1 //////////////////////////////////////////////////////////////////////
2 //
3 //                             Pixie
4 //
5 // Copyright � 1999 - 2003, Okan Arikan
6 //
7 // Contact: okan@cs.utexas.edu
8 //
9 //	This library is free software; you can redistribute it and/or
10 //	modify it under the terms of the GNU Lesser General Public
11 //	License as published by the Free Software Foundation; either
12 //	version 2.1 of the License, or (at your option) any later version.
13 //
14 //	This library is distributed in the hope that it will be useful,
15 //	but WITHOUT ANY WARRANTY; without even the implied warranty of
16 //	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 //	Lesser General Public License for more details.
18 //
19 //	You should have received a copy of the GNU Lesser General Public
20 //	License along with this library; if not, write to the Free Software
21 //	Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 //
23 ///////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////
25 //
26 //  File				:	rendererc,h
27 //  Classes				:	-
28 //  Description			:	This file holds some global types used by the renderer
29 //
30 ////////////////////////////////////////////////////////////////////////
31 #ifndef RENDERER_CONSTANTS
32 #define RENDERER_CONSTANTS
33 
34 // Possible renderer blocks (Used by sfBegin - sfEnd)
35 typedef enum {
36 	BLOCK_OUTSIDE	=	0,			// The initial block before the renderer is initialized
37 	BLOCK_RENDERER,					// The renderer has been initialized
38 	BLOCK_FRAME,					// Inside a frame block (equals to a renderman world block)
39 	BLOCK_OBJECT,					// Inside an object block
40 	BLOCK_XFORM,					// Inside an xform block
41 	BLOCK_ATTRIBUTES,				// Inside an attributes block
42 	BLOCK_OPTIONS					// inside an options block
43 } ERendererBlock;
44 
45 
46 // Possible types for a variable (Used by CVariable class)
47 typedef enum {
48 	TYPE_FLOAT,							// "u","v","s","t","Pz" ...
49 	TYPE_COLOR,							// "Cs"
50 	TYPE_VECTOR,
51 	TYPE_NORMAL,
52 	TYPE_POINT,
53 	TYPE_MATRIX,
54 	TYPE_QUAD,							// For "Pw"
55 	TYPE_DOUBLE,
56 	TYPE_STRING,
57 	TYPE_INTEGER
58 } EVariableType;
59 
60 // Possible network messages
61 typedef enum {
62 	NET_CONNECT,
63 	NET_ACK,
64 	NET_NACK,
65 	NET_RENDER_BUCKET,
66 	NET_RECEIVE_BUCKET,
67 	NET_FINISH_FRAME,
68 	NET_SEND_FILE,
69 	NET_READY,
70 	NET_CREATE_CHANNEL
71 } ENetMessage;
72 
73 
74 // Possible container classes for a variable (Used by CVariable class)
75 typedef enum {
76 	CONTAINER_UNIFORM,
77 	CONTAINER_VERTEX,
78 	CONTAINER_VARYING,
79 	CONTAINER_FACEVARYING,
80 	CONTAINER_CONSTANT
81 } EVariableClass;
82 
83 // Possible storage classes for a variable
84 typedef enum {
85 	STORAGE_NONE = 0,
86 	STORAGE_GLOBAL,
87 	STORAGE_PARAMETER,
88 	STORAGE_MUTABLEPARAMETER
89 } EVariableStorage;
90 
91 
92 // Possible message accessors for shaders
93 typedef enum {
94 	ACCESSOR_DISPLACEMENT = 0,
95 	ACCESSOR_SURFACE,
96 	ACCESSOR_ATMOSPHERE,
97 	ACCESSOR_LIGHTSOURCE,
98 	ACCESSOR_POSTSHADER,
99 	ACCESSOR_INTERIOR,
100 	ACCESSOR_EXTERIOR,
101 	NUM_ACCESSORS
102 } EMessageAccessor;
103 
104 // Predefined coordinate systems (Used by sfFindCoordinateSystem)
105 typedef enum    {
106     COORDINATE_OBJECT = 0,
107     COORDINATE_CAMERA,
108     COORDINATE_WORLD,
109     COORDINATE_SHADER,
110     COORDINATE_LIGHT,
111     COORDINATE_NDC,
112     COORDINATE_RASTER,
113     COORDINATE_SCREEN,
114 	COORDINATE_CURRENT,
115 	COLOR_RGB,
116     COLOR_HSL,
117     COLOR_HSV,
118     COLOR_XYZ,
119     COLOR_CIE,
120     COLOR_YIQ,
121     COLOR_XYY,
122     COORDINATE_CUSTOM				// This means the system is user defined
123 } ECoordinateSystem;
124 
125 // The directives for pl->shader binding
126 const	unsigned int		BINDPARAM_SURFACE				=	1;
127 const	unsigned int		BINDPARAM_DISPLACEMENT			=	2;
128 const	unsigned int		BINDPARAM_ATMOSPHERE			=	4;
129 
130 // The bounding box indices
131 const	unsigned int		BOUND_PXPYPZ					=	0;
132 const	unsigned int		BOUND_PXPYNZ					=	1;
133 const	unsigned int		BOUND_PXNYNZ					=	2;
134 const	unsigned int		BOUND_PXNYPZ					=	3;
135 const	unsigned int		BOUND_NXPYPZ					=	4;
136 const	unsigned int		BOUND_NXPYNZ					=	5;
137 const	unsigned int		BOUND_NXNYNZ					=	6;
138 const	unsigned int		BOUND_NXNYPZ					=	7;
139 
140 const	unsigned int		BOUND_PX						=	0;
141 const	unsigned int		BOUND_NX						=	1;
142 const	unsigned int		BOUND_PY						=	2;
143 const	unsigned int		BOUND_NY						=	3;
144 const	unsigned int		BOUND_PZ						=	4;
145 const	unsigned int		BOUND_NZ						=	5;
146 
147 
148 //	Entry points for the global variables
149 //	Varying variables (this includes variables declared as vertex too)
150 const	unsigned	int		VARIABLE_P					=	0;
151 const	unsigned	int		VARIABLE_PS					=	1;
152 const	unsigned	int		VARIABLE_N					=	2;
153 const	unsigned	int		VARIABLE_NG					=	3;
154 const	unsigned	int		VARIABLE_DPDU				=	4;
155 const	unsigned	int		VARIABLE_DPDV				=	5;
156 const	unsigned	int		VARIABLE_L					=	6;
157 const	unsigned	int		VARIABLE_CS					=	7;
158 const	unsigned	int		VARIABLE_OS					=	8;
159 const	unsigned	int		VARIABLE_CL					=	9;
160 const	unsigned	int		VARIABLE_OL					=	10;
161 const	unsigned	int		VARIABLE_CI					=	11;
162 const	unsigned	int		VARIABLE_OI					=	12;
163 const	unsigned	int		VARIABLE_S					=	13;
164 const	unsigned	int		VARIABLE_T					=	14;
165 const	unsigned	int		VARIABLE_DU					=	15;
166 const	unsigned	int		VARIABLE_DV					=	16;
167 const	unsigned	int		VARIABLE_U					=	17;
168 const	unsigned	int		VARIABLE_V					=	18;
169 const	unsigned	int		VARIABLE_I					=	19;
170 const	unsigned	int		VARIABLE_E					=	20;
171 const	unsigned	int		VARIABLE_ALPHA				=	21;
172 const	unsigned	int		VARIABLE_TIME				=	22;
173 const	unsigned	int		VARIABLE_PW					=	23;
174 const	unsigned	int		VARIABLE_NCOMPS				=	24;
175 const	unsigned	int		VARIABLE_DTIME				=	25;
176 const	unsigned	int		VARIABLE_DPDTIME			=	26;
177 const	unsigned	int		VARIABLE_WIDTH				=	27;
178 const	unsigned	int		VARIABLE_CONSTANTWIDTH		=	28;
179 
180 //	Some shader parameters
181 const	unsigned	int		PARAMETER_DERIVATIVE		=	1 << 14;
182 const	unsigned	int		PARAMETER_S					=	1;
183 const	unsigned	int		PARAMETER_T					=	1 << 1;
184 const	unsigned	int		PARAMETER_U					=	1 << 2;
185 const	unsigned	int		PARAMETER_V					=	1 << 3;		//			.
186 const	unsigned	int		PARAMETER_DU				=	(1 << 4) | PARAMETER_DERIVATIVE;
187 const	unsigned	int		PARAMETER_DV				=	(1 << 5) | PARAMETER_DERIVATIVE;
188 const	unsigned	int		PARAMETER_TIME				=	1 << 6;
189 const	unsigned	int		PARAMETER_DTIME				=	1 << 7;
190 const	unsigned	int		PARAMETER_NCOMPS			=	1 << 8;
191 const	unsigned	int		PARAMETER_ALPHA				=	1 << 9;
192 const	unsigned	int		PARAMETER_P					=	1 << 10;
193 const	unsigned	int		PARAMETER_PS				=	1 << 11;
194 const	unsigned	int		PARAMETER_DPDU				=	1 << 12;
195 const	unsigned	int		PARAMETER_DPDV				=	1 << 13;
196 const	unsigned	int		PARAMETER_DPDTIME			=	1 << 15;
197 const	unsigned	int		PARAMETER_NG				=	1 << 16;
198 const	unsigned	int		PARAMETER_N					=	(1 << 17) | PARAMETER_NG;
199 const	unsigned	int		PARAMETER_CI				=	1 << 18;
200 const	unsigned	int		PARAMETER_OI				=	1 << 19;
201 const	unsigned	int		PARAMETER_CL				=	1 << 20;
202 const	unsigned	int		PARAMETER_OL				=	1 << 21;
203 const	unsigned	int		PARAMETER_CS				=	1 << 22;
204 const	unsigned	int		PARAMETER_OS				=	1 << 23;
205 const	unsigned	int		PARAMETER_E					=	1 << 24;
206 const	unsigned	int		PARAMETER_I					=	1 << 25;
207 const	unsigned	int		PARAMETER_L					=	1 << 26;
208 const	unsigned	int		PARAMETER_BEGIN_SAMPLE		=	1 << 27;
209 const	unsigned	int		PARAMETER_END_SAMPLE		=	1 << 28;
210 const	unsigned	int		PARAMETER_RAYTRACE			=	1 << 29;	// Requires raytracing
211 const	unsigned	int		PARAMETER_NONAMBIENT		=	1 << 30;	// A non-ambient light source
212 const	unsigned	int		PARAMETER_MESSAGEPASSING	=	1 << 31;	// Shader calls message passing functions
213 
214 
215 
216 #endif
217 
218