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  /// Return the primvars required by this material. If a @c nullptr is
674  /// returned, it means that Karma wasn't able to determine primvars and all
675  /// primvars might be required.
676  PrimvarSet primvars() const;
677 
678  /// Return the primvars used by the default material
679  static PrimvarSet defaultPrimvars();
680 
681 private:
682  BRAY_VexMaterial *myMat;
683 };
684 
686 {
688  const MaterialPtr &material = MaterialPtr())
689  : myFaceList(facelist)
690  , myMaterial(material)
691  {
692  }
695 };
696 
697 enum class InstancableType
698 {
699  Object,
700  Light,
702 };
703 
704 /// Pure virtual class which can be either:
705 /// ObjectPtr
706 /// LightPtr
707 /// LightInstancerPtr
708 /// use isA and dyn_cast to find out the type
710 {
711 public:
713  : myType(type)
714  {
715  }
716  virtual ~InstancablePtr() = 0;
717 
719  {
720  return myType;
721  }
722 
723 private:
724  InstancableType myType;
725 };
726 
727 /// Casting operators inspired by LLVM:@n
728 /// isA<> checks the type of the object (but no nullptr check).
729 template <typename X> SYS_FORCE_INLINE bool
731 {
732  UT_ASSERT(o && "isA<> called with nullptr - use isAValid<>");
733  return X::classof(o);
734 }
735 
736 /// Casting operators inspired by LLVM:@n
737 /// isAValid<> checks the pointer is not a nullptr and is the given type.
738 template <typename X> SYS_FORCE_INLINE bool
740 {
741  return o && X::classof(o);
742 }
743 
744 /// Casting operators inspired by LLVM:@n
745 /// cast<> is a static cast with an assert.
746 template <typename X> SYS_FORCE_INLINE const X *
748 {
749  UT_ASSERT(o && isA<X>(o));
750  return static_cast<const X *>(o);
751 }
752 
753 /// Casting operators inspired by LLVM:@n
754 /// cast<> is a static cast with an assert.
755 template <typename X> SYS_FORCE_INLINE X *
757 {
758  UT_ASSERT(o && isA<X>(o));
759  return static_cast<X *>(o);
760 }
761 
762 /// @{
763 /// Casting operators inspired by LLVM:@n
764 /// dyn_cast<> is a fast dynamic cast.
765 template <typename X> SYS_FORCE_INLINE const X *
767 {
768  return isAValid<X>(o) ? static_cast<const X *>(o) : nullptr;
769 }
770 template <typename X> SYS_FORCE_INLINE const X *
772 {
773  return isA<X>(&o) ? static_cast<const X *>(&o) : nullptr;
774 }
775 template <typename X> SYS_FORCE_INLINE X *
777 {
778  return isAValid<X>(o) ? static_cast<X *>(o) : nullptr;
779 }
780 template <typename X> SYS_FORCE_INLINE X *
782 {
783  return isA<X>(&o) ? static_cast<X *>(&o) : nullptr;
784 }
785 /// @}
786 
788 {
789 public:
792  {
793  }
794  ~ObjectPtr() override;
795 
796  /// Test if Instancable is of this type
798  {
800  }
801 
802  /// Test validity
803  bool isValid() const { return myObject != nullptr; }
804 
805  /// Query if object is a leaf node (ie not scenegraph or instance)
806  bool isLeaf() const;
807 
808  /// @{
809  /// Access to the underlying object
810  SYS_SAFE_BOOL operator bool() const { return isValid(); }
811  const BRAY_Object *objectPtr() const { return myObject.get(); }
812  BRAY_Object *objectPtr() { return myObject.get(); }
813  /// @}
814 
815  /// Bind a material to the object. The method will fail if the underlying
816  /// object cannot set the material.
817  bool setMaterial(ScenePtr &scene,
818  const MaterialPtr &mat,
819  const OptionSet &opts,
820  exint nfacesets=0,
821  const FacesetMaterial *faceset_mat=nullptr);
822 
823  /// Set the mapping for transform space aliases. This allows shaders to
824  /// reference a simple space name rather than the fully qualified path to
825  /// the space (e.g. "paintSpace" instead of "/World/Obj/PaintObj/Xform")
826  bool setCoordSysAliases(const ScenePtr &scene,
828 
829  /// Set the prototype for an instance object
830  void setInstancePrototype(const ObjectPtr &proto);
831 
832  /// Set the transform on the instance
833  void setInstanceTransforms(ScenePtr &scene,
834  const UT_Array<SpacePtr> &xforms);
835 
836  /// Set attributes on instances
837  void setInstanceAttributes(const ScenePtr &scene,
838  const GT_AttributeListHandle &alist);
839 
840  /// Set property overrides for instances. The array must have an entry for
841  /// every instance. It's possible to have default options. Each
842  /// attribute's name should match an object property name. Warnings will
843  /// be output if an attribute doesn't match.
844  void setInstanceProperties(const ScenePtr &scene,
845  const GT_AttributeListHandle &alist);
846 
847  /// Set instance IDs. If not set (or given an empty array), it is assumed
848  /// that the ids are contiguous 0...N-1 where N is the number of xforms.
849  void setInstanceIds(UT_Array<exint> ids);
850 
851  /// Add an object to a scene
852  void addInstanceToScene(ObjectPtr &obj);
853 
854  /// Check to make sure that number of xforms, attribute list, ids all match
855  bool validateInstance() const;
856 
857  /// @{
858  /// This will return the object's base properties, or the scene defaults if
859  /// the object isn't defined yet.
860  OptionSet objectProperties(ScenePtr &scene);
861  const OptionSet objectProperties(const ScenePtr &scene) const;
862  /// @}
863 
864  /// Get the underlying GT_PrimitiveHandle (if possible). This method may
865  /// return a nullptr.
866  GT_PrimitiveHandle geometry() const;
867 
868  /// Pointer to the contained procedural. This may return a nullptr.
869  BRAY_Procedural *procedural();
870 
871  /// Update the geometry for the object. The method will fail if you're
872  /// trying to change the underlying primitive type.
873  bool setGeometry(const ScenePtr &scene,
874  const GT_PrimitiveHandle &prim);
875 
876  /// Set the list of "holes" for a polygon mesh (subdivision meshes have the
877  /// list of holes specified in the subdivision tags).
878  bool setGeometry(const ScenePtr &scene,
879  const GT_PrimitiveHandle &prim,
880  const GT_DataArrayHandle &holes);
881 
882  /// Update volume fields. This method will fail if the underlying
883  /// primitive isn't a volume (see createVolume())
884  /// Extents are unused for ordinary voxel-based volumes since the bounds
885  /// are computed from field data and velocity blur.
887  bool setVolume(const ScenePtr &scene,
888  const GT_AttributeListHandle &clist,
889  const FieldList& fields,
890  const UT_BoundingBox &extent);
891 
892  /// Return the detail attributes for a volume primitive
893  const GT_AttributeListHandle &volumeDetailAttributes() const;
894 
895  /// TODO: Deprecate this
896  void takeOwnership(BRAY_Object *obj);
897 
898 protected:
900  friend class ScenePtr;
901 };
902 
904 {
905 public:
908  myLight(lp)
909  {
910  }
911  ~LightPtr() override;
912 
913  /// Test if Instancable is of this type
915  {
917  }
918 
919  /// Test validity
920  bool isValid() const { return myLight != nullptr; }
921 
922  /// @{
923  /// Access to the underlying object
924  SYS_SAFE_BOOL operator bool() const { return isValid(); }
925  const BRAY_Light *lightPtr() const { return myLight.get(); }
926  BRAY_Light *lightPtr() { return myLight.get(); }
927  /// @}
928 
929  /// Return the type of light
930  BRAY_LightType type() const;
931 
932  /// Return the name of the light
933  const UT_StringHolder &name() const;
934 
935  /// Return the transform of the light
936  SpacePtr transform() const;
937 
938  /// Set the transform of the light
939  void setTransform(const SpacePtr &xforms);
940 
941  /// Set the shader for the light
942  void setShader(const ScenePtr &scene, const UT_StringArray &args);
943 
944  /// Get the current object properties for modification.
945  OptionSet objectProperties();
946 
947  /// Set the object properties
948  void setObjectProperties(const OptionSet &oprops);
949 
950  /// Get the current light properties for modification.
951  OptionSet lightProperties();
952 
953  /// Set the light properties
954  void setLightProperties(const OptionSet &lprops);
955 
956  /// After changing any options, must lock prior to rendering
957  void commitOptions(ScenePtr &scene);
958 
959  /// Update the light shader graph
960  void updateShaderGraph(const ScenePtr &scene,
961  const ShaderGraphPtr &graphptr,
962  const UT_Array<ShaderGraphPtr> &light_filters);
963 
964  /// If a light filter has been modified, this method should be called to
965  /// notify the light. The set should contain the names of the dirty light
966  /// filter shader graphs.
967  void updateFilters(const ScenePtr &scene,
968  const UT_Array<ShaderGraphPtr> &filters);
969 
970  /// Notify the light that a filter has been deleted
971  void eraseFilter(const ScenePtr &scene,
972  const UT_StringRef &shader_graph_name);
973 
974  ///
975  static UT_Vector3 computeEmission(
976  const UT_Vector3& color,
977  float intensity,
978  float exposure,
979  bool enable_color_temperature,
980  float color_temperature);
981 
982 protected:
984 private:
985  friend class LightInstancer;
986 };
987 
989 {
990 public:
993  myInstancer(p)
994  {
995  }
996  ~LightInstancerPtr() override;
997 
998  /// Test if Instancable is of this type
1000  {
1002  }
1003 
1004  // Test validity
1005  bool isValid() const { return myInstancer != nullptr; }
1006 
1007  /// Convenient validity testing
1008  SYS_SAFE_BOOL operator bool() const { return isValid(); }
1009 
1010  /// Return the name of the instancer
1011  const UT_StringHolder &name() const;
1012 
1013  /// Set the instance transforms
1014  void setInstanceTransforms(ScenePtr &scene,
1015  const UT_Array<SpacePtr> &xforms);
1016 
1017  /// Set the instance properties
1018  void setInstanceProperties(ScenePtr &scene,
1019  const GT_AttributeListHandle &alist);
1020 
1021  /// Add a light prototype for instancing
1022  /// If a light prototype with the same name exists,
1023  /// the new prototype is not added, but the instances
1024  /// belonging to that name are updated on the next commit
1025  void addPrototype(ScenePtr &scene,
1026  const LightPtr &light);
1027 
1028  /// Add a light instancer prototype for instancing
1029  /// If a light prototype with the same name exists,
1030  /// the new prototype is not added, but the instances
1031  /// belonging to that name are updated on the next commit
1032  void addPrototype(ScenePtr &scene,
1033  const LightInstancerPtr &inst);
1034 
1035  /// Commit the current prototypes to the scene
1036  void commit(ScenePtr &scene);
1037 
1038  /// Clear all instances from the Scene
1039  void clear(ScenePtr &scene);
1040 
1041 protected:
1043 private:
1044  friend class LightInstancer;
1045 };
1046 
1048 {
1049 public:
1051  : myCamera(cp)
1052  {
1053  }
1054  ~CameraPtr();
1055 
1056  /// Test validity
1057  bool isValid() const { return myCamera != nullptr; }
1058 
1059  /// @{
1060  /// Access to the underlying object
1061  SYS_SAFE_BOOL operator bool() const { return isValid(); }
1062  const BRAY_Camera *cameraPtr() const { return myCamera.get(); }
1063  BRAY_Camera *cameraPtr() { return myCamera.get(); }
1064  /// @}
1065 
1066  /// Set the transform on the camera
1067  void setTransform(ScenePtr &ptr, const SpacePtr &xforms);
1068 
1069  /// Set the lens shader for the camera
1070  void setShader(const ScenePtr &scene, const UT_StringArray &args);
1071 
1072  /// Set the lens shader material for the camera
1073  void setShaderMaterial(const ScenePtr &scene,
1074  const MaterialPtr &mat);
1075 
1076  /// Get the current object properties for modification.
1077  OptionSet objectProperties();
1078 
1079  /// Set number of motion samples for animated camera properties (1 upon
1080  /// construction). The last motion sample is assumed to have time offset of
1081  /// 1.0. (eg. if there are 3 samples, the time offsets are: 0, 0.5, 1.0)
1082  void resizeCameraProperties(int nseg);
1083 
1084  /// Get the current camera properties for modification.
1085  UT_Array<OptionSet> cameraProperties();
1086 
1087  /// Clear the camera's user defined clipping planes
1088  void clearClippingPlanes();
1089 
1090  /// Add a user defined clipping plane
1091  void addClippingPlane(const UT_Vector4D *plane, int nsegments);
1092 
1093  /// After changing any options, must lock prior to rendering
1094  void commitOptions(ScenePtr &scene);
1095 
1096 protected:
1098 
1099 };
1100 
1102 {
1103 public:
1105  : mySpace(sp)
1106  {
1107  }
1108  ~CoordSysPtr();
1109 
1110  /// Test validity
1111  bool isValid() const { return mySpace != nullptr; }
1112 
1113 
1114  /// @{
1115  /// Access to underlying object
1116  SYS_SAFE_BOOL operator bool() const { return isValid(); }
1117  const BRAY_Camera *spacePtr() const { return mySpace.get(); }
1118  BRAY_Camera *spacePtr() { return mySpace.get(); }
1119  /// @}
1120 
1121  const UT_StringHolder &name() const;
1122 
1123  /// Set transform
1124  void setTransform(ScenePtr &scn, const SpacePtr &xforms);
1125 
1126  /// The current object properties for modification (primarily for motion
1127  /// blur settings)
1128  OptionSet objectProperties();
1129 
1130  /// When a transform space has camera properties (for projection spaces),
1131  /// it's possible the projection can be motion blurred. This allows you to
1132  /// specify the motion segments for properties.
1133  void resizeCameraProperties(int nseg);
1134 
1135  /// Get the current camera properties for modification
1136  UT_Array<OptionSet> cameraProperties();
1137 
1138  /// After changing options, make sure to commit
1139  void commit(ScenePtr &scene);
1140 
1141 private:
1142  UT_SharedPtr<BRAY_Camera> mySpace;
1143 };
1144 
1146 {
1147 public:
1148  AOVBufferPtr() = default;
1149 
1151  : myAOVBuffer(aov)
1152  {}
1153 
1155 
1156  bool operator==(const AOVBufferPtr &aov) const
1157  { return aov.myAOVBuffer == myAOVBuffer; }
1158  bool operator!=(const AOVBufferPtr &aov) const
1159  { return !(*this == aov); }
1160 
1161  const UT_StringHolder &getName() const;
1162  const UT_StringHolder &getVariable() const;
1163 
1164  int getXres() const;
1165  int getYres() const;
1166  PXL_DataFormat getFormat() const;
1167  PXL_Packing getPacking() const;
1168  float getDefaultValue() const;
1169 
1170  void *map();
1171  void unmap();
1172  bool isMapped() const;
1173 
1174  // For extra channels
1175  int getNumExtra() const;
1176  const UT_StringHolder &nameExtra(int idx) const;
1177  PXL_DataFormat getFormatExtra(int idx) const;
1178  PXL_Packing getPackingExtra(int idx) const;
1179  void *mapExtra(int idx);
1180  void unmapExtra(int idx);
1181 
1182  // metadata to write to header of output file
1183  const UT_Options &getMetadata() const;
1184 
1185  bool isConverged() const;
1186  void setConverged();
1187  void clearConverged();
1188 
1189  // Valid only after raster is allocated (ie render started)
1190  bool isValid() const;
1191 
1192  SYS_SAFE_BOOL operator bool() const { return isValid(); }
1193 
1194 private:
1195  UT_SharedPtr<BRAY_AOVBuffer> myAOVBuffer;
1196 };
1197 
1198 /// A render product represents an output file
1200 {
1201 public:
1202  // Test whether the type is understook by karma
1203  // For example "karma:checkpoint"
1204  static bool isKnownType(const UT_StringRef &type);
1205 
1206  // Clear all existing output files
1207  static void clearFiles(BRAY::ScenePtr &scene);
1208 
1209  struct BRAY_API AOV
1210  {
1212  : myName(name)
1213  {
1214  }
1215  /// Method is specialized for T in:
1216  /// - bool
1217  /// - int32/int64
1218  /// - fpreal32/fpreal64
1219  /// - UT_StringHolder
1220  template <typename T>
1221  bool setOption(const UT_StringHolder &name,
1222  const T *value,
1223  exint size);
1224  template <typename T>
1225  bool setOption(const UT_StringHolder &name, const T &value)
1226  { return setOption(name, &value, 1); }
1227 
1228  /// Copy over options from those passed in
1229  bool setOptions(const UT_Options &options);
1230 
1231  const UT_StringHolder &name() const { return myName; }
1232  const UT_Options &options() const { return myOptions; }
1233 
1234  /// Dump method for debugging
1235  void dump(UT_JSONWriter &w) const;
1236  private:
1237  UT_StringHolder myName;
1238  UT_Options myOptions;
1239  };
1241  const UT_StringHolder &filename,
1242  const UT_StringHolder &type)
1243  : myScene(scene)
1244  , myFilename(filename)
1245  , myType(type)
1246  {
1247  }
1248 
1250  {
1251  if (myFilename)
1252  commit();
1253  }
1254 
1255  /// @{
1256  /// Method is specialized for T in:
1257  /// - bool
1258  /// - int32/int64
1259  /// - fpreal32/fpreal64
1260  /// - UT_StringHolder
1261  template <typename T>
1262  bool setOption(const UT_StringHolder &name,
1263  const T *value,
1264  exint size);
1265  template <typename T>
1266  bool setOption(const UT_StringHolder &name, const T &value)
1267  { return setOption(name, &value, 1); }
1268  /// @}
1269 
1270  /// Copy over options from those passed in
1271  bool setOptions(const UT_Options &options);
1272 
1273  /// Add an AOV to this output file
1275  {
1276  myAOVs.emplace_back(name);
1277  return myAOVs.last();
1278  }
1279 
1280  /// Commit and add this output file to the render
1281  bool commit()
1282  {
1283  bool result = doCommit();
1284  cancel(); // Once committed, no more changes
1285  return result;
1286  }
1287  /// Cancel this output file for some reason
1288  void cancel() { myFilename.clear(); }
1289 
1290  /// Access member data
1291  const UT_StringHolder &filename() const { return myFilename; }
1292  const UT_StringHolder &type() const { return myType; }
1293  const UT_Array<AOV> &aovs() const { return myAOVs; }
1294  const UT_Options &options() const { return myOptions; }
1295 
1296  /// @{
1297  /// Dump information (used by karma:debug)
1298  void dump() const;
1299  void dump(UT_JSONWriter &w) const;
1300  /// @}
1301 
1302 private:
1303  bool doCommit();
1304  BRAY::ScenePtr &myScene;
1305  UT_StringHolder myFilename;
1306  UT_StringHolder myType;
1307  UT_Array<AOV> myAOVs;
1308  UT_Options myOptions;
1309 };
1310 
1311 
1312 /// Interface to the renderer
1314 {
1315 public:
1316  /// Class used to define image planes
1317  struct ImagePlane
1318  {
1321  int mySize;
1324  };
1325 
1326  RendererPtr() = default;
1328 
1329  /// Allocate renderer
1330  static RendererPtr allocRenderer(BRAY::ScenePtr &sceneptr);
1331 
1332  SYS_SAFE_BOOL operator bool() const { return myRenderer.get(); }
1333 
1334  /// @{
1335  /// Define image planes for rendering
1336  void clearOutputPlanes();
1337  AOVBufferPtr addOutputPlane(const ImagePlane &plane);
1338  int getAOVCount() const;
1339  /// @}
1340 
1341  /// Access the stats for this render
1342  const BRAY::Stats &stats() const;
1343 
1344  /// Call before rendering begins. This lets the renderer prepare data
1345  /// structures before render() is called. For example, this will ensure
1346  /// all AOV buffers are allocated and active. The method returns false if
1347  /// there were errors setting up the render.
1348  bool prepareRender();
1349 
1350  /// Start rendering a scene
1351  void render(bool (*stopreq)(void *) = nullptr, void *data = nullptr);
1352 
1353  /// Test to see whether the current renderer is active
1354  bool isRendering() const;
1355 
1356  /// Test to see if there was an error rendering
1357  bool isError() const;
1358 
1359  /// Test to see if the renderer is paused
1360  bool isPaused() const;
1361 
1362  /// Tells the renderer to prepare to be stopped
1363  void prepareForStop();
1364 
1365  /// Pause rendering -- Returns true if the renderer is paused
1366  bool pauseRender();
1367 
1368  /// Restart rendering -- Returns true if @c isRendering();
1369  bool resumeRender();
1370 
1371  /// Set a point in the image to give priority to rendering
1372  void setPriority(int x, int y);
1373 
1374  /// Set a region in the image which should have priority
1375  void setPriority(const UT_DimRect &region);
1376 
1377  /// Clear the priority focus
1378  void clearPriority();
1379 
1380  /// Enables image filters by the given option.
1381  /// The is_render_settings_prim indicates whether the filter
1382  /// belongs to render settings prim or the display options.
1383  bool enableImageFilters(
1384  const UT_StringHolder &filters_opt,
1385  bool is_render_settings_prim);
1386 
1387  /// Set whether to use render settings prim or display options.
1388  void setUseRenderSettingsPrim(bool use_render_settings_prim);
1389 
1390  /// JSON map containing common render product metadata from husk.
1391  void setConvergedMetadata(const UT_JSONValue &value);
1392 
1393  /// @private method
1394  BRAY_Renderer *renderer() { return myRenderer.get(); }
1395 
1396 private:
1397  UT_SharedPtr<BRAY_Renderer> myRenderer;
1398 };
1399 
1401 {
1402 public:
1404  : myGraph(graph)
1405  {}
1407 
1408  /// Make new node based on type and add to list of nodes in the current
1409  /// graph. Returns NULL if unknown type.
1410  /// Note that the root node (ie with surface/displace output) must be the
1411  /// first node added to the graph.
1412  BRAY_ShaderInstance *createNode(const UT_StringHolder &type,
1413  const UT_StringHolder &name);
1414 
1415  /// Returns OptionSet that contains input parameters for given shader node.
1416  /// Can be used to read and write values.
1417  OptionSet nodeParams(BRAY_ShaderInstance *node);
1418 
1419  /// Return the name of the shader instance
1420  static const UT_StringHolder &nodeName(const BRAY_ShaderInstance *n);
1421 
1422  /// Return the type of the shader instance
1423  static const UT_StringHolder &nodeType(const BRAY_ShaderInstance *n);
1424 
1425  /// Make connection between two nodes
1426  bool wireNodes(const UT_StringHolder &srcnode,
1427  const UT_StringHolder &srcoutput,
1428  const UT_StringHolder &dstnode,
1429  const UT_StringHolder &dstinput);
1430 
1431  // Definition of a shader node
1432  class NodeDecl
1433  : UT_NonCopyable
1434  {
1435  public:
1438  : myName(n)
1439  {
1440  }
1441 
1442  struct Parameter
1443  {
1444  UT_StringHolder myName; // Name of parameter
1445 
1446  bool isBool() const { return myType == 0; }
1447  bool isInt() const { return myType == 1; }
1448  bool isReal() const { return myType == 2; }
1449  bool isFloat() const { return myType == 2; }
1450  bool isString() const { return myType == 3; }
1451  bool isVariadic() const { return myVariadic; }
1452 
1453  exint size() const
1454  {
1455  return myB.size() + myI.size() + myF.size() + myS.size();
1456  }
1457 
1458  UT_Array<bool> myB; // Bool defaults
1459  UT_Array<int64> myI; // Integer defaults
1460  UT_Array<fpreal64> myF; // Real defaults
1461  UT_Array<UT_StringHolder> myS; // String defaults
1462  bool myVariadic; // Array valued (variadic)
1466 
1467  void dump(UT_JSONWriter &w) const;
1468  };
1469 
1470  const UT_StringHolder name() const
1471  { return myName; }
1473  { return myInputs; }
1475  { return myOutputs; }
1477  { return myMetadata; }
1478 
1480  { myName = n; }
1481  void addInput(const Parameter &parm)
1482  { myInputs.append(parm); }
1483  void addOutput(const Parameter &parm)
1484  { myOutputs.append(parm); }
1486  { myMetadata = metadata; }
1487 
1488  void dump() const;
1489  void dump(UT_JSONWriter &w) const;
1490 
1491  private:
1492  UT_StringHolder myName;
1493  UT_StringMap<UT_StringHolder> myMetadata;
1494  UT_Array<Parameter> myInputs;
1495  UT_Array<Parameter> myOutputs;
1496  };
1497 
1498  // Extract the definition of all supported nodes
1499  static const UT_Array<const NodeDecl *> &allNodes();
1500  // Find a node given the name
1501  static const NodeDecl *findNode(const UT_StringRef &name);
1502 
1503  /// Access the object properties on the shader graph. It's possible the
1504  /// shader graph has no options, so please check `isValid()`
1505  const OptionSet getObjectProperties() const;
1506  /// Create object properties for read/write
1507  OptionSet createObjectProperties(const BRAY::ScenePtr &scene);
1508  /// Clear any existing object properties
1509  void clearObjectProperties();
1510 private:
1511  friend class MaterialPtr;
1512  friend class LightPtr;
1514 };
1515 
1516 }; // End of namespace
1517 
1518 #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:84
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