Work on resolving which trixel are we in the mesh
This commit is contained in:
parent
94c991bc4a
commit
e33abb6b9c
@ -155,6 +155,7 @@ draw_level_editor :: () {
|
||||
bindings : sg_bindings;
|
||||
bindings.vertex_buffers[0] = trilegfx.vertex_buffer;
|
||||
bindings.vertex_buffers[1] = trilegfx.normal_buffer;
|
||||
bindings.vertex_buffers[2] = trilegfx.centre_buffer;
|
||||
bindings.samplers[0] = gPipelines.trile.bind.samplers[0];
|
||||
bindings.images[0] = trilegfx.trixel_colors;
|
||||
|
||||
|
||||
@ -411,10 +411,10 @@ generate_optimized_quad_mesh :: (trilept: *Trile, vecs: *[..]float, normals: *[.
|
||||
}
|
||||
|
||||
Pool :: #import "Pool";
|
||||
meshgenpool : Pool.Pool;
|
||||
|
||||
generate_trile_gfx_matias :: (trileptr : *Trile) -> Trile_GFX {
|
||||
meshgenpool : Pool.Pool;
|
||||
Pool.set_allocators(*meshgenpool);
|
||||
Pool.set_allocators(*meshgenpool); // @ToDo: Only do this if we haven't yet done it.
|
||||
new_context := context;
|
||||
new_context.allocator = .{Pool.pool_allocator_proc, *meshgenpool};
|
||||
push_context new_context {
|
||||
@ -433,10 +433,38 @@ generate_trile_gfx_matias :: (trileptr : *Trile) -> Trile_GFX {
|
||||
trile_normal_buffer_info := sg_buffer_desc.{ data = .{ ptr = triangleNorms.data, size = xx (triangleNorms.count * 4) } };
|
||||
trile_normal_buffer := sg_make_buffer(*trile_normal_buffer_info);
|
||||
|
||||
Pool.reset(*meshgenpool);
|
||||
|
||||
print("Successfully generated mesh for trile with % triangles.\n", triangleVecs.count / 3 / 3);
|
||||
|
||||
centres : [..]float;
|
||||
|
||||
// Generate triangle centers.
|
||||
for 0..(triangleVecs.count/3/3)-1 {
|
||||
x1 := triangleVecs[it * 9 + 0];
|
||||
x2 := triangleVecs[it * 9 + 3];
|
||||
x3 := triangleVecs[it * 9 + 6];
|
||||
xr := (x1+x2+x3) / 3.0;
|
||||
|
||||
y1 := triangleVecs[it * 9 + 1];
|
||||
y2 := triangleVecs[it * 9 + 4];
|
||||
y3 := triangleVecs[it * 9 + 7];
|
||||
yr := (y1+y2+y3) / 3.0;
|
||||
|
||||
z1 := triangleVecs[it * 9 + 2];
|
||||
z2 := triangleVecs[it * 9 + 5];
|
||||
z3 := triangleVecs[it * 9 + 8];
|
||||
zr := (z1+z2+z3) / 3.0;
|
||||
|
||||
for 0..2 {
|
||||
array_add(*centres, xr);
|
||||
array_add(*centres, yr);
|
||||
array_add(*centres, zr);
|
||||
}
|
||||
}
|
||||
|
||||
trile_centre_buffer_info := sg_buffer_desc.{ data = .{ ptr = centres.data, size = xx (centres.count * 4) } };
|
||||
trile_centre_buffer := sg_make_buffer(*trile_centre_buffer_info);
|
||||
|
||||
Pool.reset(*meshgenpool);
|
||||
// Create the texture for the trile, from which it gets it's colors for trixels.
|
||||
|
||||
materialdata : [16*16*16*4]u8;
|
||||
@ -481,6 +509,6 @@ generate_trile_gfx_matias :: (trileptr : *Trile) -> Trile_GFX {
|
||||
state := sg_query_image_state(img);
|
||||
print("IMG: %\n", state);
|
||||
|
||||
return .{ img, trile_vert_buffer, trile_normal_buffer, triangleVecs.count / 3 };
|
||||
return .{ img, trile_vert_buffer, trile_normal_buffer, trile_centre_buffer, triangleVecs.count / 3 };
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,9 +163,11 @@ create_trile_pipeline :: () {
|
||||
pipeline.shader = sg_make_shader(*shader_desc);
|
||||
pipeline.layout.buffers[0].stride = 4*3;
|
||||
pipeline.layout.buffers[1].stride = 4*3;
|
||||
pipeline.layout.buffers[1].stride = 4*3;
|
||||
|
||||
pipeline.layout.attrs[ATTR_trile_position] = .{ format = .FLOAT3, buffer_index = 0 };
|
||||
pipeline.layout.attrs[ATTR_trile_normal] = .{ format = .FLOAT3, buffer_index = 1 };
|
||||
pipeline.layout.attrs[ATTR_trile_centre] = .{ format = .FLOAT3, buffer_index = 2 };
|
||||
pipeline.depth = .{
|
||||
write_enabled = true,
|
||||
compare = .LESS_EQUAL,
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
Attributes:
|
||||
ATTR_trile_position => 0
|
||||
ATTR_trile_normal => 1
|
||||
ATTR_trile_centre => 2
|
||||
Bindings:
|
||||
Uniform block 'trile_vs_params':
|
||||
Jai struct: Trile_Vs_Params
|
||||
@ -30,6 +31,7 @@
|
||||
*/
|
||||
ATTR_trile_position :: 0;
|
||||
ATTR_trile_normal :: 1;
|
||||
ATTR_trile_centre :: 2;
|
||||
UB_trile_vs_params :: 0;
|
||||
IMG_triletex :: 0;
|
||||
SMP_trilesmp :: 0;
|
||||
@ -41,13 +43,18 @@ Trile_Vs_Params :: struct {
|
||||
|
||||
uniform vec4 trile_vs_params[4];
|
||||
layout(location = 0) in vec4 position;
|
||||
layout(location = 0) out vec4 fnormal;
|
||||
layout(location = 2) out vec4 fnormal;
|
||||
layout(location = 1) in vec4 normal;
|
||||
layout(location = 0) out vec3 to_center;
|
||||
layout(location = 2) in vec4 centre;
|
||||
layout(location = 1) out vec3 vpos;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = mat4(trile_vs_params[0], trile_vs_params[1], trile_vs_params[2], trile_vs_params[3]) * vec4(position.xyz, 1.0);
|
||||
fnormal = normal;
|
||||
to_center = centre.xyz - position.xyz;
|
||||
vpos = position.xyz;
|
||||
}
|
||||
|
||||
*/
|
||||
@ -58,33 +65,51 @@ vs_trile_source_glsl430 := u8.[
|
||||
0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,
|
||||
0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x70,0x6f,0x73,0x69,
|
||||
0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,
|
||||
0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,
|
||||
0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x32,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,
|
||||
0x65,0x63,0x34,0x20,0x66,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x6c,0x61,0x79,
|
||||
0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,
|
||||
0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,
|
||||
0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,
|
||||
0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
|
||||
0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x74,0x72,0x69,0x6c,0x65,0x5f,0x76,0x73,
|
||||
0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x74,0x72,0x69,0x6c,
|
||||
0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,
|
||||
0x74,0x72,0x69,0x6c,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,
|
||||
0x32,0x5d,0x2c,0x20,0x74,0x72,0x69,0x6c,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,
|
||||
0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x70,
|
||||
0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x31,0x2e,0x30,
|
||||
0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x3d,
|
||||
0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,
|
||||
0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x33,0x20,
|
||||
0x74,0x6f,0x5f,0x63,0x65,0x6e,0x74,0x65,0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,
|
||||
0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x32,0x29,0x20,
|
||||
0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x65,0x6e,0x74,0x72,0x65,0x3b,0x0a,
|
||||
0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,
|
||||
0x3d,0x20,0x31,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x33,0x20,0x76,0x70,
|
||||
0x6f,0x73,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,
|
||||
0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,
|
||||
0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x74,0x72,0x69,0x6c,0x65,0x5f,
|
||||
0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x74,0x72,
|
||||
0x69,0x6c,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,
|
||||
0x2c,0x20,0x74,0x72,0x69,0x6c,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
|
||||
0x73,0x5b,0x32,0x5d,0x2c,0x20,0x74,0x72,0x69,0x6c,0x65,0x5f,0x76,0x73,0x5f,0x70,
|
||||
0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,
|
||||
0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x31,
|
||||
0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6e,0x6f,0x72,0x6d,0x61,0x6c,
|
||||
0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x20,0x20,0x20,0x20,0x74,
|
||||
0x6f,0x5f,0x63,0x65,0x6e,0x74,0x65,0x72,0x20,0x3d,0x20,0x63,0x65,0x6e,0x74,0x72,
|
||||
0x65,0x2e,0x78,0x79,0x7a,0x20,0x2d,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
|
||||
0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x70,0x6f,0x73,0x20,0x3d,
|
||||
0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x7d,
|
||||
0x0a,0x0a,0x00,
|
||||
];
|
||||
/*
|
||||
#version 430
|
||||
|
||||
layout(binding = 16) uniform sampler2D triletex_trilesmp;
|
||||
|
||||
layout(location = 1) in vec3 vpos;
|
||||
layout(location = 2) in vec4 fnormal;
|
||||
layout(location = 0) in vec3 to_center;
|
||||
layout(location = 0) out vec4 frag_color;
|
||||
layout(location = 0) in vec4 fnormal;
|
||||
|
||||
void main()
|
||||
{
|
||||
frag_color = texture(triletex_trilesmp, vec2(0.0));
|
||||
vec3 _20 = vpos - (fnormal.xyz * 0.00999999977648258209228515625);
|
||||
vec3 _23 = normalize(to_center);
|
||||
vec3 _25 = _20 + (_23 * 0.00999999977648258209228515625);
|
||||
vec3 _36 = _20 + (_23 * 0.100000001490116119384765625);
|
||||
frag_color = vec4(max(texelFetch(triletex_trilesmp, ivec2(int(clamp(_25.z, 9.9999997473787516355514526367188e-05, 0.999989986419677734375) * 16.0), int(clamp(_25.y, 9.9999997473787516355514526367188e-05, 0.999989986419677734375) * 16.0) + (int(clamp(_25.x, 9.9999997473787516355514526367188e-05, 0.999989986419677734375) * 16.0) * 16)), 0).xyz, texelFetch(triletex_trilesmp, ivec2(int(clamp(_36.z, 9.9999997473787516355514526367188e-05, 0.999989986419677734375) * 16.0), int(clamp(_36.y, 9.9999997473787516355514526367188e-05, 0.999989986419677734375) * 16.0) + (int(clamp(_36.x, 9.9999997473787516355514526367188e-05, 0.999989986419677734375) * 16.0) * 16)), 0).xyz), 1.0);
|
||||
}
|
||||
|
||||
*/
|
||||
@ -94,15 +119,73 @@ fs_trile_source_glsl430 := u8.[
|
||||
0x36,0x29,0x20,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,
|
||||
0x65,0x72,0x32,0x44,0x20,0x74,0x72,0x69,0x6c,0x65,0x74,0x65,0x78,0x5f,0x74,0x72,
|
||||
0x69,0x6c,0x65,0x73,0x6d,0x70,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,
|
||||
0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,
|
||||
0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,
|
||||
0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,
|
||||
0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,
|
||||
0x66,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,
|
||||
0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,
|
||||
0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,
|
||||
0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,
|
||||
0x20,0x76,0x65,0x63,0x33,0x20,0x76,0x70,0x6f,0x73,0x3b,0x0a,0x6c,0x61,0x79,0x6f,
|
||||
0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x32,0x29,
|
||||
0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x6e,0x6f,0x72,0x6d,0x61,0x6c,
|
||||
0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,
|
||||
0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x33,0x20,0x74,
|
||||
0x6f,0x5f,0x63,0x65,0x6e,0x74,0x65,0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,
|
||||
0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,
|
||||
0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,
|
||||
0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,
|
||||
0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x32,0x30,0x20,
|
||||
0x3d,0x20,0x76,0x70,0x6f,0x73,0x20,0x2d,0x20,0x28,0x66,0x6e,0x6f,0x72,0x6d,0x61,
|
||||
0x6c,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x30,0x2e,0x30,0x30,0x39,0x39,0x39,0x39,
|
||||
0x39,0x39,0x39,0x37,0x37,0x36,0x34,0x38,0x32,0x35,0x38,0x32,0x30,0x39,0x32,0x32,
|
||||
0x38,0x35,0x31,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,
|
||||
0x63,0x33,0x20,0x5f,0x32,0x33,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,
|
||||
0x7a,0x65,0x28,0x74,0x6f,0x5f,0x63,0x65,0x6e,0x74,0x65,0x72,0x29,0x3b,0x0a,0x20,
|
||||
0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x32,0x35,0x20,0x3d,0x20,0x5f,0x32,
|
||||
0x30,0x20,0x2b,0x20,0x28,0x5f,0x32,0x33,0x20,0x2a,0x20,0x30,0x2e,0x30,0x30,0x39,
|
||||
0x39,0x39,0x39,0x39,0x39,0x39,0x37,0x37,0x36,0x34,0x38,0x32,0x35,0x38,0x32,0x30,
|
||||
0x39,0x32,0x32,0x38,0x35,0x31,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x33,0x36,0x20,0x3d,0x20,0x5f,0x32,0x30,0x20,
|
||||
0x2b,0x20,0x28,0x5f,0x32,0x33,0x20,0x2a,0x20,0x30,0x2e,0x31,0x30,0x30,0x30,0x30,
|
||||
0x30,0x30,0x30,0x31,0x34,0x39,0x30,0x31,0x31,0x36,0x31,0x31,0x39,0x33,0x38,0x34,
|
||||
0x37,0x36,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,
|
||||
0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x6d,
|
||||
0x61,0x78,0x28,0x74,0x65,0x78,0x65,0x6c,0x46,0x65,0x74,0x63,0x68,0x28,0x74,0x72,
|
||||
0x69,0x6c,0x65,0x74,0x65,0x78,0x5f,0x74,0x72,0x69,0x6c,0x65,0x73,0x6d,0x70,0x2c,
|
||||
0x20,0x69,0x76,0x65,0x63,0x32,0x28,0x69,0x6e,0x74,0x28,0x63,0x6c,0x61,0x6d,0x70,
|
||||
0x28,0x5f,0x32,0x35,0x2e,0x7a,0x2c,0x20,0x39,0x2e,0x39,0x39,0x39,0x39,0x39,0x39,
|
||||
0x37,0x34,0x37,0x33,0x37,0x38,0x37,0x35,0x31,0x36,0x33,0x35,0x35,0x35,0x31,0x34,
|
||||
0x35,0x32,0x36,0x33,0x36,0x37,0x31,0x38,0x38,0x65,0x2d,0x30,0x35,0x2c,0x20,0x30,
|
||||
0x2e,0x39,0x39,0x39,0x39,0x38,0x39,0x39,0x38,0x36,0x34,0x31,0x39,0x36,0x37,0x37,
|
||||
0x37,0x33,0x34,0x33,0x37,0x35,0x29,0x20,0x2a,0x20,0x31,0x36,0x2e,0x30,0x29,0x2c,
|
||||
0x20,0x69,0x6e,0x74,0x28,0x63,0x6c,0x61,0x6d,0x70,0x28,0x5f,0x32,0x35,0x2e,0x79,
|
||||
0x2c,0x20,0x39,0x2e,0x39,0x39,0x39,0x39,0x39,0x39,0x37,0x34,0x37,0x33,0x37,0x38,
|
||||
0x37,0x35,0x31,0x36,0x33,0x35,0x35,0x35,0x31,0x34,0x35,0x32,0x36,0x33,0x36,0x37,
|
||||
0x31,0x38,0x38,0x65,0x2d,0x30,0x35,0x2c,0x20,0x30,0x2e,0x39,0x39,0x39,0x39,0x38,
|
||||
0x39,0x39,0x38,0x36,0x34,0x31,0x39,0x36,0x37,0x37,0x37,0x33,0x34,0x33,0x37,0x35,
|
||||
0x29,0x20,0x2a,0x20,0x31,0x36,0x2e,0x30,0x29,0x20,0x2b,0x20,0x28,0x69,0x6e,0x74,
|
||||
0x28,0x63,0x6c,0x61,0x6d,0x70,0x28,0x5f,0x32,0x35,0x2e,0x78,0x2c,0x20,0x39,0x2e,
|
||||
0x39,0x39,0x39,0x39,0x39,0x39,0x37,0x34,0x37,0x33,0x37,0x38,0x37,0x35,0x31,0x36,
|
||||
0x33,0x35,0x35,0x35,0x31,0x34,0x35,0x32,0x36,0x33,0x36,0x37,0x31,0x38,0x38,0x65,
|
||||
0x2d,0x30,0x35,0x2c,0x20,0x30,0x2e,0x39,0x39,0x39,0x39,0x38,0x39,0x39,0x38,0x36,
|
||||
0x34,0x31,0x39,0x36,0x37,0x37,0x37,0x33,0x34,0x33,0x37,0x35,0x29,0x20,0x2a,0x20,
|
||||
0x31,0x36,0x2e,0x30,0x29,0x20,0x2a,0x20,0x31,0x36,0x29,0x29,0x2c,0x20,0x30,0x29,
|
||||
0x2e,0x78,0x79,0x7a,0x2c,0x20,0x74,0x65,0x78,0x65,0x6c,0x46,0x65,0x74,0x63,0x68,
|
||||
0x28,0x74,0x72,0x69,0x6c,0x65,0x74,0x65,0x78,0x5f,0x74,0x72,0x69,0x6c,0x65,0x73,
|
||||
0x6d,0x70,0x2c,0x20,0x76,0x65,0x63,0x32,0x28,0x30,0x2e,0x30,0x29,0x29,0x3b,0x0a,
|
||||
0x6d,0x70,0x2c,0x20,0x69,0x76,0x65,0x63,0x32,0x28,0x69,0x6e,0x74,0x28,0x63,0x6c,
|
||||
0x61,0x6d,0x70,0x28,0x5f,0x33,0x36,0x2e,0x7a,0x2c,0x20,0x39,0x2e,0x39,0x39,0x39,
|
||||
0x39,0x39,0x39,0x37,0x34,0x37,0x33,0x37,0x38,0x37,0x35,0x31,0x36,0x33,0x35,0x35,
|
||||
0x35,0x31,0x34,0x35,0x32,0x36,0x33,0x36,0x37,0x31,0x38,0x38,0x65,0x2d,0x30,0x35,
|
||||
0x2c,0x20,0x30,0x2e,0x39,0x39,0x39,0x39,0x38,0x39,0x39,0x38,0x36,0x34,0x31,0x39,
|
||||
0x36,0x37,0x37,0x37,0x33,0x34,0x33,0x37,0x35,0x29,0x20,0x2a,0x20,0x31,0x36,0x2e,
|
||||
0x30,0x29,0x2c,0x20,0x69,0x6e,0x74,0x28,0x63,0x6c,0x61,0x6d,0x70,0x28,0x5f,0x33,
|
||||
0x36,0x2e,0x79,0x2c,0x20,0x39,0x2e,0x39,0x39,0x39,0x39,0x39,0x39,0x37,0x34,0x37,
|
||||
0x33,0x37,0x38,0x37,0x35,0x31,0x36,0x33,0x35,0x35,0x35,0x31,0x34,0x35,0x32,0x36,
|
||||
0x33,0x36,0x37,0x31,0x38,0x38,0x65,0x2d,0x30,0x35,0x2c,0x20,0x30,0x2e,0x39,0x39,
|
||||
0x39,0x39,0x38,0x39,0x39,0x38,0x36,0x34,0x31,0x39,0x36,0x37,0x37,0x37,0x33,0x34,
|
||||
0x33,0x37,0x35,0x29,0x20,0x2a,0x20,0x31,0x36,0x2e,0x30,0x29,0x20,0x2b,0x20,0x28,
|
||||
0x69,0x6e,0x74,0x28,0x63,0x6c,0x61,0x6d,0x70,0x28,0x5f,0x33,0x36,0x2e,0x78,0x2c,
|
||||
0x20,0x39,0x2e,0x39,0x39,0x39,0x39,0x39,0x39,0x37,0x34,0x37,0x33,0x37,0x38,0x37,
|
||||
0x35,0x31,0x36,0x33,0x35,0x35,0x35,0x31,0x34,0x35,0x32,0x36,0x33,0x36,0x37,0x31,
|
||||
0x38,0x38,0x65,0x2d,0x30,0x35,0x2c,0x20,0x30,0x2e,0x39,0x39,0x39,0x39,0x38,0x39,
|
||||
0x39,0x38,0x36,0x34,0x31,0x39,0x36,0x37,0x37,0x37,0x33,0x34,0x33,0x37,0x35,0x29,
|
||||
0x20,0x2a,0x20,0x31,0x36,0x2e,0x30,0x29,0x20,0x2a,0x20,0x31,0x36,0x29,0x29,0x2c,
|
||||
0x20,0x30,0x29,0x2e,0x78,0x79,0x7a,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,
|
||||
0x7d,0x0a,0x0a,0x00,
|
||||
];
|
||||
/*
|
||||
@ -112,11 +195,16 @@ fs_trile_source_glsl430 := u8.[
|
||||
layout(location = 0) in vec4 position;
|
||||
out vec4 fnormal;
|
||||
layout(location = 1) in vec4 normal;
|
||||
out vec3 to_center;
|
||||
layout(location = 2) in vec4 centre;
|
||||
out vec3 vpos;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = mat4(trile_vs_params[0], trile_vs_params[1], trile_vs_params[2], trile_vs_params[3]) * vec4(position.xyz, 1.0);
|
||||
fnormal = normal;
|
||||
to_center = centre.xyz - position.xyz;
|
||||
vpos = position.xyz;
|
||||
}
|
||||
|
||||
*/
|
||||
@ -130,17 +218,26 @@ vs_trile_source_glsl300es := u8.[
|
||||
0x34,0x20,0x66,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,
|
||||
0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20,
|
||||
0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a,
|
||||
0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,
|
||||
0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,
|
||||
0x20,0x6d,0x61,0x74,0x34,0x28,0x74,0x72,0x69,0x6c,0x65,0x5f,0x76,0x73,0x5f,0x70,
|
||||
0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x74,0x72,0x69,0x6c,0x65,0x5f,
|
||||
0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x74,0x72,
|
||||
0x69,0x6c,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,
|
||||
0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x33,0x20,0x74,0x6f,0x5f,0x63,0x65,0x6e,0x74,
|
||||
0x65,0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,
|
||||
0x69,0x6f,0x6e,0x20,0x3d,0x20,0x32,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,
|
||||
0x20,0x63,0x65,0x6e,0x74,0x72,0x65,0x3b,0x0a,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,
|
||||
0x33,0x20,0x76,0x70,0x6f,0x73,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,
|
||||
0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,
|
||||
0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x74,0x72,
|
||||
0x69,0x6c,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,
|
||||
0x2c,0x20,0x74,0x72,0x69,0x6c,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
|
||||
0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x70,0x6f,0x73,
|
||||
0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,
|
||||
0x0a,0x20,0x20,0x20,0x20,0x66,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x3d,0x20,0x6e,
|
||||
0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
0x73,0x5b,0x31,0x5d,0x2c,0x20,0x74,0x72,0x69,0x6c,0x65,0x5f,0x76,0x73,0x5f,0x70,
|
||||
0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x74,0x72,0x69,0x6c,0x65,0x5f,
|
||||
0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,
|
||||
0x76,0x65,0x63,0x34,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x79,
|
||||
0x7a,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6e,0x6f,
|
||||
0x72,0x6d,0x61,0x6c,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x20,
|
||||
0x20,0x20,0x20,0x74,0x6f,0x5f,0x63,0x65,0x6e,0x74,0x65,0x72,0x20,0x3d,0x20,0x63,
|
||||
0x65,0x6e,0x74,0x72,0x65,0x2e,0x78,0x79,0x7a,0x20,0x2d,0x20,0x70,0x6f,0x73,0x69,
|
||||
0x74,0x69,0x6f,0x6e,0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x70,
|
||||
0x6f,0x73,0x20,0x3d,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x79,
|
||||
0x7a,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
];
|
||||
/*
|
||||
#version 300 es
|
||||
@ -149,12 +246,18 @@ vs_trile_source_glsl300es := u8.[
|
||||
|
||||
uniform highp sampler2D triletex_trilesmp;
|
||||
|
||||
layout(location = 0) out highp vec4 frag_color;
|
||||
in highp vec3 vpos;
|
||||
in highp vec4 fnormal;
|
||||
in highp vec3 to_center;
|
||||
layout(location = 0) out highp vec4 frag_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
frag_color = texture(triletex_trilesmp, vec2(0.0));
|
||||
highp vec3 _20 = vpos - (fnormal.xyz * 0.00999999977648258209228515625);
|
||||
highp vec3 _23 = normalize(to_center);
|
||||
highp vec3 _25 = _20 + (_23 * 0.00999999977648258209228515625);
|
||||
highp vec3 _36 = _20 + (_23 * 0.100000001490116119384765625);
|
||||
frag_color = vec4(max(texelFetch(triletex_trilesmp, ivec2(int(clamp(_25.z, 9.9999997473787516355514526367188e-05, 0.999989986419677734375) * 16.0), int(clamp(_25.y, 9.9999997473787516355514526367188e-05, 0.999989986419677734375) * 16.0) + (int(clamp(_25.x, 9.9999997473787516355514526367188e-05, 0.999989986419677734375) * 16.0) * 16)), 0).xyz, texelFetch(triletex_trilesmp, ivec2(int(clamp(_36.z, 9.9999997473787516355514526367188e-05, 0.999989986419677734375) * 16.0), int(clamp(_36.y, 9.9999997473787516355514526367188e-05, 0.999989986419677734375) * 16.0) + (int(clamp(_36.x, 9.9999997473787516355514526367188e-05, 0.999989986419677734375) * 16.0) * 16)), 0).xyz), 1.0);
|
||||
}
|
||||
|
||||
*/
|
||||
@ -165,16 +268,74 @@ fs_trile_source_glsl300es := u8.[
|
||||
0x6f,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x69,0x6e,0x74,0x3b,0x0a,0x0a,0x75,
|
||||
0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x73,0x61,0x6d,
|
||||
0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x74,0x72,0x69,0x6c,0x65,0x74,0x65,0x78,0x5f,
|
||||
0x74,0x72,0x69,0x6c,0x65,0x73,0x6d,0x70,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,
|
||||
0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,
|
||||
0x6f,0x75,0x74,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x66,
|
||||
0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x69,0x6e,0x20,0x68,0x69,
|
||||
0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x6e,0x6f,0x72,0x6d,0x61,0x6c,
|
||||
0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,
|
||||
0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,
|
||||
0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x74,0x72,0x69,0x6c,0x65,0x74,
|
||||
0x65,0x78,0x5f,0x74,0x72,0x69,0x6c,0x65,0x73,0x6d,0x70,0x2c,0x20,0x76,0x65,0x63,
|
||||
0x32,0x28,0x30,0x2e,0x30,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
0x74,0x72,0x69,0x6c,0x65,0x73,0x6d,0x70,0x3b,0x0a,0x0a,0x69,0x6e,0x20,0x68,0x69,
|
||||
0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x76,0x70,0x6f,0x73,0x3b,0x0a,0x69,
|
||||
0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x6e,0x6f,
|
||||
0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x69,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,
|
||||
0x65,0x63,0x33,0x20,0x74,0x6f,0x5f,0x63,0x65,0x6e,0x74,0x65,0x72,0x3b,0x0a,0x6c,
|
||||
0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,
|
||||
0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,
|
||||
0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,
|
||||
0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x32,0x30,
|
||||
0x20,0x3d,0x20,0x76,0x70,0x6f,0x73,0x20,0x2d,0x20,0x28,0x66,0x6e,0x6f,0x72,0x6d,
|
||||
0x61,0x6c,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x30,0x2e,0x30,0x30,0x39,0x39,0x39,
|
||||
0x39,0x39,0x39,0x39,0x37,0x37,0x36,0x34,0x38,0x32,0x35,0x38,0x32,0x30,0x39,0x32,
|
||||
0x32,0x38,0x35,0x31,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,
|
||||
0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x32,0x33,0x20,0x3d,0x20,
|
||||
0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x74,0x6f,0x5f,0x63,0x65,0x6e,
|
||||
0x74,0x65,0x72,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,
|
||||
0x76,0x65,0x63,0x33,0x20,0x5f,0x32,0x35,0x20,0x3d,0x20,0x5f,0x32,0x30,0x20,0x2b,
|
||||
0x20,0x28,0x5f,0x32,0x33,0x20,0x2a,0x20,0x30,0x2e,0x30,0x30,0x39,0x39,0x39,0x39,
|
||||
0x39,0x39,0x39,0x37,0x37,0x36,0x34,0x38,0x32,0x35,0x38,0x32,0x30,0x39,0x32,0x32,
|
||||
0x38,0x35,0x31,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,
|
||||
0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x33,0x36,0x20,0x3d,0x20,0x5f,
|
||||
0x32,0x30,0x20,0x2b,0x20,0x28,0x5f,0x32,0x33,0x20,0x2a,0x20,0x30,0x2e,0x31,0x30,
|
||||
0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x34,0x39,0x30,0x31,0x31,0x36,0x31,0x31,0x39,
|
||||
0x33,0x38,0x34,0x37,0x36,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
||||
0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,
|
||||
0x34,0x28,0x6d,0x61,0x78,0x28,0x74,0x65,0x78,0x65,0x6c,0x46,0x65,0x74,0x63,0x68,
|
||||
0x28,0x74,0x72,0x69,0x6c,0x65,0x74,0x65,0x78,0x5f,0x74,0x72,0x69,0x6c,0x65,0x73,
|
||||
0x6d,0x70,0x2c,0x20,0x69,0x76,0x65,0x63,0x32,0x28,0x69,0x6e,0x74,0x28,0x63,0x6c,
|
||||
0x61,0x6d,0x70,0x28,0x5f,0x32,0x35,0x2e,0x7a,0x2c,0x20,0x39,0x2e,0x39,0x39,0x39,
|
||||
0x39,0x39,0x39,0x37,0x34,0x37,0x33,0x37,0x38,0x37,0x35,0x31,0x36,0x33,0x35,0x35,
|
||||
0x35,0x31,0x34,0x35,0x32,0x36,0x33,0x36,0x37,0x31,0x38,0x38,0x65,0x2d,0x30,0x35,
|
||||
0x2c,0x20,0x30,0x2e,0x39,0x39,0x39,0x39,0x38,0x39,0x39,0x38,0x36,0x34,0x31,0x39,
|
||||
0x36,0x37,0x37,0x37,0x33,0x34,0x33,0x37,0x35,0x29,0x20,0x2a,0x20,0x31,0x36,0x2e,
|
||||
0x30,0x29,0x2c,0x20,0x69,0x6e,0x74,0x28,0x63,0x6c,0x61,0x6d,0x70,0x28,0x5f,0x32,
|
||||
0x35,0x2e,0x79,0x2c,0x20,0x39,0x2e,0x39,0x39,0x39,0x39,0x39,0x39,0x37,0x34,0x37,
|
||||
0x33,0x37,0x38,0x37,0x35,0x31,0x36,0x33,0x35,0x35,0x35,0x31,0x34,0x35,0x32,0x36,
|
||||
0x33,0x36,0x37,0x31,0x38,0x38,0x65,0x2d,0x30,0x35,0x2c,0x20,0x30,0x2e,0x39,0x39,
|
||||
0x39,0x39,0x38,0x39,0x39,0x38,0x36,0x34,0x31,0x39,0x36,0x37,0x37,0x37,0x33,0x34,
|
||||
0x33,0x37,0x35,0x29,0x20,0x2a,0x20,0x31,0x36,0x2e,0x30,0x29,0x20,0x2b,0x20,0x28,
|
||||
0x69,0x6e,0x74,0x28,0x63,0x6c,0x61,0x6d,0x70,0x28,0x5f,0x32,0x35,0x2e,0x78,0x2c,
|
||||
0x20,0x39,0x2e,0x39,0x39,0x39,0x39,0x39,0x39,0x37,0x34,0x37,0x33,0x37,0x38,0x37,
|
||||
0x35,0x31,0x36,0x33,0x35,0x35,0x35,0x31,0x34,0x35,0x32,0x36,0x33,0x36,0x37,0x31,
|
||||
0x38,0x38,0x65,0x2d,0x30,0x35,0x2c,0x20,0x30,0x2e,0x39,0x39,0x39,0x39,0x38,0x39,
|
||||
0x39,0x38,0x36,0x34,0x31,0x39,0x36,0x37,0x37,0x37,0x33,0x34,0x33,0x37,0x35,0x29,
|
||||
0x20,0x2a,0x20,0x31,0x36,0x2e,0x30,0x29,0x20,0x2a,0x20,0x31,0x36,0x29,0x29,0x2c,
|
||||
0x20,0x30,0x29,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x74,0x65,0x78,0x65,0x6c,0x46,0x65,
|
||||
0x74,0x63,0x68,0x28,0x74,0x72,0x69,0x6c,0x65,0x74,0x65,0x78,0x5f,0x74,0x72,0x69,
|
||||
0x6c,0x65,0x73,0x6d,0x70,0x2c,0x20,0x69,0x76,0x65,0x63,0x32,0x28,0x69,0x6e,0x74,
|
||||
0x28,0x63,0x6c,0x61,0x6d,0x70,0x28,0x5f,0x33,0x36,0x2e,0x7a,0x2c,0x20,0x39,0x2e,
|
||||
0x39,0x39,0x39,0x39,0x39,0x39,0x37,0x34,0x37,0x33,0x37,0x38,0x37,0x35,0x31,0x36,
|
||||
0x33,0x35,0x35,0x35,0x31,0x34,0x35,0x32,0x36,0x33,0x36,0x37,0x31,0x38,0x38,0x65,
|
||||
0x2d,0x30,0x35,0x2c,0x20,0x30,0x2e,0x39,0x39,0x39,0x39,0x38,0x39,0x39,0x38,0x36,
|
||||
0x34,0x31,0x39,0x36,0x37,0x37,0x37,0x33,0x34,0x33,0x37,0x35,0x29,0x20,0x2a,0x20,
|
||||
0x31,0x36,0x2e,0x30,0x29,0x2c,0x20,0x69,0x6e,0x74,0x28,0x63,0x6c,0x61,0x6d,0x70,
|
||||
0x28,0x5f,0x33,0x36,0x2e,0x79,0x2c,0x20,0x39,0x2e,0x39,0x39,0x39,0x39,0x39,0x39,
|
||||
0x37,0x34,0x37,0x33,0x37,0x38,0x37,0x35,0x31,0x36,0x33,0x35,0x35,0x35,0x31,0x34,
|
||||
0x35,0x32,0x36,0x33,0x36,0x37,0x31,0x38,0x38,0x65,0x2d,0x30,0x35,0x2c,0x20,0x30,
|
||||
0x2e,0x39,0x39,0x39,0x39,0x38,0x39,0x39,0x38,0x36,0x34,0x31,0x39,0x36,0x37,0x37,
|
||||
0x37,0x33,0x34,0x33,0x37,0x35,0x29,0x20,0x2a,0x20,0x31,0x36,0x2e,0x30,0x29,0x20,
|
||||
0x2b,0x20,0x28,0x69,0x6e,0x74,0x28,0x63,0x6c,0x61,0x6d,0x70,0x28,0x5f,0x33,0x36,
|
||||
0x2e,0x78,0x2c,0x20,0x39,0x2e,0x39,0x39,0x39,0x39,0x39,0x39,0x37,0x34,0x37,0x33,
|
||||
0x37,0x38,0x37,0x35,0x31,0x36,0x33,0x35,0x35,0x35,0x31,0x34,0x35,0x32,0x36,0x33,
|
||||
0x36,0x37,0x31,0x38,0x38,0x65,0x2d,0x30,0x35,0x2c,0x20,0x30,0x2e,0x39,0x39,0x39,
|
||||
0x39,0x38,0x39,0x39,0x38,0x36,0x34,0x31,0x39,0x36,0x37,0x37,0x37,0x33,0x34,0x33,
|
||||
0x37,0x35,0x29,0x20,0x2a,0x20,0x31,0x36,0x2e,0x30,0x29,0x20,0x2a,0x20,0x31,0x36,
|
||||
0x29,0x29,0x2c,0x20,0x30,0x29,0x2e,0x78,0x79,0x7a,0x29,0x2c,0x20,0x31,0x2e,0x30,
|
||||
0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
];
|
||||
/*
|
||||
#include <metal_stdlib>
|
||||
@ -189,7 +350,9 @@ fs_trile_source_glsl300es := u8.[
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 fnormal [[user(locn0)]];
|
||||
float3 to_center [[user(locn0)]];
|
||||
float3 vpos [[user(locn1)]];
|
||||
float4 fnormal [[user(locn2)]];
|
||||
float4 gl_Position [[position]];
|
||||
};
|
||||
|
||||
@ -197,6 +360,7 @@ fs_trile_source_glsl300es := u8.[
|
||||
{
|
||||
float4 position [[attribute(0)]];
|
||||
float4 normal [[attribute(1)]];
|
||||
float4 centre [[attribute(2)]];
|
||||
};
|
||||
|
||||
vertex main0_out main0(main0_in in [[stage_in]], constant trile_vs_params& _19 [[buffer(0)]])
|
||||
@ -204,6 +368,8 @@ fs_trile_source_glsl300es := u8.[
|
||||
main0_out out = {};
|
||||
out.gl_Position = _19.mvp * float4(in.position.xyz, 1.0);
|
||||
out.fnormal = in.normal;
|
||||
out.to_center = in.centre.xyz - in.position.xyz;
|
||||
out.vpos = in.position.xyz;
|
||||
return out;
|
||||
}
|
||||
|
||||
@ -218,30 +384,42 @@ vs_trile_source_metal_macos := u8.[
|
||||
0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x78,0x34,0x20,0x6d,0x76,
|
||||
0x70,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,
|
||||
0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,
|
||||
0x6f,0x61,0x74,0x34,0x20,0x66,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x5b,0x5b,0x75,
|
||||
0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,
|
||||
0x74,0x69,0x6f,0x6e,0x20,0x5b,0x5b,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x5d,
|
||||
0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,
|
||||
0x69,0x6e,0x30,0x5f,0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
|
||||
0x61,0x74,0x34,0x20,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x5b,0x5b,0x61,
|
||||
0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,
|
||||
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,
|
||||
0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x31,0x29,0x5d,
|
||||
0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x76,0x65,0x72,0x74,0x65,0x78,0x20,0x6d,0x61,
|
||||
0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,
|
||||
0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,
|
||||
0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,
|
||||
0x20,0x74,0x72,0x69,0x6c,0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,
|
||||
0x26,0x20,0x5f,0x31,0x39,0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,
|
||||
0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,
|
||||
0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,
|
||||
0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,
|
||||
0x6f,0x6e,0x20,0x3d,0x20,0x5f,0x31,0x39,0x2e,0x6d,0x76,0x70,0x20,0x2a,0x20,0x66,
|
||||
0x6c,0x6f,0x61,0x74,0x34,0x28,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,
|
||||
0x6e,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x6f,0x75,0x74,0x2e,0x66,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x3d,0x20,0x69,
|
||||
0x6e,0x2e,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,
|
||||
0x6f,0x61,0x74,0x33,0x20,0x74,0x6f,0x5f,0x63,0x65,0x6e,0x74,0x65,0x72,0x20,0x5b,
|
||||
0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,
|
||||
0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x76,0x70,0x6f,0x73,0x20,
|
||||
0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x31,0x29,0x5d,0x5d,0x3b,
|
||||
0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x6e,0x6f,0x72,
|
||||
0x6d,0x61,0x6c,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x32,
|
||||
0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,
|
||||
0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x5b,0x5b,0x70,0x6f,
|
||||
0x73,0x69,0x74,0x69,0x6f,0x6e,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,
|
||||
0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x0a,0x7b,0x0a,
|
||||
0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x70,0x6f,0x73,0x69,0x74,
|
||||
0x69,0x6f,0x6e,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,
|
||||
0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,
|
||||
0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x5b,0x5b,0x61,0x74,0x74,0x72,0x69,0x62,
|
||||
0x75,0x74,0x65,0x28,0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,
|
||||
0x6f,0x61,0x74,0x34,0x20,0x63,0x65,0x6e,0x74,0x72,0x65,0x20,0x5b,0x5b,0x61,0x74,
|
||||
0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x32,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,0x3b,
|
||||
0x0a,0x0a,0x76,0x65,0x72,0x74,0x65,0x78,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,
|
||||
0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,
|
||||
0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,
|
||||
0x5d,0x2c,0x20,0x63,0x6f,0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x74,0x72,0x69,0x6c,
|
||||
0x65,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x26,0x20,0x5f,0x31,0x39,
|
||||
0x20,0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,
|
||||
0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,
|
||||
0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,
|
||||
0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
|
||||
0x5f,0x31,0x39,0x2e,0x6d,0x76,0x70,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,
|
||||
0x28,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x79,0x7a,
|
||||
0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,
|
||||
0x66,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x6e,0x6f,0x72,
|
||||
0x6d,0x61,0x6c,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x74,0x6f,0x5f,
|
||||
0x63,0x65,0x6e,0x74,0x65,0x72,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x63,0x65,0x6e,0x74,
|
||||
0x72,0x65,0x2e,0x78,0x79,0x7a,0x20,0x2d,0x20,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x69,
|
||||
0x74,0x69,0x6f,0x6e,0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,
|
||||
0x74,0x2e,0x76,0x70,0x6f,0x73,0x20,0x3d,0x20,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x69,
|
||||
0x74,0x69,0x6f,0x6e,0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,
|
||||
0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
];
|
||||
/*
|
||||
@ -255,10 +433,21 @@ vs_trile_source_metal_macos := u8.[
|
||||
float4 frag_color [[color(0)]];
|
||||
};
|
||||
|
||||
fragment main0_out main0(texture2d<float> triletex [[texture(0)]], sampler trilesmp [[sampler(0)]])
|
||||
struct main0_in
|
||||
{
|
||||
float3 to_center [[user(locn0)]];
|
||||
float3 vpos [[user(locn1)]];
|
||||
float4 fnormal [[user(locn2)]];
|
||||
};
|
||||
|
||||
fragment main0_out main0(main0_in in [[stage_in]], texture2d<float> triletex [[texture(0)]], sampler trilesmp [[sampler(0)]])
|
||||
{
|
||||
main0_out out = {};
|
||||
out.frag_color = triletex.sample(trilesmp, float2(0.0));
|
||||
float3 _20 = in.vpos - (in.fnormal.xyz * 0.00999999977648258209228515625);
|
||||
float3 _23 = fast::normalize(in.to_center);
|
||||
float3 _25 = _20 + (_23 * 0.00999999977648258209228515625);
|
||||
float3 _36 = _20 + (_23 * 0.100000001490116119384765625);
|
||||
out.frag_color = float4(fast::max(triletex.read(uint2(int2(int(fast::clamp(_25.z, 9.9999997473787516355514526367188e-05, 0.999989986419677734375) * 16.0), int(fast::clamp(_25.y, 9.9999997473787516355514526367188e-05, 0.999989986419677734375) * 16.0) + (int(fast::clamp(_25.x, 9.9999997473787516355514526367188e-05, 0.999989986419677734375) * 16.0) * 16))), 0).xyz, triletex.read(uint2(int2(int(fast::clamp(_36.z, 9.9999997473787516355514526367188e-05, 0.999989986419677734375) * 16.0), int(fast::clamp(_36.y, 9.9999997473787516355514526367188e-05, 0.999989986419677734375) * 16.0) + (int(fast::clamp(_36.x, 9.9999997473787516355514526367188e-05, 0.999989986419677734375) * 16.0) * 16))), 0).xyz), 1.0);
|
||||
return out;
|
||||
}
|
||||
|
||||
@ -272,20 +461,86 @@ fs_trile_source_metal_macos := u8.[
|
||||
0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,
|
||||
0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,
|
||||
0x20,0x5b,0x5b,0x63,0x6f,0x6c,0x6f,0x72,0x28,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x7d,
|
||||
0x3b,0x0a,0x0a,0x66,0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,
|
||||
0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x74,0x65,0x78,0x74,
|
||||
0x75,0x72,0x65,0x32,0x64,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x3e,0x20,0x74,0x72,0x69,
|
||||
0x6c,0x65,0x74,0x65,0x78,0x20,0x5b,0x5b,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,
|
||||
0x30,0x29,0x5d,0x5d,0x2c,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x20,0x74,0x72,
|
||||
0x69,0x6c,0x65,0x73,0x6d,0x70,0x20,0x5b,0x5b,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,
|
||||
0x28,0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,
|
||||
0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,
|
||||
0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,
|
||||
0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x72,0x69,0x6c,0x65,0x74,0x65,0x78,0x2e,0x73,
|
||||
0x61,0x6d,0x70,0x6c,0x65,0x28,0x74,0x72,0x69,0x6c,0x65,0x73,0x6d,0x70,0x2c,0x20,
|
||||
0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x30,0x29,0x29,0x3b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,
|
||||
0x0a,0x00,
|
||||
0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,
|
||||
0x69,0x6e,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,
|
||||
0x74,0x6f,0x5f,0x63,0x65,0x6e,0x74,0x65,0x72,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,
|
||||
0x28,0x6c,0x6f,0x63,0x6e,0x30,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,
|
||||
0x6c,0x6f,0x61,0x74,0x33,0x20,0x76,0x70,0x6f,0x73,0x20,0x5b,0x5b,0x75,0x73,0x65,
|
||||
0x72,0x28,0x6c,0x6f,0x63,0x6e,0x31,0x29,0x5d,0x5d,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
||||
0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x66,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x5b,
|
||||
0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,0x32,0x29,0x5d,0x5d,0x3b,0x0a,
|
||||
0x7d,0x3b,0x0a,0x0a,0x66,0x72,0x61,0x67,0x6d,0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,
|
||||
0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,
|
||||
0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,
|
||||
0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x32,0x64,
|
||||
0x3c,0x66,0x6c,0x6f,0x61,0x74,0x3e,0x20,0x74,0x72,0x69,0x6c,0x65,0x74,0x65,0x78,
|
||||
0x20,0x5b,0x5b,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x30,0x29,0x5d,0x5d,0x2c,
|
||||
0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x20,0x74,0x72,0x69,0x6c,0x65,0x73,0x6d,
|
||||
0x70,0x20,0x5b,0x5b,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,
|
||||
0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,
|
||||
0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
||||
0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x32,0x30,0x20,0x3d,0x20,0x69,0x6e,0x2e,
|
||||
0x76,0x70,0x6f,0x73,0x20,0x2d,0x20,0x28,0x69,0x6e,0x2e,0x66,0x6e,0x6f,0x72,0x6d,
|
||||
0x61,0x6c,0x2e,0x78,0x79,0x7a,0x20,0x2a,0x20,0x30,0x2e,0x30,0x30,0x39,0x39,0x39,
|
||||
0x39,0x39,0x39,0x39,0x37,0x37,0x36,0x34,0x38,0x32,0x35,0x38,0x32,0x30,0x39,0x32,
|
||||
0x32,0x38,0x35,0x31,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,
|
||||
0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x32,0x33,0x20,0x3d,0x20,0x66,0x61,0x73,0x74,
|
||||
0x3a,0x3a,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x69,0x6e,0x2e,0x74,
|
||||
0x6f,0x5f,0x63,0x65,0x6e,0x74,0x65,0x72,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,
|
||||
0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x32,0x35,0x20,0x3d,0x20,0x5f,0x32,0x30,0x20,
|
||||
0x2b,0x20,0x28,0x5f,0x32,0x33,0x20,0x2a,0x20,0x30,0x2e,0x30,0x30,0x39,0x39,0x39,
|
||||
0x39,0x39,0x39,0x39,0x37,0x37,0x36,0x34,0x38,0x32,0x35,0x38,0x32,0x30,0x39,0x32,
|
||||
0x32,0x38,0x35,0x31,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,
|
||||
0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x33,0x36,0x20,0x3d,0x20,0x5f,0x32,0x30,0x20,
|
||||
0x2b,0x20,0x28,0x5f,0x32,0x33,0x20,0x2a,0x20,0x30,0x2e,0x31,0x30,0x30,0x30,0x30,
|
||||
0x30,0x30,0x30,0x31,0x34,0x39,0x30,0x31,0x31,0x36,0x31,0x31,0x39,0x33,0x38,0x34,
|
||||
0x37,0x36,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,
|
||||
0x2e,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x6c,
|
||||
0x6f,0x61,0x74,0x34,0x28,0x66,0x61,0x73,0x74,0x3a,0x3a,0x6d,0x61,0x78,0x28,0x74,
|
||||
0x72,0x69,0x6c,0x65,0x74,0x65,0x78,0x2e,0x72,0x65,0x61,0x64,0x28,0x75,0x69,0x6e,
|
||||
0x74,0x32,0x28,0x69,0x6e,0x74,0x32,0x28,0x69,0x6e,0x74,0x28,0x66,0x61,0x73,0x74,
|
||||
0x3a,0x3a,0x63,0x6c,0x61,0x6d,0x70,0x28,0x5f,0x32,0x35,0x2e,0x7a,0x2c,0x20,0x39,
|
||||
0x2e,0x39,0x39,0x39,0x39,0x39,0x39,0x37,0x34,0x37,0x33,0x37,0x38,0x37,0x35,0x31,
|
||||
0x36,0x33,0x35,0x35,0x35,0x31,0x34,0x35,0x32,0x36,0x33,0x36,0x37,0x31,0x38,0x38,
|
||||
0x65,0x2d,0x30,0x35,0x2c,0x20,0x30,0x2e,0x39,0x39,0x39,0x39,0x38,0x39,0x39,0x38,
|
||||
0x36,0x34,0x31,0x39,0x36,0x37,0x37,0x37,0x33,0x34,0x33,0x37,0x35,0x29,0x20,0x2a,
|
||||
0x20,0x31,0x36,0x2e,0x30,0x29,0x2c,0x20,0x69,0x6e,0x74,0x28,0x66,0x61,0x73,0x74,
|
||||
0x3a,0x3a,0x63,0x6c,0x61,0x6d,0x70,0x28,0x5f,0x32,0x35,0x2e,0x79,0x2c,0x20,0x39,
|
||||
0x2e,0x39,0x39,0x39,0x39,0x39,0x39,0x37,0x34,0x37,0x33,0x37,0x38,0x37,0x35,0x31,
|
||||
0x36,0x33,0x35,0x35,0x35,0x31,0x34,0x35,0x32,0x36,0x33,0x36,0x37,0x31,0x38,0x38,
|
||||
0x65,0x2d,0x30,0x35,0x2c,0x20,0x30,0x2e,0x39,0x39,0x39,0x39,0x38,0x39,0x39,0x38,
|
||||
0x36,0x34,0x31,0x39,0x36,0x37,0x37,0x37,0x33,0x34,0x33,0x37,0x35,0x29,0x20,0x2a,
|
||||
0x20,0x31,0x36,0x2e,0x30,0x29,0x20,0x2b,0x20,0x28,0x69,0x6e,0x74,0x28,0x66,0x61,
|
||||
0x73,0x74,0x3a,0x3a,0x63,0x6c,0x61,0x6d,0x70,0x28,0x5f,0x32,0x35,0x2e,0x78,0x2c,
|
||||
0x20,0x39,0x2e,0x39,0x39,0x39,0x39,0x39,0x39,0x37,0x34,0x37,0x33,0x37,0x38,0x37,
|
||||
0x35,0x31,0x36,0x33,0x35,0x35,0x35,0x31,0x34,0x35,0x32,0x36,0x33,0x36,0x37,0x31,
|
||||
0x38,0x38,0x65,0x2d,0x30,0x35,0x2c,0x20,0x30,0x2e,0x39,0x39,0x39,0x39,0x38,0x39,
|
||||
0x39,0x38,0x36,0x34,0x31,0x39,0x36,0x37,0x37,0x37,0x33,0x34,0x33,0x37,0x35,0x29,
|
||||
0x20,0x2a,0x20,0x31,0x36,0x2e,0x30,0x29,0x20,0x2a,0x20,0x31,0x36,0x29,0x29,0x29,
|
||||
0x2c,0x20,0x30,0x29,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x74,0x72,0x69,0x6c,0x65,0x74,
|
||||
0x65,0x78,0x2e,0x72,0x65,0x61,0x64,0x28,0x75,0x69,0x6e,0x74,0x32,0x28,0x69,0x6e,
|
||||
0x74,0x32,0x28,0x69,0x6e,0x74,0x28,0x66,0x61,0x73,0x74,0x3a,0x3a,0x63,0x6c,0x61,
|
||||
0x6d,0x70,0x28,0x5f,0x33,0x36,0x2e,0x7a,0x2c,0x20,0x39,0x2e,0x39,0x39,0x39,0x39,
|
||||
0x39,0x39,0x37,0x34,0x37,0x33,0x37,0x38,0x37,0x35,0x31,0x36,0x33,0x35,0x35,0x35,
|
||||
0x31,0x34,0x35,0x32,0x36,0x33,0x36,0x37,0x31,0x38,0x38,0x65,0x2d,0x30,0x35,0x2c,
|
||||
0x20,0x30,0x2e,0x39,0x39,0x39,0x39,0x38,0x39,0x39,0x38,0x36,0x34,0x31,0x39,0x36,
|
||||
0x37,0x37,0x37,0x33,0x34,0x33,0x37,0x35,0x29,0x20,0x2a,0x20,0x31,0x36,0x2e,0x30,
|
||||
0x29,0x2c,0x20,0x69,0x6e,0x74,0x28,0x66,0x61,0x73,0x74,0x3a,0x3a,0x63,0x6c,0x61,
|
||||
0x6d,0x70,0x28,0x5f,0x33,0x36,0x2e,0x79,0x2c,0x20,0x39,0x2e,0x39,0x39,0x39,0x39,
|
||||
0x39,0x39,0x37,0x34,0x37,0x33,0x37,0x38,0x37,0x35,0x31,0x36,0x33,0x35,0x35,0x35,
|
||||
0x31,0x34,0x35,0x32,0x36,0x33,0x36,0x37,0x31,0x38,0x38,0x65,0x2d,0x30,0x35,0x2c,
|
||||
0x20,0x30,0x2e,0x39,0x39,0x39,0x39,0x38,0x39,0x39,0x38,0x36,0x34,0x31,0x39,0x36,
|
||||
0x37,0x37,0x37,0x33,0x34,0x33,0x37,0x35,0x29,0x20,0x2a,0x20,0x31,0x36,0x2e,0x30,
|
||||
0x29,0x20,0x2b,0x20,0x28,0x69,0x6e,0x74,0x28,0x66,0x61,0x73,0x74,0x3a,0x3a,0x63,
|
||||
0x6c,0x61,0x6d,0x70,0x28,0x5f,0x33,0x36,0x2e,0x78,0x2c,0x20,0x39,0x2e,0x39,0x39,
|
||||
0x39,0x39,0x39,0x39,0x37,0x34,0x37,0x33,0x37,0x38,0x37,0x35,0x31,0x36,0x33,0x35,
|
||||
0x35,0x35,0x31,0x34,0x35,0x32,0x36,0x33,0x36,0x37,0x31,0x38,0x38,0x65,0x2d,0x30,
|
||||
0x35,0x2c,0x20,0x30,0x2e,0x39,0x39,0x39,0x39,0x38,0x39,0x39,0x38,0x36,0x34,0x31,
|
||||
0x39,0x36,0x37,0x37,0x37,0x33,0x34,0x33,0x37,0x35,0x29,0x20,0x2a,0x20,0x31,0x36,
|
||||
0x2e,0x30,0x29,0x20,0x2a,0x20,0x31,0x36,0x29,0x29,0x29,0x2c,0x20,0x30,0x29,0x2e,
|
||||
0x78,0x79,0x7a,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
||||
0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
|
||||
];
|
||||
trile_shader_desc :: (backend: sg_backend) -> sg_shader_desc {
|
||||
desc: sg_shader_desc;
|
||||
@ -300,6 +555,8 @@ trile_shader_desc :: (backend: sg_backend) -> sg_shader_desc {
|
||||
desc.attrs[0].glsl_name = "position";
|
||||
desc.attrs[1].base_type = .FLOAT;
|
||||
desc.attrs[1].glsl_name = "normal";
|
||||
desc.attrs[2].base_type = .FLOAT;
|
||||
desc.attrs[2].glsl_name = "centre";
|
||||
desc.uniform_blocks[0].stage = .VERTEX;
|
||||
desc.uniform_blocks[0].layout = .STD140;
|
||||
desc.uniform_blocks[0].size = 64;
|
||||
@ -325,6 +582,8 @@ trile_shader_desc :: (backend: sg_backend) -> sg_shader_desc {
|
||||
desc.attrs[0].glsl_name = "position";
|
||||
desc.attrs[1].base_type = .FLOAT;
|
||||
desc.attrs[1].glsl_name = "normal";
|
||||
desc.attrs[2].base_type = .FLOAT;
|
||||
desc.attrs[2].glsl_name = "centre";
|
||||
desc.uniform_blocks[0].stage = .VERTEX;
|
||||
desc.uniform_blocks[0].layout = .STD140;
|
||||
desc.uniform_blocks[0].size = 64;
|
||||
@ -348,6 +607,7 @@ trile_shader_desc :: (backend: sg_backend) -> sg_shader_desc {
|
||||
desc.fragment_func.entry = "main0";
|
||||
desc.attrs[0].base_type = .FLOAT;
|
||||
desc.attrs[1].base_type = .FLOAT;
|
||||
desc.attrs[2].base_type = .FLOAT;
|
||||
desc.uniform_blocks[0].stage = .VERTEX;
|
||||
desc.uniform_blocks[0].layout = .STD140;
|
||||
desc.uniform_blocks[0].size = 64;
|
||||
|
||||
@ -2,22 +2,30 @@
|
||||
|
||||
in vec4 position;
|
||||
in vec4 normal;
|
||||
in vec4 centre;
|
||||
|
||||
layout(binding=0) uniform trile_vs_params {
|
||||
mat4 mvp;
|
||||
};
|
||||
|
||||
|
||||
out vec3 to_center;
|
||||
out vec3 vpos;
|
||||
out vec4 fnormal;
|
||||
|
||||
void main() {
|
||||
|
||||
gl_Position = mvp * vec4(position.xyz, 1.0);
|
||||
fnormal = normal;
|
||||
to_center = centre.xyz - position.xyz;
|
||||
vpos = position.xyz;
|
||||
}
|
||||
@end
|
||||
|
||||
@fs fs_trile
|
||||
|
||||
in vec3 to_center;
|
||||
in vec3 vpos;
|
||||
in vec4 fnormal;
|
||||
out vec4 frag_color;
|
||||
|
||||
@ -26,7 +34,19 @@ layout(binding = 0) uniform sampler trilesmp;
|
||||
|
||||
void main() {
|
||||
//frag_color = vec4((fnormal.xyz + vec3(1.0, 1.0, 1.0)) * 0.5, 1.0);
|
||||
frag_color = texture(sampler2D(triletex, trilesmp), vec2(0.0));
|
||||
vec3 pos_after_adjust_f = vpos - fnormal.xyz * 0.01 + normalize(to_center) * 0.01;
|
||||
vec3 pos_after_adjust_b = vpos - fnormal.xyz * 0.01 + normalize(to_center) * 0.1;
|
||||
int xpos_f = int(clamp(pos_after_adjust_f.z, 0.0001, 0.99999) * 16.0);
|
||||
int ypos_f = int(clamp(pos_after_adjust_f.y, 0.0001, 0.99999) * 16.0);
|
||||
int zpos_f = int(clamp(pos_after_adjust_f.x, 0.0001, 0.99999) * 16.0);
|
||||
int xpos_b = int(clamp(pos_after_adjust_b.z, 0.0001, 0.99999) * 16.0);
|
||||
int ypos_b = int(clamp(pos_after_adjust_b.y, 0.0001, 0.99999) * 16.0);
|
||||
int zpos_b = int(clamp(pos_after_adjust_b.x, 0.0001, 0.99999) * 16.0);
|
||||
|
||||
vec4 trixel_material_b = texelFetch(sampler2D(triletex, trilesmp), ivec2(xpos_b, ypos_b + zpos_b * 16), 0);
|
||||
vec4 trixel_material_f = texelFetch(sampler2D(triletex, trilesmp), ivec2(xpos_f, ypos_f + zpos_f * 16), 0);
|
||||
frag_color = vec4(max(trixel_material_f.xyz, trixel_material_b.xyz), 1.0);
|
||||
// frag_color = vec4(vec3(length(to_center)), 1.0);
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@ -11,6 +11,7 @@ Trile_GFX :: struct {
|
||||
trixel_colors : sg_image;
|
||||
vertex_buffer : sg_buffer;
|
||||
normal_buffer : sg_buffer;
|
||||
centre_buffer : sg_buffer;
|
||||
vertex_count : s64;
|
||||
};
|
||||
|
||||
@ -41,6 +42,7 @@ set_trile_gfx :: (name: string, gfx: Trile_GFX, skip_preexist_check: bool = fals
|
||||
if success {
|
||||
sg_destroy_buffer(old_gfx.vertex_buffer);
|
||||
sg_destroy_buffer(old_gfx.normal_buffer);
|
||||
sg_destroy_image(old_gfx.trixel_colors);
|
||||
print("Destroyed old GFX buffers for trile: %\n", name);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user