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