HDK
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BRAY_Interface.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: BRAY_Interface.h (BRAY Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __BRAY_Interface__
12 #define __BRAY_Interface__
13 
14 #include "BRAY_API.h"
15 #include <UT/UT_Array.h>
16 #include <UT/UT_StringHolder.h>
17 #include <UT/UT_StringArray.h>
18 #include <UT/UT_NonCopyable.h>
19 #include <UT/UT_Options.h>
20 #include <UT/UT_SharedPtr.h>
21 #include <UT/UT_IntrusivePtr.h>
22 #include <UT/UT_UniquePtr.h>
23 #include <UT/UT_Rect.h>
24 #include <UT/UT_Set.h>
25 #include <UT/UT_Map.h>
26 #include <UT/UT_VectorTypes.h>
27 #include <GT/GT_Handles.h>
28 #include <GT/GT_DataArray.h>
29 #include <PXL/PXL_Common.h>
30 #include "BRAY_Types.h"
31 #include "BRAY_Stats.h"
32 
33 // Classes referenced by the interface
34 class BRAY_Procedural;
36 class BRAY_AOVBuffer;
37 class BRAY_Camera;
38 class BRAY_Object;
39 class BRAY_Renderer;
40 class BRAY_Light;
41 class BRAY_Scene;
42 class BRAY_ShaderGraph;
43 class BRAY_ShaderInstance;
44 class BRAY_VexMaterial;
45 class VPRM_Space;
46 class VPRM_OptionSet;
47 class UT_JSONWriter;
48 class UT_JSONValue;
49 
52 
53 namespace BRAY
54 {
55 
56 class InstancablePtr;
57 class CameraPtr;
58 class CoordSysPtr;
59 class LightPtr;
60 class LightInstancer;
61 class LightInstancerPtr;
62 class MaterialPtr;
63 class ObjectPtr;
64 class RendererPtr;
65 class ScenePtr;
66 class ShaderGraphPtr;
67 
69 {
70 public:
71  enum class MBStyle
72  {
73  MB_LINEAR,
74  MB_ROTATE,
75  };
76  SpacePtr();
77  SpacePtr(const VPRM_SpacePtr &s);
78  SpacePtr(const SpacePtr &s);
79  SpacePtr(const UT_Matrix4D &xforms);
80  SpacePtr(const UT_Matrix4D *xforms, size_t num_motion_segments,
81  MBStyle style);
82  ~SpacePtr();
83  SpacePtr &operator=(const SpacePtr &s);
84 
85  /// @{
86  /// Private access
87  bool isValid() const { return mySpace.get() != nullptr; }
88  VPRM_SpacePtr &space() { return mySpace; }
89  const VPRM_SpacePtr &space() const { return mySpace; }
90  /// @}
91  /// Bool operator to test validity of pointer
92  SYS_SAFE_BOOL operator bool() const { return isValid(); }
93 
94  /// Multiply by the given space (i.e. this * sp)
95  SpacePtr mulSpace(const SpacePtr &sp) const;
96 
97  /// Return the number of motion segments
98  int motionSegments() const;
99  UT_Matrix4D getTransform(int segment) const;
100  void getTransform(UT_Matrix4D &x, BRAYtime shutter) const;
101  void dump() const;
102  void dump(UT_JSONWriter &w) const;
103 private:
104  VPRM_SpacePtr mySpace;
105 };
106 
107 /// The OptionSet acts as a pointer to an underlying set of options for various
108 /// different object types.
110 {
111 public:
112  OptionSet();
113  /// The copy c-tor will copy the underlying pointer, but refer to the same
114  /// underlying object.
115  OptionSet(const OptionSet &src);
116  explicit OptionSet(const VPRM_OptionSetPtr &o);
117  ~OptionSet();
118 
119  /// The assignment operator will change the pointer to the underlying
120  /// object. Both OptionSets will point to the same underlying object.
121  OptionSet &operator=(const OptionSet &o);
122 
123  /// This will create a new OptionSet, inheriting state information from the
124  /// this option set. Note that changing values in the this set @b may
125  /// result in unexpected changes in the new option set.
126  OptionSet duplicate() const;
127 
128  /// Returns true if property can be erased to revert back to default value.
129  /// If the options aren't inherited (i.e. offline render), it cannot be
130  /// erased.
131  bool canErase(int token) const;
132 
133  /// Erase properties
134  void erase(const UT_Set<int> &tokens);
135 
136  /// @{
137  /// Private access
138  bool isValid() const { return myOptions.get() != nullptr; }
139  VPRM_OptionSetPtr &options() { return myOptions; }
140  const VPRM_OptionSetPtr &options() const { return myOptions; }
141  /// @}
142  /// Bool operator to test validity of pointer
143  SYS_SAFE_BOOL operator bool() const { return isValid(); }
144 
145  /// Return the number of pre-defined properties in the option set
146  exint numProperties() const;
147 
148  /// Return the name associated with a given option (i.e. dicingquality)
149  const UT_StringHolder &name(int token) const;
150 
151  /// Return the fully qualified name (i.e. karma::object::dicingquality)
152  UT_StringHolder fullName(int token) const;
153 
154  /// Return the token associated with a given name (or -1 if invalid)
155  int find(const UT_StringRef &name) const;
156 
157  /// Import a property value. Method is specialized for T in:
158  /// - bool
159  /// - int32/int64
160  /// - fpreal32/fpreal64
161  /// - UT_StringHolder
162  template <typename T>
163  const T *import(int token, T *val, size_t n) const;
164 
165  /// Interface to set an property. This template class is specialized for:
166  /// - bool
167  /// - int32
168  /// - int64
169  /// - fpreal32
170  /// - fpreal64
171  /// - UT_StringHolder
172  template <typename T>
173  bool set(int token, const T *value, exint tuple_size);
174 
175  /// Simple interface to set a scalar property
176  template <typename T>
177  SYS_FORCE_INLINE bool set(int token, const T &value)
178  {
179  return set(token, &value, 1);
180  }
181 
182  /// Test whether a value is the same as the current property
183  template <typename T>
184  bool isEqual(int token, const T *value, exint tuple_size) const;
185 
186  /// Simple interface for equality of a scalar value.
187  template <typename T>
188  SYS_FORCE_INLINE bool isEqual(int token, const T &value) const
189  {
190  return isEqual(token, &value, 1);
191  }
192 
193  /// Test whether an option has variadic arguments
194  bool isVariadic(int token) const;
195 
196  /// Return the size of an option. This can be used for variadics
197  exint size(int token) const;
198 
199  /// Return the storage of an option. This will only be one of:
200  /// - GT_STORE_INVALID
201  /// - GT_STORE_UINT8 (for bool storage)
202  /// - GT_STORE_INT64
203  /// - GT_STORE_REAL64
204  /// - GT_STORE_STRING
205  GT_Storage storage(int token) const;
206 
207  /// @{
208  /// Direct access to internal option data. There are no checks on these
209  /// methods
210  const bool *bval(int token) const;
211  const int64 *ival(int token) const;
212  const fpreal64 *fval(int token) const;
213  const UT_StringHolder *sval(int token) const;
214  /// @}
215 
216  /// @private Debug the options (only available in debug builds)
217  void dump(UT_JSONWriter &w) const;
218 
219 private:
220  VPRM_OptionSetPtr myOptions;
221 };
222 
223 /// When defining materials for face sets, the material specification is
224 /// given by a pair of the @c MaterialPtr and an array of integers. The
225 /// integers specify the list of faces to material and must appear in
226 /// sorted order (smallest to largest).
227 /// Interface to the scene manager
229 {
230 public:
231  ScenePtr() = default;
232  ~ScenePtr();
233 
234  /// Allocate a new scene
235  static ScenePtr allocScene();
236 
237  /// Force an exit when there's a failed license check failure. The normal
238  /// behaviour is to render a black image.
239  static void setExitOnFailedLicense(bool state=true);
240 
241  /// Check to see whether a rendering engine is supported
242  static bool isEngineSupported(const UT_StringRef &name);
243 
244  /// convenience methods to determine which renderer is active (tests
245  /// the value of the BRAY_OPT_DELEGATE option)
246  bool isKarmaCPU() const;
247  bool isKarmaXPU() const;
248 
249  /// Start edits/loading of the scene
250  void startEdits(BRAY::RendererPtr &renderer);
251 
252  /// Test validity
253  bool isValid() const { return myScene.get() != nullptr; }
254 
255  /// Test whether the scene is thread-safe
256  bool threadSafe() const;
257 
258  /// Test whether the renderer supports nested instancing
259  bool nestedInstancing() const;
260 
261  /// Update an object in the scene
262  void updateObject(const ObjectPtr &ptr, BRAY_EventType event);
263 
264  /// Update light object in the scene
265  void updateLight(const LightPtr &ptr, BRAY_EventType event);
266 
267  /// Update camera object in the scene
268  void updateCamera(const CameraPtr &ptr, BRAY_EventType event);
269 
270  /// Update material object in the scene
271  void updateMaterial(const MaterialPtr &ptr, BRAY_EventType event);
272 
273  /// Update coord sys object
274  void updateCoordSys(const CoordSysPtr &ptr, BRAY_EventType event);
275 
276  /// @{
277  /// Set the unit scale for the scene - this is in meters/unit. For
278  /// example, centimeters would be 0.01.
279  void setSceneUnits(fpreal64 units);
280  fpreal64 sceneUnits() const;
281  /// @}
282 
283  /// Forcibly save checkpoint as soon as possible (if checkpointing is enabled)
284  void saveCheckpointASAP();
285 
286  /// Set camera ray visibility. The mask should be a combination of
287  /// - BRAY_RAY_CAMERA
288  /// - BRAY_PROXY_CAMERA
289  /// - BRAY_GUIDE_CAMERA
290  /// For example, (BRAY_RAY_CAMERA|BRAY_GUIDE_CAMERA) will cause guide and
291  /// renderable object to be visible to camera rays, but not proxy objects
292  void setCameraRayMask(BRAY_RayVisibility mask);
293 
294  /// Set shadow ray visibility. The mask should be a combination of
295  /// - BRAY_RAY_SHADOW
296  /// - BRAY_PROXY_SHADOW
297  /// - BRAY_GUIDE_SHADOW
298  /// For example, (BRAY_RAY_SHADOW|BRAY_PROXY_SHADOW) will cause proxy and
299  /// renderable object to cast shadows, but not GUIDE objects.
300  void setShadowRayMask(BRAY_RayVisibility mask);
301 
302  /// Force redicing of displacement and subd surfaces on the next render.
303  /// This will only take effect on the next call to beginRender().
304  void forceRedice();
305 
306  /// @{
307  /// Private access to the underling scene
308  SYS_SAFE_BOOL operator bool() const { return isValid(); }
309  const BRAY_Scene *scenePtr() const { return myScene.get(); }
310  BRAY_Scene *scenePtr() { return myScene.get(); }
311  /// @}
312 
313  /// After changing any options, must commit prior to rendering
314  void commitOptions();
315 
316  /// @{
317  /// Grab a copy of the current scene options
318  OptionSet sceneOptions();
319  const OptionSet constSceneOptions() const;
320  /// @}
321 
322  /// @{
323  /// Grab a copy of the current object properties.
324  OptionSet objectProperties();
325  const OptionSet constObjectProperties() const;
326  /// @}
327 
328  /// @{
329  /// Grab a copy of the current light properties
330  OptionSet lightProperties();
331  const OptionSet constLightProperties() const;
332 
333  /// @{
334  /// Grab a copy of the current camera properties
335  OptionSet cameraProperties();
336  const OptionSet constCameraProperties() const;
337  /// @}
338 
339  /// Grab a copy of the current image plane properties
340  OptionSet planeProperties();
341  const OptionSet constPlaneProperties() const;
342  /// @}
343 
344  /// Grab a the default properties for a given type. Changing their values
345  /// will cause all future objects created to inherit the new values.
346  OptionSet defaultProperties(BRAY_PropertyType type) const;
347 
348  /// @{
349  /// Convenience methods to look up scene and scene options.
350  /// Get an scene option value.
351  template <typename T>
353  T *val, size_t n) const
354  {
355  return constSceneOptions().import(token, val, n);
356  }
357 
358  /// Interface to set an option. This template class is specialized for:
359  template <typename T>
361  const T *value,
362  exint tuple_size)
363  {
364  return sceneOptions().set(token, value, tuple_size);
365  }
366 
367  /// Simple interface to set a scalar option
368  template <typename T>
369  SYS_FORCE_INLINE bool
371  {
372  return setOption(token, &value, 1);
373  }
374 
375  /// Return the size of an option. This can be used for variadics
376  /// (e.g. shading quality will be 1)
378  {
379  return constSceneOptions().size(token);
380  }
381 
382  /// Return the storage class of an option.
385  {
386  return constSceneOptions().storage(token);
387  }
388 
389  /// Return whether an option has variadic arguments
390  SYS_FORCE_INLINE bool
392  {
393  return constSceneOptions().isVariadic(token);
394  }
396  { return *constSceneOptions().bval(t); }
398  { return *constSceneOptions().ival(t); }
400  { return *constSceneOptions().fval(t); }
402  { return *constSceneOptions().sval(t); }
403  /// @}
404 
405  /// @{
406  /// Convenience methods to look up object properties.
407  /// Get an object property value.
408  template <typename T>
410  T *val, size_t n) const
411  {
412  return constObjectProperties().import(token, val, n);
413  }
414 
415  /// Interface to set an property. This template class is specialized for:
416  template <typename T>
418  const T *value,
419  exint tuple_size)
420  {
421  return objectProperties().set(token, value, tuple_size);
422  }
423 
424  /// Locking the object property prevents any overriding of the property
425  /// after the fact, essentially turning the property into a read-only
426  /// property. This method is intended to lock default properties. The
427  /// current value of the property is used as the value.
428  ///
429  /// The return value is the previous lock state of the property.
430  bool lockProperty(BRAY_ObjectProperty token, bool state);
431 
432  /// Lock properties based on a string pattern of parameter names. This
433  /// method returns the number of properties modified.
434  exint lockProperties(const char *pattern, bool state);
435 
436  /// Lock or unlock all object properties.
438  { return lockProperties("*", state); }
439 
440  /// Simple interface to set a scalar property
441  template <typename T>
442  SYS_FORCE_INLINE bool
444  {
445  return setProperty(token, &value, 1);
446  }
447 
448  /// Return the size of an option. This can be used for variadics
449  /// (e.g. shading quality will be 1)
451  {
452  return constObjectProperties().size(token);
453  }
454 
455  /// Return the storage class of an option.
458  {
459  return constObjectProperties().storage(token);
460  }
461 
462  /// Return whether an property has variadic arguments
463  SYS_FORCE_INLINE bool
465  {
466  return constObjectProperties().isVariadic(token);
467  }
469  { return *constObjectProperties().bval(t); }
471  { return *constObjectProperties().ival(t); }
473  { return *constObjectProperties().fval(t); }
475  { return *constObjectProperties().sval(t); }
476  /// @}
477 
478  /// Create a light
479  LightPtr createLight(const UT_StringHolder &name);
480 
481  /// Create a detached light, which is not added to the scene
482  LightPtr createDetachedLight(const UT_StringHolder &name);
483 
484  /// Create a camera
485  CameraPtr createCamera(const UT_StringHolder &name);
486 
487  /// Create a coordinate system
488  CoordSysPtr createCoordSys(const UT_StringHolder &name);
489 
490  /// Create a material
491  MaterialPtr createMaterial(const UT_StringHolder &name);
492 
493  /// Create an object given a GT_Primitive handle.
494  /// At the current time, the only classes supported are:
495  /// - GT_PrimPolygonMesh
496  /// - GT_PrimSubdivisionMesh
497  /// - GT_PrimCurveMesh
498  /// - GT_PrimPointMesh
499  /// The method will return a nullptr if it can't create a primitive
500  ObjectPtr createGeometry(const GT_PrimitiveHandle &prim);
501 
502  /// For polygonal meshes, use this to create geometry to handle holes
503  ObjectPtr createGeometry(const GT_PrimitiveHandle &prim,
504  const GT_DataArrayHandle &holes);
505 
506  /// Create a volume given its detail attribute and the names and
507  /// GT_PrimitiveHandles of the corresponding fields in the volume
508  ObjectPtr createVolume(const UT_StringHolder &name);
509 
510  /// Create an instance of an object (not a light)
512  const UT_StringHolder &name);
513 
514  /// Create a nested scene graph
515  ObjectPtr createScene();
516 
517  /// Create a light instancer
518  LightInstancerPtr createLightInstancer(const UT_StringHolder &name);
519 
520  /// Create a procedural object.
521  /// Ownership of the procedural is passed to the object.
522  ObjectPtr createProcedural(UT_UniquePtr<BRAY_Procedural> proc);
523 
524  /// Find a material.
525  MaterialPtr findMaterial(const UT_StringRef &name) const;
526 
527  /// Destroy/Delete a material (returns false if material wasn't found)
528  bool destroyMaterial(const UT_StringRef &name);
529 
530  /// Add traceset name to global list (categories on objects that do not
531  /// belong to this list will be ignored)
532  /// Returns true if added, false if already exists.
533  bool addTraceset(const UT_StringHolder &name);
534 
535  /// Check to see if a traceset exists.
536  bool isTraceset(const UT_StringHolder &name);
537 
538  /// Create a shader nodegraph
539  ShaderGraphPtr createShaderGraph(const UT_StringHolder &name);
540 
541  /// Load an HDA to define shader code. Not all applications support this
542  /// feature.
543  bool loadHDA(const char *path);
544 
545 private:
546  UT_SharedPtr<BRAY_Scene> myScene;
547 };
548 
549 /// Input connector for materials. This defines the name of the geometry
550 /// attribute (@c myInputName) to bind to the VEX shader parameter (@c myParmName)
552 {
553  enum class Storage
554  {
555  FLOAT,
556  INTEGER,
557  STRING
558  };
560  const UT_StringHolder &shader_parm,
561  Storage store,
562  int tsize,
563  bool is_array)
564  : myGeometry(primvar)
565  , myParmName(shader_parm)
566  , myStorage(store)
567  , myTupleSize(tsize)
568  , myIsArray(is_array)
569  {
570  }
571 
572  UT_StringHolder myGeometry; // Input name (primvar name)
573  UT_StringHolder myParmName; // Parameter Name (VEX parameter name)
574  Storage myStorage; // Base storage type
575  int myTupleSize; // Element tuple size
576  bool myIsArray; // Whether parameter is an array
577 };
578 
580 
581 /// Interface to scene materials
583 {
584 public:
585  MaterialPtr(BRAY_VexMaterial *mat = nullptr)
586  : myMat(mat)
587  {
588  }
590 
591  bool isValid() const { return myMat != nullptr; }
592 
593  /// @{
594  /// Access to the underling material
595  SYS_SAFE_BOOL operator bool() const { return isValid(); }
596  const BRAY_VexMaterial *materialPtr() const { return myMat; }
597  /// @}
598 
599  /// Update the surface shader and arguments
600  void updateSurface(const ScenePtr &scene,
601  const UT_StringArray &arguments);
602  /// Update the displacement shader and arguments
603  /// Returns true if arguments changed.
604  bool updateDisplace(ScenePtr &scene,
605  const UT_StringArray &arguments);
606  /// Update the lens shader and arguments
607  void updateLens(const ScenePtr &scene,
608  const UT_StringArray &arguments);
609 
610  /// Update surface shader VEX code. The @c preload flag is used when other
611  /// shaders in the network might depend on the code being updated.
612  void updateSurfaceCode(const ScenePtr &scene,
613  const UT_StringHolder &name,
614  const UT_StringRef &code,
615  bool preload=false);
616  /// Update displacement shader VEX code The @c preload flag is used when
617  /// other shaders in the network might depend on the code being updated.
618  /// Returns true if the name or the code changed.
619  bool updateDisplaceCode(const ScenePtr &scene,
620  const UT_StringHolder &name,
621  const UT_StringRef &code,
622  bool preload=false);
623  /// Update surface shader VEX code. The @c preload flag is used when other
624  /// shaders in the network might depend on the code being updated.
625  void updateLensCode(const ScenePtr &scene,
626  const UT_StringHolder &name,
627  const UT_StringRef &code,
628  bool preload=false);
629 
630  /// Update the surface shader graph
631  void updateSurfaceGraph(const ScenePtr &scene,
632  const UT_StringHolder &name,
633  const ShaderGraphPtr &graphptr);
634  /// Update the displacement shader graph
635  /// Returns true if the name or the code changed.
636  bool updateDisplaceGraph(ScenePtr &scene,
637  const UT_StringHolder &name,
638  const ShaderGraphPtr &graphptr);
639  /// Update the lens shader graph
640  void updateLensGraph(const ScenePtr &scene,
641  const UT_StringHolder &name,
642  const ShaderGraphPtr &graphptr);
643 
644  /// Set the material input list
645  void setInputs(const ScenePtr &scene,
646  const MaterialInputList &inputs,
647  bool for_surface);
648 
649  /// Set the mapping for transform space aliases. This allows shaders to
650  /// reference a simple space name rather than the fully qualified path to
651  /// the space (e.g. "paintSpace" instead of "/World/Obj/PaintObj/Xform")
652  void setCoordSysAliases(const ScenePtr &scene,
654 
655 private:
656  BRAY_VexMaterial *myMat;
657 };
658 
660 {
662  const MaterialPtr &material = MaterialPtr())
663  : myFaceList(facelist)
664  , myMaterial(material)
665  {
666  }
669 };
670 
671 enum class InstancableType
672 {
673  Object,
674  Light,
676 };
677 
678 /// Pure virtual class which can be either:
679 /// ObjectPtr
680 /// LightPtr
681 /// LightInstancerPtr
682 /// use isA and dyn_cast to find out the type
684 {
685 public:
687  : myType(type)
688  {
689  }
690  virtual ~InstancablePtr() = 0;
691 
693  {
694  return myType;
695  }
696 
697 private:
698  InstancableType myType;
699 };
700 
701 /// Casting operators inspired by LLVM:@n
702 /// isA<> checks the type of the object (but no nullptr check).
703 template <typename X> SYS_FORCE_INLINE bool
705 {
706  UT_ASSERT(o && "isA<> called with nullptr - use isAValid<>");
707  return X::classof(o);
708 }
709 
710 /// Casting operators inspired by LLVM:@n
711 /// isAValid<> checks the pointer is not a nullptr and is the given type.
712 template <typename X> SYS_FORCE_INLINE bool
714 {
715  return o && X::classof(o);
716 }
717 
718 /// Casting operators inspired by LLVM:@n
719 /// cast<> is a static cast with an assert.
720 template <typename X> SYS_FORCE_INLINE const X *
722 {
723  UT_ASSERT(o && isA<X>(o));
724  return static_cast<const X *>(o);
725 }
726 
727 /// Casting operators inspired by LLVM:@n
728 /// cast<> is a static cast with an assert.
729 template <typename X> SYS_FORCE_INLINE X *
731 {
732  UT_ASSERT(o && isA<X>(o));
733  return static_cast<X *>(o);
734 }
735 
736 /// @{
737 /// Casting operators inspired by LLVM:@n
738 /// dyn_cast<> is a fast dynamic cast.
739 template <typename X> SYS_FORCE_INLINE const X *
741 {
742  return isAValid<X>(o) ? static_cast<const X *>(o) : nullptr;
743 }
744 template <typename X> SYS_FORCE_INLINE const X *
746 {
747  return isA<X>(&o) ? static_cast<const X *>(&o) : nullptr;
748 }
749 template <typename X> SYS_FORCE_INLINE X *
751 {
752  return isAValid<X>(o) ? static_cast<X *>(o) : nullptr;
753 }
754 template <typename X> SYS_FORCE_INLINE X *
756 {
757  return isA<X>(&o) ? static_cast<X *>(&o) : nullptr;
758 }
759 /// @}
760 
762 {
763 public:
766  {
767  }
768  ~ObjectPtr() override;
769 
770  /// Test if Instancable is of this type
772  {
774  }
775 
776  /// Test validity
777  bool isValid() const { return myObject != nullptr; }
778 
779  /// Query if object is a leaf node (ie not scenegraph or instance)
780  bool isLeaf() const;
781 
782  /// @{
783  /// Access to the underlying object
784  SYS_SAFE_BOOL operator bool() const { return isValid(); }
785  const BRAY_Object *objectPtr() const { return myObject.get(); }
786  BRAY_Object *objectPtr() { return myObject.get(); }
787  /// @}
788 
789  /// Bind a material to the object. The method will fail if the underlying
790  /// object cannot set the material.
791  bool setMaterial(ScenePtr &scene,
792  const MaterialPtr &mat,
793  const OptionSet &opts,
794  exint nfacesets=0,
795  const FacesetMaterial *faceset_mat=nullptr);
796 
797  /// Set the prototype for an instance object
798  void setInstancePrototype(const ObjectPtr &proto);
799 
800  /// Set the transform on the instance
801  void setInstanceTransforms(ScenePtr &scene,
802  const UT_Array<SpacePtr> &xforms);
803 
804  /// Set attributes on instances
805  void setInstanceAttributes(const ScenePtr &scene,
806  const GT_AttributeListHandle &alist);
807 
808  /// Set property overrides for instances. The array must have an entry for
809  /// every instance. It's possible to have default options. Each
810  /// attribute's name should match an object property name. Warnings will
811  /// be output if an attribute doesn't match.
812  void setInstanceProperties(const ScenePtr &scene,
813  const GT_AttributeListHandle &alist);
814 
815  /// Set instance IDs. If not set (or given an empty array), it is assumed
816  /// that the ids are contiguous 0...N-1 where N is the number of xforms.
817  void setInstanceIds(UT_Array<exint> ids);
818 
819  /// Add an object to a scene
820  void addInstanceToScene(ObjectPtr &obj);
821 
822  /// Check to make sure that number of xforms, attribute list, ids all match
823  bool validateInstance() const;
824 
825  /// @{
826  /// This will return the object's base properties, or the scene defaults if
827  /// the object isn't defined yet.
828  OptionSet objectProperties(ScenePtr &scene);
829  const OptionSet objectProperties(const ScenePtr &scene) const;
830  /// @}
831 
832  /// Get the underlying GT_PrimitiveHandle (if possible). This method may
833  /// return a nullptr.
834  GT_PrimitiveHandle geometry() const;
835 
836  /// Pointer to the contained procedural. This may return a nullptr.
837  BRAY_Procedural *procedural();
838 
839  /// Update the geometry for the object. The method will fail if you're
840  /// trying to change the underlying primitive type.
841  bool setGeometry(const ScenePtr &scene,
842  const GT_PrimitiveHandle &prim);
843 
844  /// Set the list of "holes" for a polygon mesh (subdivision meshes have the
845  /// list of holes specified in the subdivision tags).
846  bool setGeometry(const ScenePtr &scene,
847  const GT_PrimitiveHandle &prim,
848  const GT_DataArrayHandle &holes);
849 
850  /// Update volume fields. This method will fail if the underlying
851  /// primitive isn't a volume (see createVolume())
852  /// Extents are unused for ordinary voxel-based volumes since the bounds
853  /// are computed from field data and velocity blur.
855  bool setVolume(const ScenePtr &scene,
856  const GT_AttributeListHandle &clist,
857  const FieldList& fields,
858  const UT_BoundingBox &extent);
859 
860  /// Return the detail attributes for a volume primitive
861  const GT_AttributeListHandle &volumeDetailAttributes() const;
862 
863  /// TODO: Deprecate this
864  void takeOwnership(BRAY_Object *obj);
865 
866 protected:
868  friend class ScenePtr;
869 };
870 
872 {
873 public:
876  myLight(lp)
877  {
878  }
879  ~LightPtr() override;
880 
881  /// Test if Instancable is of this type
883  {
885  }
886 
887  /// Test validity
888  bool isValid() const { return myLight != nullptr; }
889 
890  /// @{
891  /// Access to the underlying object
892  SYS_SAFE_BOOL operator bool() const { return isValid(); }
893  const BRAY_Light *lightPtr() const { return myLight.get(); }
894  BRAY_Light *lightPtr() { return myLight.get(); }
895  /// @}
896 
897  /// Return the type of light
898  BRAY_LightType type() const;
899 
900  /// Return the name of the light
901  const UT_StringHolder &name() const;
902 
903  /// Return the transform of the light
904  SpacePtr transform() const;
905 
906  /// Set the transform of the light
907  void setTransform(const SpacePtr &xforms);
908 
909  /// Set the shader for the light
910  void setShader(const ScenePtr &scene, const UT_StringArray &args);
911 
912  /// Get the current object properties for modification.
913  OptionSet objectProperties();
914 
915  /// Set the object properties
916  void setObjectProperties(const OptionSet &oprops);
917 
918  /// Get the current light properties for modification.
919  OptionSet lightProperties();
920 
921  /// Set the light properties
922  void setLightProperties(const OptionSet &lprops);
923 
924  /// After changing any options, must lock prior to rendering
925  void commitOptions(ScenePtr &scene);
926 
927  /// Update the light shader graph
928  void updateShaderGraph(const ScenePtr &scene,
929  const ShaderGraphPtr &graphptr,
930  const UT_Array<ShaderGraphPtr> &light_filters);
931 
932  /// If a light filter has been modified, this method should be called to
933  /// notify the light. The set should contain the names of the dirty light
934  /// filter shader graphs.
935  void updateFilters(const ScenePtr &scene,
936  const UT_Array<ShaderGraphPtr> &filters);
937 
938  /// Notify the light that a filter has been deleted
939  void eraseFilter(const ScenePtr &scene,
940  const UT_StringRef &shader_graph_name);
941 
942 protected:
944 private:
945  friend class LightInstancer;
946 };
947 
949 {
950 public:
953  myInstancer(p)
954  {
955  }
956  ~LightInstancerPtr() override;
957 
958  /// Test if Instancable is of this type
960  {
962  }
963 
964  // Test validity
965  bool isValid() const { return myInstancer != nullptr; }
966 
967  /// Convenient validity testing
968  SYS_SAFE_BOOL operator bool() const { return isValid(); }
969 
970  /// Return the name of the instancer
971  const UT_StringHolder &name() const;
972 
973  /// Set the instance transforms
974  void setInstanceTransforms(ScenePtr &scene,
975  const UT_Array<SpacePtr> &xforms);
976 
977  /// Set the instance properties
978  void setInstanceProperties(ScenePtr &scene,
979  const GT_AttributeListHandle &alist);
980 
981  /// Add a light prototype for instancing
982  /// If a light prototype with the same name exists,
983  /// the new prototype is not added, but the instances
984  /// belonging to that name are updated on the next commit
985  void addPrototype(ScenePtr &scene,
986  const LightPtr &light);
987 
988  /// Add a light instancer prototype for instancing
989  /// If a light prototype with the same name exists,
990  /// the new prototype is not added, but the instances
991  /// belonging to that name are updated on the next commit
992  void addPrototype(ScenePtr &scene,
993  const LightInstancerPtr &inst);
994 
995  /// Commit the current prototypes to the scene
996  void commit(ScenePtr &scene);
997 
998  /// Clear all instances from the Scene
999  void clear(ScenePtr &scene);
1000 
1001 protected:
1003 private:
1004  friend class LightInstancer;
1005 };
1006 
1008 {
1009 public:
1011  : myCamera(cp)
1012  {
1013  }
1014  ~CameraPtr();
1015 
1016  /// Test validity
1017  bool isValid() const { return myCamera != nullptr; }
1018 
1019  /// @{
1020  /// Access to the underlying object
1021  SYS_SAFE_BOOL operator bool() const { return isValid(); }
1022  const BRAY_Camera *cameraPtr() const { return myCamera.get(); }
1023  BRAY_Camera *cameraPtr() { return myCamera.get(); }
1024  /// @}
1025 
1026  /// Set the transform on the camera
1027  void setTransform(ScenePtr &ptr, const SpacePtr &xforms);
1028 
1029  /// Set the lens shader for the camera
1030  void setShader(const ScenePtr &scene, const UT_StringArray &args);
1031 
1032  /// Set the lens shader material for the camera
1033  void setShaderMaterial(const ScenePtr &scene,
1034  const MaterialPtr &mat);
1035 
1036  /// Get the current object properties for modification.
1037  OptionSet objectProperties();
1038 
1039  /// Set number of motion samples for animated camera properties (1 upon
1040  /// construction). The last motion sample is assumed to have time offset of
1041  /// 1.0. (eg. if there are 3 samples, the time offsets are: 0, 0.5, 1.0)
1042  void resizeCameraProperties(int nseg);
1043 
1044  /// Get the current camera properties for modification.
1045  UT_Array<OptionSet> cameraProperties();
1046 
1047  /// After changing any options, must lock prior to rendering
1048  void commitOptions(ScenePtr &scene);
1049 
1050 protected:
1052 
1053 };
1054 
1056 {
1057 public:
1059  : mySpace(sp)
1060  {
1061  }
1062  ~CoordSysPtr();
1063 
1064  /// Test validity
1065  bool isValid() const { return mySpace != nullptr; }
1066 
1067 
1068  /// @{
1069  /// Access to underlying object
1070  SYS_SAFE_BOOL operator bool() const { return isValid(); }
1071  const BRAY_Camera *spacePtr() const { return mySpace.get(); }
1072  BRAY_Camera *spacePtr() { return mySpace.get(); }
1073  /// @}
1074 
1075  const UT_StringHolder &name() const;
1076 
1077  /// Set transform
1078  void setTransform(ScenePtr &scn, const SpacePtr &xforms);
1079 
1080  /// The current object properties for modification (primarily for motion
1081  /// blur settings)
1082  OptionSet objectProperties();
1083 
1084  /// When a transform space has camera properties (for projection spaces),
1085  /// it's possible the projection can be motion blurred. This allows you to
1086  /// specify the motion segments for properties.
1087  void resizeCameraProperties(int nseg);
1088 
1089  /// Get the current camera properties for modification
1090  UT_Array<OptionSet> cameraProperties();
1091 
1092  /// After changing options, make sure to commit
1093  void commit(ScenePtr &scene);
1094 
1095 private:
1096  UT_SharedPtr<BRAY_Camera> mySpace;
1097 };
1098 
1100 {
1101 public:
1102  AOVBufferPtr() = default;
1103 
1105  : myAOVBuffer(aov)
1106  {}
1107 
1109 
1110  bool operator==(const AOVBufferPtr &aov) const
1111  { return aov.myAOVBuffer == myAOVBuffer; }
1112  bool operator!=(const AOVBufferPtr &aov) const
1113  { return !(*this == aov); }
1114 
1115  const UT_StringHolder &getName() const;
1116  const UT_StringHolder &getVariable() const;
1117 
1118  int getXres() const;
1119  int getYres() const;
1120  PXL_DataFormat getFormat() const;
1121  PXL_Packing getPacking() const;
1122  float getDefaultValue() const;
1123 
1124  void *map();
1125  void unmap();
1126  bool isMapped() const;
1127 
1128  // For extra channels
1129  int getNumExtra() const;
1130  const UT_StringHolder &nameExtra(int idx) const;
1131  PXL_DataFormat getFormatExtra(int idx) const;
1132  PXL_Packing getPackingExtra(int idx) const;
1133  void *mapExtra(int idx);
1134  void unmapExtra(int idx);
1135 
1136  // metadata to write to header of output file
1137  const UT_Options &getMetadata() const;
1138 
1139  bool isConverged() const;
1140  void setConverged();
1141  void clearConverged();
1142 
1143  // Valid only after raster is allocated (ie render started)
1144  bool isValid() const;
1145 
1146  SYS_SAFE_BOOL operator bool() const { return isValid(); }
1147 
1148 private:
1149  UT_SharedPtr<BRAY_AOVBuffer> myAOVBuffer;
1150 };
1151 
1152 /// A render product represents an output file
1154 {
1155 public:
1156  // Test whether the type is understook by karma
1157  // For example "karma:checkpoint"
1158  static bool isKnownType(const UT_StringRef &type);
1159 
1160  // Clear all existing output files
1161  static void clearFiles(BRAY::ScenePtr &scene);
1162 
1163  struct BRAY_API AOV
1164  {
1166  : myName(name)
1167  {
1168  }
1169  /// Method is specialized for T in:
1170  /// - bool
1171  /// - int32/int64
1172  /// - fpreal32/fpreal64
1173  /// - UT_StringHolder
1174  template <typename T>
1175  bool setOption(const UT_StringHolder &name,
1176  const T *value,
1177  exint size);
1178  template <typename T>
1179  bool setOption(const UT_StringHolder &name, const T &value)
1180  { return setOption(name, &value, 1); }
1181 
1182  /// Copy over options from those passed in
1183  bool setOptions(const UT_Options &options);
1184 
1185  const UT_StringHolder &name() const { return myName; }
1186  const UT_Options &options() const { return myOptions; }
1187 
1188  /// Dump method for debugging
1189  void dump(UT_JSONWriter &w) const;
1190  private:
1191  UT_StringHolder myName;
1192  UT_Options myOptions;
1193  };
1195  const UT_StringHolder &filename,
1196  const UT_StringHolder &type)
1197  : myScene(scene)
1198  , myFilename(filename)
1199  , myType(type)
1200  {
1201  }
1202 
1204  {
1205  if (myFilename)
1206  commit();
1207  }
1208 
1209  /// @{
1210  /// Method is specialized for T in:
1211  /// - bool
1212  /// - int32/int64
1213  /// - fpreal32/fpreal64
1214  /// - UT_StringHolder
1215  template <typename T>
1216  bool setOption(const UT_StringHolder &name,
1217  const T *value,
1218  exint size);
1219  template <typename T>
1220  bool setOption(const UT_StringHolder &name, const T &value)
1221  { return setOption(name, &value, 1); }
1222  /// @}
1223 
1224  /// Copy over options from those passed in
1225  bool setOptions(const UT_Options &options);
1226 
1227  /// Add an AOV to this output file
1229  {
1230  myAOVs.emplace_back(name);
1231  return myAOVs.last();
1232  }
1233 
1234  /// Commit and add this output file to the render
1235  bool commit()
1236  {
1237  bool result = doCommit();
1238  cancel(); // Once committed, no more changes
1239  return result;
1240  }
1241  /// Cancel this output file for some reason
1242  void cancel() { myFilename.clear(); }
1243 
1244  /// Access member data
1245  const UT_StringHolder &filename() const { return myFilename; }
1246  const UT_StringHolder &type() const { return myType; }
1247  const UT_Array<AOV> &aovs() const { return myAOVs; }
1248  const UT_Options &options() const { return myOptions; }
1249 
1250  /// @{
1251  /// Dump information (used by karma:debug)
1252  void dump() const;
1253  void dump(UT_JSONWriter &w) const;
1254  /// @}
1255 
1256 private:
1257  bool doCommit();
1258  BRAY::ScenePtr &myScene;
1259  UT_StringHolder myFilename;
1260  UT_StringHolder myType;
1261  UT_Array<AOV> myAOVs;
1262  UT_Options myOptions;
1263 };
1264 
1265 
1266 /// Interface to the renderer
1268 {
1269 public:
1270  /// Class used to define image planes
1271  struct ImagePlane
1272  {
1275  int mySize;
1278  };
1279 
1280  RendererPtr() = default;
1282 
1283  /// Allocate renderer
1284  static RendererPtr allocRenderer(BRAY::ScenePtr &sceneptr);
1285 
1286  SYS_SAFE_BOOL operator bool() const { return myRenderer.get(); }
1287 
1288  /// @{
1289  /// Define image planes for rendering
1290  void clearOutputPlanes();
1291  AOVBufferPtr addOutputPlane(const ImagePlane &plane);
1292  int getAOVCount() const;
1293  /// @}
1294 
1295  /// Access the stats for this render
1296  const BRAY::Stats &stats() const;
1297 
1298  /// Call before rendering begins. This lets the renderer prepare data
1299  /// structures before render() is called. For example, this will ensure
1300  /// all AOV buffers are allocated and active. The method returns false if
1301  /// there were errors setting up the render.
1302  bool prepareRender();
1303 
1304  /// Start rendering a scene
1305  void render(bool (*stopreq)(void *) = nullptr, void *data = nullptr);
1306 
1307  /// Test to see whether the current renderer is active
1308  bool isRendering() const;
1309 
1310  /// Test to see if there was an error rendering
1311  bool isError() const;
1312 
1313  /// Test to see if the renderer is paused
1314  bool isPaused() const;
1315 
1316  /// Tells the renderer to prepare to be stopped
1317  void prepareForStop();
1318 
1319  /// Pause rendering -- Returns true if the renderer is paused
1320  bool pauseRender();
1321 
1322  /// Restart rendering -- Returns true if @c isRendering();
1323  bool resumeRender();
1324 
1325  /// Set a point in the image to give priority to rendering
1326  void setPriority(int x, int y);
1327 
1328  /// Set a region in the image which should have priority
1329  void setPriority(const UT_DimRect &region);
1330 
1331  /// Clear the priority focus
1332  void clearPriority();
1333 
1334  /// Enables image filters by the given option.
1335  /// The is_render_settings_prim indicates whether the filter
1336  /// belongs to render settings prim or the display options.
1337  bool enableImageFilters(
1338  const UT_StringHolder &filters_opt,
1339  bool is_render_settings_prim);
1340 
1341  /// Set whether to use render settings prim or display options.
1342  void setUseRenderSettingsPrim(bool use_render_settings_prim);
1343 
1344  /// JSON map containing common render product metadata from husk.
1345  void setConvergedMetadata(const UT_JSONValue &value);
1346 
1347  /// @private method
1348  BRAY_Renderer *renderer() { return myRenderer.get(); }
1349 
1350 private:
1351  UT_SharedPtr<BRAY_Renderer> myRenderer;
1352 };
1353 
1355 {
1356 public:
1358  : myGraph(graph)
1359  {}
1361 
1362  /// Make new node based on type and add to list of nodes in the current
1363  /// graph. Returns NULL if unknown type.
1364  /// Note that the root node (ie with surface/displace output) must be the
1365  /// first node added to the graph.
1366  BRAY_ShaderInstance *createNode(const UT_StringHolder &type,
1367  const UT_StringHolder &name);
1368 
1369  /// Returns OptionSet that contains input parameters for given shader node.
1370  /// Can be used to read and write values.
1371  OptionSet nodeParams(BRAY_ShaderInstance *node);
1372 
1373  /// Make connection between two nodes
1374  bool wireNodes(const UT_StringHolder &srcnode,
1375  const UT_StringHolder &srcoutput,
1376  const UT_StringHolder &dstnode,
1377  const UT_StringHolder &dstinput);
1378 
1379  // Definition of a shader node
1380  class NodeDecl
1381  : UT_NonCopyable
1382  {
1383  public:
1386  : myName(n)
1387  {
1388  }
1389 
1390  struct Parameter
1391  {
1392  UT_StringHolder myName; // Name of parameter
1393 
1394  bool isBool() const { return myType == 0; }
1395  bool isInt() const { return myType == 1; }
1396  bool isReal() const { return myType == 2; }
1397  bool isFloat() const { return myType == 2; }
1398  bool isString() const { return myType == 3; }
1399  bool isVariadic() const { return myVariadic; }
1400 
1401  exint size() const
1402  {
1403  return myB.size() + myI.size() + myF.size() + myS.size();
1404  }
1405 
1406  UT_Array<bool> myB; // Bool defaults
1407  UT_Array<int64> myI; // Integer defaults
1408  UT_Array<fpreal64> myF; // Real defaults
1409  UT_Array<UT_StringHolder> myS; // String defaults
1410  bool myVariadic; // Array valued (variadic)
1414 
1415  void dump(UT_JSONWriter &w) const;
1416  };
1417 
1418  const UT_StringHolder name() const
1419  { return myName; }
1421  { return myInputs; }
1423  { return myOutputs; }
1425  { return myMetadata; }
1426 
1428  { myName = n; }
1429  void addInput(const Parameter &parm)
1430  { myInputs.append(parm); }
1431  void addOutput(const Parameter &parm)
1432  { myOutputs.append(parm); }
1434  { myMetadata = metadata; }
1435 
1436  void dump() const;
1437  void dump(UT_JSONWriter &w) const;
1438 
1439  private:
1440  UT_StringHolder myName;
1441  UT_StringMap<UT_StringHolder> myMetadata;
1442  UT_Array<Parameter> myInputs;
1443  UT_Array<Parameter> myOutputs;
1444  };
1445 
1446  // Extract the definition of all supported nodes
1447  static const UT_Array<const NodeDecl *> &allNodes();
1448  // Find a node given the name
1449  static const NodeDecl *findNode(const UT_StringRef &name);
1450 
1451  /// Access the object properties on the shader graph. It's possible the
1452  /// shader graph has no options, so please check `isValid()`
1453  const OptionSet getObjectProperties() const;
1454  /// Create object properties for read/write
1455  OptionSet createObjectProperties(const BRAY::ScenePtr &scene);
1456  /// Clear any existing object properties
1457  void clearObjectProperties();
1458 private:
1459  friend class MaterialPtr;
1460  friend class LightPtr;
1462 };
1463 
1464 }; // End of namespace
1465 
1466 #endif
void cancel()
Cancel this output file for some reason.
BRAY_EventType
Types of events that can be sent as updates to the renderer.
Definition: BRAY_Types.h:39
AOV & appendAOV(const UT_StringHolder &name)
Add an AOV to this output file.
GT_Storage
Definition: GT_Types.h:19
static SYS_FORCE_INLINE bool classof(const InstancablePtr *o)
Test if Instancable is of this type.
UT_StringHolder optionS(BRAY_SceneOption t) const
int64 propertyI(BRAY_SceneOption t) const
GT_API const UT_StringHolder filename
const BRAY_Camera * spacePtr() const
Interface to scene materials.
const VPRM_SpacePtr & space() const
bool operator==(const AOVBufferPtr &aov) const
SYS_FORCE_INLINE const T * propertyImport(BRAY_ObjectProperty token, T *val, size_t n) const
const BRAY_Scene * scenePtr() const
bool commit()
Commit and add this output file to the render.
const BRAY_Camera * cameraPtr() const
void setName(const UT_StringHolder &n)
void addOutput(const Parameter &parm)
bool isValid() const
Test validity.
float BRAYtime
Consistent representation of time type within BRAY.
Definition: BRAY_Types.h:752
getFileOption("OpenEXR:storage") storage
Definition: HDK_Image.dox:276
VPRM_SpacePtr & space()
BRAY_Light * lightPtr()
bool operator!=(const AOVBufferPtr &aov) const
InstancablePtr(InstancableType type)
SYS_FORCE_INLINE bool isA(const InstancablePtr *o)
SYS_FORCE_INLINE bool setProperty(BRAY_ObjectProperty token, const T &value)
Simple interface to set a scalar property.
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
AOV(const UT_StringHolder &name)
UT_SharedPtr< BRAY_Light > myLight
FacesetMaterial(const GT_DataArrayHandle &facelist=GT_DataArrayHandle(), const MaterialPtr &material=MaterialPtr())
int64 exint
Definition: SYS_Types.h:125
GLdouble s
Definition: glad.h:3009
const UT_Options & options() const
const UT_StringMap< UT_StringHolder > & metadata() const
X
Definition: ImathEuler.h:183
CoordSysPtr(const UT_SharedPtr< BRAY_Camera > &sp=UT_SharedPtr< BRAY_Camera >())
const UT_Array< AOV > & aovs() const
const UT_StringHolder & name() const
SYS_FORCE_INLINE const T * optionImport(BRAY_SceneOption token, T *val, size_t n) const
const UT_StringHolder & filename() const
Access member data.
bool setOption(const UT_StringHolder &name, const T &value)
GLint y
Definition: glcorearb.h:103
UT_StringHolder myGeometry
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:37
int64 optionI(BRAY_SceneOption t) const
**But if you need a result
Definition: thread.h:613
SYS_FORCE_INLINE bool set(int token, const T &value)
Simple interface to set a scalar property.
const BRAY_Object * objectPtr() const
SYS_FORCE_INLINE exint propertySize(BRAY_ObjectProperty token) const
const UT_Array< Parameter > & inputs() const
const BRAY_Light * lightPtr() const
OutputFile(BRAY::ScenePtr &scene, const UT_StringHolder &filename, const UT_StringHolder &type)
bool isValid() const
Test validity.
CameraPtr(const UT_SharedPtr< BRAY_Camera > &cp=UT_SharedPtr< BRAY_Camera >())
static SYS_FORCE_INLINE bool classof(const InstancablePtr *o)
Test if Instancable is of this type.
IFDmantra you can see code vm_image_mplay_direction endcode When SOHO starts a render
Definition: HDK_Image.dox:266
const BRAY_VexMaterial * materialPtr() const
GLintptr GLsizeiptr GLboolean commit
Definition: glcorearb.h:3363
SYS_FORCE_INLINE bool isEqual(int token, const T &value) const
Simple interface for equality of a scalar value.
UT_StringHolder propertyS(BRAY_SceneOption t) const
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
bool isValid() const
Test validity.
struct _cl_event * event
Definition: glcorearb.h:2961
UT_StringHolder myParmName
double fpreal64
Definition: SYS_Types.h:201
SYS_FORCE_INLINE X * dyn_castValid(InstancablePtr &o)
unsigned char uint8
Definition: SYS_Types.h:36
bool propertyB(BRAY_SceneOption t) const
VPRM_OptionSetPtr & options()
const UT_StringHolder name() const
GLdouble n
Definition: glcorearb.h:2008
SYS_FORCE_INLINE const X * cast(const InstancablePtr *o)
BRAY_ObjectProperty
Definition: BRAY_Types.h:225
SYS_FORCE_INLINE GT_Storage propertyStorage(BRAY_ObjectProperty token) const
Return the storage class of an option.
UT_SharedPtr< BRAY_Camera > myCamera
BRAY_RayVisibility
Ray visibility flags.
Definition: BRAY_Types.h:797
UT_SharedPtr< BRAY_Object > myObject
#define SYS_SAFE_BOOL
Definition: SYS_Compiler.h:55
BRAY_Camera * cameraPtr()
bool isValid() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:36
BRAY_Camera * spacePtr()
UT_IntrusivePtr< GT_DataArray > GT_DataArrayHandle
Definition: GT_DataArray.h:32
SYS_FORCE_INLINE exint optionSize(BRAY_SceneOption token) const
PXL_API const char * getName(const ColorSpace *space)
Return the name of the color space.
void setMetadata(const UT_StringMap< UT_StringHolder > &metadata)
int setVolume(int speaker, float vol) override
ShaderGraphPtr(UT_SharedPtr< BRAY_ShaderGraph > graph)
bool isValid() const
static SYS_FORCE_INLINE bool classof(const InstancablePtr *o)
Test if Instancable is of this type.
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
GLint GLuint mask
Definition: glcorearb.h:124
NodeDecl(const UT_StringHolder &n)
SYS_FORCE_INLINE bool optionIsVariadic(BRAY_SceneOption token) const
Return whether an option has variadic arguments.
PXL_Packing
Definition: PXL_Common.h:32
SYS_FORCE_INLINE bool setOption(BRAY_SceneOption token, const T *value, exint tuple_size)
Interface to set an option. This template class is specialized for:
long long int64
Definition: SYS_Types.h:116
SYS_FORCE_INLINE exint lockAllObjectProperties(bool state)
Lock or unlock all object properties.
const UT_Array< Parameter > & outputs() const
bool isValid() const
Test validity.
Class used to define image planes.
GLuint const GLchar * name
Definition: glcorearb.h:786
MaterialInput(const UT_StringHolder &primvar, const UT_StringHolder &shader_parm, Storage store, int tsize, bool is_array)
PXL_DataFormat
Definition: PXL_Common.h:20
GLushort pattern
Definition: glad.h:2583
GA_API const UT_StringHolder transform
GLint GLenum GLint x
Definition: glcorearb.h:409
const UT_Options & options() const
GT_DataArrayHandle myFaceList
GLdouble t
Definition: glad.h:2397
GLfloat units
Definition: glcorearb.h:408
SYS_FORCE_INLINE bool isAValid(const InstancablePtr *o)
BRAY_LightType
Definition: BRAY_Types.h:577
SYS_FORCE_INLINE bool setOption(BRAY_SceneOption token, const T &value)
Simple interface to set a scalar option.
GLsizeiptr size
Definition: glcorearb.h:664
A map of string to various well defined value types.
Definition: UT_Options.h:84
A render product represents an output file.
BRAY_SceneOption
Definition: BRAY_Types.h:66
bool isValid() const
fpreal64 optionF(BRAY_SceneOption t) const
UT_SharedPtr< LightInstancer > myInstancer
MaterialPtr(BRAY_VexMaterial *mat=nullptr)
LeafData & operator=(const LeafData &)=delete
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE Result createInstance(const VULKAN_HPP_NAMESPACE::InstanceCreateInfo *pCreateInfo, const VULKAN_HPP_NAMESPACE::AllocationCallbacks *pAllocator, VULKAN_HPP_NAMESPACE::Instance *pInstance, Dispatch const &d) VULKAN_HPP_NOEXCEPT
SYS_FORCE_INLINE bool setProperty(BRAY_ObjectProperty token, const T *value, exint tuple_size)
Interface to set an property. This template class is specialized for:
AOVBufferPtr(const UT_SharedPtr< BRAY_AOVBuffer > &aov)
auto ptr(T p) -> const void *
Definition: format.h:2448
GLuint GLfloat * val
Definition: glcorearb.h:1608
SYS_FORCE_INLINE bool propertyIsVariadic(BRAY_ObjectProperty token) const
Return whether an property has variadic arguments.
#define BRAY_API
Definition: BRAY_API.h:12
bool isValid() const
Test validity.
Class to store JSON objects as C++ objects.
Definition: UT_JSONValue.h:99
**If you just want to fire and args
Definition: thread.h:609
BRAY_PropertyType
Definition: BRAY_Types.h:412
void addInput(const Parameter &parm)
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
Definition: core.h:1131
bool setOption(const UT_StringHolder &name, const T &value)
MX_GENSHADER_API const TypeDesc * INTEGER
std::shared_ptr< class ShaderMaterial > MaterialPtr
InstancableType instancableType() const
bool optionB(BRAY_SceneOption t) const
Interface to the renderer.
type
Definition: core.h:1059
const UT_StringHolder & type() const
fpreal64 propertyF(BRAY_SceneOption t) const
GLuint * ids
Definition: glcorearb.h:652
LightInstancerPtr(UT_SharedPtr< LightInstancer > p=nullptr)
SYS_FORCE_INLINE const X * dyn_cast(const InstancablePtr *o)
Definition: format.h:895
const VPRM_OptionSetPtr & options() const
BRAY_Object * objectPtr()
BRAY_Scene * scenePtr()
LightPtr(const UT_SharedPtr< BRAY_Light > &lp=UT_SharedPtr< BRAY_Light >())
SYS_FORCE_INLINE GT_Storage optionStorage(BRAY_SceneOption token) const
Return the storage class of an option.
FMT_CONSTEXPR auto find(Ptr first, Ptr last, T value, Ptr &out) -> bool
Definition: core.h:2089
GLenum src
Definition: glcorearb.h:1793