Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
40 lines (26 sloc) 742 Bytes
@shader
#version 150
@vertex
uniform mat4 display_matrix;
in vec3 offset;
in vec3 position;
in vec2 mapping;
in vec4 color;
out vec4 surface_color;
out vec2 diffuse_mapping;
void main () {
vec3 u = vec3(display_matrix[0][0], display_matrix[1][0], display_matrix[2][0]);
vec3 v = vec3(display_matrix[0][1], display_matrix[1][1], display_matrix[2][1]);
vec3 corner = (offset.x * u + offset.y * v) + position;
diffuse_mapping = mapping;
surface_color = color;
gl_Position = display_matrix * vec4(corner, 1.0);
}
@fragment
uniform sampler2D diffuse_texture;
in vec4 surface_color;
in vec2 diffuse_mapping;
out vec4 fragment_color;
void main() {
fragment_color = texture(diffuse_texture, diffuse_mapping) * surface_color;
}