summaryrefslogtreecommitdiff
path: root/src/renderergl2/tr_shade.c
diff options
context:
space:
mode:
authorSmileTheory <SmileTheory@gmail.com>2014-03-16 16:29:38 -0700
committerTim Angus <tim@ngus.net>2014-06-17 17:43:42 +0100
commit83aaee5bc4613cc677378e85cc856dd5dfda9745 (patch)
treeab5c650b0dda585485dda8b5eb4ad088e4ed305c /src/renderergl2/tr_shade.c
parent7fd2d99020512adce7f16465e0814cbcdb2bb8b3 (diff)
OpenGL2: Parallax corrected cubemap (cheaper trick)
Diffstat (limited to 'src/renderergl2/tr_shade.c')
-rw-r--r--src/renderergl2/tr_shade.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/renderergl2/tr_shade.c b/src/renderergl2/tr_shade.c
index 0925b6d6..11ba5836 100644
--- a/src/renderergl2/tr_shade.c
+++ b/src/renderergl2/tr_shade.c
@@ -1379,8 +1379,21 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
// testing cube map
//
if (!(tr.viewParms.flags & VPF_NOCUBEMAPS) && input->cubemapIndex && r_cubeMapping->integer)
+ {
+ vec4_t vec;
+
GL_BindToTMU( tr.cubemaps[input->cubemapIndex - 1], TB_CUBEMAP);
+ vec[0] = tr.cubemapOrigins[input->cubemapIndex - 1][0] - backEnd.viewParms.or.origin[0];
+ vec[1] = tr.cubemapOrigins[input->cubemapIndex - 1][1] - backEnd.viewParms.or.origin[1];
+ vec[2] = tr.cubemapOrigins[input->cubemapIndex - 1][2] - backEnd.viewParms.or.origin[2];
+ vec[3] = 1.0f;
+
+ VectorScale4(vec, 1.0f / 1000.0f, vec);
+
+ GLSL_SetUniformVec4(sp, UNIFORM_CUBEMAPINFO, vec);
+ }
+
//
// draw
//