Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ void main()
return SDL_APP_CONTINUE;
}

/**
* @brief Advance the UI frame, present interactive editors for triangle vertices and shader source, and apply
* edits.
*
* Presents a NodeEditor with draggable 3D position editors for each vertex and a SourceEditor with a multiline
* shader text editor. If a vertex position is modified, the vertex buffer is updated with the new vertex data.
* If the shader source is modified, the pipeline's vertex shader source is updated.
*
* @return SDL_AppResult SDL_APP_CONTINUE to indicate the application should continue running.
*/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: method 'tick' can be made static [readability-convert-member-functions-to-static]

Suggested change
*/
static SDL_AppResult tick()

SDL_AppResult tick()
{
ImGui_ImplSDLGPU3_NewFrame();
Expand Down Expand Up @@ -151,6 +161,16 @@ void main()
return SDL_APP_CONTINUE;
}

/**
* @brief Render ImGui draw data and the application's triangle to the GPU, then present the swapchain texture.
*
* Prepares ImGui draw data, submits the graphics pipeline, acquires a GPU command buffer and the current
* swapchain texture, records rendering commands (including binding the pipeline and vertex buffer and issuing
* a draw call), executes ImGui rendering into the render pass, and submits the command buffer for presentation.
* If no swapchain texture is available the function still submits the command buffer and continues.
*
* @return SDL_AppResult `SDL_APP_CONTINUE` to continue the application main loop.
*/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: method 'draw' can be made static [readability-convert-member-functions-to-static]

Suggested change
*/
static SDL_AppResult draw()

SDL_AppResult draw()
{
ImGui::Render();
Expand Down Expand Up @@ -210,14 +230,12 @@ void main()
}

/**
* @brief Advance the application by one frame: update UI, apply vertex edits and live shader recompilation, render,
* and submit GPU work.
* @brief Advance the application one iteration by performing per-frame updates and rendering.
*
* Processes ImGui frames, uploads vertex data when edited, recompiles and replaces the vertex shader and graphics
* pipeline on shader edits, records a render pass that draws the triangle and ImGui draw lists, and submits the GPU
* command buffer for presentation.
* Performs per-frame UI and state updates; if those updates indicate continuation, executes rendering and submits
* GPU work for presentation.
*
* @return `SDL_APP_CONTINUE` to continue the main loop.
* @return `SDL_APP_CONTINUE` to continue the main loop, or another `SDL_AppResult` to terminate.
*/
virtual SDL_AppResult iterate() override
{
Expand Down