Tiberian Technologies Scripts Reference Revision: 9000
Loading...
Searching...
No Matches
StaticPhysClass.h
1/* Renegade Scripts.dll
2 Copyright 2013 Tiberian Technologies
3
4 This file is part of the Renegade scripts.dll
5 The Renegade scripts.dll is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free
7 Software Foundation; either version 2, or (at your option) any later
8 version. See the file COPYING for more details.
9 In addition, an exemption is given to allow Run Time Dynamic Linking of this code with any closed source module that does not contain code covered by this licence.
10 Only the source code to the module(s) containing the licenced code has to be released.
11*/
12#ifndef TT_INCLUDE__STATICPHYSCLASS_H
13#define TT_INCLUDE__STATICPHYSCLASS_H
14
15#include "PhysClass.h"
16#include "PhysIntTest.h"
17#include "PhysColTest.h"
18class StaticPhysDefClass;
19class StaticPhysClass : public PhysClass
20{
21public:
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)
32 {
33 if (Model->Cast_Ray(raytest))
34 {
35 raytest.CollidedPhysObj = this;
36 return true;
37 }
38 else
39 {
40 return false;
41 }
42 }
43 virtual bool Cast_AABox(PhysAABoxCollisionTestClass & boxtest)
44 {
45 if (Model->Cast_AABox(boxtest))
46 {
47 boxtest.CollidedPhysObj = this;
48 return true;
49 }
50 else
51 {
52 return false;
53 }
54 }
55 virtual bool Cast_OBBox(PhysOBBoxCollisionTestClass & boxtest)
56 {
57 if (Model->Cast_OBBox(boxtest))
58 {
59 boxtest.CollidedPhysObj = this;
60 return true;
61 }
62 else
63 {
64 return false;
65 }
66 }
67 virtual bool Intersection_Test(PhysAABoxIntersectionTestClass & test)
68 {
69 if (Model->Intersect_AABox(test))
70 {
71 test.Add_Intersected_Object(this);
72 return true;
73 }
74 return false;
75 }
76 virtual bool Intersection_Test(PhysOBBoxIntersectionTestClass & test)
77 {
78 if (Model->Intersect_OBBox(test))
79 {
80 test.Add_Intersected_Object(this);
81 return true;
82 }
83 return false;
84 }
85 virtual bool Intersection_Test(PhysMeshIntersectionTestClass & test)
86 {
87 return false;
88 }
89 bool Intersects(const OBBoxClass & obbox)
90 {
91 CastResultStruct result;
92 PhysOBBoxCollisionTestClass boxtest(obbox,Vector3(0,0,0),&result,TERRAIN_COLLISION_GROUP,COLLISION_TYPE_ALL);
93 Cast_OBBox(boxtest);
94 return result.StartBad;
95 }
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);
119protected:
120 void Update_Cached_Model_Parameters(void);
121 virtual void Update_Sun_Status(void);
122protected:
123 int VisSectorID; // set if this static object contains a vis sector mesh (-1 if not)
124private:
125 static bool _DisableStaticPhysSimulation;
126 static bool _DisableStaticPhysRendering;
127 StaticPhysClass(const StaticPhysClass &);
128 StaticPhysClass & operator = (const StaticPhysClass &);
129}; // 007C 007C 0098 0094
130
131
132#endif