HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BRAY_Types.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_Types.h (BRAY Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __BRAY_Types__
12 #define __BRAY_Types__
13 
14 #include "BRAY_API.h"
15 #include <UT/UT_StringHolder.h>
16 #include <UT/UT_StringMap.h>
17 #include <UT/UT_UniquePtr.h>
18 #include <GT/GT_Types.h>
19 
20 class UT_WorkBuffer;
21 
22 enum
23 {
24  // Note - when adding event types, make sure to update ::eventType()
25  BRAY_EVENT_NEW_FLAG, // Added a new object
26  BRAY_EVENT_DEL_FLAG, // Object is being deleted
27  BRAY_EVENT_ATTRIB_P_FLAG, // P attribute changed
28  BRAY_EVENT_ATTRIB_FLAG, // Generic attribute changed
29  BRAY_EVENT_TOPOLOGY_FLAG, // Topology changed
30  BRAY_EVENT_XFORM_FLAG, // Transforms changed
31  BRAY_EVENT_CONTENTS_FLAG, // Contents changed (add/delete objects)
32  BRAY_EVENT_PROPERTIES_FLAG, // Instance properties changed
33  BRAY_EVENT_MATERIAL_FLAG, // Material has changed
34  BRAY_EVENT_TRACESET_FLAG, // Traceset has changed
35 
37 };
39 #define ENUM_FLAG(TOKEN) BRAY_EVENT_##TOKEN = (1 << BRAY_EVENT_##TOKEN##_FLAG)
40 /// Types of events that can be sent as updates to the renderer
42 {
44  ENUM_FLAG(NEW),
45  ENUM_FLAG(DEL),
46  ENUM_FLAG(ATTRIB_P),
48  ENUM_FLAG(TOPOLOGY),
49  ENUM_FLAG(XFORM),
50  ENUM_FLAG(CONTENTS),
51  ENUM_FLAG(PROPERTIES),
52  ENUM_FLAG(MATERIAL),
53  ENUM_FLAG(TRACESET),
54 };
55 #undef ENUM_FLAG
56 
57 static inline BRAY_EventType
58 operator|(BRAY_EventType a, BRAY_EventType b)
59 {
60  return BRAY_EventType(uint(a)|uint(b));
61 }
62 
63 /// Create a nice string for the event type mask
65 
66 /// Option tokens used at the "global" (scene) level
67 /// @note If you add an scene option, please update BRAY_HdUtil.C
69 {
70  BRAY_OPT_RENDERER = 0, // Name of the renderer (read-only)
71  BRAY_OPT_VERSION, // Houdini version (read-only)
72  BRAY_OPT_ENGINE, // Accelerator (deprecated)
73  BRAY_OPT_DELEGATE, // Accelerator
74 
75  // Controls for general rendering
83  BRAY_OPT_CONVERGENCE_MODE, // branched/pathtraced integration convergence switch
84  BRAY_OPT_RR_CUTOFF_DEPTH, // russian roulette cutoff depth
85  BRAY_OPT_CONSTRAIN_MAX_ROUGH, // Constrain by maximum roughness
87 
88  BRAY_OPT_IMAGEMODE, // Bucket rendering mode
89  BRAY_OPT_PROGRESSIVE_PASSES,// Number of progressive passes before bucket mode
90 
91  BRAY_OPT_HD_FOREGROUND, // Hydra renders in foreground (not background)
93  BRAY_OPT_IPR_INC_RANDOM, // Random seed modified each IPR render
96  BRAY_OPT_IPR_INTERACTION, // Interaction mode (see enum)
97  BRAY_OPT_IPR_BUCKETS_FOR_IMAGEFILTER, // Buckets rendered before image filters
98  BRAY_OPT_IPR_TIME_FOR_IMAGEFILTER, // Timeout before image filters run
99  BRAY_OPT_IPR_PROXY_FOR_IMAGEFILTER, // Proxy step before running filters
100 
101  // Controls for off-line rendering cache
102  BRAY_OPT_USECACHERATIO, // Whether to use the cache ratio
103  BRAY_OPT_CACHERATIO, // Amount of memory to use as cache
104  BRAY_OPT_CACHESIZE, // Absolute cache ratio
105 
106  // Object settings overrides
107  BRAY_OPT_OVERRIDE_OBJECT, // Override object settings matching this pattern
108 
109  // Control for disabled lighting
110  BRAY_OPT_OVERRIDE_LIGHTING, // Override lighting mode
111  BRAY_OPT_DISABLE_LIGHTING, // Disable all lighting (headlight)
112  BRAY_OPT_AO_SAMPLES, // Ambient occlusion samples for headlight
113  BRAY_OPT_AO_DISTANCE, // Ambient occlusion max distance for headlight
114  BRAY_OPT_AO_COLORLIMIT, // Ambient occlusion color limit threshold
115  BRAY_OPT_DEPTHCUE_COLOR, // Color for depthcue fog
116  BRAY_OPT_DEPTHCUE_ALPHA, // Alpha for depthcue fog
117  BRAY_OPT_DEPTHCUE_Z, // Distance range for depth cue fog (near,far)
118 
119  // Controls for lighting modes
120  BRAY_OPT_LIGHT_SAMPLING_MODE, // (0[Uniform], 1[Light Tree])
125 
126  // Renderer working color space
128 
132  BRAY_OPT_DICING_QUALITY_SCALE, // Multiplier for DICING_QUALITY
133  BRAY_OPT_IPR_CONTINUOUS_DICING, // IPR continuous dicing
134  BRAY_OPT_ENABLE_DOF, // Enable DOF
135  BRAY_OPT_IMAGE_BLUR, // Image motion blur
136  BRAY_OPT_FRAME_SHUTTER_TIME, // Shutter time to map to the frame
137 
138  BRAY_OPT_RESOLUTION, // Should match the data window size
141  BRAY_OPT_IMAGEFILTER, // Image filter plugins (JSON string)
144  BRAY_OPT_SAMPLEFILTER, // Sample filter plugins (JSON string)
145  BRAY_OPT_PIXELORACLE, // Pixel oracle
146 
149 
160 
162 
163  // Image properties
164  BRAY_OPT_DATAWINDOW, // Window size should match resolution
166 
167  // Deep image properties
170 
171  BRAY_OPT_UNITS, // The metres per unit in world space
172 
173  // Path guiding
183 
184  // Texture baking
186  BRAY_OPT_UVUNWRAP_INFO, // Print out baking information
194 
195  BRAY_OPT_BAKE_GT_ENGINE, // GT_GPUTrace Engine (embree or optix)
196  BRAY_OPT_BAKE_MODE, // Baking mode
197  BRAY_OPT_BAKE_UDIM, // UDIM for baking
198  BRAY_OPT_BAKE_LOW, // Low res mesh
199  BRAY_OPT_BAKE_CAGE, // Cage mesh
200  BRAY_OPT_BAKE_HIGH, // High res mesh
201  BRAY_OPT_BAKE_UV, // uv attribute name
202 
203  // Parameters for baking
205  BRAY_OPT_BAKE_TRACE_BIAS, // Bias for trace from low to high mesh
206  BRAY_OPT_BAKE_OC_ENABLE, // Occlusion Enable
207  BRAY_OPT_BAKE_OC_SAMPLES, // Number of samples for occlusion
208  BRAY_OPT_BAKE_OC_MAXDIST, // Occlusion maximum distance
209  BRAY_OPT_BAKE_OC_BIAS, // Occlusion bias
210  BRAY_OPT_BAKE_TH_ENABLE, // Thickness Enable
211  BRAY_OPT_BAKE_TH_SAMPLES, // Number of samples for thickness
212  BRAY_OPT_BAKE_CV_ENABLE, // Cavity Enable
213  BRAY_OPT_BAKE_CV_SAMPLES, // Number of samples for cavity
214  BRAY_OPT_BAKE_CV_MAXDIST, // Cavity maximum distance
215  BRAY_OPT_BAKE_CV_BIAS, // Cavity bias
216  BRAY_OPT_BAKE_CV_RAYBIAS, // Cavity ray bias
217  BRAY_OPT_BAKE_CU_ENABLE, // Curvature Enable
218  BRAY_OPT_BAKE_CU_SAMPLES, // Number of samples for curvature
219  BRAY_OPT_BAKE_CU_SCALE, // Curvature scale
220  BRAY_OPT_BAKE_CU_BIAS, // Cavity bias
221  BRAY_OPT_BAKE_CU_SDIST, // Curvature s distance
222  BRAY_OPT_BAKE_EG_ENABLE, // Edge Enable
223  BRAY_OPT_BAKE_EG_RADIUS, // Edge Radius
224  BRAY_OPT_BAKE_EG_CUSPANGLE, // Edge cusp angle
226  BRAY_OPT_BAKE_EG_SAMPLES, // Edge samples
227  BRAY_OPT_BAKE_EG_MODE, // Edge mode
228  BRAY_OPT_BAKE_RN_ENABLE, // Rounded Normal Enable
229  BRAY_OPT_BAKE_RN_RADIUS, // Rounded Normal Radius
230  BRAY_OPT_BAKE_RN_CUSPANGLE, // Rounded Normal cusp angle
231  BRAY_OPT_BAKE_RN_RAYBIAS, // Rounded Normal bias
232  BRAY_OPT_BAKE_RN_SAMPLES, // Rounded Normal samples
233  BRAY_OPT_BAKE_RN_MODE, // Rounded Normal mode
234  BRAY_OPT_BAKE_USE_LIGHTING, // Enable lighting
235  BRAY_OPT_BAKE_PBOX_MODE, // Mode for scene bounding box
236  BRAY_OPT_BAKE_PBOX_UNIFORM, // Uniform or stretched
237  BRAY_OPT_BAKE_PBOX_MIN, // Minimum scene bounds
238  BRAY_OPT_BAKE_PBOX_MAX, // Maximum scene bounds
239 
240  // Parameters for edge detection
242 
245 
252 
256 
263 
265 
267 
269 
272 };
273 
274 /// @note If you add an object property, please update BRAY_HdUtil.C
276 {
278  BRAY_OBJ_SAMPLE_FROM_STAGE, // Choose motion segments by samples on stage
279  BRAY_OBJ_GEO_VELBLUR, // (0[no blur], 1[vel blur], 2[accel blur])
282  BRAY_OBJ_BLUR_STYLE, // (0[lin], 1[rot])
283 
284  BRAY_OBJ_INSTANCE_VELBLUR, // (0[no blur], 1[vel blur], 2[accel blur])
286 
287  BRAY_OBJ_DICING_QUALITY, // <= 0[no dicing], 1[on m-p per pixel]
289  BRAY_OBJ_TRUE_DISPLACE, // int (0 = bump map, 1 = true, 2 = disable)
290  BRAY_OBJ_DICING_DEPTH_MIN, // integer (-1: unbound)
291  BRAY_OBJ_DICING_DEPTH_MAX, // integer (-1: unbound)
293 
294  BRAY_OBJ_STENCILMAP, // asset/string
295  BRAY_OBJ_STENCIL_THRESH, // stencil threshold
296  BRAY_OBJ_STENCIL_INTERP, // stencil interpolation
298 
299  /// @{
300  /// @note: The order must match theBsdfBounceTypes in PBR_Types.h
306 
312 
318  /// @}
319 
320  BRAY_OBJ_VOLUME_SAMPLING, // (0[raymarch], 1[woodcock/delta])
332 
334 
339 
341 
342  BRAY_OBJ_POINT_STYLE, // Point rendering style
343  BRAY_OBJ_CURVE_STYLE, // Curve style
344  BRAY_OBJ_CURVE_BASIS, // Curve basis override
345  BRAY_OBJ_WIDTH_SCALE, // Scale on point/curve widths
346 
347  BRAY_OBJ_TREAT_AS_LIGHTSOURCE, // (0[no], 1[yes], 2[auto], 3[yes-LightAPI])
348  BRAY_OBJ_IS_LIGHTSOURCE, // invisible, set by BRAY under the hood
349  BRAY_OBJ_VOLLIGHT_IMPORTANCE_GRID_SIZE, // int (invisible, for now)
350  BRAY_OBJ_GEOLIGHT_NUM_PERPRIM_CESAMPS, // int (invisible, for now)
351 
355 
358 
360  BRAY_OBJ_CULL_BACKFACE, // (0[off], 1[cull back], 2[cull front])
361 
363  BRAY_OBJ_RENDER_MASK, // invisible, used only by karma delegate
364  BRAY_OBJ_CUSTOM_TRACESETS, // Custom trace groups
365  BRAY_OBJ_SSS_TRACESET, // Trace set for SSS
366  BRAY_OBJ_LPE_TAG, // string
367 
372 
374 
377 
382 
383  // per-component variance AA settings
387 
390 
391  // UV unwrapping IDs
395 
396  // bounce limit color/texture
399 
400  // edge detection
410 
411  // baker
414  BRAY_OBJ_BAKER_VISIBILITY_CULL_BACKFACE, // (0[off], 1[cull back], 2[cull front])
415 
418 };
419 
421 {
427  BRAY_CAMERA_CLIP, // real[2] (near and far)
428  BRAY_CAMERA_SHUTTER, // real[2] (open and close)
431  BRAY_CAMERA_WINDOW, // real[4] (NDC mapping window)
433  BRAY_CAMERA_TINT, // real[3]
435 
438 };
439 
441 {
443  BRAY_LIGHT_SHADER, // string
444  BRAY_LIGHT_AREA_SHAPE, // int (see BRAY_LightType)
453  BRAY_LIGHT_MIS_BIAS, // real [-1,1]
455  BRAY_LIGHT_SAMPLING_MODE, // int (see LightSamplingMode)
457  BRAY_LIGHT_CATEGORY, // string: category name
458  BRAY_LIGHT_HDRI_MAX_ISIZE, // int (max size for importance sampling tables)
459  BRAY_LIGHT_DISTANT_ANGLE, // float (angle which subtends sun)
460  BRAY_LIGHT_DIFFUSE_SCALE, // float multiplier for diffuse/sss/volume
461  BRAY_LIGHT_SPECULAR_SCALE, // float multiplier for refl/refr
462  BRAY_LIGHT_SINGLE_SIDED, // bool, single or double sided
467  BRAY_LIGHT_ILLUM_BACKGROUND, // bool illuminates background holdout
469  BRAY_LIGHT_CONTRIBUTES_CAUSTIC, // bool contributes to caustic
470  BRAY_LIGHT_SKY_LIGHT, // Type of sky light (none, sky, sky+sun, sun)
471  BRAY_LIGHT_SPREAD, // float (0,1] spread value
472  BRAY_LIGHT_IS_PORTAL, // bool, a UsdLuxPortalLight (internal only)
473 
476 };
477 
479 {
480  BRAY_PLANE_FILTER, // Pixel filter
481  BRAY_PLANE_SAMPLING, // Sample filtering (0 = average etc.)
482  BRAY_PLANE_DITHER, // Dither for quantizing to integer values
483  BRAY_PLANE_DEFAULT_VALUE, // Default value for 1-channel planes
484  BRAY_PLANE_CRYPTO_ENABLE, // Cryptomatte enable
485  BRAY_PLANE_CRYPTO_RANK, // Cryptomatte maximum rank
486  BRAY_PLANE_CRYPTO_SIDECAR, // Cryptomatte sidecar manifest file
487  BRAY_PLANE_UTILITY_PATH_EXPRESSION, // LPE for utility AOV
488 
491 };
492 
494 {
500 
503 };
504 
505 /// Not all applications are able to load HDAs. If an application is able to
506 /// load HDAs, it should create a subclass of BRAY_HDALoader and instantiate a
507 /// loader. The constructor will register the class for the application and
508 /// the destructor will de-register.
510 {
511 public:
512  BRAY_HDALoader();
513  virtual ~BRAY_HDALoader();
514 
515  /// The className() is used to print out error messages in case there are
516  /// multiple HDA loaders instantiated.
517  virtual const char *className() const = 0;
518 
519  /// Return true if the HDA given by the path was loaded. It's possible the
520  /// same path may be passed multiple times, and it's up to the implementor
521  /// to optimize for this case. It's up to the implementor to print out
522  /// errors using UT_ErrorLog.
523  virtual bool loadHDA(const UT_StringHolder &path) = 0;
524 };
525 
526 /// Return the name of the renderer
528 
529 /// Look up the enum given a name.
531 {
532  switch (ty)
533  {
534  case BRAY_SCENE_PROPERTY:
538  case BRAY_LIGHT_PROPERTY:
542  case BRAY_PLANE_PROPERTY:
544  default:
545  break;
546  }
547  return 0;
548 }
549 
550 /// Set of properties which can be picked up by the Material properties VOP
551 ///
552 /// Not all object properties can be specified on a material. For example,
553 /// it's not possible to specify the point rendering style on a material
554 /// property.
556 
557 /// Not all properties can be specified on an instance level.
559 
561  BRAY_PropertyType ty, int id);
563  const UT_StringRef &name);
566 
567 inline bool
569 {
570  return GT_STORE_INVALID
571  != BRAYpropertyStorage(ty, id);
572 }
573 
574 inline bool
575 BRAYisValid(const std::pair<BRAY_PropertyType, int> &prop)
576 {
577  return BRAYisValid(prop.first, prop.second);
578 }
579 
580 #define PROPERTY_LOOKUP(NAME, STYLE, ENUM) \
581  inline ENUM BRAY##NAME(const UT_StringRef &name) \
582  { return ENUM(BRAYproperty(STYLE, name)); } \
583  inline const UT_StringHolder &BRAY##NAME(ENUM token) \
584  { return BRAYproperty(STYLE, token); } \
585  inline exint BRAY##NAME##Size(ENUM token) \
586  { return BRAYpropertySize(STYLE, token); } \
587  inline GT_Storage BRAY##NAME##Storage(ENUM token) \
588  { return BRAYpropertyStorage(STYLE, token); } \
589  /* end of macro */
595 #undef PROPERTY_LOOKUP
596 
597 /// Lookup a property type by name
599 /// Look up the name of a property type by the id
601 
602 /// This function will resolve generic names to the appropriate property type
603 /// and property identifier. For example:
604 /// "plane:filter" -> {BRAY_PLANE_PROPERTY, BRAY_PLANE_FILTER}
605 /// "camera:focal" -> {BRAY_CAMERA_PROPERTY, BRAY_CAMERA_FOCAL}
606 /// "global:bucketsize" -> {BRAY_SCENE_PROPERTY, BRAY_OPT_BUCKETSIZE}
607 /// If the token doesn't map to a property, the function will return an invalid
608 /// pair (i.e. BRAYisValid(result) == false).
609 ///
610 /// If the token isn't prefixed with a property type, the @c default_style will
611 /// be used. For example, with the default of BRAY_SCENE_PROPERTY:
612 /// "bucketsize" -> { BRAY_SCENE_PROPERTY, BRAY_OPT_BUCKETSIZE }
613 /// "focal" -> {invalid_property_pair} (error - not a scene property)
614 BRAY_API extern std::pair<BRAY_PropertyType, int>
615  BRAYproperty(const char *token,
617 
618 /// Given a property type, this will compose a name string that fully qualifies
619 /// the property. This is a string that would be suitable for @c
620 /// BRAYlookupProperty(). This may return a @c nullptr.
621 BRAY_API extern const char *BRAYproperty(UT_WorkBuffer &storage,
623  int property_id,
624  const char *prefix = "");
625 
626 /// @{
627 /// Generic method to return the number of options given an enum
628 template <typename T> static inline constexpr size_t BRAYmaxOptions()
629 { SYS_UNIMPLEMENTED_TEMPLATE(T); return 0; }
630 
631 template <> inline constexpr size_t
633 template <> inline constexpr size_t
635 template <> inline constexpr size_t
637 template <> inline constexpr size_t
639 template <> inline constexpr size_t
641 /// @}
642 
643 /// @{
644 /// Generic method to find the valud of the property type enum given the enum
645 template <typename T> static inline constexpr BRAY_PropertyType BRAYpropertyType()
647 
648 template <> inline constexpr BRAY_PropertyType
650 template <> inline constexpr BRAY_PropertyType
652 template <> inline constexpr BRAY_PropertyType
654 template <> inline constexpr BRAY_PropertyType
656 template <> inline constexpr BRAY_PropertyType
658 /// @}
659 
660 
662 {
663  BRAY_OVERRIDE_LIGHT_OFF, // Standard lighting
664  BRAY_OVERRIDE_LIGHT_EMISSIVE, // Only emissive objects
665  BRAY_OVERRIDE_LIGHT_HEADLIGHT, // Force: Headlight
666  BRAY_OVERRIDE_LIGHT_DOMELIGHT, // Force: Dome Light
667 };
668 
670 {
680 
683 };
684 
686 {
693 
695 };
696 
697 // Different types of user interaction in IPR
699 {
706 
708 };
709 
711 {
712  BRAY_BUCKETORDER_MIDDLE, // Render starting centered on focus point
713  BRAY_BUCKETORDER_TOP, // Render top down
714  BRAY_BUCKETORDER_BOTTOM, // Render bottom up
715  BRAY_BUCKETORDER_LEFT, // Render left to right
716  BRAY_BUCKETORDER_RIGHT, // Render right to left
717 
719 };
720 
722 {
723  BRAY_IMAGEMODE_PROGRESSIVE, // Pass over all buckets on image
724  BRAY_IMAGEMODE_BUCKET, // Finish buckets before advancing
725 
727 };
728 
729 /// Projection modes for rendering
731 {
732  BRAY_PROJ_ORTHOGRAPHIC, // orthographic projection mode
733  BRAY_PROJ_PERSPECTIVE, // perspective projection mode
734  BRAY_PROJ_CVEX_SHADER, // run a CVEX lens shader
735  BRAY_PROJ_BAKING, // Custom baking projection mode
736 
739 };
740 
742 {
743  BRAY_RAYIMPORT_P, // vector: ray origin
744  BRAY_RAYIMPORT_D, // vector: ray direction
745  BRAY_RAYIMPORT_TIME, // float: shutter time
746  BRAY_RAYIMPORT_NEAR, // float: near bias
747  BRAY_RAYIMPORT_FAR, // float: max distance
748  BRAY_RAYIMPORT_MASK, // int: intersection mask
749  BRAY_RAYIMPORT_CONTRIB, // vector: contribution
750 
751  BRAY_RAYIMPORT_HIT_ISHIT, // bool: Hit or miss
752  BRAY_RAYIMPORT_HIT_P, // vector: Hit position (in world space)
753  BRAY_RAYIMPORT_HIT_P_CAMERA,// vector: Hit position (in camera space)
754  BRAY_RAYIMPORT_HIT_Pz, // float: Pz (in space of camera)
755  BRAY_RAYIMPORT_HIT_VELOCITY,// vector: Hit velocity (in world space)
756  BRAY_RAYIMPORT_HIT_MOTION, // vector: Motion Vector (in raster space)
757  BRAY_RAYIMPORT_HIT_STACK, // int[]: Hit stack
758  BRAY_RAYIMPORT_HIT_ELEM, // int: Hit element (raw id)
759  BRAY_RAYIMPORT_HIT_PRIMID, // int: Hit primitive id
760  BRAY_RAYIMPORT_HIT_COORD, // vector: raw parametric coords {u,v,w}
761  BRAY_RAYIMPORT_HIT_DIST, // float: Hit distance
762  BRAY_RAYIMPORT_HIT_DPDZ, // float: dPdz
763  BRAY_RAYIMPORT_HIT_N, // vector: smooth normal
764  BRAY_RAYIMPORT_HIT_N_CAMERA,// vector: smooth normal (in camera space)
765  BRAY_RAYIMPORT_HIT_N_FACING,// vector: view facing smooth normal (in world space)
766  BRAY_RAYIMPORT_HIT_N_FACINGRATIO, // float: facing ratio of smooth normal
767  BRAY_RAYIMPORT_HIT_Ng, // vector: geometric normal
768  BRAY_RAYIMPORT_HIT_Ng_CAMERA, // vector: geometric normal (in camera space)
769  BRAY_RAYIMPORT_HIT_Ng_FACING, // vector: view facing geometric normal (in world space)
770  BRAY_RAYIMPORT_HIT_Ng_FACINGRATIO, // float: facing ratio of geometric normal
771  BRAY_RAYIMPORT_HIT_FLAGS, // int: hit flags
772  BRAY_RAYIMPORT_HIT_OBJECTID,// int: hit object id
773  BRAY_RAYIMPORT_HIT_ISBACKFACE, // bool: is hit object backface
774  BRAY_RAYIMPORT_HIT_AUTOBIAS, // float: automatic ray bias
775  BRAY_RAYIMPORT_LEVEL, // int: ray level
776  BRAY_RAYIMPORT_VOLUME_LEVEL,// int: ray volume level
777  BRAY_RAYIMPORT_PIXEL_SAMPLES, // int: pixel samples (ie camera rays)
778  BRAY_RAYIMPORT_HD_PRIM, // int: hydra rprim id for selection
779  BRAY_RAYIMPORT_HD_INST, // int: hydra inst idx (0th level) for selection
780  BRAY_RAYIMPORT_NOFAKECAUSTICS, // bool: disable fake caustics
781 
782  BRAY_RAYIMPORT_CURVE_ATTRIB_P, // vector: interpolated curve position
783  BRAY_RAYIMPORT_CURVE_ATTRIB_WIDTH, // float: interpolated curve width
784  BRAY_RAYIMPORT_CURVE_ATTRIB_TANV, // vector: interpolated curve pos derivative
785 
786  BRAY_RAYIMPORT_ISSHADOWRAY, // bool: is the ray a shadow ray (i.e. isshadowray)
787  BRAY_RAYIMPORT_CONESPREAD, // float: ray cone half angle
788 
789  BRAY_RAYIMPORT_BAKE_P, // P from the bake state
803  BRAY_RAYIMPORT_BAKE_MINBOX, // Minimum bounds
804  BRAY_RAYIMPORT_BAKE_MAXBOX, // Maximum bounds
805  BRAY_RAYIMPORT_BAKE_MINBOX_LOW, // Minimum bounds (low mesh)
806  BRAY_RAYIMPORT_BAKE_MAXBOX_LOW, // Maximum bounds (low mesh)
807  BRAY_RAYIMPORT_BAKE_MINBOX_HIGH, // Minimum bounds (high mesh)
808  BRAY_RAYIMPORT_BAKE_MAXBOX_HIGH, // Maximum bounds (high mesh)
809  BRAY_RAYIMPORT_BAKE_MINBOX_CAGE, // Minimum bounds (cage mesh)
810  BRAY_RAYIMPORT_BAKE_MAXBOX_CAGE, // Maximum bounds (cage mesh)
811  BRAY_RAYIMPORT_BAKE_TRACESET, // The integer traceset
812  BRAY_RAYIMPORT_BAKE_AO, // Ambient Occlusion
817  BRAY_RAYIMPORT_BAKE_RN, // Rounded Normal
818 
819  BRAY_RAYIMPORT_SHADING_FLAGS, // int (ShadeInfoFlags enum)
820 
822  BRAY_RAYIMPORT_INVALID = BRAY_RAYIMPORT_MAX // Not a valid ray import
823 };
824 
826 {
827  BRAY_LIGHTIMPORT_SURFNORMAL, // vector: surface normal in light shader
828  BRAY_LIGHTIMPORT_SURFACEINCIDENT, // vector: surface camera vector in light shader
829  BRAY_LIGHTIMPORT_LIGHTVECTOR, // vector: surface to light vector in light shader
830  BRAY_LIGHTIMPORT_SURFACEPOSITION, // vector: surface position in light shader
831 
833  BRAY_LIGHTIMPORT_INVALID = BRAY_LIGHTIMPORT_MAX // Not a valid light import
834 };
835 
836 #define ENUM_MAPPER(TYPE, METHOD) \
837  BRAY_API extern TYPE METHOD(const UT_StringRef &name); \
838  BRAY_API extern const UT_StringHolder &METHOD(TYPE o); \
839  /* end macro */
840 
841 ENUM_MAPPER(BRAY_LightType, BRAYlightType)
842 ENUM_MAPPER(BRAY_RenderStage, BRAYrenderStage)
843 ENUM_MAPPER(BRAY_InteractionType, BRAYinteractionType)
844 ENUM_MAPPER(BRAY_BucketOrder, BRAYbucketOrder)
845 ENUM_MAPPER(BRAY_ImageMode, BRAYimageMode)
846 ENUM_MAPPER(BRAY_Projection, BRAYprojection)
847 ENUM_MAPPER(BRAY_VexRayImport, BRAYrayImport)
848 ENUM_MAPPER(BRAY_VexLightImport, BRAYlightImport)
849 
850 #undef ENUM_MAPPER
851 
852 /// Consistent representation of time type within BRAY
853 using BRAYtime = float;
854 
855 /// Consistent representation for material ids
857 
858 /// Invalid material id
859 static constexpr BRAYmaterialId BRAY_INVALID_MATERIAL_ID = 0;
860 
861 /// List of known LPE prefixes
863 {
867 };
868 static inline BRAY_LPEPrefix
869 operator|(BRAY_LPEPrefix a, BRAY_LPEPrefix b)
870 {
871  return BRAY_LPEPrefix(uint(a)|uint(b));
872 }
873 static inline BRAY_LPEPrefix
874 operator&(BRAY_LPEPrefix a, BRAY_LPEPrefix b)
875 {
876  return BRAY_LPEPrefix(uint(a)&uint(b));
877 }
878 
880 {
888 
891 
895 };
896 
897 #define ENUM_TO_MASK(TOKEN) TOKEN = (1 << TOKEN##_ENUM)
898 /// Ray visibility flags
900 {
902 
903  ENUM_TO_MASK(BRAY_RAY_CAMERA),
904  ENUM_TO_MASK(BRAY_RAY_DIFFUSE),
905  ENUM_TO_MASK(BRAY_RAY_REFLECT),
906  ENUM_TO_MASK(BRAY_RAY_REFRACT),
907  ENUM_TO_MASK(BRAY_RAY_VOLUME),
908  ENUM_TO_MASK(BRAY_RAY_SHADOW_REG),
909  ENUM_TO_MASK(BRAY_RAY_SHADOW_BG),
910 
911  ENUM_TO_MASK(BRAY_PROXY_CAMERA),
912  ENUM_TO_MASK(BRAY_PROXY_SHADOW),
913 
914  ENUM_TO_MASK(BRAY_GUIDE_CAMERA),
915  ENUM_TO_MASK(BRAY_GUIDE_SHADOW),
916 
917  BRAY_RAY_SHADOW = (BRAY_RAY_SHADOW_REG | BRAY_RAY_SHADOW_BG),
918  BRAY_ANY_CAMERA = (BRAY_RAY_CAMERA | BRAY_PROXY_CAMERA | BRAY_GUIDE_CAMERA),
919  BRAY_ANY_SHADOW = (BRAY_RAY_SHADOW | BRAY_PROXY_SHADOW | BRAY_GUIDE_SHADOW),
920 
921  // Temporary flag only for the hydra delegate's internal use. DO NOT USE!
923 
924  BRAY_RAY_ALL = 0x7FFF,
925 
926  BRAY_RAY_PROXY_MASK = (BRAY_PROXY_CAMERA|BRAY_PROXY_SHADOW),
927  BRAY_RAY_GUIDE_MASK = (BRAY_GUIDE_CAMERA|BRAY_GUIDE_SHADOW),
930  ENUM_TO_MASK(BRAY_RAY_SSS),
931 };
932 #undef ENUM_TO_MASK
933 
934 static inline BRAY_RayVisibility
936 {
937  return BRAY_RayVisibility(uint(a)|uint(b));
938 }
939 static inline BRAY_RayVisibility
941 {
942  return BRAY_RayVisibility(uint(a)&uint(b));
943 }
944 static inline BRAY_RayVisibility
945 operator~(BRAY_RayVisibility a)
946 {
947  return BRAY_RayVisibility(~uint(a));
948 }
949 
951 
952 /// Generic method to return the number of components for a given import
953 /// Note that arrays types return 0 (see BRAYrayImportArray())
954 template <BRAY_VexRayImport T> static inline constexpr size_t BRAYrayImportSize()
955 {
956 #if !defined(__clang__) && !SYS_IS_GCC_GE(9, 2)
958 #endif
959  return 0;
960 }
961 /// Generic method to return whether the import variable is array valued
962 template <BRAY_VexRayImport T> static inline constexpr bool BRAYrayImportIsArray()
963 {
964 #if !defined(__clang__) && !SYS_IS_GCC_GE(9, 2)
966 #endif
967  return false;
968 }
969 
970 
971 template <BRAY_VexLightImport T> static inline constexpr size_t BRAYlightImportSize()
972 {
973 #if !defined(__clang__) && !SYS_IS_GCC_GE(9, 2)
975 #endif
976  return 0;
977 }
978 /// Generic method to return whether the import variable is array valued
979 template <BRAY_VexLightImport T> static inline constexpr bool BRAYlightImportIsArray()
980 {
981 #if !defined(__clang__) && !SYS_IS_GCC_GE(9, 2)
983 #endif
984  return false;
985 }
986 
987 #define INSTANTIATE(VAR, SIZE, IS_ARRAY) \
988  template <> inline constexpr size_t \
989  BRAYrayImportSize<VAR>() { return SIZE; } \
990  template <> inline constexpr bool \
991  BRAYrayImportIsArray<VAR>() { return IS_ARRAY; } \
992  /* end of macro */
993 
994 INSTANTIATE(BRAY_RAYIMPORT_P, 3, false)
995 INSTANTIATE(BRAY_RAYIMPORT_D, 3, false)
1029 
1030 #undef INSTANTIATE
1031 
1032 #define INSTANTIATE(VAR, SIZE, IS_ARRAY) \
1033  template <> inline constexpr size_t \
1034  BRAYlightImportSize<VAR>() { return SIZE; } \
1035  template <> inline constexpr bool \
1036  BRAYlightImportIsArray<VAR>() { return IS_ARRAY; } \
1037  /* end of macro */
1038 
1043 #undef INSTANTIATE
1044 
1045 // LightSamplingMode
1046 // enum for BRAY_OPT_LIGHT_SAMPLING_MODE
1048 {
1049  BRAY_LSM_UNIFORM = 0, // uniform sampling
1050  BRAY_LSM_LIGHT_TREE // light hierarchy
1051 };
1052 
1053 // LightTreeType (flags)
1054 // the types of light-tree we can have
1056 {
1057  BRAY_LTT_NONE = 0, // light-tree is disabled
1058  BRAY_LTT_AREA = (1 << 0), // area light-tree
1059  BRAY_LTT_POINT = (1 << 1) // point light-tree
1060 };
1061 
1062 
1063 // TreatAsLightSourceOpts
1064 // enum for BRAY_OBJ_TREAT_AS_LIGHTSOURCE
1066 {
1067  TALS_NO = 0,
1071 };
1072 
1073 // For a LightAPI applied to geometry that has a bound Material,
1074 // which is entirely or partly emissive, this specifies the relationship
1075 // of the Material response to the lighting response.
1077 {
1081 };
1082 
1085 
1086 #endif
BRAY_EventType
Types of events that can be sent as updates to the renderer.
Definition: BRAY_Types.h:41
BRAY_API constexpr exint BRAYpropertyCount(BRAY_PropertyType ty)
Look up the enum given a name.
Definition: BRAY_Types.h:530
GT_Storage
Definition: GT_Types.h:19
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
BRAY_OverrideLight
Definition: BRAY_Types.h:661
unsigned short uint16
Definition: SYS_Types.h:38
UT_ASSERT_COMPILETIME(BRAY_EVENT_MAXFLAGS<=32)
#define ENUM_TO_MASK(TOKEN)
Definition: BRAY_Types.h:897
constexpr BRAY_PropertyType BRAYpropertyType< BRAY_LightProperty >()
Definition: BRAY_Types.h:653
float BRAYtime
Consistent representation of time type within BRAY.
Definition: BRAY_Types.h:853
getFileOption("OpenEXR:storage") storage
Definition: HDK_Image.dox:276
BRAY_API GT_Storage BRAYpropertyStorage(BRAY_PropertyType ty, int id)
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
BRAY_API const UT_StringHolder & BRAYrendererName()
Return the name of the renderer.
int64 exint
Definition: SYS_Types.h:125
BRAY_GeoLightMaterialSyncMode
Definition: BRAY_Types.h:1076
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1222
BRAY_VexRayImport
Definition: BRAY_Types.h:741
BRAY_ImageMode
Definition: BRAY_Types.h:721
#define INSTANTIATE(VAR, SIZE, IS_ARRAY)
Definition: BRAY_Types.h:1032
BRAY_RayVisibilityEnum
Definition: BRAY_Types.h:879
BRAY_Projection
Projection modes for rendering.
Definition: BRAY_Types.h:730
BRAY_CameraProperty
Definition: BRAY_Types.h:420
constexpr size_t BRAYmaxOptions< BRAY_CameraProperty >()
Definition: BRAY_Types.h:638
BRAY_TreatAsLightSourceOpts
Definition: BRAY_Types.h:1065
constexpr BRAY_PropertyType BRAYpropertyType< BRAY_CameraProperty >()
Definition: BRAY_Types.h:655
BRAY_API exint BRAYpropertySize(BRAY_PropertyType ty, int id)
BRAY_VexLightImport
Definition: BRAY_Types.h:825
constexpr BRAY_PropertyType BRAYpropertyType< BRAY_PlaneProperty >()
Definition: BRAY_Types.h:657
UT_UniquePtr< BRAY_SpaceMap > BRAY_SpaceMapPtr
Definition: BRAY_Types.h:1084
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
constexpr size_t BRAYmaxOptions< BRAY_ObjectProperty >()
Definition: BRAY_Types.h:634
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
BRAY_ObjectProperty
Definition: BRAY_Types.h:275
BRAY_API UT_StringHolder BRAYrayVisibility(BRAY_RayVisibility mask)
BRAY_RenderStage
Definition: BRAY_Types.h:685
BRAY_RayVisibility
Ray visibility flags.
Definition: BRAY_Types.h:899
BRAY_LightSamplingMode
Definition: BRAY_Types.h:1047
constexpr size_t BRAYmaxOptions< BRAY_LightProperty >()
Definition: BRAY_Types.h:636
BRAY_API bool BRAYisValidMaterialProperty(BRAY_ObjectProperty p)
GLint GLuint mask
Definition: glcorearb.h:124
#define ENUM_MAPPER(TYPE, METHOD)
Definition: BRAY_Types.h:836
BRAY_LightTreeType
Definition: BRAY_Types.h:1055
#define PROPERTY_LOOKUP(NAME, STYLE, ENUM)
Definition: BRAY_Types.h:580
GLuint const GLchar * name
Definition: glcorearb.h:786
BRAY_LightProperty
Definition: BRAY_Types.h:440
BRAY_PlaneProperty
Definition: BRAY_Types.h:478
#define ENUM_FLAG(TOKEN)
Definition: BRAY_Types.h:39
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
constexpr size_t BRAYmaxOptions< BRAY_SceneOption >()
Definition: BRAY_Types.h:632
BRAY_InteractionType
Definition: BRAY_Types.h:698
BRAY_LightType
Definition: BRAY_Types.h:669
IMATH_NAMESPACE::V2f IMATH_NAMESPACE::Box2i std::string this attribute is obsolete as of OpenEXR v3 float
BRAY_SceneOption
Definition: BRAY_Types.h:68
BRAY_API bool BRAYisValidInstanceProperty(BRAY_ObjectProperty p)
Not all properties can be specified on an instance level.
#define BRAY_API
Definition: BRAY_API.h:12
#define SYS_UNIMPLEMENTED_TEMPLATE(T)
BRAY_PropertyType
Definition: BRAY_Types.h:493
int BRAYmaterialId
Consistent representation for material ids.
Definition: BRAY_Types.h:856
constexpr size_t BRAYmaxOptions< BRAY_PlaneProperty >()
Definition: BRAY_Types.h:640
BRAY_API BRAY_PropertyType BRAYpropertyType(const UT_StringRef &name)
Lookup a property type by name.
bool BRAYisValid(BRAY_PropertyType ty, int id)
Definition: BRAY_Types.h:568
constexpr BRAY_PropertyType BRAYpropertyType< BRAY_ObjectProperty >()
Definition: BRAY_Types.h:651
BRAY_LPEPrefix
List of known LPE prefixes.
Definition: BRAY_Types.h:862
BRAY_API const UT_StringHolder & BRAYproperty(BRAY_PropertyType ty, int id)
BRAY_API UT_StringHolder BRAYeventType(BRAY_EventType type)
Create a nice string for the event type mask.
constexpr BRAY_PropertyType BRAYpropertyType< BRAY_SceneOption >()
Definition: BRAY_Types.h:649
unsigned int uint
Definition: SYS_Types.h:45
BRAY_BucketOrder
Definition: BRAY_Types.h:710