1 | /*
|
---|
2 | -----------------------------------------------------------------------------
|
---|
3 | This source file is part of OGRE
|
---|
4 | (Object-oriented Graphics Rendering Engine)
|
---|
5 | For the latest info, see http://www.ogre3d.org/
|
---|
6 |
|
---|
7 | Copyright (c) 2000-2005 The OGRE Team
|
---|
8 | Also see acknowledgements in Readme.html
|
---|
9 |
|
---|
10 | This program is free software; you can redistribute it and/or modify it under
|
---|
11 | the terms of the GNU Lesser General Public License as published by the Free Software
|
---|
12 | Foundation; either version 2 of the License, or (at your option) any later
|
---|
13 | version.
|
---|
14 |
|
---|
15 | This program is distributed in the hope that it will be useful, but WITHOUT
|
---|
16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
---|
17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
---|
18 |
|
---|
19 | You should have received a copy of the GNU Lesser General Public License along with
|
---|
20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
---|
21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to
|
---|
22 | http://www.gnu.org/copyleft/lesser.txt.
|
---|
23 | -----------------------------------------------------------------------------
|
---|
24 | */
|
---|
25 |
|
---|
26 | #include "OgreStableHeaders.h"
|
---|
27 | #include "OgreShadowVolumeExtrudeProgram.h"
|
---|
28 | #include "OgreString.h"
|
---|
29 | #include "OgreGpuProgramManager.h"
|
---|
30 | #include "OgreGpuProgram.h"
|
---|
31 | #include "OgreException.h"
|
---|
32 |
|
---|
33 | namespace Ogre {
|
---|
34 |
|
---|
35 | // c4 is the light position/direction in these
|
---|
36 | String ShadowVolumeExtrudeProgram::mPointArbvp1 =
|
---|
37 | "!!ARBvp1.0\n"
|
---|
38 | "PARAM c5 = { 0, 0, 0, 0 };\n"
|
---|
39 | "TEMP R0;\n"
|
---|
40 | "ATTRIB v24 = vertex.texcoord[0];\n"
|
---|
41 | "ATTRIB v16 = vertex.position;\n"
|
---|
42 | "PARAM c0[4] = { program.local[0..3] };\n"
|
---|
43 | "PARAM c4 = program.local[4];\n"
|
---|
44 | "ADD R0.xyz, v16.xyzx, -c4.xyzx;\n"
|
---|
45 | "MOV R0.w, c5.x;\n"
|
---|
46 | "MAD R0, v24.x, c4, R0;\n"
|
---|
47 | "DP4 result.position.x, c0[0], R0;\n"
|
---|
48 | "DP4 result.position.y, c0[1], R0;\n"
|
---|
49 | "DP4 result.position.z, c0[2], R0;\n"
|
---|
50 | "DP4 result.position.w, c0[3], R0;\n"
|
---|
51 | "END\n";
|
---|
52 |
|
---|
53 | String ShadowVolumeExtrudeProgram::mPointVs_1_1 =
|
---|
54 | "vs_1_1\n"
|
---|
55 | "def c5, 0, 0, 0, 0\n"
|
---|
56 | "dcl_texcoord0 v7\n"
|
---|
57 | "dcl_position v0\n"
|
---|
58 | "add r0.xyz, v0.xyz, -c4.xyz\n"
|
---|
59 | "mov r0.w, c5.x\n"
|
---|
60 | "mad r0, v7.x, c4, r0\n"
|
---|
61 | "dp4 oPos.x, c0, r0\n"
|
---|
62 | "dp4 oPos.y, c1, r0\n"
|
---|
63 | "dp4 oPos.z, c2, r0\n"
|
---|
64 | "dp4 oPos.w, c3, r0\n";
|
---|
65 |
|
---|
66 | String ShadowVolumeExtrudeProgram::mDirArbvp1 =
|
---|
67 | "!!ARBvp1.0\n"
|
---|
68 | "TEMP R0;\n"
|
---|
69 | "ATTRIB v24 = vertex.texcoord[0];\n"
|
---|
70 | "ATTRIB v16 = vertex.position;\n"
|
---|
71 | "PARAM c0[4] = { program.local[0..3] };\n"
|
---|
72 | "PARAM c4 = program.local[4];\n"
|
---|
73 | "ADD R0, v16, c4;\n"
|
---|
74 | "MAD R0, v24.x, R0, -c4;\n"
|
---|
75 | "DP4 result.position.x, c0[0], R0;\n"
|
---|
76 | "DP4 result.position.y, c0[1], R0;\n"
|
---|
77 | "DP4 result.position.z, c0[2], R0;\n"
|
---|
78 | "DP4 result.position.w, c0[3], R0;\n"
|
---|
79 | "END\n";
|
---|
80 |
|
---|
81 | String ShadowVolumeExtrudeProgram::mDirVs_1_1 =
|
---|
82 | "vs_1_1\n"
|
---|
83 | "dcl_texcoord0 v7\n"
|
---|
84 | "dcl_position v0\n"
|
---|
85 | "add r0, v0, c4\n"
|
---|
86 | "mad r0, v7.x, r0, -c4\n"
|
---|
87 | "dp4 oPos.x, c0, r0\n"
|
---|
88 | "dp4 oPos.y, c1, r0\n"
|
---|
89 | "dp4 oPos.z, c2, r0\n"
|
---|
90 | "dp4 oPos.w, c3, r0\n";
|
---|
91 |
|
---|
92 |
|
---|
93 | String ShadowVolumeExtrudeProgram::mPointArbvp1Debug =
|
---|
94 | "!!ARBvp1.0\n"
|
---|
95 | "PARAM c5 = { 0, 0, 0, 0 };\n"
|
---|
96 | "PARAM c6 = { 1, 1, 1, 1 };\n"
|
---|
97 | "TEMP R0;\n"
|
---|
98 | "ATTRIB v24 = vertex.texcoord[0];\n"
|
---|
99 | "ATTRIB v16 = vertex.position;\n"
|
---|
100 | "PARAM c0[4] = { program.local[0..3] };\n"
|
---|
101 | "PARAM c4 = program.local[4];\n"
|
---|
102 | "ADD R0.xyz, v16.xyzx, -c4.xyzx;\n"
|
---|
103 | "MOV R0.w, c5.x;\n"
|
---|
104 | "MAD R0, v24.x, c4, R0;\n"
|
---|
105 | "DP4 result.position.x, c0[0], R0;\n"
|
---|
106 | "DP4 result.position.y, c0[1], R0;\n"
|
---|
107 | "DP4 result.position.z, c0[2], R0;\n"
|
---|
108 | "DP4 result.position.w, c0[3], R0;\n"
|
---|
109 | "MOV result.color.front.primary, c6.x;\n"
|
---|
110 | "END\n";
|
---|
111 |
|
---|
112 | String ShadowVolumeExtrudeProgram::mPointVs_1_1Debug =
|
---|
113 | "vs_1_1\n"
|
---|
114 | "def c5, 0, 0, 0, 0\n"
|
---|
115 | "def c6, 1, 1, 1, 1\n"
|
---|
116 | "dcl_texcoord0 v7\n"
|
---|
117 | "dcl_position v0\n"
|
---|
118 | "add r0.xyz, v0.xyz, -c4.xyz\n"
|
---|
119 | "mov r0.w, c5.x\n"
|
---|
120 | "mad r0, v7.x, c4, r0\n"
|
---|
121 | "dp4 oPos.x, c0, r0\n"
|
---|
122 | "dp4 oPos.y, c1, r0\n"
|
---|
123 | "dp4 oPos.z, c2, r0\n"
|
---|
124 | "dp4 oPos.w, c3, r0\n"
|
---|
125 | "mov oD0, c6.x\n";
|
---|
126 |
|
---|
127 | String ShadowVolumeExtrudeProgram::mDirArbvp1Debug =
|
---|
128 | "!!ARBvp1.0\n"
|
---|
129 | "PARAM c5 = { 1, 1, 1, 1};\n"
|
---|
130 | "TEMP R0;\n"
|
---|
131 | "ATTRIB v24 = vertex.texcoord[0];\n"
|
---|
132 | "ATTRIB v16 = vertex.position;\n"
|
---|
133 | "PARAM c0[4] = { program.local[0..3] };\n"
|
---|
134 | "PARAM c4 = program.local[4];\n"
|
---|
135 | "ADD R0, v16, c4;\n"
|
---|
136 | "MAD R0, v24.x, R0, -c4;\n"
|
---|
137 | "DP4 result.position.x, c0[0], R0;\n"
|
---|
138 | "DP4 result.position.y, c0[1], R0;\n"
|
---|
139 | "DP4 result.position.z, c0[2], R0;\n"
|
---|
140 | "DP4 result.position.w, c0[3], R0;\n"
|
---|
141 | "MOV result.color.front.primary, c5.x;"
|
---|
142 | "END\n";
|
---|
143 |
|
---|
144 | String ShadowVolumeExtrudeProgram::mDirVs_1_1Debug =
|
---|
145 | "vs_1_1\n"
|
---|
146 | "def c5, 1, 1, 1, 1\n"
|
---|
147 | "dcl_texcoord0 v7\n"
|
---|
148 | "dcl_position v0\n"
|
---|
149 | "add r0, v0, c4\n"
|
---|
150 | "mad r0, v7.x, r0, -c4\n"
|
---|
151 | "dp4 oPos.x, c0, r0\n"
|
---|
152 | "dp4 oPos.y, c1, r0\n"
|
---|
153 | "dp4 oPos.z, c2, r0\n"
|
---|
154 | "dp4 oPos.w, c3, r0\n"
|
---|
155 | "mov oD0, c5.x\n";
|
---|
156 |
|
---|
157 |
|
---|
158 | // c4 is the light position/direction in these
|
---|
159 | // c5 is extrusion distance
|
---|
160 | String ShadowVolumeExtrudeProgram::mPointArbvp1Finite =
|
---|
161 | "!!ARBvp1.0\n"
|
---|
162 | "PARAM c6 = { 1, 0, 0, 0 };\n"
|
---|
163 | "TEMP R0;\n"
|
---|
164 | "ATTRIB v24 = vertex.texcoord[0];\n"
|
---|
165 | "ATTRIB v16 = vertex.position;\n"
|
---|
166 | "PARAM c0[4] = { program.local[0..3] };\n"
|
---|
167 | "PARAM c5 = program.local[5];\n"
|
---|
168 | "PARAM c4 = program.local[4];\n"
|
---|
169 | "ADD R0.x, c6.x, -v24.x;\n"
|
---|
170 | "MUL R0.w, R0.x, c5.x;\n"
|
---|
171 | "ADD R0.xyz, v16.xyzx, -c4.xyzx;\n"
|
---|
172 | "MAD R0.xyz, R0.w, R0.xyzx, v16.xyzx;\n"
|
---|
173 | "DPH result.position.x, R0.xyzz, c0[0];\n"
|
---|
174 | "DPH result.position.y, R0.xyzz, c0[1];\n"
|
---|
175 | "DPH result.position.z, R0.xyzz, c0[2];\n"
|
---|
176 | "DPH result.position.w, R0.xyzz, c0[3];\n"
|
---|
177 | "END\n";
|
---|
178 |
|
---|
179 | String ShadowVolumeExtrudeProgram::mPointVs_1_1Finite =
|
---|
180 | "vs_1_1\n"
|
---|
181 | "def c6, 1, 0, 0, 0\n"
|
---|
182 | "dcl_texcoord0 v7\n"
|
---|
183 | "dcl_position v0\n"
|
---|
184 | "add r0.x, c6.x, -v7.x\n"
|
---|
185 | "mul r1.x, r0.x, c5.x\n"
|
---|
186 | "add r0.yzw, v0.xxyz, -c4.xxyz\n"
|
---|
187 | "dp3 r0.x, r0.yzw, r0.yzw\n"
|
---|
188 | "rsq r0.x, r0.x\n"
|
---|
189 | "mul r0.xyz, r0.x, r0.yzw\n"
|
---|
190 | "mad r0.xyz, r1.x, r0.xyz, v0.xyz\n"
|
---|
191 | "mov r0.w, c6.x\n"
|
---|
192 | "dp4 oPos.x, c0, r0\n"
|
---|
193 | "dp4 oPos.y, c1, r0\n"
|
---|
194 | "dp4 oPos.z, c2, r0\n"
|
---|
195 | "dp4 oPos.w, c3, r0\n";
|
---|
196 | String ShadowVolumeExtrudeProgram::mDirArbvp1Finite =
|
---|
197 | "!!ARBvp1.0\n"
|
---|
198 | "PARAM c6 = { 1, 0, 0, 0 };\n"
|
---|
199 | "TEMP R0;\n"
|
---|
200 | "ATTRIB v24 = vertex.texcoord[0];\n"
|
---|
201 | "ATTRIB v16 = vertex.position;\n"
|
---|
202 | "PARAM c0[4] = { program.local[0..3] };\n"
|
---|
203 | "PARAM c4 = program.local[4];\n"
|
---|
204 | "PARAM c5 = program.local[5];\n"
|
---|
205 | "ADD R0.x, c6.x, -v24.x;\n"
|
---|
206 | "MUL R0.x, R0.x, c5.x;\n"
|
---|
207 | "MAD R0.xyz, -R0.x, c4.xyzx, v16.xyzx;\n"
|
---|
208 | "DPH result.position.x, R0.xyzz, c0[0];\n"
|
---|
209 | "DPH result.position.y, R0.xyzz, c0[1];\n"
|
---|
210 | "DPH result.position.z, R0.xyzz, c0[2];\n"
|
---|
211 | "DPH result.position.w, R0.xyzz, c0[3];\n"
|
---|
212 | "END\n";
|
---|
213 | String ShadowVolumeExtrudeProgram::mDirVs_1_1Finite =
|
---|
214 | "vs_1_1\n"
|
---|
215 | "def c6, 1, 0, 0, 0\n"
|
---|
216 | "dcl_texcoord0 v7\n"
|
---|
217 | "dcl_position v0\n"
|
---|
218 | "add r0.x, c6.x, -v7.x\n"
|
---|
219 | "mul r0.x, r0.x, c5.x\n"
|
---|
220 | "mad r0.xyz, -r0.x, c4.xyz, v0.xyz\n"
|
---|
221 | "mov r0.w, c6.x\n"
|
---|
222 | "dp4 oPos.x, c0, r0\n"
|
---|
223 | "dp4 oPos.y, c1, r0\n"
|
---|
224 | "dp4 oPos.z, c2, r0\n"
|
---|
225 | "dp4 oPos.w, c3, r0\n";
|
---|
226 | String ShadowVolumeExtrudeProgram::mPointArbvp1FiniteDebug =
|
---|
227 | "!!ARBvp1.0\n"
|
---|
228 | "PARAM c6 = { 1, 0, 0, 0 };\n"
|
---|
229 | "TEMP R0, R1;\n"
|
---|
230 | "ATTRIB v24 = vertex.texcoord[0];\n"
|
---|
231 | "ATTRIB v16 = vertex.position;\n"
|
---|
232 | "PARAM c0[4] = { program.local[0..3] };\n"
|
---|
233 | "PARAM c5 = program.local[5];\n"
|
---|
234 | "PARAM c4 = program.local[4];\n"
|
---|
235 | "MOV result.color.front.primary, c6.x;\n"
|
---|
236 | "ADD R0.x, c6.x, -v24.x;\n"
|
---|
237 | "MUL R1.x, R0.x, c5.x;\n"
|
---|
238 | "ADD R0.yzw, v16.xxyz, -c4.xxyz;\n"
|
---|
239 | "DP3 R0.x, R0.yzwy, R0.yzwy;\n"
|
---|
240 | "RSQ R0.x, R0.x;\n"
|
---|
241 | "MUL R0.xyz, R0.x, R0.yzwy;\n"
|
---|
242 | "MAD R0.xyz, R1.x, R0.xyzx, v16.xyzx;\n"
|
---|
243 | "DPH result.position.x, R0.xyzz, c0[0];\n"
|
---|
244 | "DPH result.position.y, R0.xyzz, c0[1];\n"
|
---|
245 | "DPH result.position.z, R0.xyzz, c0[2];\n"
|
---|
246 | "DPH result.position.w, R0.xyzz, c0[3];\n"
|
---|
247 | "END\n";
|
---|
248 | String ShadowVolumeExtrudeProgram::mPointVs_1_1FiniteDebug =
|
---|
249 | "vs_1_1\n"
|
---|
250 | "def c6, 1, 0, 0, 0\n"
|
---|
251 | "dcl_texcoord0 v7\n"
|
---|
252 | "dcl_position v0\n"
|
---|
253 | "mov oD0, c6.x\n"
|
---|
254 | "add r0.x, c6.x, -v7.x\n"
|
---|
255 | "mul r1.x, r0.x, c5.x\n"
|
---|
256 | "add r0.yzw, v0.xxyz, -c4.xxyz\n"
|
---|
257 | "dp3 r0.x, r0.yzw, r0.yzw\n"
|
---|
258 | "rsq r0.x, r0.x\n"
|
---|
259 | "mul r0.xyz, r0.x, r0.yzw\n"
|
---|
260 | "mad r0.xyz, r1.x, r0.xyz, v0.xyz\n"
|
---|
261 | "mov r0.w, c6.x\n"
|
---|
262 | "dp4 oPos.x, c0, r0\n"
|
---|
263 | "dp4 oPos.y, c1, r0\n"
|
---|
264 | "dp4 oPos.z, c2, r0\n"
|
---|
265 | "dp4 oPos.w, c3, r0\n";
|
---|
266 | String ShadowVolumeExtrudeProgram::mDirArbvp1FiniteDebug =
|
---|
267 | "!!ARBvp1.0\n"
|
---|
268 | "PARAM c6 = { 1, 0, 0, 0 };\n"
|
---|
269 | "TEMP R0;\n"
|
---|
270 | "ATTRIB v24 = vertex.texcoord[0];\n"
|
---|
271 | "ATTRIB v16 = vertex.position;\n"
|
---|
272 | "PARAM c0[4] = { program.local[0..3] };\n"
|
---|
273 | "PARAM c4 = program.local[4];\n"
|
---|
274 | "PARAM c5 = program.local[5];\n"
|
---|
275 | "MOV result.color.front.primary, c6.x;\n"
|
---|
276 | "ADD R0.x, c6.x, -v24.x;\n"
|
---|
277 | "MUL R0.x, R0.x, c5.x;\n"
|
---|
278 | "MAD R0.xyz, -R0.x, c4.xyzx, v16.xyzx;\n"
|
---|
279 | "DPH result.position.x, R0.xyzz, c0[0];\n"
|
---|
280 | "DPH result.position.y, R0.xyzz, c0[1];\n"
|
---|
281 | "DPH result.position.z, R0.xyzz, c0[2];\n"
|
---|
282 | "DPH result.position.w, R0.xyzz, c0[3];\n"
|
---|
283 | "END\n";
|
---|
284 | String ShadowVolumeExtrudeProgram::mDirVs_1_1FiniteDebug =
|
---|
285 | "vs_1_1\n"
|
---|
286 | "def c6, 1, 0, 0, 0\n"
|
---|
287 | "dcl_texcoord0 v7\n"
|
---|
288 | "dcl_position v0\n"
|
---|
289 | "mov oD0, c6.x\n"
|
---|
290 | "add r0.x, c6.x, -v7.x\n"
|
---|
291 | "mul r0.x, r0.x, c5.x\n"
|
---|
292 | "mad r0.xyz, -r0.x, c4.xyz, v0.xyz\n"
|
---|
293 | "mov r0.w, c6.x\n"
|
---|
294 | "dp4 oPos.x, c0, r0\n"
|
---|
295 | "dp4 oPos.y, c1, r0\n"
|
---|
296 | "dp4 oPos.z, c2, r0\n"
|
---|
297 | "dp4 oPos.w, c3, r0\n";
|
---|
298 |
|
---|
299 |
|
---|
300 | const String ShadowVolumeExtrudeProgram::programNames[OGRE_NUM_SHADOW_EXTRUDER_PROGRAMS] =
|
---|
301 | {
|
---|
302 | "Ogre/ShadowExtrudePointLight",
|
---|
303 | "Ogre/ShadowExtrudePointLightDebug",
|
---|
304 | "Ogre/ShadowExtrudeDirLight",
|
---|
305 | "Ogre/ShadowExtrudeDirLightDebug",
|
---|
306 | "Ogre/ShadowExtrudePointLightFinite",
|
---|
307 | "Ogre/ShadowExtrudePointLightFiniteDebug",
|
---|
308 | "Ogre/ShadowExtrudeDirLightFinite",
|
---|
309 | "Ogre/ShadowExtrudeDirLightFiniteDebug"
|
---|
310 | };
|
---|
311 |
|
---|
312 | bool ShadowVolumeExtrudeProgram::mInitialised = false;
|
---|
313 | //---------------------------------------------------------------------
|
---|
314 | //---------------------------------------------------------------------
|
---|
315 | void ShadowVolumeExtrudeProgram::initialise(void)
|
---|
316 | {
|
---|
317 | if (!mInitialised)
|
---|
318 | {
|
---|
319 | String syntax;
|
---|
320 | bool vertexProgramFinite[8] =
|
---|
321 | {
|
---|
322 | false, false, false, false,
|
---|
323 | true, true, true, true
|
---|
324 | };
|
---|
325 | bool vertexProgramDebug[8] =
|
---|
326 | {
|
---|
327 | false, true, false, true,
|
---|
328 | false, true, false, true
|
---|
329 | };
|
---|
330 | Light::LightTypes vertexProgramLightTypes[8] =
|
---|
331 | {
|
---|
332 | Light::LT_POINT, Light::LT_POINT,
|
---|
333 | Light::LT_DIRECTIONAL, Light::LT_DIRECTIONAL,
|
---|
334 | Light::LT_POINT, Light::LT_POINT,
|
---|
335 | Light::LT_DIRECTIONAL, Light::LT_DIRECTIONAL
|
---|
336 | };
|
---|
337 |
|
---|
338 | // load hardware extrusion programs for point & dir lights
|
---|
339 | if (GpuProgramManager::getSingleton().isSyntaxSupported("arbvp1"))
|
---|
340 | {
|
---|
341 | // ARBvp1
|
---|
342 | syntax = "arbvp1";
|
---|
343 | }
|
---|
344 | else if (GpuProgramManager::getSingleton().isSyntaxSupported("vs_1_1"))
|
---|
345 | {
|
---|
346 | syntax = "vs_1_1";
|
---|
347 | }
|
---|
348 | else
|
---|
349 | {
|
---|
350 | OGRE_EXCEPT(Exception::ERR_INTERNAL_ERROR,
|
---|
351 | "Vertex programs are supposedly supported, but neither "
|
---|
352 | "arbvp1 nor vs_1_1 syntaxes are present.",
|
---|
353 | "SceneManager::initShadowVolumeMaterials");
|
---|
354 | }
|
---|
355 | // Create all programs
|
---|
356 | for (unsigned short v = 0; v < OGRE_NUM_SHADOW_EXTRUDER_PROGRAMS; ++v)
|
---|
357 | {
|
---|
358 | // Create debug extruders
|
---|
359 | if (GpuProgramManager::getSingleton().getByName(
|
---|
360 | programNames[v]).isNull())
|
---|
361 | {
|
---|
362 | GpuProgramPtr vp =
|
---|
363 | GpuProgramManager::getSingleton().createProgramFromString(
|
---|
364 | programNames[v], ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME,
|
---|
365 | ShadowVolumeExtrudeProgram::getProgramSource(
|
---|
366 | vertexProgramLightTypes[v], syntax,
|
---|
367 | vertexProgramFinite[v], vertexProgramDebug[v]),
|
---|
368 | GPT_VERTEX_PROGRAM, syntax);
|
---|
369 | vp->load();
|
---|
370 | }
|
---|
371 | }
|
---|
372 | mInitialised = true;
|
---|
373 | }
|
---|
374 | }
|
---|
375 | //---------------------------------------------------------------------
|
---|
376 | void ShadowVolumeExtrudeProgram::shutdown(void)
|
---|
377 | {
|
---|
378 | if (mInitialised)
|
---|
379 | {
|
---|
380 | for (unsigned short v = 0; v < OGRE_NUM_SHADOW_EXTRUDER_PROGRAMS; ++v)
|
---|
381 | {
|
---|
382 | // Destroy debug extruders
|
---|
383 | GpuProgramManager::getSingleton().remove(programNames[v]);
|
---|
384 | }
|
---|
385 | mInitialised = false;
|
---|
386 | }
|
---|
387 | }
|
---|
388 | //---------------------------------------------------------------------
|
---|
389 | const String& ShadowVolumeExtrudeProgram::getProgramSource(
|
---|
390 | Light::LightTypes lightType, const String syntax, bool finite, bool debug)
|
---|
391 | {
|
---|
392 | if (lightType == Light::LT_DIRECTIONAL)
|
---|
393 | {
|
---|
394 | if (syntax == "arbvp1")
|
---|
395 | {
|
---|
396 | if (finite)
|
---|
397 | {
|
---|
398 | if (debug)
|
---|
399 | {
|
---|
400 | return getDirectionalLightExtruderArbvp1FiniteDebug();
|
---|
401 | }
|
---|
402 | else
|
---|
403 | {
|
---|
404 | return getDirectionalLightExtruderArbvp1Finite();
|
---|
405 | }
|
---|
406 | }
|
---|
407 | else
|
---|
408 | {
|
---|
409 | if (debug)
|
---|
410 | {
|
---|
411 | return getDirectionalLightExtruderArbvp1Debug();
|
---|
412 | }
|
---|
413 | else
|
---|
414 | {
|
---|
415 | return getDirectionalLightExtruderArbvp1();
|
---|
416 | }
|
---|
417 | }
|
---|
418 | }
|
---|
419 | else
|
---|
420 | {
|
---|
421 | if (finite)
|
---|
422 | {
|
---|
423 | if (debug)
|
---|
424 | {
|
---|
425 | return getDirectionalLightExtruderVs_1_1FiniteDebug();
|
---|
426 | }
|
---|
427 | else
|
---|
428 | {
|
---|
429 | return getDirectionalLightExtruderVs_1_1Finite();
|
---|
430 | }
|
---|
431 | }
|
---|
432 | else
|
---|
433 | {
|
---|
434 | if (debug)
|
---|
435 | {
|
---|
436 | return getDirectionalLightExtruderVs_1_1Debug();
|
---|
437 | }
|
---|
438 | else
|
---|
439 | {
|
---|
440 | return getDirectionalLightExtruderVs_1_1();
|
---|
441 | }
|
---|
442 | }
|
---|
443 | }
|
---|
444 | }
|
---|
445 | else
|
---|
446 | {
|
---|
447 | if (syntax == "arbvp1")
|
---|
448 | {
|
---|
449 | if (finite)
|
---|
450 | {
|
---|
451 | if (debug)
|
---|
452 | {
|
---|
453 | return getPointLightExtruderArbvp1FiniteDebug();
|
---|
454 | }
|
---|
455 | else
|
---|
456 | {
|
---|
457 | return getPointLightExtruderArbvp1Finite();
|
---|
458 | }
|
---|
459 | }
|
---|
460 | else
|
---|
461 | {
|
---|
462 | if (debug)
|
---|
463 | {
|
---|
464 | return getPointLightExtruderArbvp1Debug();
|
---|
465 | }
|
---|
466 | else
|
---|
467 | {
|
---|
468 | return getPointLightExtruderArbvp1();
|
---|
469 | }
|
---|
470 | }
|
---|
471 | }
|
---|
472 | else
|
---|
473 | {
|
---|
474 | if (finite)
|
---|
475 | {
|
---|
476 | if (debug)
|
---|
477 | {
|
---|
478 | return getPointLightExtruderVs_1_1FiniteDebug();
|
---|
479 | }
|
---|
480 | else
|
---|
481 | {
|
---|
482 | return getPointLightExtruderVs_1_1Finite();
|
---|
483 | }
|
---|
484 | }
|
---|
485 | else
|
---|
486 | {
|
---|
487 | if (debug)
|
---|
488 | {
|
---|
489 | return getPointLightExtruderVs_1_1Debug();
|
---|
490 | }
|
---|
491 | else
|
---|
492 | {
|
---|
493 | return getPointLightExtruderVs_1_1();
|
---|
494 | }
|
---|
495 | }
|
---|
496 | }
|
---|
497 | }
|
---|
498 | // to keep compiler happy
|
---|
499 | return StringUtil::BLANK;
|
---|
500 | }
|
---|
501 | //---------------------------------------------------------------------
|
---|
502 | const String& ShadowVolumeExtrudeProgram::getProgramName(
|
---|
503 | Light::LightTypes lightType, bool finite, bool debug)
|
---|
504 | {
|
---|
505 | if (lightType == Light::LT_DIRECTIONAL)
|
---|
506 | {
|
---|
507 | if (finite)
|
---|
508 | {
|
---|
509 | if (debug)
|
---|
510 | {
|
---|
511 | return programNames[DIRECTIONAL_LIGHT_FINITE_DEBUG];
|
---|
512 | }
|
---|
513 | else
|
---|
514 | {
|
---|
515 | return programNames[DIRECTIONAL_LIGHT_FINITE];
|
---|
516 | }
|
---|
517 | }
|
---|
518 | else
|
---|
519 | {
|
---|
520 | if (debug)
|
---|
521 | {
|
---|
522 | return programNames[DIRECTIONAL_LIGHT_DEBUG];
|
---|
523 | }
|
---|
524 | else
|
---|
525 | {
|
---|
526 | return programNames[DIRECTIONAL_LIGHT];
|
---|
527 | }
|
---|
528 | }
|
---|
529 | }
|
---|
530 | else
|
---|
531 | {
|
---|
532 | if (finite)
|
---|
533 | {
|
---|
534 | if (debug)
|
---|
535 | {
|
---|
536 | return programNames[POINT_LIGHT_FINITE_DEBUG];
|
---|
537 | }
|
---|
538 | else
|
---|
539 | {
|
---|
540 | return programNames[POINT_LIGHT_FINITE];
|
---|
541 | }
|
---|
542 | }
|
---|
543 | else
|
---|
544 | {
|
---|
545 | if (debug)
|
---|
546 | {
|
---|
547 | return programNames[POINT_LIGHT_DEBUG];
|
---|
548 | }
|
---|
549 | else
|
---|
550 | {
|
---|
551 | return programNames[POINT_LIGHT];
|
---|
552 | }
|
---|
553 | }
|
---|
554 | }
|
---|
555 | }
|
---|
556 |
|
---|
557 |
|
---|
558 |
|
---|
559 | }
|
---|