添加包围盒的两个顶点

This commit is contained in:
ayachi3 2022-12-13 15:25:01 +08:00
parent f5f2247274
commit 68cbbbafe4
2 changed files with 13 additions and 4 deletions

View File

@ -8,7 +8,7 @@
#include "mesh.h" #include "mesh.h"
#include "shader.h" #include "shader.h"
#include <limits>
class Model { class Model {
public: public:
enum MODELSTATUS { LOADING, LOADED, ERR }; enum MODELSTATUS { LOADING, LOADED, ERR };
@ -19,6 +19,12 @@ private:
std::string _directory; std::string _directory;
MODELSTATUS _status = LOADING; MODELSTATUS _status = LOADING;
// largest point
glm::vec3 right_up_front = glm::vec3(3e37f, 3e37f, 3e37f);
// smallest point
glm::vec3 left_down_back = -right_up_front;
public: public:
Model(std::string path); Model(std::string path);
~Model(); ~Model();

View File

@ -81,14 +81,17 @@ void SceneViewer::initializeGL() {
vertexShader.dispose(); vertexShader.dispose();
fragmentShader.dispose(); fragmentShader.dispose();
Model* backpackModel = new Model("E:\\Repositories\\CollegeProjects\\CGAssignments\\FinalProject\\Models\\backpack\\backpack.obj"); Model* backpackModel = new Model("D:/code/ComputerGraphic/SceneEditor/obj/nanosuit/nanosuit.obj");
Logger::info("Model loaded"); Logger::info("Model loaded");
Renderable renderable(backpackModel); Renderable renderable(backpackModel);
_objects.push_back(backpackModel); _objects.push_back(backpackModel);
_camera.setPosition(glm::vec3(0.0f, 0.0f, 3.0f)); _camera.setPosition(glm::vec3(0.0f, 15.0f, 8.0f));
_camera.setYaw(-90.0f); _camera.setYaw(-90.0f);
_camera.setPitch(0.0f); _camera.setPitch(-30.0f);
} }
void SceneViewer::resizeGL(int w, int h) { void SceneViewer::resizeGL(int w, int h) {