22 #ifndef WATCHMAKER_T3D_MESH_H 23 #define WATCHMAKER_T3D_MESH_H 25 #include "watchmaker/3d/t3d_face.h" 26 #include "watchmaker/t3d.h" 37 uint16 NumNormals = 0;
38 uint16 NumVerticesNormals = 0;
39 gVertex *SavedVertexBuffer =
nullptr;
41 gVertex *OldVertexBuffer =
nullptr;
42 t3dV3F *VertsInterpolants =
nullptr;
52 t3dF32 BBoxAverageZ = 0.0f;
55 uint16 LightmapDim = 0;
61 uint8 BlendPercent = 0;
62 uint8 LastBlendPercent = 0;
63 uint32 ExpressionFrame = 0;
64 uint32 LastExpressionFrame = 0;
65 int32 *WaterBuffer1 =
nullptr;
66 int32 *WaterBuffer2 =
nullptr;
77 void saveVertexBuffer() {
78 this->VBptr = this->VertexBuffer;
79 if (this->OldVertexBuffer)
80 memcpy(this->OldVertexBuffer, this->VBptr,
sizeof(
gVertex)*this->NumVerts);
81 if (this->SavedVertexBuffer)
82 memcpy(this->SavedVertexBuffer, this->VBptr,
sizeof(
gVertex)*this->NumVerts);
83 this->VBptr =
nullptr;
86 void preCalcLights(
const t3dV3F &ambientLight) {
88 this->VBptr = this->VertexBuffer;
90 for (uint16 j = 0; j < this->NumFaces(); j++) {
94 uint32 rr = 0, gg = 0, bb = 0;
100 if (Material->hasFlag(T3D_MATERIAL_CLIPMAP)) {
102 Face.flags |= T3D_MATERIAL_CLIPMAP;
109 if (Material->hasFlag(T3D_MATERIAL_OPACITY)) {
110 Face.flags |= T3D_MATERIAL_OPACITY;
114 if (Material->hasFlag(T3D_MATERIAL_GLASS)) {
115 Face.flags |= T3D_MATERIAL_GLASS;
119 if (Material->hasFlag(T3D_MATERIAL_BOTTLE)) {
120 Face.flags |= T3D_MATERIAL_BOTTLE;
124 if (Material->hasFlag(T3D_MATERIAL_ADDITIVE)) {
125 Face.flags |= T3D_MATERIAL_ADDITIVE;
129 if (rr < ambientLight.x) rr = (uint8)ambientLight.x;
130 if (gg < ambientLight.y) gg = (uint8)ambientLight.y;
131 if (bb < ambientLight.z) bb = (uint8)ambientLight.z;
132 this->VBptr[Face.VertexIndex[0]].diffuse = RGBA_MAKE(rr, gg, bb, alphaval);
133 this->VBptr[Face.VertexIndex[1]].diffuse = RGBA_MAKE(rr, gg, bb, alphaval);
134 this->VBptr[Face.VertexIndex[2]].diffuse = RGBA_MAKE(rr, gg, bb, alphaval);
137 this->VBptr =
nullptr;
150 void releaseAnim(uint8 flag);
152 bool hasFaceMaterial()
const {
153 return !this->FList.
empty() && (bool)(this->FList[0].getMaterial());
156 void setMovieFrame(uint32 dwCurrFrame) {
158 if (!this->FList.
empty() && this->FList[0].getMaterial()) {
159 rSetMovieFrame(this->FList[0].getMaterial(), dwCurrFrame);
162 uint32 getMovieFrame() {
163 assert(!this->FList.
empty() && this->FList[0].getMaterial());
164 return rGetMovieFrame(this->FList[0].getMaterial());
170 #endif // WATCHMAKER_T3D_MESH_H
Definition: 2d_stuff.h:30
Definition: types3d.h:101
Definition: t3d_face.h:31
bool empty() const
Definition: array.h:351
Definition: t3d_body.h:32
Definition: t3d_mesh.h:30