diff --git a/src/editor/level_editor.jai b/src/editor/level_editor.jai index 8296b42..5e86a68 100644 --- a/src/editor/level_editor.jai +++ b/src/editor/level_editor.jai @@ -379,9 +379,13 @@ draw_world_triles :: (cam: *Camera, world: *World) { } draw_level_editor :: () { - cam := get_level_editor_camera(); - draw_sky(*get_level_editor_camera(), *world.conf); - draw_world_triles(*cam, *world); + camtask := Rendering_Task_Set_Camera.{type = .SET_CAMERA, camera = get_level_editor_camera()}; + add_rendering_task(camtask); + skytask := Rendering_Task_Sky.{type = .SKY, worldConfig = *world.conf}; + add_rendering_task(skytask); + groundtask := Rendering_Task_Ground.{type = .GROUND, world = *world}; + add_rendering_task(groundtask); + // draw_world_triles(*cam, *world); } draw_level_editor_ui :: (theme: *GR.Overall_Theme) { diff --git a/src/editor/trile_editor.jai b/src/editor/trile_editor.jai index 7d4a303..29bd1f3 100644 --- a/src/editor/trile_editor.jai +++ b/src/editor/trile_editor.jai @@ -254,11 +254,12 @@ draw_material_tab :: (theme: *GR.Overall_Theme, area: GR.Rect) { draw_trile_editor :: () { - draw_sky(*get_trile_editor_camera()); + draw_trile(); } draw_trile :: () { + return; // @ToDo: Implement this using the new drawing commands. if is_in_reflection_pass then return; // We don't want to double update the buffer. if editor_current_trile == null then return; diff --git a/src/main.jai b/src/main.jai index 9b7dd09..58d447a 100644 --- a/src/main.jai +++ b/src/main.jai @@ -138,30 +138,16 @@ frame :: () { GR.getrect_handle_event(event); } - sgl_defaults(); - sgl_matrix_mode_projection(); - sgl_ortho(0.0, sapp_widthf(), sapp_heightf(), 0.0, -1.0, +1.0); tick_ui(); // This populates our render task queue. if !in_editor_view then game_draw(); + ui_clear_mouse_occluders(); + ui_pass(); + draw_editor(); render(); - // sg_begin_pass(*(sg_pass.{ action = state.pass_action_clear, attachments = gPipelines.plane.attachments})); - // is_in_reflection_pass = true; - // draw_editor(); - // is_in_reflection_pass = false; - // sg_end_pass(); - - // sg_begin_pass(*(sg_pass.{ action = state.pass_action_clear, swapchain = cast,force(sg_swapchain) sglue_swapchain() })); - // draw_editor(); - // if !in_editor_view then game_draw(); - // ui_clear_mouse_occluders(); - // ui_pass(); - // sg_end_pass(); - // sg_commit(); - input_per_frame_event_and_flag_update(); #if MEM_DEBUG { memory_visualizer_per_frame_update(); diff --git a/src/rendering/arbtri.jai b/src/rendering/arbtri.jai index dc2ccf2..c51eea4 100644 --- a/src/rendering/arbtri.jai +++ b/src/rendering/arbtri.jai @@ -110,7 +110,6 @@ layer : s32 = 0; flush_arb_commands :: () { sfons_flush(state.fons); // All the text has been drawn, now flush it to the atlas. - layer = 0; if debug_arb_flush then print(" --- !BEGIN FLUSH! ---- \n"); for arbTriState.command_list { diff --git a/src/rendering/backend_sokol.jai b/src/rendering/backend_sokol.jai index debee8e..a1e1a35 100644 --- a/src/rendering/backend_sokol.jai +++ b/src/rendering/backend_sokol.jai @@ -72,8 +72,18 @@ backend_process_command_buckets :: () { for render_command_buckets.main { backend_handle_command(it); } + // 3.2 Draw the UI. @ToDo: This should probably happen after post processing once we have that. + // Also, it's kind of stupid that this has it's own command system. It should be moved to using the + // same backend commands we are using for other rendering. + sgl_defaults(); + sgl_matrix_mode_projection(); + sgl_ortho(0.0, sapp_widthf(), sapp_heightf(), 0.0, -1.0, +1.0); + arb_tri_flush(); + + // End the main pass sg_end_pass(); + sg_commit(); array_reset_keeping_memory(*render_command_buckets.setup); diff --git a/src/ui/ui.jai b/src/ui/ui.jai index 6a0df12..768761d 100644 --- a/src/ui/ui.jai +++ b/src/ui/ui.jai @@ -405,5 +405,4 @@ render_ui :: () { ui_pass :: () { render_ui(); // Generates commands that are handled in arb_tri_flush - arb_tri_flush(); }