Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
ringobj.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/ringobj.cpp $*
26 * *
27 * Author:: Greg Hjelstrom *
28 * *
29 * $Modtime:: 11/24/01 6:17p $*
30 * *
31 * $Revision:: 27 $*
32 * *
33 *---------------------------------------------------------------------------------------------*
34 * Functions: *
35 * RingRenderObjClass::RingRenderObjClass -- Constructor *
36 * RingRenderObjClass::RingRenderObjClass -- Constructor - init from a definition *
37 * RingRenderObjClass::RingRenderObjClass -- Copy constructor *
38 * RingRenderObjClass::~RingRenderObjClass -- destructor *
39 * RingRenderObjClass::operator -- assignment operator *
40 * RingRenderObjClass::Get_Num_Polys -- returns number of polygons *
41 * RingRenderObjClass::Get_Name -- returns name *
42 * RingRenderObjClass::Set_Name -- sets the name *
43 * RingRenderObjClass::Set_Color -- Sets the color of the Ring *
44 * RingRenderObjClass::Init_Ring_Render_System -- global initialization needed for Ring *
45 * RingRenderObjClass::Shutdown_Ring_Render_System -- cleanup Ring render system *
46 * RingRenderObjClass::Set_Ring_Display_Mask -- Sets global display mask for all Ringes *
47 * RingRenderObjClass::Get_Ring_Display_Mask -- returns the display mask *
48 * RingRenderObjClass::update_mesh_data -- Updates vertex positions, etc *
49 * RingRenderObjClass::render_Ring -- submits the Ring to the GERD *
50 * RingRenderObjClass::vis_render_Ring -- submits Ring to the GERD for VIS *
51 * RingRenderObjClass::RingRenderObjClass -- constructor *
52 * RingRenderObjClass::RingRenderObjClass -- Constructor - init from a definition *
53 * RingRenderObjClass::RingRenderObjClass -- copy constructor *
54 * RingRenderObjClass::RingRenderObjClass -- Constructor from a wwmath aaRing *
55 * RingRenderObjClass::operator -- assignment operator *
56 * RingRenderObjClass::Clone -- clones the Ring *
57 * RingRenderObjClass::Class_ID -- returns the class-id for AARing's *
58 * RingRenderObjClass::Render -- render this Ring *
59 * RingRenderObjClass::Special_Render -- special render this Ring (vis) *
60 * RingRenderObjClass::Set_Transform -- set the transform for this Ring *
61 * RingRenderObjClass::Set_Position -- Set the position of this Ring *
62 * RingRenderObjClass::update_cached_Ring -- update the world-space version of this Ring *
63 * RingRenderObjClass::Cast_Ray -- cast a ray against this Ring *
64 * RingRenderObjClass::Cast_AARing -- cast an AARing against this Ring *
65 * RingRenderObjClass::Cast_OBRing -- cast an OBRing against this Ring *
66 * RingRenderObjClass::Get_Obj_Space_Bounding_Sphere -- return the object-space bounding sper*
67 * RingRenderObjClass::Get_Obj_Space_Bounding_Box -- returns the obj-space bounding box *
68 * RingRenderObjClass::Scale -- scales ring uniformly. *
69 * RingRenderObjClass::Scale -- scales ring non-uniformly. *
70 * RingRenderObjClass::Update_Cached_Bounding_Volumes -- Updates world-space bounding volum *
71 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
72
73
74#include "ringobj.h"
75#include "w3d_util.h"
76#include "wwdebug.h"
77#include "vertmaterial.h"
78#include "ww3d.h"
79#include "chunkio.h"
80#include "rinfo.h"
81#include "coltest.h"
82#include "inttest.h"
83#include "matrix3.h"
84#include "wwmath.h"
85#include "assetmgr.h"
86#include "wwstring.h"
87#include "bound.h"
88#include "camera.h"
89#include "statistics.h"
90#include "predlod.h"
91#include "dx8wrapper.h"
92#include "dx8indexbuffer.h"
93#include "dx8vertexbuffer.h"
94#include "sortingrenderer.h"
95#include "vector3i.h"
96#include "visrasterizer.h"
97
98
99static bool Ring_Array_Valid = false;
100
101
107{
109
110public:
111 // Constructor
112 RingMeshClass(void);
113 RingMeshClass(float radius, int slices);
114 // Destructor
115 ~RingMeshClass(void);
116
117 void Generate(float radius, int slices);
118
119 int Get_Num_Polys(void) { return face_ct; };
120
121 void Scale (const Vector2 &inner_scale, const Vector2 &outer_scale);
122 void Set_Tiling (int count);
123
124private:
125
126 void Free(void);
127
128 float Radius;
129 int Slices;
130 int face_ct; //# of faces
131
132 int TileCount;
133 Vector2 InnerScale;
134 Vector2 OuterScale;
135
136 int Vertex_ct; // vertex count
137 Vector3 *vtx; // array of vertices
138 Vector2 *orig_vtx; // array of vertices representing a 'unit' ring
139 Vector3 *vtx_normal; // array of vertex normals
140 Vector2 *vtx_uv; // array of vertex uv coordinates
141
142 TriIndex *tri_poly; // array of triangle polys, vertex indices (can be discard if switch to fan renderer)
143};
144
145
147float RingLODCosts[RING_NUM_LOD + 1]; // RING_NUM_LOD doesn't include the null LOD
148
149
150
151/*
152** RingRenderObjClass Implementation
153*/
154
155
156/***********************************************************************************************
157 * RingRenderObjClass::RingRenderObjClass -- Constructor *
158 * *
159 * INPUT: *
160 * *
161 * OUTPUT: *
162 * *
163 * WARNINGS: *
164 * *
165 * HISTORY: *
166 * 1/19/00 gth : Created. *
167 *=============================================================================================*/
169 : anim_time (0.0F),
171 LODBias(1.0f),
172 CurrentLOD(RING_NUM_LOD), // RING_NUM_LOD does not include the null LOD
173 AnimDuration (0.0F),
176 Color (0.75F,0.75F,0.75F),
177 InnerScale (1, 1),
178 OuterScale (1, 1),
179 Alpha (1.0F),
180 Flags(0),
182 ObjSpaceCenter (0, 0, 0),
183 ObjSpaceExtent (1, 1, 1),
184 InnerExtent (0.5F, 0.5F),
185 OuterExtent (1.0F, 1.0F)
186{
188
189 memset(Name,0,sizeof(Name));
190
191 Init_Material () ;
192
193 // So that the object is ready for use after construction, we will
194 // complete its initialization by initializing its value array
195 // according to a screen area of 1.
197}
198
199/***********************************************************************************************
200 * RingRenderObjClass::RingRenderObjClass -- Constructor - init from a definition *
201 * *
202 * INPUT: *
203 * *
204 * OUTPUT: *
205 * *
206 * WARNINGS: *
207 * *
208 * HISTORY: *
209 * 1/19/00 gth : Created. *
210 *=============================================================================================*/
212 : anim_time (0.0F),
214 LODBias(1.0f),
215 CurrentLOD(RING_NUM_LOD), // RING_NUM_LOD does not include the null LOD
216 AnimDuration (0.0F),
219 Color (0.75F,0.75F,0.75F),
220 InnerScale (1, 1),
221 OuterScale (1, 1),
222 Alpha (1.0F),
223 Flags(0),
225 ObjSpaceCenter (0, 0, 0),
226 ObjSpaceExtent (1, 1, 1),
227 InnerExtent (0.5F, 0.5F),
228 OuterExtent (1.0F, 1.0F)
229{
231 Init_Material ();
232
233 //
234 // Initialize from the defintion
235 //
236 Set_Name(def.Name);
238 Vector3 (def.Extent.X, def.Extent.Y, def.Extent.Z));
239 if (def.TextureName[0] != 0) {
241 }
242
243 // So that the object is ready for use after construction, we will
244 // complete its initialization by initializing its value array
245 // according to a screen area of 1.
247}
248
249
250/***********************************************************************************************
251 * RingRenderObjClass::RingRenderObjClass -- Copy constructor *
252 * *
253 * INPUT: *
254 * *
255 * OUTPUT: *
256 * *
257 * WARNINGS: *
258 * *
259 * HISTORY: *
260 * 1/19/00 gth : Created. *
261 *=============================================================================================*/
263 : anim_time (0.0F),
265 LODBias(1.0f),
266 CurrentLOD(RING_NUM_LOD), // RING_NUM_LOD does not include the null LOD
267 AnimDuration (0.0F),
270 Color (0.75F,0.75F,0.75F),
271 InnerScale (1, 1),
272 OuterScale (1, 1),
273 Alpha (1.0F),
274 Flags(0),
276 ObjSpaceCenter (0, 0, 0),
277 ObjSpaceExtent (1, 1, 1),
278 InnerExtent (0.5F, 0.5F),
279 OuterExtent (1.0F, 1.0F)
280{
282 Init_Material ();
283
284 *this = src;
285
286 // So that the object is ready for use after construction, we will
287 // complete its initialization by initializing its value array
288 // according to a screen area of 1.
290}
291
292
293/***********************************************************************************************
294 * RingRenderObjClass::~RingRenderObjClass -- destructor *
295 * *
296 * INPUT: *
297 * *
298 * OUTPUT: *
299 * *
300 * WARNINGS: *
301 * *
302 * HISTORY: *
303 * 2/7/2001 gth : Created. *
304 *=============================================================================================*/
310
311
312/***********************************************************************************************
313 * RingRenderObjClass::operator -- assignment operator *
314 * *
315 * INPUT: *
316 * *
317 * OUTPUT: *
318 * *
319 * WARNINGS: *
320 * *
321 * HISTORY: *
322 * 1/19/00 gth : Created. *
323 *=============================================================================================*/
325{
326 if (this != &that) {
328 Set_Name(that.Get_Name());
329 Color = that.Color;
330 Alpha = that.Alpha;
331 InnerScale = that.InnerScale;
332 OuterScale = that.OuterScale;
333 Flags = that.Flags;
334 RingShader = that.RingShader;
335 CachedBox = that.CachedBox;
336 anim_time = that.anim_time;
347
349 }
350
351 return *this;
352}
353
354
355/***********************************************************************************************
356 * RingRenderObjClass::Generate_Shared_Mesh_Arrays -- Generates mesh LOD arrays. *
357 * *
358 * INPUT: *
359 * *
360 * OUTPUT: *
361 * *
362 * WARNINGS: *
363 * *
364 * HISTORY: *
365 * 03/08/00 pds : Created. *
366 *=============================================================================================*/
368{
369 // Generate shared Mesh Arrays
370 if (!Ring_Array_Valid) {
371
372 float size = RING_LOWEST_LOD;
373 float step = (RING_HIGHEST_LOD - RING_LOWEST_LOD);
374 step /= RING_NUM_LOD;
375
376 // For NULL LOD set Cost to a small nonzero amount to avoid divisions by zero.
377 RingLODCosts[0] = 0.000001f;
378 for(int i=0; i < RING_NUM_LOD; i++) {
379
380 RingMeshArray[i].Generate(1.0f, size);
381 RingLODCosts[i + 1] = RingMeshArray[i].Get_Num_Polys();
382
383 size+=step;
384 }
385
386 Ring_Array_Valid = true;
387 }
388
389 return ;
390}
391
392
393// This is used both by Prepare_LOD and Calculate_Cost_Value_Arrays.
394void RingRenderObjClass::calculate_value_array(float screen_area, float *values) const
395{
396 values[0] = AT_MIN_LOD;
397 for (int lod = 1; lod <= RING_NUM_LOD; lod++) {
398 float polycount = RingLODCosts[lod];
399 float benefit_factor = 1 - (0.5f / (polycount * polycount));
400 values[lod] = (benefit_factor * screen_area * LODBias) / polycount;
401 }
402 values[RING_NUM_LOD + 1] = AT_MAX_LOD; // Post-inc value will flag max LOD.
403}
404
405
406/***********************************************************************************************
407 * RingRenderObjClass::Init_Material -- Sets up the material and default shader for the Ring.*
408 * *
409 * INPUT: *
410 * *
411 * OUTPUT: *
412 * *
413 * WARNINGS: *
414 * *
415 * HISTORY: *
416 * 03/08/00 pds : Created. *
417 *=============================================================================================*/
419{
421
423 RingMaterial->Set_Ambient(0,0,0);
424 RingMaterial->Set_Diffuse(0,0,0);
425 RingMaterial->Set_Specular(0,0,0);
426 RingMaterial->Set_Emissive(1,1,1);
427 RingMaterial->Set_Opacity(0.25f);
428 RingMaterial->Set_Shininess(0.0f);
429
430 // Texturing, zbuffer, primary gradient, alpha blending
432
433} // Init_Material
434
435
436
437/***********************************************************************************************
438 * RingRenderObjClass::Get_Num_Polys -- returns number of polygons *
439 * *
440 * INPUT: *
441 * *
442 * OUTPUT: *
443 * *
444 * WARNINGS: *
445 * *
446 * HISTORY: *
447 * 1/19/00 gth : Created. *
448 *=============================================================================================*/
450{
451 return RingLODCosts[CurrentLOD];
452}
453
454/***********************************************************************************************
455 * RingRenderObjClass::Set_Texture *
456 * *
457 * INPUT: *
458 * *
459 * OUTPUT: *
460 * *
461 * WARNINGS: *
462 * *
463 * HISTORY: *
464 * 1/19/00 gth : Created. *
465 *=============================================================================================*/
470
471
472/***********************************************************************************************
473 * RingRenderObjClass::Get_Name -- returns name *
474 * *
475 * INPUT: *
476 * *
477 * OUTPUT: *
478 * *
479 * WARNINGS: *
480 * *
481 * HISTORY: *
482 * 1/19/00 gth : Created. *
483 *=============================================================================================*/
484const char * RingRenderObjClass::Get_Name(void) const
485{
486 return Name;
487}
488
489
490/***********************************************************************************************
491 * RingRenderObjClass::Set_Name -- sets the name *
492 * *
493 * INPUT: *
494 * *
495 * OUTPUT: *
496 * *
497 * WARNINGS: *
498 * *
499 * HISTORY: *
500 * 1/19/00 gth : Created. *
501 *=============================================================================================*/
502void RingRenderObjClass::Set_Name(const char * name)
503{
504 WWASSERT(name != NULL);
505 WWASSERT(strlen(name) < 2*W3D_NAME_LEN);
506 strcpy(Name,name);
507}
508
509/***********************************************************************************************
510 * RingRenderObjClass::render_ring -- submits the box to the GERD *
511 * *
512 * INPUT: *
513 * *
514 * OUTPUT: *
515 * *
516 * WARNINGS: *
517 * *
518 * HISTORY: *
519 * 1/19/00 gth : Created. *
520 *=============================================================================================*/
521void RingRenderObjClass::render_ring(RenderInfoClass & rinfo,const Vector3 & center,const Vector3 & extent)
522{
523 // Should never get here with NULL LOD
524 if (CurrentLOD == 0) {
525 WWASSERT(0);
526 return;
527 }
528
530
531 if (RingTexture) {
533 } else {
535 }
539
540 // Enable sorting if the primitive is translucent, alpha testing is not enabled, and sorting is enabled globally.
541 const bool sort = (RingShader.Get_Dst_Blend_Func() != ShaderClass::DSTBLEND_ZERO) && (RingShader.Get_Alpha_Test() == ShaderClass::ALPHATEST_DISABLE) && (WW3D::Is_Sorting_Enabled());
542 const unsigned int buffer_type = sort ? BUFFER_TYPE_DYNAMIC_SORTING : BUFFER_TYPE_DYNAMIC_DX8;
543
544 DynamicVBAccessClass vb(buffer_type, dynamic_fvf_type, ring.Vertex_ct);
545 {
548
549 //
550 // set up the vertex color+alpha
551 //
552 unsigned color;
553 if (RingShader.Get_Dst_Blend_Func () == ShaderClass::DSTBLEND_ONE) {
554 color = DX8Wrapper::Convert_Color(Alpha * Color,1.0f);
555 } else {
557 }
558
559 for (int i=0; i<ring.Vertex_ct; i++)
560 {
561 vb->x = ring.vtx[i].X;
562 vb->y = ring.vtx[i].Y;
563 vb->z = ring.vtx[i].Z;
564
565 vb->nx = ring.vtx_normal[i].X; // may not need this!
566 vb->ny = ring.vtx_normal[i].Y;
567 vb->nz = ring.vtx_normal[i].Z;
568
569 vb->diffuse = color;
570
571 if (RingTexture) {
572 vb->u1 = ring.vtx_uv[i].X;
573 vb->v1 = ring.vtx_uv[i].Y;
574 }
575 vb++;
576 }
577 }
578
579 DynamicIBAccessClass ib(buffer_type, ring.face_ct * 3);
580 {
582 unsigned short *mem=Lock.Get_Index_Array();
583 for (int i=0; i<ring.face_ct; i++)
584 {
585 mem[3*i]=ring.tri_poly[i].I;
586 mem[3*i+1]=ring.tri_poly[i].J;
587 mem[3*i+2]=ring.tri_poly[i].K;
588 }
589 }
590
593
594 if (sort) {
595 SortingRendererClass::Insert_Triangles(Get_Bounding_Sphere(), 0, ring.face_ct, 0, ring.Vertex_ct);
596 } else {
597 DX8Wrapper::Draw_Triangles(0, ring.face_ct, 0, ring.Vertex_ct);
598 }
599
600} // render_ring
601
602
603/***********************************************************************************************
604 * RingRenderObjClass::vis_render_ring -- submits box to the GERD for VIS *
605 * *
606 * this renders the ring with the specified VIS-ID. *
607 * *
608 * INPUT: *
609 * *
610 * OUTPUT: *
611 * *
612 * WARNINGS: *
613 * *
614 * HISTORY: *
615 * 1/19/00 gth : Created. *
616 *=============================================================================================*/
618{
619 WWASSERT(0);
620} // vis_render_ring
621
622
623/***********************************************************************************************
624 * RingRenderObjClass::Clone -- clones the ring *
625 * *
626 * INPUT: *
627 * *
628 * OUTPUT: *
629 * *
630 * WARNINGS: *
631 * *
632 * HISTORY: *
633 * 1/19/00 gth : Created. *
634 *=============================================================================================*/
636{
637 return W3DNEW RingRenderObjClass(*this);
638}
639
640
641/***********************************************************************************************
642 * RingRenderObjClass::Class_ID -- returns the class-id for Rings's *
643 * *
644 * INPUT: *
645 * *
646 * OUTPUT: *
647 * *
648 * WARNINGS: *
649 * *
650 * HISTORY: *
651 * 1/19/00 gth : Created. *
652 *=============================================================================================*/
654{
656}
657
658
659/***********************************************************************************************
660 * RingRenderObjClass::Render -- render this ring *
661 * *
662 * INPUT: *
663 * *
664 * OUTPUT: *
665 * *
666 * WARNINGS: *
667 * *
668 * HISTORY: *
669 * 1/19/00 gth : Created. *
670 *=============================================================================================*/
672{
673 // NULL LOD
674 if (CurrentLOD == 0) return;
675
676 if (Is_Not_Hidden_At_All() == false) {
677 return;
678 }
679
680 unsigned int sort_level = SORT_LEVEL_NONE;
681
683 sort_level = RingShader.Guess_Sort_Level();
684 }
685
687
688 WW3D::Add_To_Static_Sort_List(this, sort_level);
689
690 } else {
691
692 // Process texture reductions:
693// if (RingTexture) RingTexture->Process_Reduction();
694
695 Matrix3D temp = Transform;
696
697 // Do Time Based Animation
698 animate ();
699
700 //
701 // Scale the inner and outer parts of the ring.
702 //
703 Vector2 inner_scale (InnerExtent.X * InnerScale.X, InnerExtent.Y * InnerScale.Y);
704 Vector2 outer_scale (OuterExtent.X * OuterScale.X, OuterExtent.Y * OuterScale.Y);
705 RingMeshArray[CurrentLOD - 1].Scale(inner_scale, outer_scale);
706
707 //
708 // Make sure this mesh uses the correct UV tiling
709 //
710 if (RingTexture != NULL) {
711 RingMeshArray[CurrentLOD - 1].Set_Tiling (TextureTileCount);
712 }
713
714 //
715 // Should we force the ring to be camera aligned?
716 // (this will cause the ring to be parallel to the screen)
717 //
718 if (Flags & USE_CAMERA_ALIGN) {
719 Vector3 obj_position;
720 Vector3 camera_z_vector;
721
722 rinfo.Camera.Get_Transform().Get_Z_Vector(&camera_z_vector);
723 Transform.Get_Translation(&obj_position);
724
725 Matrix3D temp;
726 temp.Look_At(obj_position, obj_position + camera_z_vector, 0.0f);
727 DX8Wrapper::Set_Transform(D3DTS_WORLD, temp);
728 } else {
730 }
731
732 //
733 // Pass the geometry on to DX8
734 //
736 }
737} // Render
738
739
740/***********************************************************************************************
741 * RingRenderObjClass::Get_Default_Color - get the default (or first frame) value *
742 * *
743 * INPUT: *
744 * *
745 * OUTPUT: *
746 * *
747 * WARNINGS: *
748 * *
749 * HISTORY: *
750 * 3/13/2000 pds : Created. *
751 *=============================================================================================*/
753{
755
756 if (ColorChannel.Get_Key_Count () > 0) {
757 value = ColorChannel.Get_Key (0).Get_Value ();
758 } else {
759 value = Color;
760 }
761
762 return value;
763}
764
765
766/***********************************************************************************************
767 * RingRenderObjClass::Get_Default_Alpha - get the default (or first frame) value *
768 * *
769 * INPUT: *
770 * *
771 * OUTPUT: *
772 * *
773 * WARNINGS: *
774 * *
775 * HISTORY: *
776 * 3/13/2000 pds : Created. *
777 *=============================================================================================*/
779{
780 float value;
781
782 if (AlphaChannel.Get_Key_Count () > 0) {
783 value = AlphaChannel.Get_Key (0).Get_Value ();
784 } else {
785 value = Alpha;
786 }
787
788 return value;
789}
790
791
792/***********************************************************************************************
793 * RingRenderObjClass::Get_Default_Inner_Scale - get the default (or first frame) value *
794 * *
795 * INPUT: *
796 * *
797 * OUTPUT: *
798 * *
799 * WARNINGS: *
800 * *
801 * HISTORY: *
802 * 3/13/2000 pds : Created. *
803 *=============================================================================================*/
805{
807
808 if (InnerScaleChannel.Get_Key_Count () > 0) {
809 value = InnerScaleChannel.Get_Key (0).Get_Value ();
810 } else {
812 }
813
814 return value;
815}
816
817
818/***********************************************************************************************
819 * RingRenderObjClass::Get_Default_Outer_Scale - get the default (or first frame) value *
820 * *
821 * INPUT: *
822 * *
823 * OUTPUT: *
824 * *
825 * WARNINGS: *
826 * *
827 * HISTORY: *
828 * 3/13/2000 pds : Created. *
829 *=============================================================================================*/
831{
833
834 if (OuterScaleChannel.Get_Key_Count () > 0) {
835 value = OuterScaleChannel.Get_Key (0).Get_Value ();
836 } else {
838 }
839
840 return value;
841}
842
843
844/***********************************************************************************************
845 * RingRenderObjClass::Special_Render -- special render this box (vis) *
846 * *
847 * INPUT: *
848 * *
849 * OUTPUT: *
850 * *
851 * WARNINGS: *
852, * *
853 * HISTORY: *
854 * 1/19/00 gth : Created. *
855 *=============================================================================================*/
857{
858 Matrix3D temp(1);
859 temp.Translate(Transform.Get_Translation());
860
862 WWASSERT(rinfo.VisRasterizer != NULL);
865 }
866}
867
868
869/***********************************************************************************************
870 * RingRenderObjClass::Set_Transform -- set the transform for this box *
871 * *
872 * INPUT: *
873 * *
874 * OUTPUT: *
875 * *
876 * WARNINGS: *
877 * *
878 * HISTORY: *
879 * 1/19/00 gth : Created. *
880 *=============================================================================================*/
886
887
888/***********************************************************************************************
889 * RingRenderObjClass::Set_Position -- Set the position of this box *
890 * *
891 * INPUT: *
892 * *
893 * OUTPUT: *
894 * *
895 * WARNINGS: *
896 * *
897 * HISTORY: *
898 * 1/19/00 gth : Created. *
899 *=============================================================================================*/
905
906
907/***********************************************************************************************
908 * RingRenderObjClass::update_cached_box -- update the world-space version of this box *
909 * *
910 * INPUT: *
911 * *
912 * OUTPUT: *
913 * *
914 * WARNINGS: *
915 * *
916 * HISTORY: *
917 * 1/19/00 gth : Created. *
918 *=============================================================================================*/
920{
921 CachedBox.Center = Transform.Get_Translation() + ObjSpaceCenter;
922 CachedBox.Extent = ObjSpaceExtent;
923}
924
925
926/***********************************************************************************************
927 * RingRenderObjClass::Get_Obj_Space_Bounding_Ring -- return the object-space bounding sphe *
928 * *
929 * INPUT: *
930 * *
931 * OUTPUT: *
932 * *
933 * WARNINGS: *
934 * *
935 * HISTORY: *
936 * 1/19/00 gth : Created. *
937 *=============================================================================================*/
939{
940 sphere.Center = ObjSpaceCenter;
941 sphere.Radius = ObjSpaceExtent.Length();
942}
943
944
945/***********************************************************************************************
946 * RingRenderObjClass::Get_Obj_Space_Bounding_Box -- returns the obj-space bounding box *
947 * *
948 * INPUT: *
949 * *
950 * OUTPUT: *
951 * *
952 * WARNINGS: *
953 * *
954 * HISTORY: *
955 * 1/19/00 gth : Created. *
956 *=============================================================================================*/
962
963
965{
966 if (Is_Not_Hidden_At_All() == false) {
967 return;
968 }
969
971
973}
974
979
981{
982 if (CurrentLOD > 0) CurrentLOD--;
983}
984
986{
987 return Get_Num_Polys(); // Currently cost == polys
988}
989
991{
992 return Value[CurrentLOD];
993}
994
996{
997 return Value[CurrentLOD + 1];
998}
999
1001{
1002 CurrentLOD = Bound(lod, 0, RING_NUM_LOD); // RING_NUM_LOD doesn't include the null LOD
1003}
1004
1006{
1007 return CurrentLOD;
1008}
1009
1011{
1012 return RING_NUM_LOD + 1; // RING_NUM_LOD doesn't include the null LOD
1013}
1014
1015int RingRenderObjClass::Calculate_Cost_Value_Arrays(float screen_area, float *values, float *costs) const
1016{
1017 calculate_value_array(screen_area, values);
1018 for (int lod = 0; lod <= RING_NUM_LOD; lod++) {
1019 costs[lod] = RingLODCosts[lod];
1020 }
1021
1022 // We currently don't support max screen size or minimum LOD clamping for ring objects
1023 return 0;
1024}
1025
1026
1027/***********************************************************************************************
1028 * RingRenderObjClass::Scale -- scales ring uniformly. *
1029 * *
1030 * INPUT: *
1031 * *
1032 * OUTPUT: *
1033 * *
1034 * WARNINGS: *
1035 * *
1036 * HISTORY: *
1037 * 7/01/02 NH : Created. *
1038 *=============================================================================================*/
1040{
1041 if (scale == 1.0f) return;
1042
1043 // Scale default values
1044 InnerScale *= scale;
1045 OuterScale *= scale;
1046
1047 // Loop over all keys in inner and outer scale channel and scale values.
1048 int i;
1049 int inner_count = InnerScaleChannel.Get_Key_Count();
1050 for (i = 0; i < inner_count; i++) {
1052 InnerScaleChannel.Set_Key_Value(i, key.Get_Value() * scale);
1053 }
1054 int outer_count = OuterScaleChannel.Get_Key_Count();
1055 for (i = 0; i < outer_count; i++) {
1057 OuterScaleChannel.Set_Key_Value(i, key.Get_Value() * scale);
1058 }
1059}
1060
1061
1062/***********************************************************************************************
1063 * RingRenderObjClass::Scale -- scales ring non-uniformly. *
1064 * *
1065 * INPUT: *
1066 * *
1067 * OUTPUT: *
1068 * *
1069 * WARNINGS: *
1070 * *
1071 * HISTORY: *
1072 * 7/01/02 NH : Created. *
1073 *=============================================================================================*/
1074void RingRenderObjClass::Scale(float scalex, float scaley, float scalez)
1075{
1076 // Scale default values
1077 InnerScale.X *= scalex;
1078 InnerScale.Y *= scaley;
1079 OuterScale.X *= scalex;
1080 OuterScale.Y *= scaley;
1081
1082 // Loop over all keys in inner and outer scale channel and scale values.
1083 int i;
1084 int inner_count = InnerScaleChannel.Get_Key_Count();
1085 for (i = 0; i < inner_count; i++) {
1087 Vector2 key_val = key.Get_Value();
1088 key_val.X *= scalex;
1089 key_val.Y *= scaley;
1090 InnerScaleChannel.Set_Key_Value(i, key_val);
1091 }
1092 int outer_count = OuterScaleChannel.Get_Key_Count();
1093 for (i = 0; i < outer_count; i++) {
1095 Vector2 key_val = key.Get_Value();
1096 key_val.X *= scalex;
1097 key_val.Y *= scaley;
1098 OuterScaleChannel.Set_Key_Value(i, key_val);
1099 }
1100}
1101
1102
1103/***********************************************************************************************
1104 * RingRenderObjClass::Update_On_Visibilty -- Either starts or stops the animation based on vis*
1105 * *
1106 * INPUT: *
1107 * *
1108 * OUTPUT: *
1109 * *
1110 * WARNINGS: *
1111 * *
1112 * HISTORY: *
1113 * 4/04/00 pds : Created. *
1114 *=============================================================================================*/
1116{
1117 // Simply start or stop the animation based on
1118 // the visibility state of the primitive.
1119 if (Is_Not_Hidden_At_All () && Is_Animating () == false) {
1120 Start_Animating ();
1121 } else if ((Is_Not_Hidden_At_All () == false) && Is_Animating ()) {
1122 Stop_Animating ();
1123 }
1124
1125 return ;
1126}
1127
1128/***********************************************************************************************
1129 * RingRenderObjClass::animate -- Update Current Display state *
1130 * *
1131 * INPUT: *
1132 * *
1133 * OUTPUT: *
1134 * *
1135 * WARNINGS: *
1136 * *
1137 * HISTORY: *
1138 * 3/07/00 jga : Created. *
1139 *=============================================================================================*/
1141{
1142 if (Is_Animating ()) {
1143
1144 if ( ColorChannel.Get_Key_Count () > 0 ||
1145 AlphaChannel.Get_Key_Count () > 0 ||
1146 InnerScaleChannel.Get_Key_Count () > 0 ||
1147 OuterScaleChannel.Get_Key_Count () > 0)
1148 {
1149 //
1150 // Convert from milliseconds to seconds and normalize the time
1151 //
1152 if (AnimDuration > 0) {
1153 float frametime = WW3D::Get_Frame_Time();
1154 frametime = (frametime * 0.001F) / AnimDuration;
1155 anim_time += frametime;
1156 } else {
1157 anim_time = 1.0F;
1158 }
1159 WWASSERT (anim_time >= 0.0F);
1160
1161 if ((Flags & USE_ANIMATION_LOOP) && anim_time > 1.0F) {
1162 anim_time -= 1.0F;
1163 }
1164
1165 if (ColorChannel.Get_Key_Count () > 0) {
1166 Color = ColorChannel.Evaluate (anim_time);
1167 }
1168
1169 if (AlphaChannel.Get_Key_Count () > 0) {
1170 Alpha = AlphaChannel.Evaluate (anim_time);
1171 }
1172
1173 if (InnerScaleChannel.Get_Key_Count () > 0) {
1175 }
1176
1177 if (OuterScaleChannel.Get_Key_Count () > 0) {
1181 ObjSpaceExtent.Z = 0;
1183 }
1184 }
1185 }
1186
1187 return ;
1188} // animate
1189
1190
1191/*
1192** RingLoaderClass Implementation
1193*/
1195{
1197 prototype->Load (cload);
1198 return prototype;
1199}
1200
1201/*
1202** RingPrototypeClass Implementation
1203*/
1205{
1206 ::memset (&Definition, 0, sizeof (Definition));
1207 return ;
1208}
1209
1211{
1212 ::memset (&Definition, 0, sizeof (Definition));
1213 ::strcpy (Definition.Name, ring->Get_Name ());
1214
1215 Definition.AnimDuration = ring->AnimDuration;
1216 Definition.Attributes = ring->Get_Flags ();
1217 Definition.DefaultAlpha = ring->Get_Default_Alpha ();
1218 Definition.DefaultInnerScale = ring->Get_Default_Inner_Scale ();
1219 Definition.DefaultOuterScale = ring->Get_Default_Outer_Scale ();
1220 Definition.TextureTileCount = ring->Get_Texture_Tiling ();
1221
1222 Definition.InnerExtent = ring->Get_Inner_Extent ();
1223 Definition.OuterExtent = ring->Get_Outer_Extent ();
1224
1225 Vector3 def_color = ring->Get_Default_Color ();
1226 W3dUtilityClass::Convert_Vector (def_color, &Definition.DefaultColor);
1227
1228 W3dUtilityClass::Convert_Vector (ring->Get_Box ().Center, &Definition.Center);
1229 W3dUtilityClass::Convert_Vector (ring->Get_Box ().Extent, &Definition.Extent);
1230 W3dUtilityClass::Convert_Shader (ring->RingShader, &Definition.Shader);
1231
1232 //
1233 // Determine the texture name for this ring
1234 //
1235 if (ring->RingTexture != NULL) {
1236 StringClass name = ring->RingTexture->Get_Full_Path();
1237 const char *filename = ::strrchr (name, '\\');
1238 if (filename != NULL) {
1239 filename ++;
1240 } else {
1241 filename = name;
1242 }
1243
1244 ::strcpy (Definition.TextureName, filename);
1245 }
1246
1247 //
1248 // Save the animateable channels
1249 //
1250 ColorChannel = ring->Peek_Color_Channel ();
1251 AlphaChannel = ring->Peek_Alpha_Channel ();
1252 InnerScaleChannel = ring->Peek_Inner_Scale_Channel ();
1253 OuterScaleChannel = ring->Peek_Outer_Scale_Channel ();
1254 return ;
1255}
1256
1261
1262const char * RingPrototypeClass::Get_Name(void) const
1263{
1264 return Definition.Name;
1265}
1266
1271
1272enum
1273{
1279};
1280
1282{
1283 ColorChannel.Reset ();
1284 AlphaChannel.Reset ();
1285 InnerScaleChannel.Reset ();
1286 OuterScaleChannel.Reset ();
1287
1288 while (cload.Open_Chunk ()) {
1289 switch (cload.Cur_Chunk_ID ()) {
1290
1291 case CHUNKID_RING_DEF:
1292 cload.Read (&Definition, sizeof (Definition));
1293 break;
1294
1296 ColorChannel.Load (cload);
1297 break;
1298
1300 AlphaChannel.Load (cload);
1301 break;
1302
1304 InnerScaleChannel.Load (cload);
1305 break;
1306
1308 OuterScaleChannel.Load (cload);
1309 break;
1310 }
1311
1312 cload.Close_Chunk ();
1313 }
1314
1315 return true;
1316}
1317
1319{
1321
1323 csave.Write (&Definition, sizeof (Definition));
1324 csave.End_Chunk ();
1325
1326 if (ColorChannel.Get_Key_Count () > 0) {
1328 ColorChannel.Save (csave);
1329 csave.End_Chunk ();
1330 }
1331
1332 if (AlphaChannel.Get_Key_Count () > 0) {
1334 AlphaChannel.Save (csave);
1335 csave.End_Chunk ();
1336 }
1337
1338 if (InnerScaleChannel.Get_Key_Count () > 0) {
1340 InnerScaleChannel.Save (csave);
1341 csave.End_Chunk ();
1342 }
1343
1344 if (OuterScaleChannel.Get_Key_Count () > 0) {
1346 OuterScaleChannel.Save (csave);
1347 csave.End_Chunk ();
1348 }
1349
1350 csave.End_Chunk ();
1351 return true;
1352}
1353
1355{
1356 //
1357 // Create the new render object
1358 //
1359 RingRenderObjClass *ring = W3DNEW RingRenderObjClass (Definition);
1360
1361 //
1362 // Configure the ring
1363 //
1364 W3dUtilityClass::Convert_Shader (Definition.Shader, &ring->RingShader);
1365 if (WW3DAssetManager::Get_Instance()->Get_Activate_Fog_On_Load()) {
1366 ring->RingShader.Enable_Fog ("RingPrototypeClass");
1368 }
1369 W3dUtilityClass::Convert_Vector (Definition.DefaultColor, &ring->Color);
1370 ring->InnerScale = Definition.DefaultInnerScale;
1371 ring->OuterScale = Definition.DefaultOuterScale;
1372 ring->Set_Animation_Duration (Definition.AnimDuration);
1373 ring->Alpha = Definition.DefaultAlpha;
1374 ring->Set_Flags (Definition.Attributes);
1375 ring->Set_Inner_Extent (Definition.InnerExtent);
1376 ring->Set_Outer_Extent (Definition.OuterExtent);
1377 ring->Set_Texture_Tiling (Definition.TextureTileCount);
1378
1379 //
1380 // Initialize the render object with the keyframe arrays
1381 //
1382 ring->Set_Color_Channel (ColorChannel);
1383 ring->Set_Alpha_Channel (AlphaChannel);
1384 ring->Set_Inner_Scale_Channel (InnerScaleChannel);
1385 ring->Set_Outer_Scale_Channel (OuterScaleChannel);
1386 return ring;
1387}
1388
1389/*
1390** Global instance of the box loader
1391*/
1393
1394
1395//
1396// Vertices are ordered as such
1397// center, followed by outer ring
1398//
1399/***********************************************************************************************
1400 * RingMeshClass::RingMeshClass -- Constructor *
1401 * *
1402 * INPUT: *
1403 * *
1404 * OUTPUT: *
1405 * *
1406 * WARNINGS: *
1407 * *
1408 * HISTORY: *
1409 * 3/07/00 jga : Created. *
1410 *=============================================================================================*/
1411RingMeshClass::RingMeshClass(float radius, int slices):
1412Radius(radius),
1413Slices(slices),
1414Vertex_ct(0), // 1 vertex minimum, for center
1415vtx(NULL),
1416orig_vtx(NULL),
1417vtx_normal(NULL),
1418vtx_uv(NULL),
1419face_ct(0),
1420tri_poly(NULL),
1421TileCount (5),
1422InnerScale (1.0F, 1.0F),
1423OuterScale (1.0F, 1.0F)
1424{
1425 Generate(radius, slices);
1426}
1427
1428/***********************************************************************************************
1429 * RingMeshClass::RingMeshClass -- Constructor *
1430 * *
1431 * INPUT: *
1432 * *
1433 * OUTPUT: *
1434 * *
1435 * WARNINGS: *
1436 * *
1437 * HISTORY: *
1438 * 3/07/00 jga : Created. *
1439 *=============================================================================================*/
1441Radius(0.0f),
1442Slices(0),
1443Vertex_ct(0), // 1 vertex minimum, for center
1444vtx(NULL),
1445orig_vtx(NULL),
1446vtx_normal(NULL),
1447vtx_uv(NULL),
1448face_ct(0),
1449tri_poly(NULL),
1450TileCount (5),
1451InnerScale (1.0F, 1.0F),
1452OuterScale (1.0F, 1.0F)
1453{
1454} // empty ringmesh Constructor
1455
1456
1458{
1459 if (TileCount != count) {
1460 TileCount = count;
1461
1462 //
1463 // Calculate the increment 'u' increment value (as in UV).
1464 //
1465 float u_inc = ((float)TileCount) / ((float)(Slices));
1466 float u_value = 0.0F;
1467
1468 //
1469 // Reassign the UVs
1470 //
1471 for (int index = 0; index < Vertex_ct; index += 2) {
1472 vtx_uv[index].Set (u_value, 0.0F);
1473 vtx_uv[index + 1].Set (u_value, 1.0F);
1474 u_value += u_inc;
1475 }
1476 }
1477
1478 return ;
1479}
1480
1481
1482void RingMeshClass::Scale (const Vector2 &inner_scale, const Vector2 &outer_scale)
1483{
1484 bool do_inner = (inner_scale != InnerScale);
1485 bool do_outer = (outer_scale != OuterScale);
1486
1487 //
1488 // Only scale the inner ring if necessary
1489 //
1490 if (do_inner) {
1491
1492 for (int index = 0; index < Vertex_ct; index += 2) {
1493 vtx[index].X = orig_vtx[index].X * inner_scale.X;
1494 vtx[index].Y = orig_vtx[index].Y * inner_scale.Y;
1495 vtx[index].Z = 0;
1496 }
1497
1498 InnerScale = inner_scale;
1499 }
1500
1501 //
1502 // Only scale the outer ring if necessary
1503 //
1504 if (do_outer) {
1505
1506 for (int index = 1; index < Vertex_ct; index += 2) {
1507 vtx[index].X = orig_vtx[index].X * outer_scale.X;
1508 vtx[index].Y = orig_vtx[index].Y * outer_scale.Y;
1509 vtx[index].Z = 0;
1510 }
1511
1512 OuterScale = outer_scale;
1513 }
1514
1515 return ;
1516}
1517
1518
1519/***********************************************************************************************
1520 * RingMeshClass::Generate - Create Ring Geometry *
1521 * *
1522 * INPUT: *
1523 * *
1524 * OUTPUT: *
1525 * *
1526 * WARNINGS: *
1527 * *
1528 * HISTORY: *
1529 * 3/07/00 jga : Created. *
1530 *=============================================================================================*/
1531void RingMeshClass::Generate(float radius, int slices)
1532{
1533 Free ();
1534
1535 Slices = slices;
1536 Radius = radius;
1537
1538 face_ct = (Slices * 2);
1539 Vertex_ct = (Slices * 2) + 2;
1540
1541 vtx = W3DNEWARRAY Vector3[Vertex_ct];
1542 orig_vtx = W3DNEWARRAY Vector2[Vertex_ct];
1543 vtx_normal = W3DNEWARRAY Vector3[Vertex_ct];
1544 vtx_uv = W3DNEWARRAY Vector2[Vertex_ct];
1545 tri_poly = W3DNEWARRAY TriIndex[face_ct];
1546
1547 //
1548 // Generate vertices, normals, and uv's
1549 //
1550 float angle_inc = DEG_TO_RADF (360) / ((float)Slices);
1551 float u_inc = ((float)TileCount) / ((float)(Slices));
1552 float u_value = 0.0F;
1553 float angle = 0;
1554 int index = 0;
1555
1556 for (index = 0; index < Vertex_ct; index += 2) {
1557
1558 float x_pos = -WWMath::Sin (angle);
1559 float y_pos = WWMath::Cos (angle);
1560
1561 //
1562 // Place the inner index
1563 //
1564 vtx[index].X = orig_vtx[index].X = x_pos;
1565 vtx[index].Y = orig_vtx[index].Y = y_pos;
1566 vtx[index].Z = 0;
1567
1568 //
1569 // Place the outer index
1570 //
1571 vtx[index+1].X = orig_vtx[index+1].X = x_pos;
1572 vtx[index+1].Y = orig_vtx[index+1].Y = y_pos;
1573 vtx[index+1].Z = 0;
1574
1575 //
1576 // Normals will just point straight up from the ring...
1577 //
1578 vtx_normal[index].Set (0, 0, 1);
1579 vtx_normal[index + 1].Set (0, 0, 1);
1580
1581 //
1582 // Assign the UVs
1583 //
1584 vtx_uv[index].Set (u_value, 0.0F);
1585 vtx_uv[index + 1].Set (u_value, 1.0F);
1586 u_value += u_inc;
1587
1588 angle += angle_inc;
1589 }
1590
1591 //
1592 // Make the triangle strip...
1593 //
1594 for (index = 0; index < face_ct; index ++) {
1595 tri_poly[index].I = index;
1596 tri_poly[index].J = index+1;
1597 tri_poly[index].K = index+2;
1598 }
1599
1600 return ;
1601}
1602
1603
1604/***********************************************************************************************
1605 * RingMeshClass::~RingMeshClass -- Destructor *
1606 * *
1607 * INPUT: *
1608 * *
1609 * OUTPUT: *
1610 * *
1611 * WARNINGS: *
1612 * *
1613 * HISTORY: *
1614 * 3/07/00 jga : Created. *
1615 *=============================================================================================*/
1617{
1618 Free();
1619}
1620
1621/***********************************************************************************************
1622 * RingMeshClass::Free - Release Memory, that the ring mesh is using *
1623 * *
1624 * INPUT: *
1625 * *
1626 * OUTPUT: *
1627 * *
1628 * WARNINGS: *
1629 * *
1630 * HISTORY: *
1631 * 3/07/00 jga : Created. *
1632 *=============================================================================================*/
1633void RingMeshClass::Free(void)
1634{
1635
1636 if (vtx) delete vtx;
1637 if (orig_vtx) delete orig_vtx;
1638 if (vtx_normal) delete vtx_normal;
1639 if (vtx_uv) delete vtx_uv;
1640 if (tri_poly) delete tri_poly;
1641
1642 vtx = NULL;
1643 orig_vtx = NULL;
1644 vtx_normal = NULL;
1645 vtx_uv = NULL;
1646 tri_poly = NULL;
1647
1648} // Free
1649
1650// EOF - ringobj.cpp
#define NULL
Definition BaseType.h:92
void const char * value
Color scale(const Color &a, const Color &b)
Definition GameMtl.cpp:722
#define WWASSERT
#define SORT_LEVEL_NONE
Definition w3d_file.h:1195
#define W3D_NAME_LEN
Definition w3d_file.h:319
@ W3D_CHUNK_RING
Definition w3d_file.h:475
#define W3DNEWARRAY
Definition always.h:110
#define W3DNEW
Definition always.h:109
@ false
Definition bool.h:59
#define DEG_TO_RADF(x)
Definition wwmath.h:87
T Bound(T original, T minval, T maxval)
Definition bound.h:44
Vector3 Center
Definition aabox.h:123
Vector3 Extent
Definition aabox.h:124
bool Close_Chunk()
Definition chunkio.cpp:448
uint32 Cur_Chunk_ID()
Definition chunkio.cpp:484
uint32 Read(void *buf, uint32 nbytes)
Definition chunkio.cpp:692
bool Open_Chunk()
Definition chunkio.cpp:412
uint32 Write(const void *buf, uint32 nbytes)
Definition chunkio.cpp:264
bool Begin_Chunk(uint32 id)
Definition chunkio.cpp:108
bool End_Chunk()
Definition chunkio.cpp:148
static void Set_Vertex_Buffer(const VertexBufferClass *vb, unsigned stream=0)
static void Set_Texture(unsigned stage, TextureBaseClass *texture)
static void Set_Index_Buffer(const IndexBufferClass *ib, unsigned short index_base_offset)
static Vector4 Convert_Color(unsigned color)
Definition dx8wrapper.h:958
static void Draw_Triangles(unsigned buffer_type, unsigned short start_index, unsigned short polygon_count, unsigned short min_vertex_index, unsigned short vertex_count)
static void Set_Material(const VertexMaterialClass *material)
static void Set_Shader(const ShaderClass &shader)
static void Set_Transform(D3DTRANSFORMSTATETYPE transform, const Matrix4x4 &m)
VertexFormatXYZNDUV2 * Get_Formatted_Vertex_Array()
WWINLINE Vector3 Get_Z_Vector() const
Definition matrix3d.h:308
void Translate(float x, float y, float z)
Definition matrix3d.h:670
void Look_At(const Vector3 &p, const Vector3 &t, float roll)
Definition matrix3d.cpp:354
static void Add_Object(RenderObjClass *robj)
Definition predlod.cpp:226
CameraClass & Camera
Definition rinfo.h:100
virtual float Get_Screen_Size(CameraClass &camera)
Definition rendobj.cpp:324
virtual void Set_Transform(const Matrix3D &m)
Definition rendobj.cpp:423
virtual int Is_Not_Hidden_At_All(void)
Definition rendobj.h:463
RenderObjClass(void)
Definition rendobj.cpp:170
virtual void Set_Position(const Vector3 &v)
Definition rendobj.cpp:444
virtual const SphereClass & Get_Bounding_Sphere(void) const
Definition rendobj.h:567
virtual void Update_Cached_Bounding_Volumes(void) const
Definition rendobj.cpp:902
RenderObjClass & operator=(const RenderObjClass &)
Definition rendobj.cpp:232
static const float AT_MAX_LOD
Definition rendobj.h:405
const Matrix3D & Get_Transform(void) const
Definition rendobj.h:617
Matrix3D Transform
Definition rendobj.h:549
static const float AT_MIN_LOD
Definition rendobj.h:404
virtual PrototypeClass * Load_W3D(ChunkLoadClass &cload)
Definition ringobj.cpp:1194
void Scale(const Vector2 &inner_scale, const Vector2 &outer_scale)
Definition ringobj.cpp:1482
~RingMeshClass(void)
Definition ringobj.cpp:1616
RingMeshClass(void)
Definition ringobj.cpp:1440
friend class RingRenderObjClass
Definition ringobj.cpp:108
void Set_Tiling(int count)
Definition ringobj.cpp:1457
int Get_Num_Polys(void)
Definition ringobj.cpp:119
void Generate(float radius, int slices)
Definition ringobj.cpp:1531
bool Save(ChunkSaveClass &csave)
Definition ringobj.cpp:1318
virtual const char * Get_Name(void) const
Definition ringobj.cpp:1262
bool Load(ChunkLoadClass &cload)
Definition ringobj.cpp:1281
virtual RenderObjClass * Create(void)
Definition ringobj.cpp:1354
virtual int Get_Class_ID(void) const
Definition ringobj.cpp:1267
void Update_On_Visibilty(void)
Definition ringobj.cpp:1115
virtual float Get_Post_Increment_Value(void) const
Definition ringobj.cpp:995
Vector2 OuterScale
Definition ringobj.h:269
virtual RenderObjClass * Clone(void) const
Definition ringobj.cpp:635
virtual const char * Get_Name(void) const
Definition ringobj.cpp:484
~RingRenderObjClass(void)
Definition ringobj.cpp:305
virtual int Calculate_Cost_Value_Arrays(float screen_area, float *values, float *costs) const
Definition ringobj.cpp:1015
ShaderClass RingShader
Definition ringobj.h:275
Vector2 Get_Default_Outer_Scale(void) const
Definition ringobj.cpp:830
virtual int Class_ID(void) const
Definition ringobj.cpp:653
const AABoxClass & Get_Box(void)
Definition ringobj.h:312
Vector3 ObjSpaceExtent
Definition ringobj.h:258
void Set_Texture_Tiling(int count)
Definition ringobj.h:170
void Set_Alpha_Channel(const RingAlphaChannelClass &data)
Definition ringobj.h:221
RingScaleChannelClass OuterScaleChannel
Definition ringobj.h:250
static void Generate_Shared_Mesh_Arrays(void)
Definition ringobj.cpp:367
virtual float Get_Value(void) const
Definition ringobj.cpp:990
virtual void Scale(float scale)
Definition ringobj.cpp:1039
void Set_Texture(TextureClass *tf)
Definition ringobj.cpp:466
virtual float Get_Cost(void) const
Definition ringobj.cpp:985
void Set_Flags(unsigned int flags)
Definition ringobj.h:160
void Set_Inner_Extent(const Vector2 &extent)
Definition ringobj.h:284
virtual void Get_Obj_Space_Bounding_Sphere(SphereClass &sphere) const
Definition ringobj.cpp:938
void calculate_value_array(float screen_area, float *values) const
Definition ringobj.cpp:394
const RingScaleChannelClass & Peek_Outer_Scale_Channel(void)
Definition ringobj.h:218
virtual void Render(RenderInfoClass &rinfo)
Definition ringobj.cpp:671
virtual void Increment_LOD(void)
Definition ringobj.cpp:975
RingColorChannelClass ColorChannel
Definition ringobj.h:247
void Set_Outer_Extent(const Vector2 &extent)
Definition ringobj.h:289
Vector3 Get_Default_Color(void) const
Definition ringobj.cpp:752
TextureClass * RingTexture
Definition ringobj.h:276
const RingScaleChannelClass & Peek_Inner_Scale_Channel(void)
Definition ringobj.h:215
void Start_Animating(void)
Definition ringobj.h:165
void Stop_Animating(void)
Definition ringobj.h:166
AABoxClass CachedBox
Definition ringobj.h:278
char Name[2 *W3D_NAME_LEN]
Definition ringobj.h:256
const Vector2 & Get_Inner_Extent(void) const
Definition ringobj.h:189
virtual int Get_Num_Polys(void) const
Definition ringobj.cpp:449
bool Is_Animating(void)
Definition ringobj.h:164
void Init_Material(void)
Definition ringobj.cpp:418
virtual void Get_Obj_Space_Bounding_Box(AABoxClass &box) const
Definition ringobj.cpp:957
void Set_Local_Center_Extent(const Vector3 &center, const Vector3 &extent)
Definition ringobj.h:298
void animate(void)
Definition ringobj.cpp:1140
Vector2 OuterExtent
Definition ringobj.h:261
virtual int Get_LOD_Level(void) const
Definition ringobj.cpp:1005
RingRenderObjClass & operator=(const RingRenderObjClass &)
Definition ringobj.cpp:324
const RingAlphaChannelClass & Peek_Alpha_Channel(void)
Definition ringobj.h:212
void Set_Outer_Scale_Channel(const RingScaleChannelClass &data)
Definition ringobj.h:223
virtual void Special_Render(SpecialRenderInfoClass &rinfo)
Definition ringobj.cpp:856
Vector2 Get_Default_Inner_Scale(void) const
Definition ringobj.cpp:804
unsigned int Flags
Definition ringobj.h:272
virtual void Decrement_LOD(void)
Definition ringobj.cpp:980
float Get_Default_Alpha(void) const
Definition ringobj.cpp:778
void vis_render_ring(SpecialRenderInfoClass &rinfo, const Vector3 &center, const Vector3 &extent)
Definition ringobj.cpp:617
RingScaleChannelClass InnerScaleChannel
Definition ringobj.h:249
Vector2 InnerScale
Definition ringobj.h:268
VertexMaterialClass * RingMaterial
Definition ringobj.h:274
RingAlphaChannelClass AlphaChannel
Definition ringobj.h:248
Vector3 ObjSpaceCenter
Definition ringobj.h:257
virtual void Set_Name(const char *name)
Definition ringobj.cpp:502
virtual void Set_Position(const Vector3 &v)
Definition ringobj.cpp:900
void Set_Animation_Duration(float time)
Definition ringobj.h:204
float Value[RING_NUM_LOD+2]
Definition ringobj.h:245
unsigned int Get_Flags(void)
Definition ringobj.h:159
virtual void Set_Transform(const Matrix3D &m)
Definition ringobj.cpp:881
const RingColorChannelClass & Peek_Color_Channel(void)
Definition ringobj.h:209
virtual void Set_LOD_Level(int lod)
Definition ringobj.cpp:1000
virtual int Get_LOD_Count(void) const
Definition ringobj.cpp:1010
virtual void Prepare_LOD(CameraClass &camera)
Definition ringobj.cpp:964
const Vector2 & Get_Outer_Extent(void) const
Definition ringobj.h:190
virtual void update_cached_box(void)
Definition ringobj.cpp:919
void Set_Inner_Scale_Channel(const RingScaleChannelClass &data)
Definition ringobj.h:222
int Get_Texture_Tiling(void) const
Definition ringobj.h:169
void Set_Color_Channel(const RingColorChannelClass &data)
Definition ringobj.h:220
void render_ring(RenderInfoClass &rinfo, const Vector3 &center, const Vector3 &extent)
Definition ringobj.cpp:521
Vector2 InnerExtent
Definition ringobj.h:260
void Set_Cull_Mode(CullModeType x)
Definition shader.h:329
@ TEXTURING_DISABLE
Definition shader.h:219
@ TEXTURING_ENABLE
Definition shader.h:220
@ CULL_MODE_DISABLE
Definition shader.h:158
static ShaderClass _PresetAlphaShader
Definition shader.h:374
void Enable_Fog(const char *source)
Definition shader.cpp:280
@ ALPHATEST_DISABLE
Definition shader.h:96
@ DSTBLEND_ZERO
Definition shader.h:172
@ DSTBLEND_ONE
Definition shader.h:173
static void Insert_Triangles(const SphereClass &bounding_sphere, unsigned short start_index, unsigned short polygon_count, unsigned short min_vertex_index, unsigned short vertex_count)
VisRasterizerClass * VisRasterizer
Definition rinfo.h:153
float Radius
Definition sphere.h:91
Vector3 Center
Definition sphere.h:90
const StringClass & Get_Full_Path(void) const
Definition texture.h:113
float Y
Definition vector2.h:79
float X
Definition vector2.h:74
float X
Definition vector3.h:90
float Z
Definition vector3.h:92
float Y
Definition vector3.h:91
unsigned short K
Definition Vector3i.h:102
unsigned short J
Definition Vector3i.h:101
unsigned short I
Definition Vector3i.h:100
void Set_Model_Transform(const Matrix3D &model)
static void Convert_Vector(const W3dVectorStruct &v, Vector3 *set)
Definition w3d_util.cpp:45
static void Convert_Shader(const W3dShaderStruct &shader, ShaderClass *set)
Definition w3d_util.cpp:106
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 unsigned int Get_Frame_Time(void)
Definition ww3d.h:173
static void Add_To_Static_Sort_List(RenderObjClass *robj, unsigned int sort_level)
Definition ww3d.cpp:1984
static bool Are_Static_Sort_Lists_Enabled(void)
Definition ww3d.h:282
static bool Is_Sorting_Enabled(void)
Definition ww3d.h:220
static float Sin(float val)
Definition wwmath.h:378
static float Cos(float val)
Definition wwmath.h:356
const unsigned dynamic_fvf_type
@ BUFFER_TYPE_DYNAMIC_DX8
Definition dx8wrapper.h:90
@ BUFFER_TYPE_DYNAMIC_SORTING
Definition dx8wrapper.h:91
Vector3i16 TriIndex
else return(RetVal)
#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
RingLoaderClass _RingLoader
Definition ringobj.cpp:1392
RingMeshClass RingMeshArray[RING_NUM_LOD]
Definition ringobj.cpp:146
float RingLODCosts[RING_NUM_LOD+1]
Definition ringobj.cpp:147
@ CHUNKID_OUTER_SCALE_CHANNEL
Definition ringobj.cpp:1278
@ CHUNKID_RING_DEF
Definition ringobj.cpp:1274
@ CHUNKID_ALPHA_CHANNEL
Definition ringobj.cpp:1276
@ CHUNKID_COLOR_CHANNEL
Definition ringobj.cpp:1275
@ CHUNKID_INNER_SCALE_CHANNEL
Definition ringobj.cpp:1277
#define RING_HIGHEST_LOD
Definition ringobj.h:98
#define RING_NUM_LOD
Definition ringobj.h:96
#define RING_LOWEST_LOD
Definition ringobj.h:97
W3dVectorStruct Center
Definition ringobj.h:72
char Name[2 *W3D_NAME_LEN]
Definition ringobj.h:70
W3dVectorStruct Extent
Definition ringobj.h:73
char TextureName[2 *W3D_NAME_LEN]
Definition ringobj.h:85