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