Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
rendobj.h
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/rendobj.h $*
26 * *
27 * Org Author:: Greg Hjelstrom *
28 * *
29 * Author : Kenny Mitchell *
30 * *
31 * $Modtime:: 06/27/02 9:23a $*
32 * *
33 * $Revision:: 14 $*
34 * *
35 * 06/27/02 KM Shader system classid addition *
36 * 07/01/02 KM Coltype enum change to avoid MAX conflicts *
37 *---------------------------------------------------------------------------------------------*
38 * Functions: *
39 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
40
41
42#if defined(_MSC_VER)
43#pragma once
44#endif
45
46#ifndef RENDOBJ_H
47#define RENDOBJ_H
48
49#include "always.h"
50#include "refcount.h"
51#include "sphere.h"
52#include "coltype.h"
53#include "aabox.h"
54#include "persist.h"
55#include "multilist.h"
56#include "robjlist.h"
57#include <float.h>
58
59class Vector3;
60class Matrix3D;
62class TextureClass;
63class SceneClass;
64class HTreeClass;
65class HAnimClass;
66class HAnimComboClass;
73class CameraClass;
74class SphereClass;
75class AABoxClass;
76class RenderInfoClass;
81class RenderObjProxyClass;
82class StringClass;
83template<class T> class DynamicVectorClass;
84
85// "unreferenced formal parameter"
86#pragma warning(disable : 4100)
87
88#ifdef DEFINE_W3DANIMMODE_NAMES
89static const char* TheAnimModeNames[] =
90{
91 "MANUAL",
92 "LOOP",
93 "ONCE",
94 "LOOP_PINGPONG",
95 "LOOP_BACKWARDS",
96 "ONCE_BACKWARDS",
97 NULL
98};
99#endif
100
101
103// RenderObjClass
104// This is the interface for all objects that get rendered by WW3D.
105//
106// Render object RTTI: If you really need to typecast a render object
107// pointer that you got from the asset manager, the class id mechanism
108// can be used to check what you really have. User class id's can come
109// after CLASSID_LAST.
110//
111// Cloning: All RenderObj's need to be able to clone themselves. This function
112// should create a new and separate RenderObj of the correct type and return a
113// RenderObj pointer to it. The implementation of this function will be
114// to simply call your copy constructor; its basically a virtual copy constructor.
115//
116// Rendering: If the render object is in a scene that is rendered and is determined
117// to be visible by that scene, it will receive a Render call. The argument
118// to the call will contain both the camera being used and the low level rendering
119// interface. In addition, the Special_Render function is for all "non-normal"
120// types of rendering. Some examples of this are: G-Buffer rendering (rendering
121// object ID's), shadow rendering (just use black, etc) and whatever else we
122// come up with. Basically it will be a function with a big switch statement
123// to handle all of these extra operations. This means the main render code
124// path is not cluttered with these checks while not forcing every object to
125// implement millions of separate special render functions. (Many objects just
126// pass the render calls onto their sub-objects).
127//
128// VertexProcessors: Vertex processors are classes that are not actually 'rendered'
129// They insert into the system an object that performs operations on all of
130// the subsequent vertices that are processed. Lights and Fogs are types of
131// vertex processors.
132//
133// "Scene Graph": A scene is organized as a list of render objects. There is no
134// implied hierarchical structure to a scene. RenderObjects can contain other
135// render objects (they follow the 'Composite' pattern) which is how hierarchical
136// objects are built. Hierarchical models are render objects that just
137// contain other render objects and apply hierarchical transforms to them.
138// Hierarchical Models can be inserted inside of other hierarchical models.
139//
140// Predictive LOD: The predictive LOD system selects LODs for the visible objects
141// so that the various resources (polys, vertices, etc.) do not pass given
142// budgets - the goal is to achieve a constant frame rate. This interface
143// includes things that are needed for this optimization process. Objects which
144// do not support changing their LOD should report that they have 1 LOD and
145// should report their cost to the LOD optimization system.
146//
147// Dependency Generation: Render objects are composed of one or more W3D and
148// texture files. This set of interfaces provides access to that dependency list.
149//
151
152// This is a small abstract class which a render object may have a pointer to. If present, its
153// Pre_Render and Post_Render calls will be called before and after the Render() call of this
154// render object. Applications using WW3D may create concrete classes deriving from this for
155// application-specific pre- and post- render processing. (the return value from Pre_Render
156// determines whether to perform the Render() call - if false, Render() will not be called).
158{
159public:
161 virtual ~RenderHookClass(void) { }
162 virtual bool Pre_Render(RenderObjClass *robj, RenderInfoClass &rinfo) = 0;
163 virtual void Post_Render(RenderObjClass *robj, RenderInfoClass &rinfo) = 0;
164private:
165 // Enforce no-copy semantics, for this and derived classes. This is done by making these
166 // private and not having definitions for them.
167 RenderHookClass(const RenderHookClass & src);
168 RenderHookClass & operator=(const RenderHookClass & src);
169};
170
171// RenderObjClass definition
173{
174public:
175
176 //Integer flag placed at the start of structure pointed to by
177 //User_Data to signal that it points at custom mesh material settings.
178 //Added for 'Generals' - MW
179 enum {USER_DATA_MATERIAL_OVERRIDE = 0x01234567};
180
181 //This strucutre is used to pass custom rendering parameters into the W3D
182 //mesh renderer so it can override settings which are usually shared across
183 //all instances of a model - typically material settings like alpha, texture
184 //animation, texture uv scrolling, etc. Added for 'Generals' -MW
187
188 int Struct_ID; //ID used to identify this structure from a pointer to it.
190 };
191
192 //
193 // Note: It is very important that these values NEVER CHANGE. That means
194 // when adding a new class id, it should be added to the end of the enum.
195 //
196 enum
197 {
198 CLASSID_UNKNOWN = 0xFFFFFFFF,
204 CLASSID_IMAGE3D, // Obsolete
206 CLASSID_BITMAP2D, // Obsolete
235 CLASSID_SHDMESH, // mesh class that uses the scaleable shader system
236 CLASSID_LAST = 0x0000FFFF
237 };
238
239 RenderObjClass(void);
240 RenderObjClass(const RenderObjClass & src);
242 virtual ~RenderObjClass(void) { if (RenderHook) delete RenderHook; }
243
244
246 // Render Object Interface - Cloning and Identification
248 virtual RenderObjClass * Clone(void) const = 0;
249 virtual int Class_ID(void) const { return CLASSID_UNKNOWN; }
250 virtual const char * Get_Name(void) const { return "UNNAMED"; }
251 virtual void Set_Name(const char * name) { }
252 virtual const char * Get_Base_Model_Name (void) const { return NULL; }
253 virtual void Set_Base_Model_Name (const char *name) { }
254 virtual int Get_Num_Polys(void) const { return 0; }
255
256
258 // Render Object Interface - Rendering
259 //
260 // Render - this object should render its polygons. Typically called from a SceneClass
261 // Special_Render - all special-case rendering goes here to avoid polluting the main render pipe (e.g. VIS)
262 // On_Frame_Update - render objects can register for an On_Frame_Update call; the scene will call this once
263 // per frame if they do so.
264 // Restart - This interface is used to facilitate model recycling. If a render object is "Restarted" it should
265 // put itself back into a state as if it has never been rendered (e.g. particle emitters
266 // should reset their "emitted particle counts" so they can be re-used.)
268 virtual void Render(RenderInfoClass & rinfo) = 0;
269 virtual void Special_Render(SpecialRenderInfoClass & rinfo) { }
270 virtual void On_Frame_Update() { }
271 virtual void Restart(void) { }
272
273
275 // Render Object Interface - "Scene Graph"
276 // Some of the functions in this group are non-virtual as they are meant
277 // to be never overriden or are supposed to be implemented in terms of
278 // the other virtual functions. We want to keep the virtual interface
279 // as small as possible
281 virtual void Add(SceneClass * scene);
282 virtual void Remove(void);
283 virtual SceneClass * Get_Scene(void);
284 virtual SceneClass * Peek_Scene(void) { return Scene; }
285 virtual void Set_Container(RenderObjClass * con);
286 virtual void Validate_Transform(void) const;
287
288#define GET_CONTAINER_INLINE
289#ifdef GET_CONTAINER_INLINE
290 // srj sez: this is called a ton and never overridden, so inline it
291 inline RenderObjClass * Get_Container(void) const { return Container; }
292#else
293 virtual RenderObjClass * Get_Container(void) const;
294#endif
295
296 virtual void Set_Transform(const Matrix3D &m);
297 virtual void Set_Position(const Vector3 &v);
298 const Matrix3D & Get_Transform(void) const;
299 const Matrix3D & Get_Transform(bool& is_transform_identity) const;
300 const Matrix3D & Get_Transform_No_Validity_Check(void) const;
301 const Matrix3D & Get_Transform_No_Validity_Check(bool& is_transform_identity) const;
302 bool Is_Transform_Identity() const;
304 Vector3 Get_Position(void) const;
305
306 virtual void Notify_Added(SceneClass * scene);
307 virtual void Notify_Removed(SceneClass * scene);
308
309 virtual int Get_Num_Sub_Objects(void) const { return 0; }
310 virtual RenderObjClass * Get_Sub_Object(int index) const { return NULL; }
311 virtual int Add_Sub_Object(RenderObjClass * subobj) { return 0; }
312 virtual int Remove_Sub_Object(RenderObjClass * robj) { return 0; }
313 virtual RenderObjClass * Get_Sub_Object_By_Name(const char * name, int *index=NULL) const;
314
315 virtual int Get_Num_Sub_Objects_On_Bone(int boneindex) const { return 0; }
316 virtual RenderObjClass * Get_Sub_Object_On_Bone(int index,int boneindex) const { return NULL; }
317 virtual int Get_Sub_Object_Bone_Index(RenderObjClass * subobj) const { return 0; }
318 virtual int Get_Sub_Object_Bone_Index(int LodIndex, int ModelIndex) const { return 0; }
319 virtual int Add_Sub_Object_To_Bone(RenderObjClass * subobj,int bone_index) { return 0; }
320 virtual int Add_Sub_Object_To_Bone(RenderObjClass * subobj,const char * bname);
321 virtual int Remove_Sub_Objects_From_Bone(int boneindex);
322 virtual int Remove_Sub_Objects_From_Bone(const char * bname);
323
324 // This is public only so objects can recursively call this on their sub-objects
325 virtual void Update_Sub_Object_Transforms(void);
326
327
329 // Render Object Interface - Hierarchical Animation
340
341 virtual void Set_Animation( void ) { }
342 virtual void Set_Animation( HAnimClass * motion,
343 float frame, int anim_mode = ANIM_MODE_MANUAL) { }
344 virtual void Set_Animation( HAnimClass * motion0,
345 float frame0,
346 HAnimClass * motion1,
347 float frame1,
348 float percentage) { }
349 virtual void Set_Animation( HAnimComboClass * anim_combo) { }
350
351 virtual HAnimClass * Peek_Animation( void ) { return NULL; }
352 virtual int Get_Num_Bones(void) { return 0; }
353 virtual const char * Get_Bone_Name(int bone_index) { return NULL; }
354 virtual int Get_Bone_Index(const char * bonename) { return 0; }
355 virtual const Matrix3D & Get_Bone_Transform(const char * bonename) { return Get_Transform(); }
356 virtual const Matrix3D & Get_Bone_Transform(int boneindex) { return Get_Transform(); }
357 virtual void Capture_Bone(int bindex) { }
358
359
360 virtual void Release_Bone(int bindex) { }
361 virtual bool Is_Bone_Captured(int bindex) const { return false; }
362 virtual void Control_Bone(int bindex,const Matrix3D & objtm,bool world_space_translation = false) { }
363 virtual const HTreeClass * Get_HTree(void) const { return NULL; }
364
366 // Render Object Interface - Collision Detection
367 // Cast_Ray - intersects a ray with the render object
368 // Cast_AABox - intersects a swept AABox with the render object
369 // Cast_OBBox - intersects a swept OBBox with the render object
370 // Intersect_AABox - boolean test for intersection between an AABox and the renderobj
371 // Intersect_OBBox - boolean test for intersection between an OBBox and the renderobj
372 // Intersect - tests a ray for intersection with the render object
373 // Intersect_Sphere - tests a ray for intersection with the bounding spheres
374 // Intersect_Sphere_Quick - tests a ray for intersection with bounding spheres
376 virtual bool Cast_Ray(RayCollisionTestClass & raytest) { return false; }
377 virtual bool Cast_AABox(AABoxCollisionTestClass & boxtest) { return false; }
378 virtual bool Cast_OBBox(OBBoxCollisionTestClass & boxtest) { return false; }
379
380 virtual bool Intersect_AABox(AABoxIntersectionTestClass & boxtest) { return false; }
381 virtual bool Intersect_OBBox(OBBoxIntersectionTestClass & boxtest) { return false; }
382
383 virtual bool Intersect(IntersectionClass *Intersection, IntersectionResultClass *Final_Result);
384 virtual bool Intersect_Sphere(IntersectionClass *Intersection, IntersectionResultClass *Final_Result);
385 virtual bool Intersect_Sphere_Quick(IntersectionClass *Intersection, IntersectionResultClass *Final_Result);
386
388 // Render Object Interface - Bounding Volumes
390 virtual const SphereClass & Get_Bounding_Sphere(void) const;
391 virtual const AABoxClass & Get_Bounding_Box(void) const;
392 virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const;
393 virtual void Get_Obj_Space_Bounding_Box(AABoxClass & box) const;
394 virtual void Update_Obj_Space_Bounding_Volumes(void) { };
395
396
398 // Render Object Interface - Predictive LOD
400
401 // Two constants for Value queries, which are returned instead of the
402 // current Value in certain cases. They are usually used as sentinels.
403 // AT_MIN_LOD is a very large positive number, AT_MAX_LOD is negative.
404 static const float AT_MIN_LOD;
405 static const float AT_MAX_LOD;
406
407 virtual void Prepare_LOD(CameraClass &camera);
408 virtual void Recalculate_Static_LOD_Factors(void) { }
409 virtual void Increment_LOD(void) { }
410 virtual void Decrement_LOD(void) { }
411 virtual float Get_Cost(void) const;
412 virtual float Get_Value(void) const { return AT_MIN_LOD; }
413 virtual float Get_Post_Increment_Value(void) const { return AT_MAX_LOD; }
414 virtual void Set_LOD_Level(int lod) { }
415 virtual int Get_LOD_Level(void) const { return 0; }
416 virtual int Get_LOD_Count(void) const { return 1; }
417 virtual void Set_LOD_Bias(float bias) { }
418 virtual int Calculate_Cost_Value_Arrays(float screen_area, float *values, float *costs) const;
419 virtual RenderObjClass * Get_Current_LOD(void) { Add_Ref(); return this; }
420
421
423 // Render Object Interface - Dependency Generation
425
426 //
427 // Note: The strings contained in these lists need to be freed by the caller.
428 // They should be freed using the delete operator.
429 //
430 // Be aware, these lists WILL contain duplicate entries.
431 //
432 virtual bool Build_Dependency_List (DynamicVectorClass<StringClass> &file_list, bool recursive=true);
433 virtual bool Build_Texture_List (DynamicVectorClass<StringClass> &texture_file_list, bool recursive=true);
434
436 // Render Object Interface - Decals
438 virtual void Create_Decal(DecalGeneratorClass * generator) { }
439 virtual void Delete_Decal(uint32 decal_id) { }
440
442 // Render Object Interface - Attributes, Options, Properties, etc
444 virtual MaterialInfoClass * Get_Material_Info(void) { return NULL; }
445 virtual void Set_User_Data(void *value, bool recursive = false) { User_Data = value; };
446 virtual void * Get_User_Data() { return User_Data; };
447 virtual int Get_Num_Snap_Points(void) { return 0; }
448 virtual void Get_Snap_Point(int index,Vector3 * set) { }
449// virtual float Calculate_Texture_Reduction_Factor(float norm_screensize);
450// virtual void Set_Texture_Reduction_Factor(float trf);
451 virtual float Get_Screen_Size(CameraClass &camera);
452 virtual void Scale(float scale) { };
453 virtual void Scale(float scalex, float scaley, float scalez) { };
454 virtual void Set_ObjectScale(float scale) { ObjectScale=scale;} //set's a scale factor that's factored into transform matrix. {ScaleFactor=scale; };
455 const float Get_ObjectScale( void ) const { return ObjectScale; };
456 void Set_ObjectColor(unsigned int color) { ObjectColor=color;} //the color that was used to modify the asset for player team color (for Generals). -MW
457 const unsigned int Get_ObjectColor( void ) const { return ObjectColor; };
458
459 virtual int Get_Sort_Level(void) const { return 0; /* SORT_LEVEL_NONE */ }
460 virtual void Set_Sort_Level(int level) { }
461
462 virtual int Is_Really_Visible(void) { return ((Bits & IS_REALLY_VISIBLE) == IS_REALLY_VISIBLE); }
464 virtual int Is_Visible(void) const { return (Bits & IS_VISIBLE); }
465 virtual void Set_Visible(int onoff) { if (onoff) { Bits |= IS_VISIBLE; } else { Bits &= ~IS_VISIBLE; } }
466
467// The cheatSpy has been put on ice until later... perhaps the next patch? - M Lorenzen
468 // virtual int Is_VisibleWithCheatSpy(void) const { return ((Bits&=~0x80) & (IS_VISIBLE); }
469// virtual void Set_VisibleWithCheatSpy(int onoff) { if (onoff) { Bits |= IS_VISIBLE|0x80; } else { Bits &= ~IS_VISIBLE; } }
470
471 virtual int Is_Hidden(void) const { return !(Bits & IS_NOT_HIDDEN); }
472 virtual void Set_Hidden(int onoff) { if (onoff) { Bits &= ~IS_NOT_HIDDEN; } else { Bits |= IS_NOT_HIDDEN; } }
473 virtual int Is_Animation_Hidden(void) const { return !(Bits & IS_NOT_ANIMATION_HIDDEN); }
474 virtual void Set_Animation_Hidden(int onoff) { if (onoff) { Bits &= ~IS_NOT_ANIMATION_HIDDEN; } else { Bits |= IS_NOT_ANIMATION_HIDDEN; } }
475 virtual int Is_Force_Visible(void) const { return Bits & IS_FORCE_VISIBLE; }
476 virtual void Set_Force_Visible(int onoff) { if (onoff) { Bits |= IS_FORCE_VISIBLE; } else { Bits &= ~IS_FORCE_VISIBLE; } }
477
478 virtual int Is_Translucent(void) const { return Bits & IS_TRANSLUCENT; }
479 virtual void Set_Translucent(int onoff) { if (onoff) { Bits |= IS_TRANSLUCENT; } else { Bits &= ~IS_TRANSLUCENT; } }
480 virtual int Is_Alpha(void) const { return Bits & IS_ALPHA; }
481 virtual void Set_Alpha(int onoff) { if (onoff) { Bits |= IS_ALPHA; } else { Bits &= ~IS_ALPHA; } }
482 virtual int Is_Additive(void) const { return Bits & IS_ADDITIVE; }
483 virtual void Set_Additive(int onoff) { if (onoff) { Bits |= IS_ADDITIVE; } else { Bits &= ~IS_ADDITIVE; } }
484 virtual int Get_Collision_Type(void) const { return (Bits & COLL_TYPE_MASK); }
485 virtual void Set_Collision_Type(int type) { Bits &= ~COLL_TYPE_MASK; Bits |= (type & COLL_TYPE_MASK) | COLL_TYPE_ALL; }
486 virtual bool Is_Complete(void) { return false; }
487 virtual bool Is_In_Scene(void) { return Scene != NULL; }
488 virtual float Get_Native_Screen_Size(void) const { return NativeScreenSize; }
489 virtual void Set_Native_Screen_Size(float screensize) { NativeScreenSize = screensize; }
490
491 void Set_Sub_Objects_Match_LOD(int onoff) { if (onoff) { Bits |= SUBOBJS_MATCH_LOD; } else { Bits &= ~SUBOBJS_MATCH_LOD; } }
493
496
497 void Set_Ignore_LOD_Cost(bool onoff) { if (onoff) { Bits |= IGNORE_LOD_COST; } else { Bits &= ~IGNORE_LOD_COST; } }
498 bool Is_Ignoring_LOD_Cost(void) { return (Bits & IGNORE_LOD_COST) != 0; }
499
502 int Is_Self_Shadowed() const { return (Bits&IS_SELF_SHADOWED); }
503
505 // Persistant object save-load interface
507 virtual const PersistFactoryClass & Get_Factory (void) const;
508 virtual bool Save (ChunkSaveClass &csave);
509 virtual bool Load (ChunkLoadClass &cload);
510
511 // Application-specific render hook:
514
515protected:
516
517 virtual void Add_Dependencies_To_List (DynamicVectorClass<StringClass> &file_list, bool textures_only = false);
518
519 virtual void Update_Cached_Bounding_Volumes(void) const;
520 virtual void Update_Sub_Object_Bits(void);
521
522 bool Bounding_Volumes_Valid(void) const { return (Bits & BOUNDING_VOLUMES_VALID) != 0; }
525
526 enum
527 {
528 COLL_TYPE_MASK = 0x000000FF,
529
530 IS_VISIBLE = 0x00000100,
531 IS_NOT_HIDDEN = 0x00000200,
533 IS_FORCE_VISIBLE = 0x00000800,
535 IS_TRANSLUCENT = 0x00004000, // is additive or alpha blended on any poly
536 IGNORE_LOD_COST = 0x00008000, // used to define if we should ignore object from LOD calculations
537 SUBOBJS_MATCH_LOD = 0x00010000, // force sub-objects to have same LOD level
538 SUBOBJ_TRANSFORMS_DIRTY = 0x00020000, // my sub-objects need me to update their transform
539 IS_ALPHA = 0x00040000, // added for Generals so we can default these meshes not to cast shadows. -MW
540 IS_ADDITIVE = 0x00100000, //added for Generals so we quickly determine what type of blending is on the mesh. -MW
541 IS_SELF_SHADOWED = 0x00080000, // the mesh is self shadowed
542 IS_CHEATER = 0x00100000,// the new cheat spy code uses these bits, since nothing else now does
546 };
547
548 mutable unsigned long Bits;
550 float ObjectScale; //user applied scaling factor inside Transform matrix.
551 unsigned int ObjectColor; //user applied coloring to the asset/prototype used to make this robj. - For Generals -MW
554 float NativeScreenSize; // The screen size at which the object was designed to be viewed (used in texture resizing).
556
559 void * User_Data;
560
562
563 friend class SceneClass;
565};
566
574
582
583/**************************************************************************
584 * Bound_Degrees -- Bounds a degree value between 0 and 360. *
585 * *
586 * INPUT: *
587 * *
588 * OUTPUT: *
589 * *
590 * WARNINGS: *
591 * *
592 * HISTORY: *
593 * 09/22/1997 PWG : Created. *
594 *========================================================================*/
595WWINLINE float Bound_Degrees(float angle)
596{
597 while (angle > 359) angle -= 360;
598 while (angle < 0) angle += 360;
599 return angle;
600}
601
602/***********************************************************************************************
603 * RenderObjClass::Get_Transform -- returns the transform for the object *
604 * *
605 * If the transform is invalid (a container has been moved or animated) then the transform *
606 * will be recalculated. *
607 * *
608 * INPUT: *
609 * *
610 * OUTPUT: *
611 * *
612 * WARNINGS: *
613 * *
614 * HISTORY: *
615 * 2/25/99 GTH : Created. *
616 *=============================================================================================*/
618{
620 return Transform;
621}
622
623WWINLINE const Matrix3D & RenderObjClass::Get_Transform(bool &is_transform_identity) const
624{
626 is_transform_identity=IsTransformIdentity;
627 return Transform;
628}
629
635
636// Warning: Be sure to call this function only if the transform is known to be valid!
641
642// Warning: Be sure to call this function only if the transform is known to be valid!
643WWINLINE const Matrix3D & RenderObjClass::Get_Transform_No_Validity_Check(bool& is_transform_identity) const
644{
645 is_transform_identity=IsTransformIdentity;
646 return Transform;
647}
648
649// Warning: Be sure to call this function only if the transform is known to be valid!
654
655
656
657
658#endif
#define NULL
Definition BaseType.h:92
void const char * value
Color scale(const Color &a, const Color &b)
Definition GameMtl.cpp:722
#define WWINLINE
Definition always.h:172
unsigned long uint32
Definition bittype.h:46
void Add_Ref(void) const
Definition refcount.cpp:171
RefCountClass(void)
Definition refcount.h:108
virtual void Post_Render(RenderObjClass *robj, RenderInfoClass &rinfo)=0
virtual bool Pre_Render(RenderObjClass *robj, RenderInfoClass &rinfo)=0
virtual ~RenderHookClass(void)
Definition rendobj.h:161
RenderHookClass(void)
Definition rendobj.h:160
virtual float Get_Screen_Size(CameraClass &camera)
Definition rendobj.cpp:324
unsigned long Bits
Definition rendobj.h:548
const unsigned int Get_ObjectColor(void) const
Definition rendobj.h:457
virtual void Create_Decal(DecalGeneratorClass *generator)
Definition rendobj.h:438
virtual void Set_User_Data(void *value, bool recursive=false)
Definition rendobj.h:445
virtual int Is_Hidden(void) const
Definition rendobj.h:471
@ USER_DATA_MATERIAL_OVERRIDE
Definition rendobj.h:179
virtual int Is_Animation_Hidden(void) const
Definition rendobj.h:473
virtual void Decrement_LOD(void)
Definition rendobj.h:410
virtual bool Intersect_Sphere_Quick(IntersectionClass *Intersection, IntersectionResultClass *Final_Result)
Definition rendobj.cpp:1034
@ IS_NOT_ANIMATION_HIDDEN
Definition rendobj.h:532
@ SUBOBJ_TRANSFORMS_DIRTY
Definition rendobj.h:538
@ IS_NOT_HIDDEN_AT_ALL
Definition rendobj.h:544
@ BOUNDING_VOLUMES_VALID
Definition rendobj.h:534
virtual RenderObjClass * Get_Sub_Object_On_Bone(int index, int boneindex) const
Definition rendobj.h:316
void Set_Ignore_LOD_Cost(bool onoff)
Definition rendobj.h:497
Vector3 Get_Position(void) const
Definition rendobj.cpp:508
virtual void Set_Animation(HAnimComboClass *anim_combo)
Definition rendobj.h:349
virtual void Capture_Bone(int bindex)
Definition rendobj.h:357
virtual void Set_Transform(const Matrix3D &m)
Definition rendobj.cpp:423
virtual void Get_Obj_Space_Bounding_Sphere(SphereClass &sphere) const
Definition rendobj.cpp:932
const float Get_ObjectScale(void) const
Definition rendobj.h:455
virtual int Get_Num_Sub_Objects_On_Bone(int boneindex) const
Definition rendobj.h:315
virtual int Is_Visible(void) const
Definition rendobj.h:464
virtual int Is_Translucent(void) const
Definition rendobj.h:478
void Validate_Cached_Bounding_Volumes(void) const
Definition rendobj.h:524
virtual int Is_Not_Hidden_At_All(void)
Definition rendobj.h:463
bool Is_Ignoring_LOD_Cost(void)
Definition rendobj.h:498
RenderObjClass(void)
Definition rendobj.cpp:170
virtual void Set_Translucent(int onoff)
Definition rendobj.h:479
@ ANIM_MODE_LOOP_PINGPONG
Definition rendobj.h:336
@ ANIM_MODE_LOOP_BACKWARDS
Definition rendobj.h:337
@ ANIM_MODE_ONCE_BACKWARDS
Definition rendobj.h:338
virtual float Get_Post_Increment_Value(void) const
Definition rendobj.h:413
virtual void Get_Snap_Point(int index, Vector3 *set)
Definition rendobj.h:448
int Is_Sub_Objects_Match_LOD_Enabled(void)
Definition rendobj.h:492
virtual void On_Frame_Update()
Definition rendobj.h:270
virtual int Is_Additive(void) const
Definition rendobj.h:482
virtual int Get_LOD_Count(void) const
Definition rendobj.h:416
virtual void Increment_LOD(void)
Definition rendobj.h:409
virtual void Set_Visible(int onoff)
Definition rendobj.h:465
virtual void Set_Position(const Vector3 &v)
Definition rendobj.cpp:444
virtual int Get_LOD_Level(void) const
Definition rendobj.h:415
virtual const Matrix3D & Get_Bone_Transform(const char *bonename)
Definition rendobj.h:355
virtual void Update_Obj_Space_Bounding_Volumes(void)
Definition rendobj.h:394
float NativeScreenSize
Definition rendobj.h:554
virtual const SphereClass & Get_Bounding_Sphere(void) const
Definition rendobj.h:567
AABoxClass CachedBoundingBox
Definition rendobj.h:553
friend class RenderObjProxyClass
Definition rendobj.h:564
virtual bool Build_Dependency_List(DynamicVectorClass< StringClass > &file_list, bool recursive=true)
Definition rendobj.cpp:1052
virtual void Notify_Added(SceneClass *scene)
Definition rendobj.cpp:862
virtual int Remove_Sub_Objects_From_Bone(int boneindex)
Definition rendobj.cpp:602
virtual void Update_Sub_Object_Transforms(void)
Definition rendobj.cpp:777
virtual void Delete_Decal(uint32 decal_id)
Definition rendobj.h:439
void Unset_Is_Self_Shadowed()
Definition rendobj.h:501
virtual SceneClass * Get_Scene(void)
Definition rendobj.cpp:361
RenderObjClass * Container
Definition rendobj.h:558
virtual int Get_Num_Snap_Points(void)
Definition rendobj.h:447
virtual void Get_Obj_Space_Bounding_Box(AABoxClass &box) const
Definition rendobj.cpp:952
virtual void Update_Cached_Bounding_Volumes(void) const
Definition rendobj.cpp:902
virtual void Set_Name(const char *name)
Definition rendobj.h:251
void Invalidate_Cached_Bounding_Volumes(void) const
Definition rendobj.h:523
virtual void Set_Base_Model_Name(const char *name)
Definition rendobj.h:253
unsigned int ObjectColor
Definition rendobj.h:551
virtual int Is_Really_Visible(void)
Definition rendobj.h:462
virtual void Set_Collision_Type(int type)
Definition rendobj.h:485
virtual void Set_Animation(HAnimClass *motion, float frame, int anim_mode=ANIM_MODE_MANUAL)
Definition rendobj.h:342
virtual float Get_Cost(void) const
Definition rendobj.cpp:675
virtual const AABoxClass & Get_Bounding_Box(void) const
Definition rendobj.h:575
virtual ~RenderObjClass(void)
Definition rendobj.h:242
virtual bool Intersect_Sphere(IntersectionClass *Intersection, IntersectionResultClass *Final_Result)
Definition rendobj.cpp:1015
virtual void Update_Sub_Object_Bits(void)
Definition rendobj.cpp:730
RenderObjClass & operator=(const RenderObjClass &)
Definition rendobj.cpp:232
virtual int Get_Sub_Object_Bone_Index(int LodIndex, int ModelIndex) const
Definition rendobj.h:318
SceneClass * Scene
Definition rendobj.h:557
void Set_Sub_Object_Transforms_Dirty(bool onoff)
Definition rendobj.h:494
virtual const HTreeClass * Get_HTree(void) const
Definition rendobj.h:363
virtual bool Is_Bone_Captured(int bindex) const
Definition rendobj.h:361
virtual bool Intersect_OBBox(OBBoxIntersectionTestClass &boxtest)
Definition rendobj.h:381
virtual void Set_Sort_Level(int level)
Definition rendobj.h:460
virtual const char * Get_Base_Model_Name(void) const
Definition rendobj.h:252
virtual int Add_Sub_Object_To_Bone(RenderObjClass *subobj, int bone_index)
Definition rendobj.h:319
virtual const PersistFactoryClass & Get_Factory(void) const
Definition rendobj.cpp:1297
virtual void Scale(float scalex, float scaley, float scalez)
Definition rendobj.h:453
void Set_Sub_Objects_Match_LOD(int onoff)
Definition rendobj.h:491
virtual int Get_Num_Bones(void)
Definition rendobj.h:352
static const float AT_MAX_LOD
Definition rendobj.h:405
virtual int Class_ID(void) const
Definition rendobj.h:249
void Set_Is_Self_Shadowed()
Definition rendobj.h:500
RenderHookClass * Get_Render_Hook(void)
Definition rendobj.h:512
virtual void Set_Hidden(int onoff)
Definition rendobj.h:472
virtual const char * Get_Bone_Name(int bone_index)
Definition rendobj.h:353
RenderHookClass * RenderHook
Definition rendobj.h:561
virtual void Set_Force_Visible(int onoff)
Definition rendobj.h:476
int Is_Self_Shadowed() const
Definition rendobj.h:502
virtual void Scale(float scale)
Definition rendobj.h:452
virtual void Set_Alpha(int onoff)
Definition rendobj.h:481
virtual RenderObjClass * Clone(void) const =0
bool IsTransformIdentity
Definition rendobj.h:555
virtual const Matrix3D & Get_Bone_Transform(int boneindex)
Definition rendobj.h:356
virtual bool Is_In_Scene(void)
Definition rendobj.h:487
bool Are_Sub_Object_Transforms_Dirty(void)
Definition rendobj.h:495
virtual bool Save(ChunkSaveClass &csave)
Definition rendobj.cpp:1302
virtual void Set_LOD_Bias(float bias)
Definition rendobj.h:417
virtual void Add_Dependencies_To_List(DynamicVectorClass< StringClass > &file_list, bool textures_only=false)
Definition rendobj.cpp:1136
virtual void Notify_Removed(SceneClass *scene)
Definition rendobj.cpp:884
virtual void Set_Container(RenderObjClass *con)
Definition rendobj.cpp:382
virtual RenderObjClass * Get_Current_LOD(void)
Definition rendobj.h:419
virtual void Set_Animation(void)
Definition rendobj.h:341
virtual const char * Get_Name(void) const
Definition rendobj.h:250
const Matrix3D & Get_Transform(void) const
Definition rendobj.h:617
virtual void Validate_Transform(void) const
Definition rendobj.cpp:464
virtual int Calculate_Cost_Value_Arrays(float screen_area, float *values, float *costs) const
Definition rendobj.cpp:703
virtual void Recalculate_Static_LOD_Factors(void)
Definition rendobj.h:408
virtual void Restart(void)
Definition rendobj.h:271
virtual float Get_Native_Screen_Size(void) const
Definition rendobj.h:488
virtual bool Load(ChunkLoadClass &cload)
Definition rendobj.cpp:1313
virtual int Get_Num_Sub_Objects(void) const
Definition rendobj.h:309
virtual void Set_LOD_Level(int lod)
Definition rendobj.h:414
virtual SceneClass * Peek_Scene(void)
Definition rendobj.h:284
bool Is_Transform_Identity_No_Validity_Check() const
Definition rendobj.h:650
virtual MaterialInfoClass * Get_Material_Info(void)
Definition rendobj.h:444
virtual bool Cast_AABox(AABoxCollisionTestClass &boxtest)
Definition rendobj.h:377
virtual bool Build_Texture_List(DynamicVectorClass< StringClass > &texture_file_list, bool recursive=true)
Definition rendobj.cpp:1090
virtual int Is_Alpha(void) const
Definition rendobj.h:480
virtual RenderObjClass * Get_Sub_Object_By_Name(const char *name, int *index=NULL) const
Definition rendobj.cpp:527
virtual void Release_Bone(int bindex)
Definition rendobj.h:360
virtual void Remove(void)
Definition rendobj.cpp:816
virtual bool Cast_Ray(RayCollisionTestClass &raytest)
Definition rendobj.h:376
virtual HAnimClass * Peek_Animation(void)
Definition rendobj.h:351
friend class SceneClass
Definition rendobj.h:563
virtual void Prepare_LOD(CameraClass &camera)
Definition rendobj.cpp:645
virtual bool Cast_OBBox(OBBoxCollisionTestClass &boxtest)
Definition rendobj.h:378
virtual int Is_Force_Visible(void) const
Definition rendobj.h:475
bool Bounding_Volumes_Valid(void) const
Definition rendobj.h:522
RenderObjClass * Get_Container(void) const
Definition rendobj.h:291
Matrix3D Transform
Definition rendobj.h:549
@ CLASSID_PREDLODGROUP
Definition rendobj.h:202
@ CLASSID_VIEWPOINTGROUP
Definition rendobj.h:217
@ CLASSID_SCREENPOINTGROUP
Definition rendobj.h:216
@ CLASSID_WORLDPOINTGROUP
Definition rendobj.h:218
@ CLASSID_DYNASCREENMESH
Definition rendobj.h:209
@ CLASSID_SEGLINETRAIL
Definition rendobj.h:233
@ CLASSID_PARTICLEEMITTER
Definition rendobj.h:214
@ CLASSID_PARTICLEBUFFER
Definition rendobj.h:215
void Set_ObjectColor(unsigned int color)
Definition rendobj.h:456
virtual int Get_Bone_Index(const char *bonename)
Definition rendobj.h:354
virtual void Set_Native_Screen_Size(float screensize)
Definition rendobj.h:489
virtual void Control_Bone(int bindex, const Matrix3D &objtm, bool world_space_translation=false)
Definition rendobj.h:362
virtual void * Get_User_Data()
Definition rendobj.h:446
virtual RenderObjClass * Get_Sub_Object(int index) const
Definition rendobj.h:310
virtual int Add_Sub_Object(RenderObjClass *subobj)
Definition rendobj.h:311
virtual void Set_ObjectScale(float scale)
Definition rendobj.h:454
float ObjectScale
Definition rendobj.h:550
bool Is_Transform_Identity() const
Definition rendobj.h:630
virtual int Get_Collision_Type(void) const
Definition rendobj.h:484
virtual void Add(SceneClass *scene)
Definition rendobj.cpp:795
virtual int Get_Num_Polys(void) const
Definition rendobj.h:254
void * User_Data
Definition rendobj.h:559
virtual bool Intersect(IntersectionClass *Intersection, IntersectionResultClass *Final_Result)
Definition rendobj.cpp:972
virtual bool Is_Complete(void)
Definition rendobj.h:486
virtual void Set_Animation_Hidden(int onoff)
Definition rendobj.h:474
virtual int Get_Sort_Level(void) const
Definition rendobj.h:459
virtual int Remove_Sub_Object(RenderObjClass *robj)
Definition rendobj.h:312
virtual void Set_Additive(int onoff)
Definition rendobj.h:483
SphereClass CachedBoundingSphere
Definition rendobj.h:552
virtual void Special_Render(SpecialRenderInfoClass &rinfo)
Definition rendobj.h:269
virtual bool Intersect_AABox(AABoxIntersectionTestClass &boxtest)
Definition rendobj.h:380
void Set_Render_Hook(RenderHookClass *hook)
Definition rendobj.h:513
virtual int Get_Sub_Object_Bone_Index(RenderObjClass *subobj) const
Definition rendobj.h:317
const Matrix3D & Get_Transform_No_Validity_Check(void) const
Definition rendobj.h:637
static const float AT_MIN_LOD
Definition rendobj.h:404
virtual float Get_Value(void) const
Definition rendobj.h:412
virtual void Set_Animation(HAnimClass *motion0, float frame0, HAnimClass *motion1, float frame1, float percentage)
Definition rendobj.h:344
virtual void Render(RenderInfoClass &rinfo)=0
@ COLL_TYPE_ALL
Definition coltype.h:75
WWINLINE float Bound_Degrees(float angle)
Definition rendobj.h:595