Graphics/AbstractRenderQueue: Remove AddBillboard method
Former-commit-id: 9429c5e127d9c4d2172d5ae224b60338d62a58ce [formerly 8e723fad4893f182a3d7b7735e5a156973ca6e59] [formerly d961c2da7c6989cd861d4a703608466dede9ba40 [formerly 20783627678843cb2f1c414862193c079d81e168]] Former-commit-id: b019c83ab483922120a9d37c16e8294694a16aa3 [formerly a651bc66c4cb96962a34ef3f2ade62d91ce1d6b7] Former-commit-id: 820dcb4d787709600d9306025c34b9feb1ced7b2
This commit is contained in:
parent
1d758d370c
commit
3cf4cd3d53
|
|
@ -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