Graphics/AbstractRenderQueue: Remove AddBillboard method
Former-commit-id: 454c84a97accb0cddddadbe48a2e08225b9cc98b [formerly a4e5d1e4511e5c1f02b8fd4e129192f88adf315f] [formerly d10b981f4e27d0dc6afc76b2c8dc60ab860cebbd [formerly 0e8c9cea9e8f06e82597924e608d0881d6735433]] Former-commit-id: 43f5b9d50bd672aa347f00ed2f87c54e9c9148ee [formerly 3ce48d5f0e61153fdf0cc957e06d6a5985e40577] Former-commit-id: d6def9dd70839c5caa8cc8a7d84d714321e81b88
This commit is contained in:
parent
b79cb84b09
commit
8fbe279a50
|
|
@ -38,7 +38,6 @@ namespace Nz
|
||||||
|
|
||||||
// Je ne suis vraiment pas fan du nombre de surcharges pour AddBillboards,
|
// Je ne suis vraiment pas fan du nombre de surcharges pour AddBillboards,
|
||||||
// mais je n'ai pas d'autre solution tout aussi performante pour le moment...
|
// mais je n'ai pas d'autre solution tout aussi performante pour le moment...
|
||||||
virtual void AddBillboard(int renderOrder, const Material* material, const Vector3f& position, const Vector2f& size, const Vector2f& sinCos = Vector2f(0.f, 1.f), const Color& color = Color::White) = 0;
|
|
||||||
virtual void AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr<const Vector3f> positionPtr, SparsePtr<const Vector2f> sizePtr, SparsePtr<const Vector2f> sinCosPtr = nullptr, SparsePtr<const Color> colorPtr = nullptr) = 0;
|
virtual void AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr<const Vector3f> positionPtr, SparsePtr<const Vector2f> sizePtr, SparsePtr<const Vector2f> sinCosPtr = nullptr, SparsePtr<const Color> colorPtr = nullptr) = 0;
|
||||||
virtual void AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr<const Vector3f> positionPtr, SparsePtr<const Vector2f> sizePtr, SparsePtr<const Vector2f> sinCosPtr, SparsePtr<const float> alphaPtr) = 0;
|
virtual void AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr<const Vector3f> positionPtr, SparsePtr<const Vector2f> sizePtr, SparsePtr<const Vector2f> sinCosPtr, SparsePtr<const float> alphaPtr) = 0;
|
||||||
virtual void AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr<const Vector3f> positionPtr, SparsePtr<const Vector2f> sizePtr, SparsePtr<const float> anglePtr, SparsePtr<const Color> colorPtr = nullptr) = 0;
|
virtual void AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr<const Vector3f> positionPtr, SparsePtr<const Vector2f> sizePtr, SparsePtr<const float> anglePtr, SparsePtr<const Color> colorPtr = nullptr) = 0;
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ namespace Nz
|
||||||
DeferredRenderQueue(ForwardRenderQueue* forwardQueue);
|
DeferredRenderQueue(ForwardRenderQueue* forwardQueue);
|
||||||
~DeferredRenderQueue() = default;
|
~DeferredRenderQueue() = default;
|
||||||
|
|
||||||
void AddBillboard(int renderOrder, const Material* material, const Vector3f& position, const Vector2f& size, const Vector2f& sinCos = Vector2f(0.f, 1.f), const Color& color = Color::White) override;
|
|
||||||
void AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr<const Vector3f> positionPtr, SparsePtr<const Vector2f> sizePtr, SparsePtr<const Vector2f> sinCosPtr = nullptr, SparsePtr<const Color> colorPtr = nullptr) override;
|
void AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr<const Vector3f> positionPtr, SparsePtr<const Vector2f> sizePtr, SparsePtr<const Vector2f> sinCosPtr = nullptr, SparsePtr<const Color> colorPtr = nullptr) override;
|
||||||
void AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr<const Vector3f> positionPtr, SparsePtr<const Vector2f> sizePtr, SparsePtr<const Vector2f> sinCosPtr, SparsePtr<const float> alphaPtr) override;
|
void AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr<const Vector3f> positionPtr, SparsePtr<const Vector2f> sizePtr, SparsePtr<const Vector2f> sinCosPtr, SparsePtr<const float> alphaPtr) override;
|
||||||
void AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr<const Vector3f> positionPtr, SparsePtr<const Vector2f> sizePtr, SparsePtr<const float> anglePtr, SparsePtr<const Color> colorPtr = nullptr) override;
|
void AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr<const Vector3f> positionPtr, SparsePtr<const Vector2f> sizePtr, SparsePtr<const float> anglePtr, SparsePtr<const Color> colorPtr = nullptr) override;
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ namespace Nz
|
||||||
DepthRenderQueue();
|
DepthRenderQueue();
|
||||||
~DepthRenderQueue() = default;
|
~DepthRenderQueue() = default;
|
||||||
|
|
||||||
void AddBillboard(int renderOrder, const Material* material, const Vector3f& position, const Vector2f& size, const Vector2f& sinCos = Vector2f(0.f, 1.f), const Color& color = Color::White) override;
|
|
||||||
void AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr<const Vector3f> positionPtr, SparsePtr<const Vector2f> sizePtr, SparsePtr<const Vector2f> sinCosPtr = nullptr, SparsePtr<const Color> colorPtr = nullptr) override;
|
void AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr<const Vector3f> positionPtr, SparsePtr<const Vector2f> sizePtr, SparsePtr<const Vector2f> sinCosPtr = nullptr, SparsePtr<const Color> colorPtr = nullptr) override;
|
||||||
void AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr<const Vector3f> positionPtr, SparsePtr<const Vector2f> sizePtr, SparsePtr<const Vector2f> sinCosPtr, SparsePtr<const float> alphaPtr) override;
|
void AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr<const Vector3f> positionPtr, SparsePtr<const Vector2f> sizePtr, SparsePtr<const Vector2f> sinCosPtr, SparsePtr<const float> alphaPtr) override;
|
||||||
void AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr<const Vector3f> positionPtr, SparsePtr<const Vector2f> sizePtr, SparsePtr<const float> anglePtr, SparsePtr<const Color> colorPtr = nullptr) override;
|
void AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr<const Vector3f> positionPtr, SparsePtr<const Vector2f> sizePtr, SparsePtr<const float> anglePtr, SparsePtr<const Color> colorPtr = nullptr) override;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ namespace Nz
|
||||||
ForwardRenderQueue() = default;
|
ForwardRenderQueue() = default;
|
||||||
~ForwardRenderQueue() = default;
|
~ForwardRenderQueue() = default;
|
||||||
|
|
||||||
void AddBillboard(int renderOrder, const Material* material, const Vector3f& position, const Vector2f& size, const Vector2f& sinCos = Vector2f(0.f, 1.f), const Color& color = Color::White) override;
|
|
||||||
void AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr<const Vector3f> positionPtr, SparsePtr<const Vector2f> sizePtr, SparsePtr<const Vector2f> sinCosPtr = nullptr, SparsePtr<const Color> colorPtr = nullptr) override;
|
void AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr<const Vector3f> positionPtr, SparsePtr<const Vector2f> sizePtr, SparsePtr<const Vector2f> sinCosPtr = nullptr, SparsePtr<const Color> colorPtr = nullptr) override;
|
||||||
void AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr<const Vector3f> positionPtr, SparsePtr<const Vector2f> sizePtr, SparsePtr<const Vector2f> sinCosPtr, SparsePtr<const float> alphaPtr) override;
|
void AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr<const Vector3f> positionPtr, SparsePtr<const Vector2f> sizePtr, SparsePtr<const Vector2f> sinCosPtr, SparsePtr<const float> alphaPtr) override;
|
||||||
void AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr<const Vector3f> positionPtr, SparsePtr<const Vector2f> sizePtr, SparsePtr<const float> anglePtr, SparsePtr<const Color> colorPtr = nullptr) override;
|
void AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr<const Vector3f> positionPtr, SparsePtr<const Vector2f> sizePtr, SparsePtr<const float> anglePtr, SparsePtr<const Color> colorPtr = nullptr) override;
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,8 @@ namespace Nz
|
||||||
if (!m_material)
|
if (!m_material)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
renderQueue->AddBillboard(instanceData.renderOrder, m_material, instanceData.transformMatrix->GetTranslation(), m_size, m_sinCos, m_color);
|
Nz::Vector3f position = instanceData.transformMatrix->GetTranslation();
|
||||||
|
renderQueue->AddBillboards(instanceData.renderOrder, m_material, 1, &position, &m_size, &m_sinCos, &m_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -29,22 +29,6 @@ namespace Nz
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Adds billboard to the queue
|
|
||||||
*
|
|
||||||
* \param renderOrder Order of rendering
|
|
||||||
* \param material Material of the billboard
|
|
||||||
* \param position Position of the billboard
|
|
||||||
* \param size Sizes of the billboard
|
|
||||||
* \param sinCos Rotation of the billboard
|
|
||||||
* \param color Color of the billboard
|
|
||||||
*/
|
|
||||||
|
|
||||||
void DeferredRenderQueue::AddBillboard(int renderOrder, const Material* material, const Vector3f& position, const Vector2f& size, const Vector2f& sinCos, const Color& color)
|
|
||||||
{
|
|
||||||
m_forwardQueue->AddBillboard(renderOrder, material, position, size, sinCos, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Adds multiple billboards to the queue
|
* \brief Adds multiple billboards to the queue
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -28,35 +28,6 @@ namespace Nz
|
||||||
//m_baseMaterial->SetFaceCulling(FaceSide_Front);
|
//m_baseMaterial->SetFaceCulling(FaceSide_Front);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Adds billboard to the queue
|
|
||||||
*
|
|
||||||
* \param renderOrder Order of rendering
|
|
||||||
* \param material Material of the billboard
|
|
||||||
* \param position Position of the billboard
|
|
||||||
* \param size Sizes of the billboard
|
|
||||||
* \param sinCos Rotation of the billboard
|
|
||||||
* \param color Color of the billboard
|
|
||||||
*
|
|
||||||
* \remark Produces a NazaraAssert if material is invalid
|
|
||||||
*/
|
|
||||||
|
|
||||||
void DepthRenderQueue::AddBillboard(int renderOrder, const Material* material, const Vector3f& position, const Vector2f& size, const Vector2f& sinCos, const Color& color)
|
|
||||||
{
|
|
||||||
NazaraAssert(material, "Invalid material");
|
|
||||||
NazaraUnused(renderOrder);
|
|
||||||
|
|
||||||
if (!IsMaterialSuitable(material))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (material->HasDepthMaterial())
|
|
||||||
material = material->GetDepthMaterial();
|
|
||||||
else
|
|
||||||
material = m_baseMaterial;
|
|
||||||
|
|
||||||
ForwardRenderQueue::AddBillboard(0, material, position, size, sinCos, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Adds multiple billboards to the queue
|
* \brief Adds multiple billboards to the queue
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -17,40 +17,6 @@ namespace Nz
|
||||||
* \brief Graphics class that represents the rendering queue for forward rendering
|
* \brief Graphics class that represents the rendering queue for forward rendering
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Adds billboard to the queue
|
|
||||||
*
|
|
||||||
* \param renderOrder Order of rendering
|
|
||||||
* \param material Material of the billboard
|
|
||||||
* \param position Position of the billboard
|
|
||||||
* \param size Sizes of the billboard
|
|
||||||
* \param sinCos Rotation of the billboard
|
|
||||||
* \param color Color of the billboard
|
|
||||||
*
|
|
||||||
* \remark Produces a NazaraAssert if material is invalid
|
|
||||||
*/
|
|
||||||
|
|
||||||
void ForwardRenderQueue::AddBillboard(int renderOrder, const Material* material, const Vector3f& position, const Vector2f& size, const Vector2f& sinCos, const Color& color)
|
|
||||||
{
|
|
||||||
NazaraAssert(material, "Invalid material");
|
|
||||||
|
|
||||||
auto& billboards = GetLayer(renderOrder).billboards;
|
|
||||||
|
|
||||||
auto it = billboards.find(material);
|
|
||||||
if (it == billboards.end())
|
|
||||||
{
|
|
||||||
BatchedBillboardEntry entry;
|
|
||||||
entry.materialReleaseSlot.Connect(material->OnMaterialRelease, this, &ForwardRenderQueue::OnMaterialInvalidation);
|
|
||||||
|
|
||||||
it = billboards.insert(std::make_pair(material, std::move(entry))).first;
|
|
||||||
}
|
|
||||||
|
|
||||||
BatchedBillboardEntry& entry = it->second;
|
|
||||||
|
|
||||||
auto& billboardVector = entry.billboards;
|
|
||||||
billboardVector.push_back(BillboardData{color, position, size, sinCos});
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Adds multiple billboards to the queue
|
* \brief Adds multiple billboards to the queue
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue