}
}
-void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements, const float *vertex3f, const float *svector3f, const float *tvector3f, const float *normal3f, const float *texcoord2f, const float *relativelightorigin, const float *relativeeyeorigin, const float *lightcolor, const matrix4x4_t *matrix_modeltolight, const matrix4x4_t *matrix_modeltoattenuationxyz, const matrix4x4_t *matrix_modeltoattenuationz, rtexture_t *basetexture, rtexture_t *bumptexture, rtexture_t *glosstexture, rtexture_t *lightcubemap, vec_t ambientscale, vec_t diffusescale, vec_t specularscale)
+void R_Shadow_RenderLighting(int firstvertex, int numvertices, int numtriangles, const int *elements, const float *vertex3f, const float *svector3f, const float *tvector3f, const float *normal3f, const float *texcoord2f, const float *relativelightorigin, const float *relativeeyeorigin, const float *lightcolor, const matrix4x4_t *matrix_modeltolight, const matrix4x4_t *matrix_modeltoattenuationxyz, const matrix4x4_t *matrix_modeltoattenuationz, rtexture_t *basetexture, rtexture_t *bumptexture, rtexture_t *glosstexture, rtexture_t *lightcubemap, vec_t ambientscale, vec_t diffusescale, vec_t specularscale)
{
int renders;
float color[3], color2[3], colorscale;
qglUniform1fARB(qglGetUniformLocationARB(prog, "OffsetMapping_Bias"), r_shadow_glsl_offsetmapping_bias.value);CHECKGLERROR
}
CHECKGLERROR
- GL_LockArrays(0, numverts);
- R_Mesh_Draw(0, numverts, numtriangles, elements);
+ GL_LockArrays(firstvertex, numvertices);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, elements);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
GL_LockArrays(0, 0);
m.texmatrix[0] = *matrix_modeltoattenuationxyz;
#else
m.pointer_texcoord3f[0] = varray_texcoord3f[0];
- R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[0], numverts, vertex3f, matrix_modeltoattenuationxyz);
+ R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[0] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltoattenuationxyz);
#endif
m.tex[1] = R_GetTexture(basetexture);
m.pointer_texcoord[1] = texcoord2f;
m.texmatrix[2] = *matrix_modeltolight;
#else
m.pointer_texcoord3f[2] = varray_texcoord3f[2];
- R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[2], numverts, vertex3f, matrix_modeltolight);
+ R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[2] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltolight);
#endif
GL_BlendFunc(GL_ONE, GL_ONE);
}
m.texmatrix[0] = *matrix_modeltoattenuationxyz;
#else
m.pointer_texcoord3f[0] = varray_texcoord3f[0];
- R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[0], numverts, vertex3f, matrix_modeltoattenuationxyz);
+ R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[0] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltoattenuationxyz);
#endif
m.tex[1] = R_GetTexture(basetexture);
m.pointer_texcoord[1] = texcoord2f;
m.texmatrix[0] = *matrix_modeltoattenuationxyz;
#else
m.pointer_texcoord[0] = varray_texcoord2f[0];
- R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[0], numverts, vertex3f, matrix_modeltoattenuationxyz);
+ R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[0] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltoattenuationxyz);
#endif
m.tex[1] = R_GetTexture(r_shadow_attenuation2dtexture);
#ifdef USETEXMATRIX
m.texmatrix[1] = *matrix_modeltoattenuationz;
#else
m.pointer_texcoord[1] = varray_texcoord2f[1];
- R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[1], numverts, vertex3f, matrix_modeltoattenuationz);
+ R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[1] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltoattenuationz);
#endif
m.tex[2] = R_GetTexture(basetexture);
m.pointer_texcoord[2] = texcoord2f;
m.texmatrix[3] = *matrix_modeltolight;
#else
m.pointer_texcoord3f[3] = varray_texcoord3f[3];
- R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[3], numverts, vertex3f, matrix_modeltolight);
+ R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[3] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltolight);
#endif
}
GL_BlendFunc(GL_ONE, GL_ONE);
m.texmatrix[0] = *matrix_modeltoattenuationxyz;
#else
m.pointer_texcoord[0] = varray_texcoord2f[0];
- R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[0], numverts, vertex3f, matrix_modeltoattenuationxyz);
+ R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[0] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltoattenuationxyz);
#endif
m.tex[1] = R_GetTexture(r_shadow_attenuation2dtexture);
#ifdef USETEXMATRIX
m.texmatrix[1] = *matrix_modeltoattenuationz;
#else
m.pointer_texcoord[1] = varray_texcoord2f[1];
- R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[1], numverts, vertex3f, matrix_modeltoattenuationz);
+ R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[1] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltoattenuationz);
#endif
m.tex[2] = R_GetTexture(basetexture);
m.pointer_texcoord[2] = texcoord2f;
m.texmatrix[0] = *matrix_modeltoattenuationxyz;
#else
m.pointer_texcoord[0] = varray_texcoord2f[0];
- R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[0], numverts, vertex3f, matrix_modeltoattenuationxyz);
+ R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[0] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltoattenuationxyz);
#endif
m.tex[1] = R_GetTexture(r_shadow_attenuation2dtexture);
#ifdef USETEXMATRIX
m.texmatrix[1] = *matrix_modeltoattenuationz;
#else
m.pointer_texcoord[1] = varray_texcoord2f[1];
- R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[1], numverts, vertex3f, matrix_modeltoattenuationz);
+ R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[1] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltoattenuationz);
#endif
R_Mesh_State(&m);
GL_ColorMask(0,0,0,1);
GL_BlendFunc(GL_ONE, GL_ZERO);
- GL_LockArrays(0, numverts);
- R_Mesh_Draw(0, numverts, numtriangles, elements);
+ GL_LockArrays(firstvertex, numvertices);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, elements);
GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
m.texmatrix[1] = *matrix_modeltolight;
#else
m.pointer_texcoord3f[1] = varray_texcoord3f[1];
- R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltolight);
+ R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltolight);
#endif
}
GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
R_Mesh_State(&m);
GL_ColorMask(r_refdef.colormask[0], r_refdef.colormask[1], r_refdef.colormask[2], 0);
VectorScale(lightcolor, colorscale, color2);
- GL_LockArrays(0, numverts);
+ GL_LockArrays(firstvertex, numvertices);
for (renders = 0;renders < 64 && (color2[0] > 0 || color2[1] > 0 || color2[2] > 0);renders++, color2[0]--, color2[1]--, color2[2]--)
{
GL_Color(bound(0, color2[0], 1), bound(0, color2[1], 1), bound(0, color2[2], 1), 1);
- R_Mesh_Draw(0, numverts, numtriangles, elements);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, elements);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
}
m.texcubemap[1] = R_GetTexture(r_shadow_normalcubetexture);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
m.pointer_texcoord3f[1] = varray_texcoord3f[1];
- R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin);
+ R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, svector3f + 3 * firstvertex, tvector3f + 3 * firstvertex, normal3f + 3 * firstvertex, relativelightorigin);
m.tex3d[2] = R_GetTexture(r_shadow_attenuation3dtexture);
#ifdef USETEXMATRIX
m.pointer_texcoord3f[2] = vertex3f;
m.texmatrix[2] = *matrix_modeltoattenuationxyz;
#else
m.pointer_texcoord3f[2] = varray_texcoord3f[2];
- R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[2], numverts, vertex3f, matrix_modeltoattenuationxyz);
+ R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[2] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltoattenuationxyz);
#endif
R_Mesh_State(&m);
GL_ColorMask(0,0,0,1);
GL_BlendFunc(GL_ONE, GL_ZERO);
- GL_LockArrays(0, numverts);
- R_Mesh_Draw(0, numverts, numtriangles, elements);
+ GL_LockArrays(firstvertex, numvertices);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, elements);
GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
m.texmatrix[1] = *matrix_modeltolight;
#else
m.pointer_texcoord3f[1] = varray_texcoord3f[1];
- R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltolight);
+ R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltolight);
#endif
}
GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
m.texmatrix[0] = *matrix_modeltoattenuationxyz;
#else
m.pointer_texcoord3f[0] = varray_texcoord3f[0];
- R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[0], numverts, vertex3f, matrix_modeltoattenuationxyz);
+ R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[0] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltoattenuationxyz);
#endif
R_Mesh_State(&m);
GL_ColorMask(0,0,0,1);
GL_BlendFunc(GL_ONE, GL_ZERO);
- GL_LockArrays(0, numverts);
- R_Mesh_Draw(0, numverts, numtriangles, elements);
+ GL_LockArrays(firstvertex, numvertices);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, elements);
GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
m.texcubemap[1] = R_GetTexture(r_shadow_normalcubetexture);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
m.pointer_texcoord3f[1] = varray_texcoord3f[1];
- R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin);
+ R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, svector3f + 3 * firstvertex, tvector3f + 3 * firstvertex, normal3f + 3 * firstvertex, relativelightorigin);
R_Mesh_State(&m);
GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
- GL_LockArrays(0, numverts);
- R_Mesh_Draw(0, numverts, numtriangles, elements);
+ GL_LockArrays(firstvertex, numvertices);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, elements);
GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
m.texmatrix[1] = *matrix_modeltolight;
#else
m.pointer_texcoord3f[1] = varray_texcoord3f[1];
- R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltolight);
+ R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltolight);
#endif
}
GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
m.texcubemap[1] = R_GetTexture(r_shadow_normalcubetexture);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
m.pointer_texcoord3f[1] = varray_texcoord3f[1];
- R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin);
+ R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, svector3f + 3 * firstvertex, tvector3f + 3 * firstvertex, normal3f + 3 * firstvertex, relativelightorigin);
R_Mesh_State(&m);
GL_ColorMask(0,0,0,1);
GL_BlendFunc(GL_ONE, GL_ZERO);
- GL_LockArrays(0, numverts);
- R_Mesh_Draw(0, numverts, numtriangles, elements);
+ GL_LockArrays(firstvertex, numvertices);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, elements);
GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
m.texmatrix[1] = *matrix_modeltoattenuationxyz;
#else
m.pointer_texcoord3f[1] = varray_texcoord3f[1];
- R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltoattenuationxyz);
+ R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltoattenuationxyz);
#endif
GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
}
m.texcubemap[1] = R_GetTexture(r_shadow_normalcubetexture);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
m.pointer_texcoord3f[1] = varray_texcoord3f[1];
- R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin);
+ R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, svector3f + 3 * firstvertex, tvector3f + 3 * firstvertex, normal3f + 3 * firstvertex, relativelightorigin);
m.tex[2] = R_GetTexture(r_shadow_attenuation2dtexture);
#ifdef USETEXMATRIX
m.pointer_texcoord3f[2] = vertex3f;
m.texmatrix[2] = *matrix_modeltoattenuationxyz;
#else
m.pointer_texcoord[2] = varray_texcoord2f[2];
- R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[2], numverts, vertex3f, matrix_modeltoattenuationxyz);
+ R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[2] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltoattenuationxyz);
#endif
m.tex[3] = R_GetTexture(r_shadow_attenuation2dtexture);
#ifdef USETEXMATRIX
m.texmatrix[3] = *matrix_modeltoattenuationz;
#else
m.pointer_texcoord[3] = varray_texcoord2f[3];
- R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[3], numverts, vertex3f, matrix_modeltoattenuationz);
+ R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[3] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltoattenuationz);
#endif
R_Mesh_State(&m);
GL_ColorMask(0,0,0,1);
GL_BlendFunc(GL_ONE, GL_ZERO);
- GL_LockArrays(0, numverts);
- R_Mesh_Draw(0, numverts, numtriangles, elements);
+ GL_LockArrays(firstvertex, numvertices);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, elements);
GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
m.texmatrix[1] = *matrix_modeltolight;
#else
m.pointer_texcoord3f[1] = varray_texcoord3f[1];
- R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltolight);
+ R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltolight);
#endif
}
GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
m.texmatrix[0] = *matrix_modeltoattenuationxyz;
#else
m.pointer_texcoord[0] = varray_texcoord2f[0];
- R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[0], numverts, vertex3f, matrix_modeltoattenuationxyz);
+ R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[0] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltoattenuationxyz);
#endif
m.tex[1] = R_GetTexture(r_shadow_attenuation2dtexture);
#ifdef USETEXMATRIX
m.texmatrix[1] = *matrix_modeltoattenuationz;
#else
m.pointer_texcoord[1] = varray_texcoord2f[1];
- R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[1], numverts, vertex3f, matrix_modeltoattenuationz);
+ R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[1] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltoattenuationz);
#endif
R_Mesh_State(&m);
GL_ColorMask(0,0,0,1);
GL_BlendFunc(GL_ONE, GL_ZERO);
- GL_LockArrays(0, numverts);
- R_Mesh_Draw(0, numverts, numtriangles, elements);
+ GL_LockArrays(firstvertex, numvertices);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, elements);
GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
m.texcubemap[1] = R_GetTexture(r_shadow_normalcubetexture);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
m.pointer_texcoord3f[1] = varray_texcoord3f[1];
- R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin);
+ R_Shadow_GenTexCoords_Diffuse_NormalCubeMap(varray_texcoord3f[1] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, svector3f + 3 * firstvertex, tvector3f + 3 * firstvertex, normal3f + 3 * firstvertex, relativelightorigin);
R_Mesh_State(&m);
GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
- GL_LockArrays(0, numverts);
- R_Mesh_Draw(0, numverts, numtriangles, elements);
+ GL_LockArrays(firstvertex, numvertices);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, elements);
GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
m.texmatrix[1] = *matrix_modeltolight;
#else
m.pointer_texcoord3f[1] = varray_texcoord3f[1];
- R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltolight);
+ R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltolight);
#endif
}
GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
R_Mesh_State(&m);
GL_ColorMask(r_refdef.colormask[0], r_refdef.colormask[1], r_refdef.colormask[2], 0);
VectorScale(lightcolor, colorscale, color2);
- GL_LockArrays(0, numverts);
+ GL_LockArrays(firstvertex, numvertices);
for (renders = 0;renders < 64 && (color2[0] > 0 || color2[1] > 0 || color2[2] > 0);renders++, color2[0]--, color2[1]--, color2[2]--)
{
GL_Color(bound(0, color2[0], 1), bound(0, color2[1], 1), bound(0, color2[2], 1), 1);
- R_Mesh_Draw(0, numverts, numtriangles, elements);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, elements);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
}
m.texcubemap[1] = R_GetTexture(r_shadow_normalcubetexture);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
m.pointer_texcoord3f[1] = varray_texcoord3f[1];
- R_Shadow_GenTexCoords_Specular_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin, relativeeyeorigin);
+ R_Shadow_GenTexCoords_Specular_NormalCubeMap(varray_texcoord3f[1] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, svector3f + 3 * firstvertex, tvector3f + 3 * firstvertex, normal3f + 3 * firstvertex, relativelightorigin, relativeeyeorigin);
R_Mesh_State(&m);
GL_ColorMask(0,0,0,1);
// this squares the result
GL_BlendFunc(GL_SRC_ALPHA, GL_ZERO);
- GL_LockArrays(0, numverts);
- R_Mesh_Draw(0, numverts, numtriangles, elements);
+ GL_LockArrays(firstvertex, numvertices);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, elements);
GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
R_Mesh_State(&m);
- GL_LockArrays(0, numverts);
+ GL_LockArrays(firstvertex, numvertices);
// square alpha in framebuffer a few times to make it shiny
GL_BlendFunc(GL_ZERO, GL_DST_ALPHA);
// these comments are a test run through this math for intensity 0.5
// 0.5 * 0.5 = 0.25 (done by the BlendFunc earlier)
// 0.25 * 0.25 = 0.0625 (this is another pass)
// 0.0625 * 0.0625 = 0.00390625 (this is another pass)
- R_Mesh_Draw(0, numverts, numtriangles, elements);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, elements);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
- R_Mesh_Draw(0, numverts, numtriangles, elements);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, elements);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
GL_LockArrays(0, 0);
m.texmatrix[0] = *matrix_modeltoattenuationxyz;
#else
m.pointer_texcoord3f[0] = varray_texcoord3f[0];
- R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[0], numverts, vertex3f, matrix_modeltoattenuationxyz);
+ R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[0] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltoattenuationxyz);
#endif
R_Mesh_State(&m);
GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
- GL_LockArrays(0, numverts);
- R_Mesh_Draw(0, numverts, numtriangles, elements);
+ GL_LockArrays(firstvertex, numvertices);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, elements);
GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
m.texmatrix[1] = *matrix_modeltolight;
#else
m.pointer_texcoord3f[1] = varray_texcoord3f[1];
- R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltolight);
+ R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltolight);
#endif
}
GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
m.texcubemap[1] = R_GetTexture(r_shadow_normalcubetexture);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
m.pointer_texcoord3f[1] = varray_texcoord3f[1];
- R_Shadow_GenTexCoords_Specular_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin, relativeeyeorigin);
+ R_Shadow_GenTexCoords_Specular_NormalCubeMap(varray_texcoord3f[1] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, svector3f + 3 * firstvertex, tvector3f + 3 * firstvertex, normal3f + 3 * firstvertex, relativelightorigin, relativeeyeorigin);
R_Mesh_State(&m);
GL_ColorMask(0,0,0,1);
// this squares the result
GL_BlendFunc(GL_SRC_ALPHA, GL_ZERO);
- GL_LockArrays(0, numverts);
- R_Mesh_Draw(0, numverts, numtriangles, elements);
+ GL_LockArrays(firstvertex, numvertices);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, elements);
GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
R_Mesh_State(&m);
- GL_LockArrays(0, numverts);
+ GL_LockArrays(firstvertex, numvertices);
// square alpha in framebuffer a few times to make it shiny
GL_BlendFunc(GL_ZERO, GL_DST_ALPHA);
// these comments are a test run through this math for intensity 0.5
// 0.5 * 0.5 = 0.25 (done by the BlendFunc earlier)
// 0.25 * 0.25 = 0.0625 (this is another pass)
// 0.0625 * 0.0625 = 0.00390625 (this is another pass)
- R_Mesh_Draw(0, numverts, numtriangles, elements);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, elements);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
- R_Mesh_Draw(0, numverts, numtriangles, elements);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, elements);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
GL_LockArrays(0, 0);
m.texmatrix[1] = *matrix_modeltoattenuationxyz;
#else
m.pointer_texcoord3f[1] = varray_texcoord3f[1];
- R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltoattenuationxyz);
+ R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltoattenuationxyz);
#endif
GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
}
m.texcubemap[1] = R_GetTexture(r_shadow_normalcubetexture);
m.texcombinergb[1] = GL_DOT3_RGBA_ARB;
m.pointer_texcoord3f[1] = varray_texcoord3f[1];
- R_Shadow_GenTexCoords_Specular_NormalCubeMap(varray_texcoord3f[1], numverts, vertex3f, svector3f, tvector3f, normal3f, relativelightorigin, relativeeyeorigin);
+ R_Shadow_GenTexCoords_Specular_NormalCubeMap(varray_texcoord3f[1] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, svector3f + 3 * firstvertex, tvector3f + 3 * firstvertex, normal3f + 3 * firstvertex, relativelightorigin, relativeeyeorigin);
R_Mesh_State(&m);
GL_ColorMask(0,0,0,1);
// this squares the result
GL_BlendFunc(GL_SRC_ALPHA, GL_ZERO);
- GL_LockArrays(0, numverts);
- R_Mesh_Draw(0, numverts, numtriangles, elements);
+ GL_LockArrays(firstvertex, numvertices);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, elements);
GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
memset(&m, 0, sizeof(m));
m.pointer_vertex = vertex3f;
R_Mesh_State(&m);
- GL_LockArrays(0, numverts);
+ GL_LockArrays(firstvertex, numvertices);
// square alpha in framebuffer a few times to make it shiny
GL_BlendFunc(GL_ZERO, GL_DST_ALPHA);
// these comments are a test run through this math for intensity 0.5
// 0.5 * 0.5 = 0.25 (done by the BlendFunc earlier)
// 0.25 * 0.25 = 0.0625 (this is another pass)
// 0.0625 * 0.0625 = 0.00390625 (this is another pass)
- R_Mesh_Draw(0, numverts, numtriangles, elements);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, elements);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
- R_Mesh_Draw(0, numverts, numtriangles, elements);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, elements);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
GL_LockArrays(0, 0);
m.texmatrix[0] = *matrix_modeltoattenuationxyz;
#else
m.pointer_texcoord[0] = varray_texcoord2f[0];
- R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[0], numverts, vertex3f, matrix_modeltoattenuationxyz);
+ R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[0] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltoattenuationxyz);
#endif
m.tex[1] = R_GetTexture(r_shadow_attenuation2dtexture);
#ifdef USETEXMATRIX
m.texmatrix[1] = *matrix_modeltoattenuationz;
#else
m.pointer_texcoord[1] = varray_texcoord2f[1];
- R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[1], numverts, vertex3f, matrix_modeltoattenuationz);
+ R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[1] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltoattenuationz);
#endif
R_Mesh_State(&m);
GL_BlendFunc(GL_DST_ALPHA, GL_ZERO);
- GL_LockArrays(0, numverts);
- R_Mesh_Draw(0, numverts, numtriangles, elements);
+ GL_LockArrays(firstvertex, numvertices);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, elements);
GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
m.texmatrix[1] = *matrix_modeltolight;
#else
m.pointer_texcoord3f[1] = varray_texcoord3f[1];
- R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1], numverts, vertex3f, matrix_modeltolight);
+ R_Shadow_Transform_Vertex3f_TexCoord3f(varray_texcoord3f[1] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltolight);
#endif
}
GL_BlendFunc(GL_DST_ALPHA, GL_ONE);
R_Mesh_State(&m);
GL_ColorMask(r_refdef.colormask[0], r_refdef.colormask[1], r_refdef.colormask[2], 0);
VectorScale(lightcolor, colorscale, color2);
- GL_LockArrays(0, numverts);
+ GL_LockArrays(firstvertex, numvertices);
for (renders = 0;renders < 64 && (color2[0] > 0 || color2[1] > 0 || color2[2] > 0);renders++, color2[0]--, color2[1]--, color2[2]--)
{
GL_Color(bound(0, color2[0], 1), bound(0, color2[1], 1), bound(0, color2[2], 1), 1);
- R_Mesh_Draw(0, numverts, numtriangles, elements);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, elements);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
}
m.texmatrix[1] = *matrix_modeltoattenuationxyz;
#else
m.pointer_texcoord[1] = varray_texcoord2f[1];
- R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[1], numverts, vertex3f, matrix_modeltoattenuationxyz);
+ R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[1] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltoattenuationxyz);
#endif
if (r_textureunits.integer >= 3)
{
m.texmatrix[2] = *matrix_modeltoattenuationz;
#else
m.pointer_texcoord[2] = varray_texcoord2f[2];
- R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[2], numverts, vertex3f, matrix_modeltoattenuationz);
+ R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[2] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltoattenuationz);
#endif
}
}
if (r_textureunits.integer >= 3)
GL_Color(color[0], color[1], color[2], 1);
else if (r_textureunits.integer >= 2)
- R_Shadow_VertexNoShadingWithZAttenuation(numverts, vertex3f, color, matrix_modeltolight);
+ R_Shadow_VertexNoShadingWithZAttenuation(numvertices, vertex3f + 3 * firstvertex, color + 3 * firstvertex, matrix_modeltolight);
else
- R_Shadow_VertexNoShadingWithXYZAttenuation(numverts, vertex3f, color, matrix_modeltolight);
- GL_LockArrays(0, numverts);
- R_Mesh_Draw(0, numverts, numtriangles, elements);
+ R_Shadow_VertexNoShadingWithXYZAttenuation(numvertices, vertex3f + 3 * firstvertex, color + 3 * firstvertex, matrix_modeltolight);
+ GL_LockArrays(firstvertex, numvertices);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, elements);
GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
m.texmatrix[1] = *matrix_modeltoattenuationxyz;
#else
m.pointer_texcoord[1] = varray_texcoord2f[1];
- R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[1], numverts, vertex3f, matrix_modeltoattenuationxyz);
+ R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[1] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltoattenuationxyz);
#endif
if (r_textureunits.integer >= 3)
{
m.texmatrix[2] = *matrix_modeltoattenuationz;
#else
m.pointer_texcoord[2] = varray_texcoord2f[2];
- R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[2], numverts, vertex3f, matrix_modeltoattenuationz);
+ R_Shadow_Transform_Vertex3f_TexCoord2f(varray_texcoord2f[2] + 3 * firstvertex, numvertices, vertex3f + 3 * firstvertex, matrix_modeltoattenuationz);
#endif
}
}
color[1] = bound(0, color2[1], 1);
color[2] = bound(0, color2[2], 1);
if (r_textureunits.integer >= 3)
- R_Shadow_VertexShading(numverts, vertex3f, normal3f, color, matrix_modeltolight);
+ R_Shadow_VertexShading(numvertices, vertex3f + 3 * firstvertex, normal3f + 3 * firstvertex, color + 3 * firstvertex, matrix_modeltolight);
else if (r_textureunits.integer >= 2)
- R_Shadow_VertexShadingWithZAttenuation(numverts, vertex3f, normal3f, color, matrix_modeltolight);
+ R_Shadow_VertexShadingWithZAttenuation(numvertices, vertex3f + 3 * firstvertex, normal3f + 3 * firstvertex, color + 3 * firstvertex, matrix_modeltolight);
else
- R_Shadow_VertexShadingWithXYZAttenuation(numverts, vertex3f, normal3f, color, matrix_modeltolight);
- GL_LockArrays(0, numverts);
- R_Mesh_Draw(0, numverts, numtriangles, elements);
+ R_Shadow_VertexShadingWithXYZAttenuation(numvertices, vertex3f + 3 * firstvertex, normal3f + 3 * firstvertex, color + 3 * firstvertex, matrix_modeltolight);
+ GL_LockArrays(firstvertex, numvertices);
+ R_Mesh_Draw(firstvertex, numvertices, numtriangles, elements);
GL_LockArrays(0, 0);
c_rt_lightmeshes++;
c_rt_lighttris += numtriangles;
{
R_Mesh_Matrix(&ent->matrix);
for (mesh = rtlight->static_meshchain_light;mesh;mesh = mesh->next)
- R_Shadow_RenderLighting(mesh->numverts, mesh->numtriangles, mesh->element3i, mesh->vertex3f, mesh->svector3f, mesh->tvector3f, mesh->normal3f, mesh->texcoord2f, relativelightorigin, relativeeyeorigin, lightcolor2, &matrix_modeltolight, &matrix_modeltoattenuationxyz, &matrix_modeltoattenuationz, mesh->map_diffuse, mesh->map_normal, mesh->map_specular, cubemaptexture, rtlight->ambientscale, rtlight->diffusescale, rtlight->specularscale);
+ R_Shadow_RenderLighting(0, mesh->numverts, mesh->numtriangles, mesh->element3i, mesh->vertex3f, mesh->svector3f, mesh->tvector3f, mesh->normal3f, mesh->texcoord2f, relativelightorigin, relativeeyeorigin, lightcolor2, &matrix_modeltolight, &matrix_modeltoattenuationxyz, &matrix_modeltoattenuationz, mesh->map_diffuse, mesh->map_normal, mesh->map_specular, cubemaptexture, rtlight->ambientscale, rtlight->diffusescale, rtlight->specularscale);
}
else
ent->model->DrawLight(ent, relativelightorigin, relativeeyeorigin, rtlight->radius, lightcolor2, &matrix_modeltolight, &matrix_modeltoattenuationxyz, &matrix_modeltoattenuationz, cubemaptexture, rtlight->ambientscale, rtlight->diffusescale, rtlight->specularscale, numsurfaces, surfacelist);