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