#5979: Cubemap support for opengl2.
This commit is contained in:
parent
68a616c7f1
commit
7e875c6941
23 changed files with 1268 additions and 516 deletions
|
@ -449,3 +449,32 @@ int R_LightDirForPoint( vec3_t point, vec3_t lightDir, vec3_t normal, world_t *w
|
|||
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
|
||||
int R_CubemapForPoint( vec3_t point )
|
||||
{
|
||||
int cubemapIndex = -1;
|
||||
|
||||
if (r_cubeMapping->integer && tr.numCubemaps)
|
||||
{
|
||||
int i;
|
||||
vec_t shortest = (float)WORLD_SIZE * (float)WORLD_SIZE;
|
||||
|
||||
for (i = 0; i < tr.numCubemaps; i++)
|
||||
{
|
||||
vec3_t diff;
|
||||
vec_t length;
|
||||
|
||||
VectorSubtract(point, tr.cubemapOrigins[i], diff);
|
||||
length = DotProduct(diff, diff);
|
||||
|
||||
if (shortest > length)
|
||||
{
|
||||
shortest = length;
|
||||
cubemapIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return cubemapIndex + 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue