1
0
Fork 0

standardized fog

Signed-off-by: Vivian Meazza <vivian.meazza@lineone.net>
This commit is contained in:
Vivian Meazza 2011-12-01 20:57:20 +00:00
parent b0bcb91c24
commit eec1b7626a
2 changed files with 16 additions and 3 deletions

View file

@ -1,6 +1,6 @@
// -*- mode: C; -*-
// Licence: GPL v2
// Author: Vivian Meazza.
// © Emilian Huminiuc and Vivian Meazza 2011
varying vec3 rawpos;
varying float fogCoord;
@ -19,12 +19,19 @@ uniform mat4 osg_ViewMatrixInverse;
attribute vec3 tangent;
attribute vec3 binormal;
////fog "include"////////
uniform int fogType;
void fog_Func(int type);
/////////////////////////
void main(void)
{
rawpos = gl_Vertex.xyz / gl_Vertex.w;
vec4 ecPosition = gl_ModelViewMatrix * gl_Vertex;
ecPosition.xyz = ecPosition.xyz / ecPosition.w;
fogCoord = ecPosition.z;
fog_Func(fogType);
vec3 n = normalize(gl_Normal);
vec3 t = cross(gl_Normal, vec3(1.0,0.0,0.0));

View file

@ -1,6 +1,6 @@
// -*- mode: C; -*-
// Licence: GPL v2
// Author: Vivian Meazza.
// © Emilian Huminiuc and Vivian Meazza 2011
#version 120
@ -32,7 +32,13 @@ uniform float ambient_correction;
uniform float reflect_map;
uniform float normalmap_dds;
uniform int fogType;
//uniform int fogType;
////fog "include" /////
uniform int fogType;
vec3 fog_Func(vec3 color, int type);
//////////////////////
vec3 fog_Func(vec3 color, int type);