q3mleaf_t *r_q3bsp_maxleaflist[65536];
int r_q3bsp_maxmarksurfaces;
int r_q3bsp_nummarksurfaces;
-q3mface_t *r_q3bsp_maxsurfacelist[65536];
+q3msurface_t *r_q3bsp_maxsurfacelist[65536];
*/
static int dlightdivtable[32768];
}
}
-void R_PrepareSurfaces(entity_render_t *ent)
+void R_UpdateLightmapInfo(entity_render_t *ent)
{
- int i, numsurfaces, *surfacevisframes;
- model_t *model;
- msurface_t *surf, *surfaces, **surfchain;
- vec3_t modelorg;
-
- if (!ent->model)
+ int i;
+ msurface_t *surface, **surfacechain;
+ model_t *model = ent->model;
+ if (!model)
return;
-
- model = ent->model;
- Matrix4x4_Transform(&ent->inversematrix, r_vieworigin, modelorg);
- numsurfaces = model->brushq1.nummodelsurfaces;
- surfaces = model->brushq1.surfaces + model->brushq1.firstmodelsurface;
- surfacevisframes = model->brushq1.surfacevisframes + model->brushq1.firstmodelsurface;
-
- R_UpdateTextureInfo(ent);
-
if (r_dynamic.integer && !r_shadow_realtime_dlight.integer)
R_MarkLights(ent);
-
if (model->brushq1.light_ambient != r_ambient.value)
{
model->brushq1.light_ambient = r_ambient.value;
- for (i = 0;i < model->brushq1.nummodelsurfaces;i++)
- model->brushq1.surfaces[i + model->brushq1.firstmodelsurface].cached_dlight = true;
+ for (i = 0;i < model->nummodelsurfaces;i++)
+ model->brushq1.surfaces[i + model->firstmodelsurface].cached_dlight = true;
}
else
{
if (model->brushq1.light_stylevalue[i] != d_lightstylevalue[model->brushq1.light_style[i]])
{
model->brushq1.light_stylevalue[i] = d_lightstylevalue[model->brushq1.light_style[i]];
- for (surfchain = model->brushq1.light_styleupdatechains[i];*surfchain;surfchain++)
- (**surfchain).cached_dlight = true;
+ for (surfacechain = model->brushq1.light_styleupdatechains[i];(surface = *surfacechain);surfacechain++)
+ surface->cached_dlight = true;
}
}
}
+}
+void R_PrepareSurfaces(entity_render_t *ent)
+{
+ int i, numsurfaces, *surfacevisframes;
+ model_t *model;
+ msurface_t *surf, *surfaces;
+ vec3_t modelorg;
+
+ if (!ent->model)
+ return;
+
+ model = ent->model;
+ Matrix4x4_Transform(&ent->inversematrix, r_vieworigin, modelorg);
+ numsurfaces = model->nummodelsurfaces;
+ surfaces = model->brushq1.surfaces + model->firstmodelsurface;
+ surfacevisframes = model->brushq1.surfacevisframes + model->firstmodelsurface;
for (i = 0, surf = surfaces;i < numsurfaces;i++, surf++)
{
if (surfacevisframes[i] == r_framecount)
#if WORLDNODECULLBACKFACES
Matrix4x4_Transform(&ent->inversematrix, r_vieworigin, modelorg);
#endif
- numsurfaces = model->brushq1.nummodelsurfaces;
- surf = model->brushq1.surfaces + model->brushq1.firstmodelsurface;
- surfacevisframes = model->brushq1.surfacevisframes + model->brushq1.firstmodelsurface;
- surfacepvsframes = model->brushq1.surfacepvsframes + model->brushq1.firstmodelsurface;
+ numsurfaces = model->nummodelsurfaces;
+ surf = model->brushq1.surfaces + model->firstmodelsurface;
+ surfacevisframes = model->brushq1.surfacevisframes + model->firstmodelsurface;
+ surfacepvsframes = model->brushq1.surfacepvsframes + model->firstmodelsurface;
for (i = 0;i < numsurfaces;i++, surf++)
{
#if WORLDNODECULLBACKFACES
#endif
surf->dlightframe = -1;
}
- R_PrepareSurfaces(ent);
+ R_UpdateTextureInfo(ent);
+ R_UpdateLightmapInfo(ent);
}
void R_SurfaceWorldNode (entity_render_t *ent)
model = ent->model;
if (model == NULL)
return;
- surfacevisframes = model->brushq1.surfacevisframes + model->brushq1.firstmodelsurface;
- surfacepvsframes = model->brushq1.surfacepvsframes + model->brushq1.firstmodelsurface;
+ surfacevisframes = model->brushq1.surfacevisframes + model->firstmodelsurface;
+ surfacepvsframes = model->brushq1.surfacepvsframes + model->firstmodelsurface;
Matrix4x4_Transform(&ent->inversematrix, r_vieworigin, modelorg);
for (leaf = model->brushq1.pvsleafchain;leaf;leaf = leaf->pvschain)
R_SurfaceWorldNode (ent);
else
R_PortalWorldNode (ent, viewleaf);
-}
-void R_DrawWorld(entity_render_t *ent)
-{
- if (ent->model == NULL)
- return;
- if (!ent->model->brushq1.num_leafs)
- {
- if (ent->model->DrawSky)
- ent->model->DrawSky(ent);
- if (ent->model->Draw)
- ent->model->Draw(ent);
- }
- else
- {
- R_PrepareSurfaces(ent);
- R_DrawSurfaces(ent, SURF_DRAWSKY);
- R_DrawSurfaces(ent, SURF_DRAWTURB | SURF_LIGHTMAP);
- if (r_drawportals.integer)
- R_DrawPortals(ent);
- }
+ if (r_drawportals.integer)
+ R_DrawPortals(ent);
}
void R_Model_Brush_DrawSky(entity_render_t *ent)
return;
if (ent != &cl_entities[0].render)
R_PrepareBrushModel(ent);
+ R_PrepareSurfaces(ent);
R_DrawSurfaces(ent, SURF_DRAWSKY);
}
c_bmodels++;
if (ent != &cl_entities[0].render)
R_PrepareBrushModel(ent);
+ R_PrepareSurfaces(ent);
+ R_UpdateTextureInfo(ent);
+ R_UpdateLightmapInfo(ent);
R_DrawSurfaces(ent, SURF_DRAWTURB | SURF_LIGHTMAP);
}
*outnumclusterspointer = 0;
*outnumsurfacespointer = 0;
memset(outclusterpvs, 0, model->brush.num_pvsclusterbytes);
- memset(outsurfacepvs, 0, (model->numsurfaces + 7) >> 3);
+ memset(outsurfacepvs, 0, (model->nummodelsurfaces + 7) >> 3);
if (model == NULL)
{
VectorCopy(lightmins, outmins);
lightmaxs[2] = relativelightorigin[2] + lightradius;
R_Mesh_Matrix(&ent->matrix);
Matrix4x4_Transform(&ent->inversematrix, r_vieworigin, modelorg);
+ R_UpdateTextureInfo(ent);
for (surfacelistindex = 0;surfacelistindex < numsurfaces;surfacelistindex++)
{
surface = model->brushq1.surfaces + surfacelist[surfacelistindex];
GL_LockArrays(0, 0);
}
-void R_Q3BSP_DrawCollisionFace(entity_render_t *ent, q3mface_t *face)
+void R_Q3BSP_DrawCollisionFace(entity_render_t *ent, q3msurface_t *face)
{
int i;
rmeshstate_t m;
memset(&m, 0, sizeof(m));
m.pointer_vertex = face->data_collisionvertex3f;
R_Mesh_State(&m);
- i = ((int)face) / sizeof(q3mface_t);
+ i = ((int)face) / sizeof(q3msurface_t);
GL_Color((i & 31) * (1.0f / 32.0f), ((i >> 5) & 31) * (1.0f / 32.0f), ((i >> 10) & 31) * (1.0f / 32.0f), 0.2f);
GL_LockArrays(0, face->num_collisionvertices);
R_Mesh_Draw(face->num_collisionvertices, face->num_collisiontriangles, face->data_collisionelement3i);
GL_LockArrays(0, 0);
}
-void R_Q3BSP_DrawSkyFace(entity_render_t *ent, q3mface_t *face)
+void R_Q3BSP_DrawSkyFace(entity_render_t *ent, q3msurface_t *face)
{
rmeshstate_t m;
if (!face->num_triangles)
GL_ColorMask(1,1,1,1);
}
-void R_Q3BSP_DrawFace_OpaqueWall_Pass_OpaqueGlow(entity_render_t *ent, q3mface_t *face)
+void R_Q3BSP_DrawFace_OpaqueWall_Pass_OpaqueGlow(entity_render_t *ent, q3msurface_t *face)
{
rmeshstate_t m;
memset(&m, 0, sizeof(m));
GL_LockArrays(0, 0);
}
-void R_Q3BSP_DrawFace_OpaqueWall_Pass_TextureLightmapCombine(entity_render_t *ent, q3mface_t *face)
+void R_Q3BSP_DrawFace_OpaqueWall_Pass_TextureLightmapCombine(entity_render_t *ent, q3msurface_t *face)
{
rmeshstate_t m;
memset(&m, 0, sizeof(m));
GL_LockArrays(0, 0);
}
-void R_Q3BSP_DrawFace_OpaqueWall_Pass_Texture(entity_render_t *ent, q3mface_t *face)
+void R_Q3BSP_DrawFace_OpaqueWall_Pass_Texture(entity_render_t *ent, q3msurface_t *face)
{
rmeshstate_t m;
memset(&m, 0, sizeof(m));
GL_LockArrays(0, 0);
}
-void R_Q3BSP_DrawFace_OpaqueWall_Pass_Lightmap(entity_render_t *ent, q3mface_t *face)
+void R_Q3BSP_DrawFace_OpaqueWall_Pass_Lightmap(entity_render_t *ent, q3msurface_t *face)
{
rmeshstate_t m;
memset(&m, 0, sizeof(m));
GL_LockArrays(0, 0);
}
-void R_Q3BSP_DrawFace_OpaqueWall_Pass_LightmapOnly(entity_render_t *ent, q3mface_t *face)
+void R_Q3BSP_DrawFace_OpaqueWall_Pass_LightmapOnly(entity_render_t *ent, q3msurface_t *face)
{
rmeshstate_t m;
memset(&m, 0, sizeof(m));
GL_LockArrays(0, 0);
}
-void R_Q3BSP_DrawFace_OpaqueWall_Pass_Glow(entity_render_t *ent, q3mface_t *face)
+void R_Q3BSP_DrawFace_OpaqueWall_Pass_Glow(entity_render_t *ent, q3msurface_t *face)
{
rmeshstate_t m;
memset(&m, 0, sizeof(m));
GL_LockArrays(0, 0);
}
-void R_Q3BSP_DrawFace_OpaqueWall_Pass_TextureVertex(entity_render_t *ent, q3mface_t *face)
+void R_Q3BSP_DrawFace_OpaqueWall_Pass_TextureVertex(entity_render_t *ent, q3msurface_t *face)
{
int i;
float mul;
GL_LockArrays(0, 0);
}
-void R_Q3BSP_DrawFace_OpaqueWall_Pass_VertexOnly(entity_render_t *ent, q3mface_t *face)
+void R_Q3BSP_DrawFace_OpaqueWall_Pass_VertexOnly(entity_render_t *ent, q3msurface_t *face)
{
int i;
float mul;
GL_LockArrays(0, 0);
}
-void R_Q3BSP_DrawFace_OpaqueWall_Pass_AddTextureAmbient(entity_render_t *ent, q3mface_t *face)
+void R_Q3BSP_DrawFace_OpaqueWall_Pass_AddTextureAmbient(entity_render_t *ent, q3msurface_t *face)
{
rmeshstate_t m;
memset(&m, 0, sizeof(m));
void R_Q3BSP_DrawFace_TransparentCallback(const void *voident, int facenumber)
{
const entity_render_t *ent = voident;
- q3mface_t *face = ent->model->brushq3.data_faces + facenumber;
+ q3msurface_t *face = ent->model->brushq3.data_faces + facenumber;
rmeshstate_t m;
R_Mesh_Matrix(&ent->matrix);
memset(&m, 0, sizeof(m));
qglEnable(GL_CULL_FACE);
}
-void R_Q3BSP_DrawFace(entity_render_t *ent, q3mface_t *face)
+void R_Q3BSP_DrawFace(entity_render_t *ent, q3msurface_t *face)
{
if (!face->num_triangles)
return;
void R_Q3BSP_DrawSky(entity_render_t *ent)
{
int i;
- q3mface_t *face;
+ q3msurface_t *face;
vec3_t modelorg;
model_t *model;
R_Mesh_Matrix(&ent->matrix);
void R_Q3BSP_Draw(entity_render_t *ent)
{
int i;
- q3mface_t *face;
+ q3msurface_t *face;
vec3_t modelorg;
model_t *model;
qbyte *pvs;
int t, leafindex, marksurfaceindex, surfaceindex, triangleindex, outnumclusters = 0, outnumsurfaces = 0;
const int *e;
const float *v[3];
- q3mface_t *surface;
+ q3msurface_t *surface;
q3mleaf_t *leaf;
const qbyte *pvs;
lightmins[0] = relativelightorigin[0] - lightradius;
*outnumclusterspointer = 0;
*outnumsurfacespointer = 0;
memset(outclusterpvs, 0, model->brush.num_pvsclusterbytes);
- memset(outsurfacepvs, 0, (model->numsurfaces + 7) >> 3);
+ memset(outsurfacepvs, 0, (model->nummodelsurfaces + 7) >> 3);
if (model == NULL)
{
VectorCopy(lightmins, outmins);
{
model_t *model = ent->model;
vec3_t lightmins, lightmaxs;
- q3mface_t *surface;
+ q3msurface_t *surface;
int surfacelistindex, j, t;
const int *e;
const float *v[3];
{
model_t *model = ent->model;
vec3_t lightmins, lightmaxs, modelorg;
- q3mface_t *surface;
+ q3msurface_t *surface;
int surfacelistindex;
if (r_drawcollisionbrushes.integer < 2)
{