work more on world storage and tools
This commit is contained in:
parent
8b2dcb496e
commit
4b349195d6
File diff suppressed because it is too large
Load Diff
@ -1,17 +1,14 @@
|
||||
#load "iprof.jai";
|
||||
#load "picker.jai";
|
||||
#load "console.jai";
|
||||
#load "postprocess.jai";
|
||||
#load "trile_editor.jai";
|
||||
#load "level_editor.jai";
|
||||
#load "iprof.jai";
|
||||
#load "textureDebugger.jai";
|
||||
|
||||
#if HAS_TACOMA {
|
||||
#load "tacoma.jai";
|
||||
}
|
||||
#if HAS_TACOMA { #load "tacoma.jai"; }
|
||||
|
||||
#scope_file
|
||||
|
||||
|
||||
Editor_View :: enum {
|
||||
Closed_Editor;
|
||||
Trile_Editor;
|
||||
|
||||
@ -369,5 +369,5 @@ draw_level_editor_ui :: (theme: *GR.Overall_Theme) {
|
||||
case .INFO;
|
||||
if curworld.valid then autoedit(r, *curworld.world.conf, theme);
|
||||
}
|
||||
draw_trile_picker(theme);
|
||||
draw_picker(theme);
|
||||
}
|
||||
|
||||
40
src/editor/picker.jai
Normal file
40
src/editor/picker.jai
Normal file
@ -0,0 +1,40 @@
|
||||
#scope_file
|
||||
|
||||
Picker :: enum {
|
||||
TRILE;
|
||||
WORLD;
|
||||
}
|
||||
|
||||
current_picker : Picker = .TRILE;
|
||||
|
||||
#scope_export
|
||||
|
||||
draw_picker :: (theme: *GR.Overall_Theme) {
|
||||
r := GR.get_rect(ui_w(85,0), ui_h(5,0), ui_w(15, 0), ui_h(95, 0));
|
||||
draw_bg_rectangle(r, theme);
|
||||
ui_add_mouse_occluder(r);
|
||||
|
||||
tab_r := r;
|
||||
tab_r.h = ui_h(3,0);
|
||||
tab_r.w = r.w / 2;
|
||||
|
||||
if GR.button(tab_r, "Triles", *t_button_tab(theme, current_picker == .TRILE)) {
|
||||
current_picker = .TRILE;
|
||||
}
|
||||
tab_r.x += tab_r.w;
|
||||
if GR.button(tab_r, "Worlds", *t_button_tab(theme, current_picker == .WORLD)) {
|
||||
current_picker = .WORLD;
|
||||
}
|
||||
|
||||
r.y += tab_r.h;
|
||||
r.h -= tab_r.h;
|
||||
|
||||
// @ToDo: Add a scrollable zone here so that
|
||||
// our triles or worlds can overflow.
|
||||
if current_picker == {
|
||||
case .TRILE;
|
||||
draw_trile_picker(r, theme);
|
||||
case .WORLD;
|
||||
draw_world_picker(r, theme);
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,5 @@
|
||||
#scope_file
|
||||
|
||||
world : World; // @ToDo: Actually load the world from somewhere once we have actual world management.
|
||||
|
||||
|
||||
get_post_processing_camera :: () -> Camera {
|
||||
camera : Camera;
|
||||
camera.target = Vector3.{0,0,0};
|
||||
@ -19,10 +16,16 @@ tick_post_process_editor :: () {
|
||||
}
|
||||
|
||||
draw_post_process_editor :: () {
|
||||
curworld := get_current_world();
|
||||
if !curworld.valid then return;
|
||||
create_set_cam_rendering_task(get_post_processing_camera());
|
||||
create_world_rendering_tasks(*world);
|
||||
create_world_rendering_tasks(curworld.world);
|
||||
}
|
||||
|
||||
draw_post_process_editor_ui :: (theme: *GR.Overall_Theme) {
|
||||
|
||||
draw_picker(theme);
|
||||
r := GR.get_rect(0, ui_h(5,0), ui_w(20, 20), ui_h(95, 0));
|
||||
ui_add_mouse_occluder(r);
|
||||
draw_bg_rectangle(r, theme);
|
||||
autoedit(r, *current_post_process, theme);
|
||||
}
|
||||
|
||||
@ -14,12 +14,6 @@ Tacoma_Screenshot :: struct {
|
||||
|
||||
current_screenshot : Tacoma_Screenshot;
|
||||
|
||||
Post_Process :: struct {
|
||||
exposure : float;
|
||||
contrast : float;
|
||||
saturation : float;
|
||||
}
|
||||
|
||||
post_process_pipeline :: (color: Vector3, post_process: Post_Process) -> Vector3 {
|
||||
vec3 :: (f: float) -> Vector3 {
|
||||
return .{f,f,f};
|
||||
|
||||
@ -38,6 +38,8 @@ current_tab : Trile_Editor_Tab = .TOOLSET;
|
||||
current_tool : Trile_Editor_Tool = .PAINT;
|
||||
current_mode : Trile_Editor_Tool_Mode = .AREA;
|
||||
|
||||
colorMuls : [16][16][16]Vector3;
|
||||
|
||||
#scope_export
|
||||
|
||||
ntrile :: (name: string) {
|
||||
@ -141,6 +143,45 @@ tick_trile_editor :: () {
|
||||
handle_tool_click();
|
||||
}
|
||||
|
||||
mindist : float = 999999;
|
||||
hovered_trixel_x = -1;
|
||||
hovered_trixel_y = -1;
|
||||
hovered_trixel_z = -1;
|
||||
|
||||
for x: 0..15 {
|
||||
for y: 0..15 {
|
||||
for z: 0..15 {
|
||||
t := editor_current_trile.trixels[x][y][z];
|
||||
if t.empty then continue;
|
||||
|
||||
cube : Collision_Cube;
|
||||
cube.position = Vector3.{cast(float) x, cast(float) y, cast(float) z} * TRIXEL_SIZE;
|
||||
cube.size = Vector3.{1,1,1} * TRIXEL_SIZE;
|
||||
|
||||
ray := get_mouse_ray(*get_trile_editor_camera());
|
||||
collision := does_ray_hit_cube(ray, cube);
|
||||
if collision.hit && collision.distance < mindist {
|
||||
mindist = collision.distance;
|
||||
hovered_trixel_x = x;
|
||||
hovered_trixel_y = y;
|
||||
hovered_trixel_z = z;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for x: 0..15 {
|
||||
for y: 0..15 {
|
||||
for z: 0..15 {
|
||||
if x == hovered_trixel_x && y == hovered_trixel_y && z == hovered_trixel_z {
|
||||
colorMuls[x][y][z] = .{0.6, 0.0, 0.0};
|
||||
} else {
|
||||
colorMuls[x][y][z] = .{1.0, 1.0, 1.0};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !input_button_states[Key_Code.CTRL] & .DOWN {
|
||||
if input_button_states[#char "D"] & .DOWN {
|
||||
rotation += TRILE_ROTATION_SPEED * cast(float) delta_time;
|
||||
@ -257,7 +298,7 @@ draw_trile_editor :: () {
|
||||
create_set_cam_rendering_task(get_trile_editor_camera());
|
||||
w := New(World,, temp);
|
||||
create_sky_rendering_task(*w.conf);
|
||||
create_trixel_rendering_task(editor_current_trile);
|
||||
create_trixel_rendering_task(editor_current_trile, *colorMuls);
|
||||
}
|
||||
|
||||
trile_editor_shortcuts :: () {
|
||||
@ -325,5 +366,5 @@ draw_trile_editor_ui :: (theme: *GR.Overall_Theme) {
|
||||
draw_tool_tab(theme, r);
|
||||
}
|
||||
|
||||
draw_trile_picker(theme);
|
||||
draw_picker(theme);
|
||||
}
|
||||
|
||||
@ -47,9 +47,10 @@ Render_Command_Draw_Trile_Positions :: struct {
|
||||
}
|
||||
|
||||
Render_Command_Update_Trixels :: struct {
|
||||
#as using c : Render_Command;
|
||||
c.type = .UPDATE_TRIXELS;
|
||||
trile : *Trile;
|
||||
#as using c : Render_Command;
|
||||
c.type = .UPDATE_TRIXELS;
|
||||
trile : *Trile;
|
||||
colMultipliers : *[16][16][16]Vector3;
|
||||
}
|
||||
|
||||
Render_Command_Draw_Trixels :: struct {
|
||||
|
||||
@ -27,14 +27,14 @@ backend_handle_command :: (cmd: *Render_Command) {
|
||||
backend_draw_ground(ground_command.worldConfig);
|
||||
case .UPDATE_TRIXELS;
|
||||
trixel_update_command := cast(*Render_Command_Update_Trixels)cmd;
|
||||
backend_update_trixels(trixel_update_command.trile);
|
||||
backend_update_trixels(trixel_update_command);
|
||||
case .DRAW_TRIXELS;
|
||||
backend_draw_trixels();
|
||||
}
|
||||
}
|
||||
|
||||
backend_update_trixels :: (trile: *Trile) {
|
||||
if trile == null then return;
|
||||
backend_update_trixels :: (cmd: Render_Command_Update_Trixels) {
|
||||
if cmd.trile == null then return;
|
||||
|
||||
trixels : [4096]Position_Color;
|
||||
trixel_count = 0;
|
||||
@ -42,15 +42,15 @@ backend_update_trixels :: (trile: *Trile) {
|
||||
for x: 0..15 {
|
||||
for y: 0..15 {
|
||||
for z: 0..15 {
|
||||
if trile.trixels[x][y][z].empty then continue;
|
||||
if cmd.trile.trixels[x][y][z].empty then continue;
|
||||
|
||||
trixels[trixel_count].pos.x = x * (1.0 / 16.0) + TRIXEL_SIZE_HALF;
|
||||
trixels[trixel_count].pos.y = y * (1.0 / 16.0) + TRIXEL_SIZE_HALF;
|
||||
trixels[trixel_count].pos.z = z * (1.0 / 16.0) + TRIXEL_SIZE_HALF;
|
||||
trixels[trixel_count].pos.w = 1.0;
|
||||
trixel_color := trile.trixels[x][y][z].material.color;
|
||||
trixel_color := cmd.trile.trixels[x][y][z].material.color * (cmd.colMultipliers.*)[x][y][z];
|
||||
|
||||
trixels[trixel_count].col = .{trixel_color.x, trixel_color.y, trixel_color.z, material_encode_to_float(trile.trixels[x][y][z].material)};
|
||||
trixels[trixel_count].col = .{trixel_color.x, trixel_color.y, trixel_color.z, material_encode_to_float(cmd.trile.trixels[x][y][z].material)};
|
||||
trixel_count += 1;
|
||||
}
|
||||
}
|
||||
@ -193,6 +193,9 @@ backend_process_command_buckets :: () {
|
||||
sg_apply_pipeline(gPipelines.postprocess.pipeline);
|
||||
gPipelines.postprocess.bind.images[0] = g_rendertex;
|
||||
sg_apply_bindings(*gPipelines.postprocess.bind);
|
||||
post_process_config_uniform : Post_Process_Config;
|
||||
fill_uniform_with_engine_data(*post_process_config_uniform , *current_post_process);
|
||||
sg_apply_uniforms(UB_post_process_config, *(sg_range.{ ptr = *post_process_config_uniform, size = size_of(type_of(post_process_config_uniform)) }));
|
||||
sg_draw(0, 6, 1);
|
||||
|
||||
sgl_defaults();
|
||||
|
||||
@ -1,3 +1,17 @@
|
||||
fill_uniform_with_engine_data :: (uniform: *$A, enginedata: *$B) {
|
||||
generate_copy_code :: () -> string {
|
||||
builder : String_Builder;
|
||||
ti := type_info(A);
|
||||
for ti.members {
|
||||
if it.name == "_" then continue; // skip padding
|
||||
if it.type == type_info(Vector3) then print_to_builder(*builder, "uniform.% = enginedata.%.component;\n", it.name, it.name);
|
||||
else print_to_builder(*builder, "uniform.% = enginedata.%;\n", it.name, it.name);
|
||||
}
|
||||
return builder_to_string(*builder);
|
||||
}
|
||||
#insert #run,stallable generate_copy_code();
|
||||
}
|
||||
|
||||
create_world_rendering_tasks :: (world: *World) {
|
||||
create_sky_rendering_task(*world.conf);
|
||||
create_ground_rendering_task(world);
|
||||
@ -15,8 +29,8 @@ create_sky_rendering_task :: (conf: *World_Config) {
|
||||
add_rendering_task(skytask);
|
||||
}
|
||||
|
||||
create_trixel_rendering_task :: (trile: *Trile) {
|
||||
trixeltask := Rendering_Task_Trixels.{type = .TRIXELS, trile = trile};
|
||||
create_trixel_rendering_task :: (trile: *Trile, muls: *[16][16][16]Vector3) {
|
||||
trixeltask := Rendering_Task_Trixels.{type = .TRIXELS, trile = trile, colMultipliers = muls};
|
||||
add_rendering_task(trixeltask);
|
||||
|
||||
}
|
||||
|
||||
10
src/rendering/post_processing.jai
Normal file
10
src/rendering/post_processing.jai
Normal file
@ -0,0 +1,10 @@
|
||||
Post_Process :: struct {
|
||||
exposure : float;
|
||||
contrast : float;
|
||||
saturation : float;
|
||||
gamma : float = 1.0; @Slider,0.3,3.0,0.1;
|
||||
tonemap : float = 1.0; @Slider,0,1,1;
|
||||
|
||||
}
|
||||
|
||||
current_post_process : Post_Process;
|
||||
@ -7,14 +7,15 @@
|
||||
|
||||
*/
|
||||
|
||||
#load "tasks.jai";
|
||||
#load "sky.jai";
|
||||
#load "core.jai";
|
||||
#load "tasks.jai";
|
||||
#load "camera.jai";
|
||||
#load "pipelines.jai";
|
||||
#load "meshgen.jai";
|
||||
#load "arbtri.jai";
|
||||
#load "meshgen.jai";
|
||||
#load "helpers.jai";
|
||||
#load "pipelines.jai";
|
||||
#load "post_processing.jai";
|
||||
|
||||
#scope_file
|
||||
|
||||
@ -23,6 +24,7 @@ old_w : int;
|
||||
old_h : int;
|
||||
|
||||
on_window_resize :: () {
|
||||
// Recreate textures that are rendering targets and dependent on window size.
|
||||
create_plane_pipeline_reflection_images();
|
||||
create_final_image();
|
||||
}
|
||||
|
||||
@ -41,9 +41,10 @@ Rendering_Task_Trile :: struct {
|
||||
}
|
||||
|
||||
Rendering_Task_Trixels :: struct {
|
||||
#as using t : Rendering_Task;
|
||||
t.type = .TRIXELS;
|
||||
trile : *Trile;
|
||||
#as using t : Rendering_Task;
|
||||
t.type = .TRIXELS;
|
||||
colMultipliers : *[16][16][16]Vector3;
|
||||
trile : *Trile;
|
||||
}
|
||||
|
||||
Rendering_Task_Set_Camera :: struct {
|
||||
@ -70,6 +71,7 @@ tasks_to_commands :: () {
|
||||
trixelsTask := (cast(*Rendering_Task_Trixels)it);
|
||||
updateCommand := New(Render_Command_Update_Trixels,, temp);
|
||||
updateCommand.trile = trixelsTask.trile;
|
||||
updateCommand.colMultipliers = trixelsTask.colMultipliers;
|
||||
array_add(*render_command_buckets.setup, updateCommand);
|
||||
drawCommand := New(Render_Command_Draw_Trixels,, temp);
|
||||
array_add(*render_command_buckets.main, drawCommand);
|
||||
|
||||
@ -16,6 +16,9 @@
|
||||
ATTR_postprocess_position => 0
|
||||
ATTR_postprocess_uv => 1
|
||||
Bindings:
|
||||
Uniform block 'post_process_config':
|
||||
Jai struct: Post_Process_Config
|
||||
Bind slot: UB_post_process_config => 0
|
||||
Image 'pptex':
|
||||
Image type: ._2D
|
||||
Sample type: .FLOAT
|
||||
@ -27,8 +30,17 @@
|
||||
*/
|
||||
ATTR_postprocess_position :: 0;
|
||||
ATTR_postprocess_uv :: 1;
|
||||
UB_post_process_config :: 0;
|
||||
IMG_pptex :: 0;
|
||||
SMP_ppsmp :: 0;
|
||||
Post_Process_Config :: struct {
|
||||
exposure: float;
|
||||
contrast: float;
|
||||
saturation: float;
|
||||
gamma: float;
|
||||
tonemap: float;
|
||||
_: [12]u8;
|
||||
};
|
||||
/*
|
||||
#version 430
|
||||
|
||||
@ -62,32 +74,90 @@ vs_pp_source_glsl430 := u8.[
|
||||
/*
|
||||
#version 430
|
||||
|
||||
uniform vec4 post_process_config[2];
|
||||
layout(binding = 16) uniform sampler2D pptex_ppsmp;
|
||||
|
||||
layout(location = 0) in vec2 texcoord;
|
||||
layout(location = 0) out vec4 frag_color;
|
||||
|
||||
vec3 aces(vec3 x)
|
||||
{
|
||||
return clamp((x * ((x * 2.5099999904632568359375) + vec3(0.02999999932944774627685546875))) / ((x * ((x * 2.4300000667572021484375) + vec3(0.589999973773956298828125))) + vec3(0.14000000059604644775390625)), vec3(0.0), vec3(1.0));
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
frag_color = texture(pptex_ppsmp, texcoord);
|
||||
vec4 _57 = texture(pptex_ppsmp, texcoord);
|
||||
vec3 _61 = _57.xyz;
|
||||
vec3 param = _61;
|
||||
vec3 tonemapped = aces(param);
|
||||
if (post_process_config[1].x > 0.5)
|
||||
{
|
||||
vec3 param_1 = _61;
|
||||
tonemapped = aces(param_1);
|
||||
}
|
||||
else
|
||||
{
|
||||
tonemapped = _61;
|
||||
}
|
||||
frag_color = vec4(pow(tonemapped, vec3(1.0 / post_process_config[0].w)), 1.0);
|
||||
}
|
||||
|
||||
*/
|
||||
fs_pp_source_glsl430 := u8.[
|
||||
0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x33,0x30,0x0a,0x0a,0x6c,0x61,
|
||||
0x79,0x6f,0x75,0x74,0x28,0x62,0x69,0x6e,0x64,0x69,0x6e,0x67,0x20,0x3d,0x20,0x31,
|
||||
0x36,0x29,0x20,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,
|
||||
0x65,0x72,0x32,0x44,0x20,0x70,0x70,0x74,0x65,0x78,0x5f,0x70,0x70,0x73,0x6d,0x70,
|
||||
0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,
|
||||
0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,
|
||||
0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,
|
||||
0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,
|
||||
0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,
|
||||
0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,
|
||||
0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,
|
||||
0x72,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x70,0x70,0x74,0x65,
|
||||
0x78,0x5f,0x70,0x70,0x73,0x6d,0x70,0x2c,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,
|
||||
0x64,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
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,0x70,0x6f,0x73,0x74,0x5f,
|
||||
0x70,0x72,0x6f,0x63,0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b,0x32,
|
||||
0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x62,0x69,0x6e,0x64,0x69,0x6e,
|
||||
0x67,0x20,0x3d,0x20,0x31,0x36,0x29,0x20,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,
|
||||
0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x70,0x70,0x74,0x65,0x78,0x5f,
|
||||
0x70,0x70,0x73,0x6d,0x70,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,
|
||||
0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,
|
||||
0x76,0x65,0x63,0x32,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x3b,0x0a,0x6c,
|
||||
0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,
|
||||
0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,
|
||||
0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x65,0x63,0x33,0x20,0x61,
|
||||
0x63,0x65,0x73,0x28,0x76,0x65,0x63,0x33,0x20,0x78,0x29,0x0a,0x7b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x63,0x6c,0x61,0x6d,0x70,0x28,0x28,
|
||||
0x78,0x20,0x2a,0x20,0x28,0x28,0x78,0x20,0x2a,0x20,0x32,0x2e,0x35,0x30,0x39,0x39,
|
||||
0x39,0x39,0x39,0x39,0x30,0x34,0x36,0x33,0x32,0x35,0x36,0x38,0x33,0x35,0x39,0x33,
|
||||
0x37,0x35,0x29,0x20,0x2b,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x32,0x39,
|
||||
0x39,0x39,0x39,0x39,0x39,0x39,0x33,0x32,0x39,0x34,0x34,0x37,0x37,0x34,0x36,0x32,
|
||||
0x37,0x36,0x38,0x35,0x35,0x34,0x36,0x38,0x37,0x35,0x29,0x29,0x29,0x20,0x2f,0x20,
|
||||
0x28,0x28,0x78,0x20,0x2a,0x20,0x28,0x28,0x78,0x20,0x2a,0x20,0x32,0x2e,0x34,0x33,
|
||||
0x30,0x30,0x30,0x30,0x30,0x36,0x36,0x37,0x35,0x37,0x32,0x30,0x32,0x31,0x34,0x38,
|
||||
0x34,0x33,0x37,0x35,0x29,0x20,0x2b,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x35,
|
||||
0x38,0x39,0x39,0x39,0x39,0x39,0x37,0x33,0x37,0x37,0x33,0x39,0x35,0x36,0x32,0x39,
|
||||
0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x29,0x29,0x29,0x20,0x2b,0x20,0x76,0x65,0x63,
|
||||
0x33,0x28,0x30,0x2e,0x31,0x34,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x35,0x39,0x36,
|
||||
0x30,0x34,0x36,0x34,0x34,0x37,0x37,0x35,0x33,0x39,0x30,0x36,0x32,0x35,0x29,0x29,
|
||||
0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x29,0x2c,0x20,0x76,0x65,0x63,
|
||||
0x33,0x28,0x31,0x2e,0x30,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,
|
||||
0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,
|
||||
0x63,0x34,0x20,0x5f,0x35,0x37,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,
|
||||
0x28,0x70,0x70,0x74,0x65,0x78,0x5f,0x70,0x70,0x73,0x6d,0x70,0x2c,0x20,0x74,0x65,
|
||||
0x78,0x63,0x6f,0x6f,0x72,0x64,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,
|
||||
0x33,0x20,0x5f,0x36,0x31,0x20,0x3d,0x20,0x5f,0x35,0x37,0x2e,0x78,0x79,0x7a,0x3b,
|
||||
0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,
|
||||
0x3d,0x20,0x5f,0x36,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x33,0x20,
|
||||
0x74,0x6f,0x6e,0x65,0x6d,0x61,0x70,0x70,0x65,0x64,0x20,0x3d,0x20,0x61,0x63,0x65,
|
||||
0x73,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,
|
||||
0x20,0x28,0x70,0x6f,0x73,0x74,0x5f,0x70,0x72,0x6f,0x63,0x65,0x73,0x73,0x5f,0x63,
|
||||
0x6f,0x6e,0x66,0x69,0x67,0x5b,0x31,0x5d,0x2e,0x78,0x20,0x3e,0x20,0x30,0x2e,0x35,
|
||||
0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x76,0x65,0x63,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x5f,
|
||||
0x36,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x74,0x6f,0x6e,0x65,
|
||||
0x6d,0x61,0x70,0x70,0x65,0x64,0x20,0x3d,0x20,0x61,0x63,0x65,0x73,0x28,0x70,0x61,
|
||||
0x72,0x61,0x6d,0x5f,0x31,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,0x74,0x6f,0x6e,0x65,0x6d,0x61,0x70,0x70,0x65,0x64,0x20,
|
||||
0x3d,0x20,0x5f,0x36,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,
|
||||
0x63,0x34,0x28,0x70,0x6f,0x77,0x28,0x74,0x6f,0x6e,0x65,0x6d,0x61,0x70,0x70,0x65,
|
||||
0x64,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x31,0x2e,0x30,0x20,0x2f,0x20,0x70,0x6f,
|
||||
0x73,0x74,0x5f,0x70,0x72,0x6f,0x63,0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,
|
||||
0x67,0x5b,0x30,0x5d,0x2e,0x77,0x29,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,
|
||||
0x7d,0x0a,0x0a,0x00,
|
||||
];
|
||||
/*
|
||||
#version 300 es
|
||||
@ -122,14 +192,33 @@ vs_pp_source_glsl300es := u8.[
|
||||
precision mediump float;
|
||||
precision highp int;
|
||||
|
||||
uniform highp vec4 post_process_config[2];
|
||||
uniform highp sampler2D pptex_ppsmp;
|
||||
|
||||
in highp vec2 texcoord;
|
||||
layout(location = 0) out highp vec4 frag_color;
|
||||
|
||||
highp vec3 aces(highp vec3 x)
|
||||
{
|
||||
return clamp((x * ((x * 2.5099999904632568359375) + vec3(0.02999999932944774627685546875))) / ((x * ((x * 2.4300000667572021484375) + vec3(0.589999973773956298828125))) + vec3(0.14000000059604644775390625)), vec3(0.0), vec3(1.0));
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
frag_color = texture(pptex_ppsmp, texcoord);
|
||||
highp vec4 _57 = texture(pptex_ppsmp, texcoord);
|
||||
highp vec3 _61 = _57.xyz;
|
||||
highp vec3 param = _61;
|
||||
highp vec3 tonemapped = aces(param);
|
||||
if (post_process_config[1].x > 0.5)
|
||||
{
|
||||
highp vec3 param_1 = _61;
|
||||
tonemapped = aces(param_1);
|
||||
}
|
||||
else
|
||||
{
|
||||
tonemapped = _61;
|
||||
}
|
||||
frag_color = vec4(pow(tonemapped, vec3(1.0 / post_process_config[0].w)), 1.0);
|
||||
}
|
||||
|
||||
*/
|
||||
@ -138,18 +227,59 @@ fs_pp_source_glsl300es := u8.[
|
||||
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,0x75,
|
||||
0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x73,0x61,0x6d,
|
||||
0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x70,0x70,0x74,0x65,0x78,0x5f,0x70,0x70,0x73,
|
||||
0x6d,0x70,0x3b,0x0a,0x0a,0x69,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,
|
||||
0x63,0x32,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x3b,0x0a,0x6c,0x61,0x79,
|
||||
0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,
|
||||
0x29,0x20,0x6f,0x75,0x74,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,
|
||||
0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76,0x6f,
|
||||
0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,
|
||||
0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x74,0x65,0x78,
|
||||
0x74,0x75,0x72,0x65,0x28,0x70,0x70,0x74,0x65,0x78,0x5f,0x70,0x70,0x73,0x6d,0x70,
|
||||
0x2c,0x20,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,
|
||||
0x00,
|
||||
0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,
|
||||
0x34,0x20,0x70,0x6f,0x73,0x74,0x5f,0x70,0x72,0x6f,0x63,0x65,0x73,0x73,0x5f,0x63,
|
||||
0x6f,0x6e,0x66,0x69,0x67,0x5b,0x32,0x5d,0x3b,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,
|
||||
0x6d,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,
|
||||
0x44,0x20,0x70,0x70,0x74,0x65,0x78,0x5f,0x70,0x70,0x73,0x6d,0x70,0x3b,0x0a,0x0a,
|
||||
0x69,0x6e,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x32,0x20,0x74,0x65,
|
||||
0x78,0x63,0x6f,0x6f,0x72,0x64,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,
|
||||
0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,
|
||||
0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67,
|
||||
0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x68,0x69,0x67,0x68,0x70,0x20,0x76,
|
||||
0x65,0x63,0x33,0x20,0x61,0x63,0x65,0x73,0x28,0x68,0x69,0x67,0x68,0x70,0x20,0x76,
|
||||
0x65,0x63,0x33,0x20,0x78,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,
|
||||
0x75,0x72,0x6e,0x20,0x63,0x6c,0x61,0x6d,0x70,0x28,0x28,0x78,0x20,0x2a,0x20,0x28,
|
||||
0x28,0x78,0x20,0x2a,0x20,0x32,0x2e,0x35,0x30,0x39,0x39,0x39,0x39,0x39,0x39,0x30,
|
||||
0x34,0x36,0x33,0x32,0x35,0x36,0x38,0x33,0x35,0x39,0x33,0x37,0x35,0x29,0x20,0x2b,
|
||||
0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x30,0x32,0x39,0x39,0x39,0x39,0x39,0x39,
|
||||
0x39,0x33,0x32,0x39,0x34,0x34,0x37,0x37,0x34,0x36,0x32,0x37,0x36,0x38,0x35,0x35,
|
||||
0x34,0x36,0x38,0x37,0x35,0x29,0x29,0x29,0x20,0x2f,0x20,0x28,0x28,0x78,0x20,0x2a,
|
||||
0x20,0x28,0x28,0x78,0x20,0x2a,0x20,0x32,0x2e,0x34,0x33,0x30,0x30,0x30,0x30,0x30,
|
||||
0x36,0x36,0x37,0x35,0x37,0x32,0x30,0x32,0x31,0x34,0x38,0x34,0x33,0x37,0x35,0x29,
|
||||
0x20,0x2b,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x35,0x38,0x39,0x39,0x39,0x39,
|
||||
0x39,0x37,0x33,0x37,0x37,0x33,0x39,0x35,0x36,0x32,0x39,0x38,0x38,0x32,0x38,0x31,
|
||||
0x32,0x35,0x29,0x29,0x29,0x20,0x2b,0x20,0x76,0x65,0x63,0x33,0x28,0x30,0x2e,0x31,
|
||||
0x34,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x35,0x39,0x36,0x30,0x34,0x36,0x34,0x34,
|
||||
0x37,0x37,0x35,0x33,0x39,0x30,0x36,0x32,0x35,0x29,0x29,0x2c,0x20,0x76,0x65,0x63,
|
||||
0x33,0x28,0x30,0x2e,0x30,0x29,0x2c,0x20,0x76,0x65,0x63,0x33,0x28,0x31,0x2e,0x30,
|
||||
0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,
|
||||
0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,
|
||||
0x65,0x63,0x34,0x20,0x5f,0x35,0x37,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,
|
||||
0x65,0x28,0x70,0x70,0x74,0x65,0x78,0x5f,0x70,0x70,0x73,0x6d,0x70,0x2c,0x20,0x74,
|
||||
0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,
|
||||
0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x5f,0x36,0x31,0x20,0x3d,0x20,0x5f,
|
||||
0x35,0x37,0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,
|
||||
0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x5f,
|
||||
0x36,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,
|
||||
0x63,0x33,0x20,0x74,0x6f,0x6e,0x65,0x6d,0x61,0x70,0x70,0x65,0x64,0x20,0x3d,0x20,
|
||||
0x61,0x63,0x65,0x73,0x28,0x70,0x61,0x72,0x61,0x6d,0x29,0x3b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x69,0x66,0x20,0x28,0x70,0x6f,0x73,0x74,0x5f,0x70,0x72,0x6f,0x63,0x65,0x73,
|
||||
0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b,0x31,0x5d,0x2e,0x78,0x20,0x3e,0x20,
|
||||
0x30,0x2e,0x35,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x68,0x69,0x67,0x68,0x70,0x20,0x76,0x65,0x63,0x33,0x20,0x70,0x61,
|
||||
0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x5f,0x36,0x31,0x3b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x20,0x20,0x20,0x20,0x74,0x6f,0x6e,0x65,0x6d,0x61,0x70,0x70,0x65,0x64,0x20,
|
||||
0x3d,0x20,0x61,0x63,0x65,0x73,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,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,0x74,0x6f,
|
||||
0x6e,0x65,0x6d,0x61,0x70,0x70,0x65,0x64,0x20,0x3d,0x20,0x5f,0x36,0x31,0x3b,0x0a,
|
||||
0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,
|
||||
0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x70,0x6f,0x77,0x28,
|
||||
0x74,0x6f,0x6e,0x65,0x6d,0x61,0x70,0x70,0x65,0x64,0x2c,0x20,0x76,0x65,0x63,0x33,
|
||||
0x28,0x31,0x2e,0x30,0x20,0x2f,0x20,0x70,0x6f,0x73,0x74,0x5f,0x70,0x72,0x6f,0x63,
|
||||
0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x5b,0x30,0x5d,0x2e,0x77,0x29,
|
||||
0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
];
|
||||
/*
|
||||
#include <metal_stdlib>
|
||||
@ -209,11 +339,22 @@ vs_pp_source_metal_macos := u8.[
|
||||
0x0a,0x0a,0x00,
|
||||
];
|
||||
/*
|
||||
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct post_process_config
|
||||
{
|
||||
float exposure;
|
||||
float contrast;
|
||||
float saturation;
|
||||
float gamma;
|
||||
float tonemap;
|
||||
};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 frag_color [[color(0)]];
|
||||
@ -224,41 +365,116 @@ vs_pp_source_metal_macos := u8.[
|
||||
float2 texcoord [[user(locn0)]];
|
||||
};
|
||||
|
||||
fragment main0_out main0(main0_in in [[stage_in]], texture2d<float> pptex [[texture(0)]], sampler ppsmp [[sampler(0)]])
|
||||
static inline __attribute__((always_inline))
|
||||
float3 aces(thread const float3& x)
|
||||
{
|
||||
return fast::clamp((x * ((x * 2.5099999904632568359375) + float3(0.02999999932944774627685546875))) / ((x * ((x * 2.4300000667572021484375) + float3(0.589999973773956298828125))) + float3(0.14000000059604644775390625)), float3(0.0), float3(1.0));
|
||||
}
|
||||
|
||||
fragment main0_out main0(main0_in in [[stage_in]], constant post_process_config& _65 [[buffer(0)]], texture2d<float> pptex [[texture(0)]], sampler ppsmp [[sampler(0)]])
|
||||
{
|
||||
main0_out out = {};
|
||||
out.frag_color = pptex.sample(ppsmp, in.texcoord);
|
||||
float4 _57 = pptex.sample(ppsmp, in.texcoord);
|
||||
float3 _61 = _57.xyz;
|
||||
float3 param = _61;
|
||||
float3 tonemapped = aces(param);
|
||||
if (_65.tonemap > 0.5)
|
||||
{
|
||||
float3 param_1 = _61;
|
||||
tonemapped = aces(param_1);
|
||||
}
|
||||
else
|
||||
{
|
||||
tonemapped = _61;
|
||||
}
|
||||
out.frag_color = float4(powr(tonemapped, float3(1.0 / _65.gamma)), 1.0);
|
||||
return out;
|
||||
}
|
||||
|
||||
*/
|
||||
fs_pp_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,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,0x32,0x20,
|
||||
0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,
|
||||
0x6c,0x6f,0x63,0x6e,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,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,
|
||||
0x69,0x6e,0x20,0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,
|
||||
0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x32,0x64,0x3c,0x66,0x6c,0x6f,0x61,0x74,
|
||||
0x3e,0x20,0x70,0x70,0x74,0x65,0x78,0x20,0x5b,0x5b,0x74,0x65,0x78,0x74,0x75,0x72,
|
||||
0x65,0x28,0x30,0x29,0x5d,0x5d,0x2c,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x20,
|
||||
0x70,0x70,0x73,0x6d,0x70,0x20,0x5b,0x5b,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x28,
|
||||
0x30,0x29,0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,
|
||||
0x30,0x5f,0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,
|
||||
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,0x70,0x6f,0x73,0x74,0x5f,0x70,0x72,0x6f,
|
||||
0x63,0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x0a,0x7b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x65,0x78,0x70,0x6f,0x73,0x75,0x72,0x65,
|
||||
0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x63,0x6f,0x6e,0x74,
|
||||
0x72,0x61,0x73,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,
|
||||
0x73,0x61,0x74,0x75,0x72,0x61,0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,
|
||||
0x66,0x6c,0x6f,0x61,0x74,0x20,0x67,0x61,0x6d,0x6d,0x61,0x3b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x74,0x6f,0x6e,0x65,0x6d,0x61,0x70,0x3b,0x0a,
|
||||
0x7d,0x3b,0x0a,0x0a,0x73,0x74,0x72,0x75,0x63,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,
|
||||
0x5f,0x6f,0x75,0x74,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
||||
0x34,0x20,0x66,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,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,0x32,0x20,0x74,0x65,0x78,0x63,
|
||||
0x6f,0x6f,0x72,0x64,0x20,0x5b,0x5b,0x75,0x73,0x65,0x72,0x28,0x6c,0x6f,0x63,0x6e,
|
||||
0x30,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,0x20,0x61,0x63,
|
||||
0x65,0x73,0x28,0x74,0x68,0x72,0x65,0x61,0x64,0x20,0x63,0x6f,0x6e,0x73,0x74,0x20,
|
||||
0x66,0x6c,0x6f,0x61,0x74,0x33,0x26,0x20,0x78,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x66,0x61,0x73,0x74,0x3a,0x3a,0x63,0x6c,
|
||||
0x61,0x6d,0x70,0x28,0x28,0x78,0x20,0x2a,0x20,0x28,0x28,0x78,0x20,0x2a,0x20,0x32,
|
||||
0x2e,0x35,0x30,0x39,0x39,0x39,0x39,0x39,0x39,0x30,0x34,0x36,0x33,0x32,0x35,0x36,
|
||||
0x38,0x33,0x35,0x39,0x33,0x37,0x35,0x29,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,
|
||||
0x33,0x28,0x30,0x2e,0x30,0x32,0x39,0x39,0x39,0x39,0x39,0x39,0x39,0x33,0x32,0x39,
|
||||
0x34,0x34,0x37,0x37,0x34,0x36,0x32,0x37,0x36,0x38,0x35,0x35,0x34,0x36,0x38,0x37,
|
||||
0x35,0x29,0x29,0x29,0x20,0x2f,0x20,0x28,0x28,0x78,0x20,0x2a,0x20,0x28,0x28,0x78,
|
||||
0x20,0x2a,0x20,0x32,0x2e,0x34,0x33,0x30,0x30,0x30,0x30,0x30,0x36,0x36,0x37,0x35,
|
||||
0x37,0x32,0x30,0x32,0x31,0x34,0x38,0x34,0x33,0x37,0x35,0x29,0x20,0x2b,0x20,0x66,
|
||||
0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x35,0x38,0x39,0x39,0x39,0x39,0x39,0x37,
|
||||
0x33,0x37,0x37,0x33,0x39,0x35,0x36,0x32,0x39,0x38,0x38,0x32,0x38,0x31,0x32,0x35,
|
||||
0x29,0x29,0x29,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x28,0x30,0x2e,0x31,
|
||||
0x34,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x35,0x39,0x36,0x30,0x34,0x36,0x34,0x34,
|
||||
0x37,0x37,0x35,0x33,0x39,0x30,0x36,0x32,0x35,0x29,0x29,0x2c,0x20,0x66,0x6c,0x6f,
|
||||
0x61,0x74,0x33,0x28,0x30,0x2e,0x30,0x29,0x2c,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,
|
||||
0x28,0x31,0x2e,0x30,0x29,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x66,0x72,0x61,0x67,0x6d,
|
||||
0x65,0x6e,0x74,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x6f,0x75,0x74,0x20,0x6d,0x61,
|
||||
0x69,0x6e,0x30,0x28,0x6d,0x61,0x69,0x6e,0x30,0x5f,0x69,0x6e,0x20,0x69,0x6e,0x20,
|
||||
0x5b,0x5b,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x5d,0x5d,0x2c,0x20,0x63,0x6f,
|
||||
0x6e,0x73,0x74,0x61,0x6e,0x74,0x20,0x70,0x6f,0x73,0x74,0x5f,0x70,0x72,0x6f,0x63,
|
||||
0x65,0x73,0x73,0x5f,0x63,0x6f,0x6e,0x66,0x69,0x67,0x26,0x20,0x5f,0x36,0x35,0x20,
|
||||
0x5b,0x5b,0x62,0x75,0x66,0x66,0x65,0x72,0x28,0x30,0x29,0x5d,0x5d,0x2c,0x20,0x74,
|
||||
0x65,0x78,0x74,0x75,0x72,0x65,0x32,0x64,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x3e,0x20,
|
||||
0x70,0x70,0x74,0x65,0x78,0x20,0x5b,0x5b,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,
|
||||
0x30,0x29,0x5d,0x5d,0x2c,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x20,0x70,0x70,
|
||||
0x73,0x6d,0x70,0x20,0x5b,0x5b,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x28,0x30,0x29,
|
||||
0x5d,0x5d,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x6d,0x61,0x69,0x6e,0x30,0x5f,
|
||||
0x6f,0x75,0x74,0x20,0x6f,0x75,0x74,0x20,0x3d,0x20,0x7b,0x7d,0x3b,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x20,0x5f,0x35,0x37,0x20,0x3d,0x20,0x70,
|
||||
0x70,0x74,0x65,0x78,0x2e,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x70,0x70,0x73,0x6d,
|
||||
0x70,0x2c,0x20,0x69,0x6e,0x2e,0x74,0x65,0x78,0x63,0x6f,0x6f,0x72,0x64,0x29,0x3b,
|
||||
0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x5f,0x36,0x31,0x20,
|
||||
0x3d,0x20,0x5f,0x35,0x37,0x2e,0x78,0x79,0x7a,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,
|
||||
0x6c,0x6f,0x61,0x74,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x5f,0x36,
|
||||
0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x74,0x6f,
|
||||
0x6e,0x65,0x6d,0x61,0x70,0x70,0x65,0x64,0x20,0x3d,0x20,0x61,0x63,0x65,0x73,0x28,
|
||||
0x70,0x61,0x72,0x61,0x6d,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,
|
||||
0x5f,0x36,0x35,0x2e,0x74,0x6f,0x6e,0x65,0x6d,0x61,0x70,0x20,0x3e,0x20,0x30,0x2e,
|
||||
0x35,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
|
||||
0x20,0x66,0x6c,0x6f,0x61,0x74,0x33,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,
|
||||
0x3d,0x20,0x5f,0x36,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x74,
|
||||
0x6f,0x6e,0x65,0x6d,0x61,0x70,0x70,0x65,0x64,0x20,0x3d,0x20,0x61,0x63,0x65,0x73,
|
||||
0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,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,0x74,0x6f,0x6e,0x65,0x6d,0x61,0x70,0x70,
|
||||
0x65,0x64,0x20,0x3d,0x20,0x5f,0x36,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,
|
||||
0x20,0x20,0x20,0x20,0x6f,0x75,0x74,0x2e,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,
|
||||
0x6f,0x72,0x20,0x3d,0x20,0x70,0x70,0x74,0x65,0x78,0x2e,0x73,0x61,0x6d,0x70,0x6c,
|
||||
0x65,0x28,0x70,0x70,0x73,0x6d,0x70,0x2c,0x20,0x69,0x6e,0x2e,0x74,0x65,0x78,0x63,
|
||||
0x6f,0x6f,0x72,0x64,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,
|
||||
0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
0x6f,0x72,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x70,0x6f,0x77,0x72,
|
||||
0x28,0x74,0x6f,0x6e,0x65,0x6d,0x61,0x70,0x70,0x65,0x64,0x2c,0x20,0x66,0x6c,0x6f,
|
||||
0x61,0x74,0x33,0x28,0x31,0x2e,0x30,0x20,0x2f,0x20,0x5f,0x36,0x35,0x2e,0x67,0x61,
|
||||
0x6d,0x6d,0x61,0x29,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,
|
||||
0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x0a,
|
||||
0x00,
|
||||
];
|
||||
postprocess_shader_desc :: (backend: sg_backend) -> sg_shader_desc {
|
||||
desc: sg_shader_desc;
|
||||
@ -273,6 +489,12 @@ postprocess_shader_desc :: (backend: sg_backend) -> sg_shader_desc {
|
||||
desc.attrs[0].glsl_name = "position";
|
||||
desc.attrs[1].base_type = .FLOAT;
|
||||
desc.attrs[1].glsl_name = "uv";
|
||||
desc.uniform_blocks[0].stage = .FRAGMENT;
|
||||
desc.uniform_blocks[0].layout = .STD140;
|
||||
desc.uniform_blocks[0].size = 32;
|
||||
desc.uniform_blocks[0].glsl_uniforms[0].type = .FLOAT4;
|
||||
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 2;
|
||||
desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "post_process_config";
|
||||
desc.images[0].stage = .FRAGMENT;
|
||||
desc.images[0].multisampled = false;
|
||||
desc.images[0].image_type = ._2D;
|
||||
@ -292,6 +514,12 @@ postprocess_shader_desc :: (backend: sg_backend) -> sg_shader_desc {
|
||||
desc.attrs[0].glsl_name = "position";
|
||||
desc.attrs[1].base_type = .FLOAT;
|
||||
desc.attrs[1].glsl_name = "uv";
|
||||
desc.uniform_blocks[0].stage = .FRAGMENT;
|
||||
desc.uniform_blocks[0].layout = .STD140;
|
||||
desc.uniform_blocks[0].size = 32;
|
||||
desc.uniform_blocks[0].glsl_uniforms[0].type = .FLOAT4;
|
||||
desc.uniform_blocks[0].glsl_uniforms[0].array_count = 2;
|
||||
desc.uniform_blocks[0].glsl_uniforms[0].glsl_name = "post_process_config";
|
||||
desc.images[0].stage = .FRAGMENT;
|
||||
desc.images[0].multisampled = false;
|
||||
desc.images[0].image_type = ._2D;
|
||||
@ -309,6 +537,10 @@ postprocess_shader_desc :: (backend: sg_backend) -> sg_shader_desc {
|
||||
desc.fragment_func.entry = "main0";
|
||||
desc.attrs[0].base_type = .FLOAT;
|
||||
desc.attrs[1].base_type = .FLOAT;
|
||||
desc.uniform_blocks[0].stage = .FRAGMENT;
|
||||
desc.uniform_blocks[0].layout = .STD140;
|
||||
desc.uniform_blocks[0].size = 32;
|
||||
desc.uniform_blocks[0].msl_buffer_n = 0;
|
||||
desc.images[0].stage = .FRAGMENT;
|
||||
desc.images[0].multisampled = false;
|
||||
desc.images[0].image_type = ._2D;
|
||||
|
||||
@ -182,7 +182,7 @@ vs_sky_source_glsl430 := u8.[
|
||||
{
|
||||
vec3 param = normalize(pos.xyz);
|
||||
vec3 param_1 = _178.sunPosition;
|
||||
frag_color = vec4(sky(param, param_1), 1.0);
|
||||
frag_color = vec4(sky(param, param_1) * _178.skyIntensity, 1.0);
|
||||
}
|
||||
|
||||
*/
|
||||
@ -423,8 +423,9 @@ fs_sky_source_glsl430 := u8.[
|
||||
0x31,0x20,0x3d,0x20,0x5f,0x31,0x37,0x38,0x2e,0x73,0x75,0x6e,0x50,0x6f,0x73,0x69,
|
||||
0x74,0x69,0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,
|
||||
0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x73,0x6b,0x79,0x28,
|
||||
0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x29,0x2c,
|
||||
0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x29,0x20,
|
||||
0x2a,0x20,0x5f,0x31,0x37,0x38,0x2e,0x73,0x6b,0x79,0x49,0x6e,0x74,0x65,0x6e,0x73,
|
||||
0x69,0x74,0x79,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
];
|
||||
/*
|
||||
#version 300 es
|
||||
@ -556,7 +557,7 @@ vs_sky_source_glsl300es := u8.[
|
||||
{
|
||||
highp vec3 param = normalize(pos.xyz);
|
||||
highp vec3 param_1 = _178.sunPosition;
|
||||
frag_color = vec4(sky(param, param_1), 1.0);
|
||||
frag_color = vec4(sky(param, param_1) * _178.skyIntensity, 1.0);
|
||||
}
|
||||
|
||||
*/
|
||||
@ -818,8 +819,9 @@ fs_sky_source_glsl300es := u8.[
|
||||
0x3d,0x20,0x5f,0x31,0x37,0x38,0x2e,0x73,0x75,0x6e,0x50,0x6f,0x73,0x69,0x74,0x69,
|
||||
0x6f,0x6e,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,
|
||||
0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x73,0x6b,0x79,0x28,0x70,0x61,
|
||||
0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x29,0x2c,0x20,0x31,
|
||||
0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x29,0x20,0x2a,0x20,
|
||||
0x5f,0x31,0x37,0x38,0x2e,0x73,0x6b,0x79,0x49,0x6e,0x74,0x65,0x6e,0x73,0x69,0x74,
|
||||
0x79,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
|
||||
];
|
||||
/*
|
||||
#include <metal_stdlib>
|
||||
@ -996,7 +998,7 @@ vs_sky_source_metal_macos := u8.[
|
||||
main0_out out = {};
|
||||
float3 param = fast::normalize(in.pos.xyz);
|
||||
float3 param_1 = float3(_178.sunPosition);
|
||||
out.frag_color = float4(sky(param, param_1, _178), 1.0);
|
||||
out.frag_color = float4(sky(param, param_1, _178) * _178.skyIntensity, 1.0);
|
||||
return out;
|
||||
}
|
||||
|
||||
@ -1281,9 +1283,10 @@ fs_sky_source_metal_macos := u8.[
|
||||
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,0x73,0x6b,
|
||||
0x79,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,
|
||||
0x2c,0x20,0x5f,0x31,0x37,0x38,0x29,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,
|
||||
0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,0x7d,
|
||||
0x0a,0x0a,0x00,
|
||||
0x2c,0x20,0x5f,0x31,0x37,0x38,0x29,0x20,0x2a,0x20,0x5f,0x31,0x37,0x38,0x2e,0x73,
|
||||
0x6b,0x79,0x49,0x6e,0x74,0x65,0x6e,0x73,0x69,0x74,0x79,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,
|
||||
];
|
||||
sky_shader_desc :: (backend: sg_backend) -> sg_shader_desc {
|
||||
desc: sg_shader_desc;
|
||||
|
||||
@ -17,9 +17,35 @@ out vec4 frag_color;
|
||||
layout(binding = 0) uniform texture2D pptex;
|
||||
layout(binding = 0) uniform sampler ppsmp;
|
||||
|
||||
layout(binding=0) uniform post_process_config {
|
||||
float exposure;
|
||||
float contrast;
|
||||
float saturation;
|
||||
float gamma;
|
||||
float tonemap;
|
||||
};
|
||||
|
||||
vec3 aces(vec3 x) {
|
||||
const float a = 2.51;
|
||||
const float b = 0.03;
|
||||
const float c = 2.43;
|
||||
const float d = 0.59;
|
||||
const float e = 0.14;
|
||||
return clamp((x * (a * x + b)) / (x * (c * x + d) + e), 0.0, 1.0);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec4 sampled = texture(sampler2D(pptex, ppsmp), texcoord.xy);
|
||||
frag_color = sampled;
|
||||
vec3 tonemapped = aces(sampled.xyz);
|
||||
if(tonemap > 0.5) {
|
||||
tonemapped = aces(sampled.xyz);
|
||||
} else {
|
||||
tonemapped = sampled.xyz;
|
||||
}
|
||||
// tonemapped *= pow(2.0, exposure);
|
||||
vec3 gammaCorrected = pow(tonemapped, vec3(1.0/gamma));
|
||||
|
||||
frag_color = vec4(gammaCorrected, 1.0);
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@ -114,7 +114,7 @@ vec3 sky(vec3 skypos, vec3 sunpos) {
|
||||
|
||||
void main() {
|
||||
vec3 dir = normalize(pos.xyz);
|
||||
vec3 color = sky(dir, sunPosition);
|
||||
vec3 color = skyIntensity * sky(dir, sunPosition);
|
||||
frag_color = vec4(color, 1.0);
|
||||
}
|
||||
@end
|
||||
|
||||
@ -193,10 +193,8 @@ material_from_rgba :: (r: u8, g: u8, b: u8, a: u8) -> Material {
|
||||
return mat;
|
||||
}
|
||||
|
||||
draw_trile_picker :: (theme: *GR.Overall_Theme) {
|
||||
r := GR.get_rect(ui_w(85,85), ui_h(5,0), ui_w(15, 15), ui_h(95, 0));
|
||||
ui_add_mouse_occluder(r);
|
||||
draw_bg_rectangle(r, theme);
|
||||
draw_trile_picker :: (r_in: GR.Rect, theme: *GR.Overall_Theme) {
|
||||
r := r_in;
|
||||
tpt := get_trile_table_ptr();
|
||||
r.h = ui_h(4,4);
|
||||
count := 0;
|
||||
|
||||
@ -4,18 +4,19 @@ Pool :: #import "Pool";
|
||||
|
||||
Current_World :: struct {
|
||||
world : *World;
|
||||
pool : Pool.Pool; // A memory pool to allocate stuff for the lifetime of this level being active.
|
||||
pool : Pool.Pool; // A memory pool to allocate stuff for the lifetime of this level being active. For example RDMs.
|
||||
valid : bool = false;
|
||||
};
|
||||
|
||||
current_world : Current_World;
|
||||
world_table : Table(string, World);
|
||||
|
||||
#scope_export
|
||||
#scope_export
|
||||
|
||||
nworld :: (name: string) {
|
||||
w : World;
|
||||
table_set(*world_table, name, w);
|
||||
w.name = sprint("%", name);
|
||||
table_set(*world_table, w.name, w);
|
||||
} @Command;
|
||||
|
||||
lworld :: (name: string) {
|
||||
@ -147,3 +148,16 @@ update_image_from_ground :: (world: *World, img: *sg_image) {
|
||||
|
||||
sg_update_image(img, *imgdata);
|
||||
}
|
||||
|
||||
draw_world_picker :: (r_in: GR.Rect, theme: *GR.Overall_Theme) {
|
||||
r := r_in;
|
||||
r.h = ui_h(4,4);
|
||||
count := 0;
|
||||
for v : world_table {
|
||||
if GR.button(r, v.name, *t_button_selectable(theme, current_world.valid && current_world.world.name == v.name), count) {
|
||||
lworld(v.name);
|
||||
}
|
||||
count += 1;
|
||||
r.y += r.h;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user