HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VOP_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: VOP_Language.h ( VOP Library, C++)
7  *
8  * COMMENTS: This is an abstraction for different languages for VOPs.
9  * This class is basically a mapper from the parameters to types
10  * and other stuff.
11  */
12 
13 #ifndef __VOP_Types__
14 #define __VOP_Types__
15 
16 #include "VOP_API.h"
17 #include <VEX/VEX_VexTypes.h>
18 #include <VEX/VEX_RslTypes.h>
19 #include <VEX/VEX_OslTypes.h>
20 
21 template <typename T> class UT_Array;
22 
23 
24 typedef enum {
25  // VEX types
37 
38  // Structs are considered custom types.
41 
51 
52  // RSL types
53  VOP_TYPE_POINT, // RSL point
54  VOP_TYPE_NORMAL, // RSL normal
55  VOP_TYPE_COLOR, // RSL color
59 
60  VOP_TYPE_ERROR, // An error type (different than undefined type)
61  VOP_TYPE_VOID, // Mainly for function return type.
62  VOP_TYPE_METHOD, // Member method of a class.
63 
64  // Shader types
65  VOP_SHADER_START, // Marker for start of shader types
66 
80  // VOP_EMITTER_SHADER,
81  // VOP_PHOTONVOLUME_SHADER,
82  // VOP_ENVIRONMENT_SHADER,
83  // VOP_CONTOUR_SHADER,
84  // VOP_CONTOUR_STORE_SHADER,
85  // VOP_CONTOUR_CONTRAST_SHADER,
86  // VOP_TEXTURE_SHADER,
93  VOP_GENERIC_SHADER, // Generic shader with generic context.
94  VOP_BSDF_SHADER, // Generic BxDF shader (for surface and volume)
98  VOP_MUTABLE_SHADER, // For switch & select which inherit input type
99  VOP_MATERIAL_SHADER, // Material: collection of shader vopnets
100  VOP_VOP_MATERIAL_SHADER, // Material: collecion of shaders in one vopnet
101  VOP_SHADER_CLASS_SHADER, // Material: class with shader methods in vopnet
102  VOP_STRUCT_DEF_SHADER, // Vop network defines a vop struct
103  VOP_INTEGRATOR_SHADER, // BxDF integrator for lighting calculation
104 
105  VOP_SHADER_END, // Marker for end of shader types
106 
107  VOP_MAX_TYPES, // Sentinal, before the uniform types
108 
116 } VOP_Type;
117 
118 #define VOP_BASE_TYPE(type) ((VOP_Type)(type&(VOP_TYPE_UNIFORM_MODIFIER-1)))
119 #define VOP_GET_MODIFIER(type) ((VOP_Type)(type&VOP_TYPE_UNIFORM_MODIFIER))
120 #define VOP_INVALID_TYPE(type) ((type)==VOP_TYPE_UNDEF||(type)==VOP_TYPE_ERROR)
121 #define VOP_VALID_TYPE(type) (!VOP_INVALID_TYPE(type))
122 
123 /// Returns true if the type is some kind of an array, and false otherwise.
125 
126 /// @{ Returns the element type of an array and
127 /// an array type based on array element type, respectively.
130 /// @}
131 
132 
133 /// Obtains the shader type based on its name.
134 /// A shader node has a single shader type, which can correspond to a shading
135 /// context in a given languate, such as surface or displacement. But,
136 /// it can be also a material or a class that has no such correspondence.
141 
142 /// A generic shading context type that can be interpreted as VEX_ContextType,
143 /// RSL_ContextType, or OSL_ContextType. Different languages support different
144 /// shading contexts, although they share some common ones (eg, surface).
145 /// Node's shader type may allow a single context (eg, surface shader contains
146 /// VOPs that are valid only in the surface context), but it may allow
147 /// several context (eg, material allows surface and displacement variables
148 /// and fuctions).
149 typedef int VOP_ContextType;
150 #define VOP_CONTEXT_TYPE_INVALID 0
151 
152 /// A definition of the context type list.
155 
156 /// Defines the known languages. Each of the languages has own set of context
157 /// types.
158 typedef enum {
164 
165 
166 // TODO: remove these conversion functions
167 /// @{ Utility function to convert between lowel level contexts and shader type.
174 /// @}
175 
176 // TODO: move this to language class
177 /// Converts the 'shader_type' based on a language to a VEX or RSL
178 /// context type encoded into the returned value of VOP_ContextType.
179 VOP_API VOP_ContextType VOPconvertToContextType( VOP_Type shader_type,
180  VOP_LanguageType language);
181 
182 // TODO: move this to language class
183 /// Converts the context type to a 'shader type'.
185  VOP_LanguageType language);
186 
187 // TODO: move these to language class
188 /// @{ Utility function to find out the context type based on the token
189 /// name (plus the language type), and vice versa.
190 VOP_API VOP_ContextType VOPconvertToContextType( const char * context_name,
191  VOP_LanguageType language);
192 VOP_API const char * VOPgetContextTypeName( VOP_ContextType context_type,
193  VOP_LanguageType language);
194 VOP_API const char * VOPgetContextTypeLabel(VOP_ContextType context_type,
195  VOP_LanguageType language);
196 /// @}
197 
198 // TODO: remove these conversion functions
199 /// @{ Utility functions to turn lower level context types into VOP_ContextType.
206 /// @}
207 
209 
210 #endif
VOP_API const char * VOPgetContextTypeName(VOP_ContextType context_type, VOP_LanguageType language)
VOP_API const char * VOPgetContextTypeLabel(VOP_ContextType context_type, VOP_LanguageType language)
VOP_API RSL_ContextType VOPconvertToRslContextType(VOP_Type shader_type)
Utility function to convert between lowel level contexts and shader type.
VOP_API VOP_Type VOPgetArrayTypeFromElement(VOP_Type element_type)
VOP_API VOP_Type VOPgetShaderType(const char *name)
VOP_API const char * VOPgetShaderTypeName(VOP_Type type)
VOP_API VEX_ContextType VOPconvertToVexContextType(VOP_Type shader_type)
Utility function to convert between lowel level contexts and shader type.
VOP_API void VOPgetShaderTypes(UT_Array< VOP_Type > &types)
int VOP_ContextType
Definition: VOP_Types.h:149
UT_Array< VOP_ContextType > VOP_ContextTypeList
A definition of the context type list.
Definition: VOP_Types.h:153
VOP_API OSL_ContextType VOPconvertToOslContextType(VOP_Type shader_type)
Utility function to convert between lowel level contexts and shader type.
#define VOP_API
Definition: VOP_API.h:10
VOP_API const char * VOPgetShaderTypeLabel(VOP_Type type)
VOP_API bool VOPisArrayType(VOP_Type type)
Returns true if the type is some kind of an array, and false otherwise.
GLuint const GLchar * name
Definition: glcorearb.h:785
OSL_ContextType
RenderMan shader context types.
Definition: VEX_OslTypes.h:25
VOP_API bool isValidPassThroughType(VOP_Type type)
VOP_Type
Definition: VOP_Types.h:24
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
RSL_ContextType
RenderMan shader context types.
Definition: VEX_RslTypes.h:25
GLsizei GLenum GLenum * types
Definition: glcorearb.h:2541
UT_Array< VOP_Type > VOP_ShaderTypeList
Definition: VOP_Types.h:154
VOP_API VOP_Type VOPgetElementTypeFromArray(VOP_Type array_type)
VEX_ContextType
Definition: VEX_VexTypes.h:60
VOP_API VOP_ContextType VOPconvertToContextType(VOP_Type shader_type, VOP_LanguageType language)
VOP_LanguageType
Definition: VOP_Types.h:158
VOP_API VOP_Type VOPconvertToShaderType(VEX_ContextType type)
Utility function to convert between lowel level contexts and shader type.