78 lines
2.4 KiB
C++
78 lines
2.4 KiB
C++
/* ************************************************************************** */
|
|
/* */
|
|
/* / ) */
|
|
/* main.cpp (\__/) ( ( */
|
|
/* ) ( ) ) */
|
|
/* By: lejulien <leo.julien.42@gmail.com> ={ }= / / */
|
|
/* ) `-------/ / */
|
|
/* Created: 2023/01/09 12:17:58 by lejulien ( / */
|
|
/* Updated: 2023/01/14 17:12:27 by lejulien \ | */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
#include <Model.hpp>
|
|
#include <cstdlib>
|
|
#include <filesystem>
|
|
#include <fstream>
|
|
#include <iostream>
|
|
#include <nlohmann/json.hpp>
|
|
#include <imgui.h>
|
|
#include <raylib.h>
|
|
#include <rlImGui.h>
|
|
|
|
int main(int ac, char **av) {
|
|
InitWindow(1920, 1080, &av[0][2]);
|
|
rlImGuiSetup(true);
|
|
|
|
// Initializing a camera
|
|
Camera camera = {0};
|
|
camera.position = (Vector3){1.0f, 10.0f, 1.0f};
|
|
camera.target = (Vector3){0.0f, 10.0f, 0.0f};
|
|
camera.up = (Vector3){0.0f, 1.0f, 0.0f};
|
|
camera.fovy = 90.0f;
|
|
camera.projection = CAMERA_PERSPECTIVE;
|
|
{ // model lifetime scope
|
|
auto can_model = Ley::cModel::create("can.obj", "can_unwrapped_text.png");
|
|
auto crow_model = Ley::cModel::create("crow.obj", "crow_tex.png");
|
|
|
|
// Model pos
|
|
can_model.setPosition({0.0f, 0.0f, 0.0f});
|
|
crow_model.setPosition({-0.5f, 3.8f, 0.0f});
|
|
|
|
BoundingBox box = GetModelBoundingBox(can_model.getModel());
|
|
|
|
DisableCursor();
|
|
|
|
bool test_window = true;
|
|
|
|
while (!WindowShouldClose()) {
|
|
// Update
|
|
UpdateCamera(&camera, CAMERA_FREE);
|
|
|
|
// Draw
|
|
BeginDrawing();
|
|
ClearBackground(GRAY);
|
|
|
|
BeginMode3D(camera);
|
|
|
|
can_model.Draw(WHITE);
|
|
crow_model.Draw(WHITE);
|
|
|
|
DrawGrid(20, 10.0f); // Draw a grid
|
|
|
|
EndMode3D();
|
|
|
|
DrawFPS(10, 10);
|
|
rlImGuiBegin();
|
|
// Test window
|
|
ImGui::Begin("test", &test_window, ImGuiWindowFlags_None);
|
|
ImGui::Text("test");
|
|
ImGui::End();
|
|
rlImGuiEnd();
|
|
EndDrawing();
|
|
}
|
|
} // Unload model
|
|
rlImGuiShutdown();
|
|
CloseWindow();
|
|
return 0;
|
|
}
|