@@ -162,11 +162,6 @@ int main(int argc, char **argv) {
162162 case SDL_EVENT_WINDOW_CLOSE_REQUESTED :
163163 running = false;
164164 break ;
165- case SDL_EVENT_KEY_DOWN :
166- if (event .key .key == SDLK_ESCAPE ) {
167- running = false;
168- }
169- break ;
170165 default :
171166 break ;
172167 }
@@ -195,11 +190,11 @@ int main(int argc, char **argv) {
195190 continue ;
196191 }
197192
198- float4x4 mv = float4x4_rotation (angleX , float3_new (1.f , 0.f , 0.f ));
199- mv = float4x4_mul (float4x4_rotation (angleY , float3_new (0.f , 1.f , 0.f )), mv );
200- mv = float4x4_mul (float4x4_translation (float3_new (0.f , 0.f , -2.5f )), mv );
201- const float4x4 proj = float4x4_perspective (45.f , (float ) swapchain .size .w / (float ) swapchain .size .h , 0.01f , 100.f );
202- const float4x4 matrixFinal = float4x4_mul (proj , mv );
193+ float4x4 modelView = float4x4_rotation (angleX , float3_new (1.f , 0.f , 0.f ));
194+ modelView = float4x4_mul (float4x4_rotation (angleY , float3_new (0.f , 1.f , 0.f )), modelView );
195+ modelView = float4x4_mul (float4x4_translation (float3_new (0.f , 0.f , -2.5f )), modelView );
196+ const float4x4 projection = float4x4_perspective (45.f , (float ) swapchain .size .w / (float ) swapchain .size .h , 0.01f , 100.f );
197+ const float4x4 modelViewProjection = float4x4_mul (projection , modelView );
203198
204199 SDL_GPUColorTargetInfo colorTarget = {
205200 .texture = swapchain .texture ,
@@ -217,7 +212,7 @@ int main(int argc, char **argv) {
217212 .buffer = vertexBuffer ,
218213 .offset = 0 ,
219214 }, 1 );
220- $ (cmd , pushVertexUniformData , 0 , matrixFinal .f , sizeof (matrixFinal ));
215+ $ (cmd , pushVertexUniformData , 0 , modelViewProjection .f , sizeof (modelViewProjection ));
221216 $ (renderPass , drawPrimitives , (Uint32 ) SDL_arraysize (vertex_data ), 1 , 0 , 0 );
222217 release (renderPass );
223218
0 commit comments