Zhanghua
Member
I want to deal the sprite image by the effect as following:
Top is dark, and Bottom is bright, and Middle is linear change.
So I did that by this way out of my prediction.
shd_Ice.VSH:
shd_Ice.FSH
Draw Event
So, I'm confused by the relative position to draw.....
Top is dark, and Bottom is bright, and Middle is linear change.
So I did that by this way out of my prediction.
shd_Ice.VSH:
Code:
//
attribute vec3 in_Position; // (x,y,z)
//attribute vec3 in_Normal; // (x,y,z) unused in this shader.
attribute vec4 in_Colour; // (r,g,b,a)
attribute vec2 in_TextureCoord; // (u,v)
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
void main()
{
//vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0);
//gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * vec4(in_Position, 1.0);
v_vColour = in_Colour;
v_vTexcoord = in_TextureCoord;
}
shd_Ice.FSH
Code:
//
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
void main()
{
vec2 uv = v_vTexcoord;
vec4 colour = texture2D( gm_BaseTexture, v_vTexcoord );
colour.r = (colour.r + uv.y )/2.0;
colour.g = (colour.g + uv.y )/2.0;
colour.b = (colour.b + uv.y )/2.0;
gl_FragColor = vec4(colour.rgb, texture2D(gm_BaseTexture,uv).a);
}
Draw Event
Code:
shader_set(shd_Ice);
draw_self();
shader_reset();
So, I'm confused by the relative position to draw.....