|
|
@ -46,27 +46,22 @@ typedef struct |
|
|
unsigned short nextframe; // If non-zero, the texture is animated and this points to the next texture in the sequence |
|
|
unsigned short nextframe; // If non-zero, the texture is animated and this points to the next texture in the sequence |
|
|
} ps1bsp_texture_t; |
|
|
} ps1bsp_texture_t; |
|
|
|
|
|
|
|
|
// This matches the SVECTOR data type, using the extra padding to store vertex color data. |
|
|
|
|
|
// The full range and precision required cannot be stored in just shorts, so we make use of a floating origin stored in the BSP leafs. |
|
|
|
|
|
// With this the higher-order bits of each vertex position are calculated into the model-view matrix, giving good precision for polygons near the camera. |
|
|
|
|
|
|
|
|
// This matches the SVECTOR data type; we can use the extra padding to store some more data. |
|
|
typedef struct |
|
|
typedef struct |
|
|
{ |
|
|
{ |
|
|
short x; |
|
|
short x; |
|
|
short y; |
|
|
short y; |
|
|
short z; |
|
|
short z; |
|
|
unsigned char baseLight, finalLight; // Used for gouraud shading based on static lightmap data |
|
|
|
|
|
|
|
|
|
|
|
// Sampled color value from the face texture, for untextured gouraud shaded drawing |
|
|
|
|
|
unsigned char a : 1; // 0 = opaque, 1 = semi-transparent |
|
|
|
|
|
unsigned char r : 5; |
|
|
|
|
|
unsigned char g : 5; |
|
|
|
|
|
unsigned char b : 5; |
|
|
|
|
|
|
|
|
short pad; |
|
|
} ps1bsp_vertex_t; |
|
|
} ps1bsp_vertex_t; |
|
|
|
|
|
|
|
|
typedef struct |
|
|
typedef struct |
|
|
{ |
|
|
{ |
|
|
unsigned short index; |
|
|
unsigned short index; |
|
|
unsigned short light; |
|
|
unsigned short light; |
|
|
|
|
|
|
|
|
|
|
|
// TODO: add texture uv's |
|
|
|
|
|
// TODO: add sampled texture color * light, for untextured gouraud shaded drawing at range |
|
|
} ps1bsp_facevertex_t; |
|
|
} ps1bsp_facevertex_t; |
|
|
|
|
|
|
|
|
typedef struct |
|
|
typedef struct |
|
|
@ -77,7 +72,7 @@ typedef struct |
|
|
unsigned short firstFaceVertex; |
|
|
unsigned short firstFaceVertex; |
|
|
unsigned short numFaceVertices; |
|
|
unsigned short numFaceVertices; |
|
|
|
|
|
|
|
|
SVECTOR centerPoint; |
|
|
|
|
|
|
|
|
SVECTOR center; |
|
|
|
|
|
|
|
|
u_long drawFrame; // Which frame was this face last drawn on? Used to check if this face should be drawn. |
|
|
u_long drawFrame; // Which frame was this face last drawn on? Used to check if this face should be drawn. |
|
|
} ps1bsp_face_t; |
|
|
} ps1bsp_face_t; |
|
|
@ -94,7 +89,7 @@ typedef struct |
|
|
int planeId; |
|
|
int planeId; |
|
|
short children[2]; |
|
|
short children[2]; |
|
|
|
|
|
|
|
|
// TODO: add bounding box for frustum culling |
|
|
|
|
|
|
|
|
// TODO: add bounding box for frustum culling (or bounding sphere, might be cheaper) |
|
|
|
|
|
|
|
|
u_short firstFace; |
|
|
u_short firstFace; |
|
|
u_short numFaces; |
|
|
u_short numFaces; |
|
|
@ -105,7 +100,8 @@ typedef struct |
|
|
int type; |
|
|
int type; |
|
|
int vislist; |
|
|
int vislist; |
|
|
|
|
|
|
|
|
// TODO: add bounding box for frustum culing |
|
|
|
|
|
|
|
|
// TODO: add bounding box for frustum culling (or do we? could save half the number of bounds checks if we only check nodes) |
|
|
|
|
|
//SVECTOR center; |
|
|
|
|
|
|
|
|
u_short firstLeafFace; |
|
|
u_short firstLeafFace; |
|
|
u_short numLeafFaces; |
|
|
u_short numLeafFaces; |
|
|
|