mirror of https://github.com/axmolengine/axmol.git
update test 15:29
This commit is contained in:
parent
1bbe9e249d
commit
95bcfaaa3e
|
@ -103,7 +103,7 @@ static Layer* restartSpriteTestAction()
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
Sprite3DTestDemo::Sprite3DTestDemo(void)
|
Sprite3DTestDemo::Sprite3DTestDemo(void)
|
||||||
: BaseTest()
|
: BaseTest()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,7 @@ protected:
|
||||||
float _outlineWidth;
|
float _outlineWidth;
|
||||||
//weak reference
|
//weak reference
|
||||||
EffectSprite3D* _sprite;
|
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;
|
EventListenerCustom* _backToForegroundListener;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifdef GL_ES
|
#ifdef GL_ES
|
||||||
varying mediump vec2 TextureCoordOut;
|
varying mediump vec2 v_texture_coord;
|
||||||
#else
|
#else
|
||||||
varying vec2 TextureCoordOut;
|
varying vec2 v_texture_coord;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uniform vec4 u_color;
|
uniform vec4 u_color;
|
||||||
|
@ -12,5 +12,5 @@ void main(void)
|
||||||
{
|
{
|
||||||
vec4 color = duration*vec4(0,0.8,0.4,1.0);
|
vec4 color = duration*vec4(0,0.8,0.4,1.0);
|
||||||
//blend two texture
|
//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;
|
||||||
}
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
attribute vec4 a_position;
|
attribute vec4 a_position;
|
||||||
attribute vec2 a_texCoord;
|
attribute vec2 a_texCoord;
|
||||||
uniform float offset;
|
uniform float offset;
|
||||||
varying vec2 TextureCoordOut;
|
varying vec2 v_texture_coord;
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
gl_Position = CC_MVPMatrix * a_position;
|
gl_Position = CC_MVPMatrix * a_position;
|
||||||
TextureCoordOut = a_texCoord;
|
v_texture_coord = a_texCoord;
|
||||||
TextureCoordOut.y = (1.0 - TextureCoordOut.y);
|
v_texture_coord.y = (1.0 - v_texture_coord.y);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#ifdef GL_ES
|
#ifdef GL_ES
|
||||||
varying mediump vec2 TextureCoordOut;
|
varying mediump vec2 v_texture_coord;
|
||||||
varying mediump vec4 v_position;
|
varying mediump vec4 v_position;
|
||||||
#else
|
#else
|
||||||
varying vec2 TextureCoordOut;
|
varying vec2 v_texture_coord;
|
||||||
varying vec4 v_position;
|
varying vec4 v_position;
|
||||||
#endif
|
#endif
|
||||||
uniform sampler2D u_shadowTexture;
|
uniform sampler2D u_shadowTexture;
|
||||||
|
@ -18,5 +18,5 @@ void main(void)
|
||||||
coord.x = dot(v_position.xyz - u_target_pos, UVector) + 0.5f;
|
coord.x = dot(v_position.xyz - u_target_pos, UVector) + 0.5f;
|
||||||
coord.y = dot(v_position.xyz - u_target_pos, VVector) + 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);
|
||||||
}
|
}
|
|
@ -1,12 +1,12 @@
|
||||||
attribute vec4 a_position;
|
attribute vec4 a_position;
|
||||||
attribute vec2 a_texCoord;
|
attribute vec2 a_texCoord;
|
||||||
varying vec2 TextureCoordOut;
|
varying vec2 v_texture_coord;
|
||||||
varying vec4 v_position;
|
varying vec4 v_position;
|
||||||
uniform mat4 u_model_matrix;
|
uniform mat4 u_model_matrix;
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
gl_Position = CC_PMatrix * CC_MVMatrix * a_position;
|
gl_Position = CC_PMatrix * CC_MVMatrix * a_position;
|
||||||
TextureCoordOut = a_texCoord;
|
v_texture_coord = a_texCoord;
|
||||||
TextureCoordOut.y = (1.0 - TextureCoordOut.y);
|
v_texture_coord.y = (1.0 - v_texture_coord.y);
|
||||||
v_position = u_model_matrix * a_position;
|
v_position = u_model_matrix * a_position;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifdef GL_ES
|
#ifdef GL_ES
|
||||||
varying mediump vec2 TextureCoordOut;
|
varying mediump vec2 v_texture_coord;
|
||||||
#else
|
#else
|
||||||
varying vec2 TextureCoordOut;
|
varying vec2 v_texture_coord;
|
||||||
#endif
|
#endif
|
||||||
uniform vec4 u_color;
|
uniform vec4 u_color;
|
||||||
varying vec3 v_normal;
|
varying vec3 v_normal;
|
||||||
|
@ -12,7 +12,7 @@ void main(void)
|
||||||
vec3 light_color = vec3(1,1,1);
|
vec3 light_color = vec3(1,1,1);
|
||||||
vec3 normal = normalize(v_normal);
|
vec3 normal = normalize(v_normal);
|
||||||
float diffuse_factor = dot(normal,-light_direction);
|
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;
|
if (diffuse_factor > 0.95) diffuse_factor=1.0;
|
||||||
else if (diffuse_factor > 0.75) diffuse_factor = 0.8;
|
else if (diffuse_factor > 0.75) diffuse_factor = 0.8;
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
attribute vec4 a_position;
|
attribute vec4 a_position;
|
||||||
attribute vec2 a_texCoord;
|
attribute vec2 a_texCoord;
|
||||||
attribute vec3 a_normal;
|
attribute vec3 a_normal;
|
||||||
varying vec2 TextureCoordOut;
|
varying vec2 v_texture_coord;
|
||||||
varying vec3 v_normal;
|
varying vec3 v_normal;
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
gl_Position = CC_MVPMatrix * a_position;
|
gl_Position = CC_MVPMatrix * a_position;
|
||||||
TextureCoordOut = a_texCoord;
|
v_texture_coord = a_texCoord;
|
||||||
TextureCoordOut.y = (1.0 - TextureCoordOut.y);
|
v_texture_coord.y = (1.0 - v_texture_coord.y);
|
||||||
v_normal = CC_NormalMatrix *a_normal;
|
v_normal = CC_NormalMatrix *a_normal;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue