#define SHADERSTAGE_NORMAL 1
#define SHADERSTAGE_COUNT 2
-#define SHADERFLAGS_NEEDLIGHTMAP 1
-
#define SURF_PLANEBACK 2
#define SURF_DRAWSKY 4
#define SURF_DRAWTURB 0x10
#define SURF_DRAWNOALPHA 0x100
#define SURF_DRAWFULLBRIGHT 0x200
#define SURF_LIGHTBOTHSIDES 0x400
-#define SURF_SHADOWCAST 0x1000 // this polygon can cast stencil shadows
-#define SURF_SHADOWLIGHT 0x2000 // this polygon can be lit by stencil shadowing
#define SURF_WATERALPHA 0x4000 // this polygon's alpha is modulated by r_wateralpha
#define SURF_SOLIDCLIP 0x8000 // this polygon blocks movement
struct entity_render_s;
struct texture_s;
struct msurface_s;
-// change this stuff when real shaders are added
-typedef struct Cshader_s
-{
- void (*shaderfunc[SHADERSTAGE_COUNT])(const struct entity_render_s *ent, const struct texture_s *texture, struct msurface_s **surfchain);
- int flags;
-}
-Cshader_t;
-
-extern Cshader_t Cshader_wall_lightmap;
-extern Cshader_t Cshader_water;
-extern Cshader_t Cshader_sky;
typedef struct texture_s
{
// loaded the same as model skins
skinframe_t skin;
- // shader to use for this texture
- Cshader_t *shader;
-
// total frames in sequence and alternate sequence
int anim_total[2];
// direct pointers to each of the frames in the sequences
// LordHavoc: replaces glpoly, triangle mesh
typedef struct surfmesh_s
{
- // can be multiple meshs per surface
- struct surfmesh_s *chain;
- int numverts; // number of vertices in the mesh
- int numtriangles; // number of triangles in the mesh
- float *vertex3f; // float[verts*3] vertex locations
- float *svector3f; // float[verts*3] direction of 'S' (right) texture axis for each vertex
- float *tvector3f; // float[verts*3] direction of 'T' (down) texture axis for each vertex
- float *normal3f; // float[verts*3] direction of 'R' (out) texture axis for each vertex
- int *lightmapoffsets; // index into surface's lightmap samples for vertex lighting
- float *texcoordtexture2f; // float[verts*2] texcoords for surface texture
- float *texcoordlightmap2f; // float[verts*2] texcoords for lightmap texture
- float *texcoorddetail2f; // float[verts*2] texcoords for detail texture
- int *element3i; // int[tris*3] triangles of the mesh, 3 indices into vertex arrays for each
- int *neighbor3i; // int[tris*3] neighboring triangle on each edge (-1 if none)
+ int num_vertices; // number of vertices in the mesh
+ int num_triangles; // number of triangles in the mesh
+ float *data_vertex3f; // float[verts*3] vertex locations
+ float *data_svector3f; // float[verts*3] direction of 'S' (right) texture axis for each vertex
+ float *data_tvector3f; // float[verts*3] direction of 'T' (down) texture axis for each vertex
+ float *data_normal3f; // float[verts*3] direction of 'R' (out) texture axis for each vertex
+ int *data_lightmapoffsets; // index into surface's lightmap samples for vertex lighting
+ float *data_texcoordtexture2f; // float[verts*2] texcoords for surface texture
+ float *data_texcoordlightmap2f; // float[verts*2] texcoords for lightmap texture
+ float *data_texcoorddetail2f; // float[verts*2] texcoords for detail texture
+ int *data_element3i; // int[tris*3] triangles of the mesh, 3 indices into vertex arrays for each
+ int *data_neighbor3i; // int[tris*3] neighboring triangle on each edge (-1 if none)
}
surfmesh_t;
// the lightmap texture fragment to use on the rendering mesh
rtexture_t *lightmaptexture;
// mesh for rendering
- surfmesh_t *mesh;
+ surfmesh_t mesh;
// if lightmap settings changed, this forces update
int cached_dlight;
int poly_numverts;
float *poly_verts;
+ // index into model->brush.shadowmesh
+ int num_firstshadowmeshtriangle;
+
// neighboring surfaces (one per poly_numverts)
//struct msurface_s **neighborsurfaces;
// currently used only for generating static shadow volumes
- int castshadow;
+ int lighttemp_castshadow;
+
+ // avoid redundent surface shadows
+ int shadowmark;
}
msurface_t;
vec3_t mins;
vec3_t maxs;
+ mplane_t *plane; // != NULL
// node specific
- mplane_t *plane;
struct mnode_s *children[2];
unsigned short firstsurface;
vec3_t mins;
vec3_t maxs;
+ mplane_t *plane; // == NULL
// leaf specific
// next leaf in pvschain
struct mleaf_s *pvschain;
// used by polygon-through-portals visibility checker
int portalmarkid;
- qbyte *compressed_vis;
+ // -1 is not in pvs, >= 0 is pvs bit number
+ int clusterindex;
int *firstmarksurface;
int nummarksurfaces;
#define Q3FACETYPE_POLYGON 1 // common
#define Q3FACETYPE_PATCH 2 // common
#define Q3FACETYPE_MESH 3 // common
-#define Q3FACETYPE_BILLBOARD 4 // rare (is this ever used?)
+#define Q3FACETYPE_FLARE 4 // rare (is this ever used?)
typedef struct
{
int numvertices;
int firstelement;
int numelements;
- int lightmapindex;
- int lightmap_base[2]; // only needed by lighting util
- int lightmap_size[2]; // only needed by lighting util
- float lightmap_origin[3]; // only needed by lighting util
- float lightmap_vectors[2][3]; // only needed by lighting util
- float normal[3]; // only needed by lighting util
- int patchsize[2]; // size for Q3FACETYPE_PATCH
+ int lightmapindex; // -1 if none
+ int lightmap_base[2];
+ int lightmap_size[2];
+ union
+ {
+ struct
+ {
+ // corrupt or don't care
+ int blah[14];
+ }
+ unknown;
+ struct
+ {
+ // Q3FACETYPE_POLYGON
+ // polygon is simply a convex polygon, renderable as a mesh
+ float lightmap_origin[3];
+ float lightmap_vectors[2][3];
+ float normal[3];
+ int unused1[2];
+ }
+ polygon;
+ struct
+ {
+ // Q3FACETYPE_PATCH
+ // patch renders as a bezier mesh, with adjustable tesselation
+ // level (optionally based on LOD using the bbox and polygon
+ // count to choose a tesselation level)
+ // note: multiple patches may have the same bbox to cause them to
+ // be LOD adjusted together as a group
+ int unused1[3];
+ float mins[3]; // LOD bbox
+ float maxs[3]; // LOD bbox
+ int unused2[3];
+ int patchsize[2]; // dimensions of vertex grid
+ }
+ patch;
+ struct
+ {
+ // Q3FACETYPE_MESH
+ // mesh renders as simply a triangle mesh
+ int unused1[3];
+ float mins[3];
+ float maxs[3];
+ int unused2[5];
+ }
+ mesh;
+ struct
+ {
+ // Q3FACETYPE_FLARE
+ // flare renders as a simple sprite at origin, no geometry
+ // exists, nor does it have a radius, a cvar controls the radius
+ // and another cvar controls distance fade
+ // (they were not used in Q3 I'm told)
+ float origin[3];
+ int unused1[11];
+ }
+ flare;
+ }
+ specific;
}
q3dface_t;
typedef struct
{
- unsigned char rgb[128][128][3];
+ unsigned char rgb[128*128*3];
}
q3dlightmap_t;
}
q3dpvs_t;
+#define CHECKPVSBIT(pvs,b) ((b) >= 0 ? ((pvs)[(b) >> 3] & (1 << ((b) & 7))) : false)
+#define SETPVSBIT(pvs,b) ((b) >= 0 ? ((pvs)[(b) >> 3] |= (1 << ((b) & 7))) : false)
+#define CLEARPVSBIT(pvs,b) ((b) >= 0 ? ((pvs)[(b) >> 3] &= ~(1 << ((b) & 7))) : false)
+
#endif