My Project: openb3dlib.mod/openb3d/src/shadow.h Source File

My Project

shadow.h
Go to the documentation of this file.
1 /*
2 * shadow.h
3 * minib3d
4 *
5 *
6 */
7
8 #ifndef SHADOW_H
9 #define SHADOW_H
10
11 #include "entity.h"
12 #include "camera.h"
13 #include "mesh.h"
14 #include "surface.h"
15
16
17 class ShadowTriangle{
18 public:
19 int surf;
20 int tris;
21 float v1x, v1y, v1z;
22 float v2x, v2y, v2z;
23 float v3x, v3y, v3z;
24 float tf_v1x, tf_v1y, tf_v1z;
25 float tf_v2x, tf_v2y, tf_v2z;
26 float tf_v3x, tf_v3y, tf_v3z;
27 float nx, ny, nz;
28 int cull;
29 int ta, tb, tc;
30 ShadowTriangle* id_ta;
31 ShadowTriangle* id_tb;
32 ShadowTriangle* id_tc;
33
34 };
35
36 class Edge{
37 Surface* surf;
38 float data[7];
39
40 Edge* Copy(){
41 Edge* C = new Edge;
42 C->surf = surf;
43 for (int i=0;i<=6;i++){
44 C->data[i] = data[i];
45 }
46 return C;
47 }
48 };
49
50 class ShadowObject{
51 public:
52 static list<ShadowObject*> shadow_list;
53
54 Mesh* Parent;
55 int cnt_tris;
56 vector<ShadowTriangle*> Tri;
57 Mesh* ShadowMesh;
58 Surface* ShadowVolume;
59 Surface* ShadowCap;
60 char Render;
61 char Static;
62 char VCreated;
63
64 static float VolumeLength;
65
66 static char top_caps;
67 static int parallel;
68
69 static float light_x;
70 static float light_y;
71 static float light_z;
72 static int midStencilVal;
73 static float ShadowRed;
74 static float ShadowGreen;
75 static float ShadowBlue;
76 static float ShadowAlpha;
77 /*static int Time;
78 static int Frame;*/
79 static int RenderedVolumes;
80
81 void FreeShadow();
82 static ShadowObject* Create(Mesh* Parent, char Static = false);
83 static void SetShadowColor(int R = 0,int G = 0, int B = 0, int A = 0.5);
84 static void ShadowInit();
85 void RemoveShadowfromMesh(Mesh* M);
86 static void Update(Camera* Cam);
87 static void RenderVolume();
88 void UpdateAnim();
89 void Init();
90 void InitShadow();
91 void UpdateCaster();
92 static void ShadowRenderWorldZFail();
93 };
94
95 #endif
96
ShadowTriangle::tf_v1x
float tf_v1x
Definition: shadow.h:24
ShadowObject::ShadowMesh
Mesh * ShadowMesh
Definition: shadow.h:57
ShadowObject::Parent
Mesh * Parent
Definition: shadow.h:54
ShadowTriangle::v1y
float v1y
Definition: shadow.h:21
entity.h
Mesh
Definition: mesh.h:34
M
#define M(row, col)
RemoveShadowfromMesh
void RemoveShadowfromMesh(ShadowObject *obj, Mesh *M)
Definition: methods.cpp:340
ShadowObject::top_caps
static char top_caps
Definition: shadow.h:66
ShadowObject::Render
char Render
Definition: shadow.h:60
ShadowTriangle::tf_v2z
float tf_v2z
Definition: shadow.h:25
ShadowObject::light_y
static float light_y
Definition: shadow.h:70
Surface
Definition: surface.h:19
ShadowInit
void ShadowInit()
Definition: methods.cpp:336
ShadowObject::midStencilVal
static int midStencilVal
Definition: shadow.h:72
ShadowTriangle::surf
int surf
Definition: shadow.h:19
camera.h
B
#define B(row, col)
ShadowTriangle::tf_v1z
float tf_v1z
Definition: shadow.h:24
mesh.h
ShadowTriangle::ta
int ta
Definition: shadow.h:29
ShadowTriangle::v3z
float v3z
Definition: shadow.h:23
ShadowTriangle::v1x
float v1x
Definition: shadow.h:21
ShadowTriangle::v2y
float v2y
Definition: shadow.h:22
Camera
Definition: camera.h:23
ShadowTriangle::nz
float nz
Definition: shadow.h:27
ShadowTriangle
Definition: shadow.h:17
RenderVolume
void RenderVolume()
Definition: methods.cpp:348
Edge
Definition: shadow.h:36
InitShadow
void InitShadow(ShadowObject *obj)
Definition: methods.cpp:360
ShadowObject
Definition: shadow.h:50
ShadowObject::shadow_list
static list< ShadowObject * > shadow_list
Definition: shadow.h:52
UpdateCaster
void UpdateCaster(ShadowObject *obj)
Definition: methods.cpp:364
UpdateAnim
void UpdateAnim(ShadowObject *obj)
Definition: methods.cpp:352
ShadowTriangle::v2z
float v2z
Definition: shadow.h:22
ShadowObject::parallel
static int parallel
Definition: shadow.h:67
ShadowObject::Tri
vector< ShadowTriangle * > Tri
Definition: shadow.h:56
ShadowTriangle::nx
float nx
Definition: shadow.h:27
ShadowTriangle::tf_v1y
float tf_v1y
Definition: shadow.h:24
ShadowObject::light_z
static float light_z
Definition: shadow.h:71
ShadowObject::VolumeLength
static float VolumeLength
Definition: shadow.h:64
ShadowTriangle::id_tb
ShadowTriangle * id_tb
Definition: shadow.h:31
ShadowObject::ShadowAlpha
static float ShadowAlpha
Definition: shadow.h:76
ShadowTriangle::tc
int tc
Definition: shadow.h:29
ShadowObject::light_x
static float light_x
Definition: shadow.h:69
ShadowObject::ShadowBlue
static float ShadowBlue
Definition: shadow.h:75
ShadowObject::ShadowRed
static float ShadowRed
Definition: shadow.h:73
ShadowTriangle::tf_v3x
float tf_v3x
Definition: shadow.h:26
FreeShadow
void FreeShadow(ShadowObject *shad)
Definition: functions.cpp:890
ShadowObject::cnt_tris
int cnt_tris
Definition: shadow.h:55
ShadowObject::ShadowGreen
static float ShadowGreen
Definition: shadow.h:74
ShadowTriangle::id_ta
ShadowTriangle * id_ta
Definition: shadow.h:30
ShadowObject::ShadowVolume
Surface * ShadowVolume
Definition: shadow.h:58
ShadowTriangle::cull
int cull
Definition: shadow.h:28
ShadowTriangle::v2x
float v2x
Definition: shadow.h:22
ShadowTriangle::tb
int tb
Definition: shadow.h:29
SetShadowColor
void SetShadowColor(int R, int G, int B, int A)
Definition: methods.cpp:332
surface.h
ShadowObject::RenderedVolumes
static int RenderedVolumes
Definition: shadow.h:79
ShadowObject::ShadowCap
Surface * ShadowCap
Definition: shadow.h:59
ShadowObject::Static
char Static
Definition: shadow.h:61
ShadowTriangle::tf_v3y
float tf_v3y
Definition: shadow.h:26
ShadowTriangle::tf_v3z
float tf_v3z
Definition: shadow.h:26
ShadowRenderWorldZFail
void ShadowRenderWorldZFail()
Definition: methods.cpp:368
ShadowTriangle::tris
int tris
Definition: shadow.h:20
ShadowTriangle::tf_v2y
float tf_v2y
Definition: shadow.h:25
ShadowTriangle::tf_v2x
float tf_v2x
Definition: shadow.h:25
ShadowTriangle::v3y
float v3y
Definition: shadow.h:23
ShadowTriangle::v3x
float v3x
Definition: shadow.h:23
ShadowTriangle::v1z
float v1z
Definition: shadow.h:21
A
#define A(row, col)
ShadowTriangle::id_tc
ShadowTriangle * id_tc
Definition: shadow.h:32
ShadowTriangle::ny
float ny
Definition: shadow.h:27
ShadowObject::VCreated
char VCreated
Definition: shadow.h:62