Renderer: Replace unique_ptr by shared_ptr
This commit is contained in:
parent
77b46e4811
commit
f15709c8a3
|
|
@ -81,14 +81,14 @@ int main()
|
||||||
texParams.height = drfreakImage->GetHeight();
|
texParams.height = drfreakImage->GetHeight();
|
||||||
texParams.depth = drfreakImage->GetDepth();
|
texParams.depth = drfreakImage->GetDepth();
|
||||||
|
|
||||||
std::unique_ptr<Nz::Texture> texture = device->InstantiateTexture(texParams);
|
std::shared_ptr<Nz::Texture> texture = device->InstantiateTexture(texParams);
|
||||||
if (!texture->Update(drfreakImage->GetConstPixels()))
|
if (!texture->Update(drfreakImage->GetConstPixels()))
|
||||||
{
|
{
|
||||||
NazaraError("Failed to update texture");
|
NazaraError("Failed to update texture");
|
||||||
return __LINE__;
|
return __LINE__;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Nz::TextureSampler> textureSampler = device->InstantiateTextureSampler({});
|
std::shared_ptr<Nz::TextureSampler> textureSampler = device->InstantiateTextureSampler({});
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
|
@ -120,7 +120,7 @@ int main()
|
||||||
|
|
||||||
Nz::ShaderBindingPtr shaderBinding = renderPipelineLayout->AllocateShaderBinding();
|
Nz::ShaderBindingPtr shaderBinding = renderPipelineLayout->AllocateShaderBinding();
|
||||||
|
|
||||||
std::unique_ptr<Nz::AbstractBuffer> uniformBuffer = device->InstantiateBuffer(Nz::BufferType_Uniform);
|
std::shared_ptr<Nz::AbstractBuffer> uniformBuffer = device->InstantiateBuffer(Nz::BufferType_Uniform);
|
||||||
if (!uniformBuffer->Initialize(uniformSize, Nz::BufferUsage_DeviceLocal | Nz::BufferUsage_Dynamic))
|
if (!uniformBuffer->Initialize(uniformSize, Nz::BufferUsage_DeviceLocal | Nz::BufferUsage_Dynamic))
|
||||||
{
|
{
|
||||||
NazaraError("Failed to create uniform buffer");
|
NazaraError("Failed to create uniform buffer");
|
||||||
|
|
@ -153,12 +153,12 @@ int main()
|
||||||
vertexBuffer.binding = 0;
|
vertexBuffer.binding = 0;
|
||||||
vertexBuffer.declaration = drfreakVB->GetVertexDeclaration();
|
vertexBuffer.declaration = drfreakVB->GetVertexDeclaration();
|
||||||
|
|
||||||
std::unique_ptr<Nz::RenderPipeline> pipeline = device->InstantiateRenderPipeline(pipelineInfo);
|
std::shared_ptr<Nz::RenderPipeline> pipeline = device->InstantiateRenderPipeline(pipelineInfo);
|
||||||
|
|
||||||
Nz::RenderDevice* renderDevice = window.GetRenderDevice().get();
|
Nz::RenderDevice* renderDevice = window.GetRenderDevice().get();
|
||||||
|
|
||||||
Nz::RenderWindowImpl* windowImpl = window.GetImpl();
|
Nz::RenderWindowImpl* windowImpl = window.GetImpl();
|
||||||
std::unique_ptr<Nz::CommandPool> commandPool = windowImpl->CreateCommandPool(Nz::QueueType::Graphics);
|
std::shared_ptr<Nz::CommandPool> commandPool = windowImpl->CreateCommandPool(Nz::QueueType::Graphics);
|
||||||
|
|
||||||
Nz::RenderBuffer* renderBufferIB = static_cast<Nz::RenderBuffer*>(drfreakIB->GetBuffer()->GetImpl());
|
Nz::RenderBuffer* renderBufferIB = static_cast<Nz::RenderBuffer*>(drfreakIB->GetBuffer()->GetImpl());
|
||||||
Nz::RenderBuffer* renderBufferVB = static_cast<Nz::RenderBuffer*>(drfreakVB->GetBuffer()->GetImpl());
|
Nz::RenderBuffer* renderBufferVB = static_cast<Nz::RenderBuffer*>(drfreakVB->GetBuffer()->GetImpl());
|
||||||
|
|
|
||||||
|
|
@ -32,13 +32,13 @@ namespace Nz
|
||||||
|
|
||||||
inline const GL::Context& GetReferenceContext() const;
|
inline const GL::Context& GetReferenceContext() const;
|
||||||
|
|
||||||
std::unique_ptr<AbstractBuffer> InstantiateBuffer(BufferType type) override;
|
std::shared_ptr<AbstractBuffer> InstantiateBuffer(BufferType type) override;
|
||||||
std::unique_ptr<CommandPool> InstantiateCommandPool(QueueType queueType) override;
|
std::shared_ptr<CommandPool> InstantiateCommandPool(QueueType queueType) override;
|
||||||
std::unique_ptr<RenderPipeline> InstantiateRenderPipeline(RenderPipelineInfo pipelineInfo) override;
|
std::shared_ptr<RenderPipeline> InstantiateRenderPipeline(RenderPipelineInfo pipelineInfo) override;
|
||||||
std::shared_ptr<RenderPipelineLayout> InstantiateRenderPipelineLayout(RenderPipelineLayoutInfo pipelineLayoutInfo) override;
|
std::shared_ptr<RenderPipelineLayout> InstantiateRenderPipelineLayout(RenderPipelineLayoutInfo pipelineLayoutInfo) override;
|
||||||
std::shared_ptr<ShaderStageImpl> InstantiateShaderStage(ShaderStageType type, ShaderLanguage lang, const void* source, std::size_t sourceSize) override;
|
std::shared_ptr<ShaderStageImpl> InstantiateShaderStage(ShaderStageType type, ShaderLanguage lang, const void* source, std::size_t sourceSize) override;
|
||||||
std::unique_ptr<Texture> InstantiateTexture(const TextureInfo& params) override;
|
std::shared_ptr<Texture> InstantiateTexture(const TextureInfo& params) override;
|
||||||
std::unique_ptr<TextureSampler> InstantiateTextureSampler(const TextureSamplerInfo& params) override;
|
std::shared_ptr<TextureSampler> InstantiateTextureSampler(const TextureSamplerInfo& params) override;
|
||||||
|
|
||||||
inline void NotifyBufferDestruction(GLuint buffer) const;
|
inline void NotifyBufferDestruction(GLuint buffer) const;
|
||||||
inline void NotifyProgramDestruction(GLuint program) const;
|
inline void NotifyProgramDestruction(GLuint program) const;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ namespace Nz
|
||||||
RenderFrame Acquire() override;
|
RenderFrame Acquire() override;
|
||||||
|
|
||||||
bool Create(RendererImpl* renderer, RenderSurface* surface, const RenderWindowParameters& parameters) override;
|
bool Create(RendererImpl* renderer, RenderSurface* surface, const RenderWindowParameters& parameters) override;
|
||||||
std::unique_ptr<CommandPool> CreateCommandPool(QueueType queueType) override;
|
std::shared_ptr<CommandPool> CreateCommandPool(QueueType queueType) override;
|
||||||
|
|
||||||
inline GL::Context& GetContext();
|
inline GL::Context& GetContext();
|
||||||
const OpenGLFramebuffer& GetFramebuffer() const override;
|
const OpenGLFramebuffer& GetFramebuffer() const override;
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ namespace Nz
|
||||||
|
|
||||||
struct HardwareBuffer
|
struct HardwareBuffer
|
||||||
{
|
{
|
||||||
std::unique_ptr<AbstractBuffer> buffer;
|
std::shared_ptr<AbstractBuffer> buffer;
|
||||||
bool synchronized = false;
|
bool synchronized = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,14 +29,14 @@ namespace Nz
|
||||||
RenderDevice() = default;
|
RenderDevice() = default;
|
||||||
virtual ~RenderDevice();
|
virtual ~RenderDevice();
|
||||||
|
|
||||||
virtual std::unique_ptr<AbstractBuffer> InstantiateBuffer(BufferType type) = 0;
|
virtual std::shared_ptr<AbstractBuffer> InstantiateBuffer(BufferType type) = 0;
|
||||||
virtual std::unique_ptr<CommandPool> InstantiateCommandPool(QueueType queueType) = 0;
|
virtual std::shared_ptr<CommandPool> InstantiateCommandPool(QueueType queueType) = 0;
|
||||||
virtual std::unique_ptr<RenderPipeline> InstantiateRenderPipeline(RenderPipelineInfo pipelineInfo) = 0;
|
virtual std::shared_ptr<RenderPipeline> InstantiateRenderPipeline(RenderPipelineInfo pipelineInfo) = 0;
|
||||||
virtual std::shared_ptr<RenderPipelineLayout> InstantiateRenderPipelineLayout(RenderPipelineLayoutInfo pipelineLayoutInfo) = 0;
|
virtual std::shared_ptr<RenderPipelineLayout> InstantiateRenderPipelineLayout(RenderPipelineLayoutInfo pipelineLayoutInfo) = 0;
|
||||||
virtual std::shared_ptr<ShaderStageImpl> InstantiateShaderStage(ShaderStageType type, ShaderLanguage lang, const void* source, std::size_t sourceSize) = 0;
|
virtual std::shared_ptr<ShaderStageImpl> InstantiateShaderStage(ShaderStageType type, ShaderLanguage lang, const void* source, std::size_t sourceSize) = 0;
|
||||||
std::shared_ptr<ShaderStageImpl> InstantiateShaderStage(ShaderStageType type, ShaderLanguage lang, const std::filesystem::path& sourcePath);
|
std::shared_ptr<ShaderStageImpl> InstantiateShaderStage(ShaderStageType type, ShaderLanguage lang, const std::filesystem::path& sourcePath);
|
||||||
virtual std::unique_ptr<Texture> InstantiateTexture(const TextureInfo& params) = 0;
|
virtual std::shared_ptr<Texture> InstantiateTexture(const TextureInfo& params) = 0;
|
||||||
virtual std::unique_ptr<TextureSampler> InstantiateTextureSampler(const TextureSamplerInfo& params) = 0;
|
virtual std::shared_ptr<TextureSampler> InstantiateTextureSampler(const TextureSamplerInfo& params) = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ namespace Nz
|
||||||
virtual RenderFrame Acquire() = 0;
|
virtual RenderFrame Acquire() = 0;
|
||||||
|
|
||||||
virtual bool Create(RendererImpl* renderer, RenderSurface* surface, const RenderWindowParameters& parameters) = 0;
|
virtual bool Create(RendererImpl* renderer, RenderSurface* surface, const RenderWindowParameters& parameters) = 0;
|
||||||
virtual std::unique_ptr<CommandPool> CreateCommandPool(QueueType queueType) = 0;
|
virtual std::shared_ptr<CommandPool> CreateCommandPool(QueueType queueType) = 0;
|
||||||
|
|
||||||
virtual const Framebuffer& GetFramebuffer() const = 0;
|
virtual const Framebuffer& GetFramebuffer() const = 0;
|
||||||
virtual std::shared_ptr<RenderDevice> GetRenderDevice() = 0;
|
virtual std::shared_ptr<RenderDevice> GetRenderDevice() = 0;
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ namespace Nz
|
||||||
|
|
||||||
bool Create(RendererImpl* renderer, RenderSurface* surface, const RenderWindowParameters& parameters) override;
|
bool Create(RendererImpl* renderer, RenderSurface* surface, const RenderWindowParameters& parameters) override;
|
||||||
|
|
||||||
std::unique_ptr<CommandPool> CreateCommandPool(QueueType queueType) override;
|
std::shared_ptr<CommandPool> CreateCommandPool(QueueType queueType) override;
|
||||||
|
|
||||||
inline const VulkanMultipleFramebuffer& GetFramebuffer() const override;
|
inline const VulkanMultipleFramebuffer& GetFramebuffer() const override;
|
||||||
inline VulkanDevice& GetDevice();
|
inline VulkanDevice& GetDevice();
|
||||||
|
|
|
||||||
|
|
@ -23,13 +23,13 @@ namespace Nz
|
||||||
VulkanDevice(VulkanDevice&&) = delete; ///TODO?
|
VulkanDevice(VulkanDevice&&) = delete; ///TODO?
|
||||||
~VulkanDevice();
|
~VulkanDevice();
|
||||||
|
|
||||||
std::unique_ptr<AbstractBuffer> InstantiateBuffer(BufferType type) override;
|
std::shared_ptr<AbstractBuffer> InstantiateBuffer(BufferType type) override;
|
||||||
std::unique_ptr<CommandPool> InstantiateCommandPool(QueueType queueType) override;
|
std::shared_ptr<CommandPool> InstantiateCommandPool(QueueType queueType) override;
|
||||||
std::unique_ptr<RenderPipeline> InstantiateRenderPipeline(RenderPipelineInfo pipelineInfo) override;
|
std::shared_ptr<RenderPipeline> InstantiateRenderPipeline(RenderPipelineInfo pipelineInfo) override;
|
||||||
std::shared_ptr<RenderPipelineLayout> InstantiateRenderPipelineLayout(RenderPipelineLayoutInfo pipelineLayoutInfo) override;
|
std::shared_ptr<RenderPipelineLayout> InstantiateRenderPipelineLayout(RenderPipelineLayoutInfo pipelineLayoutInfo) override;
|
||||||
std::shared_ptr<ShaderStageImpl> InstantiateShaderStage(ShaderStageType type, ShaderLanguage lang, const void* source, std::size_t sourceSize) override;
|
std::shared_ptr<ShaderStageImpl> InstantiateShaderStage(ShaderStageType type, ShaderLanguage lang, const void* source, std::size_t sourceSize) override;
|
||||||
std::unique_ptr<Texture> InstantiateTexture(const TextureInfo& params) override;
|
std::shared_ptr<Texture> InstantiateTexture(const TextureInfo& params) override;
|
||||||
std::unique_ptr<TextureSampler> InstantiateTextureSampler(const TextureSamplerInfo& params) override;
|
std::shared_ptr<TextureSampler> InstantiateTextureSampler(const TextureSamplerInfo& params) override;
|
||||||
|
|
||||||
VulkanDevice& operator=(const VulkanDevice&) = delete;
|
VulkanDevice& operator=(const VulkanDevice&) = delete;
|
||||||
VulkanDevice& operator=(VulkanDevice&&) = delete; ///TODO?
|
VulkanDevice& operator=(VulkanDevice&&) = delete; ///TODO?
|
||||||
|
|
|
||||||
|
|
@ -48,19 +48,19 @@ namespace Nz
|
||||||
return contextPtr;
|
return contextPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<AbstractBuffer> OpenGLDevice::InstantiateBuffer(BufferType type)
|
std::shared_ptr<AbstractBuffer> OpenGLDevice::InstantiateBuffer(BufferType type)
|
||||||
{
|
{
|
||||||
return std::make_unique<OpenGLBuffer>(*this, type);
|
return std::make_shared<OpenGLBuffer>(*this, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<CommandPool> OpenGLDevice::InstantiateCommandPool(QueueType /*queueType*/)
|
std::shared_ptr<CommandPool> OpenGLDevice::InstantiateCommandPool(QueueType /*queueType*/)
|
||||||
{
|
{
|
||||||
return std::make_unique<OpenGLCommandPool>();
|
return std::make_shared<OpenGLCommandPool>();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<RenderPipeline> OpenGLDevice::InstantiateRenderPipeline(RenderPipelineInfo pipelineInfo)
|
std::shared_ptr<RenderPipeline> OpenGLDevice::InstantiateRenderPipeline(RenderPipelineInfo pipelineInfo)
|
||||||
{
|
{
|
||||||
return std::make_unique<OpenGLRenderPipeline>(*this, std::move(pipelineInfo));
|
return std::make_shared<OpenGLRenderPipeline>(*this, std::move(pipelineInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<RenderPipelineLayout> OpenGLDevice::InstantiateRenderPipelineLayout(RenderPipelineLayoutInfo pipelineLayoutInfo)
|
std::shared_ptr<RenderPipelineLayout> OpenGLDevice::InstantiateRenderPipelineLayout(RenderPipelineLayoutInfo pipelineLayoutInfo)
|
||||||
|
|
@ -73,14 +73,14 @@ namespace Nz
|
||||||
return std::make_shared<OpenGLShaderStage>(*this, type, lang, source, sourceSize);
|
return std::make_shared<OpenGLShaderStage>(*this, type, lang, source, sourceSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Texture> OpenGLDevice::InstantiateTexture(const TextureInfo& params)
|
std::shared_ptr<Texture> OpenGLDevice::InstantiateTexture(const TextureInfo& params)
|
||||||
{
|
{
|
||||||
return std::make_unique<OpenGLTexture>(*this, params);
|
return std::make_shared<OpenGLTexture>(*this, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<TextureSampler> OpenGLDevice::InstantiateTextureSampler(const TextureSamplerInfo& params)
|
std::shared_ptr<TextureSampler> OpenGLDevice::InstantiateTextureSampler(const TextureSamplerInfo& params)
|
||||||
{
|
{
|
||||||
return std::make_unique<OpenGLTextureSampler>(*this, params);
|
return std::make_shared<OpenGLTextureSampler>(*this, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ namespace Nz
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<CommandPool> OpenGLRenderWindow::CreateCommandPool(QueueType /*queueType*/)
|
std::shared_ptr<CommandPool> OpenGLRenderWindow::CreateCommandPool(QueueType /*queueType*/)
|
||||||
{
|
{
|
||||||
return std::make_unique<OpenGLCommandPool>();
|
return std::make_unique<OpenGLCommandPool>();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -219,7 +219,7 @@ namespace Nz
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<CommandPool> VkRenderWindow::CreateCommandPool(QueueType queueType)
|
std::shared_ptr<CommandPool> VkRenderWindow::CreateCommandPool(QueueType queueType)
|
||||||
{
|
{
|
||||||
UInt32 queueFamilyIndex = [&] {
|
UInt32 queueFamilyIndex = [&] {
|
||||||
switch (queueType)
|
switch (queueType)
|
||||||
|
|
@ -237,7 +237,7 @@ namespace Nz
|
||||||
throw std::runtime_error("invalid queue type " + std::to_string(UnderlyingCast(queueType)));
|
throw std::runtime_error("invalid queue type " + std::to_string(UnderlyingCast(queueType)));
|
||||||
}();
|
}();
|
||||||
|
|
||||||
return std::make_unique<VulkanCommandPool>(*m_device, queueFamilyIndex);
|
return std::make_shared<VulkanCommandPool>(*m_device, queueFamilyIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VkRenderWindow::Present(UInt32 imageIndex, VkSemaphore waitSemaphore)
|
void VkRenderWindow::Present(UInt32 imageIndex, VkSemaphore waitSemaphore)
|
||||||
|
|
|
||||||
|
|
@ -15,19 +15,19 @@ namespace Nz
|
||||||
{
|
{
|
||||||
VulkanDevice::~VulkanDevice() = default;
|
VulkanDevice::~VulkanDevice() = default;
|
||||||
|
|
||||||
std::unique_ptr<AbstractBuffer> VulkanDevice::InstantiateBuffer(BufferType type)
|
std::shared_ptr<AbstractBuffer> VulkanDevice::InstantiateBuffer(BufferType type)
|
||||||
{
|
{
|
||||||
return std::make_unique<VulkanBuffer>(*this, type);
|
return std::make_shared<VulkanBuffer>(*this, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<CommandPool> VulkanDevice::InstantiateCommandPool(QueueType queueType)
|
std::shared_ptr<CommandPool> VulkanDevice::InstantiateCommandPool(QueueType queueType)
|
||||||
{
|
{
|
||||||
return std::make_unique<VulkanCommandPool>(*this, queueType);
|
return std::make_shared<VulkanCommandPool>(*this, queueType);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<RenderPipeline> VulkanDevice::InstantiateRenderPipeline(RenderPipelineInfo pipelineInfo)
|
std::shared_ptr<RenderPipeline> VulkanDevice::InstantiateRenderPipeline(RenderPipelineInfo pipelineInfo)
|
||||||
{
|
{
|
||||||
return std::make_unique<VulkanRenderPipeline>(*this, std::move(pipelineInfo));
|
return std::make_shared<VulkanRenderPipeline>(*this, std::move(pipelineInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<RenderPipelineLayout> VulkanDevice::InstantiateRenderPipelineLayout(RenderPipelineLayoutInfo pipelineLayoutInfo)
|
std::shared_ptr<RenderPipelineLayout> VulkanDevice::InstantiateRenderPipelineLayout(RenderPipelineLayoutInfo pipelineLayoutInfo)
|
||||||
|
|
@ -48,13 +48,13 @@ namespace Nz
|
||||||
return stage;
|
return stage;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Texture> VulkanDevice::InstantiateTexture(const TextureInfo& params)
|
std::shared_ptr<Texture> VulkanDevice::InstantiateTexture(const TextureInfo& params)
|
||||||
{
|
{
|
||||||
return std::make_unique<VulkanTexture>(*this, params);
|
return std::make_shared<VulkanTexture>(*this, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<TextureSampler> VulkanDevice::InstantiateTextureSampler(const TextureSamplerInfo& params)
|
std::shared_ptr<TextureSampler> VulkanDevice::InstantiateTextureSampler(const TextureSamplerInfo& params)
|
||||||
{
|
{
|
||||||
return std::make_unique<VulkanTextureSampler>(*this, params);
|
return std::make_shared<VulkanTextureSampler>(*this, params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -268,7 +268,7 @@ namespace Ndk
|
||||||
|
|
||||||
if (callbacks.endCallback)
|
if (callbacks.endCallback)
|
||||||
{
|
{
|
||||||
worldCallbacks.endCallback = [this, cb = std::move(callbacks.endCallback)](Nz::PhysWorld2D& world, Nz::Arbiter2D& arbiter, Nz::RigidBody2D& bodyA, Nz::RigidBody2D& bodyB, void* userdata)
|
worldCallbacks.endCallback = [this, cb = std::move(callbacks.endCallback)](Nz::PhysWorld2D& /*world*/, Nz::Arbiter2D& arbiter, Nz::RigidBody2D& bodyA, Nz::RigidBody2D& bodyB, void* userdata)
|
||||||
{
|
{
|
||||||
cb(*this, arbiter, GetEntityFromBody(bodyA), GetEntityFromBody(bodyB), userdata);
|
cb(*this, arbiter, GetEntityFromBody(bodyA), GetEntityFromBody(bodyB), userdata);
|
||||||
};
|
};
|
||||||
|
|
@ -276,7 +276,7 @@ namespace Ndk
|
||||||
|
|
||||||
if (callbacks.preSolveCallback)
|
if (callbacks.preSolveCallback)
|
||||||
{
|
{
|
||||||
worldCallbacks.preSolveCallback = [this, cb = std::move(callbacks.preSolveCallback)](Nz::PhysWorld2D& world, Nz::Arbiter2D& arbiter, Nz::RigidBody2D& bodyA, Nz::RigidBody2D& bodyB, void* userdata)
|
worldCallbacks.preSolveCallback = [this, cb = std::move(callbacks.preSolveCallback)](Nz::PhysWorld2D& /*world*/, Nz::Arbiter2D& arbiter, Nz::RigidBody2D& bodyA, Nz::RigidBody2D& bodyB, void* userdata)
|
||||||
{
|
{
|
||||||
return cb(*this, arbiter, GetEntityFromBody(bodyA), GetEntityFromBody(bodyB), userdata);
|
return cb(*this, arbiter, GetEntityFromBody(bodyA), GetEntityFromBody(bodyB), userdata);
|
||||||
};
|
};
|
||||||
|
|
@ -284,7 +284,7 @@ namespace Ndk
|
||||||
|
|
||||||
if (callbacks.postSolveCallback)
|
if (callbacks.postSolveCallback)
|
||||||
{
|
{
|
||||||
worldCallbacks.postSolveCallback = [this, cb = std::move(callbacks.postSolveCallback)](Nz::PhysWorld2D& world, Nz::Arbiter2D& arbiter, Nz::RigidBody2D& bodyA, Nz::RigidBody2D& bodyB, void* userdata)
|
worldCallbacks.postSolveCallback = [this, cb = std::move(callbacks.postSolveCallback)](Nz::PhysWorld2D& /*world*/, Nz::Arbiter2D& arbiter, Nz::RigidBody2D& bodyA, Nz::RigidBody2D& bodyB, void* userdata)
|
||||||
{
|
{
|
||||||
cb(*this, arbiter, GetEntityFromBody(bodyA), GetEntityFromBody(bodyB), userdata);
|
cb(*this, arbiter, GetEntityFromBody(bodyA), GetEntityFromBody(bodyB), userdata);
|
||||||
};
|
};
|
||||||
|
|
@ -292,7 +292,7 @@ namespace Ndk
|
||||||
|
|
||||||
if (callbacks.startCallback)
|
if (callbacks.startCallback)
|
||||||
{
|
{
|
||||||
worldCallbacks.startCallback = [this, cb = std::move(callbacks.startCallback)](Nz::PhysWorld2D& world, Nz::Arbiter2D& arbiter, Nz::RigidBody2D& bodyA, Nz::RigidBody2D& bodyB, void* userdata)
|
worldCallbacks.startCallback = [this, cb = std::move(callbacks.startCallback)](Nz::PhysWorld2D& /*world*/, Nz::Arbiter2D& arbiter, Nz::RigidBody2D& bodyA, Nz::RigidBody2D& bodyB, void* userdata)
|
||||||
{
|
{
|
||||||
return cb(*this, arbiter, GetEntityFromBody(bodyA), GetEntityFromBody(bodyB), userdata);
|
return cb(*this, arbiter, GetEntityFromBody(bodyA), GetEntityFromBody(bodyB), userdata);
|
||||||
};
|
};
|
||||||
|
|
@ -309,7 +309,7 @@ namespace Ndk
|
||||||
|
|
||||||
if (callbacks.endCallback)
|
if (callbacks.endCallback)
|
||||||
{
|
{
|
||||||
worldCallbacks.endCallback = [this, cb = std::move(callbacks.endCallback)](Nz::PhysWorld2D& world, Nz::Arbiter2D& arbiter, Nz::RigidBody2D& bodyA, Nz::RigidBody2D& bodyB, void* userdata)
|
worldCallbacks.endCallback = [this, cb = std::move(callbacks.endCallback)](Nz::PhysWorld2D& /*world*/, Nz::Arbiter2D& arbiter, Nz::RigidBody2D& bodyA, Nz::RigidBody2D& bodyB, void* userdata)
|
||||||
{
|
{
|
||||||
cb(*this, arbiter, GetEntityFromBody(bodyA), GetEntityFromBody(bodyB), userdata);
|
cb(*this, arbiter, GetEntityFromBody(bodyA), GetEntityFromBody(bodyB), userdata);
|
||||||
};
|
};
|
||||||
|
|
@ -317,7 +317,7 @@ namespace Ndk
|
||||||
|
|
||||||
if (callbacks.preSolveCallback)
|
if (callbacks.preSolveCallback)
|
||||||
{
|
{
|
||||||
worldCallbacks.preSolveCallback = [this, cb = std::move(callbacks.preSolveCallback)](Nz::PhysWorld2D& world, Nz::Arbiter2D& arbiter, Nz::RigidBody2D& bodyA, Nz::RigidBody2D& bodyB, void* userdata)
|
worldCallbacks.preSolveCallback = [this, cb = std::move(callbacks.preSolveCallback)](Nz::PhysWorld2D& /*world*/, Nz::Arbiter2D& arbiter, Nz::RigidBody2D& bodyA, Nz::RigidBody2D& bodyB, void* userdata)
|
||||||
{
|
{
|
||||||
return cb(*this, arbiter, GetEntityFromBody(bodyA), GetEntityFromBody(bodyB), userdata);
|
return cb(*this, arbiter, GetEntityFromBody(bodyA), GetEntityFromBody(bodyB), userdata);
|
||||||
};
|
};
|
||||||
|
|
@ -325,7 +325,7 @@ namespace Ndk
|
||||||
|
|
||||||
if (callbacks.postSolveCallback)
|
if (callbacks.postSolveCallback)
|
||||||
{
|
{
|
||||||
worldCallbacks.postSolveCallback = [this, cb = std::move(callbacks.postSolveCallback)](Nz::PhysWorld2D& world, Nz::Arbiter2D& arbiter, Nz::RigidBody2D& bodyA, Nz::RigidBody2D& bodyB, void* userdata)
|
worldCallbacks.postSolveCallback = [this, cb = std::move(callbacks.postSolveCallback)](Nz::PhysWorld2D& /*world*/, Nz::Arbiter2D& arbiter, Nz::RigidBody2D& bodyA, Nz::RigidBody2D& bodyB, void* userdata)
|
||||||
{
|
{
|
||||||
cb(*this, arbiter, GetEntityFromBody(bodyA), GetEntityFromBody(bodyB), userdata);
|
cb(*this, arbiter, GetEntityFromBody(bodyA), GetEntityFromBody(bodyB), userdata);
|
||||||
};
|
};
|
||||||
|
|
@ -333,7 +333,7 @@ namespace Ndk
|
||||||
|
|
||||||
if (callbacks.startCallback)
|
if (callbacks.startCallback)
|
||||||
{
|
{
|
||||||
worldCallbacks.startCallback = [this, cb = std::move(callbacks.startCallback)](Nz::PhysWorld2D& world, Nz::Arbiter2D& arbiter, Nz::RigidBody2D& bodyA, Nz::RigidBody2D& bodyB, void* userdata)
|
worldCallbacks.startCallback = [this, cb = std::move(callbacks.startCallback)](Nz::PhysWorld2D& /*world*/, Nz::Arbiter2D& arbiter, Nz::RigidBody2D& bodyA, Nz::RigidBody2D& bodyB, void* userdata)
|
||||||
{
|
{
|
||||||
return cb(*this, arbiter, GetEntityFromBody(bodyA), GetEntityFromBody(bodyB), userdata);
|
return cb(*this, arbiter, GetEntityFromBody(bodyA), GetEntityFromBody(bodyB), userdata);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue