rm logs debug

This commit is contained in:
Clément Le Bihan
2021-05-21 17:09:19 +02:00
parent ace448763e
commit 09b4c8cb56
+61 -64
View File
@@ -18,94 +18,91 @@
int main() int main()
{ {
SetTraceLogLevel(LOG_WARNING);
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
const int screenWidth = 800; const int screenWidth = 800;
const int screenHeight = 450; const int screenHeight = 450;
RAY::Vector2 ballPosition = { (float)screenWidth/2, (float)screenHeight/2 }; RAY::Vector2 ballPosition = {(float)screenWidth / 2, (float)screenHeight / 2};
RAY::Window &window = RAY::Window::getInstance(screenWidth, screenHeight, "Ta mère en slip", FLAG_WINDOW_RESIZABLE); RAY::Window &window = RAY::Window::getInstance(screenWidth, screenHeight, "Ta mère en slip", FLAG_WINDOW_RESIZABLE);
RAY::Camera::Camera3D camera(RAY::Vector3{30.0f, 20.0f, 30.0f}, RAY::Camera::Camera3D camera(RAY::Vector3{30.0f, 20.0f, 30.0f},
RAY::Vector3{0.0f, 0.0f, 0.0f}, RAY::Vector3{0.0f, 0.0f, 0.0f},
RAY::Vector3{0.0f, 1.0f, 0.0f }, RAY::Vector3{0.0f, 1.0f, 0.0f},
70.0, 70.0,
CAMERA_PERSPECTIVE); CAMERA_PERSPECTIVE);
RAY::Drawables::Drawables3D::Grid grid(10, 5.0f); RAY::Drawables::Drawables3D::Grid grid(10, 5.0f);
RAY::Drawables::Drawables3D::Cube cube({0}, {0}, {0}); RAY::Drawables::Drawables3D::Cube cube({0}, {0}, {0});
// Specify the amount of blocks in each direction // Specify the amount of blocks in each direction
const int numBlocks = 15; const int numBlocks = 15;
window.setFPS(60); window.setFPS(60);
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
// Main game loop // Main game loop
while (!window.shouldClose()) // Detect window close button or ESC key while (!window.shouldClose()) // Detect window close button or ESC key
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
double time = GetTime(); double time = GetTime();
// Calculate time scale for cube position and size // Calculate time scale for cube position and size
float scale = (2.0f + (float)sin(time))*0.7f; float scale = (2.0f + (float)sin(time)) * 0.7f;
// Move camera around the scene // Move camera around the scene
double cameraTime = time*0.3; double cameraTime = time * 0.3;
camera.setPosition({(float)cos(cameraTime)*40.0f, 20.0f, (float)sin(cameraTime)*40.0f}); camera.setPosition({(float)cos(cameraTime) * 40.0f, 20.0f, (float)sin(cameraTime) * 40.0f});
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
window.beginDrawing(); window.beginDrawing();
window.clear(RAYWHITE); window.clear(RAYWHITE);
window.beginMode3D(camera); window.beginMode3D(camera);
window.draw(grid); window.draw(grid);
for (int x = 0; x < numBlocks; x++) for (int x = 0; x < numBlocks; x++) {
{ for (int y = 0; y < numBlocks; y++) {
for (int y = 0; y < numBlocks; y++) for (int z = 0; z < numBlocks; z++) {
{ // Scale of the blocks depends on x/y/z positions
for (int z = 0; z < numBlocks; z++) float blockScale = (x + y + z) / 30.0f;
{
// Scale of the blocks depends on x/y/z positions
float blockScale = (x + y + z)/30.0f;
// Scatter makes the waving effect by adding blockScale over time // Scatter makes the waving effect by adding blockScale over time
float scatter = sinf(blockScale*20.0f + (float)(time*4.0f)); float scatter = sinf(blockScale * 20.0f + (float)(time * 4.0f));
// Calculate the cube position // Calculate the cube position
cube.setPosition((RAY::Vector3){ cube.setPosition((RAY::Vector3){
(float)(x - numBlocks/2)*(scale*3.0f) + scatter, static_cast<float>(x - numBlocks / 2) * (scale * 3.0f) + scatter,
(float)(y - numBlocks/2)*(scale*2.0f) + scatter, static_cast<float>(y - numBlocks / 2) * (scale * 2.0f) + scatter,
(float)(z - numBlocks/2)*(scale*3.0f) + scatter static_cast<float>(z - numBlocks / 2) * (scale * 3.0f) + scatter
}); });
// Pick a color with a hue depending on cube position for the rainbow color effect // Pick a color with a hue depending on cube position for the rainbow color effect
cube.setColor(RAY::Color((float)(((x + y + z)*18)%360), 0.75f, 0.9f)); cube.setColor(RAY::Color(static_cast<float>(((x + y + z) * 18) % 360), 0.75f, 0.9f));
// Calculate cube size // Calculate cube size
float cubeSize = (2.4f - scale)*blockScale; float cubeSize = (2.4f - scale) * blockScale;
cube.setDimensions({cubeSize, cubeSize, cubeSize}); cube.setDimensions({cubeSize, cubeSize, cubeSize});
// And finally, draw the cube! // And finally, draw the cube!
window.draw(cube); window.draw(cube);
} }
} }
} }
window.endMode3D(); window.endMode3D();
window.endDrawing(); window.endDrawing();
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
} }
// De-Initialization // De-Initialization
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
window.close(); // Close window and OpenGL context window.close(); // Close window and OpenGL context
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
return 0; return 0;
} }