Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIRIE Shinsuke <irieshinsuke@yahoo.co.jp>2013-11-24 21:19:14 +0400
committerIRIE Shinsuke <irieshinsuke@yahoo.co.jp>2013-11-24 21:21:06 +0400
commit178bd849bf6fded4c7ffae44eedda2f55afa4629 (patch)
treeff19c6893570f4f92f1928be659918b77c9755f8
parent61a28ef7643e50178a1d42d0db41d8eaf732debd (diff)
Blender Internal: Revert own previous commit for "Camera Data" node, correct GLSL code for view vector output of "Geometry" node.
Revert 0c7d2de38219. The "Camera Data" node actually gives the location of the point in camera coordinate system. To obtain actual camera data, we can use "Geometry" node instead. Also modify the "Geometry" node, to produce correct view vector output in orthographic GLSL preview.
-rw-r--r--source/blender/gpu/shaders/gpu_shader_material.glsl4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_camera.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 934b81bd63e..1dd33080d94 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -140,7 +140,7 @@ void uv_attribute(vec2 attuv, out vec3 uv)
void geom(vec3 co, vec3 nor, mat4 viewinvmat, vec3 attorco, vec2 attuv, vec4 attvcol, out vec3 global, out vec3 local, out vec3 view, out vec3 orco, out vec3 uv, out vec3 normal, out vec4 vcol, out float vcol_alpha, out float frontback)
{
local = co;
- view = normalize(local);
+ view = (gl_ProjectionMatrix[3][3] == 0.0)? normalize(local): vec3(0.0, 0.0, -1.0);
global = (viewinvmat*vec4(local, 1.0)).xyz;
orco = attorco;
uv_attribute(attuv, uv);
@@ -163,7 +163,7 @@ void camera(vec3 co, out vec3 outview, out float outdepth, out float outdist)
{
outdepth = abs(co.z);
outdist = length(co);
- outview = (gl_ProjectionMatrix[3][3] == 0.0)? normalize(co): vec3(0.0, 0.0, -1.0);
+ outview = normalize(co);
}
void math_add(float val1, float val2, out float outval)
diff --git a/source/blender/nodes/shader/nodes/node_shader_camera.c b/source/blender/nodes/shader/nodes/node_shader_camera.c
index 0f0f191e1e5..d1ff30ef7d1 100644
--- a/source/blender/nodes/shader/nodes/node_shader_camera.c
+++ b/source/blender/nodes/shader/nodes/node_shader_camera.c
@@ -46,9 +46,9 @@ static void node_shader_exec_camera(void *data, int UNUSED(thread), bNode *UNUSE
if (data) {
ShadeInput *shi = ((ShaderCallData *)data)->shi; /* Data we need for shading. */
- copy_v3_v3(out[0]->vec, shi->view); /* get view vector */
+ copy_v3_v3(out[0]->vec, shi->co); /* get view vector */
out[1]->vec[0] = fabs(shi->co[2]); /* get view z-depth */
- out[2]->vec[0] = len_v3(shi->co); /* get view distance */
+ out[2]->vec[0] = normalize_v3(out[0]->vec); /* get view distance */
}
}