wip work
This commit is contained in:
parent
1bfe79fc6b
commit
89c0e36bee
@ -607,8 +607,9 @@ create_level_editor_preview_tasks :: () {
|
||||
draw_level_editor :: () {
|
||||
curworld := get_current_world();
|
||||
if !curworld.valid then return;
|
||||
create_set_cam_rendering_task(get_level_editor_camera(), effective_plane_height(*curworld.world.conf));
|
||||
create_world_rendering_tasks(*curworld.world);
|
||||
cam := get_level_editor_camera();
|
||||
create_set_cam_rendering_task(cam, effective_plane_height(*curworld.world.conf));
|
||||
create_world_rendering_tasks(*curworld.world, cam);
|
||||
if show_trile_preview && !trile_preview_disabled {
|
||||
create_level_editor_preview_tasks();
|
||||
}
|
||||
|
||||
@ -196,10 +196,10 @@ frame :: () {
|
||||
if !in_editor_view then delta_time_accumulator += delta_time;
|
||||
|
||||
if !in_editor_view {
|
||||
while delta_time_accumulator > (1.0/60.0) {
|
||||
game_tick(1.0/60.0);
|
||||
delta_time_accumulator -= (1.0/60.0);
|
||||
}
|
||||
// while delta_time_accumulator > (1.0/60.0) {
|
||||
game_tick(1.0/144.0);
|
||||
// delta_time_accumulator -= (1.0/60.0);
|
||||
// }
|
||||
}
|
||||
fonsClearState(state.fons);
|
||||
for event: Input.events_this_frame {
|
||||
|
||||
@ -153,12 +153,29 @@ backend_draw_trile_positions_gbuffer :: (trile : string, amount : s32, worldConf
|
||||
|
||||
backend_draw_trile_positions_main :: (trile : string, amount : s32, worldConf: *World_Config, chunk_key: Chunk_Key, is_preview: bool = false) {
|
||||
start_frame_profiling_group("Draw trile positions");
|
||||
mvp : Matrix4;
|
||||
if !in_shadowmap_pass {
|
||||
mvp = create_viewproj(*camera);
|
||||
} else {
|
||||
mvp = shadow_mvp;
|
||||
|
||||
trilegfx := get_trile_gfx(trile);
|
||||
offset := trile_offsets[current_trile_offset_index];
|
||||
current_trile_offset_index += 1;
|
||||
|
||||
if in_shadowmap_pass {
|
||||
vs_params : Trile_Shadow_Vs_Params;
|
||||
vs_params.mvp = shadow_mvp.floats;
|
||||
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.vertex_buffers[3] = gPipelines.trile.bind.vertex_buffers[3];
|
||||
bindings.vertex_buffer_offsets[3] = offset;
|
||||
sg_apply_pipeline(gPipelines.trile_shadow.pipeline);
|
||||
sg_apply_bindings(*bindings);
|
||||
sg_apply_uniforms(UB_trile_shadow_vs_params, *(sg_range.{ ptr = *vs_params, size = size_of(type_of(vs_params)) }));
|
||||
sg_draw(0, cast(s32) trilegfx.vertex_count, amount);
|
||||
end_frame_profiling_group("Draw trile positions");
|
||||
return;
|
||||
}
|
||||
|
||||
mvp := create_viewproj(*camera);
|
||||
vs_params : Trile_Vs_Params;
|
||||
vs_params.mvp = mvp.floats;
|
||||
vs_params.mvp_shadow = shadow_mvp.floats;
|
||||
@ -168,10 +185,6 @@ backend_draw_trile_positions_main :: (trile : string, amount : s32, worldConf: *
|
||||
world_config_to_shader_type(worldConf, *world_conf);
|
||||
world_conf.planeHeight = effective_plane_height(worldConf);
|
||||
|
||||
offset := trile_offsets[current_trile_offset_index];
|
||||
current_trile_offset_index += 1;
|
||||
|
||||
trilegfx := get_trile_gfx(trile);
|
||||
bindings : sg_bindings;
|
||||
bindings.vertex_buffers[0] = trilegfx.vertex_buffer;
|
||||
bindings.vertex_buffers[1] = trilegfx.normal_buffer;
|
||||
@ -182,14 +195,7 @@ backend_draw_trile_positions_main :: (trile : string, amount : s32, worldConf: *
|
||||
bindings.images[0] = trilegfx.trixel_colors;
|
||||
bindings.images[1] = g_ssaobuf;
|
||||
bindings.samplers[2] = g_shadowmap_sampler;
|
||||
if !in_shadowmap_pass {
|
||||
bindings.images[2] = g_shadowmap;
|
||||
} else {
|
||||
// Just put something in this slot instead of the shadowmap
|
||||
// so we don't have a circular shadowmap drawing situation.
|
||||
// The texture is not used in shadowmap pass.
|
||||
bindings.images[2] = g_rendertex_depth;
|
||||
}
|
||||
bindings.images[2] = g_shadowmap;
|
||||
|
||||
// Bind RDM textures for this chunk. Fall back to a 1x1 black image when
|
||||
// no baked data is available so sokol doesn't drop the draw call.
|
||||
@ -222,7 +228,7 @@ backend_draw_trile_positions_main :: (trile : string, amount : s32, worldConf: *
|
||||
fs_params.ambient_color = lc.ambient_color.component;
|
||||
fs_params.is_preview = ifx is_preview then cast(s32)1 else cast(s32)0;
|
||||
fs_params.rdm_tint = lc.rdm_tint.component;
|
||||
|
||||
|
||||
sg_apply_bindings(*bindings);
|
||||
sg_apply_uniforms(UB_trile_fs_params, *(sg_range.{ ptr = *fs_params, size = size_of(type_of(fs_params)) }));
|
||||
sg_apply_uniforms(UB_trile_vs_params, *(sg_range.{ ptr = *vs_params, size = size_of(type_of(vs_params))}));
|
||||
|
||||
@ -18,45 +18,107 @@ Gathered_Positions :: struct {
|
||||
positions: [..]Vector4;
|
||||
}
|
||||
|
||||
create_world_rendering_tasks :: (world: *World) {
|
||||
// Extract 6 frustum planes from an MVP matrix using the Gribb-Hartmann method.
|
||||
// Each plane is vec4(A,B,C,D) where dot(plane.xyz, point) + plane.w >= 0 means inside.
|
||||
// Accounts for Jai row-major storage being transposed when uploaded to OpenGL.
|
||||
extract_frustum_planes :: (mvp: Matrix4) -> [6]Vector4 {
|
||||
planes : [6]Vector4;
|
||||
m := mvp;
|
||||
planes[0] = .{m._14+m._11, m._24+m._21, m._34+m._31, m._44+m._41}; // left
|
||||
planes[1] = .{m._14-m._11, m._24-m._21, m._34-m._31, m._44-m._41}; // right
|
||||
planes[2] = .{m._14+m._12, m._24+m._22, m._34+m._32, m._44+m._42}; // bottom
|
||||
planes[3] = .{m._14-m._12, m._24-m._22, m._34-m._32, m._44-m._42}; // top
|
||||
planes[4] = .{m._14+m._13, m._24+m._23, m._34+m._33, m._44+m._43}; // near
|
||||
planes[5] = .{m._14-m._13, m._24-m._23, m._34-m._33, m._44-m._43}; // far
|
||||
return planes;
|
||||
}
|
||||
|
||||
// Returns false if the AABB is completely outside any single frustum plane (fast rejection).
|
||||
aabb_in_frustum :: (planes: [6]Vector4, bmin: Vector3, bmax: Vector3) -> bool {
|
||||
for plane: planes {
|
||||
px := ifx plane.x >= 0 then bmax.x else bmin.x;
|
||||
py := ifx plane.y >= 0 then bmax.y else bmin.y;
|
||||
pz := ifx plane.z >= 0 then bmax.z else bmin.z;
|
||||
if plane.x*px + plane.y*py + plane.z*pz + plane.w < 0 return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
create_world_rendering_tasks :: (world: *World, camera: Camera) {
|
||||
create_sky_rendering_task(*world.conf);
|
||||
create_set_light_rendering_task(*world.conf);
|
||||
|
||||
// Gather all trile positions from chunks, grouped by trile type.
|
||||
gathered: [..]Gathered_Positions;
|
||||
cam_mvp := create_viewproj(*camera);
|
||||
shadow_mvp := create_shadow_viewproj(*camera, *world.conf);
|
||||
cam_planes := extract_frustum_planes(cam_mvp);
|
||||
shadow_planes := extract_frustum_planes(shadow_mvp);
|
||||
|
||||
// Gather positions for camera-visible instances (all passes) and
|
||||
// shadow-only instances (chunks visible from sun but not camera).
|
||||
gathered : [..]Gathered_Positions;
|
||||
gathered.allocator = temp;
|
||||
shad_gathered : [..]Gathered_Positions;
|
||||
shad_gathered.allocator = temp;
|
||||
|
||||
find_or_create :: (list: *[..]Gathered_Positions, name: string, chunk_key: Chunk_Key) -> *Gathered_Positions {
|
||||
for *g: list.* {
|
||||
if g.name == name && g.chunk_key == chunk_key return g;
|
||||
}
|
||||
array_add(list, .{name = name, chunk_key = chunk_key});
|
||||
g := *list.*[list.count - 1];
|
||||
g.positions.allocator = temp;
|
||||
return g;
|
||||
}
|
||||
|
||||
for chunk: world.chunks {
|
||||
bmin := Vector3.{chunk.coord.x * 32.0, chunk.coord.y * 32.0, chunk.coord.z * 32.0};
|
||||
bmax := bmin + .{32, 32, 32};
|
||||
|
||||
in_cam := aabb_in_frustum(cam_planes, bmin, bmax);
|
||||
in_shad := aabb_in_frustum(shadow_planes, bmin, bmax);
|
||||
if !in_cam && !in_shad continue;
|
||||
|
||||
for group: chunk.groups {
|
||||
// Find or create the gathered entry for this (chunk, trile_type) pair.
|
||||
target: *Gathered_Positions = null;
|
||||
for *g: gathered {
|
||||
if g.name == group.trile_name && g.chunk_key == chunk.coord {
|
||||
target = g;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if !target {
|
||||
array_add(*gathered, .{name = group.trile_name, chunk_key = chunk.coord});
|
||||
target = *gathered[gathered.count - 1];
|
||||
target.positions.allocator = temp;
|
||||
}
|
||||
for inst: group.instances {
|
||||
wx, wy, wz := chunk_local_to_world(chunk.coord, inst.x, inst.y, inst.z);
|
||||
array_add(*target.positions, Vector4.{cast(float) wx, cast(float) wy, cast(float) wz, cast(float) inst.orientation});
|
||||
imin := Vector3.{cast(float)wx, cast(float)wy, cast(float)wz};
|
||||
imax := imin + .{1, 1, 1};
|
||||
|
||||
inst_cam := in_cam && aabb_in_frustum(cam_planes, imin, imax);
|
||||
inst_shad := in_shad && aabb_in_frustum(shadow_planes, imin, imax);
|
||||
if !inst_cam && !inst_shad continue;
|
||||
|
||||
pos := Vector4.{cast(float)wx, cast(float)wy, cast(float)wz, cast(float)inst.orientation};
|
||||
if inst_cam {
|
||||
target := find_or_create(*gathered, group.trile_name, chunk.coord);
|
||||
array_add(*target.positions, pos);
|
||||
} else {
|
||||
target := find_or_create(*shad_gathered, group.trile_name, chunk.coord);
|
||||
array_add(*target.positions, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for g: gathered {
|
||||
if g.positions.count < 1 then continue;
|
||||
triletask := Rendering_Task_Trile.{};
|
||||
triletask.trile = g.name;
|
||||
if g.positions.count < 1 continue;
|
||||
triletask : Rendering_Task_Trile;
|
||||
triletask.trile = g.name;
|
||||
triletask.chunk_key = g.chunk_key;
|
||||
triletask.positions = g.positions;
|
||||
triletask.worldConf = *world.conf;
|
||||
add_rendering_task(triletask);
|
||||
}
|
||||
for g: shad_gathered {
|
||||
if g.positions.count < 1 continue;
|
||||
triletask : Rendering_Task_Trile;
|
||||
triletask.trile = g.name;
|
||||
triletask.chunk_key = g.chunk_key;
|
||||
triletask.positions = g.positions;
|
||||
triletask.worldConf = *world.conf;
|
||||
triletask.shadow_only = true;
|
||||
add_rendering_task(triletask);
|
||||
}
|
||||
|
||||
create_ground_rendering_task(world);
|
||||
}
|
||||
|
||||
@ -56,6 +56,9 @@ gPipelines : struct {
|
||||
// Renders sets of triles
|
||||
trile : Pipeline_Binding;
|
||||
|
||||
// Depth-only shadow pass for triles (no lighting/RDM)
|
||||
trile_shadow : Pipeline_Binding;
|
||||
|
||||
// Renders the ground plane. (just water)
|
||||
plane : Pipeline_Binding;
|
||||
|
||||
@ -140,6 +143,7 @@ create_pipelines :: () {
|
||||
create_arbtri_pipeline();
|
||||
create_trixel_pipeline();
|
||||
create_trile_pipeline();
|
||||
create_trile_shadow_pipeline();
|
||||
create_sky_pipeline();
|
||||
create_plane_pipeline();
|
||||
create_postprocess_pipeline();
|
||||
@ -408,6 +412,28 @@ create_trile_pipeline :: () {
|
||||
}));
|
||||
}
|
||||
|
||||
create_trile_shadow_pipeline :: () {
|
||||
pipeline: sg_pipeline_desc;
|
||||
shader_desc := trile_shadow_shader_desc(sg_query_backend());
|
||||
pipeline.shader = sg_make_shader(*shader_desc);
|
||||
pipeline.layout.buffers[0].stride = 4*3;
|
||||
pipeline.layout.buffers[1].stride = 4*3;
|
||||
pipeline.layout.buffers[3].step_func = .PER_INSTANCE;
|
||||
// Explicit locations matching layout(location=N) in the shader.
|
||||
pipeline.layout.attrs[0] = .{ format = .FLOAT3, buffer_index = 0 }; // position
|
||||
pipeline.layout.attrs[1] = .{ format = .FLOAT3, buffer_index = 1 }; // normal (slot match)
|
||||
pipeline.layout.attrs[2] = .{ format = .FLOAT3, buffer_index = 2 }; // centre (slot match)
|
||||
pipeline.layout.attrs[3] = .{ format = .FLOAT4, buffer_index = 3 }; // instance
|
||||
pipeline.depth = .{
|
||||
write_enabled = true,
|
||||
compare = .LESS_EQUAL,
|
||||
pixel_format = .DEPTH,
|
||||
};
|
||||
pipeline.color_count = 1;
|
||||
pipeline.colors[0].pixel_format = .RGBA32F;
|
||||
gPipelines.trile_shadow.pipeline = sg_make_pipeline(*pipeline);
|
||||
}
|
||||
|
||||
create_sky_pipeline :: () {
|
||||
pipeline: sg_pipeline_desc;
|
||||
shader_desc := sky_shader_desc(sg_query_backend());
|
||||
|
||||
@ -57,6 +57,7 @@ Rendering_Task_Trile :: struct {
|
||||
positions : []Vector4;
|
||||
worldConf : *World_Config;
|
||||
is_preview : bool = false;
|
||||
shadow_only : bool = false; // only submit to shadow bucket (frustum-culled from camera)
|
||||
}
|
||||
|
||||
Rendering_Task_Trixels :: struct {
|
||||
@ -115,7 +116,9 @@ tasks_to_commands :: () {
|
||||
drawPositionsCmd.amount = cast(s32)trileTask.positions.count;
|
||||
drawPositionsCmd.conf = trileTask.worldConf;
|
||||
drawPositionsCmd.is_preview = trileTask.is_preview;
|
||||
if trileTask.is_preview {
|
||||
if trileTask.shadow_only {
|
||||
array_add(*render_command_buckets.shadow, drawPositionsCmd);
|
||||
} else if trileTask.is_preview {
|
||||
array_add(*render_command_buckets.main, drawPositionsCmd);
|
||||
} else {
|
||||
array_add(*render_command_buckets.reflection, drawPositionsCmd);
|
||||
|
||||
907
src/shaders/jai/shader_trile_shadow.jai
Normal file
907
src/shaders/jai/shader_trile_shadow.jai
Normal file
@ -0,0 +1,907 @@
|
||||
/*
|
||||
#version:1# (machine generated, don't edit!)
|
||||
|
||||
Generated by sokol-shdc (https://github.com/floooh/sokol-tools)
|
||||
|
||||
Cmdline:
|
||||
sokol-shdc -i shader_trile_shadow.glsl -o ./jai/shader_trile_shadow.jai -l glsl430:glsl300es:metal_macos -f sokol_jai
|
||||
|
||||
Overview:
|
||||
=========
|
||||
Shader program: 'trile_shadow':
|
||||
Get shader desc: trile_shadow_shader_desc(sg_query_backend())
|
||||
Vertex Shader: vs_trile_shadow
|
||||
Fragment Shader: fs_trile_shadow
|
||||
Attributes:
|
||||
ATTR_trile_shadow_position => 0
|
||||
ATTR_trile_shadow_normal => 1
|
||||
ATTR_trile_shadow_centre => 2
|
||||
ATTR_trile_shadow_instance => 3
|
||||
Bindings:
|
||||
Uniform block 'trile_shadow_vs_params':
|
||||
Jai struct: Trile_Shadow_Vs_Params
|
||||
Bind slot: UB_trile_shadow_vs_params => 0
|
||||
*/
|
||||
ATTR_trile_shadow_position :: 0;
|
||||
ATTR_trile_shadow_normal :: 1;
|
||||
ATTR_trile_shadow_centre :: 2;
|
||||
ATTR_trile_shadow_instance :: 3;
|
||||
UB_trile_shadow_vs_params :: 0;
|
||||
Trile_Shadow_Vs_Params :: struct {
|
||||
mvp: [16]float;
|
||||
};
|
||||
/*
|
||||
#version 430
|
||||
|
||||
uniform vec4 trile_shadow_vs_params[4];
|
||||
layout(location = 3) in vec4 instance;
|
||||
layout(location = 0) in vec4 position;
|
||||
layout(location = 1) in vec4 normal;
|
||||
layout(location = 2) in vec4 centre;
|
||||
|
||||
mat3 rot_x(float a)
|
||||
{
|
||||
float _28 = cos(a);
|
||||
float _31 = sin(a);
|
||||
return mat3(vec3(1.0, 0.0, 0.0), vec3(0.0, _28, -_31), vec3(0.0, _31, _28));
|
||||
}
|
||||
|
||||
mat3 rot_z(float a)
|
||||
{
|
||||
float _47 = cos(a);
|
||||
float _50 = sin(a);
|
||||
return mat3(vec3(_47, -_50, 0.0), vec3(_50, _47, 0.0), vec3(0.0, 0.0, 1.0));
|
||||
}
|
||||
|
||||
mat3 rot_y(float a)
|
||||
{
|
||||
float _64 = cos(a);
|
||||
float _67 = sin(a);
|
||||
return mat3(vec3(_64, 0.0, _67), vec3(0.0, 1.0, 0.0), vec3(-_67, 0.0, _64));
|
||||
}
|
||||
|
||||
mat3 get_orientation_matrix(int ori)
|
||||
{
|
||||
int _82 = ori / 4;
|
||||
mat3 base;
|
||||
if (_82 == 0)
|
||||
{
|
||||
base = mat3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_82 == 1)
|
||||
{
|
||||
float param = 3.1415927410125732421875;
|
||||
base = rot_x(param);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_82 == 2)
|
||||
{
|
||||
float param_1 = -1.57079637050628662109375;
|
||||
base = rot_z(param_1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_82 == 3)
|
||||
{
|
||||
float param_2 = 1.57079637050628662109375;
|
||||
base = rot_z(param_2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_82 == 4)
|
||||
{
|
||||
float param_3 = 1.57079637050628662109375;
|
||||
base = rot_x(param_3);
|
||||
}
|
||||
else
|
||||
{
|
||||
float param_4 = -1.57079637050628662109375;
|
||||
base = rot_x(param_4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
float param_5 = float(ori % 4) * 1.57079637050628662109375;
|
||||
return base * rot_y(param_5);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
int param = int(round(instance.w));
|
||||
gl_Position = mat4(trile_shadow_vs_params[0], trile_shadow_vs_params[1], trile_shadow_vs_params[2], trile_shadow_vs_params[3]) * vec4(((get_orientation_matrix(param) * (position.xyz - vec3(0.5))) + vec3(0.5)) + instance.xyz, 1.0);
|
||||
}
|
||||
|
||||
*/
|
||||
vs_trile_shadow_source_glsl430 := u8.[
|
||||
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x75,0x6e,
|
||||
0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x74,0x72,0x69,0x6c,0x65,
|
||||
0x5f,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
|
||||
0x73,0x5b,0x34,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,
|
||||
0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x33,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,
|
||||
0x63,0x34,0x20,0x69,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,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,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,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,
|
||||
0x20,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,0x32,0x29,0x20,0x69,0x6e,
|
||||
0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x65,0x6e,0x74,0x72,0x65,0x3b,0x0a,0x0a,0x6d,
|
||||
0x61,0x74,0x33,0x20,0x72,0x6f,0x74,0x5f,0x78,0x28,0x66,0x6c,0x6f,0x61,0x74,0x20,
|
||||
0x61,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,
|
||||
0x32,0x38,0x20,0x3d,0x20,0x63,0x6f,0x73,0x28,0x61,0x29,0x3b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x33,0x31,0x20,0x3d,0x20,0x73,0x69,0x6e,
|
||||
0x28,0x61,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,
|
||||
0x6d,0x61,0x74,0x33,0x28,0x76,0x65,0x63,0x33,0x28,0x31,0x2e,0x30,0x2c,0x20,0x30,
|
||||
0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x30,
|
||||
0x2e,0x30,0x2c,0x20,0x5f,0x32,0x38,0x2c,0x20,0x2d,0x5f,0x33,0x31,0x29,0x2c,0x20,
|
||||
0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x5f,0x33,0x31,0x2c,0x20,0x5f,
|
||||
0x32,0x38,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x6d,0x61,0x74,0x33,0x20,0x72,0x6f,
|
||||
0x74,0x5f,0x7a,0x28,0x66,0x6c,0x6f,0x61,0x74,0x20,0x61,0x29,0x0a,0x7b,0x0a,0x20,
|
||||
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x34,0x37,0x20,0x3d,0x20,0x63,
|
||||
0x6f,0x73,0x28,0x61,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
||||
0x20,0x5f,0x35,0x30,0x20,0x3d,0x20,0x73,0x69,0x6e,0x28,0x61,0x29,0x3b,0x0a,0x20,
|
||||
0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x74,0x33,0x28,0x76,
|
||||
0x65,0x63,0x33,0x28,0x5f,0x34,0x37,0x2c,0x20,0x2d,0x5f,0x35,0x30,0x2c,0x20,0x30,
|
||||
0x2e,0x30,0x29,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x5f,0x35,0x30,0x2c,0x20,0x5f,
|
||||
0x34,0x37,0x2c,0x20,0x30,0x2e,0x30,0x29,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x30,
|
||||
0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x29,0x3b,0x0a,
|
||||
0x7d,0x0a,0x0a,0x6d,0x61,0x74,0x33,0x20,0x72,0x6f,0x74,0x5f,0x79,0x28,0x66,0x6c,
|
||||
0x6f,0x61,0x74,0x20,0x61,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
|
||||
0x61,0x74,0x20,0x5f,0x36,0x34,0x20,0x3d,0x20,0x63,0x6f,0x73,0x28,0x61,0x29,0x3b,
|
||||
0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x36,0x37,0x20,0x3d,
|
||||
0x20,0x73,0x69,0x6e,0x28,0x61,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,
|
||||
0x75,0x72,0x6e,0x20,0x6d,0x61,0x74,0x33,0x28,0x76,0x65,0x63,0x33,0x28,0x5f,0x36,
|
||||
0x34,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x5f,0x36,0x37,0x29,0x2c,0x20,0x76,0x65,
|
||||
0x63,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,
|
||||
0x29,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x2d,0x5f,0x36,0x37,0x2c,0x20,0x30,0x2e,
|
||||
0x30,0x2c,0x20,0x5f,0x36,0x34,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x6d,0x61,0x74,
|
||||
0x33,0x20,0x67,0x65,0x74,0x5f,0x6f,0x72,0x69,0x65,0x6e,0x74,0x61,0x74,0x69,0x6f,
|
||||
0x6e,0x5f,0x6d,0x61,0x74,0x72,0x69,0x78,0x28,0x69,0x6e,0x74,0x20,0x6f,0x72,0x69,
|
||||
0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x69,0x6e,0x74,0x20,0x5f,0x38,0x32,0x20,
|
||||
0x3d,0x20,0x6f,0x72,0x69,0x20,0x2f,0x20,0x34,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6d,
|
||||
0x61,0x74,0x33,0x20,0x62,0x61,0x73,0x65,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,
|
||||
0x20,0x28,0x5f,0x38,0x32,0x20,0x3d,0x3d,0x20,0x30,0x29,0x0a,0x20,0x20,0x20,0x20,
|
||||
0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x62,0x61,0x73,0x65,0x20,0x3d,
|
||||
0x20,0x6d,0x61,0x74,0x33,0x28,0x76,0x65,0x63,0x33,0x28,0x31,0x2e,0x30,0x2c,0x20,
|
||||
0x30,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,
|
||||
0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x2c,0x20,
|
||||
0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,
|
||||
0x2e,0x30,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,
|
||||
0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x38,0x32,0x20,0x3d,0x3d,0x20,0x31,0x29,
|
||||
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,
|
||||
0x61,0x6d,0x20,0x3d,0x20,0x33,0x2e,0x31,0x34,0x31,0x35,0x39,0x32,0x37,0x34,0x31,
|
||||
0x30,0x31,0x32,0x35,0x37,0x33,0x32,0x34,0x32,0x31,0x38,0x37,0x35,0x3b,0x0a,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x62,0x61,0x73,0x65,0x20,
|
||||
0x3d,0x20,0x72,0x6f,0x74,0x5f,0x78,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x3b,0x0a,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,
|
||||
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x66,0x20,
|
||||
0x28,0x5f,0x38,0x32,0x20,0x3d,0x3d,0x20,0x32,0x29,0x0a,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,
|
||||
0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x2d,0x31,0x2e,0x35,0x37,0x30,0x37,
|
||||
0x39,0x36,0x33,0x37,0x30,0x35,0x30,0x36,0x32,0x38,0x36,0x36,0x32,0x31,0x30,0x39,
|
||||
0x33,0x37,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x62,0x61,0x73,0x65,0x20,0x3d,0x20,0x72,0x6f,0x74,0x5f,
|
||||
0x7a,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x38,0x32,
|
||||
0x20,0x3d,0x3d,0x20,0x33,0x29,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,
|
||||
0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x31,0x2e,0x35,
|
||||
0x37,0x30,0x37,0x39,0x36,0x33,0x37,0x30,0x35,0x30,0x36,0x32,0x38,0x36,0x36,0x32,
|
||||
0x31,0x30,0x39,0x33,0x37,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x62,0x61,0x73,0x65,
|
||||
0x20,0x3d,0x20,0x72,0x6f,0x74,0x5f,0x7a,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,
|
||||
0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x69,0x66,0x20,0x28,0x5f,0x38,0x32,0x20,0x3d,0x3d,0x20,0x34,0x29,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,
|
||||
0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x20,0x3d,0x20,0x31,0x2e,0x35,0x37,
|
||||
0x30,0x37,0x39,0x36,0x33,0x37,0x30,0x35,0x30,0x36,0x32,0x38,0x36,0x36,0x32,0x31,
|
||||
0x30,0x39,0x33,0x37,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x62,
|
||||
0x61,0x73,0x65,0x20,0x3d,0x20,0x72,0x6f,0x74,0x5f,0x78,0x28,0x70,0x61,0x72,0x61,
|
||||
0x6d,0x5f,0x33,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,
|
||||
0x20,0x3d,0x20,0x2d,0x31,0x2e,0x35,0x37,0x30,0x37,0x39,0x36,0x33,0x37,0x30,0x35,
|
||||
0x30,0x36,0x32,0x38,0x36,0x36,0x32,0x31,0x30,0x39,0x33,0x37,0x35,0x3b,0x0a,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x62,0x61,0x73,0x65,0x20,0x3d,0x20,0x72,0x6f,
|
||||
0x74,0x5f,0x78,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x29,0x3b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,
|
||||
0x72,0x61,0x6d,0x5f,0x35,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x6f,0x72,
|
||||
0x69,0x20,0x25,0x20,0x34,0x29,0x20,0x2a,0x20,0x31,0x2e,0x35,0x37,0x30,0x37,0x39,
|
||||
0x36,0x33,0x37,0x30,0x35,0x30,0x36,0x32,0x38,0x36,0x36,0x32,0x31,0x30,0x39,0x33,
|
||||
0x37,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x62,
|
||||
0x61,0x73,0x65,0x20,0x2a,0x20,0x72,0x6f,0x74,0x5f,0x79,0x28,0x70,0x61,0x72,0x61,
|
||||
0x6d,0x5f,0x35,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,
|
||||
0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x69,0x6e,0x74,0x20,0x70,
|
||||
0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x69,0x6e,0x74,0x28,0x72,0x6f,0x75,0x6e,0x64,
|
||||
0x28,0x69,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x2e,0x77,0x29,0x29,0x3b,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,0x73,0x68,0x61,0x64,
|
||||
0x6f,0x77,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,
|
||||
0x20,0x74,0x72,0x69,0x6c,0x65,0x5f,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x76,0x73,
|
||||
0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x74,0x72,0x69,0x6c,
|
||||
0x65,0x5f,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,
|
||||
0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x74,0x72,0x69,0x6c,0x65,0x5f,0x73,0x68,0x61,
|
||||
0x64,0x6f,0x77,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,
|
||||
0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x28,0x28,0x67,0x65,0x74,0x5f,0x6f,
|
||||
0x72,0x69,0x65,0x6e,0x74,0x61,0x74,0x69,0x6f,0x6e,0x5f,0x6d,0x61,0x74,0x72,0x69,
|
||||
0x78,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x20,0x2a,0x20,0x28,0x70,0x6f,0x73,0x69,
|
||||
0x74,0x69,0x6f,0x6e,0x2e,0x78,0x79,0x7a,0x20,0x2d,0x20,0x76,0x65,0x63,0x33,0x28,
|
||||
0x30,0x2e,0x35,0x29,0x29,0x29,0x20,0x2b,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,
|
||||
0x35,0x29,0x29,0x20,0x2b,0x20,0x69,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x2e,0x78,
|
||||
0x79,0x7a,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
];
|
||||
/*
|
||||
#version 430
|
||||
|
||||
layout(location = 0) out vec4 frag_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
frag_color = vec4(0.0);
|
||||
}
|
||||
|
||||
*/
|
||||
fs_trile_shadow_source_glsl430 := u8.[
|
||||
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,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,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,0x76,0x65,0x63,0x34,0x28,0x30,0x2e,0x30,
|
||||
0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
];
|
||||
/*
|
||||
#version 300 es
|
||||
|
||||
uniform vec4 trile_shadow_vs_params[4];
|
||||
layout(location = 3) in vec4 instance;
|
||||
layout(location = 0) in vec4 position;
|
||||
layout(location = 1) in vec4 normal;
|
||||
layout(location = 2) in vec4 centre;
|
||||
|
||||
mat3 rot_x(float a)
|
||||
{
|
||||
float _28 = cos(a);
|
||||
float _31 = sin(a);
|
||||
return mat3(vec3(1.0, 0.0, 0.0), vec3(0.0, _28, -_31), vec3(0.0, _31, _28));
|
||||
}
|
||||
|
||||
mat3 rot_z(float a)
|
||||
{
|
||||
float _47 = cos(a);
|
||||
float _50 = sin(a);
|
||||
return mat3(vec3(_47, -_50, 0.0), vec3(_50, _47, 0.0), vec3(0.0, 0.0, 1.0));
|
||||
}
|
||||
|
||||
mat3 rot_y(float a)
|
||||
{
|
||||
float _64 = cos(a);
|
||||
float _67 = sin(a);
|
||||
return mat3(vec3(_64, 0.0, _67), vec3(0.0, 1.0, 0.0), vec3(-_67, 0.0, _64));
|
||||
}
|
||||
|
||||
mat3 get_orientation_matrix(int ori)
|
||||
{
|
||||
int _82 = ori / 4;
|
||||
mat3 base;
|
||||
if (_82 == 0)
|
||||
{
|
||||
base = mat3(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_82 == 1)
|
||||
{
|
||||
float param = 3.1415927410125732421875;
|
||||
base = rot_x(param);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_82 == 2)
|
||||
{
|
||||
float param_1 = -1.57079637050628662109375;
|
||||
base = rot_z(param_1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_82 == 3)
|
||||
{
|
||||
float param_2 = 1.57079637050628662109375;
|
||||
base = rot_z(param_2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_82 == 4)
|
||||
{
|
||||
float param_3 = 1.57079637050628662109375;
|
||||
base = rot_x(param_3);
|
||||
}
|
||||
else
|
||||
{
|
||||
float param_4 = -1.57079637050628662109375;
|
||||
base = rot_x(param_4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
float param_5 = float(ori % 4) * 1.57079637050628662109375;
|
||||
return base * rot_y(param_5);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
int param = int(round(instance.w));
|
||||
gl_Position = mat4(trile_shadow_vs_params[0], trile_shadow_vs_params[1], trile_shadow_vs_params[2], trile_shadow_vs_params[3]) * vec4(((get_orientation_matrix(param) * (position.xyz - vec3(0.5))) + vec3(0.5)) + instance.xyz, 1.0);
|
||||
}
|
||||
|
||||
*/
|
||||
vs_trile_shadow_source_glsl300es := u8.[
|
||||
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a,
|
||||
0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x74,0x72,
|
||||
0x69,0x6c,0x65,0x5f,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x76,0x73,0x5f,0x70,0x61,
|
||||
0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,
|
||||
0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x33,0x29,0x20,0x69,0x6e,
|
||||
0x20,0x76,0x65,0x63,0x34,0x20,0x69,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,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,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,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,
|
||||
0x65,0x63,0x34,0x20,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,0x32,0x29,
|
||||
0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x65,0x6e,0x74,0x72,0x65,0x3b,
|
||||
0x0a,0x0a,0x6d,0x61,0x74,0x33,0x20,0x72,0x6f,0x74,0x5f,0x78,0x28,0x66,0x6c,0x6f,
|
||||
0x61,0x74,0x20,0x61,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,
|
||||
0x74,0x20,0x5f,0x32,0x38,0x20,0x3d,0x20,0x63,0x6f,0x73,0x28,0x61,0x29,0x3b,0x0a,
|
||||
0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x33,0x31,0x20,0x3d,0x20,
|
||||
0x73,0x69,0x6e,0x28,0x61,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,
|
||||
0x72,0x6e,0x20,0x6d,0x61,0x74,0x33,0x28,0x76,0x65,0x63,0x33,0x28,0x31,0x2e,0x30,
|
||||
0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x2c,0x20,0x76,0x65,0x63,
|
||||
0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x5f,0x32,0x38,0x2c,0x20,0x2d,0x5f,0x33,0x31,
|
||||
0x29,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x5f,0x33,0x31,
|
||||
0x2c,0x20,0x5f,0x32,0x38,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x6d,0x61,0x74,0x33,
|
||||
0x20,0x72,0x6f,0x74,0x5f,0x7a,0x28,0x66,0x6c,0x6f,0x61,0x74,0x20,0x61,0x29,0x0a,
|
||||
0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x34,0x37,0x20,
|
||||
0x3d,0x20,0x63,0x6f,0x73,0x28,0x61,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,
|
||||
0x6f,0x61,0x74,0x20,0x5f,0x35,0x30,0x20,0x3d,0x20,0x73,0x69,0x6e,0x28,0x61,0x29,
|
||||
0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x74,
|
||||
0x33,0x28,0x76,0x65,0x63,0x33,0x28,0x5f,0x34,0x37,0x2c,0x20,0x2d,0x5f,0x35,0x30,
|
||||
0x2c,0x20,0x30,0x2e,0x30,0x29,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x5f,0x35,0x30,
|
||||
0x2c,0x20,0x5f,0x34,0x37,0x2c,0x20,0x30,0x2e,0x30,0x29,0x2c,0x20,0x76,0x65,0x63,
|
||||
0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,
|
||||
0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x6d,0x61,0x74,0x33,0x20,0x72,0x6f,0x74,0x5f,0x79,
|
||||
0x28,0x66,0x6c,0x6f,0x61,0x74,0x20,0x61,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,
|
||||
0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x36,0x34,0x20,0x3d,0x20,0x63,0x6f,0x73,0x28,
|
||||
0x61,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x36,
|
||||
0x37,0x20,0x3d,0x20,0x73,0x69,0x6e,0x28,0x61,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
||||
0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6d,0x61,0x74,0x33,0x28,0x76,0x65,0x63,0x33,
|
||||
0x28,0x5f,0x36,0x34,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x5f,0x36,0x37,0x29,0x2c,
|
||||
0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,
|
||||
0x30,0x2e,0x30,0x29,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x2d,0x5f,0x36,0x37,0x2c,
|
||||
0x20,0x30,0x2e,0x30,0x2c,0x20,0x5f,0x36,0x34,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,
|
||||
0x6d,0x61,0x74,0x33,0x20,0x67,0x65,0x74,0x5f,0x6f,0x72,0x69,0x65,0x6e,0x74,0x61,
|
||||
0x74,0x69,0x6f,0x6e,0x5f,0x6d,0x61,0x74,0x72,0x69,0x78,0x28,0x69,0x6e,0x74,0x20,
|
||||
0x6f,0x72,0x69,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x69,0x6e,0x74,0x20,0x5f,
|
||||
0x38,0x32,0x20,0x3d,0x20,0x6f,0x72,0x69,0x20,0x2f,0x20,0x34,0x3b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x6d,0x61,0x74,0x33,0x20,0x62,0x61,0x73,0x65,0x3b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x69,0x66,0x20,0x28,0x5f,0x38,0x32,0x20,0x3d,0x3d,0x20,0x30,0x29,0x0a,0x20,
|
||||
0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x62,0x61,0x73,
|
||||
0x65,0x20,0x3d,0x20,0x6d,0x61,0x74,0x33,0x28,0x76,0x65,0x63,0x33,0x28,0x31,0x2e,
|
||||
0x30,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x2c,0x20,0x76,0x65,
|
||||
0x63,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,
|
||||
0x29,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,
|
||||
0x2c,0x20,0x31,0x2e,0x30,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,
|
||||
0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x38,0x32,0x20,0x3d,0x3d,
|
||||
0x20,0x31,0x29,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,
|
||||
0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x33,0x2e,0x31,0x34,0x31,0x35,0x39,0x32,
|
||||
0x37,0x34,0x31,0x30,0x31,0x32,0x35,0x37,0x33,0x32,0x34,0x32,0x31,0x38,0x37,0x35,
|
||||
0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x62,0x61,
|
||||
0x73,0x65,0x20,0x3d,0x20,0x72,0x6f,0x74,0x5f,0x78,0x28,0x70,0x61,0x72,0x61,0x6d,
|
||||
0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x69,0x66,0x20,0x28,0x5f,0x38,0x32,0x20,0x3d,0x3d,0x20,0x32,0x29,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,
|
||||
0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x2d,0x31,0x2e,0x35,
|
||||
0x37,0x30,0x37,0x39,0x36,0x33,0x37,0x30,0x35,0x30,0x36,0x32,0x38,0x36,0x36,0x32,
|
||||
0x31,0x30,0x39,0x33,0x37,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x62,0x61,0x73,0x65,0x20,0x3d,0x20,0x72,
|
||||
0x6f,0x74,0x5f,0x7a,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x29,0x3b,0x0a,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,
|
||||
0x5f,0x38,0x32,0x20,0x3d,0x3d,0x20,0x33,0x29,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,
|
||||
0x31,0x2e,0x35,0x37,0x30,0x37,0x39,0x36,0x33,0x37,0x30,0x35,0x30,0x36,0x32,0x38,
|
||||
0x36,0x36,0x32,0x31,0x30,0x39,0x33,0x37,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x62,
|
||||
0x61,0x73,0x65,0x20,0x3d,0x20,0x72,0x6f,0x74,0x5f,0x7a,0x28,0x70,0x61,0x72,0x61,
|
||||
0x6d,0x5f,0x32,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x38,0x32,0x20,0x3d,0x3d,0x20,0x34,0x29,
|
||||
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,
|
||||
0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x20,0x3d,0x20,0x31,
|
||||
0x2e,0x35,0x37,0x30,0x37,0x39,0x36,0x33,0x37,0x30,0x35,0x30,0x36,0x32,0x38,0x36,
|
||||
0x36,0x32,0x31,0x30,0x39,0x33,0x37,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x62,0x61,0x73,0x65,0x20,0x3d,0x20,0x72,0x6f,0x74,0x5f,0x78,0x28,0x70,
|
||||
0x61,0x72,0x61,0x6d,0x5f,0x33,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,
|
||||
0x6d,0x5f,0x34,0x20,0x3d,0x20,0x2d,0x31,0x2e,0x35,0x37,0x30,0x37,0x39,0x36,0x33,
|
||||
0x37,0x30,0x35,0x30,0x36,0x32,0x38,0x36,0x36,0x32,0x31,0x30,0x39,0x33,0x37,0x35,
|
||||
0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x62,0x61,0x73,0x65,0x20,0x3d,
|
||||
0x20,0x72,0x6f,0x74,0x5f,0x78,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x29,0x3b,
|
||||
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,
|
||||
0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
||||
0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x35,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
||||
0x28,0x6f,0x72,0x69,0x20,0x25,0x20,0x34,0x29,0x20,0x2a,0x20,0x31,0x2e,0x35,0x37,
|
||||
0x30,0x37,0x39,0x36,0x33,0x37,0x30,0x35,0x30,0x36,0x32,0x38,0x36,0x36,0x32,0x31,
|
||||
0x30,0x39,0x33,0x37,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,
|
||||
0x6e,0x20,0x62,0x61,0x73,0x65,0x20,0x2a,0x20,0x72,0x6f,0x74,0x5f,0x79,0x28,0x70,
|
||||
0x61,0x72,0x61,0x6d,0x5f,0x35,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,
|
||||
0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x69,0x6e,
|
||||
0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x69,0x6e,0x74,0x28,0x72,0x6f,
|
||||
0x75,0x6e,0x64,0x28,0x69,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x2e,0x77,0x29,0x29,
|
||||
0x3b,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,0x73,
|
||||
0x68,0x61,0x64,0x6f,0x77,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,
|
||||
0x30,0x5d,0x2c,0x20,0x74,0x72,0x69,0x6c,0x65,0x5f,0x73,0x68,0x61,0x64,0x6f,0x77,
|
||||
0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x74,
|
||||
0x72,0x69,0x6c,0x65,0x5f,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x76,0x73,0x5f,0x70,
|
||||
0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x74,0x72,0x69,0x6c,0x65,0x5f,
|
||||
0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,
|
||||
0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x28,0x28,0x67,0x65,
|
||||
0x74,0x5f,0x6f,0x72,0x69,0x65,0x6e,0x74,0x61,0x74,0x69,0x6f,0x6e,0x5f,0x6d,0x61,
|
||||
0x74,0x72,0x69,0x78,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x20,0x2a,0x20,0x28,0x70,
|
||||
0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x79,0x7a,0x20,0x2d,0x20,0x76,0x65,
|
||||
0x63,0x33,0x28,0x30,0x2e,0x35,0x29,0x29,0x29,0x20,0x2b,0x20,0x76,0x65,0x63,0x33,
|
||||
0x28,0x30,0x2e,0x35,0x29,0x29,0x20,0x2b,0x20,0x69,0x6e,0x73,0x74,0x61,0x6e,0x63,
|
||||
0x65,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,
|
||||
0x00,
|
||||
];
|
||||
/*
|
||||
#version 300 es
|
||||
precision mediump float;
|
||||
precision highp int;
|
||||
|
||||
layout(location = 0) out highp vec4 frag_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
frag_color = vec4(0.0);
|
||||
}
|
||||
|
||||
*/
|
||||
fs_trile_shadow_source_glsl300es := u8.[
|
||||
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x33,0x30,0x30,0x20,0x65,0x73,0x0a,
|
||||
0x70,0x72,0x65,0x63,0x69,0x73,0x69,0x6f,0x6e,0x20,0x6d,0x65,0x64,0x69,0x75,0x6d,
|
||||
0x70,0x20,0x66,0x6c,0x6f,0x61,0x74,0x3b,0x0a,0x70,0x72,0x65,0x63,0x69,0x73,0x69,
|
||||
0x6f,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x69,0x6e,0x74,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,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,0x76,
|
||||
0x65,0x63,0x34,0x28,0x30,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
];
|
||||
/*
|
||||
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct trile_shadow_vs_params
|
||||
{
|
||||
float4x4 mvp;
|
||||
};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 gl_Position [[position]];
|
||||
};
|
||||
|
||||
struct main0_in
|
||||
{
|
||||
float4 position [[attribute(0)]];
|
||||
float4 instance [[attribute(3)]];
|
||||
};
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
float3x3 rot_x(thread const float& a)
|
||||
{
|
||||
float _28 = cos(a);
|
||||
float _31 = sin(a);
|
||||
return float3x3(float3(1.0, 0.0, 0.0), float3(0.0, _28, -_31), float3(0.0, _31, _28));
|
||||
}
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
float3x3 rot_z(thread const float& a)
|
||||
{
|
||||
float _47 = cos(a);
|
||||
float _50 = sin(a);
|
||||
return float3x3(float3(_47, -_50, 0.0), float3(_50, _47, 0.0), float3(0.0, 0.0, 1.0));
|
||||
}
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
float3x3 rot_y(thread const float& a)
|
||||
{
|
||||
float _64 = cos(a);
|
||||
float _67 = sin(a);
|
||||
return float3x3(float3(_64, 0.0, _67), float3(0.0, 1.0, 0.0), float3(-_67, 0.0, _64));
|
||||
}
|
||||
|
||||
static inline __attribute__((always_inline))
|
||||
float3x3 get_orientation_matrix(thread const int& ori)
|
||||
{
|
||||
int _82 = ori / 4;
|
||||
float3x3 base;
|
||||
if (_82 == 0)
|
||||
{
|
||||
base = float3x3(float3(1.0, 0.0, 0.0), float3(0.0, 1.0, 0.0), float3(0.0, 0.0, 1.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_82 == 1)
|
||||
{
|
||||
float param = 3.1415927410125732421875;
|
||||
base = rot_x(param);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_82 == 2)
|
||||
{
|
||||
float param_1 = -1.57079637050628662109375;
|
||||
base = rot_z(param_1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_82 == 3)
|
||||
{
|
||||
float param_2 = 1.57079637050628662109375;
|
||||
base = rot_z(param_2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_82 == 4)
|
||||
{
|
||||
float param_3 = 1.57079637050628662109375;
|
||||
base = rot_x(param_3);
|
||||
}
|
||||
else
|
||||
{
|
||||
float param_4 = -1.57079637050628662109375;
|
||||
base = rot_x(param_4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
float param_5 = float(ori % 4) * 1.57079637050628662109375;
|
||||
return base * rot_y(param_5);
|
||||
}
|
||||
|
||||
vertex main0_out main0(main0_in in [[stage_in]], constant trile_shadow_vs_params& _193 [[buffer(0)]])
|
||||
{
|
||||
main0_out out = {};
|
||||
int param = int(round(in.instance.w));
|
||||
out.gl_Position = _193.mvp * float4(((get_orientation_matrix(param) * (in.position.xyz - float3(0.5))) + float3(0.5)) + in.instance.xyz, 1.0);
|
||||
return out;
|
||||
}
|
||||
|
||||
*/
|
||||
vs_trile_shadow_source_metal_macos := u8.[
|
||||
0x23,0x70,0x72,0x61,0x67,0x6d,0x61,0x20,0x63,0x6c,0x61,0x6e,0x67,0x20,0x64,0x69,
|
||||
0x61,0x67,0x6e,0x6f,0x73,0x74,0x69,0x63,0x20,0x69,0x67,0x6e,0x6f,0x72,0x65,0x64,
|
||||
0x20,0x22,0x2d,0x57,0x6d,0x69,0x73,0x73,0x69,0x6e,0x67,0x2d,0x70,0x72,0x6f,0x74,
|
||||
0x6f,0x74,0x79,0x70,0x65,0x73,0x22,0x0a,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,
|
||||
0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,
|
||||
0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,
|
||||
0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,
|
||||
0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20,0x6d,0x65,0x74,0x61,0x6c,0x3b,0x0a,
|
||||
0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x74,0x72,0x69,0x6c,0x65,0x5f,0x73,0x68,
|
||||
0x61,0x64,0x6f,0x77,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x0a,0x7b,
|
||||
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,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,0x69,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x20,0x5b,
|
||||
0x5b,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x28,0x33,0x29,0x5d,0x5d,0x3b,
|
||||
0x0a,0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x69,0x6e,0x6c,0x69,
|
||||
0x6e,0x65,0x20,0x5f,0x5f,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x5f,0x5f,
|
||||
0x28,0x28,0x61,0x6c,0x77,0x61,0x79,0x73,0x5f,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x29,
|
||||
0x29,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x33,0x78,0x33,0x20,0x72,0x6f,0x74,0x5f,0x78,
|
||||
0x28,0x74,0x68,0x72,0x65,0x61,0x64,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,0x66,0x6c,
|
||||
0x6f,0x61,0x74,0x26,0x20,0x61,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,
|
||||
0x6f,0x61,0x74,0x20,0x5f,0x32,0x38,0x20,0x3d,0x20,0x63,0x6f,0x73,0x28,0x61,0x29,
|
||||
0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x33,0x31,0x20,
|
||||
0x3d,0x20,0x73,0x69,0x6e,0x28,0x61,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,
|
||||
0x74,0x75,0x72,0x6e,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x78,0x33,0x28,0x66,0x6c,
|
||||
0x6f,0x61,0x74,0x33,0x28,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x30,
|
||||
0x2e,0x30,0x29,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x30,0x2c,
|
||||
0x20,0x5f,0x32,0x38,0x2c,0x20,0x2d,0x5f,0x33,0x31,0x29,0x2c,0x20,0x66,0x6c,0x6f,
|
||||
0x61,0x74,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x5f,0x33,0x31,0x2c,0x20,0x5f,0x32,
|
||||
0x38,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,0x63,0x20,0x69,
|
||||
0x6e,0x6c,0x69,0x6e,0x65,0x20,0x5f,0x5f,0x61,0x74,0x74,0x72,0x69,0x62,0x75,0x74,
|
||||
0x65,0x5f,0x5f,0x28,0x28,0x61,0x6c,0x77,0x61,0x79,0x73,0x5f,0x69,0x6e,0x6c,0x69,
|
||||
0x6e,0x65,0x29,0x29,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x33,0x78,0x33,0x20,0x72,0x6f,
|
||||
0x74,0x5f,0x7a,0x28,0x74,0x68,0x72,0x65,0x61,0x64,0x20,0x63,0x6f,0x6e,0x73,0x74,
|
||||
0x20,0x66,0x6c,0x6f,0x61,0x74,0x26,0x20,0x61,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x34,0x37,0x20,0x3d,0x20,0x63,0x6f,0x73,
|
||||
0x28,0x61,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,
|
||||
0x35,0x30,0x20,0x3d,0x20,0x73,0x69,0x6e,0x28,0x61,0x29,0x3b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x78,0x33,
|
||||
0x28,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x5f,0x34,0x37,0x2c,0x20,0x2d,0x5f,0x35,
|
||||
0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,
|
||||
0x5f,0x35,0x30,0x2c,0x20,0x5f,0x34,0x37,0x2c,0x20,0x30,0x2e,0x30,0x29,0x2c,0x20,
|
||||
0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x2c,
|
||||
0x20,0x31,0x2e,0x30,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x73,0x74,0x61,0x74,0x69,
|
||||
0x63,0x20,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x5f,0x5f,0x61,0x74,0x74,0x72,0x69,
|
||||
0x62,0x75,0x74,0x65,0x5f,0x5f,0x28,0x28,0x61,0x6c,0x77,0x61,0x79,0x73,0x5f,0x69,
|
||||
0x6e,0x6c,0x69,0x6e,0x65,0x29,0x29,0x0a,0x66,0x6c,0x6f,0x61,0x74,0x33,0x78,0x33,
|
||||
0x20,0x72,0x6f,0x74,0x5f,0x79,0x28,0x74,0x68,0x72,0x65,0x61,0x64,0x20,0x63,0x6f,
|
||||
0x6e,0x73,0x74,0x20,0x66,0x6c,0x6f,0x61,0x74,0x26,0x20,0x61,0x29,0x0a,0x7b,0x0a,
|
||||
0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x5f,0x36,0x34,0x20,0x3d,0x20,
|
||||
0x63,0x6f,0x73,0x28,0x61,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,
|
||||
0x74,0x20,0x5f,0x36,0x37,0x20,0x3d,0x20,0x73,0x69,0x6e,0x28,0x61,0x29,0x3b,0x0a,
|
||||
0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
||||
0x33,0x78,0x33,0x28,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x5f,0x36,0x34,0x2c,0x20,
|
||||
0x30,0x2e,0x30,0x2c,0x20,0x5f,0x36,0x37,0x29,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
||||
0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,
|
||||
0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x2d,0x5f,0x36,0x37,0x2c,0x20,0x30,
|
||||
0x2e,0x30,0x2c,0x20,0x5f,0x36,0x34,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x73,0x74,
|
||||
0x61,0x74,0x69,0x63,0x20,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x20,0x5f,0x5f,0x61,0x74,
|
||||
0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x5f,0x5f,0x28,0x28,0x61,0x6c,0x77,0x61,0x79,
|
||||
0x73,0x5f,0x69,0x6e,0x6c,0x69,0x6e,0x65,0x29,0x29,0x0a,0x66,0x6c,0x6f,0x61,0x74,
|
||||
0x33,0x78,0x33,0x20,0x67,0x65,0x74,0x5f,0x6f,0x72,0x69,0x65,0x6e,0x74,0x61,0x74,
|
||||
0x69,0x6f,0x6e,0x5f,0x6d,0x61,0x74,0x72,0x69,0x78,0x28,0x74,0x68,0x72,0x65,0x61,
|
||||
0x64,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,0x69,0x6e,0x74,0x26,0x20,0x6f,0x72,0x69,
|
||||
0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x69,0x6e,0x74,0x20,0x5f,0x38,0x32,0x20,
|
||||
0x3d,0x20,0x6f,0x72,0x69,0x20,0x2f,0x20,0x34,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,
|
||||
0x6c,0x6f,0x61,0x74,0x33,0x78,0x33,0x20,0x62,0x61,0x73,0x65,0x3b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x38,0x32,0x20,0x3d,0x3d,0x20,0x30,0x29,0x0a,
|
||||
0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x62,0x61,
|
||||
0x73,0x65,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x78,0x33,0x28,0x66,0x6c,
|
||||
0x6f,0x61,0x74,0x33,0x28,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x30,
|
||||
0x2e,0x30,0x29,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x30,0x2c,
|
||||
0x20,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x2c,0x20,0x66,0x6c,0x6f,0x61,
|
||||
0x74,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,
|
||||
0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x65,0x6c,
|
||||
0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x69,0x66,0x20,0x28,0x5f,0x38,0x32,0x20,0x3d,0x3d,0x20,0x31,0x29,0x0a,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,
|
||||
0x20,0x3d,0x20,0x33,0x2e,0x31,0x34,0x31,0x35,0x39,0x32,0x37,0x34,0x31,0x30,0x31,
|
||||
0x32,0x35,0x37,0x33,0x32,0x34,0x32,0x31,0x38,0x37,0x35,0x3b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x62,0x61,0x73,0x65,0x20,0x3d,0x20,
|
||||
0x72,0x6f,0x74,0x5f,0x78,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x3b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,
|
||||
0x38,0x32,0x20,0x3d,0x3d,0x20,0x32,0x29,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,
|
||||
0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x2d,0x31,0x2e,0x35,0x37,0x30,0x37,0x39,0x36,
|
||||
0x33,0x37,0x30,0x35,0x30,0x36,0x32,0x38,0x36,0x36,0x32,0x31,0x30,0x39,0x33,0x37,
|
||||
0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x62,0x61,0x73,0x65,0x20,0x3d,0x20,0x72,0x6f,0x74,0x5f,0x7a,0x28,
|
||||
0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x38,0x32,0x20,0x3d,
|
||||
0x3d,0x20,0x33,0x29,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
||||
0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x31,0x2e,0x35,0x37,0x30,
|
||||
0x37,0x39,0x36,0x33,0x37,0x30,0x35,0x30,0x36,0x32,0x38,0x36,0x36,0x32,0x31,0x30,
|
||||
0x39,0x33,0x37,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x62,0x61,0x73,0x65,0x20,0x3d,
|
||||
0x20,0x72,0x6f,0x74,0x5f,0x7a,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x29,0x3b,
|
||||
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x66,
|
||||
0x20,0x28,0x5f,0x38,0x32,0x20,0x3d,0x3d,0x20,0x34,0x29,0x0a,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,
|
||||
0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x20,0x3d,0x20,0x31,0x2e,0x35,0x37,0x30,0x37,
|
||||
0x39,0x36,0x33,0x37,0x30,0x35,0x30,0x36,0x32,0x38,0x36,0x36,0x32,0x31,0x30,0x39,
|
||||
0x33,0x37,0x35,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x62,0x61,0x73,
|
||||
0x65,0x20,0x3d,0x20,0x72,0x6f,0x74,0x5f,0x78,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,
|
||||
0x33,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x65,0x6c,
|
||||
0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x20,0x3d,
|
||||
0x20,0x2d,0x31,0x2e,0x35,0x37,0x30,0x37,0x39,0x36,0x33,0x37,0x30,0x35,0x30,0x36,
|
||||
0x32,0x38,0x36,0x36,0x32,0x31,0x30,0x39,0x33,0x37,0x35,0x3b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x62,0x61,0x73,0x65,0x20,0x3d,0x20,0x72,0x6f,0x74,0x5f,
|
||||
0x78,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,
|
||||
0x7d,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x70,0x61,0x72,0x61,
|
||||
0x6d,0x5f,0x35,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x28,0x6f,0x72,0x69,0x20,
|
||||
0x25,0x20,0x34,0x29,0x20,0x2a,0x20,0x31,0x2e,0x35,0x37,0x30,0x37,0x39,0x36,0x33,
|
||||
0x37,0x30,0x35,0x30,0x36,0x32,0x38,0x36,0x36,0x32,0x31,0x30,0x39,0x33,0x37,0x35,
|
||||
0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x62,0x61,0x73,
|
||||
0x65,0x20,0x2a,0x20,0x72,0x6f,0x74,0x5f,0x79,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,
|
||||
0x35,0x29,0x3b,0x0a,0x7d,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,0x73,0x68,0x61,0x64,0x6f,0x77,0x5f,0x76,0x73,
|
||||
0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x26,0x20,0x5f,0x31,0x39,0x33,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,0x69,0x6e,0x74,0x20,0x70,
|
||||
0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x69,0x6e,0x74,0x28,0x72,0x6f,0x75,0x6e,0x64,
|
||||
0x28,0x69,0x6e,0x2e,0x69,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x2e,0x77,0x29,0x29,
|
||||
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,0x33,0x2e,0x6d,0x76,0x70,
|
||||
0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x28,0x28,0x67,0x65,0x74,0x5f,
|
||||
0x6f,0x72,0x69,0x65,0x6e,0x74,0x61,0x74,0x69,0x6f,0x6e,0x5f,0x6d,0x61,0x74,0x72,
|
||||
0x69,0x78,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x20,0x2a,0x20,0x28,0x69,0x6e,0x2e,
|
||||
0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x79,0x7a,0x20,0x2d,0x20,0x66,
|
||||
0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x35,0x29,0x29,0x29,0x20,0x2b,0x20,0x66,
|
||||
0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x35,0x29,0x29,0x20,0x2b,0x20,0x69,0x6e,
|
||||
0x2e,0x69,0x6e,0x73,0x74,0x61,0x6e,0x63,0x65,0x2e,0x78,0x79,0x7a,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,
|
||||
];
|
||||
/*
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 frag_color [[color(0)]];
|
||||
};
|
||||
|
||||
fragment main0_out main0()
|
||||
{
|
||||
main0_out out = {};
|
||||
out.frag_color = float4(0.0);
|
||||
return out;
|
||||
}
|
||||
|
||||
*/
|
||||
fs_trile_shadow_source_metal_macos := u8.[
|
||||
0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x20,0x3c,0x6d,0x65,0x74,0x61,0x6c,0x5f,
|
||||
0x73,0x74,0x64,0x6c,0x69,0x62,0x3e,0x0a,0x23,0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,
|
||||
0x20,0x3c,0x73,0x69,0x6d,0x64,0x2f,0x73,0x69,0x6d,0x64,0x2e,0x68,0x3e,0x0a,0x0a,
|
||||
0x75,0x73,0x69,0x6e,0x67,0x20,0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x20,
|
||||
0x6d,0x65,0x74,0x61,0x6c,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,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,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,0x66,0x6c,0x6f,
|
||||
0x61,0x74,0x34,0x28,0x30,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_shadow_shader_desc :: (backend: sg_backend) -> sg_shader_desc {
|
||||
desc: sg_shader_desc;
|
||||
desc.label = "trile_shadow_shader";
|
||||
if backend == {
|
||||
case .GLCORE;
|
||||
desc.vertex_func.source = xx *vs_trile_shadow_source_glsl430;
|
||||
desc.vertex_func.entry = "main";
|
||||
desc.fragment_func.source = xx *fs_trile_shadow_source_glsl430;
|
||||
desc.fragment_func.entry = "main";
|
||||
desc.attrs[0].base_type = .FLOAT;
|
||||
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.attrs[3].base_type = .FLOAT;
|
||||
desc.attrs[3].glsl_name = "instance";
|
||||
desc.uniform_blocks[0].stage = .VERTEX;
|
||||
desc.uniform_blocks[0].layout = .STD140;
|
||||
desc.uniform_blocks[0].size = 64;
|
||||
desc.uniform_blocks[0].glsl_uniforms[0].type = .FLOAT4;
|
||||
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4;
|
||||
desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "trile_shadow_vs_params";
|
||||
case .GLES3;
|
||||
desc.vertex_func.source = xx *vs_trile_shadow_source_glsl300es;
|
||||
desc.vertex_func.entry = "main";
|
||||
desc.fragment_func.source = xx *fs_trile_shadow_source_glsl300es;
|
||||
desc.fragment_func.entry = "main";
|
||||
desc.attrs[0].base_type = .FLOAT;
|
||||
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.attrs[3].base_type = .FLOAT;
|
||||
desc.attrs[3].glsl_name = "instance";
|
||||
desc.uniform_blocks[0].stage = .VERTEX;
|
||||
desc.uniform_blocks[0].layout = .STD140;
|
||||
desc.uniform_blocks[0].size = 64;
|
||||
desc.uniform_blocks[0].glsl_uniforms[0].type = .FLOAT4;
|
||||
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 4;
|
||||
desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "trile_shadow_vs_params";
|
||||
case .METAL_MACOS;
|
||||
desc.vertex_func.source = xx *vs_trile_shadow_source_metal_macos;
|
||||
desc.vertex_func.entry = "main0";
|
||||
desc.fragment_func.source = xx *fs_trile_shadow_source_metal_macos;
|
||||
desc.fragment_func.entry = "main0";
|
||||
desc.attrs[0].base_type = .FLOAT;
|
||||
desc.attrs[1].base_type = .FLOAT;
|
||||
desc.attrs[2].base_type = .FLOAT;
|
||||
desc.attrs[3].base_type = .FLOAT;
|
||||
desc.uniform_blocks[0].stage = .VERTEX;
|
||||
desc.uniform_blocks[0].layout = .STD140;
|
||||
desc.uniform_blocks[0].size = 64;
|
||||
desc.uniform_blocks[0].msl_buffer_n = 0;
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
46
src/shaders/shader_trile_shadow.glsl
Normal file
46
src/shaders/shader_trile_shadow.glsl
Normal file
@ -0,0 +1,46 @@
|
||||
@vs vs_trile_shadow
|
||||
|
||||
layout(location=0) in vec4 position;
|
||||
layout(location=1) in vec4 normal; // same slot as shader_trile; not used
|
||||
layout(location=2) in vec4 centre; // same slot as shader_trile; not used
|
||||
layout(location=3) in vec4 instance; // xyz=world_pos, w=orientation
|
||||
|
||||
layout(binding=0) uniform trile_shadow_vs_params {
|
||||
mat4 mvp;
|
||||
};
|
||||
|
||||
mat3 rot_x(float a) { float c=cos(a),s=sin(a); return mat3(1,0,0, 0,c,-s, 0,s,c); }
|
||||
mat3 rot_z(float a) { float c=cos(a),s=sin(a); return mat3(c,-s,0, s,c,0, 0,0,1); }
|
||||
mat3 rot_y(float a) { float c=cos(a),s=sin(a); return mat3(c,0,s, 0,1,0, -s,0,c); }
|
||||
|
||||
mat3 get_orientation_matrix(int ori) {
|
||||
int face = ori / 4;
|
||||
int twist = ori % 4;
|
||||
float PI = 3.1415927;
|
||||
mat3 base;
|
||||
if (face == 0) base = mat3(1.0);
|
||||
else if (face == 1) base = rot_x(PI);
|
||||
else if (face == 2) base = rot_z(-PI*0.5);
|
||||
else if (face == 3) base = rot_z( PI*0.5);
|
||||
else if (face == 4) base = rot_x( PI*0.5);
|
||||
else base = rot_x(-PI*0.5);
|
||||
return base * rot_y(float(twist) * PI * 0.5);
|
||||
}
|
||||
|
||||
void main() {
|
||||
int ori = int(round(instance.w));
|
||||
mat3 rot = get_orientation_matrix(ori);
|
||||
vec3 local = position.xyz - 0.5;
|
||||
vec3 rotated = rot * local + 0.5;
|
||||
gl_Position = mvp * vec4(rotated + instance.xyz, 1.0);
|
||||
}
|
||||
@end
|
||||
|
||||
@fs fs_trile_shadow
|
||||
out vec4 frag_color;
|
||||
void main() {
|
||||
frag_color = vec4(0.0);
|
||||
}
|
||||
@end
|
||||
|
||||
@program trile_shadow vs_trile_shadow fs_trile_shadow
|
||||
Loading…
x
Reference in New Issue
Block a user