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 /// Enumeration of the built-in (basic) VOP data types.
25 typedef enum {
26  // VEX types
39 
40  // Structs are considered custom types.
43 
54 
55  // RSL types
56  VOP_TYPE_POINT, // RSL point
57  VOP_TYPE_NORMAL, // RSL normal
58  VOP_TYPE_COLOR, // RSL color
62 
63  VOP_TYPE_ERROR, // An error type (different than undefined type)
64  VOP_TYPE_VOID, // Mainly for function return type.
65  VOP_TYPE_METHOD, // Member method of a class.
66 
67  // Shader types
68  VOP_SHADER_START, // Marker for start of shader types
69 
83  // VOP_EMITTER_SHADER,
84  // VOP_PHOTONVOLUME_SHADER,
85  // VOP_ENVIRONMENT_SHADER,
86  // VOP_CONTOUR_SHADER,
87  // VOP_CONTOUR_STORE_SHADER,
88  // VOP_CONTOUR_CONTRAST_SHADER,
89  // VOP_TEXTURE_SHADER,
95  VOP_GENERIC_SHADER, // Generic shader with generic context.
96  VOP_BSDF_SHADER, // Generic BxDF shader (for surface and volume)
100  VOP_MUTABLE_SHADER, // For switch & select which inherit input type
101  VOP_MATERIAL_SHADER, // Material: collection of shader vopnets
102  VOP_VOP_MATERIAL_SHADER, // Material: collecion of shaders in one vopnet
103  VOP_SHADER_CLASS_SHADER, // Material: class with shader methods in vopnet
104  VOP_STRUCT_DEF_SHADER, // Vop network defines a vop struct
105  VOP_INTEGRATOR_SHADER, // BxDF integrator for lighting calculation
106 
107  VOP_SHADER_END, // Marker for end of shader types
108 
109  VOP_MAX_TYPES, // Sentinal, before the uniform types
110 
126 
129 
143 
144 } VOP_Type;
145 
146 #define VOP_BASE_TYPE(type) ((VOP_Type)(type&(VOP_TYPE_UNIFORM_MODIFIER-1)))
147 #define VOP_GET_MODIFIER(type) ((VOP_Type)(type&VOP_TYPE_UNIFORM_MODIFIER))
148 #define VOP_INVALID_TYPE(type) ((type)==VOP_TYPE_UNDEF||(type)==VOP_TYPE_ERROR)
149 #define VOP_VALID_TYPE(type) (!VOP_INVALID_TYPE(type))
150 
151 /// Returns true if the type is some kind of an array, and false otherwise.
153 
154 /// @{ Returns the element type of an array and
155 /// an array type based on array element type, respectively.
158 /// @}
159 
160 
161 /// Obtains the shader type based on its name.
162 /// A shader node has a single shader type, which can correspond to a shading
163 /// context in a given languate, such as surface or displacement. But,
164 /// it can be also a material or a class that has no such correspondence.
169 
170 /// A generic shading context type that can be interpreted as VEX_ContextType,
171 /// RSL_ContextType, or OSL_ContextType. Different languages support different
172 /// shading contexts, although they share some common ones (eg, surface).
173 /// Node's shader type may allow a single context (eg, surface shader contains
174 /// VOPs that are valid only in the surface context), but it may allow
175 /// several context (eg, material allows surface and displacement variables
176 /// and fuctions).
177 typedef int VOP_ContextType;
178 #define VOP_CONTEXT_TYPE_INVALID 0
179 
180 /// A definition of the context type list.
183 
184 /// Defines the known languages. Each of the languages has own set of context
185 /// types.
186 typedef enum {
193 
194 
195 // TODO: remove these conversion functions
196 /// @{ Utility function to convert between lowel level contexts and shader type.
203 /// @}
204 
205 // TODO: move this to language class
206 /// Converts the 'shader_type' based on a language to a VEX or RSL
207 /// context type encoded into the returned value of VOP_ContextType.
208 VOP_API VOP_ContextType VOPconvertToContextType( VOP_Type shader_type,
209  VOP_LanguageType language);
210 
211 // TODO: move this to language class
212 /// Converts the context type to a 'shader type'.
214  VOP_LanguageType language);
215 
216 // TODO: move these to language class
217 /// @{ Utility function to find out the context type based on the token
218 /// name (plus the language type), and vice versa.
219 VOP_API VOP_ContextType VOPconvertToContextType( const char * context_name,
220  VOP_LanguageType language);
221 VOP_API const char * VOPgetContextTypeName( VOP_ContextType context_type,
222  VOP_LanguageType language);
223 VOP_API const char * VOPgetContextTypeLabel(VOP_ContextType context_type,
224  VOP_LanguageType language);
225 /// @}
226 
227 // TODO: remove these conversion functions
228 /// @{ Utility functions to turn lower level context types into VOP_ContextType.
235 /// @}
236 
238 
239 #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:177
UT_Array< VOP_ContextType > VOP_ContextTypeList
A definition of the context type list.
Definition: VOP_Types.h:181
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:786
OSL_ContextType
RenderMan shader context types.
Definition: VEX_OslTypes.h:25
VOP_API bool isValidPassThroughType(VOP_Type type)
VOP_Type
Enumeration of the built-in (basic) VOP data types.
Definition: VOP_Types.h:25
RSL_ContextType
RenderMan shader context types.
Definition: VEX_RslTypes.h:25
GLsizei GLenum GLenum * types
Definition: glcorearb.h:2542
UT_Array< VOP_Type > VOP_ShaderTypeList
Definition: VOP_Types.h:182
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)
type
Definition: core.h:1059
VOP_LanguageType
Definition: VOP_Types.h:186
VOP_API VOP_Type VOPconvertToShaderType(VEX_ContextType type)
Utility function to convert between lowel level contexts and shader type.