Browse Source

Code reorganization on example

pull/1357/head
raysan5 4 years ago
parent
commit
ebdeab7e25
1 changed files with 9 additions and 10 deletions
  1. +9
    -10
      examples/shaders/shaders_raymarching.c

+ 9
- 10
examples/shaders/shaders_raymarching.c View File

@ -59,16 +59,6 @@ int main(void)
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Check if screen is resized
//----------------------------------------------------------------------------------
if(IsWindowResized())
{
screenWidth = GetScreenWidth();
screenHeight = GetScreenHeight();
float resolution[2] = { (float)screenWidth, (float)screenHeight };
SetShaderValue(shader, resolutionLoc, resolution, UNIFORM_VEC2);
}
// Update
//----------------------------------------------------------------------------------
UpdateCamera(&camera); // Update camera
@ -83,6 +73,15 @@ int main(void)
SetShaderValue(shader, viewEyeLoc, cameraPos, UNIFORM_VEC3);
SetShaderValue(shader, viewCenterLoc, cameraTarget, UNIFORM_VEC3);
SetShaderValue(shader, runTimeLoc, &runTime, UNIFORM_FLOAT);
// Check if screen is resized
if (IsWindowResized())
{
screenWidth = GetScreenWidth();
screenHeight = GetScreenHeight();
float resolution[2] = { (float)screenWidth, (float)screenHeight };
SetShaderValue(shader, resolutionLoc, resolution, UNIFORM_VEC2);
}
//----------------------------------------------------------------------------------
// Draw

Loading…
Cancel
Save