Skip to content

Commit

Permalink
Added computeAABB
Browse files Browse the repository at this point in the history
  • Loading branch information
denis authored and denis committed Aug 23, 2024
1 parent be0572d commit 483b9b8
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 6 deletions.
2 changes: 0 additions & 2 deletions Engine/include/SceneData/SceneExporterLayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ namespace Prisma {
verticesData->vertices = vertices;
verticesData->indices = j.at("faces").get<std::vector<unsigned int>>();
mesh->loadModel(verticesData);
mesh->computeAABB();
}
else if(type == "LIGHT_DIRECTIONAL"){
auto light = std::dynamic_pointer_cast<Prisma::Light<Prisma::LightType::LightDir>>(n);
Expand Down Expand Up @@ -433,7 +432,6 @@ namespace Prisma {


mesh->loadAnimateModel(verticesData);
mesh->computeAABB();
}
}

Expand Down
1 change: 0 additions & 1 deletion Engine/src/Components/PhysicsMeshComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ void Prisma::PhysicsMeshComponent::updateCollisionData() {
void Prisma::PhysicsMeshComponent::colliderDispatcher(Prisma::Physics::Collider collider) {
auto mesh = dynamic_cast<Prisma::Mesh*>(parent());
if (mesh && !m_fixed) {
mesh->computeAABB();
auto aabbData = mesh->aabbData();
switch (collider) {
case Prisma::Physics::Collider::BOX_COLLIDER: {
Expand Down
2 changes: 0 additions & 2 deletions Engine/src/SceneData/SceneLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ void Prisma::SceneLoader::nodeIteration(std::shared_ptr<Node> nodeRoot, aiNode*
currentMesh->matrix(glm::mat4(1.0f), false);
currentMesh->finalMatrix(glm::mat4(1.0f), false);

currentMesh->computeAABB();

nodeRoot->addChild(currentMesh,false);
if (isAnimate) {
if (m_scene->animateMeshes.size() < MAX_ANIMATION_MESHES) {
Expand Down
1 change: 1 addition & 0 deletions Engine/src/SceneObjects/AnimatedMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ void Prisma::AnimatedMesh::computeAABB()

void Prisma::AnimatedMesh::loadAnimateModel(std::shared_ptr<AnimateVerticesData> vertices) {
m_animateVertices = vertices;
computeAABB();
}

std::shared_ptr<Prisma::AnimatedMesh::AnimateVerticesData> Prisma::AnimatedMesh::animateVerticesData()
Expand Down
1 change: 1 addition & 0 deletions Engine/src/SceneObjects/Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
void Prisma::Mesh::loadModel(std::shared_ptr<VerticesData> vertices)
{
m_vertices = vertices;
computeAABB();
}

const Prisma::Mesh::VerticesData& Prisma::Mesh::verticesData() const
Expand Down
1 change: 0 additions & 1 deletion UserEngine/src/PlayerController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ void PlayerController::createCamera() {
if (button == GLFW_MOUSE_BUTTON_LEFT && action == GLFW_PRESS) {
auto ball = Prisma::Mesh::instantiate(m_sphereMesh);
auto physicsComponent = std::make_shared<Prisma::PhysicsMeshComponent>();
ball->computeAABB();
ball->addComponent(physicsComponent);
auto front = glm::normalize(m_front);
auto position = m_gunPosition->finalMatrix()[3] + glm::vec4(Prisma::getVec3GLM(m_currentDirection), 0.0f);
Expand Down

0 comments on commit 483b9b8

Please sign in to comment.