SHADER_DEFINE( colour_shader,
// VERTEX
- "layout (location=0) in vec3 a_co;"
+ "layout (location=0) in vec2 a_co;"
"uniform mat4 uPv;"
"uniform mat4 uMdl;"
""
"void main()"
"{"
- " vec4 vert_pos = uPv * uMdl * vec4( a_co, 1.0 );"
- " gl_Position = vert_pos;"
+ " vec4 vert_pos = uPv * uMdl * vec4( a_co.x, 0.0, a_co.y, 1.0 );"
+ " gl_Position = vert_pos;"
"}",
// FRAGMENT
""
"void main()"
"{"
- " FragColor = uColour;"
+ " FragColor = uColour;"
"}"
,
UNIFORMS({ "uPv", "uMdl", "uColour" })
)
+/*
+SHADER_DEFINE( tilemap_shader,
+
+ // VERTEX
+ "layout (location=0) in vec2 a_co;"
+ "uniform mat4 uPv;"
+ "uniform vec4 uTextureInfo;" // Cell dx,dy 1.0/mx, 1.0/my
+ "uniform "
+ ""
+ "uniform vec2 uPosition;"
+ "uniform int uCellIndex;"
+ ""
+ "out vec2 s_uv;"
+ ""
+ "void main()"
+ "{"
+ " gl_Position = uPv * vec4( uPosition.x + a_co.x, 0.0, uPosition.y + a_co.y, 0.0 );"
+ " s_uv = vec2( mod( uCellIndex,"
+ "}"
+*/
+
mat4 m_projection;
mat4 m_view;
mat4 m_mdl;
u32 flags;
}
stack;
+
+ GLuint tile_texture;
+ GLuint flow_texture;
}
map;
float quad_mesh[] =
{
- -0.5f, 0.f, -0.5f,
- -0.5f, 0.f, 0.5f,
- 0.5f, 0.f, 0.5f,
- -0.5f, 0.f, -0.5f,
- 0.5f, 0.f, 0.5f,
- 0.5f, 0.f, -0.5f
+ 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f,
+ 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f
};
glBindVertexArray( tile_vao );
GL_STATIC_DRAW
);
- glVertexAttribPointer( 0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0 );
+ glVertexAttribPointer( 0, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(float), (void*)0 );
glEnableVertexAttribArray( 0 );
VG_CHECK_GL();
+ map.tile_texture = vg_tex2d_rgba( "textures/rivertiles_flowm.tga" );
+ map.flow_texture = vg_tex2d_rgba( "textures/rivertiles_ripple.tga" );
+
map_load
(
"#####-#####;aa\n"
void vg_free(void)
{
map_free();
+
+ glDeleteTextures( 1, &map.tile_texture );
+ glDeleteTextures( 1, &map.flow_texture );
}
void vg_ui(void)