mirror of
https://github.com/Linloir/SceneEditor.git
synced 2025-12-17 15:38:11 +08:00
set boundary in loop
This commit is contained in:
parent
a7212b893e
commit
b145dbc567
@ -65,9 +65,16 @@ Mesh Model::processMesh(aiMesh* mesh, const aiScene* scene) {
|
|||||||
glm::vec3 vertexBitangent = glm::vec3(0.0f);
|
glm::vec3 vertexBitangent = glm::vec3(0.0f);
|
||||||
|
|
||||||
// Process vertex positions
|
// Process vertex positions
|
||||||
vertexPosition.x = mesh->mVertices[i].x;
|
// 使用循环避免代码重复,如果可行的话,可以在此循环中确定法向量等信息
|
||||||
vertexPosition.y = mesh->mVertices[i].y;
|
for (int j = 0; j < 3; j++) {
|
||||||
vertexPosition.z = mesh->mVertices[i].z;
|
vertexPosition[j] = mesh->mVertices[i][j];
|
||||||
|
left_down_back[j] = left_down_back[j] < vertexPosition[j] ? left_down_back[j] : vertexPosition[j];
|
||||||
|
right_up_front[j] = right_up_front[j] > vertexPosition[j] ? right_up_front[j] : vertexPosition[j];
|
||||||
|
}
|
||||||
|
|
||||||
|
//vertexPosition.x = mesh->mVertices[i].x;
|
||||||
|
//vertexPosition.y = mesh->mVertices[i].y;
|
||||||
|
//vertexPosition.z = mesh->mVertices[i].z;
|
||||||
|
|
||||||
// Process vertex normals
|
// Process vertex normals
|
||||||
if (mesh->mNormals) {
|
if (mesh->mNormals) {
|
||||||
|
|||||||
@ -19,11 +19,10 @@ 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
|
// smallest point
|
||||||
glm::vec3 left_down_back = -right_up_front;
|
glm::vec3 left_down_back = glm::vec3(3e37f, 3e37f, 3e37f);
|
||||||
|
// largest point
|
||||||
|
glm::vec3 right_up_front = -left_down_back;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Model(std::string path);
|
Model(std::string path);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user