22 #ifndef WATCHMAKER_T3D_H 23 #define WATCHMAKER_T3D_H 25 #include "common/array.h" 26 #include "common/stream.h" 27 #include "watchmaker/render.h" 28 #include "watchmaker/types.h" 29 #include "watchmaker/3d/types3d.h" 37 #define T3D_PI 3.14159265358979323846f 38 #define T3D_2PI (3.14159265358979323846f*2.0f) 39 #define DEGREE_TO_RADIANS(x) ((x)*T3D_PI/180.0f) 40 #define RADIANS_TO_DEGREE(x) ((x)*180.0f/T3D_PI) 42 #define T3D_NAMELEN 32 // default name len 43 #define T3D_MAX_LEVELS 5 // max bounds level per room 44 #define T3D_MAX_PATHNODES 1000 // max path nodes per walk 45 #define T3D_MAX_WALKSTEPS 4000 // max walk steps per walk 46 #define T3D_MAX_BLOCK_MESHES 3 // max block meshes per room 47 #define T3D_MAX_CHARACTERS 26 // max characters 48 #define T3D_MAX_SHADOWBOX_PER_CHAR 10 // max shadow box per character 51 #define T3D_NORMAL_INVISIBLE (1<<0) // invisible 52 #define T3D_NORMAL_VISIBLE (1<<1) // visible 55 #define T3D_MATRIX_IDENTITY (1<<0) // is identical 58 #define T3D_FACE_VISIBLE (1<<13) // is visiuble 59 #define T3D_FACE_CASTSHADOWS (1<<14) // cast shadows 60 #define T3D_FACE_RECEIVESHADOWS (1<<15) // receive shadows 63 #define T3D_MESH_CASTSHADOWS (1<<0) // Mesh cast shadow 64 #define T3D_MESH_RECEIVESHADOWS (1<<1) // Mesh receive shadows 65 #define T3D_MESH_NOLIGHTMAP (1<<2) // Mesh without lightmap 66 #define T3D_MESH_VISIBLE (1<<3) // Mesh visible 67 #define T3D_MESH_NOBOUNDBOX (1<<4) // Disable BoundBox check 68 #define T3D_MESH_NOPORTALCHECK (1<<5) // Disable Portal check 69 #define T3D_MESH_HIDDEN (1<<6) // Mesh Hidden 70 #define T3D_MESH_DEFAULTANIM (1<<7) // if takes animartions from the default set 71 #define T3D_MESH_CHARACTER (1<<8) // set if mesh is part of a character 72 #define T3D_MESH_PORTAL (1<<9) // mesh is a portal 73 #define T3D_MESH_MIRROR (1<<10) // mesh is a mirror 74 #define T3D_MESH_INVISIBLEFROMSECT (1<<11) // mesh is VISIBLE form the current sector 75 #define T3D_MESH_RAYBAN (1<<12) // mesh reject ray detection 76 #define T3D_MESH_ABS_ANIM (1<<13) // se animazione e' assoluta o relativa 77 #define T3D_MESH_LAST_DEFAULTANIM (1<<14) // if last frame was DEFAULTANIM 78 #define T3D_MESH_RECEIVERIPPLES (1<<15) // Mesh accepts ripples on it's material texture 79 #define T3D_MESH_WAVESTEXTURE (1<<16) // Waves textures on all the material textures 80 #define T3D_MESH_POOLWATER (1<<17) // Mesh accepts swimming pool water fx 81 #define T3D_MESH_PREPROCESSPORTAL (1<<18) // Preprocess portal for mesh visibilities 82 #define T3D_MESH_CASTREALTIMESHADOWS (1<<19) // Mesh calc realtime shadows using shadows-volumes 83 #define T3D_MESH_UPDATEVB (1<<20) // needs to update materail VB 84 #define T3D_MESH_ONLYINMIRRORS (1<<21) // appears only in mirrors 85 #define T3D_MESH_VIEWONLYPORTAL (1<<22) // if it's a View Only portal 86 #define T3D_MESH_PORTALPROCESSED (1<<23) // if it was just processed by another portal 87 #define T3D_MESH_ALWAYSVISIBLE (1<<24) // if this mesh is always visible 88 #define T3D_MESH_SOLARVARIATION (1<<25) // if change when sun moves 91 #define T3D_LIGHT_SPOTLIGHT (1<<0) // is a spot 92 #define T3D_LIGHT_LIGHTON (1<<1) // light is on 93 #define T3D_LIGHT_ATTENUATION (1<<2) // is attenuated 94 #define T3D_LIGHT_CASTSHADOWS (1<<3) // cast shadows 95 #define T3D_LIGHT_PULSE (1<<4) // is flicking 96 #define T3D_LIGHT_ALLLIGHTSOFF (1<<5) // turn off all the lights in the room 97 #define T3D_LIGHT_FLARE (1<<6) // is a flare 98 #define T3D_LIGHT_CANDLESMOKE (1<<7) // light from a moving candle 99 #define T3D_LIGHT_REALTIME (1<<8) // affects realtime objects 100 #define T3D_LIGHT_SUN (1<<9) // if it's the sunlight position 101 #define T3D_LIGHT_SOLARVARIATION (1<<10) // if change when sun moves 102 #define T3D_LIGHT_OFF_MORNING (1<<11) // disable during the morning 103 #define T3D_LIGHT_OFF_AFTERNOON (1<<12) // disable during the afternoon 104 #define T3D_LIGHT_OFF_EVENING (1<<13) // disable during the evening 105 #define T3D_LIGHT_OFF_NIGHT (1<<14) // disable during the night 108 #define T3D_CHARACTER_HIDE (1<<0) // is hidden 109 #define T3D_CHARACTER_ENABLEDINMIRROR (1<<1) // is in first person but enabled in the mirror 110 #define T3D_CHARACTER_CASTREALTIMESHADOWS (1<<2) // cast real time shadows 111 #define T3D_CHARACTER_REALTIMELIGHTING (1<<3) // needs realtime lighting 112 #define T3D_CHARACTER_VOLUMETRICLIGHTING (1<<4) // needs realtime volumetric lighting 113 #define T3D_CHARACTER_BNDHIDE (1<<5) // don't use char BND 114 #define T3D_CHARACTER_DIARYDISABLE (1<<6) // diable diary 130 t3dF32 *Dist =
nullptr;
132 uint16 NumFrames = 0;
138 BoneTable(old.BoneTable),
140 NumBones(old.NumBones),
141 NumFrames(old.NumFrames) {
143 old.BoneTable =
nullptr;
172 _morphModVertices.
reserve(morphNumModVertices);
173 if (morphNumModVertices) {
174 for (
int j = 0; j < morphNumModVertices; j++) {
197 t3dV3F TopLeft, BottomRight;
198 uint16 Row = 0, Col = 0;
208 uint32 CarrelloDist = 0;
221 t3dF32 NearClipPlane, FarClipPlane;
225 uint8 NumAvailablePaths()
const {
226 return CameraPaths.
size();
244 NearClipPlane = 0.0f, FarClipPlane = 0.0f;
249 void normalizedSight();
253 t3dF32 CellsSize = 0.0f;
263 uint16 ParticleIndex;
288 uint16 NumVisVerts()
const {
289 return VisVerts.
size();
300 t3dF32 NearRange, FarRange;
301 t3dF32 HotSpot, FallOff;
304 uint8 FlickerDelay = 0;
305 int8 LightRandomizer = 0;
307 t3dF32 FlareSize = 0;
315 void setupVisibleVerticesFromLight(
t3dBODY *b);
316 void SetVisibleFromLight(
gVertex *v);
329 t3dF32 x1 = 0.0f, z1 = 0.0f;
330 t3dF32 x2 = 0.0f, z2 = 0.0f;
331 t3dF32 bx1 = 0.0f, bz1 = 0.0f;
332 t3dF32 bx2 = 0.0f, bz2 = 0.0f;
338 float x = 0.0f, z = 0.0f;
348 int16 Act = 0, Frame = 0;
360 t3dF32 LookX = 0.0f, LookZ = 0.0f;
361 t3dF32 CurX = 0.0f, CurZ = 0.0f;
364 t3dSTEPS WalkSteps[T3D_MAX_WALKSTEPS] = {};
365 int32 CurrentStep = 0;
367 int32 NumPathNodes = 0;
369 int16 CurPanel = 0, OldPanel = 0;
370 int16 CurAction = 0, CurFrame = 0;
377 char Name[T3D_NAMELEN] = {};
386 SHADOWBOX *ShadowBox[T3D_MAX_SHADOWBOX_PER_CHAR] = {};
387 t3dF32 Radius = 0.0f, Height = 0.0f;
388 int32 CurExpressionSet = 0;
392 uint8 BlendPercent = 0;
393 int32 NumPathNodes = 0;
394 int32 CurrentStep = 0;
396 int16 CurAction = 0, CurFrame = 0;
398 t3dF32 posy = 0.0f, mposy = 0.0f;
404 #endif // WATCHMAKER_T3D_H
Definition: 2d_stuff.h:30
FORCEINLINE int32 readSint32LE()
Definition: stream.h:555
void clear()
Definition: array.h:320
Definition: work_dirs.h:30
void push_back(const T &element)
Definition: array.h:180
void reserve(size_type newCapacity)
Definition: array.h:396
Definition: t3d_body.h:32
Definition: t3d_mesh.h:30
size_type size() const
Definition: array.h:315
FORCEINLINE int16 readSint16LE()
Definition: stream.h:543
Definition: material.h:39