#5979: Cubemap support for opengl2.
This commit is contained in:
1 parent
68a616c7f1
commit
7e875c6941
23 files changed
+1267
-515
No files matched your search
@@ -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;
|
||||
}
|
||||
Reference in new issue
Block a user