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  explicit 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  explicit 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  explicit 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  explicit 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  explicit operator bool() const { return isValid(); }
617 
618  /// Access to the underling material
619  const BRAY_VexMaterial *materialPtr() const { return myMat; }
620 
621  /// Update the surface shader and arguments
622  void updateSurface(const ScenePtr &scene,
623  const UT_StringArray &arguments);
624  /// Update the displacement shader and arguments
625  /// Returns true if arguments changed.
626  bool updateDisplace(ScenePtr &scene,
627  const UT_StringArray &arguments);
628  /// Update the lens shader and arguments
629  void updateLens(const ScenePtr &scene,
630  const UT_StringArray &arguments);
631 
632  /// Update surface shader VEX code. The @c preload flag is used when other
633  /// shaders in the network might depend on the code being updated.
634  void updateSurfaceCode(const ScenePtr &scene,
635  const UT_StringHolder &name,
636  const UT_StringRef &code,
637  bool preload=false);
638  /// Update displacement shader VEX code The @c preload flag is used when
639  /// other shaders in the network might depend on the code being updated.
640  /// Returns true if the name or the code changed.
641  bool updateDisplaceCode(const ScenePtr &scene,
642  const UT_StringHolder &name,
643  const UT_StringRef &code,
644  bool preload=false);
645  /// Update surface shader VEX code. The @c preload flag is used when other
646  /// shaders in the network might depend on the code being updated.
647  void updateLensCode(const ScenePtr &scene,
648  const UT_StringHolder &name,
649  const UT_StringRef &code,
650  bool preload=false);
651 
652  /// Update the surface shader graph
653  void updateSurfaceGraph(const ScenePtr &scene,
654  const UT_StringHolder &name,
655  const ShaderGraphPtr &graphptr);
656  /// Update the displacement shader graph
657  /// Returns true if the name or the code changed.
658  bool updateDisplaceGraph(ScenePtr &scene,
659  const UT_StringHolder &name,
660  const ShaderGraphPtr &graphptr);
661  /// Update the lens shader graph
662  void updateLensGraph(const ScenePtr &scene,
663  const UT_StringHolder &name,
664  const ShaderGraphPtr &graphptr);
665 
666  /// Set the material input list
667  void setInputs(const ScenePtr &scene,
668  const MaterialInputList &inputs,
669  bool for_surface);
670 
671  /// Set stable name to use with built-in cryptomatte material name layer.
672  void setNiceName(const UT_StringHolder &nicename);
673 
674  /// Return the primvars required by this material. If a @c nullptr is
675  /// returned, it means that Karma wasn't able to determine primvars and all
676  /// primvars might be required.
677  PrimvarSet primvars() const;
678 
679  /// Return the primvars used by the default material
680  static PrimvarSet defaultPrimvars();
681 
682 private:
683  BRAY_VexMaterial *myMat;
684 };
685 
687 {
689  const MaterialPtr &material = MaterialPtr())
690  : myFaceList(facelist)
691  , myMaterial(material)
692  {
693  }
696 };
697 
698 enum class InstancableType
699 {
700  Object,
701  Light,
703 };
704 
705 /// Pure virtual class which can be either:
706 /// ObjectPtr
707 /// LightPtr
708 /// LightInstancerPtr
709 /// use isA and dyn_cast to find out the type
711 {
712 public:
714  : myType(type)
715  {
716  }
717  virtual ~InstancablePtr() = 0;
718 
720  {
721  return myType;
722  }
723 
724 private:
725  InstancableType myType;
726 };
727 
728 /// Casting operators inspired by LLVM:@n
729 /// isA<> checks the type of the object (but no nullptr check).
730 template <typename X> SYS_FORCE_INLINE bool
732 {
733  UT_ASSERT(o && "isA<> called with nullptr - use isAValid<>");
734  return X::classof(o);
735 }
736 
737 /// Casting operators inspired by LLVM:@n
738 /// isAValid<> checks the pointer is not a nullptr and is the given type.
739 template <typename X> SYS_FORCE_INLINE bool
741 {
742  return o && X::classof(o);
743 }
744 
745 /// Casting operators inspired by LLVM:@n
746 /// cast<> is a static cast with an assert.
747 template <typename X> SYS_FORCE_INLINE const X *
749 {
750  UT_ASSERT(o && isA<X>(o));
751  return static_cast<const X *>(o);
752 }
753 
754 /// Casting operators inspired by LLVM:@n
755 /// cast<> is a static cast with an assert.
756 template <typename X> SYS_FORCE_INLINE X *
758 {
759  UT_ASSERT(o && isA<X>(o));
760  return static_cast<X *>(o);
761 }
762 
763 /// @{
764 /// Casting operators inspired by LLVM:@n
765 /// dyn_cast<> is a fast dynamic cast.
766 template <typename X> SYS_FORCE_INLINE const X *
768 {
769  return isAValid<X>(o) ? static_cast<const X *>(o) : nullptr;
770 }
771 template <typename X> SYS_FORCE_INLINE const X *
773 {
774  return isA<X>(&o) ? static_cast<const X *>(&o) : nullptr;
775 }
776 template <typename X> SYS_FORCE_INLINE X *
778 {
779  return isAValid<X>(o) ? static_cast<X *>(o) : nullptr;
780 }
781 template <typename X> SYS_FORCE_INLINE X *
783 {
784  return isA<X>(&o) ? static_cast<X *>(&o) : nullptr;
785 }
786 /// @}
787 
789 {
790 public:
793  {
794  }
795  ~ObjectPtr() override;
796 
797  /// Test if Instancable is of this type
799  {
801  }
802 
803  /// Test validity
804  /// @{
805  bool isValid() const { return myObject != nullptr; }
806  explicit operator bool() const { return isValid(); }
807  /// @}
808 
809  /// Query if object is a leaf node (ie not scenegraph or instance)
810  bool isLeaf() const;
811 
812  /// @{
813  /// Access to the underlying object
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  /// @{
924  bool isValid() const { return myLight != nullptr; }
925  explicit operator bool() const { return isValid(); }
926  /// @}
927 
928  /// Access to the underlying object
929  /// @{
930  const BRAY_Light *lightPtr() const { return myLight.get(); }
931  BRAY_Light *lightPtr() { return myLight.get(); }
932  /// @}
933 
934  /// Return the type of light
935  BRAY_LightType type() const;
936 
937  /// Return the name of the light
938  const UT_StringHolder &name() const;
939 
940  /// Return the transform of the light
941  SpacePtr transform() const;
942 
943  /// Set the transform of the light
944  void setTransform(const SpacePtr &xforms);
945 
946  /// Set the shader for the light
947  void setShader(const ScenePtr &scene, const UT_StringArray &args);
948 
949  /// Get the current object properties for modification.
950  OptionSet objectProperties();
951 
952  /// Set the object properties
953  void setObjectProperties(const OptionSet &oprops);
954 
955  /// Get the current light properties for modification.
956  OptionSet lightProperties();
957 
958  /// Set the light properties
959  void setLightProperties(const OptionSet &lprops);
960 
961  /// After changing any options, must lock prior to rendering
962  void commitOptions(ScenePtr &scene);
963 
964  /// Update the light shader graph
965  void updateShaderGraph(const ScenePtr &scene,
966  const ShaderGraphPtr &graphptr,
967  const UT_Array<ShaderGraphPtr> &light_filters);
968 
969  /// If a light filter has been modified, this method should be called to
970  /// notify the light. The set should contain the names of the dirty light
971  /// filter shader graphs.
972  void updateFilters(const ScenePtr &scene,
973  const UT_Array<ShaderGraphPtr> &filters);
974 
975  /// Notify the light that a filter has been deleted
976  void eraseFilter(const ScenePtr &scene,
977  const UT_StringRef &shader_graph_name);
978 
979  ///
980  static UT_Vector3 computeEmission(
981  const UT_Vector3& color,
982  float intensity,
983  float exposure,
984  bool enable_color_temperature,
985  float color_temperature);
986 
987 protected:
989 private:
990  friend class LightInstancer;
991 };
992 
994 {
995 public:
998  myInstancer(p)
999  {
1000  }
1001  ~LightInstancerPtr() override;
1002 
1003  /// Test if Instancable is of this type
1005  {
1007  }
1008 
1009  // Test validity
1010  bool isValid() const { return myInstancer != nullptr; }
1011 
1012  /// Convenient validity testing
1013  explicit operator bool() const { return isValid(); }
1014 
1015  /// Return the name of the instancer
1016  const UT_StringHolder &name() const;
1017 
1018  /// Set the instance transforms
1019  void setInstanceTransforms(ScenePtr &scene,
1020  const UT_Array<SpacePtr> &xforms);
1021 
1022  /// Set the instance properties
1023  void setInstanceProperties(ScenePtr &scene,
1024  const GT_AttributeListHandle &alist);
1025 
1026  /// Add a light prototype for instancing
1027  /// If a light prototype with the same name exists,
1028  /// the new prototype is not added, but the instances
1029  /// belonging to that name are updated on the next commit
1030  void addPrototype(ScenePtr &scene,
1031  const LightPtr &light);
1032 
1033  /// Add a light instancer prototype for instancing
1034  /// If a light prototype with the same name exists,
1035  /// the new prototype is not added, but the instances
1036  /// belonging to that name are updated on the next commit
1037  void addPrototype(ScenePtr &scene,
1038  const LightInstancerPtr &inst);
1039 
1040  /// Commit the current prototypes to the scene
1041  void commit(ScenePtr &scene);
1042 
1043  /// Clear all instances from the Scene
1044  void clear(ScenePtr &scene);
1045 
1046 protected:
1048 private:
1049  friend class LightInstancer;
1050 };
1051 
1053 {
1054 public:
1056  : myCamera(cp)
1057  {
1058  }
1059  ~CameraPtr();
1060 
1061  /// Test validity
1062  /// @{
1063  bool isValid() const { return myCamera != nullptr; }
1064  explicit operator bool() const { return isValid(); }
1065  /// @}
1066 
1067  /// Access to the underlying object
1068  /// @{
1069  const BRAY_Camera *cameraPtr() const { return myCamera.get(); }
1070  BRAY_Camera *cameraPtr() { return myCamera.get(); }
1071  /// @}
1072 
1073  /// Set the transform on the camera
1074  void setTransform(ScenePtr &ptr, const SpacePtr &xforms);
1075 
1076  /// Set the lens shader for the camera
1077  void setShader(const ScenePtr &scene, const UT_StringArray &args);
1078 
1079  /// Set the lens shader material for the camera
1080  void setShaderMaterial(const ScenePtr &scene,
1081  const MaterialPtr &mat);
1082 
1083  /// Get the current object properties for modification.
1084  OptionSet objectProperties();
1085 
1086  /// Set number of motion samples for animated camera properties (1 upon
1087  /// construction). The last motion sample is assumed to have time offset of
1088  /// 1.0. (eg. if there are 3 samples, the time offsets are: 0, 0.5, 1.0)
1089  void resizeCameraProperties(int nseg);
1090 
1091  /// Get the current camera properties for modification.
1092  UT_Array<OptionSet> cameraProperties();
1093 
1094  /// Clear the camera's user defined clipping planes
1095  void clearClippingPlanes();
1096 
1097  /// Add a user defined clipping plane
1098  void addClippingPlane(const UT_Vector4D *plane, int nsegments);
1099 
1100  /// After changing any options, must lock prior to rendering
1101  void commitOptions(ScenePtr &scene);
1102 
1103 protected:
1105 
1106 };
1107 
1109 {
1110 public:
1112  : mySpace(sp)
1113  {
1114  }
1115  ~CoordSysPtr();
1116 
1117  /// Test validity
1118  /// @{
1119  bool isValid() const { return mySpace != nullptr; }
1120  explicit operator bool() const { return isValid(); }
1121  /// @}
1122 
1123  /// Access to underlying object
1124  /// @{
1125  const BRAY_Camera *spacePtr() const { return mySpace.get(); }
1126  BRAY_Camera *spacePtr() { return mySpace.get(); }
1127  /// @}
1128 
1129  const UT_StringHolder &name() const;
1130 
1131  /// Set transform
1132  void setTransform(ScenePtr &scn, const SpacePtr &xforms);
1133 
1134  /// The current object properties for modification (primarily for motion
1135  /// blur settings)
1136  OptionSet objectProperties();
1137 
1138  /// When a transform space has camera properties (for projection spaces),
1139  /// it's possible the projection can be motion blurred. This allows you to
1140  /// specify the motion segments for properties.
1141  void resizeCameraProperties(int nseg);
1142 
1143  /// Get the current camera properties for modification
1144  UT_Array<OptionSet> cameraProperties();
1145 
1146  /// After changing options, make sure to commit
1147  void commit(ScenePtr &scene);
1148 
1149 private:
1150  UT_SharedPtr<BRAY_Camera> mySpace;
1151 };
1152 
1154 {
1155 public:
1156  AOVBufferPtr() = default;
1157 
1159  : myAOVBuffer(aov)
1160  {}
1161 
1163 
1164  bool operator==(const AOVBufferPtr &aov) const
1165  { return aov.myAOVBuffer == myAOVBuffer; }
1166  bool operator!=(const AOVBufferPtr &aov) const
1167  { return !(*this == aov); }
1168 
1169  const UT_StringHolder &getName() const;
1170  const UT_StringHolder &getVariable() const;
1171 
1172  int getXres() const;
1173  int getYres() const;
1174  PXL_DataFormat getFormat() const;
1175  PXL_Packing getPacking() const;
1176  float getDefaultValue() const;
1177 
1178  void *map();
1179  void unmap();
1180  bool isMapped() const;
1181 
1182  // For extra channels
1183  int getNumExtra() const;
1184  const UT_StringHolder &nameExtra(int idx) const;
1185  PXL_DataFormat getFormatExtra(int idx) const;
1186  PXL_Packing getPackingExtra(int idx) const;
1187  void *mapExtra(int idx);
1188  void unmapExtra(int idx);
1189 
1190  // metadata to write to header of output file
1191  const UT_Options &getMetadata() const;
1192 
1193  bool isConverged() const;
1194  void setConverged();
1195  void clearConverged();
1196 
1197  // Valid only after raster is allocated (ie render started)
1198  bool isValid() const;
1199  explicit operator bool() const { return isValid(); }
1200 
1201 private:
1202  UT_SharedPtr<BRAY_AOVBuffer> myAOVBuffer;
1203 };
1204 
1205 /// A render product represents an output file
1207 {
1208 public:
1209  // Test whether the type is understook by karma
1210  // For example "karma:checkpoint"
1211  static bool isKnownType(const UT_StringRef &type);
1212 
1213  // Clear all existing output files
1214  static void clearFiles(BRAY::ScenePtr &scene);
1215 
1216  struct BRAY_API AOV
1217  {
1219  : myName(name)
1220  {
1221  }
1222  /// Method is specialized for T in:
1223  /// - bool
1224  /// - int32/int64
1225  /// - fpreal32/fpreal64
1226  /// - UT_StringHolder
1227  template <typename T>
1228  bool setOption(const UT_StringHolder &name,
1229  const T *value,
1230  exint size);
1231  template <typename T>
1232  bool setOption(const UT_StringHolder &name, const T &value)
1233  { return setOption(name, &value, 1); }
1234 
1235  /// Copy over options from those passed in
1236  bool setOptions(const UT_Options &options);
1237 
1238  const UT_StringHolder &name() const { return myName; }
1239  const UT_Options &options() const { return myOptions; }
1240 
1241  /// Dump method for debugging
1242  void dump(UT_JSONWriter &w) const;
1243  private:
1244  UT_StringHolder myName;
1245  UT_Options myOptions;
1246  };
1248  const UT_StringHolder &filename,
1249  const UT_StringHolder &type)
1250  : myScene(scene)
1251  , myFilename(filename)
1252  , myType(type)
1253  {
1254  }
1255 
1257  {
1258  if (myFilename)
1259  commit();
1260  }
1261 
1262  /// @{
1263  /// Method is specialized for T in:
1264  /// - bool
1265  /// - int32/int64
1266  /// - fpreal32/fpreal64
1267  /// - UT_StringHolder
1268  template <typename T>
1269  bool setOption(const UT_StringHolder &name,
1270  const T *value,
1271  exint size);
1272  template <typename T>
1273  bool setOption(const UT_StringHolder &name, const T &value)
1274  { return setOption(name, &value, 1); }
1275  /// @}
1276 
1277  /// Copy over options from those passed in
1278  bool setOptions(const UT_Options &options);
1279 
1280  /// Add an AOV to this output file
1282  {
1283  myAOVs.emplace_back(name);
1284  return myAOVs.last();
1285  }
1286 
1287  /// Commit and add this output file to the render
1288  bool commit()
1289  {
1290  bool result = doCommit();
1291  cancel(); // Once committed, no more changes
1292  return result;
1293  }
1294  /// Cancel this output file for some reason
1295  void cancel() { myFilename.clear(); }
1296 
1297  /// Access member data
1298  const UT_StringHolder &filename() const { return myFilename; }
1299  const UT_StringHolder &type() const { return myType; }
1300  const UT_Array<AOV> &aovs() const { return myAOVs; }
1301  const UT_Options &options() const { return myOptions; }
1302 
1303  /// @{
1304  /// Dump information (used by karma:debug)
1305  void dump() const;
1306  void dump(UT_JSONWriter &w) const;
1307  /// @}
1308 
1309 private:
1310  bool doCommit();
1311  BRAY::ScenePtr &myScene;
1312  UT_StringHolder myFilename;
1313  UT_StringHolder myType;
1314  UT_Array<AOV> myAOVs;
1315  UT_Options myOptions;
1316 };
1317 
1318 
1319 /// Interface to the renderer
1321 {
1322 public:
1323  /// Class used to define image planes
1324  struct ImagePlane
1325  {
1328  int mySize;
1331  };
1332 
1333  RendererPtr() = default;
1335 
1336  /// Allocate renderer
1337  static RendererPtr allocRenderer(BRAY::ScenePtr &sceneptr);
1338 
1339  explicit operator bool() const { return myRenderer.get(); }
1340 
1341  /// @{
1342  /// Define image planes for rendering
1343  void clearOutputPlanes();
1344  AOVBufferPtr addOutputPlane(const ImagePlane &plane);
1345  int getAOVCount() const;
1346  /// @}
1347 
1348  /// Access the stats for this render
1349  const BRAY::Stats &stats() const;
1350 
1351  /// Call before rendering begins. This lets the renderer prepare data
1352  /// structures before render() is called. For example, this will ensure
1353  /// all AOV buffers are allocated and active. The method returns false if
1354  /// there were errors setting up the render.
1355  bool prepareRender();
1356 
1357  /// Start rendering a scene
1358  void render(bool (*stopreq)(void *) = nullptr, void *data = nullptr);
1359 
1360  /// Test to see whether the current renderer is active
1361  bool isRendering() const;
1362 
1363  /// Test to see if there was an error rendering
1364  bool isError() const;
1365 
1366  /// Test to see if the renderer is paused
1367  bool isPaused() const;
1368 
1369  /// Tells the renderer to prepare to be stopped
1370  void prepareForStop();
1371 
1372  /// Pause rendering -- Returns true if the renderer is paused
1373  bool pauseRender();
1374 
1375  /// Restart rendering -- Returns true if @c isRendering();
1376  bool resumeRender();
1377 
1378  /// Set a point in the image to give priority to rendering
1379  void setPriority(int x, int y);
1380 
1381  /// Set a region in the image which should have priority
1382  void setPriority(const UT_DimRect &region);
1383 
1384  /// Clear the priority focus
1385  void clearPriority();
1386 
1387  /// Enables image filters by the given option.
1388  /// The is_render_settings_prim indicates whether the filter
1389  /// belongs to render settings prim or the display options.
1390  bool enableImageFilters(
1391  const UT_StringHolder &filters_opt,
1392  bool is_render_settings_prim);
1393 
1394  /// Set whether to use render settings prim or display options.
1395  void setUseRenderSettingsPrim(bool use_render_settings_prim);
1396 
1397  /// JSON map containing common render product metadata from husk.
1398  void setConvergedMetadata(const UT_JSONValue &value);
1399 
1400  /// @private method
1401  BRAY_Renderer *renderer() { return myRenderer.get(); }
1402 
1403 private:
1404  UT_SharedPtr<BRAY_Renderer> myRenderer;
1405 };
1406 
1408 {
1409 public:
1411  : myGraph(graph)
1412  {}
1414 
1415  /// Make new node based on type and add to list of nodes in the current
1416  /// graph. Returns NULL if unknown type.
1417  /// Note that the root node (ie with surface/displace output) must be the
1418  /// first node added to the graph.
1419  BRAY_ShaderInstance *createNode(const UT_StringHolder &type,
1420  const UT_StringHolder &name);
1421 
1422  /// Returns OptionSet that contains input parameters for given shader node.
1423  /// Can be used to read and write values.
1424  OptionSet nodeParams(BRAY_ShaderInstance *node);
1425 
1426  /// Return the name of the shader instance
1427  static const UT_StringHolder &nodeName(const BRAY_ShaderInstance *n);
1428 
1429  /// Return the type of the shader instance
1430  static const UT_StringHolder &nodeType(const BRAY_ShaderInstance *n);
1431 
1432  /// Make connection between two nodes
1433  bool wireNodes(const UT_StringHolder &srcnode,
1434  const UT_StringHolder &srcoutput,
1435  const UT_StringHolder &dstnode,
1436  const UT_StringHolder &dstinput);
1437 
1438  // Definition of a shader node
1439  class NodeDecl
1440  : UT_NonCopyable
1441  {
1442  public:
1445  : myName(n)
1446  {
1447  }
1448 
1449  struct Parameter
1450  {
1451  UT_StringHolder myName; // Name of parameter
1452 
1453  bool isBool() const { return myType == 0; }
1454  bool isInt() const { return myType == 1; }
1455  bool isReal() const { return myType == 2; }
1456  bool isFloat() const { return myType == 2; }
1457  bool isString() const { return myType == 3; }
1458  bool isVariadic() const { return myVariadic; }
1459 
1460  exint size() const
1461  {
1462  return myB.size() + myI.size() + myF.size() + myS.size();
1463  }
1464 
1465  UT_Array<bool> myB; // Bool defaults
1466  UT_Array<int64> myI; // Integer defaults
1467  UT_Array<fpreal64> myF; // Real defaults
1468  UT_Array<UT_StringHolder> myS; // String defaults
1469  bool myVariadic; // Array valued (variadic)
1473 
1474  void dump(UT_JSONWriter &w) const;
1475  };
1476 
1477  const UT_StringHolder name() const
1478  { return myName; }
1480  { return myInputs; }
1482  { return myOutputs; }
1484  { return myMetadata; }
1485 
1487  { myName = n; }
1488  void addInput(const Parameter &parm)
1489  { myInputs.append(parm); }
1490  void addOutput(const Parameter &parm)
1491  { myOutputs.append(parm); }
1493  { myMetadata = metadata; }
1494 
1495  void dump() const;
1496  void dump(UT_JSONWriter &w) const;
1497 
1498  private:
1499  UT_StringHolder myName;
1500  UT_StringMap<UT_StringHolder> myMetadata;
1501  UT_Array<Parameter> myInputs;
1502  UT_Array<Parameter> myOutputs;
1503  };
1504 
1505  // Extract the definition of all supported nodes
1506  static const UT_Array<const NodeDecl *> &allNodes();
1507  // Find a node given the name
1508  static const NodeDecl *findNode(const UT_StringRef &name);
1509 
1510  /// Access the object properties on the shader graph. It's possible the
1511  /// shader graph has no options, so please check `isValid()`
1512  const OptionSet getObjectProperties() const;
1513  /// Create object properties for read/write
1514  OptionSet createObjectProperties(const BRAY::ScenePtr &scene);
1515  /// Clear any existing object properties
1516  void clearObjectProperties();
1517 
1518 
1519 private:
1520  friend class MaterialPtr;
1521  friend class LightPtr;
1523 };
1524 
1525 }; // End of namespace
1526 
1527 #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
float BRAYtime
Consistent representation of time type within BRAY.
Definition: BRAY_Types.h:872
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:39
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
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
Access to the underling material.
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
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:292
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:918
UT_SharedPtr< BRAY_Object > myObject
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:33
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:689
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
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:513
void addInput(const Parameter &parm)
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:165
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