29 #include "../idlib/precompiled.h"
60 int numShadowingFaces = 0;
67 for ( i = 0; i < numFaces; i++ ) {
68 numShadowingFaces += facing[
i];
70 numShadowingFaces = numFaces - numShadowingFaces;
78 for ( j = i = 0; i < tri->
numIndexes; i += 3, j++ ) {
79 if ( !modifyFacing[j] ) {
80 int i1 = indexes[i+0];
81 int i2 = indexes[i+1];
82 int i3 = indexes[i+2];
83 if ( cullBits[i1] & cullBits[i2] & cullBits[i3] ) {
92 if ( !numShadowingFaces ) {
103 #ifdef USE_TRI_DATA_ALLOCATOR
115 int f1 = facing[sil->
p1];
116 int f2 = facing[sil->
p2];
118 if ( !( f1 ^ f2 ) ) {
122 int v1 = sil->
v1 << 1;
123 int v2 = sil->
v2 << 1;
128 shadowIndexes[0] =
v1;
129 shadowIndexes[1] = v2 ^ f1;
130 shadowIndexes[2] = v2 ^ f2;
131 shadowIndexes[3] = v1 ^ f2;
132 shadowIndexes[4] = v1 ^ f1;
133 shadowIndexes[5] = v2 ^ 1;
138 int numShadowIndexes = shadowIndexes - tempIndexes;
145 #ifdef USE_TRI_DATA_ALLOCATOR
160 shadowIndexes = newTri->
indexes + numShadowIndexes;
161 for ( i = 0, j = 0; i < tri->
numIndexes; i += 3, j++ ) {
166 int i0 = indexes[i+0] << 1;
167 shadowIndexes[2] = i0;
168 shadowIndexes[3] = i0 ^ 1;
169 int i1 = indexes[i+1] << 1;
170 shadowIndexes[1] =
i1;
171 shadowIndexes[4] = i1 ^ 1;
172 int i2 = indexes[i+2] << 1;
173 shadowIndexes[0] =
i2;
174 shadowIndexes[5] = i2 ^ 1;
203 int numShadowingFaces = 0;
210 for ( i = 0; i < numFaces; i++ ) {
211 numShadowingFaces += facing[
i];
213 numShadowingFaces = numFaces - numShadowingFaces;
221 for ( j = i = 0; i < tri->
numIndexes; i += 3, j++ ) {
222 if ( !modifyFacing[j] ) {
223 int i1 = indexes[i+0];
224 int i2 = indexes[i+1];
225 int i3 = indexes[i+2];
226 if ( cullBits[i1] & cullBits[i2] & cullBits[i3] ) {
235 if ( !numShadowingFaces ) {
242 #ifdef USE_TRI_DATA_ALLOCATOR
251 int *vertRemap = (
int *)_alloca16( tri->
numVerts *
sizeof( vertRemap[0] ) );
255 for ( i = 0, j = 0; i < tri->
numIndexes; i += 3, j++ ) {
271 #ifdef USE_TRI_DATA_ALLOCATOR
279 #ifdef USE_TRI_DATA_ALLOCATOR
291 int f1 = facing[sil->
p1];
292 int f2 = facing[sil->
p2];
294 if ( !( f1 ^ f2 ) ) {
298 int v1 = vertRemap[sil->
v1];
299 int v2 = vertRemap[sil->
v2];
304 shadowIndexes[0] =
v1;
305 shadowIndexes[1] = v2 ^ f1;
306 shadowIndexes[2] = v2 ^ f2;
307 shadowIndexes[3] = v1 ^ f2;
308 shadowIndexes[4] = v1 ^ f1;
309 shadowIndexes[5] = v2 ^ 1;
314 int numShadowIndexes = shadowIndexes - tempIndexes;
321 #ifdef USE_TRI_DATA_ALLOCATOR
336 shadowIndexes = newTri->
indexes + numShadowIndexes;
337 for ( i = 0, j = 0; i < tri->
numIndexes; i += 3, j++ ) {
342 int i0 = vertRemap[indexes[i+0]];
343 shadowIndexes[2] = i0;
344 shadowIndexes[3] = i0 ^ 1;
345 int i1 = vertRemap[indexes[i+1]];
346 shadowIndexes[1] =
i1;
347 shadowIndexes[4] = i1 ^ 1;
348 int i2 = vertRemap[indexes[i+2]];
349 shadowIndexes[0] =
i2;
350 shadowIndexes[5] = i2 ^ 1;
int numShadowIndexesNoFrontCaps
void R_CalcInteractionCullBits(const idRenderEntityLocal *ent, const srfTriangles_t *tri, const idRenderLightLocal *light, srfCullInfo_t &cullInfo)
#define LIGHT_CULL_ALL_FRONT
void R_CalcInteractionFacing(const idRenderEntityLocal *ent, const srfTriangles_t *tri, const idRenderLightLocal *light, srfCullInfo_t &cullInfo)
idCVar r_useShadowProjectedCull("r_useShadowProjectedCull","1", CVAR_RENDERER|CVAR_BOOL,"discard triangles outside light volume before shadowing")
void R_ResizeStaticTriSurfShadowVerts(srfTriangles_t *tri, int numVerts)
srfTriangles_t * R_AllocStaticTriSurf(void)
virtual void VPCALL Memset(void *dst, const int val, const int count)=0
srfTriangles_t * R_CreateVertexProgramTurboShadowVolume(const idRenderEntityLocal *ent, const srfTriangles_t *tri, const idRenderLightLocal *light, srfCullInfo_t &cullInfo)
GLfloat GLfloat GLfloat v2
const int SHADOW_CAP_INFINITE
void R_AllocStaticTriSurfShadowVerts(srfTriangles_t *tri, int numVerts)
shadowCache_t * shadowVertexes
virtual void VPCALL Memcpy(void *dst, const void *src, const int count)=0
int numShadowIndexesNoCaps
void R_GlobalPointToLocal(const float modelMatrix[16], const idVec3 &in, idVec3 &out)
srfTriangles_t * R_CreateTurboShadowVolume(const idRenderEntityLocal *ent, const srfTriangles_t *tri, const idRenderLightLocal *light, srfCullInfo_t &cullInfo)
void R_AllocStaticTriSurfIndexes(srfTriangles_t *tri, int numIndexes)
void R_ResizeStaticTriSurfIndexes(srfTriangles_t *tri, int numIndexes)
virtual int VPCALL CreateShadowCache(idVec4 *vertexCache, int *vertRemap, const idVec3 &lightOrigin, const idDrawVert *verts, const int numVerts)=0
idSIMDProcessor * SIMDProcessor