parent
a82f3b5f14
commit
17ff7d02dd
|
@ -8,7 +8,6 @@ uniform sampler2D la;
|
|||
uniform sampler2D tex;
|
||||
|
||||
in vec2 in_text;
|
||||
out vec4 f_color;
|
||||
|
||||
vec2 barrel(vec2 vert)
|
||||
{
|
||||
|
@ -27,7 +26,7 @@ void main(void)
|
|||
vec2 text = barrel(in_text * 2.0 - 1.0);
|
||||
vec2 vert = text * 2.0 - 1.0;
|
||||
|
||||
f_color = texture(la, text) + vec4(
|
||||
gl_FragColor = texture(la, text) + vec4(
|
||||
texture(tex, fringe(vert, -abrtn)).r,
|
||||
texture(tex, fringe(vert, abrtn)).g,
|
||||
texture(tex, text).b, 1.0);
|
||||
|
|
|
@ -7,11 +7,10 @@ const float coeffs[13] = float[](
|
|||
uniform sampler2D tex;
|
||||
|
||||
in vec2 coords[13];
|
||||
out vec4 f_color;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
f_color = vec4(0.0);
|
||||
gl_FragColor = vec4(0.0);
|
||||
for (int i = 0; i < 13; ++i)
|
||||
f_color += texture(tex, coords[i]) * coeffs[i];
|
||||
gl_FragColor += texture(tex, coords[i]) * coeffs[i];
|
||||
}
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
#version 330 core
|
||||
layout (lines) in;
|
||||
layout (line_strip, max_vertices = 54) out;
|
||||
|
||||
uniform float visibility;
|
||||
uniform vec3 camera;
|
||||
uniform mat4 vp;
|
||||
|
||||
out float intensity;
|
||||
|
||||
void translate(inout vec4 delta)
|
||||
{
|
||||
vec4 vert;
|
||||
float dist;
|
||||
for (int n = 0; n < 2; ++n) {
|
||||
vert = gl_in[n].gl_Position + delta;
|
||||
dist = distance(camera, vec3(vert));
|
||||
intensity = 1 / (1 + dist * dist / visibility);
|
||||
gl_Position = vp * vert;
|
||||
EmitVertex();
|
||||
}
|
||||
EndPrimitive();
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
float i, j, k;
|
||||
for (i = -12.0; i < 12.3; i += 12.0)
|
||||
for (j = -12.0; j < 12.3; j += 12.0)
|
||||
for (k = -9.0; k < 12.3; k += 9.0)
|
||||
translate(vec4(i, j, k, 0.0));
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
#version 330
|
||||
|
||||
in vec3 color;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = vec4(color, 1.0);
|
||||
}
|
|
@ -1,14 +1,23 @@
|
|||
#version 330
|
||||
|
||||
uniform mat4 mvp;
|
||||
uniform vec3 camera;
|
||||
const float SAT = 0.123456789;
|
||||
const vec3 SIZE = vec3(12, 12, 9);
|
||||
const vec3 K = acos(-1) / 1.5 / SIZE;
|
||||
const mat3 YUV = mat3(1.0, 1.0, 1.0,
|
||||
0.0, -0.39465, 2.03211,
|
||||
1.13983, -0.58060, 0.0);
|
||||
|
||||
uniform float visibility;
|
||||
uniform mat4 mvp;
|
||||
|
||||
in vec3 in_vert;
|
||||
out float intensity;
|
||||
out vec3 color;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = mvp * vec4(in_vert, 1.0);
|
||||
intensity = 1 / (1 + pow(distance(camera, in_vert), 2) / visibility);
|
||||
float Y = 1 / (1 + pow(1 - gl_Position.z, 2) / visibility);
|
||||
vec3 vert = mod((in_vert + SIZE), SIZE) * K;
|
||||
float angle = vert.x + vert.y + vert.z;
|
||||
color = YUV * vec3(Y, cos(angle) * SAT, sin(angle) * SAT);
|
||||
}
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
uniform vec3 color;
|
||||
|
||||
in float intensity;
|
||||
out vec4 f_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
f_color = vec4(color * intensity, 1.0);
|
||||
gl_FragColor = vec4(color * intensity, 1.0);
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
#version 330 core
|
||||
#version 330
|
||||
layout (triangles) in;
|
||||
layout (triangle_strip, max_vertices = 81) out;
|
||||
|
|
@ -3,11 +3,11 @@
|
|||
uniform sampler2D tex;
|
||||
|
||||
in vec2 in_text;
|
||||
out vec4 f_color;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
f_color = texture(tex, in_text) * 0.5;
|
||||
float r = f_color.r, g = f_color.g, b = f_color.b;
|
||||
f_color *= abs(r - g) + abs(g - b) + abs(b - r);
|
||||
gl_FragColor = texture(tex, in_text) * 0.69;
|
||||
float r = gl_FragColor.r, g = gl_FragColor.g, b = gl_FragColor.b;
|
||||
gl_FragColor *= abs(r - g) + abs(g - b) + abs(b - r);
|
||||
gl_FragColor -= r * g * b * 4.2;
|
||||
}
|
||||
|
|
15
axuy/view.py
15
axuy/view.py
|
@ -64,10 +64,10 @@ OCTOINDECIES = np.int32([0, 1, 2, 0, 1, 3, 4, 0, 2, 4, 0, 3,
|
|||
2, 1, 5, 3, 1, 5, 2, 5, 4, 3, 5, 4])
|
||||
|
||||
with open(abspath('shaders/map.vert')) as f: MAP_VERTEX = f.read()
|
||||
with open(abspath('shaders/map.frag')) as f: MAP_FRAGMENT = f.read()
|
||||
with open(abspath('shaders/pico.vert')) as f: PICO_VERTEX = f.read()
|
||||
with open(abspath('shaders/line.geom')) as f: LINE_GEOMETRY = f.read()
|
||||
with open(abspath('shaders/triangle.geom')) as f: TRIANGLE_GEOMETRY = f.read()
|
||||
with open(abspath('shaders/world.frag')) as f: WORLD_FRAGMENT = f.read()
|
||||
with open(abspath('shaders/pico.geom')) as f: PICO_GEOMETRY = f.read()
|
||||
with open(abspath('shaders/pico.frag')) as f: PICO_FRAGMENT = f.read()
|
||||
|
||||
with open(abspath('shaders/tex.vert')) as f: TEX_VERTEX = f.read()
|
||||
with open(abspath('shaders/sat.frag')) as f: SAT_FRAGMENT = f.read()
|
||||
|
@ -317,8 +317,7 @@ class View:
|
|||
|
||||
# GLSL program and vertex array for map rendering
|
||||
self.maprog = context.program(vertex_shader=MAP_VERTEX,
|
||||
fragment_shader=WORLD_FRAGMENT)
|
||||
self.maprog['color'].write(bytes((0, 0, 128, 63) * 3))
|
||||
fragment_shader=MAP_FRAGMENT)
|
||||
mapvb = context.buffer(np.stack(vertices).astype(np.float32).tobytes())
|
||||
self.mapva = context.simple_vertex_array(self.maprog, mapvb, 'in_vert')
|
||||
|
||||
|
@ -329,8 +328,8 @@ class View:
|
|||
sib = context.buffer(OCTOINDECIES.tobytes())
|
||||
|
||||
self.prog = context.program(vertex_shader=PICO_VERTEX,
|
||||
geometry_shader=TRIANGLE_GEOMETRY,
|
||||
fragment_shader=WORLD_FRAGMENT)
|
||||
geometry_shader=PICO_GEOMETRY,
|
||||
fragment_shader=PICO_FRAGMENT)
|
||||
self.pva = context.vertex_array(self.prog, pvb, pib)
|
||||
self.sva = context.vertex_array(self.prog, svb, sib)
|
||||
|
||||
|
@ -517,7 +516,6 @@ class View:
|
|||
|
||||
# Render map
|
||||
self.maprog['visibility'].value = visibility
|
||||
self.maprog['camera'].write(self.pos.tobytes())
|
||||
self.maprog['mvp'].write(vp)
|
||||
self.mapva.render(moderngl.TRIANGLES)
|
||||
|
||||
|
@ -525,7 +523,6 @@ class View:
|
|||
self.prog['visibility'].value = visibility
|
||||
self.prog['camera'].write(self.pos.tobytes())
|
||||
self.prog['vp'].write(vp)
|
||||
|
||||
picos = list(self.picos.values())
|
||||
for pico in picos:
|
||||
shards = {}
|
||||
|
|
Loading…
Reference in New Issue