Tiberian Technologies Scripts Reference Revision: 9000
Loading...
Searching...
No Matches
boxrenderobjclass.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_BOXRENDEROBJCLASS_H
13#define TT_INCLUDE_BOXRENDEROBJCLASS_H
14#include "RenderObjClass.h"
15#include "w3d.h"
16#include "obboxclass.h"
17#include "AABoxClass.h"
18#include "prototypeclass.h"
19class BoxRenderObjClass : public RenderObjClass
20{
21protected:
22 static bool IsInitted;
23 static int DisplayMask;
24 char Name[32];
25 Vector3 Color;
26 Vector3 ObjSpaceCenter;
27 Vector3 ObjSpaceExtent;
28 float Opacity;
29public:
30 static void Init();
31 static void Shutdown();
32 static void Set_Box_Display_Mask(int mask);
33 static int Get_Box_Display_Mask();
34 BoxRenderObjClass(const BoxRenderObjClass& src);
35 BoxRenderObjClass(const W3dBoxStruct& src);
36 BoxRenderObjClass();
37 BoxRenderObjClass& operator=(const BoxRenderObjClass& that);
38 virtual const char* Get_Name () const { return Name; }
39 virtual void Set_Name (const char *name)
40 {
41 strcpy_s(Name,name);
42 }
43 virtual int Get_Num_Polys () const { return 0xC; }
44 virtual void update_cached_box() = 0;
45 void Set_Color(const Vector3 &color);
46 void render_box(RenderInfoClass& rinfo,const Vector3 &center,const Vector3 &extent);
47 void vis_render_box(RenderInfoClass& rinfo,const Vector3 &center,const Vector3 &extent);
48 void Set_Opacity(float opacity) {Opacity = opacity;}
49 const Vector3 &Get_Local_Center() {return ObjSpaceCenter;}
50 const Vector3 &Get_Local_Extent() {return ObjSpaceExtent;}
51 void Set_Local_Center_Extent(const Vector3 &center,const Vector3 &extent)
52 {
53 ObjSpaceCenter = center;
54 ObjSpaceExtent = extent;
55 update_cached_box();
56 }
57};
58class OBBoxRenderObjClass : public BoxRenderObjClass
59{
60public:
61 OBBoxClass CachedBox;
62 OBBoxRenderObjClass(const OBBoxRenderObjClass& src);
63 OBBoxRenderObjClass(const W3dBoxStruct& src);
64 OBBoxRenderObjClass();
65 OBBoxRenderObjClass& operator=(const OBBoxRenderObjClass& that);
66 OBBoxRenderObjClass(const OBBoxClass& src);
67 virtual RenderObjClass* Clone () const;
68 virtual int Class_ID () const;
69 virtual void Render (RenderInfoClass& rinfo);
70 virtual void Special_Render (SpecialRenderInfoClass& rinfo);
71 virtual void Set_Transform (const Matrix3D& tm);
72 virtual void Set_Position (const Vector3& pos);
73 virtual bool Cast_Ray (RayCollisionTestClass& col);
74 virtual bool Cast_AABox (AABoxCollisionTestClass& col);
75 virtual bool Cast_OBBox (OBBoxCollisionTestClass& col);
76 virtual bool Intersect_AABox (AABoxIntersectionTestClass& col);
77 virtual bool Intersect_OBBox (OBBoxIntersectionTestClass& col);
78 virtual void Get_Obj_Space_Bounding_Sphere (SphereClass& sphere) const;
79 virtual void Get_Obj_Space_Bounding_Box (AABoxClass& box) const;
80 virtual void update_cached_box();
81 OBBoxClass &Get_Box()
82 {
83 Validate_Transform();
84 update_cached_box();
85 return CachedBox;
86 }
87};
88class AABoxRenderObjClass : public BoxRenderObjClass {
89public:
90 AABoxClass CachedBox;
91 AABoxRenderObjClass(const AABoxRenderObjClass& src);
92 AABoxRenderObjClass(const W3dBoxStruct& src);
93 AABoxRenderObjClass();
94 AABoxRenderObjClass& operator=(const AABoxRenderObjClass& that);
95 AABoxRenderObjClass(const AABoxClass& src);
96 virtual RenderObjClass* Clone () const;
97 virtual int Class_ID () const;
98 virtual void Render (RenderInfoClass& rinfo);
99 virtual void Special_Render (SpecialRenderInfoClass& rinfo);
100 virtual void Set_Transform (const Matrix3D& tm);
101 virtual void Set_Position (const Vector3& pos);
102 virtual bool Cast_Ray (RayCollisionTestClass& col);
103 virtual bool Cast_AABox (AABoxCollisionTestClass& col);
104 virtual bool Cast_OBBox (OBBoxCollisionTestClass& col);
105 virtual bool Intersect_AABox (AABoxIntersectionTestClass& col);
106 virtual bool Intersect_OBBox (OBBoxIntersectionTestClass& col);
107 virtual void Get_Obj_Space_Bounding_Sphere (SphereClass& sphere) const;
108 virtual void Get_Obj_Space_Bounding_Box (AABoxClass& box) const;
109 virtual void update_cached_box();
110 AABoxClass &Get_Box()
111 {
112 Validate_Transform();
113 update_cached_box();
114 return CachedBox;
115 }
116};
117class BoxLoaderClass : public PrototypeLoaderClass
118{
119public:
120 virtual int Chunk_Type(void)
121 {
122 return 0x740;
123 }
124 virtual PrototypeClass *Load_W3D(ChunkLoadClass & cload);
125};
126extern BoxLoaderClass _BoxLoader;
127#endif