mirror of
https://github.com/Linloir/SceneEditor.git
synced 2025-12-17 07:28:12 +08:00
modify constructor of renderable and update skeleton
This commit is contained in:
parent
cabdc8b5e8
commit
5ec0a5718e
@ -34,6 +34,8 @@ void Model::loadModel(std::string path) {
|
||||
processNode(scene->mRootNode, scene);
|
||||
_status = LOADED;
|
||||
Logger::info("Model loaded");
|
||||
// 仅检查一次即可
|
||||
check_boundary();
|
||||
}
|
||||
|
||||
void Model::processNode(aiNode* node, const aiScene* scene) {
|
||||
|
||||
@ -48,10 +48,13 @@ private:
|
||||
void processNode(aiNode* node, const aiScene* scene);
|
||||
Mesh processMesh(aiMesh* mesh, const aiScene* scene);
|
||||
std::vector<Texture> loadMaterialTextures(aiMaterial* mat, aiTextureType type, TextureType textureType);
|
||||
// Since these are loacl position, this function should be called just once.
|
||||
void check_boundary();
|
||||
|
||||
public:
|
||||
void render(const ShaderProgram& shader) const;
|
||||
void check_boundary();
|
||||
|
||||
|
||||
|
||||
// maybe we can encapsure a function to get both upper and lower bound?
|
||||
|
||||
|
||||
@ -2,9 +2,17 @@
|
||||
|
||||
#include "renderable.h"
|
||||
|
||||
Renderable::Renderable(Model* model) : _model(model) {}
|
||||
// 极值点一定在model包围盒的顶点出取到
|
||||
|
||||
Renderable::Renderable(Model* model, glm::vec3 position) : _model(model), _position(position) {}
|
||||
Renderable::Renderable(Model* model) : _model(model) {
|
||||
_upper_bound = model->get_upper_bound();
|
||||
_lower_bound = model->get_lower_bound();
|
||||
}
|
||||
|
||||
Renderable::Renderable(Model* model, glm::vec3 position) : _model(model), _position(position) {
|
||||
_upper_bound = model->get_upper_bound();
|
||||
_lower_bound = model->get_lower_bound();
|
||||
}
|
||||
|
||||
void Renderable::move(glm::vec3 deltaVec) {
|
||||
_position += deltaVec;
|
||||
@ -36,3 +44,8 @@ void Renderable::render(ShaderProgram shader) {
|
||||
// Render
|
||||
_model->render(shader);
|
||||
}
|
||||
|
||||
// check here to get global boundary
|
||||
void Renderable::check_boundary() {
|
||||
|
||||
}
|
||||
@ -12,6 +12,9 @@ private:
|
||||
glm::vec3 _position = glm::vec3(0.0f);
|
||||
glm::mat4 _rotation = glm::mat4(1.0f);
|
||||
glm::vec3 _scale = glm::vec3(1.0f);
|
||||
// 下面是与坐标轴平行的顶点
|
||||
glm::vec3 _lower_bound;
|
||||
glm::vec3 _upper_bound;
|
||||
|
||||
public:
|
||||
Renderable(Model* model);
|
||||
@ -29,6 +32,8 @@ public:
|
||||
|
||||
public:
|
||||
void render(ShaderProgram shader);
|
||||
// check here to get global boundary
|
||||
void check_boundary();
|
||||
};
|
||||
|
||||
inline glm::mat4 Renderable::modelMatrix() const {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user