12#ifndef TT_INCLUDE__STATICPHYSCLASS_H
13#define TT_INCLUDE__STATICPHYSCLASS_H
16#include "PhysIntTest.h"
17#include "PhysColTest.h"
18class StaticPhysDefClass;
19class StaticPhysClass :
public PhysClass
22 StaticPhysClass(
void);
23 ~StaticPhysClass(
void);
24 virtual StaticPhysClass * As_StaticPhysClass(
void) {
return this; }
25 StaticPhysDefClass * Get_StaticPhysDef(
void) {
return (StaticPhysDefClass *)Definition; }
26 void Init(
const StaticPhysDefClass & def);
27 virtual bool Needs_Timestep(
void) {
return false; }
28 virtual void Timestep(
float dt) { };
29 virtual void Set_Model(RenderObjClass * model);
30 virtual void Render_Vis_Meshes(RenderInfoClass & rinfo);
31 virtual bool Cast_Ray(PhysRayCollisionTestClass & raytest)
33 if (Model->Cast_Ray(raytest))
35 raytest.CollidedPhysObj =
this;
43 virtual bool Cast_AABox(PhysAABoxCollisionTestClass & boxtest)
45 if (Model->Cast_AABox(boxtest))
47 boxtest.CollidedPhysObj =
this;
55 virtual bool Cast_OBBox(PhysOBBoxCollisionTestClass & boxtest)
57 if (Model->Cast_OBBox(boxtest))
59 boxtest.CollidedPhysObj =
this;
67 virtual bool Intersection_Test(PhysAABoxIntersectionTestClass & test)
69 if (Model->Intersect_AABox(test))
71 test.Add_Intersected_Object(
this);
76 virtual bool Intersection_Test(PhysOBBoxIntersectionTestClass & test)
78 if (Model->Intersect_OBBox(test))
80 test.Add_Intersected_Object(
this);
85 virtual bool Intersection_Test(PhysMeshIntersectionTestClass & test)
89 bool Intersects(
const OBBoxClass & obbox)
91 CastResultStruct result;
92 PhysOBBoxCollisionTestClass boxtest(obbox,Vector3(0,0,0),&result,TERRAIN_COLLISION_GROUP,COLLISION_TYPE_ALL);
94 return result.StartBad;
96 virtual const AABoxClass & Get_Bounding_Box(
void)
const;
97 virtual const Matrix3D & Get_Transform(
void)
const;
98 virtual void Set_Transform(
const Matrix3D & m);
99 int Is_Occluder(
void);
100 bool Is_Model_Pre_Lit(
void);
101 bool Is_Model_User_Lit(
void);
102 void Set_Vis_Sector_ID(
int new_id);
103 int Get_Vis_Sector_ID(
void)
const {
return VisSectorID; }
104 bool Is_Vis_Sector(RenderObjClass * model = NULL)
const;
105 virtual bool Is_Simulation_Disabled(
void) {
return _DisableStaticPhysSimulation; }
106 virtual bool Is_Rendering_Disabled(
void) {
return _DisableStaticPhysRendering || PhysClass::Is_Rendering_Disabled(); }
107 static void Disable_All_Simulation(
bool onoff) { _DisableStaticPhysSimulation = onoff; }
108 static void Disable_All_Rendering(
bool onoff) { _DisableStaticPhysRendering = onoff; }
109 static bool Is_All_Simulation_Disabled(
void) {
return _DisableStaticPhysSimulation; }
110 static bool Is_All_Rendering_Disabled(
void) {
return _DisableStaticPhysRendering; }
111 virtual bool Has_Dynamic_State(
void) {
return false; }
112 virtual void Save_State(ChunkSaveClass & csave) { }
113 virtual void Load_State(ChunkLoadClass & cload) { }
114 virtual const PersistFactoryClass & Get_Factory (
void)
const;
115 virtual bool Save (ChunkSaveClass &csave);
116 virtual bool Load (ChunkLoadClass &cload);
117 virtual void On_Post_Load(
void);
118 float Compute_Vis_Mesh_Ram(RenderObjClass * model = NULL);
120 void Update_Cached_Model_Parameters(
void);
121 virtual void Update_Sun_Status(
void);
125 static bool _DisableStaticPhysSimulation;
126 static bool _DisableStaticPhysRendering;
127 StaticPhysClass(
const StaticPhysClass &);
128 StaticPhysClass & operator = (
const StaticPhysClass &);