*/
void R_BuildLightMap (const entity_render_t *ent, msurface_t *surface)
{
- int smax, tmax, i, j, size, size3, maps, stride, l;
+ int smax, tmax, i, j, size, size3, maps, l;
unsigned int *bl, scale;
unsigned char *lightmap, *out, *stain;
static unsigned int intblocklights[MAX_LIGHTMAP_SIZE*MAX_LIGHTMAP_SIZE*3]; // LordHavoc: *3 for colored lighting
// (0 = 0.0, 128 = 1.0, 256 = 2.0)
if (ent->model->brushq1.lightmaprgba)
{
- stride = (surface->lightmapinfo->lightmaptexturestride - smax) * 4;
- for (i = 0;i < tmax;i++, out += stride)
+ for (i = 0;i < tmax;i++)
{
for (j = 0;j < smax;j++)
{
}
else
{
- stride = (surface->lightmapinfo->lightmaptexturestride - smax) * 3;
- for (i = 0;i < tmax;i++, out += stride)
+ for (i = 0;i < tmax;i++)
{
for (j = 0;j < smax;j++)
{
}
}
- R_UpdateTexture(surface->lightmaptexture, templight);
+ R_UpdateTexture(surface->lightmaptexture, templight, surface->lightmapinfo->lightmaporigin[0], surface->lightmapinfo->lightmaporigin[1], smax, tmax);
}
void R_StainNode (mnode_t *node, model_t *model, const vec3_t origin, float radius, const float fcolor[8])
static void R_DrawPortal_Callback(const entity_render_t *ent, int surfacenumber, const rtlight_t *rtlight)
{
const mportal_t *portal = (mportal_t *)ent;
- int i;
+ int i, numpoints;
float *v;
rmeshstate_t m;
+ float vertex3f[POLYGONELEMENTS_MAXPOINTS*3];
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GL_DepthMask(false);
GL_DepthTest(true);
+ qglDisable(GL_CULL_FACE);
R_Mesh_Matrix(&identitymatrix);
+ numpoints = min(portal->numpoints, POLYGONELEMENTS_MAXPOINTS);
+
memset(&m, 0, sizeof(m));
- m.pointer_vertex = varray_vertex3f;
+ m.pointer_vertex = vertex3f;
R_Mesh_State(&m);
i = surfacenumber;
((i & 0x0038) >> 3) * (1.0f / 7.0f),
((i & 0x01C0) >> 6) * (1.0f / 7.0f),
0.125f);
- if (PlaneDiff(r_vieworigin, (&portal->plane)) < 0)
- {
- for (i = portal->numpoints - 1, v = varray_vertex3f;i >= 0;i--, v += 3)
- VectorCopy(portal->points[i].position, v);
- }
- else
- for (i = 0, v = varray_vertex3f;i < portal->numpoints;i++, v += 3)
- VectorCopy(portal->points[i].position, v);
- GL_LockArrays(0, portal->numpoints);
- R_Mesh_Draw(0, portal->numpoints, portal->numpoints - 2, polygonelements);
- GL_LockArrays(0, 0);
+ for (i = 0, v = vertex3f;i < numpoints;i++, v += 3)
+ VectorCopy(portal->points[i].position, v);
+ R_Mesh_Draw(0, numpoints, numpoints - 2, polygonelements);
+ qglEnable(GL_CULL_FACE);
}
// LordHavoc: this is just a nice debugging tool, very slow
int surfacelistindex;
float projectdistance = lightradius + model->radius*2 + r_shadow_projectdistance.value;
texture_t *texture;
- r_shadow_compilingrtlight->static_meshchain_shadow = Mod_ShadowMesh_Begin(r_shadow_mempool, 32768, 32768, NULL, NULL, NULL, false, false, true);
+ r_shadow_compilingrtlight->static_meshchain_shadow = Mod_ShadowMesh_Begin(r_main_mempool, 32768, 32768, NULL, NULL, NULL, false, false, true);
R_Shadow_PrepareShadowMark(model->brush.shadowmesh->numtriangles);
for (surfacelistindex = 0;surfacelistindex < numsurfaces;surfacelistindex++)
{
R_Shadow_MarkVolumeFromBox(surface->num_firstshadowmeshtriangle, surface->num_triangles, model->brush.shadowmesh->vertex3f, model->brush.shadowmesh->element3i, relativelightorigin, r_shadow_compilingrtlight->cullmins, r_shadow_compilingrtlight->cullmaxs, surface->mins, surface->maxs);
}
R_Shadow_VolumeFromList(model->brush.shadowmesh->numverts, model->brush.shadowmesh->numtriangles, model->brush.shadowmesh->vertex3f, model->brush.shadowmesh->element3i, model->brush.shadowmesh->neighbor3i, relativelightorigin, lightradius + model->radius + projectdistance, numshadowmark, shadowmarklist);
- r_shadow_compilingrtlight->static_meshchain_shadow = Mod_ShadowMesh_Finish(r_shadow_mempool, r_shadow_compilingrtlight->static_meshchain_shadow, false, false);
+ r_shadow_compilingrtlight->static_meshchain_shadow = Mod_ShadowMesh_Finish(r_main_mempool, r_shadow_compilingrtlight->static_meshchain_shadow, false, false);
}
extern float *rsurface_vertex3f;