Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
texproject.cpp
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19/***********************************************************************************************
20 *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
21 ***********************************************************************************************
22 * *
23 * Project Name : WW3D *
24 * *
25 * $Archive:: /Commando/Code/ww3d2/texproject.cpp $*
26 * *
27 * Original Author:: Greg Hjelstrom *
28 * *
29 * $Author:: Kenny Mitchell *
30 * *
31 * $Modtime:: 08/05/02 10:03a $*
32 * *
33 * $Revision:: 22 $*
34 * *
35 * 06/26/02 KM Matrix name change to avoid MAX conflicts *
36 * 06/27/02 KM Render to shadow buffer texture support *
37 * 08/05/02 KM Texture class redesign
38 *---------------------------------------------------------------------------------------------*
39 * Functions: *
40 * TexProjectClass::TexProjectClass -- Constructor *
41 * TexProjectClass::~TexProjectClass -- Destructor *
42 * TexProjectClass::Set_Texture_Size -- Set the size of texture to use *
43 * TexProjectClass::Get_Texture_Size -- Returns the stored texture size *
44 * TexProjectClass::Set_Flag -- Turn specified flag on or off *
45 * TexProjectClass::Get_Flag -- Get the current state of specified flag *
46 * TexProjectClass::Set_Intensity -- Set the intensity of this projector *
47 * TexProjectClass::Get_Intensity -- returns the current "desired" intensity *
48 * TexProjectClass::Set_Attenuation -- Set the attenuation factor *
49 * TexProjectClass::Get_Attenuation -- Returns the attenuation value *
50 * TexProjectClass::Enable_Attenuation -- Set the state of the ATTENUATE flag *
51 * TexProjectClass::Is_Attenuation_Enabled -- Get the state of the ATTENUATE flag *
52 * TexProjectClass::Is_Depth_Gradient_Enabled -- returns whether the depth gradient is enabl *
53 * TexProjectClass::Enable_Depth_Gradient -- enable/disable depth gradient *
54 * TexProjectClass::Init_Multiplicative -- Initialize this to be a multiplicative texture pr *
55 * TexProjectClass::Is_Intensity_Zero -- check if we can eliminate this projector *
56 * TexProjectClass::Init_Additive -- Set up the projector to be additive *
57 * TexProjectClass::Set_Perspective_Projection -- Set up a perspective projection *
58 * TexProjectClass::Set_Ortho_Projection -- Set up an orthographic projection *
59 * TexProjectClass::Set_Texture -- Set the texture to be projected *
60 * TexProjectClass::Get_Texture -- Returns the texture being projected *
61 * TexProjectClass::Peek_Texture -- Returns the texture being projected *
62 * TexProjectClass::Peek_Material_Pass -- Returns the material pass object *
63 * TexProjectClass::Compute_Perspective_Projection -- Set up a perspective projection of an *
64 * TexProjectClass::Compute_Perspective_Projection -- Set up a perspective projection of an *
65 * TexProjectClass::Compute_Ortho_Projection -- Automatic Orthographic projection *
66 * TexProjectClass::Compute_Ortho_Projection -- Automatic Orthographic projection *
67 * TexProjectClass::Compute_Texture -- Generates texture by rendering an object *
68 * TexProjectClass::Configure_Camera -- setup a camera to match this projector *
69 * TexProjectClass::Pre_Render_Update -- Prepare the projector for rendering *
70 * TexProjectClass::Update_WS_Bounding_Volume -- Recalculate the world-space bounding box *
71 * TexProjectClass::Get_Surface -- Returns pointer to the texture surface *
72 * TexProjectClass::Set_Render_Target -- Install a render target for this projector to use *
73 * TexProjectClass::Needs_Render_Target -- returns wheter this projector needs a render targ *
74 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
75
76
77#include "texproject.h"
78#include "vertmaterial.h"
79#include "shader.h"
80#include "texture.h"
81#include "rendobj.h"
82#include "rinfo.h"
83#include "camera.h"
84#include "matpass.h"
85#include "bwrender.h"
86#include "assetmgr.h"
87#include "dx8wrapper.h"
88
89
90// DEBUG DEBUG
91#include "mpu.h"
92
93#define DEBUG_SHADOW_RENDERING 0
94//#define DEFAULT_TEXTURE_SIZE 64
95
96const float INTENSITY_RATE_OF_CHANGE = 1.0f; // change in intensity per second
97
98
99/*
100**
101** Shadow mapping: from pre-projected view coordinates back to world space
102** then to shadow space
103**
104** (1) Vshadow = PShadow * Mwrld-shadow * Vwrld
105**
106** (2) Vview = Mwrld-camera * Vwrld
107**
108** Using (2) to solve for Vwrld in terms of Vview
109** -1
110** (3) Mwrld-camera * Vview = Vwrld
111**
112** Substituting (3) into (1)
113** -1
114** (4) Vshadow = Pshadow * Mwrld-shadow * Mwrld-camera * Vview
115**
116** ---------------------------------------------------------------------------------
117**
118** Shadow mapping: from pre-projected view space to world space, to shadow space,
119** then projecting.
120**
121** (1) Vshadow = Mwrld-shadow * Vwrld
122**
123** (2) Vview = Mwrld-camera * Vwrld
124**
125** solving (2) for Vwrld:
126** -1
127** (3) Mwrld-camera * Vview = Vwrld
128**
129** substitute into (1)
130** -1
131** (4) Vshadow = Mwrld-shadow * Mwrld-camera * Vview
132**
133** project shadow
134** -1
135** (5) Vproj-shadow = Pshadow * (Mwrld-shadow * Mwrld-camera ) * Vview
136**
137** aaah! same thing :-)
138**
139** ---------------------------------------------------------------------------------
140**
141** Shadow mapping: from pre-projected view coordinates back to obj space
142** then to shadow space
143**
144** (1) Vshadow = PShadow * Mwrld-shadow * Mobj-wrld * Vobj
145**
146** (2) Vview = Mwrld-camera * Mobj-wrld * Vobj
147** -1 -1
148** (3) Mobj-wrld * Mwrld-camera * Vview = Vobj
149** -1 -1
150** (4) Vshadow = PShadow * Mwrld-shadow * Mobj-wrld * Mobj-wrld * Mwrld-camera * Vview
151** -1
152** (5) Vshadow = PShadow * Mwrld-shadow * Mvrld-camera * Vview
153**
154**
155** Ideas:
156** - Use Texture Projectors to implement spot lights and stained glass windows
157** - Attenuate texture projections with distance from the projector
158** - Should be able to handle lots of pre-calculated static texture projectors. They
159** should cull well and we can pre-generate the textures.
160**
161** Ideas maybe used in conjunction with texture projections:
162** - Light volumes: the problem is when the volume is cliped it looks funny, we can
163** fill in the clipped face of a non-translucent object by rendering the backfaces
164** - Use the backface-fill to make the camera slicing through the commando look like
165** its *really* slicing through the commando :-)
166** - The back-face-fill trick might be able to use el-cheapo screen mapping!
167**
168*/
169
170
171
172/***********************************************************************************************
173 * TexProjectClass::TexProjectClass -- Constructor *
174 * *
175 * INPUT: *
176 * *
177 * OUTPUT: *
178 * *
179 * WARNINGS: *
180 * *
181 * HISTORY: *
182 * 1/4/00 gth : Created. *
183 *=============================================================================================*/
186 DesiredIntensity(1.0f),
187 Intensity(1.0f),
188 Attenuation(1.0f),
190 Mapper1(NULL),
193 HFov(90.0f),
194 VFov(90.0f),
195 XMin(-10.0f),
196 XMax(10.0f),
197 YMin(-10.0f),
198 YMax(10.0f),
199 ZNear(1.0f),
200 ZFar(1000.0f)
201{
202 // create a material pass class
204 MaterialPass->Set_Cull_Volume(&WorldBoundingVolume);
205
206 // create a vertex material
208 WWASSERT(vmtl != NULL);
209
210 // Plug our parent's mapper into our vertex material
211 // the mapper for stage1 will be allocated as needed
212 vmtl->Set_Mapper(Mapper);
213
214 MaterialPass->Set_Material(vmtl);
215 vmtl->Release_Ref();
216 vmtl = NULL;
217
218 // by default init our material pass to be multiplicative (shadow)
220}
221
222
223/***********************************************************************************************
224 * TexProjectClass::~TexProjectClass -- Destructor *
225 * *
226 * INPUT: *
227 * *
228 * OUTPUT: *
229 * *
230 * WARNINGS: *
231 * *
232 * HISTORY: *
233 * 1/4/00 gth : Created. *
234 *=============================================================================================*/
242
243
244/***********************************************************************************************
245 * TexProjectClass::Set_Texture_Size -- Set the size of texture to use *
246 * *
247 * This function stores the desired texture size in this TexProjectClass. Note that *
248 * this size is only used if you have the TexProjectClass generate a texture. *
249 * *
250 * INPUT: *
251 * size - dimension of the texture in pixels *
252 * *
253 * OUTPUT: *
254 * *
255 * WARNINGS: *
256 * *
257 * HISTORY: *
258 * 1/4/00 gth : Created. *
259 *=============================================================================================*/
261{
262 WWASSERT(size > 0);
263 WWASSERT(size <= 512);
264 Flags &= ~SIZE_MASK;
265 Flags |= (size << SIZE_SHIFT);
266}
267
268
269/***********************************************************************************************
270 * TexProjectClass::Get_Texture_Size -- Returns the stored texture size *
271 * *
272 * Returns the size stored in the flags variable. This can be different than the actual *
273 * texture's size if you manually installed a texture. This size is only used when *
274 * automatically generating a texture as is the case when creating shadows. *
275 * *
276 * INPUT: *
277 * *
278 * OUTPUT: *
279 * *
280 * WARNINGS: *
281 * *
282 * HISTORY: *
283 * 1/4/00 gth : Created. *
284 *=============================================================================================*/
286{
287 return (Flags & SIZE_MASK) >> SIZE_SHIFT;
288}
289
290
291/***********************************************************************************************
292 * TexProjectClass::Set_Flag -- Turn specified flag on or off *
293 * *
294 * See the TexProjectClass header file for valid flags *
295 * *
296 * INPUT: *
297 * *
298 * OUTPUT: *
299 * *
300 * WARNINGS: *
301 * *
302 * HISTORY: *
303 * 1/4/00 gth : Created. *
304 *=============================================================================================*/
306{
307 if (onoff) {
308 Flags |= flag;
309 } else {
310 Flags &= ~flag;
311 }
312}
313
314
315/***********************************************************************************************
316 * TexProjectClass::Get_Flag -- Get the current state of specified flag *
317 * *
318 * See the TexProjectClass header file for valid flags *
319 * *
320 * INPUT: *
321 * *
322 * OUTPUT: *
323 * *
324 * WARNINGS: *
325 * *
326 * HISTORY: *
327 * 1/4/00 gth : Created. *
328 *=============================================================================================*/
330{
331 return (Flags & flag) == flag;
332}
333
334
335/***********************************************************************************************
336 * TexProjectClass::Set_Intensity -- Set the intensity of this projector *
337 * *
338 * The "intensity" is a value between 0 and 1. At 0, the projector will have no effect *
339 * At 1, the projector will be at its highest strength. The intensity will automatically *
340 * smoothly interpolate towards the value specified unless you use the immediate option. *
341 * *
342 * INPUT: *
343 * intensity - desired intensity, 0 <= intensity <= 1 *
344 * immediate - should the intensity be immediately set to the desired value? (default = false) *
345 * *
346 * OUTPUT: *
347 * *
348 * WARNINGS: *
349 * *
350 * HISTORY: *
351 * 1/4/00 gth : Created. *
352 *=============================================================================================*/
353void TexProjectClass::Set_Intensity(float intensity,bool immediate)
354{
355 WWASSERT(intensity <= 1.0f);
356 WWASSERT(intensity >= 0.0f);
357
358 DesiredIntensity = intensity;
359 if (immediate) {
361 }
362}
363
364
365/***********************************************************************************************
366 * TexProjectClass::Get_Intensity -- returns the current "desired" intensity *
367 * *
368 * This will return the last value that was sent into this object through Set_Intensity. *
369 * Note however that the actual intensity used in rendering may not have arrived at *
370 * that value yet. *
371 * *
372 * INPUT: *
373 * *
374 * OUTPUT: *
375 * *
376 * WARNINGS: *
377 * *
378 * HISTORY: *
379 * 1/4/00 gth : Created. *
380 *=============================================================================================*/
382{
383 return DesiredIntensity;
384}
385
386
387/***********************************************************************************************
388 * TexProjectClass::Is_Intensity_Zero -- check if we can eliminate this projector *
389 * *
390 * Only returns true if the current intensity is zero AND the target intensity is zero *
391 * *
392 * INPUT: *
393 * *
394 * OUTPUT: *
395 * *
396 * WARNINGS: *
397 * *
398 * HISTORY: *
399 * 1/4/00 gth : Created. *
400 *=============================================================================================*/
402{
403 return ((Intensity == 0.0f) && (DesiredIntensity == 0.0f));
404}
405
406
407/***********************************************************************************************
408 * TexProjectClass::Set_Attenuation -- Set the attenuation factor *
409 * *
410 * Attenuation scales the intensity. I use attenuation to make shadows fade away as they *
411 * get farther away from the light source or from the viewer. *
412 * *
413 * INPUT: *
414 * *
415 * OUTPUT: *
416 * *
417 * WARNINGS: *
418 * *
419 * HISTORY: *
420 * 1/4/00 gth : Created. *
421 *=============================================================================================*/
422void TexProjectClass::Set_Attenuation(float attenuation)
423{
424 WWASSERT(attenuation >= 0.0f);
425 WWASSERT(attenuation <= 1.0f);
426 Attenuation = attenuation;
427}
428
429
430/***********************************************************************************************
431 * TexProjectClass::Get_Attenuation -- Returns the attenuation value *
432 * *
433 * INPUT: *
434 * *
435 * OUTPUT: *
436 * *
437 * WARNINGS: *
438 * *
439 * HISTORY: *
440 * 1/4/00 gth : Created. *
441 *=============================================================================================*/
443{
444 return Attenuation;
445}
446
447
448/***********************************************************************************************
449 * TexProjectClass::Enable_Attenuation -- Set the state of the ATTENUATE flag *
450 * *
451 * INPUT: *
452 * *
453 * OUTPUT: *
454 * *
455 * WARNINGS: *
456 * *
457 * HISTORY: *
458 * 1/4/00 gth : Created. *
459 *=============================================================================================*/
461{
462 Set_Flag(ATTENUATE,onoff);
463}
464
465
466/***********************************************************************************************
467 * TexProjectClass::Is_Attenuation_Enabled -- Get the state of the ATTENUATE flag *
468 * *
469 * INPUT: *
470 * *
471 * OUTPUT: *
472 * *
473 * WARNINGS: *
474 * *
475 * HISTORY: *
476 * 1/4/00 gth : Created. *
477 *=============================================================================================*/
482
483
484/***********************************************************************************************
485 * TexProjectClass::Enable_Depth_Gradient -- enable/disable depth gradient *
486 * *
487 * INPUT: *
488 * *
489 * OUTPUT: *
490 * *
491 * WARNINGS: *
492 * *
493 * HISTORY: *
494 * 2/25/2000 gth : Created. *
495 *=============================================================================================*/
497{
499
500 // re-setup the shader settings
501 if (Get_Flag(ADDITIVE)) {
503 } else {
505 }
506}
507
508
509/***********************************************************************************************
510 * TexProjectClass::Is_Depth_Gradient_Enabled -- returns whether the depth gradient is enabled *
511 * *
512 * INPUT: *
513 * *
514 * OUTPUT: *
515 * *
516 * WARNINGS: *
517 * *
518 * HISTORY: *
519 * 2/25/2000 gth : Created. *
520 *=============================================================================================*/
525
526/***********************************************************************************************
527 * TexProjectClass::Init_Multiplicative -- Initialize this to be a multiplicative texture proj *
528 * *
529 * Set up the internal materials so that the texture is multiplied with whatever it is *
530 * projected onto. *
531 * *
532 * INPUT: *
533 * *
534 * OUTPUT: *
535 * *
536 * WARNINGS: *
537 * *
538 * HISTORY: *
539 * 1/4/00 gth : Created. *
540 *=============================================================================================*/
542{
543 Set_Flag(ADDITIVE,false);
544
545 /*
546 ** Set up the shader
547 */
548 static ShaderClass mult_shader( SHADE_CNST( ShaderClass::PASS_LEQUAL, //depth_compare,
550 ShaderClass::COLOR_WRITE_ENABLE, //color_mask,
551 ShaderClass::SRCBLEND_ZERO, //src_blend,
554 ShaderClass::GRADIENT_ADD, //pri_grad,
557
558 ShaderClass::ALPHATEST_DISABLE, //alpha_test,
560 0, //post_det_color,
561 0) ); //post_det_alpha
562
563 if (WW3DAssetManager::Get_Instance()->Get_Activate_Fog_On_Load()) {
564 mult_shader.Enable_Fog ("TexProjectClass");
565 }
566
568
569 /*
570 ** enable multi-texturing
571 */
573
574 /*
575 ** plug the gradient texture into the second stage
576 */
577 TextureClass * grad_tex = WW3DAssetManager::Get_Instance()->Get_Texture("MultProjectorGradient.tga");
578 if (grad_tex) {
581 MaterialPass->Set_Texture(grad_tex,1);
582 grad_tex->Release_Ref();
583 } else {
584 WWDEBUG_SAY(("Could not find texture: MultProjectorGradient.tga!\n"));
585 }
586
587 } else {
588
589 /*
590 ** disable multi-texturing
591 */
593
594 /*
595 ** remove the texture from the second stage
596 */
597 MaterialPass->Set_Texture(NULL,1);
598 }
599
600#if (DEBUG_SHADOW_RENDERING)
601 // invert the shader so we can see what polygons it is hitting
604#endif
605
606 MaterialPass->Set_Shader(mult_shader);
607
608 /*
609 ** Set up the Vertex Material parameters
610 */
611 VertexMaterialClass * vmtl = MaterialPass->Peek_Material();
612 vmtl->Set_Ambient(0,0,0);
613 vmtl->Set_Diffuse(0,0,0);
614 vmtl->Set_Specular(0,0,0);
615 vmtl->Set_Emissive(0.0f,0.0f,0.0f);
616 vmtl->Set_Opacity(1.0f);
617 vmtl->Set_Lighting(true); // I need the emissive value to scale the intensity of the shadow
618
619 /*
620 ** Set up some mapper settings related to depth gradient
621 */
623 if (Mapper1 == NULL) {
625 }
627 vmtl->Set_Mapper(Mapper1,1);
628 } else {
629 vmtl->Set_Mapper(NULL,1);
630 }
631}
632
633
634/***********************************************************************************************
635 * TexProjectClass::Init_Additive -- Set up the projector to be additive *
636 * *
637 * INPUT: *
638 * *
639 * OUTPUT: *
640 * *
641 * WARNINGS: *
642 * *
643 * HISTORY: *
644 * 1/11/00 gth : Created. *
645 *=============================================================================================*/
647{
648 Set_Flag(ADDITIVE,true);
649
650 /*
651 ** Set up the shader
652 */
653 static ShaderClass add_shader( SHADE_CNST( ShaderClass::PASS_LEQUAL, //depth_compare,
655 ShaderClass::COLOR_WRITE_ENABLE, //color_mask,
656 ShaderClass::SRCBLEND_ONE, //src_blend,
657 ShaderClass::DSTBLEND_ONE, //dst_blend,
662 ShaderClass::ALPHATEST_DISABLE, //alpha_test,
664 ShaderClass::DETAILCOLOR_DISABLE, //post_det_color,
665 ShaderClass::DETAILALPHA_DISABLE) ); //post_det_alpha
666
667 if (WW3DAssetManager::Get_Instance()->Get_Activate_Fog_On_Load()) {
668 add_shader.Enable_Fog ("TexProjectClass");
669 }
670
671 /*
672 ** Additive projectors always use the normal gradient so they need multi-texturing
673 */
675
676 /*
677 ** plug in the gradient texture
678 */
679 TextureClass * grad_tex = WW3DAssetManager::Get_Instance()->Get_Texture("AddProjectorGradient.tga");
680 if (grad_tex) {
683 MaterialPass->Set_Texture(grad_tex,1);
684 grad_tex->Release_Ref();
685 } else {
686 WWDEBUG_SAY(("Could not find texture: AddProjectorGradient.tga!\n"));
687 }
688
689#if (DEBUG_SHADOW_RENDERING)
690 // invert the shader so we can see what polygons it is hitting
693#endif
694
695 MaterialPass->Set_Shader(add_shader);
696
697 /*
698 ** Set up the Vertex Material parameters
699 */
700 VertexMaterialClass * vmtl = MaterialPass->Peek_Material();
701 vmtl->Set_Ambient(0,0,0);
702 vmtl->Set_Diffuse(0,0,0);
703 vmtl->Set_Specular(0,0,0);
704 vmtl->Set_Emissive(1,1,1);
705 vmtl->Set_Opacity(1.0f);
706 vmtl->Set_Lighting(true); //need emissive to scale the intensity of the projector
707
708 /*
709 ** Set up some mapper settings related to depth gradient
710 ** Additive texture projections always use the normal gradient
711 */
712 if (Mapper1 == NULL) {
714 }
716 vmtl->Set_Mapper(Mapper1,1);
717}
718
719
720/***********************************************************************************************
721 * TexProjectClass::Set_Texture -- Set the texture to be projected *
722 * *
723 * INPUT: *
724 * *
725 * OUTPUT: *
726 * *
727 * WARNINGS: *
728 * *
729 * HISTORY: *
730 * 1/11/00 gth : Created. *
731 *=============================================================================================*/
733{
734 if (texture != NULL)
735 {
738 MaterialPass->Set_Texture(texture);
739 }
740}
741
742
743/***********************************************************************************************
744 * TexProjectClass::Get_Texture -- Returns the texture being projected *
745 * *
746 * INPUT: *
747 * *
748 * OUTPUT: *
749 * *
750 * WARNINGS: *
751 * the pointer is ref-counted! make sure to keep track of your references *
752 * *
753 * HISTORY: *
754 * 1/11/00 gth : Created. *
755 *=============================================================================================*/
757{
758 return MaterialPass->Get_Texture();
759}
760
761
762/***********************************************************************************************
763 * TexProjectClass::Peek_Texture -- Returns the texture being projected *
764 * *
765 * INPUT: *
766 * *
767 * OUTPUT: *
768 * *
769 * WARNINGS: *
770 * *
771 * HISTORY: *
772 * 1/11/00 gth : Created. *
773 *=============================================================================================*/
775{
776 return MaterialPass->Peek_Texture();
777}
778
779
780/***********************************************************************************************
781 * TexProjectClass::Peek_Material_Pass -- Returns the material pass object *
782 * *
783 * INPUT: *
784 * *
785 * OUTPUT: *
786 * *
787 * WARNINGS: *
788 * *
789 * HISTORY: *
790 * 1/11/00 gth : Created. *
791 *=============================================================================================*/
796
797
798/***********************************************************************************************
799 * TexProjectClass::Set_Perspective_Projection -- set up a perspective projection *
800 * *
801 * INPUT: *
802 * *
803 * OUTPUT: *
804 * *
805 * WARNINGS: *
806 * *
807 * HISTORY: *
808 * 1/27/00 gth : Created. *
809 *=============================================================================================*/
810void TexProjectClass::Set_Perspective_Projection(float hfov,float vfov,float znear,float zfar)
811{
812 HFov = hfov;
813 VFov = vfov;
814 ZNear = znear;
815 ZFar = zfar;
816
817 ProjectorClass::Set_Perspective_Projection(hfov,vfov,znear,zfar);
818 Set_Flag(PERSPECTIVE,true);
819}
820
821
822/***********************************************************************************************
823 * TexProjectClass::Set_Ortho_Projection -- set up an orthographic projection *
824 * *
825 * INPUT: *
826 * *
827 * OUTPUT: *
828 * *
829 * WARNINGS: *
830 * *
831 * HISTORY: *
832 * 1/27/00 gth : Created. *
833 *=============================================================================================*/
834void TexProjectClass::Set_Ortho_Projection(float xmin,float xmax,float ymin,float ymax,float znear,float zfar)
835{
836 XMin = xmin;
837 XMax = xmax;
838 YMin = ymin;
839 YMax = ymax;
840 ZNear = znear;
841 ZFar = zfar;
842
843 ProjectorClass::Set_Ortho_Projection(xmin,xmax,ymin,ymax,znear,zfar);
844 Set_Flag(PERSPECTIVE,false);
845}
846
847/***********************************************************************************************
848 * TexProjectClass::Compute_Perspective_Projection -- Set up a perspective projection of an ob *
849 * *
850 * This function automates the process of generating the perspective parameters needed to *
851 * tightly bound the projection of an object. *
852 * *
853 * INPUT: *
854 * model - object which we are created a projection of *
855 * lightpos - positional light source *
856 * znear - distance to near clipping plane for the projection (if -1.0, will be generated) *
857 * zfar - distance to far clipping plane for the projection (if -1.0, will be generated) *
858 * *
859 * OUTPUT: *
860 * *
861 * WARNINGS: *
862 * *
863 * HISTORY: *
864 * 1/11/00 gth : Created. *
865 *=============================================================================================*/
867(
868 RenderObjClass * model,
869 const Vector3 & lightpos,
870 float znear,
871 float zfar
872)
873{
874 if (model == NULL) {
875 WWDEBUG_SAY(("Attempting to generate projection for a NULL model\r\n"));
876 return false;
877 }
878
879 AABoxClass box;
880 model->Get_Obj_Space_Bounding_Box(box);
881 const Matrix3D & tm = model->Get_Transform();
882
883 return Compute_Perspective_Projection(box,tm,lightpos,znear,zfar);
884}
885
886
887/***********************************************************************************************
888 * TexProjectClass::Compute_Perspective_Projection -- Set up a perspective projection of an ob *
889 * *
890 * This function automates the process of generating the perspective parameters needed to *
891 * tightly bound the projection of an object. *
892 * *
893 * INPUT: *
894 * obj_box - object space bounding box of the object we are projecting *
895 * tm - transform of the object we are projecting *
896 * lightpos - positional light source *
897 * user_znear - distance to near clipping plane for the projection (if -1.0, will be generated)*
898 * user_zfar - distance to far clipping plane for the projection (if -1.0, will be generated) *
899 * *
900 * OUTPUT: *
901 * *
902 * WARNINGS: *
903 * *
904 * HISTORY: *
905 * 1/11/00 gth : Created. *
906 *=============================================================================================*/
908(
909 const AABoxClass & obj_box,
910 const Matrix3D & tm,
911 const Vector3 & lightpos,
912 float user_znear,
913 float user_zfar
914)
915{
916 /*
917 ** Compute the center of the box in world-space
918 */
919 Vector3 wrld_center;
920 Matrix3D::Transform_Vector(tm,obj_box.Center,&wrld_center);
921
922 /*
923 ** Create a camera transform looking at the object.
924 ** Set this as our transform later in this routine.
925 */
926 Matrix3D texture_tm,texture_tm_inv;
927 texture_tm.Look_At(lightpos,wrld_center,0.0f);
928 texture_tm.Get_Orthogonal_Inverse(texture_tm_inv);
929
930 /*
931 ** Calculate the axis-aligned bounding box of the model in the camera's coordinate system.
932 */
933 AABoxClass box = obj_box;
934 Matrix3D obj_to_world = tm;
935 Matrix3D obj_to_texture;
936 Matrix3D::Multiply(texture_tm_inv,obj_to_world,&obj_to_texture);
937 box.Transform(obj_to_texture);
938
939 /*
940 ** If the box is behind the viewpoint or the viewpoint is inside the box
941 ** our FOV will be > 180 degrees. Have to give up
942 */
943 if ((box.Center.Z > 0.0f) || (box.Extent.Z > WWMath::Fabs(box.Center.Z))) {
944 return false;
945 }
946
947 /*
948 ** Compute the frustum parameters. Remember that our z coordinates are negative but the
949 ** projection code needs positive z distances.
950 */
951 float znear = -box.Center.Z; //-(box.Center.Z + obj_box.Extent.Quick_Length());
952 float zfar = -(box.Center.Z - obj_box.Extent.Quick_Length()) * 2.0f;
953
954 if (user_znear != -1.0f) {
955 znear = box.Center.Z + user_znear;
956 }
957 if (user_zfar != -1.0f) {
958 zfar = box.Center.Z + user_zfar;
959 }
960
961 float tan_hfov2 = WWMath::Fabs(box.Extent.X / (box.Center.Z + box.Extent.Z));
962 float tan_vfov2 = WWMath::Fabs(box.Extent.Y / (box.Center.Z + box.Extent.Z));
963 float hfov = 2.0f * WWMath::Atan(tan_hfov2);
964 float vfov = 2.0f * WWMath::Atan(tan_vfov2);
965
966 /*
967 ** Plug in the results.
968 */
969 Set_Perspective_Projection(hfov,vfov,znear,zfar);
970 Set_Transform(texture_tm);
971 return true;
972}
973
974
975/***********************************************************************************************
976 * TexProjectClass::Compute_Ortho_Projection -- Automatic Orthographic projection *
977 * *
978 * Generates the orthographic projection parameters to tightly bound an object *
979 * *
980 * INPUT: *
981 * model - object which we are created a projection of *
982 * lightdir - directional light source *
983 * znear - distance to near clipping plane for the projection (if -1.0, will be generated) *
984 * zfar - distance to far clipping plane for the projection (if -1.0, will be generated) *
985 * *
986 * OUTPUT: *
987 * *
988 * WARNINGS: *
989 * *
990 * HISTORY: *
991 * 1/11/00 gth : Created. *
992 *=============================================================================================*/
994(
995 RenderObjClass * model,
996 const Vector3 & lightdir,
997 float znear,
998 float zfar
999)
1000{
1001 if (model == NULL) {
1002 WWDEBUG_SAY(("Attempting to generate projection for a NULL model\r\n"));
1003 return false;
1004 }
1005
1006 AABoxClass box;
1007 model->Get_Obj_Space_Bounding_Box(box);
1008 const Matrix3D & tm = model->Get_Transform();
1009
1010 return Compute_Ortho_Projection(box,tm,lightdir,znear,zfar);
1011}
1012
1013
1014/***********************************************************************************************
1015 * TexProjectClass::Compute_Ortho_Projection -- Automatic Orthographic projection *
1016 * *
1017 * Generates the orthographic projection parameters to tightly bound an object *
1018 * *
1019 * INPUT: *
1020 * obj_box - object space bounding box of the object we are projecting *
1021 * tm - transform of the object we are projecting *
1022 * lightdir - directional light *
1023 * user_znear - distance to near clipping plane for the projection (if -1.0, will be generated)*
1024 * user_zfar - distance to far clipping plane for the projection (if -1.0, will be generated) *
1025 * *
1026 * OUTPUT: *
1027 * *
1028 * WARNINGS: *
1029 * *
1030 * HISTORY: *
1031 * 1/11/00 gth : Created. *
1032 *=============================================================================================*/
1034(
1035 const AABoxClass & obj_box,
1036 const Matrix3D & tm,
1037 const Vector3 & lightdir,
1038 float user_znear,
1039 float user_zfar
1040)
1041{
1042 /*
1043 ** Compute the center of the box in world-space
1044 */
1045 AABoxClass wrldbox = obj_box;
1046 wrldbox.Transform(tm);
1047
1048 /*
1049 ** Create a camera transform looking at the object.
1050 ** Set this as our transform later in this routine.
1051 */
1052 Vector3 camera_target = wrldbox.Center;
1053 Vector3 camera_position = camera_target - 2.0f * wrldbox.Extent.Length() * lightdir;
1054
1055 Matrix3D texture_tm,texture_tm_inv;
1056 texture_tm.Look_At(camera_position,camera_target,0.0f);
1057 texture_tm.Get_Orthogonal_Inverse(texture_tm_inv);
1058
1059 /*
1060 ** Calculate the axis-aligned bounding box of the model in the camera's coordinate system.
1061 */
1062 AABoxClass box = obj_box;
1063 Matrix3D obj_to_world = tm;
1064 Matrix3D obj_to_texture;
1065 Matrix3D::Multiply(texture_tm_inv,obj_to_world,&obj_to_texture);
1066 box.Transform(obj_to_texture);
1067
1068 /*
1069 ** Expand the box to help with bounding box errors
1070 */
1071 box.Extent *= 1.0f;
1072
1073 /*
1074 ** Compute the frustum parameters. Note that znear and zfar are supposed to
1075 ** be positive distances for the projection code.
1076 */
1077 float znear = -box.Center.Z; //-(box.Center.Z + obj_box.Extent.Quick_Length());
1078 float zfar = -(box.Center.Z - obj_box.Extent.Quick_Length()) * 2.0f;
1079
1080 if (user_znear != -1.0f) {
1081 znear = -box.Center.Z + user_znear;
1082 }
1083 if (user_zfar != -1.0f) {
1084 zfar = -box.Center.Z + user_zfar;
1085 }
1086
1087 /*
1088 ** All done!
1089 */
1091 box.Center.X + box.Extent.X,
1092 box.Center.Y - box.Extent.Y,
1093 box.Center.Y + box.Extent.Y,
1094 znear,
1095 zfar );
1096 Set_Transform(texture_tm);
1097 return true;
1098}
1099
1100/***********************************************************************************************
1101 * TexProjectClass::Compute_Texture -- Generates texture by rendering an object *
1102 * *
1103 * INPUT: *
1104 * model - pointer to the render object to generate a shadow texture for *
1105 * context - shadow render context which has been initialized to <TextureSize> resolution *
1106 * *
1107 * OUTPUT: *
1108 * *
1109 * WARNINGS: *
1110 * *
1111 * HISTORY: *
1112 * 1/11/00 gth : Created. *
1113 * 5/16/02 kjm : Added optional custom depth/stencil target *
1114 *=============================================================================================*/
1116(
1117 RenderObjClass * model,
1118 SpecialRenderInfoClass * context
1119)
1120{
1121 if ((model == NULL) || (context == NULL))
1122 {
1123 return false;
1124 }
1125 /*
1126 ** Render to texture
1127 */
1128 TextureClass * rtarget=NULL;
1129 ZTextureClass* ztarget=NULL;
1130
1131 Peek_Render_Target(&rtarget,&ztarget);
1132
1133 if (rtarget != NULL)
1134 {
1135 // set projector for render context KJM
1136 context->Texture_Projector=this;
1137
1138 /*
1139 ** Set the render target
1140 */
1141 DX8Wrapper::Set_Render_Target_With_Z (rtarget,ztarget);
1142
1143 /*
1144 ** Set up the camera
1145 */
1146 Configure_Camera(context->Camera);
1147
1148 /*
1149 ** Render the object
1150 */
1151 Vector3 color(0.0f,0.0f,0.0f);
1152 if (Get_Flag(ADDITIVE) == false) {
1153 color.Set(1.0f,1.0f,1.0f);
1154 }
1155
1156 bool zclear=ztarget!=NULL;
1157
1158 bool snapshot=WW3D::Is_Snapshot_Activated();
1159 SNAPSHOT_SAY(("TexProjectCLass::Begin_Render()\n"));
1160 WW3D::Begin_Render(true,zclear,color); // false to zclear as we don't have z-buffer
1161 WW3D::Render(*model,*context);
1162 SNAPSHOT_SAY(("TexProjectCLass::End_Render()\n"));
1163 WW3D::End_Render(false);
1164 WW3D::Activate_Snapshot(snapshot); // End_Render() ends the shapsnot, so restore the state
1165
1166 DX8Wrapper::Set_Render_Target((IDirect3DSurface8 *)NULL);
1167
1168 }
1169
1170#if 0
1171
1172 /*
1173 ** Render the object with the BW Renderer into our color surface
1174 */
1175 BWRenderClass bwr((unsigned char*)shadow_surface->getDataPtr(),tex_size);
1176 bwr.Fill(0xff);
1177 context->BWRenderer = &bwr;
1178 model->Special_Render(*context);
1179 context->BWRenderer = NULL;
1180#endif
1181 return true;
1182}
1183
1184
1185/***********************************************************************************************
1186 * TexProjectClass::Needs_Render_Target -- returns wheter this projector needs a render target *
1187 * *
1188 * INPUT: *
1189 * *
1190 * OUTPUT: *
1191 * *
1192 * WARNINGS: *
1193 * *
1194 * HISTORY: *
1195 * 4/17/2001 gth : Created. *
1196 *=============================================================================================*/
1201
1202
1203/***********************************************************************************************
1204 * TexProjectClass::Set_Render_Target -- Install a render target for this projector to use *
1205 * *
1206 * INPUT: *
1207 * *
1208 * OUTPUT: *
1209 * *
1210 * WARNINGS: *
1211 * *
1212 * HISTORY: *
1213 * 4/16/2001 gth : Created. *
1214 *=============================================================================================*/
1216(
1217 TextureClass* render_target,
1218 ZTextureClass* zbuffer
1219)
1220{
1221 REF_PTR_SET(RenderTarget,render_target);
1224}
1225
1226/***********************************************************************************************
1227 * TexProjectClass::Peek_Render_Target -- Returns pointer to the render target if we have one *
1228 * *
1229 * INPUT: *
1230 * *
1231 * OUTPUT: *
1232 * *
1233 * WARNINGS: *
1234 * *
1235 * HISTORY: *
1236 * 4/5/2001 gth : Created. *
1237 * 5/16/2002 kjm : Added optional custom zbuffer *
1238 *=============================================================================================*/
1240(
1241 TextureClass** rtarget,
1242 ZTextureClass** ztarget
1243)
1244{
1245 // some uses of this function just want to know if a render target exists
1246 if (rtarget==NULL) return RenderTarget;
1247
1248 *rtarget=RenderTarget;
1249
1250 // don't set if pointer isn't supplied
1251 if (ztarget!=NULL)
1252 *ztarget=DepthStencilTarget;
1253
1254 return RenderTarget;
1255}
1256
1257/***********************************************************************************************
1258 * TexProjectClass::Configure_Camera -- set up a camera to match this projector *
1259 * *
1260 * INPUT: *
1261 * *
1262 * OUTPUT: *
1263 * *
1264 * WARNINGS: *
1265 * *
1266 * HISTORY: *
1267 * 1/11/00 gth : Created. *
1268 *=============================================================================================*/
1270{
1271 camera.Set_Transform(Transform);
1272 camera.Set_Clip_Planes(0.01f,ZFar);
1273
1274 if (Get_Flag(PERSPECTIVE)) {
1276 camera.Set_View_Plane(HFov,VFov);
1277
1278 } else {
1281 }
1282
1283 // Set one-pixel borders to the texture to avoid "flooding" shadows...
1284 float size=Get_Texture_Size();
1285 float inv_size=1.0f/size;
1286 Vector2 vmin(1.0f*inv_size,1.0f*inv_size);
1287 Vector2 vmax((size-1.0f)*inv_size,(size-1.0f)*inv_size);
1288 camera.Set_Viewport(vmin,vmax);
1289}
1290
1291
1292/***********************************************************************************************
1293 * TexProjectClass::Pre_Render_Update -- Prepare the projector for rendering *
1294 * *
1295 * INPUT: *
1296 * *
1297 * OUTPUT: *
1298 * *
1299 * WARNINGS: *
1300 * *
1301 * HISTORY: *
1302 * 1/11/00 gth : Created. *
1303 *=============================================================================================*/
1305{
1306 /*
1307 ** Mview-texture = PShadow * Mwrld-texture * Mcamera-vrld
1308 */
1309 Matrix3D world_to_texture;
1310 Matrix3D tmp;
1311 Matrix4x4 view_to_texture;
1312
1313 Transform.Get_Orthogonal_Inverse(world_to_texture);
1314 Matrix3D::Multiply(world_to_texture,camera,&tmp);
1315 Matrix4x4::Multiply(Projection,tmp,&view_to_texture);
1316
1317 /*
1318 ** update the current intensity by iterating it towards the desired intensity
1319 */
1320 float frame_time = (float)WW3D::Get_Frame_Time() / 1000.0f;
1321 float intensity_delta = DesiredIntensity - Intensity;
1322 float max_intensity_delta = INTENSITY_RATE_OF_CHANGE * frame_time;
1323
1324 if (intensity_delta > max_intensity_delta) {
1325 Intensity += max_intensity_delta;
1326 } else if (intensity_delta < -max_intensity_delta) {
1327 Intensity -= max_intensity_delta;
1328 } else {
1330 }
1331
1332 float actual_intensity = Intensity * Attenuation;
1333
1334 /*
1335 ** install the current intensity
1336 */
1337 VertexMaterialClass * vmat = MaterialPass->Peek_Material();
1338 if (Get_Flag(ADDITIVE)) {
1339 vmat->Set_Emissive(actual_intensity,actual_intensity,actual_intensity);
1340 } else {
1341 vmat->Set_Emissive(1.0f - actual_intensity,1.0f - actual_intensity,1.0f - actual_intensity);
1342 }
1343
1344 /*
1345 ** update the mappers
1346 */
1347 if (Get_Flag(PERSPECTIVE)) {
1349 } else {
1351 }
1352
1353 if (Get_Texture_Size() == 0) {
1354// SurfaceClass::SurfaceDescription surface_desc;
1355// MaterialPass->Peek_Texture()->Get_Level_Description(surface_desc);
1356 Set_Texture_Size(MaterialPass->Peek_Texture()->Get_Width());
1357 WWASSERT(Get_Texture_Size() != 0);
1358 }
1359
1360 Mapper->Set_Texture_Transform(view_to_texture,Get_Texture_Size());
1361 if (Mapper1) {
1362 Mapper1->Set_Texture_Transform(view_to_texture,Get_Texture_Size());
1363 }
1364}
1365
1366
1367/***********************************************************************************************
1368 * TexProjectClass::Update_WS_Bounding_Volume -- Recalculate the world-space bounding box *
1369 * *
1370 * INPUT: *
1371 * *
1372 * OUTPUT: *
1373 * *
1374 * WARNINGS: *
1375 * *
1376 * HISTORY: *
1377 * 1/11/00 gth : Created. *
1378 *=============================================================================================*/
1380{
1382
1383 /*
1384 ** Tell our culling system that we've changed
1385 */
1386 Vector3 extent;
1387 WorldBoundingVolume.Compute_Axis_Aligned_Extent(&extent);
1389}
1390
#define NULL
Definition BaseType.h:92
#define WWASSERT
unsigned long uint32
Definition bittype.h:46
void Transform(const Matrix3D &tm)
Definition aabox.h:185
Vector3 Center
Definition aabox.h:123
Vector3 Extent
Definition aabox.h:124
void Fill(unsigned char c)
Definition bwrender.cpp:98
@ PERSPECTIVE
Definition camera.h:113
void Set_Clip_Planes(float znear, float zfar)
Definition camera.cpp:742
void Set_Viewport(const Vector2 &min, const Vector2 &max)
Definition camera.h:275
void Set_View_Plane(const Vector2 &min, const Vector2 &max)
Definition camera.cpp:306
void Set_Projection_Type(ProjectionType ptype)
Definition camera.h:264
virtual void Set_Transform(const Matrix3D &m)
Definition camera.cpp:264
void Set_Cull_Box(const AABoxClass &box, bool just_loaded=false)
Definition cullsys.cpp:62
static void Set_Render_Target_With_Z(TextureClass *texture, ZTextureClass *ztexture=NULL)
static void Set_Render_Target(IDirect3DSurface8 *render_target, bool use_default_depth_buffer=false)
static void Multiply(const Matrix3D &A, const Matrix3D &B, Matrix3D *set_result)
Definition matrix3d.cpp:640
void Get_Orthogonal_Inverse(Matrix3D &set_inverse) const
Definition matrix3d.cpp:570
static WWINLINE void Transform_Vector(const Matrix3D &tm, const Vector3 &in, Vector3 *out)
Definition matrix3d.h:1742
void Look_At(const Vector3 &p, const Vector3 &t, float roll)
Definition matrix3d.cpp:354
WWINLINE friend Matrix4x4 Multiply(const Matrix4x4 &a, const Matrix4x4 &b)
Definition matrix4.h:743
OBBoxClass WorldBoundingVolume
Definition projector.h:84
virtual void Set_Perspective_Projection(float hfov, float vfov, float znear, float zfar)
MatrixMapperClass * Mapper
Definition projector.h:86
virtual void Set_Ortho_Projection(float xmin, float xmax, float ymin, float ymax, float znear, float zfar)
Matrix3D Transform
Definition projector.h:80
virtual void Update_WS_Bounding_Volume(void)
Matrix4x4 Projection
Definition projector.h:81
virtual void Set_Transform(const Matrix3D &tm)
WWINLINE void Release_Ref(void) const
Definition refcount.h:146
TexProjectClass * Texture_Projector
Definition rinfo.h:111
CameraClass & Camera
Definition rinfo.h:100
virtual void Get_Obj_Space_Bounding_Box(AABoxClass &box) const
Definition rendobj.cpp:952
const Matrix3D & Get_Transform(void) const
Definition rendobj.h:617
virtual void Special_Render(SpecialRenderInfoClass &rinfo)
Definition rendobj.h:269
@ GRADIENT_MODULATE
Definition shader.h:193
@ GRADIENT_ADD
Definition shader.h:194
@ DETAILCOLOR_DISABLE
Definition shader.h:139
@ DETAILCOLOR_SCALE
Definition shader.h:141
@ DETAILCOLOR_ADD
Definition shader.h:143
void Set_Src_Blend_Func(SrcBlendFuncType x)
Definition shader.h:334
@ PASS_LEQUAL
Definition shader.h:106
@ FOG_DISABLE
Definition shader.h:183
@ COLOR_WRITE_ENABLE
Definition shader.h:124
@ DETAILALPHA_DISABLE
Definition shader.h:130
@ TEXTURING_ENABLE
Definition shader.h:220
@ CULL_MODE_ENABLE
Definition shader.h:159
void Set_Post_Detail_Color_Func(DetailColorFuncType x)
Definition shader.h:327
@ DEPTH_WRITE_DISABLE
Definition shader.h:116
void Set_Dst_Blend_Func(DstBlendFuncType x)
Definition shader.h:330
@ SECONDARY_GRADIENT_DISABLE
Definition shader.h:203
void Enable_Fog(const char *source)
Definition shader.cpp:280
@ SRCBLEND_ZERO
Definition shader.h:210
@ SRCBLEND_ONE
Definition shader.h:211
@ ALPHATEST_DISABLE
Definition shader.h:96
@ DSTBLEND_SRC_COLOR
Definition shader.h:174
@ DSTBLEND_ONE
Definition shader.h:173
BWRenderClass * BWRenderer
Definition rinfo.h:157
void Set_Render_Target(TextureClass *render_target, ZTextureClass *ztarget=NULL)
virtual void Set_Perspective_Projection(float hfov, float vfov, float znear, float zfar)
bool Needs_Render_Target(void)
void Configure_Camera(CameraClass &camera)
void Set_Attenuation(float attenuation)
bool Get_Flag(uint32 flag) const
void Set_Texture(TextureClass *texture)
bool Compute_Perspective_Projection(RenderObjClass *obj, const Vector3 &lightpos, float znear=-1.0f, float zfar=-1.0f)
bool Compute_Texture(RenderObjClass *model, SpecialRenderInfoClass *context)
virtual ~TexProjectClass(void)
float Get_Intensity(void)
virtual void Pre_Render_Update(const Matrix3D &camera)
bool Compute_Ortho_Projection(RenderObjClass *obj, const Vector3 &lightdir, float znear=-1.0f, float zfar=-1.0f)
TextureClass * Peek_Texture(void) const
virtual void Update_WS_Bounding_Volume(void)
void Set_Flag(uint32 flag, bool onoff)
ZTextureClass * DepthStencilTarget
Definition texproject.h:224
virtual void Set_Ortho_Projection(float xmin, float xmax, float ymin, float ymax, float znear, float zfar)
void Set_Texture_Size(int size)
MaterialPassClass * Peek_Material_Pass(void)
TextureClass * Get_Texture(void) const
bool Is_Intensity_Zero(void)
float DesiredIntensity
Definition texproject.h:214
void Init_Additive(void)
TextureClass * Peek_Render_Target(TextureClass **rtarget=NULL, ZTextureClass **ztarget=NULL)
void Init_Multiplicative(void)
void Enable_Depth_Gradient(bool onoff)
int Get_Texture_Size(void)
bool Is_Depth_Gradient_Enabled(bool onoff)
bool Is_Attenuation_Enabled(void)
MaterialPassClass * MaterialPass
Definition texproject.h:221
MatrixMapperClass * Mapper1
Definition texproject.h:222
float Get_Attenuation(void)
void Enable_Attenuation(bool onoff)
TextureClass * RenderTarget
Definition texproject.h:223
void Set_Intensity(float intensity, bool immediate=false)
TextureFilterClass & Get_Filter()
Definition texture.h:336
void Set_V_Addr_Mode(TxtAddrMode mode)
void Set_U_Addr_Mode(TxtAddrMode mode)
float X
Definition vector3.h:90
float Z
Definition vector3.h:92
float Y
Definition vector3.h:91
WWINLINE float Length(void) const
Definition vector3.h:453
WWINLINE void Set(float x, float y, float z)
Definition vector3.h:103
float Quick_Length(void) const
Definition vector3.h:487
void Set_Lighting(bool lighting)
void Set_Specular(const Vector3 &color)
void Set_Diffuse(const Vector3 &color)
void Set_Ambient(const Vector3 &color)
void Set_Emissive(const Vector3 &color)
void Set_Mapper(TextureMapperClass *mapper, int stage=0)
void Set_Opacity(float o)
virtual TextureClass * Get_Texture(const char *filename, MipCountType mip_level_count=MIP_LEVELS_ALL, WW3DFormat texture_format=WW3D_FORMAT_UNKNOWN, bool allow_compression=true, TextureBaseClass::TexAssetType type=TextureBaseClass::TEX_REGULAR, bool allow_reduction=true)
static WW3DAssetManager * Get_Instance(void)
Definition assetmgr.h:205
static WW3DErrorType Render(const LayerListClass &layerlist)
Definition ww3d.cpp:876
static bool Is_Snapshot_Activated()
Definition ww3d.h:298
static unsigned int Get_Frame_Time(void)
Definition ww3d.h:173
static void Activate_Snapshot(bool b)
Definition ww3d.h:299
static WW3DErrorType Begin_Render(bool clear=false, bool clearz=true, const Vector3 &color=Vector3(0, 0, 0), float dest_alpha=0.0f, void(*network_callback)(void)=NULL)
Definition ww3d.cpp:791
static WW3DErrorType End_Render(bool flip_frame=true)
Definition ww3d.cpp:1082
static float Atan(float x)
Definition wwmath.h:149
static WWINLINE float Fabs(float val)
Definition wwmath.h:113
#define REF_PTR_RELEASE(x)
Definition refcount.h:80
#define REF_PTR_SET(dst, src)
Definition refcount.h:79
#define NEW_REF(C, P)
Definition refcount.h:62
#define SHADE_CNST(depth_compare, depth_mask, color_mask, src_blend, dst_blend, fog, pri_grad, sec_grad, texture, alpha_test, cullmode, post_det_color, post_det_alpha)
Definition shader.h:76
const float INTENSITY_RATE_OF_CHANGE
unsigned char flag
Definition vchannel.cpp:273
#define SNAPSHOT_SAY(x)
Definition ww3d.h:68
#define WWDEBUG_SAY(x)
Definition wwdebug.h:114