implement SceneEntity::QueryVolumeFromDrawable

This commit is contained in:
Adam Jensen 2023-03-24 00:39:00 +00:00
parent 8702085502
commit 1b86c3cbc1
2 changed files with 22 additions and 1 deletions

View File

@ -1,3 +1,4 @@
#include "IDrawable.h"
#include "Scene.h"
#include "SceneCell.h"
#include "SceneCellGroup.h"
@ -11,6 +12,7 @@ SceneEntity::SceneEntity(Scene *scene) : scene(scene) {
void SceneEntity::setMatrix(Matrix& newMatrix) {
matrix = newMatrix;
QueryVolumeFromDrawable();
// TODO
}
@ -20,6 +22,7 @@ Matrix& SceneEntity::getMatrix() {
void SceneEntity::setDrawable(IDrawable *newDrawable) {
drawable = newDrawable;
QueryVolumeFromDrawable();
// TODO
}
@ -36,7 +39,21 @@ void SceneEntity::setCellGroup(ISceneCellGroup *newICellGroup) {
}
}
void SceneEntity::UpdateData(bool reInitCell) {
void SceneEntity::QueryVolumeFromDrawable() { // line 370
if (drawable) {
drawable->GetBoundingVolume(&cullingVolume);
TransformVolumeAndPivot();
// TODO
} else {
// TODO
}
}
void SceneEntity::TransformVolumeAndPivot() { // line 406
cullingVolume.Transform(matrix);
}
void SceneEntity::UpdateData(bool reInitCell) { // line 464
// HACK
auto cell = sceneCellGroup->cellByIndex(0);
if (reInitCell) {

View File

@ -1,6 +1,7 @@
#pragma once
#include "ISceneEntity.h"
#include "cdcMath/Math.h"
#include "rendering/Culling/BasicPrimitives.h"
namespace cdc {
@ -16,7 +17,10 @@ public:
Matrix matrix; // 20
IDrawable *drawable = nullptr; // 6C
SceneCellGroup *sceneCellGroup = nullptr; // 70
BasicCullingVolume cullingVolume; // F0
void QueryVolumeFromDrawable();
void TransformVolumeAndPivot();
void UpdateData(bool);
public: