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 <GT/GT_Types.h>
17 
18 class UT_WorkBuffer;
19 
20 enum
21 {
22  // Note - when adding event types, make sure to update ::eventType()
23  BRAY_EVENT_NEW_FLAG, // Added a new object
24  BRAY_EVENT_DEL_FLAG, // Object is being deleted
25  BRAY_EVENT_ATTRIB_P_FLAG, // P attribute changed
26  BRAY_EVENT_ATTRIB_FLAG, // Generic attribute changed
27  BRAY_EVENT_TOPOLOGY_FLAG, // Topology changed
28  BRAY_EVENT_XFORM_FLAG, // Transforms changed
29  BRAY_EVENT_CONTENTS_FLAG, // Contents changed (add/delete objects)
30  BRAY_EVENT_PROPERTIES_FLAG, // Instance properties changed
31  BRAY_EVENT_MATERIAL_FLAG, // Material has changed
32  BRAY_EVENT_TRACESET_FLAG, // Traceset has changed
33 
35 };
37 #define ENUM_FLAG(TOKEN) BRAY_EVENT_##TOKEN = (1 << BRAY_EVENT_##TOKEN##_FLAG)
38 /// Types of events that can be sent as updates to the renderer
40 {
42  ENUM_FLAG(NEW),
43  ENUM_FLAG(DEL),
44  ENUM_FLAG(ATTRIB_P),
46  ENUM_FLAG(TOPOLOGY),
47  ENUM_FLAG(XFORM),
48  ENUM_FLAG(CONTENTS),
49  ENUM_FLAG(PROPERTIES),
51  ENUM_FLAG(TRACESET),
52 };
53 #undef ENUM_FLAG
54 
55 static inline BRAY_EventType
56 operator|(BRAY_EventType a, BRAY_EventType b)
57 {
58  return BRAY_EventType(uint(a)|uint(b));
59 }
60 
61 /// Create a nice string for the event type mask
63 
64 /// Option tokens used at the "global" (scene) level
65 /// @note If you add an scene option, please update BRAY_HdUtil.C
67 {
68  BRAY_OPT_RENDERER = 0, // Name of the renderer (read-only)
69  BRAY_OPT_VERSION, // Houdini version (read-only)
70  BRAY_OPT_ENGINE, // Accelerator (deprecated)
71  BRAY_OPT_DELEGATE, // Accelerator
72 
73  // Controls for general rendering
81  BRAY_OPT_CONVERGENCE_MODE, // branched/pathtraced integration convergence switch
82  BRAY_OPT_RR_CUTOFF_DEPTH, // russian roulette cutoff depth
83  BRAY_OPT_CONSTRAIN_MAX_ROUGH, // Constrain by maximum roughness
84 
85  BRAY_OPT_IMAGEMODE, // Bucket rendering mode
86  BRAY_OPT_PROGRESSIVE_PASSES,// Number of progressive passes before bucket mode
87 
88  BRAY_OPT_HD_FOREGROUND, // Hydra renders in foreground (not background)
90  BRAY_OPT_IPR_INC_RANDOM, // Random seed modified each IPR render
93  BRAY_OPT_IPR_INTERACTION, // Interaction mode (see enum)
94  BRAY_OPT_IPR_BUCKETS_FOR_IMAGEFILTER, // Buckets rendered before image filters
95  BRAY_OPT_IPR_TIME_FOR_IMAGEFILTER, // Timeout before image filters run
96  BRAY_OPT_IPR_PROXY_FOR_IMAGEFILTER, // Proxy step before running filters
97 
98  // Controls for off-line rendering cache
99  BRAY_OPT_USECACHERATIO, // Whether to use the cache ratio
100  BRAY_OPT_CACHERATIO, // Amount of memory to use as cache
101  BRAY_OPT_CACHESIZE, // Absolute cache ratio
102 
103  // Object settings overrides
104  BRAY_OPT_OVERRIDE_OBJECT, // Override object settings matching this pattern
105 
106  // Control for disabled lighting
107  BRAY_OPT_OVERRIDE_LIGHTING, // Override lighting mode
108  BRAY_OPT_DISABLE_LIGHTING, // Disable all lighting (headlight)
109  BRAY_OPT_AO_SAMPLES, // Ambient occlusion samples for headlight
110  BRAY_OPT_AO_DISTANCE, // Ambient occlusion max distance for headlight
111  BRAY_OPT_AO_COLORLIMIT, // Ambient occlusion color limit threshold
112  BRAY_OPT_DEPTHCUE_COLOR, // Color for depthcue fog
113  BRAY_OPT_DEPTHCUE_ALPHA, // Alpha for depthcue fog
114  BRAY_OPT_DEPTHCUE_Z, // Distance range for depth cue fog (near,far)
115 
116  // Controls for lighting modes
117  BRAY_OPT_LIGHT_SAMPLING_MODE, // (0[Uniform], 1[Light Tree])
122 
123  // Renderer working color space
125 
129  BRAY_OPT_DICING_QUALITY_SCALE, // Multiplier for DICING_QUALITY
130  BRAY_OPT_IPR_CONTINUOUS_DICING, // IPR continuous dicing
131  BRAY_OPT_ENABLE_DOF, // Enable DOF
132  BRAY_OPT_IMAGE_BLUR, // Image motion blur
133 
134  BRAY_OPT_RESOLUTION, // Should match the data window size
137  BRAY_OPT_IMAGEFILTER, // Image filter plugins (JSON string)
140  BRAY_OPT_SAMPLEFILTER, // Sample filter plugins (JSON string)
141  BRAY_OPT_PIXELORACLE, // Pixel oracle
142 
145 
156 
158 
159  // Image properties
160  BRAY_OPT_DATAWINDOW, // Window size should match resolution
162 
163  BRAY_OPT_UNITS, // The metres per unit in world space
164 
165  // Path guiding
175 
176  // Texture baking
178  BRAY_OPT_UVUNWRAP_INFO, // Print out baking information
186 
187  BRAY_OPT_BAKE_MODE, // Baking mode
188  BRAY_OPT_BAKE_UDIM, // UDIM for baking
189  BRAY_OPT_BAKE_LOW, // Low res mesh
190  BRAY_OPT_BAKE_CAGE, // Cage mesh
191  BRAY_OPT_BAKE_HIGH, // High res mesh
192 
193  // Parameters for baking
195  BRAY_OPT_BAKE_TRACESET, // Trace group
196  BRAY_OPT_BAKE_TRACE_BIAS, // Bias for trace from low to high mesh
197  BRAY_OPT_BAKE_OC_SAMPLES, // Number of samples for occlusion
198  BRAY_OPT_BAKE_OC_MAXDIST, // Occlusion maximum distance
199  BRAY_OPT_BAKE_OC_BIAS, // Occlusion bias
200  BRAY_OPT_BAKE_TH_SAMPLES, // Number of samples for thickness
201  BRAY_OPT_BAKE_CV_SAMPLES, // Number of samples for cavity
202  BRAY_OPT_BAKE_CV_MAXDIST, // Cavity maximum distance
203  BRAY_OPT_BAKE_CV_BIAS, // Cavity bias
204  BRAY_OPT_BAKE_CV_RAYBIAS, // Cavity ray bias
205  BRAY_OPT_BAKE_CU_SAMPLES, // Number of samples for curvature
206  BRAY_OPT_BAKE_CU_SCALE, // Curvature scale
207  BRAY_OPT_BAKE_CU_BIAS, // Cavity bias
208  BRAY_OPT_BAKE_CU_SDIST, // Curvature s distance
209  BRAY_OPT_BAKE_USE_LIGHTING, // Enable lighting
210  BRAY_OPT_BAKE_FLIPN, // Flip normal
211  BRAY_OPT_BAKE_PBOX_MODE, // Mode for scene bounding box
212  BRAY_OPT_BAKE_PBOX_UNIFORM, // Uniform or stretched
213  BRAY_OPT_BAKE_PBOX_MIN, // Minimum scene bounds
214  BRAY_OPT_BAKE_PBOX_MAX, // Maximum scene bounds
215 
218 };
219 
220 /// @note If you add an object property, please update BRAY_HdUtil.C
222 {
224  BRAY_OBJ_SAMPLE_FROM_STAGE, // Choose motion segments by samples on stage
225  BRAY_OBJ_GEO_VELBLUR, // (0[no blur], 1[vel blur], 2[accel blur])
228  BRAY_OBJ_BLUR_STYLE, // (0[lin], 1[rot])
229 
230  BRAY_OBJ_INSTANCE_VELBLUR, // (0[no blur], 1[vel blur], 2[accel blur])
232 
233  BRAY_OBJ_DICING_QUALITY, // <= 0[no dicing], 1[on m-p per pixel]
235  BRAY_OBJ_TRUE_DISPLACE, // int (0 = bump map, 1 = true, 2 = disable)
236  BRAY_OBJ_DICING_DEPTH_MIN, // integer (-1: unbound)
237  BRAY_OBJ_DICING_DEPTH_MAX, // integer (-1: unbound)
238 
240 
241  /// @{
242  /// @note: The order must match theBsdfBounceTypes in PBR_Types.h
248 
254 
260  /// @}
261 
262  BRAY_OBJ_VOLUME_SAMPLING, // (0[raymarch], 1[woodcock/delta])
271 
273 
278 
280 
281  BRAY_OBJ_POINT_STYLE, // Point rendering style
282  BRAY_OBJ_CURVE_STYLE, // Curve style
283  BRAY_OBJ_CURVE_BASIS, // Curve basis override
284 
285  BRAY_OBJ_TREAT_AS_LIGHTSOURCE, // (0[no], 1[yes], 2[auto])
286  BRAY_OBJ_IS_LIGHTSOURCE, // invisible, set by BRAY under the hood
287  BRAY_OBJ_VOLLIGHT_IMPORTANCE_GRID_SIZE, // int (invisible, for now)
288  BRAY_OBJ_GEOLIGHT_NUM_PERPRIM_CESAMPS, // int (invisible, for now)
289 
293 
296 
298  BRAY_OBJ_CULL_BACKFACE, // (0[off], 1[cull back], 2[cull front])
299 
301  BRAY_OBJ_RENDER_MASK, // invisible, used only by karma delegate
302  BRAY_OBJ_CUSTOM_TRACESETS, // Custom trace groups
303  BRAY_OBJ_LPE_TAG, // string
304 
308 
311 
315 
316  // per-component variance AA settings
320 
323 
324  // UV unwrapping IDs
328 
330 
333 };
334 
336 {
342  BRAY_CAMERA_CLIP, // real[2] (near and far)
343  BRAY_CAMERA_SHUTTER, // real[2] (open and close)
346  BRAY_CAMERA_WINDOW, // real[4] (NDC mapping window)
348  BRAY_CAMERA_TINT, // real[3]
350 
353 };
354 
356 {
358  BRAY_LIGHT_SHADER, // string
359  BRAY_LIGHT_AREA_SHAPE, // int (see BRAY_LightType)
368  BRAY_LIGHT_MIS_BIAS, // real [-1,1]
370  BRAY_LIGHT_SAMPLING_MODE, // int (see LightSamplingMode)
372  BRAY_LIGHT_CATEGORY, // string: category name
373  BRAY_LIGHT_HDRI_MAX_ISIZE, // int (max size for importance sampling tables)
374  BRAY_LIGHT_DISTANT_ANGLE, // float (angle which subtends sun)
375  BRAY_LIGHT_DIFFUSE_SCALE, // float multiplier for diffuse/sss/volume
376  BRAY_LIGHT_SPECULAR_SCALE, // float multiplier for refl/refr
377  BRAY_LIGHT_SINGLE_SIDED, // bool, single or double sided
382  BRAY_LIGHT_ILLUM_BACKGROUND, // bool illuminates background holdout
384  BRAY_LIGHT_CONTRIBUTES_CAUSTIC, // bool contributes to caustic
385  BRAY_LIGHT_SKY_LIGHT, // Type of sky light (none, sky, sky+sun, sun)
386  BRAY_LIGHT_SPREAD, // float (0,1] spread value
387 
390 };
391 
393 {
394  BRAY_PLANE_FILTER, // Pixel filter
395  BRAY_PLANE_SAMPLING, // Sample filtering (0 = average etc.)
396  BRAY_PLANE_DITHER, // Dither for quantizing to integer values
397  BRAY_PLANE_DEFAULT_VALUE, // Default value for 1-channel planes
398  BRAY_PLANE_CRYPTO_ENABLE, // Cryptomatte enable
399  BRAY_PLANE_CRYPTO_RANK, // Cryptomatte maximum rank
400  BRAY_PLANE_CRYPTO_SIDECAR, // Cryptomatte sidecar manifest file
401 
404 };
405 
407 {
413 
416 };
417 
418 /// Not all applications are able to load HDAs. If an application is able to
419 /// load HDAs, it should create a subclass of BRAY_HDALoader and instantiate a
420 /// loader. The constructor will register the class for the application and
421 /// the destructor will de-register.
423 {
424 public:
425  BRAY_HDALoader();
426  virtual ~BRAY_HDALoader();
427 
428  /// The className() is used to print out error messages in case there are
429  /// multiple HDA loaders instantiated.
430  virtual const char *className() const = 0;
431 
432  /// Return true if the HDA given by the path was loaded. It's possible the
433  /// same path may be passed multiple times, and it's up to the implementor
434  /// to optimize for this case. It's up to the implementor to print out
435  /// errors using UT_ErrorLog.
436  virtual bool loadHDA(const UT_StringHolder &path) = 0;
437 };
438 
439 /// Return the name of the renderer
441 
442 /// Look up the enum given a name.
444 {
445  switch (ty)
446  {
447  case BRAY_SCENE_PROPERTY:
451  case BRAY_LIGHT_PROPERTY:
455  case BRAY_PLANE_PROPERTY:
457  default:
458  break;
459  }
460  return 0;
461 }
463  BRAY_PropertyType ty, int id);
465  const UT_StringRef &name);
468 
469 inline bool
471 {
472  return GT_STORE_INVALID
473  != BRAYpropertyStorage(ty, id);
474 }
475 
476 inline bool
477 BRAYisValid(const std::pair<BRAY_PropertyType, int> &prop)
478 {
479  return BRAYisValid(prop.first, prop.second);
480 }
481 
482 #define PROPERTY_LOOKUP(NAME, STYLE, ENUM) \
483  inline ENUM BRAY##NAME(const UT_StringRef &name) \
484  { return ENUM(BRAYproperty(STYLE, name)); } \
485  inline const UT_StringHolder &BRAY##NAME(ENUM token) \
486  { return BRAYproperty(STYLE, token); } \
487  inline exint BRAY##NAME##Size(ENUM token) \
488  { return BRAYpropertySize(STYLE, token); } \
489  inline GT_Storage BRAY##NAME##Storage(ENUM token) \
490  { return BRAYpropertyStorage(STYLE, token); } \
491  /* end of macro */
497 #undef PROPERTY_LOOKUP
498 
499 /// Lookup a property type by name
501 /// Look up the name of a property type by the id
503 
504 /// This function will resolve generic names to the appropriate property type
505 /// and property identifier. For example:
506 /// "plane:filter" -> {BRAY_PLANE_PROPERTY, BRAY_PLANE_FILTER}
507 /// "camera:focal" -> {BRAY_CAMERA_PROPERTY, BRAY_CAMERA_FOCAL}
508 /// "global:bucketsize" -> {BRAY_SCENE_PROPERTY, BRAY_OPT_BUCKETSIZE}
509 /// If the token doesn't map to a property, the function will return an invalid
510 /// pair (i.e. BRAYisValid(result) == false).
511 ///
512 /// If the token isn't prefixed with a property type, the @c default_style will
513 /// be used. For example, with the default of BRAY_SCENE_PROPERTY:
514 /// "bucketsize" -> { BRAY_SCENE_PROPERTY, BRAY_OPT_BUCKETSIZE }
515 /// "focal" -> {invalid_property_pair} (error - not a scene property)
516 BRAY_API extern std::pair<BRAY_PropertyType, int>
517  BRAYproperty(const char *token,
519 
520 /// Given a property type, this will compose a name string that fully qualifies
521 /// the property. This is a string that would be suitable for @c
522 /// BRAYlookupProperty(). This may return a @c nullptr.
523 BRAY_API extern const char *BRAYproperty(UT_WorkBuffer &storage,
525  int property_id,
526  const char *prefix = "");
527 
528 /// @{
529 /// Generic method to return the number of options given an enum
530 template <typename T> static inline constexpr size_t BRAYmaxOptions()
531 { SYS_UNIMPLEMENTED_TEMPLATE(T); return 0; }
532 
533 template <> inline constexpr size_t
535 template <> inline constexpr size_t
537 template <> inline constexpr size_t
539 template <> inline constexpr size_t
541 template <> inline constexpr size_t
543 /// @}
544 
545 /// @{
546 /// Generic method to find the valud of the property type enum given the enum
547 template <typename T> static inline constexpr BRAY_PropertyType BRAYpropertyType()
549 
550 template <> inline constexpr BRAY_PropertyType
552 template <> inline constexpr BRAY_PropertyType
554 template <> inline constexpr BRAY_PropertyType
556 template <> inline constexpr BRAY_PropertyType
558 template <> inline constexpr BRAY_PropertyType
560 /// @}
561 
562 
564 {
565  BRAY_OVERRIDE_LIGHT_OFF, // Standard lighting
566  BRAY_OVERRIDE_LIGHT_EMISSIVE, // Only emissive objects
567  BRAY_OVERRIDE_LIGHT_HEADLIGHT, // Force: Headlight
568  BRAY_OVERRIDE_LIGHT_DOMELIGHT, // Force: Dome Light
569 };
570 
572 {
582 
585 };
586 
588 {
595 
597 };
598 
599 // Different types of user interaction in IPR
601 {
608 
610 };
611 
613 {
614  BRAY_BUCKETORDER_MIDDLE, // Render starting centered on focus point
615  BRAY_BUCKETORDER_TOP, // Render top down
616  BRAY_BUCKETORDER_BOTTOM, // Render bottom up
617  BRAY_BUCKETORDER_LEFT, // Render left to right
618  BRAY_BUCKETORDER_RIGHT, // Render right to left
619 
621 };
622 
624 {
625  BRAY_IMAGEMODE_PROGRESSIVE, // Pass over all buckets on image
626  BRAY_IMAGEMODE_BUCKET, // Finish buckets before advancing
627 
629 };
630 
631 /// Projection modes for rendering
633 {
634  BRAY_PROJ_ORTHOGRAPHIC, // orthographic projection mode
635  BRAY_PROJ_PERSPECTIVE, // perspective projection mode
636  BRAY_PROJ_CVEX_SHADER, // run a CVEX lens shader
637  BRAY_PROJ_BAKING, // Custom baking projection mode
638 
641 };
642 
644 {
645  BRAY_RAYIMPORT_P, // vector: ray origin
646  BRAY_RAYIMPORT_D, // vector: ray direction
647  BRAY_RAYIMPORT_TIME, // float: shutter time
648  BRAY_RAYIMPORT_NEAR, // float: near bias
649  BRAY_RAYIMPORT_FAR, // float: max distance
650  BRAY_RAYIMPORT_MASK, // int: intersection mask
651  BRAY_RAYIMPORT_CONTRIB, // vector: contribution
652 
653  BRAY_RAYIMPORT_HIT_ISHIT, // bool: Hit or miss
654  BRAY_RAYIMPORT_HIT_P, // vector: Hit position (in world space)
655  BRAY_RAYIMPORT_HIT_P_CAMERA,// vector: Hit position (in camera space)
656  BRAY_RAYIMPORT_HIT_Pz, // float: Pz (in space of camera)
657  BRAY_RAYIMPORT_HIT_VELOCITY,// vector: Hit velocity (in world space)
658  BRAY_RAYIMPORT_HIT_MOTION, // vector: Motion Vector (in raster space)
659  BRAY_RAYIMPORT_HIT_STACK, // int[]: Hit stack
660  BRAY_RAYIMPORT_HIT_ELEM, // int: Hit element (raw id)
661  BRAY_RAYIMPORT_HIT_PRIMID, // int: Hit primitive id
662  BRAY_RAYIMPORT_HIT_COORD, // vector: raw parametric coords {u,v,w}
663  BRAY_RAYIMPORT_HIT_DIST, // float: Hit distance
664  BRAY_RAYIMPORT_HIT_DPDZ, // float: dPdz
665  BRAY_RAYIMPORT_HIT_N, // vector: smooth normal
666  BRAY_RAYIMPORT_HIT_N_CAMERA,// vector: smooth normal (in camera space)
667  BRAY_RAYIMPORT_HIT_N_FACING,// vector: view facing smooth normal (in world space)
668  BRAY_RAYIMPORT_HIT_N_FACINGRATIO, // float: facing ratio of smooth normal
669  BRAY_RAYIMPORT_HIT_Ng, // vector: geometric normal
670  BRAY_RAYIMPORT_HIT_Ng_CAMERA, // vector: geometric normal (in camera space)
671  BRAY_RAYIMPORT_HIT_Ng_FACING, // vector: view facing geometric normal (in world space)
672  BRAY_RAYIMPORT_HIT_Ng_FACINGRATIO, // float: facing ratio of geometric normal
673  BRAY_RAYIMPORT_HIT_FLAGS, // int: hit flags
674  BRAY_RAYIMPORT_HIT_OBJECTID,// int: hit object id
675  BRAY_RAYIMPORT_HIT_ISBACKFACE, // bool: is hit object backface
676  BRAY_RAYIMPORT_LEVEL, // int: ray level
677  BRAY_RAYIMPORT_VOLUME_LEVEL,// int: ray volume level
678  BRAY_RAYIMPORT_PIXEL_SAMPLES, // int: pixel samples (ie camera rays)
679  BRAY_RAYIMPORT_HD_PRIM, // int: hydra rprim id for selection
680  BRAY_RAYIMPORT_HD_INST, // int: hydra inst idx (0th level) for selection
681  BRAY_RAYIMPORT_NOFAKECAUSTICS, // bool: disable fake caustics
682 
683  BRAY_RAYIMPORT_CURVE_ATTRIB_P, // vector: interpolated curve position
684  BRAY_RAYIMPORT_CURVE_ATTRIB_WIDTH, // float: interpolated curve width
685  BRAY_RAYIMPORT_CURVE_ATTRIB_TANV, // vector: interpolated curve pos derivative
686 
687  BRAY_RAYIMPORT_ISSHADOWRAY, // bool: is the ray a shadow ray (i.e. isshadowray)
688  BRAY_RAYIMPORT_CONESPREAD, // float: ray cone half angle
689 
690  BRAY_RAYIMPORT_BAKE_P, // P from the bake state
704  BRAY_RAYIMPORT_BAKE_MINBOX, // Minimum bounds
705  BRAY_RAYIMPORT_BAKE_MAXBOX, // Maximum bounds
706  BRAY_RAYIMPORT_BAKE_MINBOX_LOW, // Minimum bounds (low mesh)
707  BRAY_RAYIMPORT_BAKE_MAXBOX_LOW, // Maximum bounds (low mesh)
708  BRAY_RAYIMPORT_BAKE_MINBOX_HIGH, // Minimum bounds (high mesh)
709  BRAY_RAYIMPORT_BAKE_MAXBOX_HIGH, // Maximum bounds (high mesh)
710  BRAY_RAYIMPORT_BAKE_MINBOX_CAGE, // Minimum bounds (cage mesh)
711  BRAY_RAYIMPORT_BAKE_MAXBOX_CAGE, // Maximum bounds (cage mesh)
712  BRAY_RAYIMPORT_BAKE_TRACESET, // The integer traceset
713 
715  BRAY_RAYIMPORT_INVALID = BRAY_RAYIMPORT_MAX // Not a valid ray import
716 };
717 
719 {
720  BRAY_LIGHTIMPORT_SURFNORMAL, // vector: surface normal in light shader
721  BRAY_LIGHTIMPORT_SURFACEINCIDENT, // vector: surface camera vector in light shader
722  BRAY_LIGHTIMPORT_LIGHTVECTOR, // vector: surface to light vector in light shader
723  BRAY_LIGHTIMPORT_SURFACEPOSITION, // vector: surface position in light shader
724 
726  BRAY_LIGHTIMPORT_INVALID = BRAY_LIGHTIMPORT_MAX // Not a valid light import
727 };
728 
729 #define ENUM_MAPPER(TYPE, METHOD) \
730  BRAY_API extern TYPE METHOD(const UT_StringRef &name); \
731  BRAY_API extern const UT_StringHolder &METHOD(TYPE o); \
732  /* end macro */
733 
734 ENUM_MAPPER(BRAY_LightType, BRAYlightType)
735 ENUM_MAPPER(BRAY_RenderStage, BRAYrenderStage)
736 ENUM_MAPPER(BRAY_InteractionType, BRAYinteractionType)
737 ENUM_MAPPER(BRAY_BucketOrder, BRAYbucketOrder)
738 ENUM_MAPPER(BRAY_ImageMode, BRAYimageMode)
739 ENUM_MAPPER(BRAY_Projection, BRAYprojection)
740 ENUM_MAPPER(BRAY_VexRayImport, BRAYrayImport)
741 ENUM_MAPPER(BRAY_VexLightImport, BRAYlightImport)
742 
743 #undef ENUM_MAPPER
744 
745 /// Consistent representation of time type within BRAY
746 using BRAYtime = float;
747 
748 /// Consistent representation for material ids
750 
751 /// Invalid material id
752 static constexpr BRAYmaterialId BRAY_INVALID_MATERIAL_ID = 0;
753 
754 /// List of known LPE prefixes
756 {
760 };
761 static inline BRAY_LPEPrefix
762 operator|(BRAY_LPEPrefix a, BRAY_LPEPrefix b)
763 {
764  return BRAY_LPEPrefix(uint(a)|uint(b));
765 }
766 static inline BRAY_LPEPrefix
767 operator&(BRAY_LPEPrefix a, BRAY_LPEPrefix b)
768 {
769  return BRAY_LPEPrefix(uint(a)&uint(b));
770 }
771 
773 {
781 
784 
787 };
788 
789 #define ENUM_TO_MASK(TOKEN) TOKEN = (1 << TOKEN##_ENUM)
790 /// Ray visibility flags
792 {
794 
795  ENUM_TO_MASK(BRAY_RAY_CAMERA),
796  ENUM_TO_MASK(BRAY_RAY_DIFFUSE),
797  ENUM_TO_MASK(BRAY_RAY_REFLECT),
798  ENUM_TO_MASK(BRAY_RAY_REFRACT),
799  ENUM_TO_MASK(BRAY_RAY_VOLUME),
800  ENUM_TO_MASK(BRAY_RAY_SHADOW_REG),
801  ENUM_TO_MASK(BRAY_RAY_SHADOW_BG),
802 
803  ENUM_TO_MASK(BRAY_PROXY_CAMERA),
804  ENUM_TO_MASK(BRAY_PROXY_SHADOW),
805 
806  ENUM_TO_MASK(BRAY_GUIDE_CAMERA),
807  ENUM_TO_MASK(BRAY_GUIDE_SHADOW),
808 
809  BRAY_RAY_SHADOW = (BRAY_RAY_SHADOW_REG | BRAY_RAY_SHADOW_BG),
810  BRAY_ANY_CAMERA = (BRAY_RAY_CAMERA | BRAY_PROXY_CAMERA | BRAY_GUIDE_CAMERA),
811  BRAY_ANY_SHADOW = (BRAY_RAY_SHADOW | BRAY_PROXY_SHADOW | BRAY_GUIDE_SHADOW),
812 
813  // Temporary flag only for the hydra delegate's internal use. DO NOT USE!
815 
816  BRAY_RAY_ALL = 0x7FFF,
817 
818  BRAY_RAY_PROXY_MASK = (BRAY_PROXY_CAMERA|BRAY_PROXY_SHADOW),
819  BRAY_RAY_GUIDE_MASK = (BRAY_GUIDE_CAMERA|BRAY_GUIDE_SHADOW),
822 };
823 #undef ENUM_TO_MASK
824 
825 static inline BRAY_RayVisibility
827 {
828  return BRAY_RayVisibility(uint(a)|uint(b));
829 }
830 static inline BRAY_RayVisibility
832 {
833  return BRAY_RayVisibility(uint(a)&uint(b));
834 }
835 static inline BRAY_RayVisibility
836 operator~(BRAY_RayVisibility a)
837 {
838  return BRAY_RayVisibility(~uint(a));
839 }
840 
842 
843 /// Generic method to return the number of components for a given import
844 /// Note that arrays types return 0 (see BRAYrayImportArray())
845 template <BRAY_VexRayImport T> static inline constexpr size_t BRAYrayImportSize()
846 {
847 #if !defined(__clang__) && !SYS_IS_GCC_GE(9, 2)
849 #endif
850  return 0;
851 }
852 /// Generic method to return whether the import variable is array valued
853 template <BRAY_VexRayImport T> static inline constexpr bool BRAYrayImportIsArray()
854 {
855 #if !defined(__clang__) && !SYS_IS_GCC_GE(9, 2)
857 #endif
858  return false;
859 }
860 
861 
862 template <BRAY_VexLightImport T> static inline constexpr size_t BRAYlightImportSize()
863 {
864 #if !defined(__clang__) && !SYS_IS_GCC_GE(9, 2)
866 #endif
867  return 0;
868 }
869 /// Generic method to return whether the import variable is array valued
870 template <BRAY_VexLightImport T> static inline constexpr bool BRAYlightImportIsArray()
871 {
872 #if !defined(__clang__) && !SYS_IS_GCC_GE(9, 2)
874 #endif
875  return false;
876 }
877 
878 #define INSTANTIATE(VAR, SIZE, IS_ARRAY) \
879  template <> inline constexpr size_t \
880  BRAYrayImportSize<VAR>() { return SIZE; } \
881  template <> inline constexpr bool \
882  BRAYrayImportIsArray<VAR>() { return IS_ARRAY; } \
883  /* end of macro */
884 
885 INSTANTIATE(BRAY_RAYIMPORT_P, 3, false)
886 INSTANTIATE(BRAY_RAYIMPORT_D, 3, false)
918 
919 #undef INSTANTIATE
920 
921 #define INSTANTIATE(VAR, SIZE, IS_ARRAY) \
922  template <> inline constexpr size_t \
923  BRAYlightImportSize<VAR>() { return SIZE; } \
924  template <> inline constexpr bool \
925  BRAYlightImportIsArray<VAR>() { return IS_ARRAY; } \
926  /* end of macro */
927 
932 #undef INSTANTIATE
933 
934 // LightSamplingMode
935 // enum for BRAY_OPT_LIGHT_SAMPLING_MODE
937 {
938  BRAY_LSM_UNIFORM = 0, // uniform sampling
939  BRAY_LSM_LIGHT_TREE // light hierarchy
940 };
941 
942 #endif
BRAY_EventType
Types of events that can be sent as updates to the renderer.
Definition: BRAY_Types.h:39
BRAY_API constexpr exint BRAYpropertyCount(BRAY_PropertyType ty)
Look up the enum given a name.
Definition: BRAY_Types.h:443
GT_Storage
Definition: GT_Types.h:19
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
BRAY_OverrideLight
Definition: BRAY_Types.h:563
unsigned short uint16
Definition: SYS_Types.h:38
UT_ASSERT_COMPILETIME(BRAY_EVENT_MAXFLAGS<=32)
#define ENUM_TO_MASK(TOKEN)
Definition: BRAY_Types.h:789
constexpr BRAY_PropertyType BRAYpropertyType< BRAY_LightProperty >()
Definition: BRAY_Types.h:555
float BRAYtime
Consistent representation of time type within BRAY.
Definition: BRAY_Types.h:746
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
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1222
BRAY_VexRayImport
Definition: BRAY_Types.h:643
BRAY_ImageMode
Definition: BRAY_Types.h:623
#define INSTANTIATE(VAR, SIZE, IS_ARRAY)
Definition: BRAY_Types.h:921
BRAY_RayVisibilityEnum
Definition: BRAY_Types.h:772
BRAY_Projection
Projection modes for rendering.
Definition: BRAY_Types.h:632
BRAY_CameraProperty
Definition: BRAY_Types.h:335
MX_GENSHADER_API const TypeDesc * MATERIAL
constexpr size_t BRAYmaxOptions< BRAY_CameraProperty >()
Definition: BRAY_Types.h:540
constexpr BRAY_PropertyType BRAYpropertyType< BRAY_CameraProperty >()
Definition: BRAY_Types.h:557
BRAY_API exint BRAYpropertySize(BRAY_PropertyType ty, int id)
BRAY_VexLightImport
Definition: BRAY_Types.h:718
constexpr BRAY_PropertyType BRAYpropertyType< BRAY_PlaneProperty >()
Definition: BRAY_Types.h:559
constexpr size_t BRAYmaxOptions< BRAY_ObjectProperty >()
Definition: BRAY_Types.h:536
BRAY_ObjectProperty
Definition: BRAY_Types.h:221
IMATH_NAMESPACE::V2f float
BRAY_API UT_StringHolder BRAYrayVisibility(BRAY_RayVisibility mask)
BRAY_RenderStage
Definition: BRAY_Types.h:587
BRAY_RayVisibility
Ray visibility flags.
Definition: BRAY_Types.h:791
BRAY_LightSamplingMode
Definition: BRAY_Types.h:936
constexpr size_t BRAYmaxOptions< BRAY_LightProperty >()
Definition: BRAY_Types.h:538
GLint GLuint mask
Definition: glcorearb.h:124
#define ENUM_MAPPER(TYPE, METHOD)
Definition: BRAY_Types.h:729
#define PROPERTY_LOOKUP(NAME, STYLE, ENUM)
Definition: BRAY_Types.h:482
GLuint const GLchar * name
Definition: glcorearb.h:786
BRAY_LightProperty
Definition: BRAY_Types.h:355
BRAY_PlaneProperty
Definition: BRAY_Types.h:392
#define ENUM_FLAG(TOKEN)
Definition: BRAY_Types.h:37
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
constexpr size_t BRAYmaxOptions< BRAY_SceneOption >()
Definition: BRAY_Types.h:534
BRAY_InteractionType
Definition: BRAY_Types.h:600
BRAY_LightType
Definition: BRAY_Types.h:571
BRAY_SceneOption
Definition: BRAY_Types.h:66
#define BRAY_API
Definition: BRAY_API.h:12
#define SYS_UNIMPLEMENTED_TEMPLATE(T)
BRAY_PropertyType
Definition: BRAY_Types.h:406
int BRAYmaterialId
Consistent representation for material ids.
Definition: BRAY_Types.h:749
constexpr size_t BRAYmaxOptions< BRAY_PlaneProperty >()
Definition: BRAY_Types.h:542
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:470
constexpr BRAY_PropertyType BRAYpropertyType< BRAY_ObjectProperty >()
Definition: BRAY_Types.h:553
BRAY_LPEPrefix
List of known LPE prefixes.
Definition: BRAY_Types.h:755
BRAY_API const UT_StringHolder & BRAYproperty(BRAY_PropertyType ty, int id)
type
Definition: core.h:1059
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:551
unsigned int uint
Definition: SYS_Types.h:45
BRAY_BucketOrder
Definition: BRAY_Types.h:612