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
85 
86  BRAY_OPT_IMAGEMODE, // Bucket rendering mode
87  BRAY_OPT_PROGRESSIVE_PASSES,// Number of progressive passes before bucket mode
88 
89  BRAY_OPT_HD_FOREGROUND, // Hydra renders in foreground (not background)
91  BRAY_OPT_IPR_INC_RANDOM, // Random seed modified each IPR render
94  BRAY_OPT_IPR_INTERACTION, // Interaction mode (see enum)
95  BRAY_OPT_IPR_BUCKETS_FOR_IMAGEFILTER, // Buckets rendered before image filters
96  BRAY_OPT_IPR_TIME_FOR_IMAGEFILTER, // Timeout before image filters run
97  BRAY_OPT_IPR_PROXY_FOR_IMAGEFILTER, // Proxy step before running filters
98 
99  // Controls for off-line rendering cache
100  BRAY_OPT_USECACHERATIO, // Whether to use the cache ratio
101  BRAY_OPT_CACHERATIO, // Amount of memory to use as cache
102  BRAY_OPT_CACHESIZE, // Absolute cache ratio
103 
104  // Object settings overrides
105  BRAY_OPT_OVERRIDE_OBJECT, // Override object settings matching this pattern
106 
107  // Control for disabled lighting
108  BRAY_OPT_OVERRIDE_LIGHTING, // Override lighting mode
109  BRAY_OPT_DISABLE_LIGHTING, // Disable all lighting (headlight)
110  BRAY_OPT_AO_SAMPLES, // Ambient occlusion samples for headlight
111  BRAY_OPT_AO_DISTANCE, // Ambient occlusion max distance for headlight
112  BRAY_OPT_AO_COLORLIMIT, // Ambient occlusion color limit threshold
113  BRAY_OPT_DEPTHCUE_COLOR, // Color for depthcue fog
114  BRAY_OPT_DEPTHCUE_ALPHA, // Alpha for depthcue fog
115  BRAY_OPT_DEPTHCUE_Z, // Distance range for depth cue fog (near,far)
116 
117  // Controls for lighting modes
118  BRAY_OPT_LIGHT_SAMPLING_MODE, // (0[Uniform], 1[Light Tree])
123 
124  // Renderer working color space
126 
130  BRAY_OPT_DICING_QUALITY_SCALE, // Multiplier for DICING_QUALITY
131  BRAY_OPT_IPR_CONTINUOUS_DICING, // IPR continuous dicing
132  BRAY_OPT_ENABLE_DOF, // Enable DOF
133  BRAY_OPT_IMAGE_BLUR, // Image motion blur
134 
135  BRAY_OPT_RESOLUTION, // Should match the data window size
138  BRAY_OPT_IMAGEFILTER, // Image filter plugins (JSON string)
141  BRAY_OPT_SAMPLEFILTER, // Sample filter plugins (JSON string)
142  BRAY_OPT_PIXELORACLE, // Pixel oracle
143 
146 
157 
159 
160  // Image properties
161  BRAY_OPT_DATAWINDOW, // Window size should match resolution
163 
164  // Deep image properties
166 
167  BRAY_OPT_UNITS, // The metres per unit in world space
168 
169  // Path guiding
179 
180  // Texture baking
182  BRAY_OPT_UVUNWRAP_INFO, // Print out baking information
190 
191  BRAY_OPT_BAKE_MODE, // Baking mode
192  BRAY_OPT_BAKE_UDIM, // UDIM for baking
193  BRAY_OPT_BAKE_LOW, // Low res mesh
194  BRAY_OPT_BAKE_CAGE, // Cage mesh
195  BRAY_OPT_BAKE_HIGH, // High res mesh
196 
197  // Parameters for baking
199  BRAY_OPT_BAKE_TRACESET, // Trace group
200  BRAY_OPT_BAKE_TRACE_BIAS, // Bias for trace from low to high mesh
201  BRAY_OPT_BAKE_OC_SAMPLES, // Number of samples for occlusion
202  BRAY_OPT_BAKE_OC_MAXDIST, // Occlusion maximum distance
203  BRAY_OPT_BAKE_OC_BIAS, // Occlusion bias
204  BRAY_OPT_BAKE_TH_SAMPLES, // Number of samples for thickness
205  BRAY_OPT_BAKE_CV_SAMPLES, // Number of samples for cavity
206  BRAY_OPT_BAKE_CV_MAXDIST, // Cavity maximum distance
207  BRAY_OPT_BAKE_CV_BIAS, // Cavity bias
208  BRAY_OPT_BAKE_CV_RAYBIAS, // Cavity ray bias
209  BRAY_OPT_BAKE_CU_SAMPLES, // Number of samples for curvature
210  BRAY_OPT_BAKE_CU_SCALE, // Curvature scale
211  BRAY_OPT_BAKE_CU_BIAS, // Cavity bias
212  BRAY_OPT_BAKE_CU_SDIST, // Curvature s distance
213  BRAY_OPT_BAKE_USE_LIGHTING, // Enable lighting
214  BRAY_OPT_BAKE_FLIPN, // Flip normal
215  BRAY_OPT_BAKE_PBOX_MODE, // Mode for scene bounding box
216  BRAY_OPT_BAKE_PBOX_UNIFORM, // Uniform or stretched
217  BRAY_OPT_BAKE_PBOX_MIN, // Minimum scene bounds
218  BRAY_OPT_BAKE_PBOX_MAX, // Maximum scene bounds
219 
222 };
223 
224 /// @note If you add an object property, please update BRAY_HdUtil.C
226 {
228  BRAY_OBJ_SAMPLE_FROM_STAGE, // Choose motion segments by samples on stage
229  BRAY_OBJ_GEO_VELBLUR, // (0[no blur], 1[vel blur], 2[accel blur])
232  BRAY_OBJ_BLUR_STYLE, // (0[lin], 1[rot])
233 
234  BRAY_OBJ_INSTANCE_VELBLUR, // (0[no blur], 1[vel blur], 2[accel blur])
236 
237  BRAY_OBJ_DICING_QUALITY, // <= 0[no dicing], 1[on m-p per pixel]
239  BRAY_OBJ_TRUE_DISPLACE, // int (0 = bump map, 1 = true, 2 = disable)
240  BRAY_OBJ_DICING_DEPTH_MIN, // integer (-1: unbound)
241  BRAY_OBJ_DICING_DEPTH_MAX, // integer (-1: unbound)
242 
244 
245  /// @{
246  /// @note: The order must match theBsdfBounceTypes in PBR_Types.h
252 
258 
264  /// @}
265 
266  BRAY_OBJ_VOLUME_SAMPLING, // (0[raymarch], 1[woodcock/delta])
277 
279 
284 
286 
287  BRAY_OBJ_POINT_STYLE, // Point rendering style
288  BRAY_OBJ_CURVE_STYLE, // Curve style
289  BRAY_OBJ_CURVE_BASIS, // Curve basis override
290 
291  BRAY_OBJ_TREAT_AS_LIGHTSOURCE, // (0[no], 1[yes], 2[auto])
292  BRAY_OBJ_IS_LIGHTSOURCE, // invisible, set by BRAY under the hood
293  BRAY_OBJ_VOLLIGHT_IMPORTANCE_GRID_SIZE, // int (invisible, for now)
294  BRAY_OBJ_GEOLIGHT_NUM_PERPRIM_CESAMPS, // int (invisible, for now)
295 
299 
302 
304  BRAY_OBJ_CULL_BACKFACE, // (0[off], 1[cull back], 2[cull front])
305 
307  BRAY_OBJ_RENDER_MASK, // invisible, used only by karma delegate
308  BRAY_OBJ_CUSTOM_TRACESETS, // Custom trace groups
309  BRAY_OBJ_LPE_TAG, // string
310 
314 
317 
321 
322  // per-component variance AA settings
326 
329 
330  // UV unwrapping IDs
334 
336 
339 };
340 
342 {
348  BRAY_CAMERA_CLIP, // real[2] (near and far)
349  BRAY_CAMERA_SHUTTER, // real[2] (open and close)
352  BRAY_CAMERA_WINDOW, // real[4] (NDC mapping window)
354  BRAY_CAMERA_TINT, // real[3]
356 
359 };
360 
362 {
364  BRAY_LIGHT_SHADER, // string
365  BRAY_LIGHT_AREA_SHAPE, // int (see BRAY_LightType)
374  BRAY_LIGHT_MIS_BIAS, // real [-1,1]
376  BRAY_LIGHT_SAMPLING_MODE, // int (see LightSamplingMode)
378  BRAY_LIGHT_CATEGORY, // string: category name
379  BRAY_LIGHT_HDRI_MAX_ISIZE, // int (max size for importance sampling tables)
380  BRAY_LIGHT_DISTANT_ANGLE, // float (angle which subtends sun)
381  BRAY_LIGHT_DIFFUSE_SCALE, // float multiplier for diffuse/sss/volume
382  BRAY_LIGHT_SPECULAR_SCALE, // float multiplier for refl/refr
383  BRAY_LIGHT_SINGLE_SIDED, // bool, single or double sided
388  BRAY_LIGHT_ILLUM_BACKGROUND, // bool illuminates background holdout
390  BRAY_LIGHT_CONTRIBUTES_CAUSTIC, // bool contributes to caustic
391  BRAY_LIGHT_SKY_LIGHT, // Type of sky light (none, sky, sky+sun, sun)
392  BRAY_LIGHT_SPREAD, // float (0,1] spread value
393 
396 };
397 
399 {
400  BRAY_PLANE_FILTER, // Pixel filter
401  BRAY_PLANE_SAMPLING, // Sample filtering (0 = average etc.)
402  BRAY_PLANE_DITHER, // Dither for quantizing to integer values
403  BRAY_PLANE_DEFAULT_VALUE, // Default value for 1-channel planes
404  BRAY_PLANE_CRYPTO_ENABLE, // Cryptomatte enable
405  BRAY_PLANE_CRYPTO_RANK, // Cryptomatte maximum rank
406  BRAY_PLANE_CRYPTO_SIDECAR, // Cryptomatte sidecar manifest file
407 
410 };
411 
413 {
419 
422 };
423 
424 /// Not all applications are able to load HDAs. If an application is able to
425 /// load HDAs, it should create a subclass of BRAY_HDALoader and instantiate a
426 /// loader. The constructor will register the class for the application and
427 /// the destructor will de-register.
429 {
430 public:
431  BRAY_HDALoader();
432  virtual ~BRAY_HDALoader();
433 
434  /// The className() is used to print out error messages in case there are
435  /// multiple HDA loaders instantiated.
436  virtual const char *className() const = 0;
437 
438  /// Return true if the HDA given by the path was loaded. It's possible the
439  /// same path may be passed multiple times, and it's up to the implementor
440  /// to optimize for this case. It's up to the implementor to print out
441  /// errors using UT_ErrorLog.
442  virtual bool loadHDA(const UT_StringHolder &path) = 0;
443 };
444 
445 /// Return the name of the renderer
447 
448 /// Look up the enum given a name.
450 {
451  switch (ty)
452  {
453  case BRAY_SCENE_PROPERTY:
457  case BRAY_LIGHT_PROPERTY:
461  case BRAY_PLANE_PROPERTY:
463  default:
464  break;
465  }
466  return 0;
467 }
469  BRAY_PropertyType ty, int id);
471  const UT_StringRef &name);
474 
475 inline bool
477 {
478  return GT_STORE_INVALID
479  != BRAYpropertyStorage(ty, id);
480 }
481 
482 inline bool
483 BRAYisValid(const std::pair<BRAY_PropertyType, int> &prop)
484 {
485  return BRAYisValid(prop.first, prop.second);
486 }
487 
488 #define PROPERTY_LOOKUP(NAME, STYLE, ENUM) \
489  inline ENUM BRAY##NAME(const UT_StringRef &name) \
490  { return ENUM(BRAYproperty(STYLE, name)); } \
491  inline const UT_StringHolder &BRAY##NAME(ENUM token) \
492  { return BRAYproperty(STYLE, token); } \
493  inline exint BRAY##NAME##Size(ENUM token) \
494  { return BRAYpropertySize(STYLE, token); } \
495  inline GT_Storage BRAY##NAME##Storage(ENUM token) \
496  { return BRAYpropertyStorage(STYLE, token); } \
497  /* end of macro */
503 #undef PROPERTY_LOOKUP
504 
505 /// Lookup a property type by name
507 /// Look up the name of a property type by the id
509 
510 /// This function will resolve generic names to the appropriate property type
511 /// and property identifier. For example:
512 /// "plane:filter" -> {BRAY_PLANE_PROPERTY, BRAY_PLANE_FILTER}
513 /// "camera:focal" -> {BRAY_CAMERA_PROPERTY, BRAY_CAMERA_FOCAL}
514 /// "global:bucketsize" -> {BRAY_SCENE_PROPERTY, BRAY_OPT_BUCKETSIZE}
515 /// If the token doesn't map to a property, the function will return an invalid
516 /// pair (i.e. BRAYisValid(result) == false).
517 ///
518 /// If the token isn't prefixed with a property type, the @c default_style will
519 /// be used. For example, with the default of BRAY_SCENE_PROPERTY:
520 /// "bucketsize" -> { BRAY_SCENE_PROPERTY, BRAY_OPT_BUCKETSIZE }
521 /// "focal" -> {invalid_property_pair} (error - not a scene property)
522 BRAY_API extern std::pair<BRAY_PropertyType, int>
523  BRAYproperty(const char *token,
525 
526 /// Given a property type, this will compose a name string that fully qualifies
527 /// the property. This is a string that would be suitable for @c
528 /// BRAYlookupProperty(). This may return a @c nullptr.
529 BRAY_API extern const char *BRAYproperty(UT_WorkBuffer &storage,
531  int property_id,
532  const char *prefix = "");
533 
534 /// @{
535 /// Generic method to return the number of options given an enum
536 template <typename T> static inline constexpr size_t BRAYmaxOptions()
537 { SYS_UNIMPLEMENTED_TEMPLATE(T); return 0; }
538 
539 template <> inline constexpr size_t
541 template <> inline constexpr size_t
543 template <> inline constexpr size_t
545 template <> inline constexpr size_t
547 template <> inline constexpr size_t
549 /// @}
550 
551 /// @{
552 /// Generic method to find the valud of the property type enum given the enum
553 template <typename T> static inline constexpr BRAY_PropertyType BRAYpropertyType()
555 
556 template <> inline constexpr BRAY_PropertyType
558 template <> inline constexpr BRAY_PropertyType
560 template <> inline constexpr BRAY_PropertyType
562 template <> inline constexpr BRAY_PropertyType
564 template <> inline constexpr BRAY_PropertyType
566 /// @}
567 
568 
570 {
571  BRAY_OVERRIDE_LIGHT_OFF, // Standard lighting
572  BRAY_OVERRIDE_LIGHT_EMISSIVE, // Only emissive objects
573  BRAY_OVERRIDE_LIGHT_HEADLIGHT, // Force: Headlight
574  BRAY_OVERRIDE_LIGHT_DOMELIGHT, // Force: Dome Light
575 };
576 
578 {
588 
591 };
592 
594 {
601 
603 };
604 
605 // Different types of user interaction in IPR
607 {
614 
616 };
617 
619 {
620  BRAY_BUCKETORDER_MIDDLE, // Render starting centered on focus point
621  BRAY_BUCKETORDER_TOP, // Render top down
622  BRAY_BUCKETORDER_BOTTOM, // Render bottom up
623  BRAY_BUCKETORDER_LEFT, // Render left to right
624  BRAY_BUCKETORDER_RIGHT, // Render right to left
625 
627 };
628 
630 {
631  BRAY_IMAGEMODE_PROGRESSIVE, // Pass over all buckets on image
632  BRAY_IMAGEMODE_BUCKET, // Finish buckets before advancing
633 
635 };
636 
637 /// Projection modes for rendering
639 {
640  BRAY_PROJ_ORTHOGRAPHIC, // orthographic projection mode
641  BRAY_PROJ_PERSPECTIVE, // perspective projection mode
642  BRAY_PROJ_CVEX_SHADER, // run a CVEX lens shader
643  BRAY_PROJ_BAKING, // Custom baking projection mode
644 
647 };
648 
650 {
651  BRAY_RAYIMPORT_P, // vector: ray origin
652  BRAY_RAYIMPORT_D, // vector: ray direction
653  BRAY_RAYIMPORT_TIME, // float: shutter time
654  BRAY_RAYIMPORT_NEAR, // float: near bias
655  BRAY_RAYIMPORT_FAR, // float: max distance
656  BRAY_RAYIMPORT_MASK, // int: intersection mask
657  BRAY_RAYIMPORT_CONTRIB, // vector: contribution
658 
659  BRAY_RAYIMPORT_HIT_ISHIT, // bool: Hit or miss
660  BRAY_RAYIMPORT_HIT_P, // vector: Hit position (in world space)
661  BRAY_RAYIMPORT_HIT_P_CAMERA,// vector: Hit position (in camera space)
662  BRAY_RAYIMPORT_HIT_Pz, // float: Pz (in space of camera)
663  BRAY_RAYIMPORT_HIT_VELOCITY,// vector: Hit velocity (in world space)
664  BRAY_RAYIMPORT_HIT_MOTION, // vector: Motion Vector (in raster space)
665  BRAY_RAYIMPORT_HIT_STACK, // int[]: Hit stack
666  BRAY_RAYIMPORT_HIT_ELEM, // int: Hit element (raw id)
667  BRAY_RAYIMPORT_HIT_PRIMID, // int: Hit primitive id
668  BRAY_RAYIMPORT_HIT_COORD, // vector: raw parametric coords {u,v,w}
669  BRAY_RAYIMPORT_HIT_DIST, // float: Hit distance
670  BRAY_RAYIMPORT_HIT_DPDZ, // float: dPdz
671  BRAY_RAYIMPORT_HIT_N, // vector: smooth normal
672  BRAY_RAYIMPORT_HIT_N_CAMERA,// vector: smooth normal (in camera space)
673  BRAY_RAYIMPORT_HIT_N_FACING,// vector: view facing smooth normal (in world space)
674  BRAY_RAYIMPORT_HIT_N_FACINGRATIO, // float: facing ratio of smooth normal
675  BRAY_RAYIMPORT_HIT_Ng, // vector: geometric normal
676  BRAY_RAYIMPORT_HIT_Ng_CAMERA, // vector: geometric normal (in camera space)
677  BRAY_RAYIMPORT_HIT_Ng_FACING, // vector: view facing geometric normal (in world space)
678  BRAY_RAYIMPORT_HIT_Ng_FACINGRATIO, // float: facing ratio of geometric normal
679  BRAY_RAYIMPORT_HIT_FLAGS, // int: hit flags
680  BRAY_RAYIMPORT_HIT_OBJECTID,// int: hit object id
681  BRAY_RAYIMPORT_HIT_ISBACKFACE, // bool: is hit object backface
682  BRAY_RAYIMPORT_LEVEL, // int: ray level
683  BRAY_RAYIMPORT_VOLUME_LEVEL,// int: ray volume level
684  BRAY_RAYIMPORT_PIXEL_SAMPLES, // int: pixel samples (ie camera rays)
685  BRAY_RAYIMPORT_HD_PRIM, // int: hydra rprim id for selection
686  BRAY_RAYIMPORT_HD_INST, // int: hydra inst idx (0th level) for selection
687  BRAY_RAYIMPORT_NOFAKECAUSTICS, // bool: disable fake caustics
688 
689  BRAY_RAYIMPORT_CURVE_ATTRIB_P, // vector: interpolated curve position
690  BRAY_RAYIMPORT_CURVE_ATTRIB_WIDTH, // float: interpolated curve width
691  BRAY_RAYIMPORT_CURVE_ATTRIB_TANV, // vector: interpolated curve pos derivative
692 
693  BRAY_RAYIMPORT_ISSHADOWRAY, // bool: is the ray a shadow ray (i.e. isshadowray)
694  BRAY_RAYIMPORT_CONESPREAD, // float: ray cone half angle
695 
696  BRAY_RAYIMPORT_BAKE_P, // P from the bake state
710  BRAY_RAYIMPORT_BAKE_MINBOX, // Minimum bounds
711  BRAY_RAYIMPORT_BAKE_MAXBOX, // Maximum bounds
712  BRAY_RAYIMPORT_BAKE_MINBOX_LOW, // Minimum bounds (low mesh)
713  BRAY_RAYIMPORT_BAKE_MAXBOX_LOW, // Maximum bounds (low mesh)
714  BRAY_RAYIMPORT_BAKE_MINBOX_HIGH, // Minimum bounds (high mesh)
715  BRAY_RAYIMPORT_BAKE_MAXBOX_HIGH, // Maximum bounds (high mesh)
716  BRAY_RAYIMPORT_BAKE_MINBOX_CAGE, // Minimum bounds (cage mesh)
717  BRAY_RAYIMPORT_BAKE_MAXBOX_CAGE, // Maximum bounds (cage mesh)
718  BRAY_RAYIMPORT_BAKE_TRACESET, // The integer traceset
719 
721  BRAY_RAYIMPORT_INVALID = BRAY_RAYIMPORT_MAX // Not a valid ray import
722 };
723 
725 {
726  BRAY_LIGHTIMPORT_SURFNORMAL, // vector: surface normal in light shader
727  BRAY_LIGHTIMPORT_SURFACEINCIDENT, // vector: surface camera vector in light shader
728  BRAY_LIGHTIMPORT_LIGHTVECTOR, // vector: surface to light vector in light shader
729  BRAY_LIGHTIMPORT_SURFACEPOSITION, // vector: surface position in light shader
730 
732  BRAY_LIGHTIMPORT_INVALID = BRAY_LIGHTIMPORT_MAX // Not a valid light import
733 };
734 
735 #define ENUM_MAPPER(TYPE, METHOD) \
736  BRAY_API extern TYPE METHOD(const UT_StringRef &name); \
737  BRAY_API extern const UT_StringHolder &METHOD(TYPE o); \
738  /* end macro */
739 
740 ENUM_MAPPER(BRAY_LightType, BRAYlightType)
741 ENUM_MAPPER(BRAY_RenderStage, BRAYrenderStage)
742 ENUM_MAPPER(BRAY_InteractionType, BRAYinteractionType)
743 ENUM_MAPPER(BRAY_BucketOrder, BRAYbucketOrder)
744 ENUM_MAPPER(BRAY_ImageMode, BRAYimageMode)
745 ENUM_MAPPER(BRAY_Projection, BRAYprojection)
746 ENUM_MAPPER(BRAY_VexRayImport, BRAYrayImport)
747 ENUM_MAPPER(BRAY_VexLightImport, BRAYlightImport)
748 
749 #undef ENUM_MAPPER
750 
751 /// Consistent representation of time type within BRAY
752 using BRAYtime = float;
753 
754 /// Consistent representation for material ids
756 
757 /// Invalid material id
758 static constexpr BRAYmaterialId BRAY_INVALID_MATERIAL_ID = 0;
759 
760 /// List of known LPE prefixes
762 {
766 };
767 static inline BRAY_LPEPrefix
768 operator|(BRAY_LPEPrefix a, BRAY_LPEPrefix b)
769 {
770  return BRAY_LPEPrefix(uint(a)|uint(b));
771 }
772 static inline BRAY_LPEPrefix
773 operator&(BRAY_LPEPrefix a, BRAY_LPEPrefix b)
774 {
775  return BRAY_LPEPrefix(uint(a)&uint(b));
776 }
777 
779 {
787 
790 
793 };
794 
795 #define ENUM_TO_MASK(TOKEN) TOKEN = (1 << TOKEN##_ENUM)
796 /// Ray visibility flags
798 {
800 
801  ENUM_TO_MASK(BRAY_RAY_CAMERA),
802  ENUM_TO_MASK(BRAY_RAY_DIFFUSE),
803  ENUM_TO_MASK(BRAY_RAY_REFLECT),
804  ENUM_TO_MASK(BRAY_RAY_REFRACT),
805  ENUM_TO_MASK(BRAY_RAY_VOLUME),
806  ENUM_TO_MASK(BRAY_RAY_SHADOW_REG),
807  ENUM_TO_MASK(BRAY_RAY_SHADOW_BG),
808 
809  ENUM_TO_MASK(BRAY_PROXY_CAMERA),
810  ENUM_TO_MASK(BRAY_PROXY_SHADOW),
811 
812  ENUM_TO_MASK(BRAY_GUIDE_CAMERA),
813  ENUM_TO_MASK(BRAY_GUIDE_SHADOW),
814 
815  BRAY_RAY_SHADOW = (BRAY_RAY_SHADOW_REG | BRAY_RAY_SHADOW_BG),
816  BRAY_ANY_CAMERA = (BRAY_RAY_CAMERA | BRAY_PROXY_CAMERA | BRAY_GUIDE_CAMERA),
817  BRAY_ANY_SHADOW = (BRAY_RAY_SHADOW | BRAY_PROXY_SHADOW | BRAY_GUIDE_SHADOW),
818 
819  // Temporary flag only for the hydra delegate's internal use. DO NOT USE!
821 
822  BRAY_RAY_ALL = 0x7FFF,
823 
824  BRAY_RAY_PROXY_MASK = (BRAY_PROXY_CAMERA|BRAY_PROXY_SHADOW),
825  BRAY_RAY_GUIDE_MASK = (BRAY_GUIDE_CAMERA|BRAY_GUIDE_SHADOW),
828 };
829 #undef ENUM_TO_MASK
830 
831 static inline BRAY_RayVisibility
833 {
834  return BRAY_RayVisibility(uint(a)|uint(b));
835 }
836 static inline BRAY_RayVisibility
838 {
839  return BRAY_RayVisibility(uint(a)&uint(b));
840 }
841 static inline BRAY_RayVisibility
842 operator~(BRAY_RayVisibility a)
843 {
844  return BRAY_RayVisibility(~uint(a));
845 }
846 
848 
849 /// Generic method to return the number of components for a given import
850 /// Note that arrays types return 0 (see BRAYrayImportArray())
851 template <BRAY_VexRayImport T> static inline constexpr size_t BRAYrayImportSize()
852 {
853 #if !defined(__clang__) && !SYS_IS_GCC_GE(9, 2)
855 #endif
856  return 0;
857 }
858 /// Generic method to return whether the import variable is array valued
859 template <BRAY_VexRayImport T> static inline constexpr bool BRAYrayImportIsArray()
860 {
861 #if !defined(__clang__) && !SYS_IS_GCC_GE(9, 2)
863 #endif
864  return false;
865 }
866 
867 
868 template <BRAY_VexLightImport T> static inline constexpr size_t BRAYlightImportSize()
869 {
870 #if !defined(__clang__) && !SYS_IS_GCC_GE(9, 2)
872 #endif
873  return 0;
874 }
875 /// Generic method to return whether the import variable is array valued
876 template <BRAY_VexLightImport T> static inline constexpr bool BRAYlightImportIsArray()
877 {
878 #if !defined(__clang__) && !SYS_IS_GCC_GE(9, 2)
880 #endif
881  return false;
882 }
883 
884 #define INSTANTIATE(VAR, SIZE, IS_ARRAY) \
885  template <> inline constexpr size_t \
886  BRAYrayImportSize<VAR>() { return SIZE; } \
887  template <> inline constexpr bool \
888  BRAYrayImportIsArray<VAR>() { return IS_ARRAY; } \
889  /* end of macro */
890 
891 INSTANTIATE(BRAY_RAYIMPORT_P, 3, false)
892 INSTANTIATE(BRAY_RAYIMPORT_D, 3, false)
924 
925 #undef INSTANTIATE
926 
927 #define INSTANTIATE(VAR, SIZE, IS_ARRAY) \
928  template <> inline constexpr size_t \
929  BRAYlightImportSize<VAR>() { return SIZE; } \
930  template <> inline constexpr bool \
931  BRAYlightImportIsArray<VAR>() { return IS_ARRAY; } \
932  /* end of macro */
933 
938 #undef INSTANTIATE
939 
940 // LightSamplingMode
941 // enum for BRAY_OPT_LIGHT_SAMPLING_MODE
943 {
944  BRAY_LSM_UNIFORM = 0, // uniform sampling
945  BRAY_LSM_LIGHT_TREE // light hierarchy
946 };
947 
948 #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:449
GT_Storage
Definition: GT_Types.h:19
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
BRAY_OverrideLight
Definition: BRAY_Types.h:569
unsigned short uint16
Definition: SYS_Types.h:38
UT_ASSERT_COMPILETIME(BRAY_EVENT_MAXFLAGS<=32)
#define ENUM_TO_MASK(TOKEN)
Definition: BRAY_Types.h:795
constexpr BRAY_PropertyType BRAYpropertyType< BRAY_LightProperty >()
Definition: BRAY_Types.h:561
float BRAYtime
Consistent representation of time type within BRAY.
Definition: BRAY_Types.h:752
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:649
BRAY_ImageMode
Definition: BRAY_Types.h:629
#define INSTANTIATE(VAR, SIZE, IS_ARRAY)
Definition: BRAY_Types.h:927
BRAY_RayVisibilityEnum
Definition: BRAY_Types.h:778
BRAY_Projection
Projection modes for rendering.
Definition: BRAY_Types.h:638
BRAY_CameraProperty
Definition: BRAY_Types.h:341
MX_GENSHADER_API const TypeDesc * MATERIAL
constexpr size_t BRAYmaxOptions< BRAY_CameraProperty >()
Definition: BRAY_Types.h:546
constexpr BRAY_PropertyType BRAYpropertyType< BRAY_CameraProperty >()
Definition: BRAY_Types.h:563
BRAY_API exint BRAYpropertySize(BRAY_PropertyType ty, int id)
BRAY_VexLightImport
Definition: BRAY_Types.h:724
constexpr BRAY_PropertyType BRAYpropertyType< BRAY_PlaneProperty >()
Definition: BRAY_Types.h:565
constexpr size_t BRAYmaxOptions< BRAY_ObjectProperty >()
Definition: BRAY_Types.h:542
BRAY_ObjectProperty
Definition: BRAY_Types.h:225
IMATH_NAMESPACE::V2f float
BRAY_API UT_StringHolder BRAYrayVisibility(BRAY_RayVisibility mask)
BRAY_RenderStage
Definition: BRAY_Types.h:593
BRAY_RayVisibility
Ray visibility flags.
Definition: BRAY_Types.h:797
BRAY_LightSamplingMode
Definition: BRAY_Types.h:942
constexpr size_t BRAYmaxOptions< BRAY_LightProperty >()
Definition: BRAY_Types.h:544
GLint GLuint mask
Definition: glcorearb.h:124
#define ENUM_MAPPER(TYPE, METHOD)
Definition: BRAY_Types.h:735
#define PROPERTY_LOOKUP(NAME, STYLE, ENUM)
Definition: BRAY_Types.h:488
GLuint const GLchar * name
Definition: glcorearb.h:786
BRAY_LightProperty
Definition: BRAY_Types.h:361
BRAY_PlaneProperty
Definition: BRAY_Types.h:398
#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:540
BRAY_InteractionType
Definition: BRAY_Types.h:606
BRAY_LightType
Definition: BRAY_Types.h:577
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:412
int BRAYmaterialId
Consistent representation for material ids.
Definition: BRAY_Types.h:755
constexpr size_t BRAYmaxOptions< BRAY_PlaneProperty >()
Definition: BRAY_Types.h:548
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:476
constexpr BRAY_PropertyType BRAYpropertyType< BRAY_ObjectProperty >()
Definition: BRAY_Types.h:559
BRAY_LPEPrefix
List of known LPE prefixes.
Definition: BRAY_Types.h:761
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:557
unsigned int uint
Definition: SYS_Types.h:45
BRAY_BucketOrder
Definition: BRAY_Types.h:618