mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-17 00:56:07 +09:00
more shader shenanigans
This commit is contained in:
@@ -36,36 +36,41 @@ class UIHandler(//var UI: UICanvas,
|
||||
|
||||
companion object {
|
||||
private val SHADER_PROG_FRAG = """
|
||||
#version 130
|
||||
#version 150
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
uniform float opacity;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main(void) {
|
||||
vec4 color = texture2D(u_texture, v_texCoords).rgba;
|
||||
vec4 color = texture(u_texture, v_texCoords).rgba;
|
||||
|
||||
gl_FragColor = v_color * vec4(color.rgb, color.a * opacity);
|
||||
fragColor = v_color * vec4(color.rgb, color.a * opacity);
|
||||
}
|
||||
""".trimIndent()
|
||||
|
||||
private val SHADER_PROG_VERT = """
|
||||
attribute vec4 a_position;
|
||||
attribute vec4 a_color;
|
||||
attribute vec2 a_texCoord0;
|
||||
#version 150
|
||||
|
||||
in vec4 a_position;
|
||||
in vec4 a_color;
|
||||
in vec2 a_texCoord0;
|
||||
|
||||
uniform mat4 u_projTrans;
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
out vec4 v_color;
|
||||
out vec2 v_texCoords;
|
||||
|
||||
void main() {
|
||||
v_color = a_color;
|
||||
v_color.a = v_color.a * (255.0/254.0);
|
||||
v_texCoords = a_texCoord0;
|
||||
gl_Position = u_projTrans * a_position;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user