rev |
line source |
nuclear@0
|
1 #ifndef _OBJECTS_H_
|
nuclear@0
|
2 #define _OBJECTS_H_
|
nuclear@0
|
3
|
nuclear@0
|
4 #include <string>
|
nuclear@0
|
5 #include "3dengine.h"
|
nuclear@0
|
6 #include "n3dmath.h"
|
nuclear@0
|
7 #include "3dgeom.h"
|
nuclear@0
|
8 #include "material.h"
|
nuclear@0
|
9 #include "motion.h"
|
nuclear@0
|
10
|
nuclear@0
|
11 class Object {
|
nuclear@0
|
12 protected:
|
nuclear@0
|
13 GraphicsContext *gc;
|
nuclear@0
|
14 RenderParams rendp;
|
nuclear@0
|
15
|
nuclear@0
|
16 TriMesh *mesh;
|
nuclear@0
|
17 TriMesh **ShadowVolumes;
|
nuclear@0
|
18 int ShadowCount;
|
nuclear@0
|
19 bool CastShadows;
|
nuclear@0
|
20
|
nuclear@0
|
21 Matrix4x4 WorldXForm;
|
nuclear@0
|
22 // Matrix4x4 TransMat, RotMat, ScaleMat, GRotMat;
|
nuclear@0
|
23 Matrix4x4 TextureMatrix;
|
nuclear@0
|
24 bool UseTextureMatrix;
|
nuclear@0
|
25
|
nuclear@0
|
26 bool AutoSetZWrite;
|
nuclear@0
|
27
|
nuclear@0
|
28 void Render2TexUnits();
|
nuclear@0
|
29 void Render4TexUnits();
|
nuclear@0
|
30 void Render8TexUnits();
|
nuclear@0
|
31
|
nuclear@0
|
32 public:
|
nuclear@0
|
33 std::string name;
|
nuclear@0
|
34 Material material;
|
nuclear@0
|
35 MotionController controller;
|
nuclear@0
|
36
|
nuclear@0
|
37 Matrix4x4 TransMat, RotMat, ScaleMat, GRotMat;
|
nuclear@0
|
38
|
nuclear@0
|
39 Object(GraphicsContext *gc, byte DetailLevels = 1);
|
nuclear@0
|
40 ~Object();
|
nuclear@0
|
41
|
nuclear@0
|
42 TriMesh *GetTriMesh();
|
nuclear@0
|
43
|
nuclear@0
|
44 void ResetTransform();
|
nuclear@0
|
45 void ResetTranslation();
|
nuclear@0
|
46 void ResetRotation();
|
nuclear@0
|
47 void ResetGlobalRotation();
|
nuclear@0
|
48 void ResetScaling();
|
nuclear@0
|
49
|
nuclear@0
|
50 void Translate(float tx, float ty, float tz);
|
nuclear@0
|
51 void Rotate(float rx, float ry, float rz);
|
nuclear@0
|
52 void Rotate(const Vector3 &axis, float angle);
|
nuclear@0
|
53 void Rotate(const Matrix4x4 &rot);
|
nuclear@0
|
54 void GlobalRotate(float rx, float ry, float rz);
|
nuclear@0
|
55 void GlobalRotate(const Vector3 &axis, float angle);
|
nuclear@0
|
56 void GlobalRotate(const Matrix4x4 &rot);
|
nuclear@0
|
57 void Scale(float sx, float sy, float sz);
|
nuclear@0
|
58
|
nuclear@0
|
59 void SetTranslation(float tx, float ty, float tz);
|
nuclear@0
|
60 void SetRotation(float rx, float ry, float rz);
|
nuclear@0
|
61 void SetRotation(const Vector3 &axis, float angle);
|
nuclear@0
|
62 void SetRotation(const Matrix4x4 &rot);
|
nuclear@0
|
63 void SetGlobalRotation(float rx, float ry, float rz);
|
nuclear@0
|
64 void SetGlobalRotation(const Vector3 &axis, float angle);
|
nuclear@0
|
65 void SetGlobalRotation(const Matrix4x4 &rot);
|
nuclear@0
|
66 void SetScaling(float sx, float sy, float sz);
|
nuclear@0
|
67
|
nuclear@0
|
68 const Matrix4x4 GetWorldTransform() const;
|
nuclear@0
|
69
|
nuclear@0
|
70 void SetTextureMatrix(Matrix4x4 mat);
|
nuclear@0
|
71 Matrix4x4 GetTextureMatrix() const;
|
nuclear@0
|
72
|
nuclear@0
|
73 // set render parameters
|
nuclear@0
|
74 void SetVertexProgram(dword VertexProgram);
|
nuclear@0
|
75 void SetPixelProgram(dword PixelProgram);
|
nuclear@0
|
76 void SetShadingMode(ShadeMode smode);
|
nuclear@0
|
77 void SetWriteZBuffer(bool enable);
|
nuclear@0
|
78 void SetBlendFunc(BlendingFactor src, BlendingFactor dest);
|
nuclear@0
|
79 void GetBlendFunc(BlendingFactor *src, BlendingFactor *dest);
|
nuclear@0
|
80
|
nuclear@0
|
81 // about shadows
|
nuclear@0
|
82 void CalculateShadows(const Light **lights, int LightCount);
|
nuclear@0
|
83 TriMesh *GetShadowVolume(int light);
|
nuclear@0
|
84 void SetShadowCasting(bool enable);
|
nuclear@0
|
85 bool GetShadowCasting() const;
|
nuclear@0
|
86
|
nuclear@0
|
87 void SetRenderStates();
|
nuclear@0
|
88 void Render();
|
nuclear@0
|
89 void RenderBare();
|
nuclear@0
|
90
|
nuclear@0
|
91 // generate geometry
|
nuclear@0
|
92 void CreatePlane(float size, dword subdivisions);
|
nuclear@0
|
93 void CreateCube(float size);
|
nuclear@0
|
94 };
|
nuclear@0
|
95
|
nuclear@0
|
96
|
nuclear@0
|
97 #endif // _OBJECTS_H_ |