This commit is contained in:
Tuomas Katajisto 2026-04-03 11:46:14 +03:00
parent 435b544540
commit 57414915b7
16 changed files with 5501 additions and 4988 deletions

View File

@ -16,8 +16,6 @@ Active_Fetch :: struct {
chunk_buf : []u8;
}
// Shared types and the global must be #scope_export so that rdm_loader.jai
// (a separate file, even when #load-ed) can access them.
#scope_export
CHANNEL_MAIN : u32 : 0;
@ -34,16 +32,20 @@ Fetch_Type :: enum {
Fetch_Request :: struct {
type : Fetch_Type;
path : string;
// Pack
pack_name : string;
should_block : bool;
should_block_engine : bool;
// World / RDM
world_name : string;
chunk_key : Chunk_Key;
// Atlas GPU image held between RDM_ATLAS and its paired RDM_LOOKUP fetch.
rdm_pending_atlas : sg_image;
// Heap copy of world.json carried between WORLD and WORLD_CHUNKS fetches.
// Copy of world.json carried between WORLD and WORLD_CHUNKS fetches.
world_json_data : []u8;
}

View File

@ -256,9 +256,13 @@ frame :: () {
ui_clear_mouse_occluders();
ui_pass();
add_frame_profiling_point("After UI draw");
#if !FLAG_RELEASE_BUILD { prepare_text(debug_font, tprint("frametime: % ms", latest_frametime * 1000)); }
draw_prepared_text(debug_font, 10, 10, .{0.0, 1.0, 0.0, 1.0});
#if !FLAG_RELEASE_BUILD { draw_editor(); }
#if !FLAG_RELEASE_BUILD {
prepare_text(debug_font, tprint("frametime: % ms", latest_frametime * 1000));
draw_prepared_text(debug_font, 10, 10, .{0.0, 1.0, 0.0, 1.0});
draw_editor();
}
add_particle_render_tasks();
add_frame_profiling_point("After editor draw");
render();

View File

@ -1,13 +1,13 @@
#import,dir "../../modules/sokol-jai/sokol/app"(DEBUG = FLAG_RELEASE_BUILD);
#import,dir "../../modules/sokol-jai/sokol/gfx"(DEBUG = FLAG_RELEASE_BUILD);
#import,dir "../../modules/sokol-jai/sokol/gl"(DEBUG = FLAG_RELEASE_BUILD);
#import,dir "../../modules/sokol-jai/sokol/glue"(DEBUG = FLAG_RELEASE_BUILD);
#import,dir "../../modules/sokol-jai/sokol/shape"(DEBUG = FLAG_RELEASE_BUILD);
#import,dir "../../modules/sokol-jai/sokol/app"(DEBUG = !FLAG_RELEASE_BUILD);
#import,dir "../../modules/sokol-jai/sokol/gfx"(DEBUG = !FLAG_RELEASE_BUILD);
#import,dir "../../modules/sokol-jai/sokol/gl"(DEBUG = !FLAG_RELEASE_BUILD);
#import,dir "../../modules/sokol-jai/sokol/glue"(DEBUG = !FLAG_RELEASE_BUILD);
#import,dir "../../modules/sokol-jai/sokol/shape"(DEBUG = !FLAG_RELEASE_BUILD);
#import,dir "../../modules/sokol-jai/sokol/fontstash";
#import,dir "../../modules/sokol-jai/sokol/log"(DEBUG = FLAG_RELEASE_BUILD);
#import,dir "../../modules/sokol-jai/sokol/time"(DEBUG = FLAG_RELEASE_BUILD);
#import,dir "../../modules/sokol-jai/sokol/fetch"(DEBUG = FLAG_RELEASE_BUILD);
#import,dir "../../modules/sokol-jai/sokol/audio"(DEBUG = FLAG_RELEASE_BUILD);
#import,dir "../../modules/sokol-jai/sokol/log"(DEBUG = !FLAG_RELEASE_BUILD);
#import,dir "../../modules/sokol-jai/sokol/time"(DEBUG = !FLAG_RELEASE_BUILD);
#import,dir "../../modules/sokol-jai/sokol/fetch"(DEBUG = !FLAG_RELEASE_BUILD);
#import,dir "../../modules/sokol-jai/sokol/audio"(DEBUG = !FLAG_RELEASE_BUILD);
#load "../main.jai";

View File

@ -33,10 +33,10 @@ animation_player_tick :: (player: *Animation_Player) {
}
}
animation_draw :: (player: *Animation_Player, position: Vector3, flipX: bool = false, flipY: bool = false) {
animation_draw :: (player: *Animation_Player, position: Vector3, flipX: bool = false, flipY: bool = false, faceDir : Vector3 = .{-100, -100, -100}) {
animation_player_tick(player);
if player.current_animation == null then return;
create_billboard_rendering_task(position, player.current_animation, player.current_frame, flipX, flipY);
create_billboard_rendering_task(position, player.current_animation, player.current_frame, flipX, flipY, faceDir);
}
animation_set :: (player: *Animation_Player, animation: string) {

View File

@ -74,6 +74,7 @@ Render_Command_Draw_Billboard :: struct {
frame : s32;
flipX : bool;
flipY : bool;
faceDir : Vector3 = .{-100, -100, -100};
}
Render_Command_Draw_Trixels :: struct {

View File

@ -49,9 +49,9 @@ backend_handle_command :: (cmd: *Render_Command) {
case .DRAW_BILLBOARD;
command := cast(*Render_Command_Draw_Billboard)cmd;
if !in_gbuffer_pass {
backend_draw_billboard(command.position, command.animation, command.frame, command.flipX);
backend_draw_billboard(command.position, command.animation, command.frame, command.flipX, command.faceDir);
} else {
backend_gbuffer_draw_billboard(command.position, command.animation, command.frame, command.flipX);
backend_gbuffer_draw_billboard(command.position, command.animation, command.frame, command.flipX, command.faceDir);
}
case .DRAW_PARTICLES;
particles_cmd := cast(*Render_Command_Draw_Particles)cmd;
@ -300,7 +300,7 @@ backend_draw_ground :: (wc: *World_Config) {
sg_draw(0, 6, 2);
}
backend_draw_billboard :: (position: Vector3, anim: *Animation, frame_idx: s32, flipX: bool) {
backend_draw_billboard :: (position: Vector3, anim: *Animation, frame_idx: s32, flipX: bool, faceDir: Vector3) {
if !anim then return;
mvp := create_viewproj(*camera);
vs_params : Billboard_Vs_Params;
@ -318,6 +318,7 @@ backend_draw_billboard :: (position: Vector3, anim: *Animation, frame_idx: s32,
}
vs_params.size = Vector2.{cast(float)(frame.w / 16), cast(float)(frame.h / 16)}.component;
vs_params.cam = camera.position.component;
vs_params.faceDir = faceDir.component;
if !in_shadowmap_pass {
vs_params.mvp = mvp.floats;
} else {
@ -330,7 +331,7 @@ backend_draw_billboard :: (position: Vector3, anim: *Animation, frame_idx: s32,
sg_draw(0, 6, 1);
}
backend_gbuffer_draw_billboard :: (position: Vector3, anim: *Animation, frame_idx: s32, flipX: bool) {
backend_gbuffer_draw_billboard :: (position: Vector3, anim: *Animation, frame_idx: s32, flipX: bool, faceDir: Vector3) {
if !anim then return;
mvp := create_viewproj(*camera);
view := create_lookat(*camera);
@ -350,6 +351,7 @@ backend_gbuffer_draw_billboard :: (position: Vector3, anim: *Animation, frame_id
}
vs_params.size = Vector2.{cast(float)(frame.w / 16), cast(float)(frame.h / 16)}.component;
vs_params.cam = camera.position.component;
vs_params.faceDir = faceDir.component;
if !in_shadowmap_pass {
vs_params.mvp = mvp.floats;
} else {

View File

@ -77,23 +77,25 @@ debug_grid :: (cx: float, y: float, cz: float, half_extent: int, col: Vector4) {
}
}
debug_box_2d :: (rect: Collision_Rect, y: float, col: Vector4) {
// Todo: This should probably allow for any axis to be the constant one.
// Currently this is this way to support the game being currently made.
debug_box_2d :: (rect: Collision_Rect, x: float, col: Vector4) {
if !debug_draw_enabled || !debug_draw_colliders then return;
hw := rect.width * 0.5;
hh := rect.height * 0.5;
cx := rect.position.x;
cz := rect.position.y;
p0 := Vector3.{cx - hw, y, cz - hh};
p1 := Vector3.{cx + hw, y, cz - hh};
p2 := Vector3.{cx + hw, y, cz + hh};
p3 := Vector3.{cx - hw, y, cz + hh};
p0 := Vector3.{ x, cz - hh, cx - hw };
p1 := Vector3.{ x, cz - hh, cx + hw };
p2 := Vector3.{ x, cz + hh, cx + hw };
p3 := Vector3.{ x, cz + hh, cx - hw };
debug_line(p0, p1, col);
debug_line(p1, p2, col);
debug_line(p2, p3, col);
debug_line(p3, p0, col);
}
debug_circle_2d :: (circle: Collision_Circle, y: float, col: Vector4, segments: int = 16) {
debug_circle_2d :: (circle: Collision_Circle, x: float, col: Vector4, segments: int = 16) {
if !debug_draw_enabled || !debug_draw_colliders then return;
TAU :: cast(float)(2.0 * 3.14159265358979);
cx := circle.position.x;
@ -102,8 +104,8 @@ debug_circle_2d :: (circle: Collision_Circle, y: float, col: Vector4, segments:
for i: 0..segments-1 {
t0 := (cast(float)i / cast(float)segments) * TAU;
t1 := (cast(float)(i + 1) / cast(float)segments) * TAU;
a := Vector3.{cx + cos(t0) * r, y, cz + sin(t0) * r};
b := Vector3.{cx + cos(t1) * r, y, cz + sin(t1) * r};
a := Vector3.{x, cz + sin(t0) * r, cx + cos(t0) * r};
b := Vector3.{x, cz + sin(t1) * r, cx + cos(t1) * r};
debug_line(a, b, col);
}
}

View File

@ -141,8 +141,8 @@ create_ground_rendering_task :: (world: *World) {
add_rendering_task(groundtask);
}
create_billboard_rendering_task :: (position: Vector3, animation: *Animation, frame: s32, flipX: bool, flipY: bool) {
billboardtask := Rendering_Task_Billboard.{type = .BILLBOARD, position = position, animation = animation, frame = frame, flipX = flipX, flipY = flipY };
create_billboard_rendering_task :: (position: Vector3, animation: *Animation, frame: s32, flipX: bool, flipY: bool, faceDir : Vector3 = .{-100, -100, -100}) {
billboardtask := Rendering_Task_Billboard.{type = .BILLBOARD, position = position, animation = animation, frame = frame, flipX = flipX, flipY = flipY, faceDir = faceDir };
add_rendering_task(billboardtask);
}

View File

@ -47,6 +47,7 @@ Rendering_Task_Billboard :: struct {
frame : s32;
flipX : bool;
flipY : bool;
faceDir : Vector3 = .{-100, -100, -100};
}
Rendering_Task_Trile :: struct {
@ -166,6 +167,7 @@ tasks_to_commands :: () {
commandDrawBillboard.frame = billboardTask.frame;
commandDrawBillboard.flipX = billboardTask.flipX;
commandDrawBillboard.flipY = billboardTask.flipY;
commandDrawBillboard.faceDir = billboardTask.faceDir;
commandDrawBillboard.animation = billboardTask.animation;
array_add(*render_command_buckets.gbuffer, commandDrawBillboard);
array_add(*render_command_buckets.main, commandDrawBillboard);

View File

@ -40,11 +40,13 @@ Billboard_Vs_Params :: struct {
_: [8]u8;
cam: [3]float;
_: [4]u8;
faceDir: [3]float;
_: [4]u8;
};
/*
#version 430
uniform vec4 billboard_vs_params[8];
uniform vec4 billboard_vs_params[9];
layout(location = 0) in vec3 position;
layout(location = 0) out vec2 uv_in;
@ -52,7 +54,12 @@ Billboard_Vs_Params :: struct {
{
vec3 _53 = billboard_vs_params[5].xyz - billboard_vs_params[7].xyz;
_53.y = 0.0;
gl_Position = mat4(billboard_vs_params[0], billboard_vs_params[1], billboard_vs_params[2], billboard_vs_params[3]) * vec4((billboard_vs_params[5].xyz + (normalize(cross(vec3(0.0, 1.0, 0.0), normalize(_53))) * ((position.x - 0.5) * billboard_vs_params[6].x))) + (vec3(0.0, 1.0, 0.0) * (position.y * billboard_vs_params[6].y)), 1.0);
vec3 look_dir = normalize(_53);
if (billboard_vs_params[8].x > (-10.0))
{
look_dir = billboard_vs_params[8].xyz;
}
gl_Position = mat4(billboard_vs_params[0], billboard_vs_params[1], billboard_vs_params[2], billboard_vs_params[3]) * vec4((billboard_vs_params[5].xyz + (normalize(cross(vec3(0.0, 1.0, 0.0), look_dir)) * ((position.x - 0.5) * billboard_vs_params[6].x))) + (vec3(0.0, 1.0, 0.0) * (position.y * billboard_vs_params[6].y)), 1.0);
uv_in = vec2(billboard_vs_params[4].x + (position.x * billboard_vs_params[4].z), billboard_vs_params[4].y + (position.y * billboard_vs_params[4].w));
}
@ -60,7 +67,7 @@ Billboard_Vs_Params :: struct {
vs_billboard_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,0x62,0x69,0x6c,0x6c,0x62,
0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x38,
0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x39,
0x5d,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,
0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,
@ -72,38 +79,46 @@ vs_billboard_source_glsl430 := u8.[
0x5b,0x35,0x5d,0x2e,0x78,0x79,0x7a,0x20,0x2d,0x20,0x62,0x69,0x6c,0x6c,0x62,0x6f,
0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x37,0x5d,
0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x35,0x33,0x2e,0x79,0x20,
0x3d,0x20,0x30,0x2e,0x30,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,0x62,0x69,
0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
0x73,0x5b,0x30,0x5d,0x2c,0x20,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,
0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x62,0x69,
0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
0x73,0x5b,0x32,0x5d,0x2c,0x20,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,
0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,
0x76,0x65,0x63,0x34,0x28,0x28,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,
0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x35,0x5d,0x2e,0x78,0x79,0x7a,
0x20,0x2b,0x20,0x28,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x63,0x72,
0x6f,0x73,0x73,0x28,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,
0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x2c,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,
0x7a,0x65,0x28,0x5f,0x35,0x33,0x29,0x29,0x29,0x20,0x2a,0x20,0x28,0x28,0x70,0x6f,
0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x20,0x2d,0x20,0x30,0x2e,0x35,0x29,0x20,
0x2a,0x20,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,
0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x5d,0x2e,0x78,0x29,0x29,0x29,0x20,0x2b,0x20,
0x28,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,
0x30,0x2e,0x30,0x29,0x20,0x2a,0x20,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
0x2e,0x79,0x20,0x2a,0x20,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,
0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x5d,0x2e,0x79,0x29,0x29,0x2c,
0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x5f,0x69,0x6e,
0x20,0x3d,0x20,0x76,0x65,0x63,0x32,0x28,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,
0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2e,0x78,
0x20,0x2b,0x20,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x20,0x2a,
0x3d,0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,
0x6c,0x6f,0x6f,0x6b,0x5f,0x64,0x69,0x72,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,
0x6c,0x69,0x7a,0x65,0x28,0x5f,0x35,0x33,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,
0x66,0x20,0x28,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,
0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x38,0x5d,0x2e,0x78,0x20,0x3e,0x20,0x28,0x2d,
0x31,0x30,0x2e,0x30,0x29,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x20,0x6c,0x6f,0x6f,0x6b,0x5f,0x64,0x69,0x72,0x20,0x3d,0x20,
0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,
0x61,0x6d,0x73,0x5b,0x38,0x5d,0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x7d,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,
0x6e,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,
0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,
0x20,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,
0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2e,0x7a,0x29,0x2c,0x20,0x62,0x69,0x6c,0x6c,
0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,
0x34,0x5d,0x2e,0x79,0x20,0x2b,0x20,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
0x2e,0x79,0x20,0x2a,0x20,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,
0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2e,0x77,0x29,0x29,0x3b,
0x0a,0x7d,0x0a,0x0a,0x00,
0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,
0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,
0x20,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,
0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,
0x28,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,
0x72,0x61,0x6d,0x73,0x5b,0x35,0x5d,0x2e,0x78,0x79,0x7a,0x20,0x2b,0x20,0x28,0x6e,
0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x63,0x72,0x6f,0x73,0x73,0x28,0x76,
0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,
0x30,0x29,0x2c,0x20,0x6c,0x6f,0x6f,0x6b,0x5f,0x64,0x69,0x72,0x29,0x29,0x20,0x2a,
0x20,0x28,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x20,0x2d,0x20,
0x30,0x2e,0x35,0x29,0x20,0x2a,0x20,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,
0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x5d,0x2e,0x78,0x29,
0x29,0x29,0x20,0x2b,0x20,0x28,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,
0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x20,0x2a,0x20,0x28,0x70,0x6f,0x73,
0x69,0x74,0x69,0x6f,0x6e,0x2e,0x79,0x20,0x2a,0x20,0x62,0x69,0x6c,0x6c,0x62,0x6f,
0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x5d,
0x2e,0x79,0x29,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x75,0x76,0x5f,0x69,0x6e,0x20,0x3d,0x20,0x76,0x65,0x63,0x32,0x28,0x62,0x69,0x6c,
0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,
0x5b,0x34,0x5d,0x2e,0x78,0x20,0x2b,0x20,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,
0x6e,0x2e,0x78,0x20,0x2a,0x20,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,
0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2e,0x7a,0x29,0x2c,
0x20,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,
0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2e,0x79,0x20,0x2b,0x20,0x28,0x70,0x6f,0x73,
0x69,0x74,0x69,0x6f,0x6e,0x2e,0x79,0x20,0x2a,0x20,0x62,0x69,0x6c,0x6c,0x62,0x6f,
0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,
0x2e,0x77,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
];
/*
#version 430
@ -155,7 +170,7 @@ fs_billboard_source_glsl430 := u8.[
/*
#version 300 es
uniform vec4 billboard_vs_params[8];
uniform vec4 billboard_vs_params[9];
layout(location = 0) in vec3 position;
out vec2 uv_in;
@ -163,7 +178,12 @@ fs_billboard_source_glsl430 := u8.[
{
vec3 _53 = billboard_vs_params[5].xyz - billboard_vs_params[7].xyz;
_53.y = 0.0;
gl_Position = mat4(billboard_vs_params[0], billboard_vs_params[1], billboard_vs_params[2], billboard_vs_params[3]) * vec4((billboard_vs_params[5].xyz + (normalize(cross(vec3(0.0, 1.0, 0.0), normalize(_53))) * ((position.x - 0.5) * billboard_vs_params[6].x))) + (vec3(0.0, 1.0, 0.0) * (position.y * billboard_vs_params[6].y)), 1.0);
vec3 look_dir = normalize(_53);
if (billboard_vs_params[8].x > (-10.0))
{
look_dir = billboard_vs_params[8].xyz;
}
gl_Position = mat4(billboard_vs_params[0], billboard_vs_params[1], billboard_vs_params[2], billboard_vs_params[3]) * vec4((billboard_vs_params[5].xyz + (normalize(cross(vec3(0.0, 1.0, 0.0), look_dir)) * ((position.x - 0.5) * billboard_vs_params[6].x))) + (vec3(0.0, 1.0, 0.0) * (position.y * billboard_vs_params[6].y)), 1.0);
uv_in = vec2(billboard_vs_params[4].x + (position.x * billboard_vs_params[4].z), billboard_vs_params[4].y + (position.y * billboard_vs_params[4].w));
}
@ -172,7 +192,7 @@ vs_billboard_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,0x62,0x69,
0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
0x73,0x5b,0x38,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,
0x73,0x5b,0x39,0x5d,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,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x6f,0x75,0x74,
0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x5f,0x69,0x6e,0x3b,0x0a,0x0a,0x76,0x6f,
@ -182,38 +202,46 @@ vs_billboard_source_glsl300es := u8.[
0x5d,0x2e,0x78,0x79,0x7a,0x20,0x2d,0x20,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,
0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x37,0x5d,0x2e,0x78,
0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x35,0x33,0x2e,0x79,0x20,0x3d,0x20,
0x30,0x2e,0x30,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,0x62,0x69,0x6c,0x6c,
0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,
0x30,0x5d,0x2c,0x20,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,
0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x62,0x69,0x6c,0x6c,
0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,
0x32,0x5d,0x2c,0x20,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,
0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x76,0x65,
0x63,0x34,0x28,0x28,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,
0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x35,0x5d,0x2e,0x78,0x79,0x7a,0x20,0x2b,
0x20,0x28,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x63,0x72,0x6f,0x73,
0x73,0x28,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,
0x20,0x30,0x2e,0x30,0x29,0x2c,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,
0x28,0x5f,0x35,0x33,0x29,0x29,0x29,0x20,0x2a,0x20,0x28,0x28,0x70,0x6f,0x73,0x69,
0x74,0x69,0x6f,0x6e,0x2e,0x78,0x20,0x2d,0x20,0x30,0x2e,0x35,0x29,0x20,0x2a,0x20,
0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,
0x61,0x6d,0x73,0x5b,0x36,0x5d,0x2e,0x78,0x29,0x29,0x29,0x20,0x2b,0x20,0x28,0x76,
0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,
0x30,0x29,0x20,0x2a,0x20,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x79,
0x20,0x2a,0x20,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,
0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x5d,0x2e,0x79,0x29,0x29,0x2c,0x20,0x31,
0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x5f,0x69,0x6e,0x20,0x3d,
0x20,0x76,0x65,0x63,0x32,0x28,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,
0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2e,0x78,0x20,0x2b,
0x20,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x20,0x2a,0x20,0x62,
0x30,0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x6c,0x6f,
0x6f,0x6b,0x5f,0x64,0x69,0x72,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,
0x7a,0x65,0x28,0x5f,0x35,0x33,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,
0x28,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,
0x72,0x61,0x6d,0x73,0x5b,0x38,0x5d,0x2e,0x78,0x20,0x3e,0x20,0x28,0x2d,0x31,0x30,
0x2e,0x30,0x29,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x6c,0x6f,0x6f,0x6b,0x5f,0x64,0x69,0x72,0x20,0x3d,0x20,0x62,0x69,
0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
0x73,0x5b,0x38,0x5d,0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,
0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,
0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,
0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x62,
0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,
0x6d,0x73,0x5b,0x34,0x5d,0x2e,0x7a,0x29,0x2c,0x20,0x62,0x69,0x6c,0x6c,0x62,0x6f,
0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,
0x2e,0x79,0x20,0x2b,0x20,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x79,
0x20,0x2a,0x20,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,
0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2e,0x77,0x29,0x29,0x3b,0x0a,0x7d,
0x0a,0x0a,0x00,
0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,
0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x62,
0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,
0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x28,0x62,
0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,
0x6d,0x73,0x5b,0x35,0x5d,0x2e,0x78,0x79,0x7a,0x20,0x2b,0x20,0x28,0x6e,0x6f,0x72,
0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x63,0x72,0x6f,0x73,0x73,0x28,0x76,0x65,0x63,
0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,
0x2c,0x20,0x6c,0x6f,0x6f,0x6b,0x5f,0x64,0x69,0x72,0x29,0x29,0x20,0x2a,0x20,0x28,
0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x20,0x2d,0x20,0x30,0x2e,
0x35,0x29,0x20,0x2a,0x20,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,
0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x5d,0x2e,0x78,0x29,0x29,0x29,
0x20,0x2b,0x20,0x28,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,
0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x20,0x2a,0x20,0x28,0x70,0x6f,0x73,0x69,0x74,
0x69,0x6f,0x6e,0x2e,0x79,0x20,0x2a,0x20,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,
0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x5d,0x2e,0x79,
0x29,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,
0x5f,0x69,0x6e,0x20,0x3d,0x20,0x76,0x65,0x63,0x32,0x28,0x62,0x69,0x6c,0x6c,0x62,
0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,
0x5d,0x2e,0x78,0x20,0x2b,0x20,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,
0x78,0x20,0x2a,0x20,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,
0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2e,0x7a,0x29,0x2c,0x20,0x62,
0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,
0x6d,0x73,0x5b,0x34,0x5d,0x2e,0x79,0x20,0x2b,0x20,0x28,0x70,0x6f,0x73,0x69,0x74,
0x69,0x6f,0x6e,0x2e,0x79,0x20,0x2a,0x20,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,
0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2e,0x77,
0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
];
/*
#version 300 es
@ -279,6 +307,7 @@ fs_billboard_source_glsl300es := u8.[
float3 offset;
float2 size;
float3 cam;
float3 faceDir;
};
struct main0_out
@ -297,7 +326,12 @@ fs_billboard_source_glsl300es := u8.[
main0_out out = {};
float3 _53 = _24.offset - _24.cam;
_53.y = 0.0;
out.gl_Position = _24.mvp * float4((_24.offset + (fast::normalize(cross(float3(0.0, 1.0, 0.0), fast::normalize(_53))) * ((in.position.x - 0.5) * _24.size.x))) + (float3(0.0, 1.0, 0.0) * (in.position.y * _24.size.y)), 1.0);
float3 look_dir = fast::normalize(_53);
if (_24.faceDir.x > (-10.0))
{
look_dir = _24.faceDir;
}
out.gl_Position = _24.mvp * float4((_24.offset + (fast::normalize(cross(float3(0.0, 1.0, 0.0), look_dir)) * ((in.position.x - 0.5) * _24.size.x))) + (float3(0.0, 1.0, 0.0) * (in.position.y * _24.size.y)), 1.0);
out.uv_in = float2(_24.uvs.x + (in.position.x * _24.uvs.z), _24.uvs.y + (in.position.y * _24.uvs.w));
return out;
}
@ -315,50 +349,58 @@ vs_billboard_source_metal_macos := u8.[
0x34,0x20,0x75,0x76,0x73,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,
0x33,0x20,0x6f,0x66,0x66,0x73,0x65,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,
0x6f,0x61,0x74,0x32,0x20,0x73,0x69,0x7a,0x65,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,
0x6c,0x6f,0x61,0x74,0x33,0x20,0x63,0x61,0x6d,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,0x32,0x20,0x75,0x76,0x5f,
0x69,0x6e,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,0x33,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,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,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,
0x70,0x61,0x72,0x61,0x6d,0x73,0x26,0x20,0x5f,0x32,0x34,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,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,
0x5f,0x35,0x33,0x20,0x3d,0x20,0x5f,0x32,0x34,0x2e,0x6f,0x66,0x66,0x73,0x65,0x74,
0x20,0x2d,0x20,0x5f,0x32,0x34,0x2e,0x63,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x5f,0x35,0x33,0x2e,0x79,0x20,0x3d,0x20,0x30,0x2e,0x30,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,0x32,0x34,0x2e,0x6d,0x76,0x70,0x20,0x2a,0x20,0x66,0x6c,0x6f,
0x61,0x74,0x34,0x28,0x28,0x5f,0x32,0x34,0x2e,0x6f,0x66,0x66,0x73,0x65,0x74,0x20,
0x2b,0x20,0x28,0x66,0x61,0x73,0x74,0x3a,0x3a,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,
0x7a,0x65,0x28,0x63,0x72,0x6f,0x73,0x73,0x28,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,
0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x2c,0x20,
0x6c,0x6f,0x61,0x74,0x33,0x20,0x63,0x61,0x6d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,
0x6c,0x6f,0x61,0x74,0x33,0x20,0x66,0x61,0x63,0x65,0x44,0x69,0x72,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,0x32,
0x20,0x75,0x76,0x5f,0x69,0x6e,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,0x33,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,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,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,
0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x26,0x20,0x5f,0x32,0x34,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,0x66,0x6c,0x6f,
0x61,0x74,0x33,0x20,0x5f,0x35,0x33,0x20,0x3d,0x20,0x5f,0x32,0x34,0x2e,0x6f,0x66,
0x66,0x73,0x65,0x74,0x20,0x2d,0x20,0x5f,0x32,0x34,0x2e,0x63,0x61,0x6d,0x3b,0x0a,
0x20,0x20,0x20,0x20,0x5f,0x35,0x33,0x2e,0x79,0x20,0x3d,0x20,0x30,0x2e,0x30,0x3b,
0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x6c,0x6f,0x6f,0x6b,
0x5f,0x64,0x69,0x72,0x20,0x3d,0x20,0x66,0x61,0x73,0x74,0x3a,0x3a,0x6e,0x6f,0x72,
0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x5f,0x35,0x33,0x29,0x3b,0x0a,0x20,0x20,0x20,
0x20,0x69,0x66,0x20,0x28,0x5f,0x32,0x34,0x2e,0x66,0x61,0x63,0x65,0x44,0x69,0x72,
0x2e,0x78,0x20,0x3e,0x20,0x28,0x2d,0x31,0x30,0x2e,0x30,0x29,0x29,0x0a,0x20,0x20,
0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x6c,0x6f,0x6f,0x6b,
0x5f,0x64,0x69,0x72,0x20,0x3d,0x20,0x5f,0x32,0x34,0x2e,0x66,0x61,0x63,0x65,0x44,
0x69,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,
0x74,0x2e,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,
0x5f,0x32,0x34,0x2e,0x6d,0x76,0x70,0x20,0x2a,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,
0x28,0x28,0x5f,0x32,0x34,0x2e,0x6f,0x66,0x66,0x73,0x65,0x74,0x20,0x2b,0x20,0x28,
0x66,0x61,0x73,0x74,0x3a,0x3a,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,
0x5f,0x35,0x33,0x29,0x29,0x29,0x20,0x2a,0x20,0x28,0x28,0x69,0x6e,0x2e,0x70,0x6f,
0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x20,0x2d,0x20,0x30,0x2e,0x35,0x29,0x20,
0x2a,0x20,0x5f,0x32,0x34,0x2e,0x73,0x69,0x7a,0x65,0x2e,0x78,0x29,0x29,0x29,0x20,
0x2b,0x20,0x28,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x31,
0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x20,0x2a,0x20,0x28,0x69,0x6e,0x2e,0x70,
0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x79,0x20,0x2a,0x20,0x5f,0x32,0x34,0x2e,
0x73,0x69,0x7a,0x65,0x2e,0x79,0x29,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,
0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x75,0x76,0x5f,0x69,0x6e,0x20,0x3d,0x20,
0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x5f,0x32,0x34,0x2e,0x75,0x76,0x73,0x2e,0x78,
0x20,0x2b,0x20,0x28,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,
0x78,0x20,0x2a,0x20,0x5f,0x32,0x34,0x2e,0x75,0x76,0x73,0x2e,0x7a,0x29,0x2c,0x20,
0x5f,0x32,0x34,0x2e,0x75,0x76,0x73,0x2e,0x79,0x20,0x2b,0x20,0x28,0x69,0x6e,0x2e,
0x63,0x72,0x6f,0x73,0x73,0x28,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x30,
0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x2c,0x20,0x6c,0x6f,0x6f,
0x6b,0x5f,0x64,0x69,0x72,0x29,0x29,0x20,0x2a,0x20,0x28,0x28,0x69,0x6e,0x2e,0x70,
0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x20,0x2d,0x20,0x30,0x2e,0x35,0x29,
0x20,0x2a,0x20,0x5f,0x32,0x34,0x2e,0x73,0x69,0x7a,0x65,0x2e,0x78,0x29,0x29,0x29,
0x20,0x2b,0x20,0x28,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,
0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x20,0x2a,0x20,0x28,0x69,0x6e,0x2e,
0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x79,0x20,0x2a,0x20,0x5f,0x32,0x34,
0x2e,0x75,0x76,0x73,0x2e,0x77,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,
0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
0x2e,0x73,0x69,0x7a,0x65,0x2e,0x79,0x29,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,
0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x75,0x76,0x5f,0x69,0x6e,0x20,0x3d,
0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x5f,0x32,0x34,0x2e,0x75,0x76,0x73,0x2e,
0x78,0x20,0x2b,0x20,0x28,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
0x2e,0x78,0x20,0x2a,0x20,0x5f,0x32,0x34,0x2e,0x75,0x76,0x73,0x2e,0x7a,0x29,0x2c,
0x20,0x5f,0x32,0x34,0x2e,0x75,0x76,0x73,0x2e,0x79,0x20,0x2b,0x20,0x28,0x69,0x6e,
0x2e,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x79,0x20,0x2a,0x20,0x5f,0x32,
0x34,0x2e,0x75,0x76,0x73,0x2e,0x77,0x29,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>
@ -443,9 +485,9 @@ billboard_shader_desc :: (backend: sg_backend) -> sg_shader_desc {
desc.attrs[0].glsl_name = "position";
desc.uniform_blocks[0].stage = .VERTEX;
desc.uniform_blocks[0].layout = .STD140;
desc.uniform_blocks[0].size = 128;
desc.uniform_blocks[0].size = 144;
desc.uniform_blocks[0].glsl_uniforms[0].type = .FLOAT4;
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 8;
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 9;
desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "billboard_vs_params";
desc.images[0].stage = .FRAGMENT;
desc.images[0].multisampled = false;
@ -466,9 +508,9 @@ billboard_shader_desc :: (backend: sg_backend) -> sg_shader_desc {
desc.attrs[0].glsl_name = "position";
desc.uniform_blocks[0].stage = .VERTEX;
desc.uniform_blocks[0].layout = .STD140;
desc.uniform_blocks[0].size = 128;
desc.uniform_blocks[0].size = 144;
desc.uniform_blocks[0].glsl_uniforms[0].type = .FLOAT4;
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 8;
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 9;
desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "billboard_vs_params";
desc.images[0].stage = .FRAGMENT;
desc.images[0].multisampled = false;
@ -488,7 +530,7 @@ billboard_shader_desc :: (backend: sg_backend) -> sg_shader_desc {
desc.attrs[0].base_type = .FLOAT;
desc.uniform_blocks[0].stage = .VERTEX;
desc.uniform_blocks[0].layout = .STD140;
desc.uniform_blocks[0].size = 128;
desc.uniform_blocks[0].size = 144;
desc.uniform_blocks[0].msl_buffer_n = 0;
desc.images[0].stage = .FRAGMENT;
desc.images[0].multisampled = false;

View File

@ -41,11 +41,13 @@ Gbuffer_Billboard_Vs_Params :: struct {
cam: [3]float;
_: [4]u8;
view_matrix: [16]float;
faceDir: [3]float;
_: [4]u8;
};
/*
#version 430
uniform vec4 gbuffer_billboard_vs_params[12];
uniform vec4 gbuffer_billboard_vs_params[13];
layout(location = 0) in vec3 position;
layout(location = 1) out vec3 view_space_pos;
layout(location = 2) out vec3 view_space_normal;
@ -55,11 +57,16 @@ Gbuffer_Billboard_Vs_Params :: struct {
{
vec3 _53 = gbuffer_billboard_vs_params[5].xyz - gbuffer_billboard_vs_params[7].xyz;
_53.y = 0.0;
vec4 _88 = vec4((gbuffer_billboard_vs_params[5].xyz + (normalize(cross(vec3(0.0, 1.0, 0.0), normalize(_53))) * ((position.x - 0.5) * gbuffer_billboard_vs_params[6].x))) + (vec3(0.0, 1.0, 0.0) * (position.y * gbuffer_billboard_vs_params[6].y)), 1.0);
gl_Position = mat4(gbuffer_billboard_vs_params[0], gbuffer_billboard_vs_params[1], gbuffer_billboard_vs_params[2], gbuffer_billboard_vs_params[3]) * _88;
mat4 _96 = mat4(gbuffer_billboard_vs_params[8], gbuffer_billboard_vs_params[9], gbuffer_billboard_vs_params[10], gbuffer_billboard_vs_params[11]);
view_space_pos = (_96 * _88).xyz;
view_space_normal = mat3(_96[0].xyz, _96[1].xyz, _96[2].xyz) * vec3(0.0, 1.0, 0.0);
vec3 look_dir = normalize(_53);
if (gbuffer_billboard_vs_params[12].x < (-10.0))
{
look_dir = gbuffer_billboard_vs_params[12].xyz;
}
vec4 _98 = vec4((gbuffer_billboard_vs_params[5].xyz + (normalize(cross(vec3(0.0, 1.0, 0.0), look_dir)) * ((position.x - 0.5) * gbuffer_billboard_vs_params[6].x))) + (vec3(0.0, 1.0, 0.0) * (position.y * gbuffer_billboard_vs_params[6].y)), 1.0);
gl_Position = mat4(gbuffer_billboard_vs_params[0], gbuffer_billboard_vs_params[1], gbuffer_billboard_vs_params[2], gbuffer_billboard_vs_params[3]) * _98;
mat4 _106 = mat4(gbuffer_billboard_vs_params[8], gbuffer_billboard_vs_params[9], gbuffer_billboard_vs_params[10], gbuffer_billboard_vs_params[11]);
view_space_pos = (_106 * _98).xyz;
view_space_normal = mat3(_106[0].xyz, _106[1].xyz, _106[2].xyz) * vec3(0.0, 1.0, 0.0);
uv_in = vec2(gbuffer_billboard_vs_params[4].x + (position.x * gbuffer_billboard_vs_params[4].z), gbuffer_billboard_vs_params[4].y + (position.y * gbuffer_billboard_vs_params[4].w));
}
@ -68,7 +75,7 @@ vs_gbuffer_billboard_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,0x67,0x62,0x75,0x66,0x66,
0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,
0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x32,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,
0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x33,0x5d,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,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,
0x6e,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,
@ -87,61 +94,71 @@ vs_gbuffer_billboard_source_glsl430 := u8.[
0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,
0x61,0x72,0x61,0x6d,0x73,0x5b,0x37,0x5d,0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,
0x20,0x20,0x5f,0x35,0x33,0x2e,0x79,0x20,0x3d,0x20,0x30,0x2e,0x30,0x3b,0x0a,0x20,
0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x38,0x38,0x20,0x3d,0x20,0x76,0x65,
0x63,0x34,0x28,0x28,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,
0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,
0x35,0x5d,0x2e,0x78,0x79,0x7a,0x20,0x2b,0x20,0x28,0x6e,0x6f,0x72,0x6d,0x61,0x6c,
0x69,0x7a,0x65,0x28,0x63,0x72,0x6f,0x73,0x73,0x28,0x76,0x65,0x63,0x33,0x28,0x30,
0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x2c,0x20,0x6e,
0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x5f,0x35,0x33,0x29,0x29,0x29,0x20,
0x2a,0x20,0x28,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x20,0x2d,
0x20,0x30,0x2e,0x35,0x29,0x20,0x2a,0x20,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,
0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,
0x61,0x6d,0x73,0x5b,0x36,0x5d,0x2e,0x78,0x29,0x29,0x29,0x20,0x2b,0x20,0x28,0x76,
0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,
0x30,0x29,0x20,0x2a,0x20,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x79,
0x20,0x2a,0x20,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,
0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,
0x5d,0x2e,0x79,0x29,0x29,0x2c,0x20,0x31,0x2e,0x30,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,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,
0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,
0x30,0x5d,0x2c,0x20,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,
0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,
0x31,0x5d,0x2c,0x20,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,
0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,
0x32,0x5d,0x2c,0x20,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,
0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,
0x33,0x5d,0x29,0x20,0x2a,0x20,0x5f,0x38,0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6d,
0x61,0x74,0x34,0x20,0x5f,0x39,0x36,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x67,
0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,
0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x38,0x5d,0x2c,0x20,0x67,
0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,
0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x39,0x5d,0x2c,0x20,0x67,
0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,
0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x30,0x5d,0x2c,0x20,
0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,
0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x31,0x5d,0x29,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x69,0x65,0x77,0x5f,0x73,0x70,0x61,0x63,0x65,
0x5f,0x70,0x6f,0x73,0x20,0x3d,0x20,0x28,0x5f,0x39,0x36,0x20,0x2a,0x20,0x5f,0x38,
0x38,0x29,0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x69,0x65,0x77,
0x5f,0x73,0x70,0x61,0x63,0x65,0x5f,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x3d,0x20,
0x6d,0x61,0x74,0x33,0x28,0x5f,0x39,0x36,0x5b,0x30,0x5d,0x2e,0x78,0x79,0x7a,0x2c,
0x20,0x5f,0x39,0x36,0x5b,0x31,0x5d,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x5f,0x39,0x36,
0x5b,0x32,0x5d,0x2e,0x78,0x79,0x7a,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x33,0x28,
0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x3b,0x0a,
0x20,0x20,0x20,0x20,0x75,0x76,0x5f,0x69,0x6e,0x20,0x3d,0x20,0x76,0x65,0x63,0x32,
0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x6c,0x6f,0x6f,0x6b,0x5f,0x64,0x69,0x72,
0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x5f,0x35,0x33,
0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x67,0x62,0x75,0x66,0x66,
0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,
0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x32,0x5d,0x2e,0x78,0x20,0x3c,0x20,0x28,
0x2d,0x31,0x30,0x2e,0x30,0x29,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,
0x20,0x20,0x20,0x20,0x20,0x20,0x6c,0x6f,0x6f,0x6b,0x5f,0x64,0x69,0x72,0x20,0x3d,
0x20,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,
0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x32,0x5d,
0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,
0x76,0x65,0x63,0x34,0x20,0x5f,0x39,0x38,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,
0x28,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,
0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x35,0x5d,0x2e,
0x78,0x79,0x7a,0x20,0x2b,0x20,0x28,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,
0x28,0x63,0x72,0x6f,0x73,0x73,0x28,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x2c,
0x20,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x2c,0x20,0x6c,0x6f,0x6f,0x6b,
0x5f,0x64,0x69,0x72,0x29,0x29,0x20,0x2a,0x20,0x28,0x28,0x70,0x6f,0x73,0x69,0x74,
0x69,0x6f,0x6e,0x2e,0x78,0x20,0x2d,0x20,0x30,0x2e,0x35,0x29,0x20,0x2a,0x20,0x67,
0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,
0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x5d,0x2e,0x78,0x29,
0x29,0x29,0x20,0x2b,0x20,0x28,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,
0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x20,0x2a,0x20,0x28,0x70,0x6f,0x73,
0x69,0x74,0x69,0x6f,0x6e,0x2e,0x79,0x20,0x2a,0x20,0x67,0x62,0x75,0x66,0x66,0x65,
0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,
0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x5d,0x2e,0x79,0x29,0x29,0x2c,0x20,0x31,0x2e,
0x30,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,0x67,0x62,0x75,0x66,0x66,
0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,
0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x67,0x62,0x75,0x66,0x66,
0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,
0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x67,0x62,0x75,0x66,0x66,
0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,
0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x67,0x62,0x75,0x66,0x66,
0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,
0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x5f,0x39,0x38,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x74,0x34,0x20,0x5f,0x31,0x30,0x36,0x20,
0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,
0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,
0x6d,0x73,0x5b,0x38,0x5d,0x2c,0x20,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,
0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,
0x6d,0x73,0x5b,0x39,0x5d,0x2c,0x20,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,
0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,
0x6d,0x73,0x5b,0x31,0x30,0x5d,0x2c,0x20,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,
0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,
0x61,0x6d,0x73,0x5b,0x31,0x31,0x5d,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x69,
0x65,0x77,0x5f,0x73,0x70,0x61,0x63,0x65,0x5f,0x70,0x6f,0x73,0x20,0x3d,0x20,0x28,
0x5f,0x31,0x30,0x36,0x20,0x2a,0x20,0x5f,0x39,0x38,0x29,0x2e,0x78,0x79,0x7a,0x3b,
0x0a,0x20,0x20,0x20,0x20,0x76,0x69,0x65,0x77,0x5f,0x73,0x70,0x61,0x63,0x65,0x5f,
0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x3d,0x20,0x6d,0x61,0x74,0x33,0x28,0x5f,0x31,
0x30,0x36,0x5b,0x30,0x5d,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x5f,0x31,0x30,0x36,0x5b,
0x31,0x5d,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x5f,0x31,0x30,0x36,0x5b,0x32,0x5d,0x2e,
0x78,0x79,0x7a,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x2c,
0x20,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x75,0x76,0x5f,0x69,0x6e,0x20,0x3d,0x20,0x76,0x65,0x63,0x32,0x28,0x67,0x62,0x75,
0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,
0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2e,0x78,0x20,0x2b,0x20,
0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x20,0x2a,0x20,0x67,0x62,
0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,
0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2e,0x7a,0x29,0x2c,
0x20,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,
0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2e,
0x78,0x20,0x2b,0x20,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x20,
0x79,0x20,0x2b,0x20,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x79,0x20,
0x2a,0x20,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,
0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,
0x2e,0x7a,0x29,0x2c,0x20,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,
0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,
0x5b,0x34,0x5d,0x2e,0x79,0x20,0x2b,0x20,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,
0x6e,0x2e,0x79,0x20,0x2a,0x20,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,
0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
0x73,0x5b,0x34,0x5d,0x2e,0x77,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
0x2e,0x77,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
];
/*
#version 430
@ -208,7 +225,7 @@ fs_gbuffer_billboard_source_glsl430 := u8.[
/*
#version 300 es
uniform vec4 gbuffer_billboard_vs_params[12];
uniform vec4 gbuffer_billboard_vs_params[13];
layout(location = 0) in vec3 position;
out vec3 view_space_pos;
out vec3 view_space_normal;
@ -218,11 +235,16 @@ fs_gbuffer_billboard_source_glsl430 := u8.[
{
vec3 _53 = gbuffer_billboard_vs_params[5].xyz - gbuffer_billboard_vs_params[7].xyz;
_53.y = 0.0;
vec4 _88 = vec4((gbuffer_billboard_vs_params[5].xyz + (normalize(cross(vec3(0.0, 1.0, 0.0), normalize(_53))) * ((position.x - 0.5) * gbuffer_billboard_vs_params[6].x))) + (vec3(0.0, 1.0, 0.0) * (position.y * gbuffer_billboard_vs_params[6].y)), 1.0);
gl_Position = mat4(gbuffer_billboard_vs_params[0], gbuffer_billboard_vs_params[1], gbuffer_billboard_vs_params[2], gbuffer_billboard_vs_params[3]) * _88;
mat4 _96 = mat4(gbuffer_billboard_vs_params[8], gbuffer_billboard_vs_params[9], gbuffer_billboard_vs_params[10], gbuffer_billboard_vs_params[11]);
view_space_pos = (_96 * _88).xyz;
view_space_normal = mat3(_96[0].xyz, _96[1].xyz, _96[2].xyz) * vec3(0.0, 1.0, 0.0);
vec3 look_dir = normalize(_53);
if (gbuffer_billboard_vs_params[12].x < (-10.0))
{
look_dir = gbuffer_billboard_vs_params[12].xyz;
}
vec4 _98 = vec4((gbuffer_billboard_vs_params[5].xyz + (normalize(cross(vec3(0.0, 1.0, 0.0), look_dir)) * ((position.x - 0.5) * gbuffer_billboard_vs_params[6].x))) + (vec3(0.0, 1.0, 0.0) * (position.y * gbuffer_billboard_vs_params[6].y)), 1.0);
gl_Position = mat4(gbuffer_billboard_vs_params[0], gbuffer_billboard_vs_params[1], gbuffer_billboard_vs_params[2], gbuffer_billboard_vs_params[3]) * _98;
mat4 _106 = mat4(gbuffer_billboard_vs_params[8], gbuffer_billboard_vs_params[9], gbuffer_billboard_vs_params[10], gbuffer_billboard_vs_params[11]);
view_space_pos = (_106 * _98).xyz;
view_space_normal = mat3(_106[0].xyz, _106[1].xyz, _106[2].xyz) * vec3(0.0, 1.0, 0.0);
uv_in = vec2(gbuffer_billboard_vs_params[4].x + (position.x * gbuffer_billboard_vs_params[4].z), gbuffer_billboard_vs_params[4].y + (position.y * gbuffer_billboard_vs_params[4].w));
}
@ -231,7 +253,7 @@ vs_gbuffer_billboard_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,0x67,0x62,
0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,
0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x32,0x5d,0x3b,0x0a,0x6c,
0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x33,0x5d,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,0x70,0x6f,0x73,0x69,
0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x33,0x20,0x76,
@ -246,62 +268,71 @@ vs_gbuffer_billboard_source_glsl300es := u8.[
0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,
0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x37,0x5d,0x2e,0x78,0x79,0x7a,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x35,0x33,0x2e,0x79,0x20,0x3d,0x20,0x30,0x2e,
0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x38,0x38,0x20,
0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x28,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,
0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,
0x61,0x6d,0x73,0x5b,0x35,0x5d,0x2e,0x78,0x79,0x7a,0x20,0x2b,0x20,0x28,0x6e,0x6f,
0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x63,0x72,0x6f,0x73,0x73,0x28,0x76,0x65,
0x63,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,
0x29,0x2c,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x5f,0x35,0x33,
0x29,0x29,0x29,0x20,0x2a,0x20,0x28,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
0x2e,0x78,0x20,0x2d,0x20,0x30,0x2e,0x35,0x29,0x20,0x2a,0x20,0x67,0x62,0x75,0x66,
0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,
0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x5d,0x2e,0x78,0x29,0x29,0x29,0x20,
0x2b,0x20,0x28,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,
0x2c,0x20,0x30,0x2e,0x30,0x29,0x20,0x2a,0x20,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,
0x6f,0x6e,0x2e,0x79,0x20,0x2a,0x20,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,
0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,
0x6d,0x73,0x5b,0x36,0x5d,0x2e,0x79,0x29,0x29,0x2c,0x20,0x31,0x2e,0x30,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,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,
0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,
0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,
0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,
0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,
0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,
0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,
0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,
0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,0x20,0x5f,0x38,0x38,0x3b,0x0a,0x20,
0x20,0x20,0x20,0x6d,0x61,0x74,0x34,0x20,0x5f,0x39,0x36,0x20,0x3d,0x20,0x6d,0x61,
0x74,0x34,0x28,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,
0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x38,
0x5d,0x2c,0x20,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,
0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x39,
0x5d,0x2c,0x20,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,
0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,
0x30,0x5d,0x2c,0x20,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,
0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,
0x31,0x31,0x5d,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x69,0x65,0x77,0x5f,0x73,
0x70,0x61,0x63,0x65,0x5f,0x70,0x6f,0x73,0x20,0x3d,0x20,0x28,0x5f,0x39,0x36,0x20,
0x2a,0x20,0x5f,0x38,0x38,0x29,0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x76,0x69,0x65,0x77,0x5f,0x73,0x70,0x61,0x63,0x65,0x5f,0x6e,0x6f,0x72,0x6d,0x61,
0x6c,0x20,0x3d,0x20,0x6d,0x61,0x74,0x33,0x28,0x5f,0x39,0x36,0x5b,0x30,0x5d,0x2e,
0x78,0x79,0x7a,0x2c,0x20,0x5f,0x39,0x36,0x5b,0x31,0x5d,0x2e,0x78,0x79,0x7a,0x2c,
0x20,0x5f,0x39,0x36,0x5b,0x32,0x5d,0x2e,0x78,0x79,0x7a,0x29,0x20,0x2a,0x20,0x76,
0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,
0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x5f,0x69,0x6e,0x20,0x3d,0x20,
0x76,0x65,0x63,0x32,0x28,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,
0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x6c,0x6f,0x6f,0x6b,
0x5f,0x64,0x69,0x72,0x20,0x3d,0x20,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,
0x28,0x5f,0x35,0x33,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x67,
0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,
0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x32,0x5d,0x2e,0x78,
0x20,0x3c,0x20,0x28,0x2d,0x31,0x30,0x2e,0x30,0x29,0x29,0x0a,0x20,0x20,0x20,0x20,
0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x6c,0x6f,0x6f,0x6b,0x5f,0x64,
0x69,0x72,0x20,0x3d,0x20,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,
0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,
0x5b,0x34,0x5d,0x2e,0x78,0x20,0x2b,0x20,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,
0x6e,0x2e,0x78,0x20,0x2a,0x20,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,
0x5b,0x31,0x32,0x5d,0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,
0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x5f,0x39,0x38,0x20,0x3d,0x20,0x76,
0x65,0x63,0x34,0x28,0x28,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,
0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,
0x5b,0x35,0x5d,0x2e,0x78,0x79,0x7a,0x20,0x2b,0x20,0x28,0x6e,0x6f,0x72,0x6d,0x61,
0x6c,0x69,0x7a,0x65,0x28,0x63,0x72,0x6f,0x73,0x73,0x28,0x76,0x65,0x63,0x33,0x28,
0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x2c,0x20,
0x6c,0x6f,0x6f,0x6b,0x5f,0x64,0x69,0x72,0x29,0x29,0x20,0x2a,0x20,0x28,0x28,0x70,
0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x20,0x2d,0x20,0x30,0x2e,0x35,0x29,
0x20,0x2a,0x20,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,
0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,
0x5d,0x2e,0x78,0x29,0x29,0x29,0x20,0x2b,0x20,0x28,0x76,0x65,0x63,0x33,0x28,0x30,
0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x20,0x2a,0x20,
0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x79,0x20,0x2a,0x20,0x67,0x62,
0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,
0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x36,0x5d,0x2e,0x79,0x29,0x29,
0x2c,0x20,0x31,0x2e,0x30,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,0x67,
0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,
0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2c,0x20,0x67,
0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,
0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x67,
0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,
0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x67,
0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,
0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29,0x20,0x2a,
0x20,0x5f,0x39,0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x74,0x34,0x20,0x5f,
0x31,0x30,0x36,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x67,0x62,0x75,0x66,0x66,
0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,
0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x38,0x5d,0x2c,0x20,0x67,0x62,0x75,0x66,0x66,
0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,
0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x39,0x5d,0x2c,0x20,0x67,0x62,0x75,0x66,0x66,
0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,
0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x30,0x5d,0x2c,0x20,0x67,0x62,0x75,0x66,
0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,
0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x31,0x5d,0x29,0x3b,0x0a,0x20,0x20,
0x20,0x20,0x76,0x69,0x65,0x77,0x5f,0x73,0x70,0x61,0x63,0x65,0x5f,0x70,0x6f,0x73,
0x20,0x3d,0x20,0x28,0x5f,0x31,0x30,0x36,0x20,0x2a,0x20,0x5f,0x39,0x38,0x29,0x2e,
0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x69,0x65,0x77,0x5f,0x73,0x70,
0x61,0x63,0x65,0x5f,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x3d,0x20,0x6d,0x61,0x74,
0x33,0x28,0x5f,0x31,0x30,0x36,0x5b,0x30,0x5d,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x5f,
0x31,0x30,0x36,0x5b,0x31,0x5d,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x5f,0x31,0x30,0x36,
0x5b,0x32,0x5d,0x2e,0x78,0x79,0x7a,0x29,0x20,0x2a,0x20,0x76,0x65,0x63,0x33,0x28,
0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x3b,0x0a,
0x20,0x20,0x20,0x20,0x75,0x76,0x5f,0x69,0x6e,0x20,0x3d,0x20,0x76,0x65,0x63,0x32,
0x28,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,
0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2e,
0x78,0x20,0x2b,0x20,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x20,
0x2a,0x20,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,
0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,
0x2e,0x7a,0x29,0x2c,0x20,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,
0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,
0x5b,0x34,0x5d,0x2e,0x79,0x20,0x2b,0x20,0x28,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,
0x6e,0x2e,0x79,0x20,0x2a,0x20,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,
0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,
0x73,0x5b,0x34,0x5d,0x2e,0x7a,0x29,0x2c,0x20,0x67,0x62,0x75,0x66,0x66,0x65,0x72,
0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,
0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2e,0x79,0x20,0x2b,0x20,0x28,0x70,0x6f,0x73,
0x69,0x74,0x69,0x6f,0x6e,0x2e,0x79,0x20,0x2a,0x20,0x67,0x62,0x75,0x66,0x66,0x65,
0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,
0x61,0x72,0x61,0x6d,0x73,0x5b,0x34,0x5d,0x2e,0x77,0x29,0x29,0x3b,0x0a,0x7d,0x0a,
0x0a,0x00,
0x73,0x5b,0x34,0x5d,0x2e,0x77,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
];
/*
#version 300 es
@ -381,6 +412,7 @@ fs_gbuffer_billboard_source_glsl300es := u8.[
float2 size;
float3 cam;
float4x4 view_matrix;
float3 faceDir;
};
struct main0_out
@ -401,9 +433,14 @@ fs_gbuffer_billboard_source_glsl300es := u8.[
main0_out out = {};
float3 _53 = _24.offset - _24.cam;
_53.y = 0.0;
float4 _88 = float4((_24.offset + (fast::normalize(cross(float3(0.0, 1.0, 0.0), fast::normalize(_53))) * ((in.position.x - 0.5) * _24.size.x))) + (float3(0.0, 1.0, 0.0) * (in.position.y * _24.size.y)), 1.0);
out.gl_Position = _24.mvp * _88;
out.view_space_pos = (_24.view_matrix * _88).xyz;
float3 look_dir = fast::normalize(_53);
if (_24.faceDir.x < (-10.0))
{
look_dir = _24.faceDir;
}
float4 _98 = float4((_24.offset + (fast::normalize(cross(float3(0.0, 1.0, 0.0), look_dir)) * ((in.position.x - 0.5) * _24.size.x))) + (float3(0.0, 1.0, 0.0) * (in.position.y * _24.size.y)), 1.0);
out.gl_Position = _24.mvp * _98;
out.view_space_pos = (_24.view_matrix * _98).xyz;
out.view_space_normal = float3x3(_24.view_matrix[0].xyz, _24.view_matrix[1].xyz, _24.view_matrix[2].xyz) * float3(0.0, 1.0, 0.0);
out.uv_in = float2(_24.uvs.x + (in.position.x * _24.uvs.z), _24.uvs.y + (in.position.y * _24.uvs.w));
return out;
@ -424,70 +461,78 @@ vs_gbuffer_billboard_source_metal_macos := u8.[
0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x73,0x69,0x7a,
0x65,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x63,0x61,
0x6d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x78,0x34,0x20,
0x76,0x69,0x65,0x77,0x5f,0x6d,0x61,0x74,0x72,0x69,0x78,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,0x32,0x20,0x75,
0x76,0x5f,0x69,0x6e,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,0x69,0x65,0x77,0x5f,0x73,0x70,0x61,0x63,0x65,0x5f,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,0x33,0x20,0x76,0x69,0x65,0x77,
0x5f,0x73,0x70,0x61,0x63,0x65,0x5f,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,0x33,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,
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,0x67,0x62,
0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,0x61,0x72,0x64,0x5f,
0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x26,0x20,0x5f,0x32,0x34,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,0x66,0x6c,0x6f,0x61,
0x74,0x33,0x20,0x5f,0x35,0x33,0x20,0x3d,0x20,0x5f,0x32,0x34,0x2e,0x6f,0x66,0x66,
0x73,0x65,0x74,0x20,0x2d,0x20,0x5f,0x32,0x34,0x2e,0x63,0x61,0x6d,0x3b,0x0a,0x20,
0x20,0x20,0x20,0x5f,0x35,0x33,0x2e,0x79,0x20,0x3d,0x20,0x30,0x2e,0x30,0x3b,0x0a,
0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x38,0x38,0x20,0x3d,
0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x28,0x5f,0x32,0x34,0x2e,0x6f,0x66,0x66,
0x73,0x65,0x74,0x20,0x2b,0x20,0x28,0x66,0x61,0x73,0x74,0x3a,0x3a,0x6e,0x6f,0x72,
0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x63,0x72,0x6f,0x73,0x73,0x28,0x66,0x6c,0x6f,
0x61,0x74,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,
0x30,0x29,0x2c,0x20,0x66,0x61,0x73,0x74,0x3a,0x3a,0x6e,0x6f,0x72,0x6d,0x61,0x6c,
0x69,0x7a,0x65,0x28,0x5f,0x35,0x33,0x29,0x29,0x29,0x20,0x2a,0x20,0x28,0x28,0x69,
0x6e,0x2e,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x20,0x2d,0x20,0x30,
0x2e,0x35,0x29,0x20,0x2a,0x20,0x5f,0x32,0x34,0x2e,0x73,0x69,0x7a,0x65,0x2e,0x78,
0x29,0x29,0x29,0x20,0x2b,0x20,0x28,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,
0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x20,0x2a,0x20,0x28,
0x69,0x6e,0x2e,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x79,0x20,0x2a,0x20,
0x5f,0x32,0x34,0x2e,0x73,0x69,0x7a,0x65,0x2e,0x79,0x29,0x29,0x2c,0x20,0x31,0x2e,
0x30,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,0x32,0x34,0x2e,0x6d,0x76,
0x70,0x20,0x2a,0x20,0x5f,0x38,0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,
0x2e,0x76,0x69,0x65,0x77,0x5f,0x73,0x70,0x61,0x63,0x65,0x5f,0x70,0x6f,0x73,0x20,
0x3d,0x20,0x28,0x5f,0x32,0x34,0x2e,0x76,0x69,0x65,0x77,0x5f,0x6d,0x61,0x74,0x72,
0x69,0x78,0x20,0x2a,0x20,0x5f,0x38,0x38,0x29,0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20,
0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x76,0x69,0x65,0x77,0x5f,0x73,0x70,0x61,0x63,
0x65,0x5f,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,
0x33,0x78,0x33,0x28,0x5f,0x32,0x34,0x2e,0x76,0x69,0x65,0x77,0x5f,0x6d,0x61,0x74,
0x72,0x69,0x78,0x5b,0x30,0x5d,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x5f,0x32,0x34,0x2e,
0x76,0x69,0x65,0x77,0x5f,0x6d,0x61,0x74,0x72,0x69,0x78,0x5b,0x31,0x5d,0x2e,0x78,
0x79,0x7a,0x2c,0x20,0x5f,0x32,0x34,0x2e,0x76,0x69,0x65,0x77,0x5f,0x6d,0x61,0x74,
0x72,0x69,0x78,0x5b,0x32,0x5d,0x2e,0x78,0x79,0x7a,0x29,0x20,0x2a,0x20,0x66,0x6c,
0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x30,
0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x75,0x76,0x5f,
0x69,0x6e,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x5f,0x32,0x34,0x2e,
0x75,0x76,0x73,0x2e,0x78,0x20,0x2b,0x20,0x28,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x69,
0x74,0x69,0x6f,0x6e,0x2e,0x78,0x20,0x2a,0x20,0x5f,0x32,0x34,0x2e,0x75,0x76,0x73,
0x2e,0x7a,0x29,0x2c,0x20,0x5f,0x32,0x34,0x2e,0x75,0x76,0x73,0x2e,0x79,0x20,0x2b,
0x20,0x28,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x79,0x20,
0x2a,0x20,0x5f,0x32,0x34,0x2e,0x75,0x76,0x73,0x2e,0x77,0x29,0x29,0x3b,0x0a,0x20,
0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,
0x0a,0x0a,0x00,
0x76,0x69,0x65,0x77,0x5f,0x6d,0x61,0x74,0x72,0x69,0x78,0x3b,0x0a,0x20,0x20,0x20,
0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x66,0x61,0x63,0x65,0x44,0x69,0x72,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,0x32,0x20,0x75,0x76,0x5f,0x69,0x6e,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,0x69,0x65,0x77,0x5f,0x73,0x70,0x61,0x63,0x65,0x5f,
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,0x33,0x20,
0x76,0x69,0x65,0x77,0x5f,0x73,0x70,0x61,0x63,0x65,0x5f,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,0x33,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,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,0x67,0x62,0x75,0x66,0x66,0x65,0x72,0x5f,0x62,0x69,0x6c,0x6c,0x62,0x6f,
0x61,0x72,0x64,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x26,0x20,0x5f,
0x32,0x34,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,
0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x35,0x33,0x20,0x3d,0x20,0x5f,0x32,0x34,
0x2e,0x6f,0x66,0x66,0x73,0x65,0x74,0x20,0x2d,0x20,0x5f,0x32,0x34,0x2e,0x63,0x61,
0x6d,0x3b,0x0a,0x20,0x20,0x20,0x20,0x5f,0x35,0x33,0x2e,0x79,0x20,0x3d,0x20,0x30,
0x2e,0x30,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x6c,
0x6f,0x6f,0x6b,0x5f,0x64,0x69,0x72,0x20,0x3d,0x20,0x66,0x61,0x73,0x74,0x3a,0x3a,
0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x69,0x7a,0x65,0x28,0x5f,0x35,0x33,0x29,0x3b,0x0a,
0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x32,0x34,0x2e,0x66,0x61,0x63,0x65,
0x44,0x69,0x72,0x2e,0x78,0x20,0x3c,0x20,0x28,0x2d,0x31,0x30,0x2e,0x30,0x29,0x29,
0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x6c,
0x6f,0x6f,0x6b,0x5f,0x64,0x69,0x72,0x20,0x3d,0x20,0x5f,0x32,0x34,0x2e,0x66,0x61,
0x63,0x65,0x44,0x69,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,
0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x39,0x38,0x20,0x3d,0x20,0x66,0x6c,
0x6f,0x61,0x74,0x34,0x28,0x28,0x5f,0x32,0x34,0x2e,0x6f,0x66,0x66,0x73,0x65,0x74,
0x20,0x2b,0x20,0x28,0x66,0x61,0x73,0x74,0x3a,0x3a,0x6e,0x6f,0x72,0x6d,0x61,0x6c,
0x69,0x7a,0x65,0x28,0x63,0x72,0x6f,0x73,0x73,0x28,0x66,0x6c,0x6f,0x61,0x74,0x33,
0x28,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x2c,
0x20,0x6c,0x6f,0x6f,0x6b,0x5f,0x64,0x69,0x72,0x29,0x29,0x20,0x2a,0x20,0x28,0x28,
0x69,0x6e,0x2e,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x20,0x2d,0x20,
0x30,0x2e,0x35,0x29,0x20,0x2a,0x20,0x5f,0x32,0x34,0x2e,0x73,0x69,0x7a,0x65,0x2e,
0x78,0x29,0x29,0x29,0x20,0x2b,0x20,0x28,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,
0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x29,0x20,0x2a,0x20,
0x28,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x79,0x20,0x2a,
0x20,0x5f,0x32,0x34,0x2e,0x73,0x69,0x7a,0x65,0x2e,0x79,0x29,0x29,0x2c,0x20,0x31,
0x2e,0x30,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,0x32,0x34,0x2e,0x6d,
0x76,0x70,0x20,0x2a,0x20,0x5f,0x39,0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,
0x74,0x2e,0x76,0x69,0x65,0x77,0x5f,0x73,0x70,0x61,0x63,0x65,0x5f,0x70,0x6f,0x73,
0x20,0x3d,0x20,0x28,0x5f,0x32,0x34,0x2e,0x76,0x69,0x65,0x77,0x5f,0x6d,0x61,0x74,
0x72,0x69,0x78,0x20,0x2a,0x20,0x5f,0x39,0x38,0x29,0x2e,0x78,0x79,0x7a,0x3b,0x0a,
0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x76,0x69,0x65,0x77,0x5f,0x73,0x70,0x61,
0x63,0x65,0x5f,0x6e,0x6f,0x72,0x6d,0x61,0x6c,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,
0x74,0x33,0x78,0x33,0x28,0x5f,0x32,0x34,0x2e,0x76,0x69,0x65,0x77,0x5f,0x6d,0x61,
0x74,0x72,0x69,0x78,0x5b,0x30,0x5d,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x5f,0x32,0x34,
0x2e,0x76,0x69,0x65,0x77,0x5f,0x6d,0x61,0x74,0x72,0x69,0x78,0x5b,0x31,0x5d,0x2e,
0x78,0x79,0x7a,0x2c,0x20,0x5f,0x32,0x34,0x2e,0x76,0x69,0x65,0x77,0x5f,0x6d,0x61,
0x74,0x72,0x69,0x78,0x5b,0x32,0x5d,0x2e,0x78,0x79,0x7a,0x29,0x20,0x2a,0x20,0x66,
0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,
0x30,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x75,0x76,
0x5f,0x69,0x6e,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x5f,0x32,0x34,
0x2e,0x75,0x76,0x73,0x2e,0x78,0x20,0x2b,0x20,0x28,0x69,0x6e,0x2e,0x70,0x6f,0x73,
0x69,0x74,0x69,0x6f,0x6e,0x2e,0x78,0x20,0x2a,0x20,0x5f,0x32,0x34,0x2e,0x75,0x76,
0x73,0x2e,0x7a,0x29,0x2c,0x20,0x5f,0x32,0x34,0x2e,0x75,0x76,0x73,0x2e,0x79,0x20,
0x2b,0x20,0x28,0x69,0x6e,0x2e,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x2e,0x79,
0x20,0x2a,0x20,0x5f,0x32,0x34,0x2e,0x75,0x76,0x73,0x2e,0x77,0x29,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>
@ -583,9 +628,9 @@ gbuffer_billboard_shader_desc :: (backend: sg_backend) -> sg_shader_desc {
desc.attrs[0].glsl_name = "position";
desc.uniform_blocks[0].stage = .VERTEX;
desc.uniform_blocks[0].layout = .STD140;
desc.uniform_blocks[0].size = 192;
desc.uniform_blocks[0].size = 208;
desc.uniform_blocks[0].glsl_uniforms[0].type = .FLOAT4;
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 12;
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 13;
desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "gbuffer_billboard_vs_params";
desc.images[0].stage = .FRAGMENT;
desc.images[0].multisampled = false;
@ -606,9 +651,9 @@ gbuffer_billboard_shader_desc :: (backend: sg_backend) -> sg_shader_desc {
desc.attrs[0].glsl_name = "position";
desc.uniform_blocks[0].stage = .VERTEX;
desc.uniform_blocks[0].layout = .STD140;
desc.uniform_blocks[0].size = 192;
desc.uniform_blocks[0].size = 208;
desc.uniform_blocks[0].glsl_uniforms[0].type = .FLOAT4;
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 12;
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 13;
desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "gbuffer_billboard_vs_params";
desc.images[0].stage = .FRAGMENT;
desc.images[0].multisampled = false;
@ -628,7 +673,7 @@ gbuffer_billboard_shader_desc :: (backend: sg_backend) -> sg_shader_desc {
desc.attrs[0].base_type = .FLOAT;
desc.uniform_blocks[0].stage = .VERTEX;
desc.uniform_blocks[0].layout = .STD140;
desc.uniform_blocks[0].size = 192;
desc.uniform_blocks[0].size = 208;
desc.uniform_blocks[0].msl_buffer_n = 0;
desc.images[0].stage = .FRAGMENT;
desc.images[0].multisampled = false;

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,7 @@ layout(binding=0) uniform billboard_vs_params {
vec3 offset;
vec2 size;
vec3 cam;
vec3 faceDir;
};
out vec2 uv_in;
@ -18,6 +19,7 @@ void main() {
vec3 look_dir = offset - cam;
look_dir.y = 0.0;
look_dir = normalize(look_dir);
if(faceDir.x > -10) look_dir = faceDir;
vec3 world_right = normalize(cross(world_up, look_dir));
vec3 world_pos = offset + (world_right * local_pos.x) + (world_up * local_pos.y);
gl_Position = mvp * vec4(world_pos, 1.0);

View File

@ -9,6 +9,7 @@ layout(binding=0) uniform gbuffer_billboard_vs_params {
vec2 size;
vec3 cam;
mat4 view_matrix;
vec3 faceDir;
};
out vec2 uv_in;
@ -21,6 +22,7 @@ void main() {
vec3 look_dir = offset - cam;
look_dir.y = 0.0;
look_dir = normalize(look_dir);
if(faceDir.x < -10) look_dir = faceDir;
vec3 world_right = normalize(cross(world_up, look_dir));
vec3 world_pos = offset + (world_right * local_pos.x) + (world_up * local_pos.y);
gl_Position = mvp * vec4(world_pos, 1.0);

View File

@ -77,6 +77,7 @@ layout(binding=1) uniform trile_world_config {
vec3 deepColor;
float time;
int hsv_lighting;
};
in vec3 cam;
@ -200,8 +201,6 @@ vec3 sky(vec3 skypos, vec3 sunpos) {
return final;
}
// ---- SKY END ----
// ---- PBR FUNCTIONS ----
float DistributionGGX(vec3 N, vec3 H, float roughness) {
@ -251,7 +250,6 @@ int rdm_index_from_normal(vec3 N) {
vec3 n_frontback = vec3(1.0, 0.0, 0.0);
int res = 0;
// res += int(dot(n_updown, N) >= 0.98) * 0; unnecessary
res += int(dot(-n_updown, N) >= 0.98) * 1;
res += int(dot(n_leftright, N) >= 0.98) * 2;
res += int(dot(-n_leftright, N) >= 0.98) * 3;
@ -282,12 +280,9 @@ vec2 rdm_get_hemioct(vec3 v, int index, vec2 off) {
normalize(vc);
vec2 p = vc.xy * (1.0 / (abs(vc.x) + abs(vc.y) + vc.z));
// Rotate and scale the center diamond to the unit square
vec2 res = vec2(p.x + p.y, p.x - p.y);
res.x = (res.x + 1.0) * 0.5;
res.y = (res.y + 1.0) * 0.5;
// res.y = clamp(res.y, 0.0, 1.0);
// res.x = clamp(res.x, 0.0, 1.0);
return res;
}
@ -299,8 +294,6 @@ float rdm_offset_x(int index) {
return float((index % 2)) * (1.0/2.0);
}
// Look up atlas rect from the lookup texture for a given chunk-local position and roughness.
// Returns atlas_rect: xy = UV offset, zw = UV size. z > 0 means valid.
vec4 rdm_get_atlas_rect(ivec3 local_pos, int roughness) {
int rdm_index = local_pos.x + local_pos.y * 32 + local_pos.z * 1024 + roughness * 32768;
int tx = rdm_index % 512;
@ -308,8 +301,6 @@ vec4 rdm_get_atlas_rect(ivec3 local_pos, int roughness) {
return texelFetch(sampler2D(rdm_lookup, trilesmp), ivec2(tx, ty), 0);
}
// Compute pixel offset in the atlas for a given face within an atlas rect.
// Returns ivec2(ox, oy) — the top-left pixel of this face's sub-image.
ivec2 rdm_face_pixel_offset(vec4 atlas_rect, int face, int rdmSize) {
ivec2 atlasSize = textureSize(sampler2D(rdm_atlas, rdmsmp), 0);
int col = face % 2;
@ -374,11 +365,6 @@ vec3 sample_rdm(vec3 N, vec3 V, vec3 rdm_center, vec3 diff, int roughness, ivec3
return sky(skyDir, sunPosition);
}
// Sample diffuse irradiance from a single probe (roughness=7 RDM face)
vec3 sample_rdm_diff_map(vec3 N, ivec3 local_pos, vec3 fallback) {
vec4 atlas_rect = rdm_get_atlas_rect(local_pos, 7);
if (atlas_rect.z <= 0.0) return fallback;
@ -402,12 +388,10 @@ vec3 smix(vec3 a, vec3 b, float t) {
return mix(a, b, smoothT);
}
// Interpolated diffuse irradiance from 4 nearest neighbor probes
vec3 sample_rdm_diff(vec3 N, vec3 diff, ivec3 local_pos) {
int face = rdm_index_from_normal(N);
vec3 ambientPlaceholder = vec3(0.3, 0.3, 0.4);
// Determine the 2D delta in the face plane
vec2 delta = vec2(0.0);
if (face == 0 || face == 1) {
delta = vec2(diff.x, diff.z);
@ -417,7 +401,6 @@ vec3 sample_rdm_diff(vec3 N, vec3 diff, ivec3 local_pos) {
delta = vec2(diff.z, diff.y);
}
// Compute neighbor offsets in 3D
ivec3 s0 = ivec3(0, 0, 0);
ivec3 s1, s2, s3;
if (face == 0 || face == 1) {
@ -434,27 +417,11 @@ vec3 sample_rdm_diff(vec3 N, vec3 diff, ivec3 local_pos) {
s3 = ivec3(0, isign(delta.y), isign(delta.x));
}
// // Swizzle offsets based on face orientation
// if (face == 2 || face == 3) {
// int temp;
// temp = s1.y; s1.y = s1.z; s1.z = temp;
// temp = s2.y; s2.y = s2.z; s2.z = temp;
// temp = s3.y; s3.y = s3.z; s3.z = temp;
// }
// if (face == 4 || face == 5) {
// int temp;
// temp = s1.y; s1.y = s1.x; s1.x = temp;
// temp = s2.y; s2.y = s2.x; s2.x = temp;
// temp = s3.y; s3.y = s3.x; s3.x = temp;
// }
// Sample the four nearest probes using offset local positions
vec3 p0 = sample_rdm_diff_map(N, ivec3(mod(vec3(local_pos + s0), 32.0)), ambientPlaceholder);
vec3 p1 = sample_rdm_diff_map(N, ivec3(mod(vec3(local_pos + s1), 32.0)), ambientPlaceholder);
vec3 p2 = sample_rdm_diff_map(N, ivec3(mod(vec3(local_pos + s2), 32.0)), ambientPlaceholder);
vec3 p3 = sample_rdm_diff_map(N, ivec3(mod(vec3(local_pos + s3), 32.0)), ambientPlaceholder);
// Bilinear blend with smooth interpolation
return smix(
smix(p0, p1, abs(delta.x)),
smix(p2, p3, abs(delta.x)),
@ -462,6 +429,21 @@ vec3 sample_rdm_diff(vec3 N, vec3 diff, ivec3 local_pos) {
);
}
vec3 rgb2hsv(vec3 c) {
vec4 K = vec4(0.0, -1.0/3.0, 2.0/3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
float d = q.x - min(q.w, q.y);
float e = 1.0e-10;
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}
vec3 hsv2rgb(vec3 c) {
vec4 K = vec4(1.0, 2.0/3.0, 1.0/3.0, 3.0);
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}
void main() {
if (vpos.y < planeHeight - 0.01 && is_reflection == 1) {
discard;
@ -571,6 +553,9 @@ void main() {
if (rdm_diff_scale < 0.001) {
light += ambient_color * ambient_intensity * albedo * ssao_sample;
}
if (length(light) < ambient_intensity) {
light += ambient_color * (ambient_intensity - length(light)) * albedo * ssao_sample;
}
} else {
// Fallback: ambient + sky reflection when no RDM data (or RDM disabled).
light += ambient_color * ambient_intensity * albedo * ssao_sample;
@ -579,7 +564,15 @@ void main() {
light += F * sky(R, sunPosition) * 0.1;
}
frag_color = vec4(mix(deepColor, light + emissive, smoothstep(0.0, planeHeight, vpos.y)), 1.0);
vec3 final_color = light + emissive;
if (hsv_lighting == 1) {
float albedo_lum = dot(albedo, vec3(0.2126, 0.7152, 0.0722)) + 0.001;
float light_lum = dot(final_color, vec3(0.2126, 0.7152, 0.0722));
vec3 hsv = rgb2hsv(albedo);
hsv.z = clamp(hsv.z * (light_lum / albedo_lum), 0.0, 1.0);
final_color = hsv2rgb(hsv);
}
frag_color = vec4(mix(deepColor, final_color, smoothstep(0.0, planeHeight, vpos.y)), 1.0);
if (is_preview == 1) {
frag_color.rgb = mix(frag_color.rgb, vec3(0.3, 0.7, 1.0), 0.5);
} else if (is_preview == 2) {

View File

@ -718,6 +718,7 @@ World_Config :: struct {
deepColor : Vector3 = .{1.0, 1.0, 1.0}; @Color // @ToDo: sensible default values.
waterShininess : float = 64.0; @Slider,1,512,8
rdmDiffSaturation : float = 1.0; @Slider,0,2,0.05
hsv_lighting : s32 = 1; @Slider,0,1,1
// ambientColor : Vector3 = .{1.0, 1.0, 1.0}; @Color
// ambientIntensity : float = 0.3; @Slider,0,3,0.1