parent
49038b9a88
commit
836b249bc6
After Width: | Height: | Size: 253 KiB |
@ -0,0 +1,11 @@ |
|||||||
|
#version 430 |
||||||
|
layout (binding=0) uniform sampler2D samp; |
||||||
|
out vec4 color; |
||||||
|
in vec2 uv; |
||||||
|
void main(void) |
||||||
|
{ |
||||||
|
color=texture(samp,uv); |
||||||
|
if(color.a<0.1){ |
||||||
|
discard; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,68 @@ |
|||||||
|
#version 430 |
||||||
|
layout (location=0) in vec3 position; |
||||||
|
layout (location=1) in vec2 texCoords; |
||||||
|
|
||||||
|
uniform mat4 proj_matrix; |
||||||
|
uniform mat4 mv_matrix; |
||||||
|
|
||||||
|
out vec2 uv; |
||||||
|
|
||||||
|
mat4 buildTranslate(float x, float y, float z); |
||||||
|
mat4 buildRotateX(float rad); |
||||||
|
mat4 buildRotateY(float rad); |
||||||
|
mat4 buildRotateZ(float rad); |
||||||
|
|
||||||
|
void main(void) |
||||||
|
{ |
||||||
|
gl_Position=proj_matrix*mv_matrix*vec4(position,1.0); |
||||||
|
uv=texCoords; |
||||||
|
} |
||||||
|
// builds and returns a translation matrix |
||||||
|
mat4 buildTranslate(float x, float y, float z) |
||||||
|
{ |
||||||
|
mat4 trans = mat4(1.0, 0.0, 0.0, 0.0, |
||||||
|
0.0, 1.0, 0.0, 0.0, |
||||||
|
0.0, 0.0, 1.0, 0.0, |
||||||
|
x, y, z, 1.0 ); |
||||||
|
return trans; |
||||||
|
} |
||||||
|
|
||||||
|
// builds and returns a matrix that performs a rotation around the X axis |
||||||
|
mat4 buildRotateX(float rad) |
||||||
|
{ |
||||||
|
mat4 xrot = mat4(1.0, 0.0, 0.0, 0.0, |
||||||
|
0.0, cos(rad), -sin(rad), 0.0, |
||||||
|
0.0, sin(rad), cos(rad), 0.0, |
||||||
|
0.0, 0.0, 0.0, 1.0 ); |
||||||
|
return xrot; |
||||||
|
} |
||||||
|
|
||||||
|
// builds and returns a matrix that performs a rotation around the Y axis |
||||||
|
mat4 buildRotateY(float rad) |
||||||
|
{ |
||||||
|
mat4 yrot = mat4(cos(rad), 0.0, sin(rad), 0.0, |
||||||
|
0.0, 1.0, 0.0, 0.0, |
||||||
|
-sin(rad), 0.0, cos(rad), 0.0, |
||||||
|
0.0, 0.0, 0.0, 1.0 ); |
||||||
|
return yrot; |
||||||
|
} |
||||||
|
|
||||||
|
// builds and returns a matrix that performs a rotation around the Z axis |
||||||
|
mat4 buildRotateZ(float rad) |
||||||
|
{ |
||||||
|
mat4 zrot = mat4(cos(rad), -sin(rad), 0.0, 0.0, |
||||||
|
sin(rad), cos(rad), 0.0, 0.0, |
||||||
|
0.0, 0.0, 1.0, 0.0, |
||||||
|
0.0, 0.0, 0.0, 1.0 ); |
||||||
|
return zrot; |
||||||
|
} |
||||||
|
|
||||||
|
// builds and returns a scale matrix |
||||||
|
mat4 buildScale(float x, float y, float z) |
||||||
|
{ |
||||||
|
mat4 scale = mat4(x, 0.0, 0.0, 0.0, |
||||||
|
0.0, y, 0.0, 0.0, |
||||||
|
0.0, 0.0, z, 0.0, |
||||||
|
0.0, 0.0, 0.0, 1.0 ); |
||||||
|
return scale; |
||||||
|
} |
@ -1,8 +1,7 @@ |
|||||||
#version 430 |
#version 430 |
||||||
layout (binding=0) uniform sampler2D samp; |
|
||||||
out vec4 color; |
out vec4 color; |
||||||
in vec2 uv; |
in vec4 varyingColor; |
||||||
void main(void) |
void main(void) |
||||||
{ |
{ |
||||||
color=texture(samp,uv); |
color=varyingColor; |
||||||
} |
} |
Loading…
Reference in new issue