tinyrenderers
tinyrenderers copied to clipboard
Unnecessary Calculations Performed in draw_frame
The code in ChessSet.cpp below can be safely moved into the init function, and doesn't need to be calculated every frame
g_chess_board_1_solid.SetColor(float3(0.23f));
g_chess_board_2_solid.SetColor(float3(0.88f));
g_chess_pieces_1_solid.SetColor(float3(0.85f, 0.3f, 0.3f));
g_chess_pieces_2_solid.SetColor(float3(0.4f, 0.4f, 0.8f));
float3 eye = float3(0, 7, 12);
float3 look_at = float3(0, 0, 0);
g_camera.LookAt(eye, look_at);
g_camera.Perspective(65.0f, (float)g_window_width / (float)g_window_height);
g_chess_board_1_solid.SetView(g_camera);
g_chess_board_2_solid.SetView(g_camera);
g_chess_pieces_1_solid.SetView(g_camera);
g_chess_pieces_2_solid.SetView(g_camera);
g_chess_pieces_1_wireframe.SetView(g_camera);
g_chess_pieces_2_wireframe.SetView(g_camera);
Also, i think the tr_queue_wait_idle(g_renderer->graphics_queue); can go out of draw_frame and below (right before the call to destroy the renderer)
edit: I lied. Works fine with Vulkan, but not with DX12