More work on REAL 3D object decode/render; Some OpenGL stuff
This commit is contained in:
@@ -1,21 +1,30 @@
|
||||
#version 330 core
|
||||
#extension GL_ARB_explicit_uniform_location : enable
|
||||
#extension GL_ARB_conservative_depth : enable
|
||||
|
||||
layout(location = 1) uniform sampler2D texBase;
|
||||
layout(location = 2) uniform sampler2DArray texAnim;
|
||||
layout(location = 3) uniform uint animFrame;
|
||||
layout(location = 2) uniform sampler2D texBase;
|
||||
layout(location = 3) uniform sampler2DArray texAnim;
|
||||
layout(location = 4) uniform uint animFrame;
|
||||
layout(location = 5) uniform vec3 IDcolor;
|
||||
|
||||
in vec2 fragTC;
|
||||
flat in uint fragUseAnimTex;
|
||||
|
||||
out vec4 color;
|
||||
layout(location = 0) out vec4 color;
|
||||
layout(location = 1) out vec4 IDcolor_out;
|
||||
layout(depth_unchanged) out float gl_FragDepth;
|
||||
|
||||
void main(void) {
|
||||
vec2 texDx = dFdx(fragTC);
|
||||
vec2 texDy = dFdy(fragTC);
|
||||
|
||||
if (fragUseAnimTex > 0u)
|
||||
color = textureGrad(texAnim, vec3(fragTC, animFrame), texDx, texDy);
|
||||
//color = vec4(1.0, 1.0, 0.0, 1.0);
|
||||
else
|
||||
color = textureGrad(texBase, fragTC, texDx, texDy);
|
||||
|
||||
if (color.w < 0.5)
|
||||
discard;
|
||||
|
||||
IDcolor_out = vec4(IDcolor, 1.0);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
#extension GL_ARB_shading_language_420pack : enable
|
||||
#extension GL_ARB_explicit_uniform_location : enable
|
||||
|
||||
layout(location = 0) uniform mat4 mvp_matrix;
|
||||
layout(location = 0) uniform mat4 vp_matrix;
|
||||
layout(location = 1) uniform mat4 m_matrix;
|
||||
|
||||
layout(location = 0) in vec3 vertex;
|
||||
layout(location = 1) in vec2 vertexTC;
|
||||
@@ -12,8 +13,8 @@ out vec2 fragTC;
|
||||
flat out uint fragUseAnimTex;
|
||||
|
||||
void main(void) {
|
||||
gl_Position = mvp_matrix * vec4(vertex, 1.0);
|
||||
gl_Position = vp_matrix * m_matrix * vec4(vertex, 1.0);
|
||||
|
||||
fragTC = vertexTC;
|
||||
fragUseAnimTex = useAnimTex;
|
||||
fragTC = vertexTC;
|
||||
fragUseAnimTex = useAnimTex;
|
||||
}
|
||||
|
||||
@@ -5,8 +5,9 @@ layout(location = 1) uniform sampler2D texBase;
|
||||
|
||||
in vec2 fragTC;
|
||||
|
||||
out vec4 color;
|
||||
layout(location = 0) out vec4 color;
|
||||
|
||||
void main(void) {
|
||||
color = texture(texBase, fragTC);
|
||||
vec4 texCol = texture(texBase, fragTC);
|
||||
color = texCol*texCol.w;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user