Implement RGSS2 Tilemap class (TilemapVX)
This commit is contained in:
parent
3717609142
commit
7790bd6c2c
12 changed files with 1797 additions and 9 deletions
33
shader/tilemapvx.vert
Normal file
33
shader/tilemapvx.vert
Normal file
|
@ -0,0 +1,33 @@
|
|||
|
||||
uniform mat4 projMat;
|
||||
|
||||
uniform vec2 texSizeInv;
|
||||
uniform vec2 translation;
|
||||
|
||||
uniform vec2 aniOffset;
|
||||
|
||||
attribute vec2 position;
|
||||
attribute vec2 texCoord;
|
||||
|
||||
varying vec2 v_texCoord;
|
||||
|
||||
const vec2 atAreaA = vec2(9.0*32.0, 12.0*32.0);
|
||||
const float atAreaCX = 12.0*32.0;
|
||||
const float atAreaCW = 4.0*32.0;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 tex = texCoord;
|
||||
|
||||
/* Type A autotiles shift horizontally */
|
||||
if (tex.x <= atAreaA.x && tex.y <= atAreaA.y)
|
||||
tex.x += aniOffset.x;
|
||||
|
||||
/* Type C autotiles shift vertically */
|
||||
if (tex.x >= atAreaCX && tex.x <= (atAreaCX+atAreaCW) && tex.y <= atAreaA.y)
|
||||
tex.y += aniOffset.y;
|
||||
|
||||
gl_Position = projMat * vec4(position + translation, 0, 1);
|
||||
|
||||
v_texCoord = tex * texSizeInv;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue