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
78  BRAY_OPT_PERCENT_OF_SAMPLES, // Render a fraction of samples (by default 100)
84  BRAY_OPT_CONVERGENCE_MODE, // branched/pathtraced integration convergence switch
85  BRAY_OPT_RR_CUTOFF_DEPTH, // russian roulette cutoff depth
86  BRAY_OPT_CONSTRAIN_MAX_ROUGH, // Constrain by maximum roughness
88 
89  BRAY_OPT_IMAGEMODE, // Bucket rendering mode
90  BRAY_OPT_PROGRESSIVE_PASSES,// Number of progressive passes before bucket mode
91 
92  BRAY_OPT_HD_FOREGROUND, // Hydra renders in foreground (not background)
94  BRAY_OPT_IPR_INC_RANDOM, // Random seed modified each IPR render
97  BRAY_OPT_IPR_INTERACTION, // Interaction mode (see enum)
98  BRAY_OPT_IPR_BUCKETS_FOR_IMAGEFILTER, // Buckets rendered before image filters
99  BRAY_OPT_IPR_TIME_FOR_IMAGEFILTER, // Timeout before image filters run
100  BRAY_OPT_IPR_PROXY_FOR_IMAGEFILTER, // Proxy step before running filters
101 
102  // Controls for off-line rendering cache
103  BRAY_OPT_USECACHERATIO, // Whether to use the cache ratio
104  BRAY_OPT_CACHERATIO, // Amount of memory to use as cache
105  BRAY_OPT_CACHESIZE, // Absolute cache ratio
106 
107  // Object settings overrides
108  BRAY_OPT_OVERRIDE_OBJECT, // Override object settings matching this pattern
109 
110  // Control for disabled lighting
111  BRAY_OPT_OVERRIDE_LIGHTING, // Override lighting mode
112  BRAY_OPT_DISABLE_LIGHTING, // Disable all lighting (headlight)
113  BRAY_OPT_AO_SAMPLES, // Ambient occlusion samples for headlight
114  BRAY_OPT_AO_DISTANCE, // Ambient occlusion max distance for headlight
115  BRAY_OPT_AO_COLORLIMIT, // Ambient occlusion color limit threshold
116  BRAY_OPT_DEPTHCUE_COLOR, // Color for depthcue fog
117  BRAY_OPT_DEPTHCUE_ALPHA, // Alpha for depthcue fog
118  BRAY_OPT_DEPTHCUE_Z, // Distance range for depth cue fog (near,far)
119 
120  // Controls for lighting modes
121  BRAY_OPT_LIGHT_SAMPLING_MODE, // (0[Uniform], 1[Light Tree])
126 
127  // Renderer working color space
129 
133  BRAY_OPT_DICING_QUALITY_SCALE, // Multiplier for DICING_QUALITY
134  BRAY_OPT_IPR_CONTINUOUS_DICING, // IPR continuous dicing
135  BRAY_OPT_ENABLE_DOF, // Enable DOF
136  BRAY_OPT_IMAGE_BLUR, // Image motion blur
137  BRAY_OPT_FRAME_SHUTTER_TIME, // Shutter time to map to the frame
138 
139  BRAY_OPT_RESOLUTION, // Should match the data window size
142  BRAY_OPT_IMAGEFILTER, // Image filter plugins (JSON string)
146  BRAY_OPT_SAMPLEFILTER, // Sample filter plugins (JSON string)
147  BRAY_OPT_PIXELORACLE, // Pixel oracle
148 
151 
162 
164 
165  // Image properties
166  BRAY_OPT_DATAWINDOW, // Window size should match resolution
168 
169  // Deep image properties
172 
173  BRAY_OPT_UNITS, // The metres per unit in world space
174 
175  // Path guiding
185 
186  // Texture filtering
189 
190  // Texture baking
192  BRAY_OPT_UVUNWRAP_INFO, // Print out baking information
200 
201  BRAY_OPT_BAKE_GT_ENGINE, // GT_GPUTrace Engine (embree or optix)
202  BRAY_OPT_BAKE_MODE, // Baking mode
203  BRAY_OPT_BAKE_UDIM, // UDIM for baking
204  BRAY_OPT_BAKE_LOW, // Low res mesh
205  BRAY_OPT_BAKE_CAGE, // Cage mesh
206  BRAY_OPT_BAKE_HIGH, // High res mesh
207  BRAY_OPT_BAKE_UV, // uv attribute name
208 
209  // Parameters for baking
211  BRAY_OPT_BAKE_TRACE_BIAS_OPT, // Bias options (see BRAY_BakerBiasMode enum)
212  BRAY_OPT_BAKE_TRACE_BIAS, // Global bias for trace from low to high mesh
213  BRAY_OPT_BAKE_TRACE_BIAS_TEX, // Bias read from texture
214  BRAY_OPT_BAKE_TRACE_BIAS_ATTR, // Bias read from attribute
215  BRAY_OPT_BAKE_TRACE_MAX_OPT, // Max distance options (see BRAY_BakerBiasMode enum)
216  BRAY_OPT_BAKE_TRACE_MAX, // Global max for trace from low to high mesh
217  BRAY_OPT_BAKE_TRACE_MAX_TEX, // Max read from texture
218  BRAY_OPT_BAKE_TRACE_MAX_ATTR, // Max read from attribute
220  BRAY_OPT_BAKE_OC_ENABLE, // Occlusion Enable
221  BRAY_OPT_BAKE_OC_SAMPLES, // Number of samples for occlusion
222  BRAY_OPT_BAKE_OC_MAXDIST, // Occlusion maximum distance
223  BRAY_OPT_BAKE_OC_BIAS, // Occlusion bias
224  BRAY_OPT_BAKE_TH_ENABLE, // Thickness Enable
225  BRAY_OPT_BAKE_TH_SAMPLES, // Number of samples for thickness
226  BRAY_OPT_BAKE_CV_ENABLE, // Cavity Enable
227  BRAY_OPT_BAKE_CV_SAMPLES, // Number of samples for cavity
228  BRAY_OPT_BAKE_CV_MAXDIST, // Cavity maximum distance
229  BRAY_OPT_BAKE_CV_BIAS, // Cavity bias
230  BRAY_OPT_BAKE_CV_RAYBIAS, // Cavity ray bias
231  BRAY_OPT_BAKE_CU_ENABLE, // Curvature Enable
232  BRAY_OPT_BAKE_CU_SAMPLES, // Number of samples for curvature
233  BRAY_OPT_BAKE_CU_SCALE, // Curvature scale
234  BRAY_OPT_BAKE_CU_BIAS, // Cavity bias
235  BRAY_OPT_BAKE_CU_SDIST, // Curvature s distance
236  BRAY_OPT_BAKE_EG_ENABLE, // Edge Enable
237  BRAY_OPT_BAKE_EG_RADIUS, // Edge Radius
238  BRAY_OPT_BAKE_EG_CUSPANGLE, // Edge cusp angle
240  BRAY_OPT_BAKE_EG_SAMPLES, // Edge samples
241  BRAY_OPT_BAKE_EG_MODE, // Edge mode
242  BRAY_OPT_BAKE_RN_ENABLE, // Rounded Normal Enable
243  BRAY_OPT_BAKE_RN_RADIUS, // Rounded Normal Radius
244  BRAY_OPT_BAKE_RN_CUSPANGLE, // Rounded Normal cusp angle
245  BRAY_OPT_BAKE_RN_RAYBIAS, // Rounded Normal bias
246  BRAY_OPT_BAKE_RN_SAMPLES, // Rounded Normal samples
247  BRAY_OPT_BAKE_RN_MODE, // Rounded Normal mode
248  BRAY_OPT_BAKE_USE_LIGHTING, // Enable lighting
249  BRAY_OPT_BAKE_PBOX_MODE, // Mode for scene bounding box
250  BRAY_OPT_BAKE_PBOX_UNIFORM, // Uniform or stretched
251  BRAY_OPT_BAKE_PBOX_MIN, // Minimum scene bounds
252  BRAY_OPT_BAKE_PBOX_MAX, // Maximum scene bounds
254 
255  // Parameters for edge detection
257 
260 
267 
271 
278 
280 
282 
284 
286 
289 };
290 
291 /// @note If you add an object property, please update BRAY_HdUtil.C
293 {
295  BRAY_OBJ_SAMPLE_FROM_STAGE, // Choose motion segments by samples on stage
296  BRAY_OBJ_GEO_VELBLUR, // (0[no blur], 1[vel blur], 2[accel blur])
299  BRAY_OBJ_BLUR_STYLE, // (0[lin], 1[rot])
300 
301  BRAY_OBJ_INSTANCE_VELBLUR, // (0[no blur], 1[vel blur], 2[accel blur])
303 
304  BRAY_OBJ_DICING_QUALITY, // <= 0[no dicing], 1[on m-p per pixel]
306  BRAY_OBJ_TRUE_DISPLACE, // int (0 = bump map, 1 = true, 2 = disable,
307  // 3 = bump on top)
308  BRAY_OBJ_DICING_DEPTH_MIN, // integer (-1: unbound)
309  BRAY_OBJ_DICING_DEPTH_MAX, // integer (-1: unbound)
312 
313  BRAY_OBJ_STENCILMAP, // asset/string
314  BRAY_OBJ_STENCIL_THRESH, // stencil threshold
315  BRAY_OBJ_STENCIL_INTERP, // stencil interpolation
317 
318  /// @{
319  /// @note: The order must match theBsdfBounceTypes in PBR_Types.h
325 
331 
337  /// @}
338 
339  BRAY_OBJ_VOLUME_SAMPLING, // (0[raymarch], 1[woodcock/delta])
351 
353 
358 
360 
361  BRAY_OBJ_POINT_STYLE, // Point rendering style
362  BRAY_OBJ_CURVE_STYLE, // Curve style
363  BRAY_OBJ_CURVE_BASIS, // Curve basis override
364  BRAY_OBJ_WIDTH_SCALE, // Scale on point/curve widths
365 
366  BRAY_OBJ_TREAT_AS_LIGHTSOURCE, // (0[no], 1[yes], 2[auto], 3[yes-LightAPI])
367  BRAY_OBJ_IS_LIGHTSOURCE, // invisible, set by BRAY under the hood
368  BRAY_OBJ_VOLLIGHT_IMPORTANCE_GRID_SIZE, // int (invisible, for now)
369  BRAY_OBJ_GEOLIGHT_NUM_PERPRIM_CESAMPS, // int (invisible, for now)
370 
374 
377 
379  BRAY_OBJ_CULL_BACKFACE, // (0[off], 1[cull back], 2[cull front])
380 
382  BRAY_OBJ_RENDER_MASK, // invisible, used only by karma delegate
383  BRAY_OBJ_CUSTOM_TRACESETS, // Custom trace groups
384  BRAY_OBJ_SSS_TRACESET, // Trace set for SSS
385  BRAY_OBJ_LPE_TAG, // string
386 
391 
393 
396 
401 
402  // per-component variance AA settings
406 
409 
410  // UV unwrapping IDs
414 
415  // bounce limit color/texture
418 
419  // edge detection
429 
430  // baker
433  BRAY_OBJ_BAKER_VISIBILITY_CULL_BACKFACE, // (0[off], 1[cull back], 2[cull front])
434 
437 };
438 
440 {
446  BRAY_CAMERA_CLIP, // real[2] (near and far)
447  BRAY_CAMERA_SHUTTER, // real[2] (open and close)
450  BRAY_CAMERA_WINDOW, // real[4] (NDC mapping window)
452  BRAY_CAMERA_TINT, // real[3]
454 
457 };
458 
460 {
462  BRAY_LIGHT_SHADER, // string
463  BRAY_LIGHT_AREA_SHAPE, // int (see BRAY_LightType)
472  BRAY_LIGHT_MIS_BIAS, // real [-1,1]
474  BRAY_LIGHT_SAMPLING_MODE, // int (see LightSamplingMode)
476  BRAY_LIGHT_CATEGORY, // string: category name
477  BRAY_LIGHT_HDRI_MAX_ISIZE, // int (max size for importance sampling tables)
478  BRAY_LIGHT_DISTANT_ANGLE, // float (angle which subtends sun)
479  BRAY_LIGHT_DIFFUSE_SCALE, // float multiplier for diffuse/sss/volume
480  BRAY_LIGHT_SPECULAR_SCALE, // float multiplier for refl/refr
481  BRAY_LIGHT_SINGLE_SIDED, // bool, single or double sided
486  BRAY_LIGHT_ILLUM_BACKGROUND, // bool illuminates background holdout
488  BRAY_LIGHT_CONTRIBUTES_CAUSTIC, // bool contributes to caustic
489  BRAY_LIGHT_SKY_LIGHT, // Type of sky light (none, sky, sky+sun, sun)
490  BRAY_LIGHT_SPREAD, // float (0,1] spread value
491  BRAY_LIGHT_IS_PORTAL, // bool, a UsdLuxPortalLight (internal only)
492  BRAY_LIGHT_RECT_TEX_FLIP, // int, (see RectLightTexFlipMode)
496 
499 };
500 
502 {
503  BRAY_PLANE_FILTER, // Pixel filter
504  BRAY_PLANE_SAMPLING, // Sample filtering (0 = average etc.)
505  BRAY_PLANE_DITHER, // Dither for quantizing to integer values
506  BRAY_PLANE_DEFAULT_VALUE, // Default value for 1-channel planes
507  BRAY_PLANE_CRYPTO_ENABLE, // Cryptomatte enable
508  BRAY_PLANE_CRYPTO_RANK, // Cryptomatte maximum rank
509  BRAY_PLANE_CRYPTO_SIDECAR, // Cryptomatte sidecar manifest file
510  BRAY_PLANE_UTILITY_PATH_EXPRESSION, // LPE for utility AOV
511 
514 };
515 
517 {
523 
526 };
527 
528 /// Not all applications are able to load HDAs. If an application is able to
529 /// load HDAs, it should create a subclass of BRAY_HDALoader and instantiate a
530 /// loader. The constructor will register the class for the application and
531 /// the destructor will de-register.
533 {
534 public:
535  BRAY_HDALoader();
536  virtual ~BRAY_HDALoader();
537 
538  /// The className() is used to print out error messages in case there are
539  /// multiple HDA loaders instantiated.
540  virtual const char *className() const = 0;
541 
542  /// Return true if the HDA given by the path was loaded. It's possible the
543  /// same path may be passed multiple times, and it's up to the implementor
544  /// to optimize for this case. It's up to the implementor to print out
545  /// errors using UT_ErrorLog.
546  virtual bool loadHDA(const UT_StringHolder &path) = 0;
547 };
548 
549 /// Return the name of the renderer
551 
552 /// Look up the enum given a name.
554 {
555  switch (ty)
556  {
557  case BRAY_SCENE_PROPERTY:
561  case BRAY_LIGHT_PROPERTY:
565  case BRAY_PLANE_PROPERTY:
567  default:
568  break;
569  }
570  return 0;
571 }
572 
573 /// Set of properties which can be picked up by the Material properties VOP
574 ///
575 /// Not all object properties can be specified on a material. For example,
576 /// it's not possible to specify the point rendering style on a material
577 /// property.
579 
580 /// Not all properties can be specified on an instance level.
582 
584  BRAY_PropertyType ty, int id);
586  const UT_StringRef &name);
589 
590 inline bool
592 {
593  return GT_STORE_INVALID
594  != BRAYpropertyStorage(ty, id);
595 }
596 
597 inline bool
598 BRAYisValid(const std::pair<BRAY_PropertyType, int> &prop)
599 {
600  return BRAYisValid(prop.first, prop.second);
601 }
602 
603 #define PROPERTY_LOOKUP(NAME, STYLE, ENUM) \
604  inline ENUM BRAY##NAME(const UT_StringRef &name) \
605  { return ENUM(BRAYproperty(STYLE, name)); } \
606  inline const UT_StringHolder &BRAY##NAME(ENUM token) \
607  { return BRAYproperty(STYLE, token); } \
608  inline exint BRAY##NAME##Size(ENUM token) \
609  { return BRAYpropertySize(STYLE, token); } \
610  inline GT_Storage BRAY##NAME##Storage(ENUM token) \
611  { return BRAYpropertyStorage(STYLE, token); } \
612  /* end of macro */
618 #undef PROPERTY_LOOKUP
619 
620 /// Lookup a property type by name
622 /// Look up the name of a property type by the id
624 
625 /// This function will resolve generic names to the appropriate property type
626 /// and property identifier. For example:
627 /// "plane:filter" -> {BRAY_PLANE_PROPERTY, BRAY_PLANE_FILTER}
628 /// "camera:focal" -> {BRAY_CAMERA_PROPERTY, BRAY_CAMERA_FOCAL}
629 /// "global:bucketsize" -> {BRAY_SCENE_PROPERTY, BRAY_OPT_BUCKETSIZE}
630 /// If the token doesn't map to a property, the function will return an invalid
631 /// pair (i.e. BRAYisValid(result) == false).
632 ///
633 /// If the token isn't prefixed with a property type, the @c default_style will
634 /// be used. For example, with the default of BRAY_SCENE_PROPERTY:
635 /// "bucketsize" -> { BRAY_SCENE_PROPERTY, BRAY_OPT_BUCKETSIZE }
636 /// "focal" -> {invalid_property_pair} (error - not a scene property)
637 BRAY_API extern std::pair<BRAY_PropertyType, int>
638  BRAYproperty(const char *token,
640 
641 /// Given a property type, this will compose a name string that fully qualifies
642 /// the property. This is a string that would be suitable for @c
643 /// BRAYlookupProperty(). This may return a @c nullptr.
644 BRAY_API extern const char *BRAYproperty(UT_WorkBuffer &storage,
646  int property_id,
647  const char *prefix = "");
648 
649 /// @{
650 /// Generic method to return the number of options given an enum
651 template <typename T> static inline constexpr size_t BRAYmaxOptions()
652 { SYS_UNIMPLEMENTED_TEMPLATE(T); return 0; }
653 
654 template <> inline constexpr size_t
656 template <> inline constexpr size_t
658 template <> inline constexpr size_t
660 template <> inline constexpr size_t
662 template <> inline constexpr size_t
664 /// @}
665 
666 /// @{
667 /// Generic method to find the valud of the property type enum given the enum
668 template <typename T> static inline constexpr BRAY_PropertyType BRAYpropertyType()
670 
671 template <> inline constexpr BRAY_PropertyType
673 template <> inline constexpr BRAY_PropertyType
675 template <> inline constexpr BRAY_PropertyType
677 template <> inline constexpr BRAY_PropertyType
679 template <> inline constexpr BRAY_PropertyType
681 /// @}
682 
683 
685 {
686  BRAY_OVERRIDE_LIGHT_OFF, // Standard lighting
687  BRAY_OVERRIDE_LIGHT_EMISSIVE, // Only emissive objects
688  BRAY_OVERRIDE_LIGHT_HEADLIGHT, // Force: Headlight
689  BRAY_OVERRIDE_LIGHT_DOMELIGHT, // Force: Dome Light
690 };
691 
693 {
703 
706 };
707 
709 {
716 
718 };
719 
720 // Different types of user interaction in IPR
722 {
729 
731 };
732 
734 {
735  BRAY_BUCKETORDER_MIDDLE, // Render starting centered on focus point
736  BRAY_BUCKETORDER_TOP, // Render top down
737  BRAY_BUCKETORDER_BOTTOM, // Render bottom up
738  BRAY_BUCKETORDER_LEFT, // Render left to right
739  BRAY_BUCKETORDER_RIGHT, // Render right to left
740 
742 };
743 
745 {
746  BRAY_IMAGEMODE_PROGRESSIVE, // Pass over all buckets on image
747  BRAY_IMAGEMODE_BUCKET, // Finish buckets before advancing
748 
750 };
751 
752 /// Projection modes for rendering
754 {
755  BRAY_PROJ_ORTHOGRAPHIC, // orthographic projection mode
756  BRAY_PROJ_PERSPECTIVE, // perspective projection mode
757  BRAY_PROJ_CVEX_SHADER, // run a CVEX lens shader
758  BRAY_PROJ_BAKING, // custom baking projection mode
759  BRAY_PROJ_KVEX, // run a KVEX lens shader
760 
763 };
764 
766 {
767  BRAY_RAYIMPORT_P, // vector: ray origin
768  BRAY_RAYIMPORT_D, // vector: ray direction
769  BRAY_RAYIMPORT_TIME, // float: shutter time
770  BRAY_RAYIMPORT_NEAR, // float: near bias
771  BRAY_RAYIMPORT_FAR, // float: max distance
772  BRAY_RAYIMPORT_MASK, // int: intersection mask
773  BRAY_RAYIMPORT_CONTRIB, // vector: contribution
774 
775  BRAY_RAYIMPORT_HIT_ISHIT, // bool: Hit or miss
776  BRAY_RAYIMPORT_HIT_P, // vector: Hit position (in world space)
777  BRAY_RAYIMPORT_HIT_P_CAMERA,// vector: Hit position (in camera space)
778  BRAY_RAYIMPORT_HIT_Pz, // float: Pz (in space of camera)
779  BRAY_RAYIMPORT_HIT_VELOCITY,// vector: Hit velocity (in world space)
780  BRAY_RAYIMPORT_HIT_MOTION, // vector: Motion Vector (in raster space)
781  BRAY_RAYIMPORT_HIT_STACK, // int[]: Hit stack
782  BRAY_RAYIMPORT_HIT_ELEM, // int: Hit element (raw id)
783  BRAY_RAYIMPORT_HIT_PRIMID, // int: Hit primitive id
784  BRAY_RAYIMPORT_HIT_COORD, // vector: raw parametric coords {u,v,w}
785  BRAY_RAYIMPORT_HIT_DIST, // float: Hit distance
786  BRAY_RAYIMPORT_HIT_DPDZ, // float: dPdz
787  BRAY_RAYIMPORT_HIT_N, // vector: smooth normal
788  BRAY_RAYIMPORT_HIT_N_CAMERA,// vector: smooth normal (in camera space)
789  BRAY_RAYIMPORT_HIT_N_FACING,// vector: view facing smooth normal (in world space)
790  BRAY_RAYIMPORT_HIT_N_FACINGRATIO, // float: facing ratio of smooth normal
791  BRAY_RAYIMPORT_HIT_Ng, // vector: geometric normal
792  BRAY_RAYIMPORT_HIT_Ng_CAMERA, // vector: geometric normal (in camera space)
793  BRAY_RAYIMPORT_HIT_Ng_FACING, // vector: view facing geometric normal (in world space)
794  BRAY_RAYIMPORT_HIT_Ng_FACINGRATIO, // float: facing ratio of geometric normal
795  BRAY_RAYIMPORT_HIT_FLAGS, // int: hit flags
796  BRAY_RAYIMPORT_HIT_OBJECTID,// int: hit object id
797  BRAY_RAYIMPORT_HIT_ISBACKFACE, // bool: is hit object backface
798  BRAY_RAYIMPORT_HIT_AUTOBIAS, // float: automatic ray bias
799  BRAY_RAYIMPORT_LEVEL, // int: ray level
800  BRAY_RAYIMPORT_VOLUME_LEVEL,// int: ray volume level
801  BRAY_RAYIMPORT_PIXEL_SAMPLES, // int: pixel samples (ie camera rays)
802  BRAY_RAYIMPORT_HD_PRIM, // int: hydra rprim id for selection
803  BRAY_RAYIMPORT_HD_INST, // int: hydra inst idx (0th level) for selection
804  BRAY_RAYIMPORT_NOFAKECAUSTICS, // bool: disable fake caustics
805 
806  BRAY_RAYIMPORT_CURVE_ATTRIB_P, // vector: interpolated curve position
807  BRAY_RAYIMPORT_CURVE_ATTRIB_WIDTH, // float: interpolated curve width
808  BRAY_RAYIMPORT_CURVE_ATTRIB_TANV, // vector: interpolated curve pos derivative
809 
810  BRAY_RAYIMPORT_ISSHADOWRAY, // bool: is the ray a shadow ray (i.e. isshadowray)
811  BRAY_RAYIMPORT_CONESPREAD, // float: ray cone half angle
812 
813  BRAY_RAYIMPORT_BAKE_P, // P from the bake state
825  BRAY_RAYIMPORT_BAKE_MINBOX, // Minimum bounds
826  BRAY_RAYIMPORT_BAKE_MAXBOX, // Maximum bounds
827  BRAY_RAYIMPORT_BAKE_MINBOX_LOW, // Minimum bounds (low mesh)
828  BRAY_RAYIMPORT_BAKE_MAXBOX_LOW, // Maximum bounds (low mesh)
829  BRAY_RAYIMPORT_BAKE_MINBOX_HIGH, // Minimum bounds (high mesh)
830  BRAY_RAYIMPORT_BAKE_MAXBOX_HIGH, // Maximum bounds (high mesh)
831  BRAY_RAYIMPORT_BAKE_MINBOX_CAGE, // Minimum bounds (cage mesh)
832  BRAY_RAYIMPORT_BAKE_MAXBOX_CAGE, // Maximum bounds (cage mesh)
833  BRAY_RAYIMPORT_BAKE_TRACESET, // The integer traceset
834  BRAY_RAYIMPORT_BAKE_AO, // Ambient Occlusion
839  BRAY_RAYIMPORT_BAKE_RN, // Rounded Normal
840 
841  BRAY_RAYIMPORT_SHADING_FLAGS, // int (ShadeInfoFlags enum)
842 
844  BRAY_RAYIMPORT_INVALID = BRAY_RAYIMPORT_MAX // Not a valid ray import
845 };
846 
848 {
849  BRAY_LIGHTIMPORT_SURFNORMAL, // vector: surface normal in light shader
850  BRAY_LIGHTIMPORT_SURFACEINCIDENT, // vector: surface camera vector in light shader
851  BRAY_LIGHTIMPORT_LIGHTVECTOR, // vector: surface to light vector in light shader
852  BRAY_LIGHTIMPORT_SURFACEPOSITION, // vector: surface position in light shader
853 
855  BRAY_LIGHTIMPORT_INVALID = BRAY_LIGHTIMPORT_MAX // Not a valid light import
856 };
857 
858 #define ENUM_MAPPER(TYPE, METHOD) \
859  BRAY_API extern TYPE METHOD(const UT_StringRef &name); \
860  BRAY_API extern const UT_StringHolder &METHOD(TYPE o); \
861  /* end macro */
862 
863 ENUM_MAPPER(BRAY_LightType, BRAYlightType)
864 ENUM_MAPPER(BRAY_RenderStage, BRAYrenderStage)
865 ENUM_MAPPER(BRAY_InteractionType, BRAYinteractionType)
866 ENUM_MAPPER(BRAY_BucketOrder, BRAYbucketOrder)
867 ENUM_MAPPER(BRAY_ImageMode, BRAYimageMode)
868 ENUM_MAPPER(BRAY_Projection, BRAYprojection)
869 ENUM_MAPPER(BRAY_VexRayImport, BRAYrayImport)
870 ENUM_MAPPER(BRAY_VexLightImport, BRAYlightImport)
871 
872 #undef ENUM_MAPPER
873 
874 /// Consistent representation of time type within BRAY
875 using BRAYtime = float;
876 
877 /// Consistent representation for material ids
879 
880 /// Invalid material id
881 static constexpr BRAYmaterialId BRAY_INVALID_MATERIAL_ID = 0;
882 
883 /// List of known LPE prefixes
885 {
889 };
890 static inline BRAY_LPEPrefix
891 operator|(BRAY_LPEPrefix a, BRAY_LPEPrefix b)
892 {
893  return BRAY_LPEPrefix(uint(a)|uint(b));
894 }
895 static inline BRAY_LPEPrefix
896 operator&(BRAY_LPEPrefix a, BRAY_LPEPrefix b)
897 {
898  return BRAY_LPEPrefix(uint(a)&uint(b));
899 }
900 
902 {
910 
913 
917 };
918 
919 #define ENUM_TO_MASK(TOKEN) TOKEN = (1 << TOKEN##_ENUM)
920 /// Ray visibility flags
922 {
924 
925  ENUM_TO_MASK(BRAY_RAY_CAMERA),
926  ENUM_TO_MASK(BRAY_RAY_DIFFUSE),
927  ENUM_TO_MASK(BRAY_RAY_REFLECT),
928  ENUM_TO_MASK(BRAY_RAY_REFRACT),
929  ENUM_TO_MASK(BRAY_RAY_VOLUME),
930  ENUM_TO_MASK(BRAY_RAY_SHADOW_REG),
931  ENUM_TO_MASK(BRAY_RAY_SHADOW_BG),
932 
933  ENUM_TO_MASK(BRAY_PROXY_CAMERA),
934  ENUM_TO_MASK(BRAY_PROXY_SHADOW),
935 
936  ENUM_TO_MASK(BRAY_GUIDE_CAMERA),
937  ENUM_TO_MASK(BRAY_GUIDE_SHADOW),
938 
939  BRAY_RAY_SHADOW = (BRAY_RAY_SHADOW_REG | BRAY_RAY_SHADOW_BG),
940  BRAY_ANY_CAMERA = (BRAY_RAY_CAMERA | BRAY_PROXY_CAMERA | BRAY_GUIDE_CAMERA),
941  BRAY_ANY_SHADOW = (BRAY_RAY_SHADOW | BRAY_PROXY_SHADOW | BRAY_GUIDE_SHADOW),
942 
943  // Temporary flag only for the hydra delegate's internal use. DO NOT USE!
945 
946  BRAY_RAY_ALL = 0x7FFF,
947 
948  BRAY_RAY_PROXY_MASK = (BRAY_PROXY_CAMERA|BRAY_PROXY_SHADOW),
949  BRAY_RAY_GUIDE_MASK = (BRAY_GUIDE_CAMERA|BRAY_GUIDE_SHADOW),
952  ENUM_TO_MASK(BRAY_RAY_SSS),
953 };
954 #undef ENUM_TO_MASK
955 
956 static inline BRAY_RayVisibility
958 {
959  return BRAY_RayVisibility(uint(a)|uint(b));
960 }
961 static inline BRAY_RayVisibility
963 {
964  return BRAY_RayVisibility(uint(a)&uint(b));
965 }
966 static inline BRAY_RayVisibility
967 operator~(BRAY_RayVisibility a)
968 {
969  return BRAY_RayVisibility(~uint(a));
970 }
971 
973 
974 /// Generic method to return the number of components for a given import
975 /// Note that arrays types return 0 (see BRAYrayImportArray())
976 template <BRAY_VexRayImport T> static inline constexpr size_t BRAYrayImportSize()
977 {
978 #if !defined(__clang__) && !SYS_IS_GCC_GE(9, 2)
980 #endif
981  return 0;
982 }
983 /// Generic method to return whether the import variable is array valued
984 template <BRAY_VexRayImport T> static inline constexpr bool BRAYrayImportIsArray()
985 {
986 #if !defined(__clang__) && !SYS_IS_GCC_GE(9, 2)
988 #endif
989  return false;
990 }
991 
992 
993 template <BRAY_VexLightImport T> static inline constexpr size_t BRAYlightImportSize()
994 {
995 #if !defined(__clang__) && !SYS_IS_GCC_GE(9, 2)
997 #endif
998  return 0;
999 }
1000 /// Generic method to return whether the import variable is array valued
1001 template <BRAY_VexLightImport T> static inline constexpr bool BRAYlightImportIsArray()
1002 {
1003 #if !defined(__clang__) && !SYS_IS_GCC_GE(9, 2)
1005 #endif
1006  return false;
1007 }
1008 
1009 #define INSTANTIATE(VAR, SIZE, IS_ARRAY) \
1010  template <> inline constexpr size_t \
1011  BRAYrayImportSize<VAR>() { return SIZE; } \
1012  template <> inline constexpr bool \
1013  BRAYrayImportIsArray<VAR>() { return IS_ARRAY; } \
1014  /* end of macro */
1015 
1016 INSTANTIATE(BRAY_RAYIMPORT_P, 3, false)
1017 INSTANTIATE(BRAY_RAYIMPORT_D, 3, false)
1051 
1052 #undef INSTANTIATE
1053 
1054 #define INSTANTIATE(VAR, SIZE, IS_ARRAY) \
1055  template <> inline constexpr size_t \
1056  BRAYlightImportSize<VAR>() { return SIZE; } \
1057  template <> inline constexpr bool \
1058  BRAYlightImportIsArray<VAR>() { return IS_ARRAY; } \
1059  /* end of macro */
1060 
1065 #undef INSTANTIATE
1066 
1067 // LightSamplingMode
1068 // enum for BRAY_OPT_LIGHT_SAMPLING_MODE
1070 {
1071  BRAY_LSM_UNIFORM = 0, // uniform sampling
1072  BRAY_LSM_LIGHT_TREE // light hierarchy
1073 };
1074 
1075 // LightTreeType (flags)
1076 // the types of light-tree we can have
1078 {
1079  BRAY_LTT_NONE = 0, // light-tree is disabled
1080  BRAY_LTT_AREA = (1 << 0), // area light-tree
1081  BRAY_LTT_POINT = (1 << 1), // point light-tree
1082  BRAY_LTT_EQUIANGULAR = (1 << 2) // lights in volume
1083 };
1084 
1085 
1086 // TreatAsLightSourceOpts
1087 // enum for BRAY_OBJ_TREAT_AS_LIGHTSOURCE
1089 {
1090  TALS_NO = 0,
1094 };
1095 
1096 // For a LightAPI applied to geometry that has a bound Material,
1097 // which is entirely or partly emissive, this specifies the relationship
1098 // of the Material response to the lighting response.
1100 {
1104 };
1105 
1108 
1109 #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:553
GT_Storage
Definition: GT_Types.h:19
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
BRAY_OverrideLight
Definition: BRAY_Types.h:684
unsigned short uint16
Definition: SYS_Types.h:38
UT_ASSERT_COMPILETIME(BRAY_EVENT_MAXFLAGS<=32)
#define ENUM_TO_MASK(TOKEN)
Definition: BRAY_Types.h:919
constexpr BRAY_PropertyType BRAYpropertyType< BRAY_LightProperty >()
Definition: BRAY_Types.h:676
float BRAYtime
Consistent representation of time type within BRAY.
Definition: BRAY_Types.h:875
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:1099
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1222
BRAY_VexRayImport
Definition: BRAY_Types.h:765
BRAY_ImageMode
Definition: BRAY_Types.h:744
#define INSTANTIATE(VAR, SIZE, IS_ARRAY)
Definition: BRAY_Types.h:1054
BRAY_RayVisibilityEnum
Definition: BRAY_Types.h:901
BRAY_Projection
Projection modes for rendering.
Definition: BRAY_Types.h:753
BRAY_CameraProperty
Definition: BRAY_Types.h:439
constexpr size_t BRAYmaxOptions< BRAY_CameraProperty >()
Definition: BRAY_Types.h:661
BRAY_TreatAsLightSourceOpts
Definition: BRAY_Types.h:1088
constexpr BRAY_PropertyType BRAYpropertyType< BRAY_CameraProperty >()
Definition: BRAY_Types.h:678
BRAY_API exint BRAYpropertySize(BRAY_PropertyType ty, int id)
BRAY_VexLightImport
Definition: BRAY_Types.h:847
constexpr BRAY_PropertyType BRAYpropertyType< BRAY_PlaneProperty >()
Definition: BRAY_Types.h:680
UT_UniquePtr< BRAY_SpaceMap > BRAY_SpaceMapPtr
Definition: BRAY_Types.h:1107
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:657
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
BRAY_ObjectProperty
Definition: BRAY_Types.h:292
BRAY_API UT_StringHolder BRAYrayVisibility(BRAY_RayVisibility mask)
BRAY_RenderStage
Definition: BRAY_Types.h:708
BRAY_RayVisibility
Ray visibility flags.
Definition: BRAY_Types.h:921
BRAY_LightSamplingMode
Definition: BRAY_Types.h:1069
constexpr size_t BRAYmaxOptions< BRAY_LightProperty >()
Definition: BRAY_Types.h:659
BRAY_API bool BRAYisValidMaterialProperty(BRAY_ObjectProperty p)
GLint GLuint mask
Definition: glcorearb.h:124
#define ENUM_MAPPER(TYPE, METHOD)
Definition: BRAY_Types.h:858
BRAY_LightTreeType
Definition: BRAY_Types.h:1077
#define PROPERTY_LOOKUP(NAME, STYLE, ENUM)
Definition: BRAY_Types.h:603
GLuint const GLchar * name
Definition: glcorearb.h:786
BRAY_LightProperty
Definition: BRAY_Types.h:459
BRAY_PlaneProperty
Definition: BRAY_Types.h:501
#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:655
BRAY_InteractionType
Definition: BRAY_Types.h:721
BRAY_LightType
Definition: BRAY_Types.h:692
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:516
int BRAYmaterialId
Consistent representation for material ids.
Definition: BRAY_Types.h:878
constexpr size_t BRAYmaxOptions< BRAY_PlaneProperty >()
Definition: BRAY_Types.h:663
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:591
constexpr BRAY_PropertyType BRAYpropertyType< BRAY_ObjectProperty >()
Definition: BRAY_Types.h:674
BRAY_LPEPrefix
List of known LPE prefixes.
Definition: BRAY_Types.h:884
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:672
unsigned int uint
Definition: SYS_Types.h:45
BRAY_BucketOrder
Definition: BRAY_Types.h:733