internal: add bounding box to SceneAsset & subclasses
This commit is contained in:
@@ -53,7 +53,14 @@ namespace thermion
|
||||
return _materialInstanceCount;
|
||||
}
|
||||
|
||||
const Box &getBoundingBox() const { return _boundingBox; }
|
||||
const Aabb getBoundingBox() const override
|
||||
{
|
||||
return Aabb {
|
||||
|
||||
.min = _boundingBox.getMin(), // center - halfExtent
|
||||
.max = _boundingBox.getMax() // center + halfExtent
|
||||
};
|
||||
}
|
||||
VertexBuffer *getVertexBuffer() const { return _vertexBuffer; }
|
||||
IndexBuffer *getIndexBuffer() const { return _indexBuffer; }
|
||||
|
||||
@@ -137,7 +144,6 @@ namespace thermion
|
||||
utils::Entity _entity;
|
||||
RenderableManager::PrimitiveType _primitiveType;
|
||||
std::vector<std::unique_ptr<GeometrySceneAsset>> _instances;
|
||||
|
||||
};
|
||||
|
||||
} // namespace thermion
|
||||
@@ -73,6 +73,10 @@ namespace thermion
|
||||
return _asset;
|
||||
}
|
||||
|
||||
const Aabb getBoundingBox() const override {
|
||||
return _asset->getBoundingBox();
|
||||
}
|
||||
|
||||
void addAllEntities(Scene *scene) override
|
||||
{
|
||||
scene->addEntities(_asset->getEntities(), _asset->getEntityCount());
|
||||
|
||||
@@ -39,6 +39,10 @@ namespace thermion
|
||||
return std::nullptr_t();
|
||||
};
|
||||
|
||||
const Aabb getBoundingBox() const override {
|
||||
return _instance->getBoundingBox();
|
||||
}
|
||||
|
||||
SceneAssetType getType() override
|
||||
{
|
||||
return SceneAsset::SceneAssetType::Gltf;
|
||||
|
||||
@@ -22,6 +22,9 @@ class SceneAsset {
|
||||
virtual ~SceneAsset() {
|
||||
|
||||
}
|
||||
|
||||
virtual const Aabb getBoundingBox() const = 0;
|
||||
|
||||
virtual SceneAssetType getType() = 0;
|
||||
|
||||
virtual utils::Entity getEntity() {
|
||||
|
||||
Reference in New Issue
Block a user