1
0
forked from 0ad/0ad

Remove conditional defines as those served a very doubtful purpose with parallax, replacing it with something dynamic in the shader. This cleans the C++ side of the renderer as conditional defines were very ugly.

This was SVN commit r16430.
This commit is contained in:
wraitii 2015-03-15 12:22:36 +00:00
parent 5a4ddb52a2
commit f29d059617
16 changed files with 56 additions and 150 deletions

View File

@ -6,12 +6,7 @@
<alternative material="basic_trans_ao_spec.xml" quality="8"/> <alternative material="basic_trans_ao_spec.xml" quality="8"/>
<alternative material="alphatest_ao_parallax_spec.xml" if="CFG_FORCE_ALPHATEST"/> <alternative material="alphatest_ao_parallax_spec.xml" if="CFG_FORCE_ALPHATEST"/>
<conditional_define name="USE_PARALLAX_MAP" value="1" type="draw_range" conf="PARALLAX_DIST"/> <define name="USE_PARALLAX" value="1"/>
<conditional_define name="USE_HQ_PARALLAX" value="1" type="draw_range" conf="PARALLAX_HQ_DIST"/>
<conditional_define name="USE_VHQ_PARALLAX" value="1" type="draw_range" conf="PARALLAX_VHQ_DIST"/>
<!-- <define name="USE_SELF_LIGHT" value="1"/> -->
<!-- Settings for effects above: <!-- Settings for effects above:
First value: Normal mapping intensity. First value: Normal mapping intensity.

View File

@ -6,13 +6,7 @@
<alternative material="basic_trans_spec.xml" quality="8"/> <alternative material="basic_trans_spec.xml" quality="8"/>
<alternative material="alphatest_ao_parallax_spec.xml" if="CFG_FORCE_ALPHATEST"/> <alternative material="alphatest_ao_parallax_spec.xml" if="CFG_FORCE_ALPHATEST"/>
<conditional_define name="USE_PARALLAX_MAP" value="1" type="draw_range" conf="PARALLAX_DIST"/> <define name="USE_PARALLAX" value="1"/>
<conditional_define name="USE_HQ_PARALLAX" value="1" type="draw_range" conf="PARALLAX_HQ_DIST"/>
<conditional_define name="USE_VHQ_PARALLAX" value="1" type="draw_range" conf="PARALLAX_VHQ_DIST"/>
<!-- <define name="USE_SELF_LIGHT" value="1"/> -->
<!--<define name="USE_AO" value="1"/>-->
<!-- Settings for effects above: <!-- Settings for effects above:
First value: Normal mapping intensity. First value: Normal mapping intensity.

View File

@ -20,13 +20,6 @@ element material {
attribute name { text }, attribute name { text },
attribute value { text } attribute value { text }
}* & }* &
element conditional_define {
attribute name { text },
attribute value { text },
attribute type { text },
(attribute conf { text }
| ( attribute min { xsd:float }?, attribute max { xsd:float }? ))
}* &
element uniform { element uniform {
attribute name { text }, attribute name { text },
attribute value { list { # X Y Z W attribute value { list { # X Y Z W

View File

@ -3,12 +3,7 @@
<shader effect="model"/> <shader effect="model"/>
<alternative material="no_trans_ao.xml" quality="8"/> <alternative material="no_trans_ao.xml" quality="8"/>
<conditional_define name="USE_PARALLAX_MAP" value="1" type="draw_range" conf="PARALLAX_DIST"/> <define name="USE_PARALLAX" value="1"/>
<conditional_define name="USE_HQ_PARALLAX" value="1" type="draw_range" conf="PARALLAX_HQ_DIST"/>
<conditional_define name="USE_VHQ_PARALLAX" value="1" type="draw_range" conf="PARALLAX_VHQ_DIST"/>
<!-- <define name="USE_SELF_LIGHT" value="1"/> -->
<!-- Settings for effects above: <!-- Settings for effects above:
First value: Normal mapping intensity. First value: Normal mapping intensity.

View File

@ -4,9 +4,7 @@
<alternative material="player_trans_ao.xml" quality="8"/> <alternative material="player_trans_ao.xml" quality="8"/>
<define name="USE_PLAYERCOLOR" value="1"/> <define name="USE_PLAYERCOLOR" value="1"/>
<conditional_define name="USE_PARALLAX_MAP" value="1" type="draw_range" conf="PARALLAX_DIST"/> <define name="USE_PARALLAX" value="1"/>
<conditional_define name="USE_HQ_PARALLAX" value="1" type="draw_range" conf="PARALLAX_HQ_DIST"/>
<conditional_define name="USE_VHQ_PARALLAX" value="1" type="draw_range" conf="PARALLAX_VHQ_DIST"/>
<uniform name="effectSettings" value="1.0 50.0 0.0075 0.6"/> <uniform name="effectSettings" value="1.0 50.0 0.0075 0.6"/>

View File

@ -4,12 +4,7 @@
<alternative material="player_trans_ao_spec.xml" quality="8"/> <alternative material="player_trans_ao_spec.xml" quality="8"/>
<define name="USE_PLAYERCOLOR" value="1"/> <define name="USE_PLAYERCOLOR" value="1"/>
<conditional_define name="USE_PARALLAX_MAP" value="1" type="draw_range" conf="PARALLAX_DIST"/> <define name="USE_PARALLAX" value="1"/>
<conditional_define name="USE_HQ_PARALLAX" value="1" type="draw_range" conf="PARALLAX_HQ_DIST"/>
<conditional_define name="USE_VHQ_PARALLAX" value="1" type="draw_range" conf="PARALLAX_VHQ_DIST"/>
<!-- <define name="USE_SELF_LIGHT" value="1"/> -->
<!-- Settings for effects above: <!-- Settings for effects above:
First value: Normal mapping intensity. First value: Normal mapping intensity.

View File

@ -4,13 +4,6 @@
<alternative material="player_trans_ao.xml" quality="3"/> <alternative material="player_trans_ao.xml" quality="3"/>
<define name="USE_PLAYERCOLOR" value="1"/> <define name="USE_PLAYERCOLOR" value="1"/>
<!--<conditional_define name="USE_PARALLAX_MAP" value="1" type="draw_range" conf="PARALLAX_DIST"/>
<conditional_define name="USE_HQ_PARALLAX" value="1" type="draw_range" conf="PARALLAX_HQ_DIST"/>
<conditional_define name="USE_VHQ_PARALLAX" value="1" type="draw_range" conf="PARALLAX_VHQ_DIST"/>-->
<!-- <define name="USE_SELF_LIGHT" value="1"/> -->
<!-- Settings for effects above: <!-- Settings for effects above:
First value: Normal mapping intensity. First value: Normal mapping intensity.
Second value: Specular power. Second value: Specular power.

View File

@ -4,9 +4,7 @@
<alternative material="player_trans.xml" quality="8"/> <alternative material="player_trans.xml" quality="8"/>
<define name="USE_PLAYERCOLOR" value="1"/> <define name="USE_PLAYERCOLOR" value="1"/>
<conditional_define name="USE_PARALLAX_MAP" value="1" type="draw_range" conf="PARALLAX_DIST"/> <define name="USE_PARALLAX" value="1"/>
<conditional_define name="USE_HQ_PARALLAX" value="1" type="draw_range" conf="PARALLAX_HQ_DIST"/>
<conditional_define name="USE_VHQ_PARALLAX" value="1" type="draw_range" conf="PARALLAX_VHQ_DIST"/>
<!--<define name="USE_SPECULAR_MAP" value="1"/> <!--<define name="USE_SPECULAR_MAP" value="1"/>
<define name="USE_SELF_LIGHT" value="1"/>--> <define name="USE_SELF_LIGHT" value="1"/>-->

View File

@ -4,9 +4,7 @@
<alternative material="player_trans_spec.xml" quality="8"/> <alternative material="player_trans_spec.xml" quality="8"/>
<define name="USE_PLAYERCOLOR" value="1"/> <define name="USE_PLAYERCOLOR" value="1"/>
<conditional_define name="USE_PARALLAX_MAP" value="1" type="draw_range" conf="PARALLAX_DIST"/> <define name="USE_PARALLAX" value="1"/>
<conditional_define name="USE_HQ_PARALLAX" value="1" type="draw_range" conf="PARALLAX_HQ_DIST"/>
<conditional_define name="USE_VHQ_PARALLAX" value="1" type="draw_range" conf="PARALLAX_VHQ_DIST"/>
<!-- <define name="USE_SELF_LIGHT" value="1"/> --> <!-- <define name="USE_SELF_LIGHT" value="1"/> -->

View File

@ -10,9 +10,7 @@
COMMENT: Pixels that are exactly white are calculated more efficiently (on average) COMMENT: Pixels that are exactly white are calculated more efficiently (on average)
if dynamic branching is supported by the player's GPU. if dynamic branching is supported by the player's GPU.
EFFICIENCY: This is a moderately expensive effect, so use with care. --> EFFICIENCY: This is a moderately expensive effect, so use with care. -->
<conditional_define name="USE_PARALLAX_MAP" value="1" type="draw_range" conf="PARALLAX_DIST"/> <define name="USE_PARALLAX" value="1"/>
<conditional_define name="USE_HQ_PARALLAX" value="1" type="draw_range" conf="PARALLAX_HQ_DIST"/>
<conditional_define name="USE_VHQ_PARALLAX" value="1" type="draw_range" conf="PARALLAX_VHQ_DIST"/>
<!-- REQUIRES: Actor must provide a texture named "normTex", where the RGB channels <!-- REQUIRES: Actor must provide a texture named "normTex", where the RGB channels
are a normal map corresponding to XYZ normals. are a normal map corresponding to XYZ normals.

View File

@ -10,8 +10,7 @@
COMMENT: Pixels that are exactly white are calculated more efficiently (on average) COMMENT: Pixels that are exactly white are calculated more efficiently (on average)
if dynamic branching is supported by the player's GPU. if dynamic branching is supported by the player's GPU.
EFFICIENCY: This is a moderately expensive effect, so use with care. --> EFFICIENCY: This is a moderately expensive effect, so use with care. -->
<conditional_define name="USE_PARALLAX_MAP" value="1" type="draw_range" conf="PARALLAX_DIST"/> <define name="USE_PARALLAX" value="1"/>
<conditional_define name="USE_HQ_PARALLAX" value="1" type="draw_range" conf="PARALLAX_HQ_DIST"/>
<!-- REQUIRES: Actor must provide a texture named "normTex", where the RGB channels <!-- REQUIRES: Actor must provide a texture named "normTex", where the RGB channels
are a normal map corresponding to XYZ normals. are a normal map corresponding to XYZ normals.

View File

@ -3,9 +3,7 @@
<shader effect="model_transparent"/> <shader effect="model_transparent"/>
<alpha_blending/> <alpha_blending/>
<define name="USE_TRANSPARENT" value="1"/> <define name="USE_TRANSPARENT" value="1"/>
<conditional_define name="USE_PARALLAX_MAP" value="1" type="draw_range" conf="PARALLAX_DIST"/> <define name="USE_PARALLAX" value="1"/>
<conditional_define name="USE_HQ_PARALLAX" value="1" type="draw_range" conf="PARALLAX_HQ_DIST"/>
<conditional_define name="USE_VHQ_PARALLAX" value="1" type="draw_range" conf="PARALLAX_VHQ_DIST"/>
<uniform name="effectSettings" value="1.0 50.0 0.0075 0.85"/> <uniform name="effectSettings" value="1.0 50.0 0.0075 0.85"/>
<renderquery name="sim_time"/> <renderquery name="sim_time"/>

View File

@ -47,20 +47,20 @@ varying vec2 v_los;
uniform vec3 specularColor; uniform vec3 specularColor;
#endif #endif
#if USE_NORMAL_MAP || USE_SPECULAR_MAP || USE_PARALLAX_MAP || USE_AO #if USE_NORMAL_MAP || USE_SPECULAR_MAP || USE_PARALLAX || USE_AO
uniform vec4 effectSettings; uniform vec4 effectSettings;
#endif #endif
#if USE_SPECULAR || USE_NORMAL_MAP || USE_SPECULAR_MAP || USE_PARALLAX_MAP #if USE_SPECULAR || USE_NORMAL_MAP || USE_SPECULAR_MAP || USE_PARALLAX
varying vec4 v_normal; varying vec4 v_normal;
#if (USE_INSTANCING || USE_GPU_SKINNING) && (USE_NORMAL_MAP || USE_PARALLAX_MAP) #if (USE_INSTANCING || USE_GPU_SKINNING) && (USE_NORMAL_MAP || USE_PARALLAX)
varying vec4 v_tangent; varying vec4 v_tangent;
//varying vec3 v_bitangent; //varying vec3 v_bitangent;
#endif #endif
#if USE_SPECULAR || USE_SPECULAR_MAP #if USE_SPECULAR || USE_SPECULAR_MAP
varying vec3 v_half; varying vec3 v_half;
#endif #endif
#if (USE_INSTANCING || USE_GPU_SKINNING) && USE_PARALLAX_MAP #if (USE_INSTANCING || USE_GPU_SKINNING) && USE_PARALLAX
varying vec3 v_eyeVec; varying vec3 v_eyeVec;
#endif #endif
#endif #endif
@ -113,84 +113,45 @@ void main()
{ {
vec2 coord = v_tex; vec2 coord = v_tex;
#if (USE_INSTANCING || USE_GPU_SKINNING) && (USE_PARALLAX_MAP || USE_NORMAL_MAP) #if (USE_INSTANCING || USE_GPU_SKINNING) && (USE_PARALLAX || USE_NORMAL_MAP)
vec3 bitangent = vec3(v_normal.w, v_tangent.w, v_lighting.w); vec3 bitangent = vec3(v_normal.w, v_tangent.w, v_lighting.w);
mat3 tbn = mat3(v_tangent.xyz, bitangent, v_normal.xyz); mat3 tbn = mat3(v_tangent.xyz, bitangent, v_normal.xyz);
#endif #endif
#if (USE_INSTANCING || USE_GPU_SKINNING) && USE_PARALLAX_MAP #if (USE_INSTANCING || USE_GPU_SKINNING) && USE_PARALLAX
{ {
float h = texture2D(normTex, coord).a; float h = texture2D(normTex, coord).a;
vec3 eyeDir = normalize(v_eyeVec * tbn); vec3 eyeDir = normalize(v_eyeVec * tbn);
float dist = length(v_eyeVec); float dist = length(v_eyeVec);
float s;
vec2 move; vec2 move;
float height = 1.0; float height = 1.0;
float scale = effectSettings.z; float scale = effectSettings.z;
scale = (scale * (float(PARALLAX_DIST_MAX) - dist)) / float(PARALLAX_DIST_MAX); int iter = int(min(30, 70.0/dist));
if (iter > 0.01)
{
float s = 1.0/iter;
float t = s;
move = vec2(-eyeDir.x, eyeDir.y) * scale / (eyeDir.z * iter);
vec2 nil = vec2(0.0);
float iter = 8.0; for (int i = 0; i < iter; ++i) {
#if USE_HQ_PARALLAX height -= t;
iter = 16.0; t = (h < height) ? s : 0.0;
#if USE_VHQ_PARALLAX vec2 temp = (h < height) ? move : nil;
iter = 24.0; coord += temp;
#endif h = texture2D(normTex, coord).a;
#endif }
s = 1.0 / iter; // Move back to where we collided with the surface.
float t = s; // This assumes the surface is linear between the sample point before we
move = vec2(-eyeDir.x, eyeDir.y) * scale / (eyeDir.z * iter); // intersect the surface and after we intersect the surface
vec2 nil = vec2(0.0); float hp = texture2D(normTex, coord - move).a;
coord -= move * ((h - height) / (s + h - hp));
#define PARALLAX_ITER {\ }
height -= t;\
t = (h < height) ? s : 0.0;\
vec2 temp = (h < height) ? move : nil;\
coord += temp;\
h = texture2D(normTex, coord).a;\
}
// 8 iterations of parallax
PARALLAX_ITER
PARALLAX_ITER
PARALLAX_ITER
PARALLAX_ITER
PARALLAX_ITER
PARALLAX_ITER
PARALLAX_ITER
PARALLAX_ITER
// an additional 8 iterations for the HQ parallax
#if USE_HQ_PARALLAX
PARALLAX_ITER
PARALLAX_ITER
PARALLAX_ITER
PARALLAX_ITER
PARALLAX_ITER
PARALLAX_ITER
PARALLAX_ITER
PARALLAX_ITER
#if USE_VHQ_PARALLAX
PARALLAX_ITER
PARALLAX_ITER
PARALLAX_ITER
PARALLAX_ITER
PARALLAX_ITER
PARALLAX_ITER
PARALLAX_ITER
PARALLAX_ITER
#endif
#endif
// Move back to where we collided with the surface.
// This assumes the surface is linear between the sample point before we
// intersect the surface and after we intersect the surface
float hp = texture2D(normTex, coord - move).a;
coord -= move * ((h - height) / (s + h - hp));
} }
#endif #endif

View File

@ -34,16 +34,16 @@ varying vec2 v_los;
varying vec2 v_tex2; varying vec2 v_tex2;
#endif #endif
#if USE_SPECULAR || USE_NORMAL_MAP || USE_SPECULAR_MAP || USE_PARALLAX_MAP #if USE_SPECULAR || USE_NORMAL_MAP || USE_SPECULAR_MAP || USE_PARALLAX
varying vec4 v_normal; varying vec4 v_normal;
#if (USE_INSTANCING || USE_GPU_SKINNING) && (USE_NORMAL_MAP || USE_PARALLAX_MAP) #if (USE_INSTANCING || USE_GPU_SKINNING) && (USE_NORMAL_MAP || USE_PARALLAX)
varying vec4 v_tangent; varying vec4 v_tangent;
//varying vec3 v_bitangent; //varying vec3 v_bitangent;
#endif #endif
#if USE_SPECULAR || USE_SPECULAR_MAP #if USE_SPECULAR || USE_SPECULAR_MAP
varying vec3 v_half; varying vec3 v_half;
#endif #endif
#if (USE_INSTANCING || USE_GPU_SKINNING) && USE_PARALLAX_MAP #if (USE_INSTANCING || USE_GPU_SKINNING) && USE_PARALLAX
varying vec3 v_eyeVec; varying vec3 v_eyeVec;
#endif #endif
#endif #endif
@ -88,7 +88,7 @@ void main()
vec4 position = instancingTransform * vec4(p, 1.0); vec4 position = instancingTransform * vec4(p, 1.0);
mat3 normalMatrix = mat3(instancingTransform[0].xyz, instancingTransform[1].xyz, instancingTransform[2].xyz); mat3 normalMatrix = mat3(instancingTransform[0].xyz, instancingTransform[1].xyz, instancingTransform[2].xyz);
vec3 normal = normalMatrix * normalize(n); vec3 normal = normalMatrix * normalize(n);
#if (USE_NORMAL_MAP || USE_PARALLAX_MAP) #if (USE_NORMAL_MAP || USE_PARALLAX)
vec3 tangent = normalMatrix * a_tangent.xyz; vec3 tangent = normalMatrix * a_tangent.xyz;
#endif #endif
#else #else
@ -96,7 +96,7 @@ void main()
vec4 position = instancingTransform * vec4(a_vertex, 1.0); vec4 position = instancingTransform * vec4(a_vertex, 1.0);
mat3 normalMatrix = mat3(instancingTransform[0].xyz, instancingTransform[1].xyz, instancingTransform[2].xyz); mat3 normalMatrix = mat3(instancingTransform[0].xyz, instancingTransform[1].xyz, instancingTransform[2].xyz);
vec3 normal = normalMatrix * a_normal; vec3 normal = normalMatrix * a_normal;
#if (USE_NORMAL_MAP || USE_PARALLAX_MAP) #if (USE_NORMAL_MAP || USE_PARALLAX)
vec3 tangent = normalMatrix * a_tangent.xyz; vec3 tangent = normalMatrix * a_tangent.xyz;
#endif #endif
#else #else
@ -142,10 +142,10 @@ void main()
gl_Position = transform * position; gl_Position = transform * position;
#if USE_SPECULAR || USE_NORMAL_MAP || USE_SPECULAR_MAP || USE_PARALLAX_MAP #if USE_SPECULAR || USE_NORMAL_MAP || USE_SPECULAR_MAP || USE_PARALLAX
v_normal.xyz = normal; v_normal.xyz = normal;
#if (USE_INSTANCING || USE_GPU_SKINNING) && (USE_NORMAL_MAP || USE_PARALLAX_MAP) #if (USE_INSTANCING || USE_GPU_SKINNING) && (USE_NORMAL_MAP || USE_PARALLAX)
v_tangent.xyz = tangent; v_tangent.xyz = tangent;
vec3 bitangent = cross(v_normal.xyz, v_tangent.xyz) * a_tangent.w; vec3 bitangent = cross(v_normal.xyz, v_tangent.xyz) * a_tangent.w;
v_normal.w = bitangent.x; v_normal.w = bitangent.x;
@ -153,13 +153,13 @@ void main()
v_lighting.w = bitangent.z; v_lighting.w = bitangent.z;
#endif #endif
#if USE_SPECULAR || USE_SPECULAR_MAP || USE_PARALLAX_MAP #if USE_SPECULAR || USE_SPECULAR_MAP || USE_PARALLAX
vec3 eyeVec = cameraPos.xyz - position.xyz; vec3 eyeVec = cameraPos.xyz - position.xyz;
#if USE_SPECULAR || USE_SPECULAR_MAP #if USE_SPECULAR || USE_SPECULAR_MAP
vec3 sunVec = -sunDir; vec3 sunVec = -sunDir;
v_half = normalize(sunVec + normalize(eyeVec)); v_half = normalize(sunVec + normalize(eyeVec));
#endif #endif
#if (USE_INSTANCING || USE_GPU_SKINNING) && USE_PARALLAX_MAP #if (USE_INSTANCING || USE_GPU_SKINNING) && USE_PARALLAX
v_eyeVec = eyeVec; v_eyeVec = eyeVec;
#endif #endif
#endif #endif

View File

@ -48,23 +48,20 @@ varying vec2 v_blend;
uniform vec3 specularColor; uniform vec3 specularColor;
#endif #endif
#if USE_SPECULAR || USE_NORMAL_MAP || USE_SPECULAR_MAP || USE_PARALLAX_MAP || USE_AO #if USE_SPECULAR || USE_NORMAL_MAP || USE_SPECULAR_MAP || USE_AO
uniform vec4 effectSettings; uniform vec4 effectSettings;
#endif #endif
varying vec3 v_normal; varying vec3 v_normal;
#if USE_SPECULAR || USE_NORMAL_MAP || USE_SPECULAR_MAP || USE_PARALLAX_MAP #if USE_SPECULAR || USE_NORMAL_MAP || USE_SPECULAR_MAP
#if USE_NORMAL_MAP || USE_PARALLAX_MAP #if USE_NORMAL_MAP
varying vec4 v_tangent; varying vec4 v_tangent;
varying vec3 v_bitangent; varying vec3 v_bitangent;
#endif #endif
#if USE_SPECULAR || USE_SPECULAR_MAP #if USE_SPECULAR || USE_SPECULAR_MAP
varying vec3 v_half; varying vec3 v_half;
#endif #endif
#if USE_PARALLAX_MAP
varying vec3 v_eyeVec;
#endif
#endif #endif
float get_shadow() float get_shadow()

View File

@ -34,17 +34,14 @@ varying vec2 v_blend;
varying vec3 v_normal; varying vec3 v_normal;
#if USE_SPECULAR || USE_NORMAL_MAP || USE_SPECULAR_MAP || USE_PARALLAX_MAP #if USE_SPECULAR || USE_NORMAL_MAP || USE_SPECULAR_MAP
#if USE_NORMAL_MAP || USE_PARALLAX_MAP #if USE_NORMAL_MAP
varying vec4 v_tangent; varying vec4 v_tangent;
varying vec3 v_bitangent; varying vec3 v_bitangent;
#endif #endif
#if USE_SPECULAR || USE_SPECULAR_MAP #if USE_SPECULAR || USE_SPECULAR_MAP
varying vec3 v_half; varying vec3 v_half;
#endif #endif
#if USE_PARALLAX_MAP
varying vec3 v_eyeVec;
#endif
#endif #endif
@ -102,23 +99,20 @@ void main()
v_normal = a_normal; v_normal = a_normal;
#if USE_SPECULAR || USE_NORMAL_MAP || USE_SPECULAR_MAP || USE_PARALLAX_MAP || USE_TRIPLANAR #if USE_SPECULAR || USE_NORMAL_MAP || USE_SPECULAR_MAP || USE_TRIPLANAR
#if USE_NORMAL_MAP || USE_PARALLAX_MAP #if USE_NORMAL_MAP
vec3 t = vec3(1.0, 0.0, 0.0); vec3 t = vec3(1.0, 0.0, 0.0);
t = normalize(t - v_normal * dot(v_normal, t)); t = normalize(t - v_normal * dot(v_normal, t));
v_tangent = vec4(t, -1.0); v_tangent = vec4(t, -1.0);
v_bitangent = cross(v_normal, t); v_bitangent = cross(v_normal, t);
#endif #endif
#if USE_SPECULAR || USE_SPECULAR_MAP || USE_PARALLAX_MAP #if USE_SPECULAR || USE_SPECULAR_MAP
vec3 eyeVec = cameraPos.xyz - position.xyz; vec3 eyeVec = cameraPos.xyz - position.xyz;
#if USE_SPECULAR || USE_SPECULAR_MAP #if USE_SPECULAR || USE_SPECULAR_MAP
vec3 sunVec = -sunDir; vec3 sunVec = -sunDir;
v_half = normalize(sunVec + normalize(eyeVec)); v_half = normalize(sunVec + normalize(eyeVec));
#endif #endif
#if USE_PARALLAX_MAP
v_eyeVec = eyeVec;
#endif
#endif #endif
#endif #endif