update test 15:29

This commit is contained in:
tangziwen 2014-12-19 15:31:06 +08:00
parent 1bbe9e249d
commit 95bcfaaa3e
8 changed files with 20 additions and 20 deletions

View File

@ -103,7 +103,7 @@ static Layer* restartSpriteTestAction()
//------------------------------------------------------------------
Sprite3DTestDemo::Sprite3DTestDemo(void)
: BaseTest()
: BaseTest()
{
}

View File

@ -173,7 +173,7 @@ protected:
float _outlineWidth;
//weak reference
EffectSprite3D* _sprite;
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WP8 || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
EventListenerCustom* _backToForegroundListener;
#endif

View File

@ -1,7 +1,7 @@
#ifdef GL_ES
varying mediump vec2 TextureCoordOut;
varying mediump vec2 v_texture_coord;
#else
varying vec2 TextureCoordOut;
varying vec2 v_texture_coord;
#endif
uniform vec4 u_color;
@ -12,5 +12,5 @@ void main(void)
{
vec4 color = duration*vec4(0,0.8,0.4,1.0);
//blend two texture
gl_FragColor = u_color*texture2D(CC_Texture0, vec2(TextureCoordOut.x- 2.0 * offset,TextureCoordOut.y)) * vec4(0.3,0.3,0.3,1)+texture2D(caustics,vec2(TextureCoordOut.x-offset,TextureCoordOut.y)).r*color;
gl_FragColor = u_color*texture2D(CC_Texture0, vec2(v_texture_coord.x- 2.0 * offset,v_texture_coord.y)) * vec4(0.3,0.3,0.3,1)+texture2D(caustics,vec2(v_texture_coord.x-offset,v_texture_coord.y)).r*color;
}

View File

@ -1,10 +1,10 @@
attribute vec4 a_position;
attribute vec2 a_texCoord;
uniform float offset;
varying vec2 TextureCoordOut;
varying vec2 v_texture_coord;
void main(void)
{
gl_Position = CC_MVPMatrix * a_position;
TextureCoordOut = a_texCoord;
TextureCoordOut.y = (1.0 - TextureCoordOut.y);
v_texture_coord = a_texCoord;
v_texture_coord.y = (1.0 - v_texture_coord.y);
}

View File

@ -1,8 +1,8 @@
#ifdef GL_ES
varying mediump vec2 TextureCoordOut;
varying mediump vec2 v_texture_coord;
varying mediump vec4 v_position;
#else
varying vec2 TextureCoordOut;
varying vec2 v_texture_coord;
varying vec4 v_position;
#endif
uniform sampler2D u_shadowTexture;
@ -18,5 +18,5 @@ void main(void)
coord.x = dot(v_position.xyz - u_target_pos, UVector) + 0.5f;
coord.y = dot(v_position.xyz - u_target_pos, VVector) + 0.5f;
gl_FragColor = u_color*texture2D(CC_Texture0,TextureCoordOut)*texture2D(u_shadowTexture,coord);
gl_FragColor = u_color*texture2D(CC_Texture0,v_texture_coord)*texture2D(u_shadowTexture,coord);
}

View File

@ -1,12 +1,12 @@
attribute vec4 a_position;
attribute vec2 a_texCoord;
varying vec2 TextureCoordOut;
varying vec2 v_texture_coord;
varying vec4 v_position;
uniform mat4 u_model_matrix;
void main(void)
{
gl_Position = CC_PMatrix * CC_MVMatrix * a_position;
TextureCoordOut = a_texCoord;
TextureCoordOut.y = (1.0 - TextureCoordOut.y);
v_texture_coord = a_texCoord;
v_texture_coord.y = (1.0 - v_texture_coord.y);
v_position = u_model_matrix * a_position;
}

View File

@ -1,7 +1,7 @@
#ifdef GL_ES
varying mediump vec2 TextureCoordOut;
varying mediump vec2 v_texture_coord;
#else
varying vec2 TextureCoordOut;
varying vec2 v_texture_coord;
#endif
uniform vec4 u_color;
varying vec3 v_normal;
@ -12,7 +12,7 @@ void main(void)
vec3 light_color = vec3(1,1,1);
vec3 normal = normalize(v_normal);
float diffuse_factor = dot(normal,-light_direction);
vec4 diffuse_color = texture2D(CC_Texture0,TextureCoordOut);
vec4 diffuse_color = texture2D(CC_Texture0,v_texture_coord);
if (diffuse_factor > 0.95) diffuse_factor=1.0;
else if (diffuse_factor > 0.75) diffuse_factor = 0.8;

View File

@ -1,12 +1,12 @@
attribute vec4 a_position;
attribute vec2 a_texCoord;
attribute vec3 a_normal;
varying vec2 TextureCoordOut;
varying vec2 v_texture_coord;
varying vec3 v_normal;
void main(void)
{
gl_Position = CC_MVPMatrix * a_position;
TextureCoordOut = a_texCoord;
TextureCoordOut.y = (1.0 - TextureCoordOut.y);
v_texture_coord = a_texCoord;
v_texture_coord.y = (1.0 - v_texture_coord.y);
v_normal = CC_NormalMatrix *a_normal;
}