Graphics: Fix WorldInstance removal while being in use
This commit is contained in:
@@ -28,8 +28,7 @@ namespace Nz
|
||||
inline void DetachRenderable(const std::shared_ptr<InstancedRenderable>& renderable);
|
||||
|
||||
inline const std::vector<std::shared_ptr<InstancedRenderable>>& GetRenderables() const;
|
||||
inline WorldInstance& GetWorldInstance();
|
||||
inline const WorldInstance& GetWorldInstance() const;
|
||||
inline const WorldInstancePtr& GetWorldInstance() const;
|
||||
|
||||
GraphicsComponent& operator=(const GraphicsComponent&) = default;
|
||||
GraphicsComponent& operator=(GraphicsComponent&&) = default;
|
||||
@@ -39,7 +38,7 @@ namespace Nz
|
||||
|
||||
private:
|
||||
std::vector<std::shared_ptr<InstancedRenderable>> m_renderables;
|
||||
std::unique_ptr<WorldInstance> m_worldInstance;
|
||||
WorldInstancePtr m_worldInstance;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Nz
|
||||
{
|
||||
inline GraphicsComponent::GraphicsComponent()
|
||||
{
|
||||
m_worldInstance = std::make_unique<WorldInstance>(); //< FIXME
|
||||
m_worldInstance = std::make_shared<WorldInstance>(); //< FIXME: Use pools
|
||||
}
|
||||
|
||||
inline void GraphicsComponent::AttachRenderable(std::shared_ptr<InstancedRenderable> renderable)
|
||||
@@ -35,13 +35,8 @@ namespace Nz
|
||||
return m_renderables;
|
||||
}
|
||||
|
||||
inline WorldInstance& GraphicsComponent::GetWorldInstance()
|
||||
inline const WorldInstancePtr& GraphicsComponent::GetWorldInstance() const
|
||||
{
|
||||
return *m_worldInstance;
|
||||
}
|
||||
|
||||
inline const WorldInstance& GraphicsComponent::GetWorldInstance() const
|
||||
{
|
||||
return *m_worldInstance;
|
||||
return m_worldInstance;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user