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
38 
39  // Structs are considered custom types.
42 
53 
54  // RSL types
55  VOP_TYPE_POINT, // RSL point
56  VOP_TYPE_NORMAL, // RSL normal
57  VOP_TYPE_COLOR, // RSL color
61 
62  VOP_TYPE_ERROR, // An error type (different than undefined type)
63  VOP_TYPE_VOID, // Mainly for function return type.
64  VOP_TYPE_METHOD, // Member method of a class.
65 
66  // Shader types
67  VOP_SHADER_START, // Marker for start of shader types
68 
82  // VOP_EMITTER_SHADER,
83  // VOP_PHOTONVOLUME_SHADER,
84  // VOP_ENVIRONMENT_SHADER,
85  // VOP_CONTOUR_SHADER,
86  // VOP_CONTOUR_STORE_SHADER,
87  // VOP_CONTOUR_CONTRAST_SHADER,
88  // VOP_TEXTURE_SHADER,
94  VOP_GENERIC_SHADER, // Generic shader with generic context.
95  VOP_BSDF_SHADER, // Generic BxDF shader (for surface and volume)
99  VOP_MUTABLE_SHADER, // For switch & select which inherit input type
100  VOP_MATERIAL_SHADER, // Material: collection of shader vopnets
101  VOP_VOP_MATERIAL_SHADER, // Material: collecion of shaders in one vopnet
102  VOP_SHADER_CLASS_SHADER, // Material: class with shader methods in vopnet
103  VOP_STRUCT_DEF_SHADER, // Vop network defines a vop struct
104  VOP_INTEGRATOR_SHADER, // BxDF integrator for lighting calculation
105 
106  VOP_SHADER_END, // Marker for end of shader types
107 
108  VOP_MAX_TYPES, // Sentinal, before the uniform types
109 
118 } VOP_Type;
119 
120 #define VOP_BASE_TYPE(type) ((VOP_Type)(type&(VOP_TYPE_UNIFORM_MODIFIER-1)))
121 #define VOP_GET_MODIFIER(type) ((VOP_Type)(type&VOP_TYPE_UNIFORM_MODIFIER))
122 #define VOP_INVALID_TYPE(type) ((type)==VOP_TYPE_UNDEF||(type)==VOP_TYPE_ERROR)
123 #define VOP_VALID_TYPE(type) (!VOP_INVALID_TYPE(type))
124 
125 /// Returns true if the type is some kind of an array, and false otherwise.
127 
128 /// @{ Returns the element type of an array and
129 /// an array type based on array element type, respectively.
132 /// @}
133 
134 
135 /// Obtains the shader type based on its name.
136 /// A shader node has a single shader type, which can correspond to a shading
137 /// context in a given languate, such as surface or displacement. But,
138 /// it can be also a material or a class that has no such correspondence.
143 
144 /// A generic shading context type that can be interpreted as VEX_ContextType,
145 /// RSL_ContextType, or OSL_ContextType. Different languages support different
146 /// shading contexts, although they share some common ones (eg, surface).
147 /// Node's shader type may allow a single context (eg, surface shader contains
148 /// VOPs that are valid only in the surface context), but it may allow
149 /// several context (eg, material allows surface and displacement variables
150 /// and fuctions).
151 typedef int VOP_ContextType;
152 #define VOP_CONTEXT_TYPE_INVALID 0
153 
154 /// A definition of the context type list.
157 
158 /// Defines the known languages. Each of the languages has own set of context
159 /// types.
160 typedef enum {
166 
167 
168 // TODO: remove these conversion functions
169 /// @{ Utility function to convert between lowel level contexts and shader type.
176 /// @}
177 
178 // TODO: move this to language class
179 /// Converts the 'shader_type' based on a language to a VEX or RSL
180 /// context type encoded into the returned value of VOP_ContextType.
181 VOP_API VOP_ContextType VOPconvertToContextType( VOP_Type shader_type,
182  VOP_LanguageType language);
183 
184 // TODO: move this to language class
185 /// Converts the context type to a 'shader type'.
187  VOP_LanguageType language);
188 
189 // TODO: move these to language class
190 /// @{ Utility function to find out the context type based on the token
191 /// name (plus the language type), and vice versa.
192 VOP_API VOP_ContextType VOPconvertToContextType( const char * context_name,
193  VOP_LanguageType language);
194 VOP_API const char * VOPgetContextTypeName( VOP_ContextType context_type,
195  VOP_LanguageType language);
196 VOP_API const char * VOPgetContextTypeLabel(VOP_ContextType context_type,
197  VOP_LanguageType language);
198 /// @}
199 
200 // TODO: remove these conversion functions
201 /// @{ Utility functions to turn lower level context types into VOP_ContextType.
208 /// @}
209 
211 
212 #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.
GLuint const GLchar * name
Definition: glew.h:1814
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:151
UT_Array< VOP_ContextType > VOP_ContextTypeList
A definition of the context type list.
Definition: VOP_Types.h:155
GLsizei GLenum GLenum * types
Definition: glew.h:3954
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 GLuint GLsizei GLenum type
Definition: glew.h:1253
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
RSL_ContextType
RenderMan shader context types.
Definition: VEX_RslTypes.h:25
UT_Array< VOP_Type > VOP_ShaderTypeList
Definition: VOP_Types.h:156
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:160
VOP_API VOP_Type VOPconvertToShaderType(VEX_ContextType type)
Utility function to convert between lowel level contexts and shader type.