HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BRAY_Interface.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: BRAY_Interface.h (BRAY Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __BRAY_Interface__
12 #define __BRAY_Interface__
13 
14 #include "BRAY_API.h"
15 #include <UT/UT_Array.h>
16 #include <UT/UT_StringHolder.h>
17 #include <UT/UT_StringArray.h>
18 #include <UT/UT_NonCopyable.h>
19 #include <UT/UT_SharedPtr.h>
20 #include <UT/UT_IntrusivePtr.h>
21 #include <UT/UT_UniquePtr.h>
22 #include <UT/UT_VectorTypes.h>
23 #include <GT/GT_Handles.h>
24 #include <GT/GT_DataArray.h>
25 #include <PXL/PXL_Common.h>
26 #include "BRAY_Types.h"
27 
28 // Classes referenced by the interface
29 class BRAY_Procedural;
31 class BRAY_AOVBuffer;
32 class BRAY_Camera;
33 class BRAY_Object;
34 class BRAY_Renderer;
35 class BRAY_Light;
36 class BRAY_Scene;
37 class BRAY_VexMaterial;
38 class VPRM_Space;
39 class VPRM_OptionSet;
40 class UT_JSONWriter;
41 
44 
45 namespace BRAY
46 {
47 
48 class CameraPtr;
49 class LightPtr;
50 class MaterialPtr;
51 class ObjectPtr;
52 class ScenePtr;
53 
55 {
56 public:
57  SpacePtr();
58  SpacePtr(const VPRM_SpacePtr &s);
59  SpacePtr(const SpacePtr &s);
60  SpacePtr(const UT_Matrix4D &xforms);
61  SpacePtr(const UT_Matrix4D *xforms, size_t num_motion_segments);
62  ~SpacePtr();
63  SpacePtr &operator=(const SpacePtr &s);
64 
65  /// @{
66  /// Private access
67  bool isValid() const { return mySpace.get() != nullptr; }
68  VPRM_SpacePtr &space() { return mySpace; }
69  const VPRM_SpacePtr &space() const { return mySpace; }
70  /// @}
71  /// Bool operator to test validity of pointer
72  SYS_SAFE_BOOL operator bool() const { return isValid(); }
73 
74  /// Multiply by the given space (i.e. this * sp)
75  SpacePtr mulSpace(const SpacePtr &sp) const;
76 
77  /// Return the number of motion segments
78  int motionSegments() const;
79  const UT_Matrix4D &getTransform(int segment) const;
80  void getTransform(UT_Matrix4D &x, BRAYtime shutter) const;
81  void dump() const;
82  void dump(UT_JSONWriter &w) const;
83 private:
84  VPRM_SpacePtr mySpace;
85 };
86 
88 {
89 public:
90  OptionSet();
91  OptionSet(const OptionSet &src);
92  OptionSet(const VPRM_OptionSetPtr &o);
93  ~OptionSet();
94 
95  OptionSet &operator=(const OptionSet &o);
96 
97  /// @{
98  /// Private access
99  bool isValid() const { return myOptions.get() != nullptr; }
100  VPRM_OptionSetPtr &options() { return myOptions; }
101  const VPRM_OptionSetPtr &options() const { return myOptions; }
102  /// @}
103  /// Bool operator to test validity of pointer
104  SYS_SAFE_BOOL operator bool() const { return isValid(); }
105 
106  /// Return the name associated with a given option (i.e. dicingquality)
107  const UT_StringHolder &name(int token) const;
108 
109  /// Return the fully qualified name (i.e. karma::object::dicingquality)
110  UT_StringHolder fullName(int token) const;
111 
112  /// Return the token associated with a given name (or -1 if invalid)
113  int find(const UT_StringRef &name) const;
114 
115  /// Import a property value. Method is specialized for T in:
116  /// - bool
117  /// - int32/int64
118  /// - fpreal32/fpreal64
119  /// - UT_StringHolder
120  template <typename T>
121  const T *import(int token, T *val, size_t n) const;
122 
123  /// Interface to set an property. This template class is specialized for:
124  /// - bool
125  /// - int32
126  /// - int64
127  /// - fpreal32
128  /// - fpreal64
129  /// - UT_StringHolder
130  template <typename T>
131  bool set(int token, const T *value, exint tuple_size);
132 
133  /// Simple interface to set a scalar property
134  template <typename T>
135  SYS_FORCE_INLINE bool set(int token, const T &value)
136  {
137  return set(token, &value, 1);
138  }
139 
140  /// Test whether a value is the same as the current property
141  template <typename T>
142  bool isEqual(int token, const T *value, exint tuple_size) const;
143 
144  /// Simple interface for equality of a scalar value.
145  template <typename T>
146  SYS_FORCE_INLINE bool isEqual(int token, const T &value) const
147  {
148  return isEqual(token, &value, 1);
149  }
150 
151  /// Test whether an option has variadic arguments
152  bool isVariadic(int token) const;
153 
154  /// Return the size of an option. This can be used for variadics
155  exint size(int token) const;
156 
157  /// Return the storage of an option. This will only be one of:
158  /// - GT_STORE_INVALID
159  /// - GT_STORE_UINT8 (for bool storage)
160  /// - GT_STORE_INT64
161  /// - GT_STORE_REAL64
162  /// - GT_STORE_STRING
163  GT_Storage storage(int token) const;
164 
165  /// @{
166  /// Direct access to internal option data. There are no checks on these
167  /// methods
168  const bool *bval(int token) const;
169  const int64 *ival(int token) const;
170  const fpreal64 *fval(int token) const;
171  const UT_StringHolder *sval(int token) const;
172  /// @}
173 
174  /// @private Debug the options (only available in debug builds)
175  void dump(UT_JSONWriter &w) const;
176 
177 private:
178  VPRM_OptionSetPtr myOptions;
179 };
180 
181 /// When defining materials for face sets, the material specification is
182 /// given by a pair of the @c MaterialPtr and an array of integers. The
183 /// integers specify the list of faces to material and must appear in
184 /// sorted order (smallest to largest).
185 /// Interface to the scene manager
187 {
188 public:
189  ScenePtr() = default;
190  ~ScenePtr();
191 
192  /// Allocate a new scene
193  static ScenePtr allocScene();
194 
195  /// Test validity
196  bool isValid() const { return myScene.get() != nullptr; }
197 
198  /// Test whether the scene is thread-safe
199  bool threadSafe() const;
200 
201  /// Test whether the renderer supports nested instancing
202  bool nestedInstancing() const;
203 
204  /// Update an object in the scene
205  void updateObject(const ObjectPtr &ptr, BRAY_EventType event);
206 
207  /// Update light object in the scene
208  void updateLight(const LightPtr &ptr, BRAY_EventType event);
209 
210  /// Update camera object in the scene
211  void updateCamera(const CameraPtr &ptr, BRAY_EventType event);
212 
213  /// Set camera ray visibility. The mask should be a combination of
214  /// - BRAY_RAY_CAMERA
215  /// - BRAY_PROXY_CAMERA
216  /// - BRAY_GUIDE_CAMERA
217  /// For example, (BRAY_RAY_CAMERA|BRAY_GUIDE_CAMERA) will cause guide and
218  /// renderable object to be visible to camera rays, but not proxy objects
219  void setCameraRayMask(BRAY_RayVisibility mask);
220 
221  /// Set shadow ray visibility. The mask should be a combination of
222  /// - BRAY_RAY_SHADOW
223  /// - BRAY_PROXY_SHADOW
224  /// - BRAY_GUIDE_SHADOW
225  /// For example, (BRAY_RAY_SHADOW|BRAY_PROXY_SHADOW) will cause proxy and
226  /// renderable object to cast shadows, but not GUIDE objects.
227  void setShadowRayMask(BRAY_RayVisibility mask);
228 
229  /// Force redicing of displacement and subd surfaces on the next render.
230  /// This will only take effect on the next call to beginRender().
231  void forceRedice();
232 
233  /// @{
234  /// Private access to the underling scene
235  SYS_SAFE_BOOL operator bool() const { return isValid(); }
236  const BRAY_Scene *scenePtr() const { return myScene.get(); }
237  BRAY_Scene *scenePtr() { return myScene.get(); }
238  /// @}
239 
240  /// After changing any options, must commit prior to rendering
241  void lockOptions();
242 
243  /// Grab a copy of the current scene options
244  OptionSet sceneOptions() const;
245 
246  /// Grab a copy of the current object properties.
247  OptionSet objectProperties() const;
248 
249  /// Grab a copy of the current light properties
250  OptionSet lightProperties() const;
251 
252  /// Grab a copy of the current camera properties
253  OptionSet cameraProperties() const;
254 
255  /// Grab a copy of the current image plane properties
256  OptionSet planeProperties() const;
257 
258  /// Grab a the default properties for a given type. Changing their values
259  /// will cause all future objects created to inherit the new values.
260  OptionSet defaultProperties(BRAY_PropertyType type) const;
261 
262  /// @{
263  /// Convenience methods to look up scene and scene options.
264  /// Get an scene option value.
265  template <typename T>
267  T *val, size_t n) const
268  {
269  return sceneOptions().import(token, val, n);
270  }
271 
272  /// Interface to set an option. This template class is specialized for:
273  template <typename T>
275  const T *value,
276  exint tuple_size)
277  {
278  return sceneOptions().set(token, value, tuple_size);
279  }
280 
281  /// Simple interface to set a scalar option
282  template <typename T>
283  SYS_FORCE_INLINE bool
285  {
286  return setOption(token, &value, 1);
287  }
288 
289  /// Return the size of an option. This can be used for variadics
290  /// (e.g. shading quality will be 1)
292  {
293  return sceneOptions().size(token);
294  }
295 
296  /// Return the storage class of an option.
299  {
300  return sceneOptions().storage(token);
301  }
302 
303  /// Return whether an option has variadic arguments
304  SYS_FORCE_INLINE bool
306  {
307  return sceneOptions().isVariadic(token);
308  }
310  { return *sceneOptions().bval(t); }
312  { return *sceneOptions().ival(t); }
314  { return *sceneOptions().fval(t); }
316  { return *sceneOptions().sval(t); }
317  /// @}
318 
319  /// @{
320  /// Convenience methods to look up object properties.
321  /// Get an object property value.
322  template <typename T>
324  T *val, size_t n) const
325  {
326  return objectProperties().import(token, val, n);
327  }
328 
329  /// Interface to set an property. This template class is specialized for:
330  template <typename T>
332  const T *value,
333  exint tuple_size)
334  {
335  return objectProperties().set(token, value, tuple_size);
336  }
337 
338  /// Simple interface to set a scalar property
339  template <typename T>
340  SYS_FORCE_INLINE bool
342  {
343  return setProperty(token, &value, 1);
344  }
345 
346  /// Return the size of an option. This can be used for variadics
347  /// (e.g. shading quality will be 1)
349  {
350  return objectProperties().size(token);
351  }
352 
353  /// Return the storage class of an option.
356  {
357  return objectProperties().storage(token);
358  }
359 
360  /// Return whether an property has variadic arguments
361  SYS_FORCE_INLINE bool
363  {
364  return objectProperties().isVariadic(token);
365  }
367  { return *objectProperties().bval(t); }
369  { return *objectProperties().ival(t); }
371  { return *objectProperties().fval(t); }
373  { return *objectProperties().sval(t); }
374  /// @}
375 
376  /// Create a light
377  LightPtr createLight(const UT_StringHolder &name);
378 
379  /// Create a camera
380  CameraPtr createCamera(const UT_StringHolder &name);
381 
382  /// Create a material
383  MaterialPtr createMaterial(const UT_StringHolder &name);
384 
385  /// Find a material.
386  MaterialPtr findMaterial(const UT_StringRef &name) const;
387 
388  /// Add a named transform space (that can be referenced from VEX)
389  /// Returns true if the space was added (false if the space already exists)
390  bool addSpace(const UT_StringHolder &name,
391  const SpacePtr &space,
392  bool replace_existing = true);
393 
394  /// Add traceset name to global list (categories on objects that do not
395  /// belong to this list will be ignored)
396  /// Returns true if added, false if already exists.
397  bool addTraceset(const UT_StringHolder &name);
398 
399  /// Check to see if a traceset exists.
400  bool isTraceset(const UT_StringHolder &name);
401 
402 private:
403  UT_SharedPtr<BRAY_Scene> myScene;
404 };
405 
406 /// Interface to scene materials
408 {
409 public:
410  MaterialPtr(BRAY_VexMaterial *mat = nullptr)
411  : myMat(mat)
412  {
413  }
415 
416  bool isValid() const { return myMat != nullptr; }
417 
418  /// @{
419  /// Access to the underling material
420  SYS_SAFE_BOOL operator bool() const { return isValid(); }
421  const BRAY_VexMaterial *materialPtr() const { return myMat; }
422  /// @}
423 
424  /// Update the surface shader and arguments
425  void updateSurface(const ScenePtr &scene,
426  const UT_StringArray &arguments);
427  /// Update the displacement shader and arguments
428  /// Returns true if arguments changed.
429  bool updateDisplace(const ScenePtr &scene,
430  const UT_StringArray &arguments);
431 
432  /// Update surface shader VEX code
433  void updateSurfaceCode(const ScenePtr &scene,
434  const char *name,
435  const UT_StringRef &code);
436  /// Update displacement shader VEX code
437  /// Returns true if the name or the code changed.
438  bool updateDisplaceCode(const ScenePtr &scene,
439  const char *name,
440  const UT_StringRef &code);
441 private:
442  BRAY_VexMaterial *myMat;
443 };
444 
446 {
448  const MaterialPtr &material = MaterialPtr(),
449  const OptionSet &options = OptionSet())
450  : myFaceList(facelist)
451  , myMaterial(material)
452  , myOptions(options)
453  {
454  }
458 };
459 
461 {
462 public:
463  ObjectPtr() = default;
464  ~ObjectPtr();
465 
466  /// Create an object given a GT_Primitive handle.
467  /// At the current time, the only classes supported are:
468  /// - GT_PrimPolygonMesh
469  /// - GT_PrimSubdivisionMesh
470  /// - GT_PrimCurveMesh
471  /// - GT_PrimPointMesh
472  /// The method will return a nullptr if it can't create a primitive
473  static ObjectPtr createGeometry(const GT_PrimitiveHandle &prim);
474 
475  /// Create a volume given its detail attribute and the names and
476  /// GT_PrimitiveHandles of the corresponding fields in the volume
478  static ObjectPtr createVolume(const UT_StringHolder &name);
479 
480  /// Create an instance of an object
481  static ObjectPtr createInstance(const ObjectPtr &obj,
482  const char *name = nullptr);
483 
484  /// Create a nested scene graph
485  static ObjectPtr createScene();
486 
487  /// Create a procedural object.
488  /// Ownership of the procedural is passed to the object.
489  static ObjectPtr createProcedural(UT_UniquePtr<BRAY_Procedural> proc);
490 
491  /// Test validity
492  bool isValid() const { return myObject != nullptr; }
493 
494  /// @{
495  /// Access to the underlying object
496  SYS_SAFE_BOOL operator bool() const { return isValid(); }
497  const BRAY_Object *objectPtr() const { return myObject.get(); }
498  BRAY_Object *objectPtr() { return myObject.get(); }
499  /// @}
500 
501  /// Bind a material to the object. The method will fail if the underlying
502  /// object cannot set the material.
503  bool setMaterial(ScenePtr &scene,
504  const MaterialPtr &mat,
505  const OptionSet &opts,
506  exint nfacesets=0,
507  const FacesetMaterial *faceset_mat=nullptr);
508 
509  /// Set the prototype for an instance object
510  void setInstancePrototype(const ObjectPtr &proto);
511 
512  /// Set the transform on the instance
513  void setInstanceTransforms(const UT_Array<SpacePtr> &xforms);
514 
515  /// Set attributes on instances
516  void setInstanceAttributes(const ScenePtr &scene,
517  const GT_AttributeListHandle &alist);
518 
519  /// Set instance IDs. If not set (or given an empty array), it is assumed
520  /// that the ids are contiguous 0...N-1 where N is the number of xforms.
521  void setInstanceIds(UT_Array<exint> ids);
522 
523  /// Add an object to a scene
524  void addInstanceToScene(ObjectPtr &obj);
525 
526  /// Get the current object properties for modification. If there are no
527  /// face sets, the array length will be 1. Otherwise, the properties for
528  /// every face set will also be included in the array.
529  ///
530  /// If the object hasn't been initialized yet, default properties will be
531  /// returned.
532  void objectProperties(const ScenePtr &scene,
533  UT_Array<OptionSet> &properties) const;
534 
535  /// @{
536  /// This will return the object's base properties, or the scene defaults if
537  /// the object isn't defined yet.
538  OptionSet objectProperties(const ScenePtr &scene);
539  const OptionSet objectProperties(const ScenePtr &scene) const;
540  /// @}
541 
542  /// Get the underlying GT_PrimitiveHandle (if possible). This method may
543  /// return a nullptr.
544  GT_PrimitiveHandle geometry() const;
545 
546  /// Pointer to the contained procedural. This may return a nullptr.
547  BRAY_Procedural *procedural();
548 
549  /// Update the geometry for the object. The method will fail if you're
550  /// trying to change the underlying primitive type.
551  bool setGeometry(const GT_PrimitiveHandle &prim);
552 
553  /// Update volume fields. This method will fail if the underlying
554  /// primitive isn't a volume (see createVolume())
555  bool setVolume(const GT_AttributeListHandle &clist,
556  const FieldList& fields);
557 
558  /// Return the detail attributes for a volume primitive
559  const GT_AttributeListHandle &volumeDetailAttributes() const;
560 
561  /// TODO: Deprecate this
562  void takeOwnership(BRAY_Object *obj);
563 
564 protected:
566 };
567 
569 {
570 public:
572  : myLight(lp)
573  {
574  }
575  ~LightPtr();
576 
577  /// Test validity
578  bool isValid() const { return myLight != nullptr; }
579 
580  /// @{
581  /// Access to the underlying object
582  SYS_SAFE_BOOL operator bool() const { return isValid(); }
583  const BRAY_Light *lightPtr() const { return myLight.get(); }
584  BRAY_Light *lightPtr() { return myLight.get(); }
585  /// @}
586 
587  /// Return the type of light
588  BRAY_LightType type() const;
589 
590  /// Set the transform on the instance
591  void setTransform(const SpacePtr &xforms);
592 
593  /// Set the shader for the light
594  void setShader(ScenePtr &scene, const UT_StringArray &args);
595 
596  /// Get the current object properties for modification.
597  OptionSet objectProperties();
598 
599  /// Get the current light properties for modification.
600  OptionSet lightProperties();
601 
602  /// After changing any options, must lock prior to rendering
603  void lockOptions(ScenePtr &scene);
604 
605 protected:
607 
608 };
609 
611 {
612 public:
614  : myCamera(cp)
615  {
616  }
617  ~CameraPtr();
618 
619  /// Test validity
620  bool isValid() const { return myCamera != nullptr; }
621 
622  /// @{
623  /// Access to the underlying object
624  SYS_SAFE_BOOL operator bool() const { return isValid(); }
625  const BRAY_Camera *cameraPtr() const { return myCamera.get(); }
626  BRAY_Camera *cameraPtr() { return myCamera.get(); }
627  /// @}
628 
629  /// Set the transform on the instance
630  void setTransform(const SpacePtr &xforms);
631 
632  /// Set the lens shader for the camera
633  void setShader(const ScenePtr &scene, const UT_StringArray &args);
634 
635  /// Get the current object properties for modification.
636  OptionSet objectProperties();
637 
638  /// Set number of motion samples for animated camera properties (1 upon
639  /// construction). The last motion sample is assumed to have time offset of
640  /// 1.0. (eg. if there are 3 samples, the time offsets are: 0, 0.5, 1.0)
641  void resizeCameraProperties(int nseg);
642 
643  /// Get the current camera properties for modification.
644  UT_Array<OptionSet> cameraProperties();
645 
646  /// After changing any options, must lock prior to rendering
647  void lockOptions(ScenePtr &scene);
648 
649 protected:
651 
652 };
653 
655 {
656 public:
657  AOVBufferPtr() = default;
658 
660  : myAOVBuffer(aov)
661  {}
662 
664 
665  bool operator==(const AOVBufferPtr &aov) const
666  { return aov.myAOVBuffer == myAOVBuffer; }
667  bool operator!=(const AOVBufferPtr &aov) const
668  { return !(*this == aov); }
669 
670  int getXres() const;
671  int getYres() const;
672  PXL_DataFormat getFormat() const;
673  PXL_Packing getPacking() const;
674 
675  void *map();
676  void unmap();
677  bool isMapped() const;
678 
679  bool isConverged() const;
680  void setConverged();
681  void clearConverged();
682 
683  // Valid only after raster is allocated (ie render started)
684  bool isValid() const;
685 
686  SYS_SAFE_BOOL operator bool() const { return isValid(); }
687 
688 private:
689  UT_SharedPtr<BRAY_AOVBuffer> myAOVBuffer;
690 };
691 
692 /// Interface to the renderer
694 {
695 public:
696  /// Class used to define image planes
697  struct ImagePlane
698  {
701  int mySize;
704  };
705 
706  struct Stats
707  {
709  {
714  };
715 
717  {
718  clear();
719  myFrameCount = 0;
720  }
721  void clear()
722  {
723  myWorldToCamera = UT_Matrix4D(1);
724  myWorldToScreen = UT_Matrix4D(1);
725  myStage = STAGE_INACTIVE;
726  myPercentDone = 0;
727  myCameraRays = 0;
728  myIndirectRays = 0;
729  myOcclusionRays = 0;
730  myLightGeoRays = 0;
731  myProbeRays = 0;
732  myObjectCountsSet = false;
733  myPolyCount = UT_Vector2I(0, 0);
734  myCurveCount = UT_Vector2I(0, 0);
735  myPointCount = UT_Vector2I(0, 0);
736  myPointMeshCount = UT_Vector2I(0, 0);
737  myVolumeCount = UT_Vector2I(0, 0);
738  myProceduralCount = UT_Vector2I(0, 0);
739  myLightCount = 0;
740  myLightTreeCount = 0;
741  myCameraCount = 0;
742  myOctreeBuildTime = 0;
743  myLoadWallClock = 0;
744  myLoadCPU = 0;
745  myLoadSystem = 0;
746  myLoadMemory = 0;
747  myTotalWallClock = 0;
748  myTotalCPU = 0;
749  myTotalSystem = 0;
750  myCurrentMemory = 0;
751  myPeakMemory = 0;
752  myFilterErrors.clear();
753  myPrimvar.clear();
754  }
755 
756  /// Transform matrices
759 
760  /// Current state of rendering
762 
763  /// Total number of frames rendered
765 
766  /// Percent complete of current frame
768 
769  /// Ray counts
775 
776  /// Object counts -- only defined if verbose >= 2
777  UT_Vector2I myPolyCount; // Individual/Instances
778  UT_Vector2I myCurveCount; // Individual/Instances
779  UT_Vector2I myPointCount; // Individual/Instances
780  UT_Vector2I myPointMeshCount; // Individual/Instances
781  UT_Vector2I myVolumeCount; // Individual/Instances
782  UT_Vector2I myProceduralCount; // Individual/Instances
783  int64 myLightCount; // Total lights in the scene
784  int64 myLightTreeCount; // Lights in the light tree
785  int64 myCameraCount; // Cameras in the scene
786 
787  /// Times
788  fpreal myOctreeBuildTime; // Time to build octree
789 
790  /// Initialization times
791  fpreal myLoadWallClock; // Wall clock time for load
792  fpreal myLoadCPU; // CPU time for load
793  fpreal myLoadSystem; // System time for load
794  int64 myLoadMemory; // Memory after load
795 
796  /// Render times
797  fpreal myTotalWallClock; // Wall clock time for render
798  fpreal myTotalCPU; // CPU time for load
799  fpreal myTotalSystem; // System time for load
800  int64 myCurrentMemory; // Current memory
801 
802  int64 myPeakMemory; // Memory after load
803 
804  // Errors from image/pixel/sample filters
806 
807  // Internal stats
809 
810  // Whether myPolyCount, myCurveCount etc. are set
812  };
813 
814  RendererPtr() = default;
816 
817  /// Allocate renderer
818  static RendererPtr allocRenderer(BRAY::ScenePtr &sceneptr);
819 
820  SYS_SAFE_BOOL operator bool() const { return myRenderer.get(); }
821 
822  /// @{
823  /// Define image planes for rendering
824  void clearOutputPlanes();
825  AOVBufferPtr addOutputPlane(const ImagePlane &plane);
826  int getAOVCount() const;
827  /// @}
828 
829  /// Return stats about rendering
830  const Stats &renderStats() const;
831 
832  /// Start rendering a scene
833  void render(bool (*stopreq)(void *) = nullptr,
834  void *data = nullptr);
835 
836  /// Test to see whether the current renderer is active
837  bool isRendering() const;
838 
839  /// Test to see if the renderer is paused
840  bool isPaused() const;
841 
842  /// Tells the renderer to prepare to be stopped
843  void prepareForStop();
844 
845  /// Pause rendering -- Returns true if the renderer is paused
846  bool pauseRender();
847 
848  /// Restart rendering -- Returns true if @c isRendering();
849  bool resumeRender();
850 
851 private:
852  UT_SharedPtr<BRAY_Renderer> myRenderer;
853 };
854 
855 }; // End of namespace
856 
857 #endif
int64 myCameraRays
Ray counts.
GLdouble s
Definition: glew.h:1390
BRAY_EventType
Types of events that can be sent as updates to the renderer.
Definition: BRAY_Types.h:39
UT_Vector2T< int64 > UT_Vector2I
GT_Storage
Definition: GT_Types.h:18
UT_Matrix4T< fpreal64 > UT_Matrix4D
UT_StringHolder optionS(BRAY_SceneOption t) const
int64 propertyI(BRAY_SceneOption t) const
fpreal myOctreeBuildTime
Times.
GLsizeiptr size
Definition: glew.h:1681
GLenum src
Definition: glew.h:2410
GLuint const GLchar * name
Definition: glew.h:1814
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
const BRAY_Camera * cameraPtr() const
bool isValid() const
Test validity.
const Args & args
Definition: printf.h:628
float BRAYtime
Consistent representation of time type within BRAY.
Definition: BRAY_Types.h:421
UT_Vector2I myPolyCount
Object counts – only defined if verbose >= 2.
VPRM_SpacePtr & space()
BRAY_Light * lightPtr()
BRAY_RayVisibility
Ray visibility flags.
Definition: BRAY_Types.h:459
bool operator!=(const AOVBufferPtr &aov) const
GLuint const GLfloat * val
Definition: glew.h:2794
SYS_FORCE_INLINE bool setProperty(BRAY_ObjectProperty token, const T &value)
Simple interface to set a scalar property.
UT_SharedPtr< BRAY_Light > myLight
SYS_FORCE_INLINE const T * optionImport(BRAY_SceneOption token, T *val, size_t n) const
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:32
GLhandleARB obj
Definition: glew.h:6236
int64 optionI(BRAY_SceneOption t) const
SYS_FORCE_INLINE bool set(int token, const T &value)
Simple interface to set a scalar property.
const BRAY_Object * objectPtr() const
GLenum GLint GLuint mask
Definition: glew.h:1845
UT_StringHolder myPrimvar
SYS_FORCE_INLINE exint propertySize(BRAY_ObjectProperty token) const
const BRAY_Light * lightPtr() const
bool isValid() const
Test validity.
UT_Matrix4D myWorldToCamera
Transform matrices.
CameraPtr(const UT_SharedPtr< BRAY_Camera > &cp=UT_SharedPtr< BRAY_Camera >())
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
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
bool isValid() const
Test validity.
bool propertyB(BRAY_SceneOption t) const
long long int64
Definition: SYS_Types.h:111
VPRM_OptionSetPtr & options()
BRAY_ObjectProperty
Definition: BRAY_Types.h:136
SYS_FORCE_INLINE GT_Storage propertyStorage(BRAY_ObjectProperty token) const
Return the storage class of an option.
UT_SharedPtr< BRAY_Camera > myCamera
GLint GLint GLint GLint GLint x
Definition: glew.h:1252
UT_SharedPtr< BRAY_Object > myObject
#define SYS_SAFE_BOOL
Definition: SYS_Compiler.h:62
BRAY_Camera * cameraPtr()
bool isValid() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:28
UT_IntrusivePtr< GT_DataArray > GT_DataArrayHandle
Definition: GT_DataArray.h:31
int64 exint
Definition: SYS_Types.h:120
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
SYS_FORCE_INLINE exint optionSize(BRAY_SceneOption token) const
double fpreal64
Definition: SYS_Types.h:196
bool isValid() const
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
GLubyte GLubyte GLubyte GLubyte w
Definition: glew.h:1890
GLsizei n
Definition: glew.h:4040
SYS_FORCE_INLINE bool optionIsVariadic(BRAY_SceneOption token) const
Return whether an option has variadic arguments.
PXL_Packing
Definition: PXL_Common.h:29
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:
int myFrameCount
Total number of frames rendered.
fpreal myLoadWallClock
Initialization times.
bool isValid() const
Test validity.
Class used to define image planes.
PXL_DataFormat
Definition: PXL_Common.h:19
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1253
GT_DataArrayHandle myFaceList
BRAY_LightType
Definition: BRAY_Types.h:386
SYS_FORCE_INLINE bool setOption(BRAY_SceneOption token, const T &value)
Simple interface to set a scalar option.
fpreal myPercentDone
Percent complete of current frame.
double fpreal
Definition: SYS_Types.h:276
cl_event event
Definition: glew.h:3695
BRAY_SceneOption
Definition: BRAY_Types.h:66
const void * ptr(const T *p)
Definition: format.h:3292
bool isValid() const
virtual int setVolume(int speaker, float vol)
fpreal64 optionF(BRAY_SceneOption t) const
MaterialPtr(BRAY_VexMaterial *mat=nullptr)
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:47
FMT_CONSTEXPR bool find(Ptr first, Ptr last, T value, Ptr &out)
Definition: format.h:2104
FacesetMaterial(const GT_DataArrayHandle &facelist=GT_DataArrayHandle(), const MaterialPtr &material=MaterialPtr(), const OptionSet &options=OptionSet())
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)
SYS_FORCE_INLINE bool propertyIsVariadic(BRAY_ObjectProperty token) const
Return whether an property has variadic arguments.
#define BRAY_API
Definition: BRAY_API.h:12
const GLuint * ids
Definition: glew.h:1684
BRAY_PropertyType
Definition: BRAY_Types.h:263
getOption("OpenEXR.storage") storage
Definition: HDK_Image.dox:276
RenderStage myStage
Current state of rendering.
bool optionB(BRAY_SceneOption t) const
Interface to the renderer.
fpreal64 propertyF(BRAY_SceneOption t) const
GLsizei const GLfloat * value
Definition: glew.h:1849
GLdouble GLdouble t
Definition: glew.h:1398
const VPRM_OptionSetPtr & options() const
BRAY_Object * objectPtr()
BRAY_Scene * scenePtr()
UT_StringArray myFilterErrors
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.
type
Definition: core.h:528
fpreal myTotalWallClock
Render times.