Implemented rim_light and rim_power shader parameters, enabling outlining of objects on a per-model basis.

Will need to later refactor to allow for a more scalable means of adding per-model shader attributes.

--HG--
branch : nfb
This commit is contained in:
2013-12-05 01:09:31 -08:00
parent c7948ea314
commit 79abdd98d0
26 changed files with 156 additions and 50 deletions

View File

@@ -138,11 +138,14 @@ uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying t
varying mediump float specularFactor;
#endif
#if ENABLE_RIM_COLOR == 1
#define NEED_EYEVEC
#endif
#if HAS_REFLECTION_CUBE_MAP == 1
#if HAS_NORMAL_MAP == 1
#define NEED_EYEVEC
uniform highp mat4 model_inverse_transpose_matrix;
varying mediump vec3 eyeVec;
varying highp mat3 tangent_to_world_matrix;
#else
uniform highp mat4 model_matrix;
@@ -150,6 +153,10 @@ uniform highp mat4 mvp_matrix; // mvp_matrix is the result of multiplying t
#endif
#endif
#ifdef NEED_EYEVEC
varying mediump vec3 eyeVec;
#endif
#if HAS_DIFFUSE_MAP_SCALE == 1
uniform highp vec2 diffuseTexture_Scale;
#endif
@@ -246,7 +253,7 @@ void main()
#if HAS_REFLECTION_CUBE_MAP == 1
#if HAS_NORMAL_MAP == 1
eyeVec = normalize(camera_position_model_space - vertex_position_skinned);
#else
// Calculate reflection vector as I - 2.0 * dot(N, I) * N
mediump vec3 eyeVec = normalize(camera_position_model_space - vertex_position_skinned);
@@ -255,6 +262,9 @@ void main()
#endif
#endif
#ifdef NEED_EYEVEC
eyeVec = normalize(camera_position_model_space - vertex_position_skinned);
#endif
#if HAS_LIGHT_MAP == 1
// Pass shadow UV co-ordinates