// Copyright (C) 2015 Jérôme Leclercq // This file is part of the "Nazara Engine - Graphics module" // For conditions of distribution and use, see copyright notice in Config.hpp #include #include #include #include namespace Nz { /*! * \ingroup graphics * \class Nz::DepthRenderQueue * \brief Graphics class that represents the rendering queue for depth rendering */ /*! * \brief Constructs a DepthRenderTechnique object by default */ DepthRenderQueue::DepthRenderQueue() { // Material m_baseMaterial = Material::New(); m_baseMaterial->Enable(RendererParameter_ColorWrite, false); m_baseMaterial->Enable(RendererParameter_FaceCulling, false); //m_baseMaterial->SetFaceCulling(FaceSide_Front); } /*! * \brief Adds multiple billboards to the queue * * \param renderOrder Order of rendering * \param material Material of the billboards * \param count Number of billboards * \param positionPtr Position of the billboards * \param sizePtr Sizes of the billboards * \param sinCosPtr Rotation of the billboards if null, Vector2f(0.f, 1.f) is used * \param colorPtr Color of the billboards if null, Color::White is used * * \remark Produces a NazaraAssert if material is invalid */ void DepthRenderQueue::AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr positionPtr, SparsePtr sizePtr, SparsePtr sinCosPtr, SparsePtr colorPtr) { NazaraAssert(material, "Invalid material"); NazaraUnused(renderOrder); if (!IsMaterialSuitable(material)) return; if (material->HasDepthMaterial()) material = material->GetDepthMaterial(); else material = m_baseMaterial; ForwardRenderQueue::AddBillboards(0, material, count, positionPtr, sizePtr, sinCosPtr, colorPtr); } /*! * \brief Adds multiple billboards to the queue * * \param renderOrder Order of rendering * \param material Material of the billboards * \param count Number of billboards * \param positionPtr Position of the billboards * \param sizePtr Sizes of the billboards * \param sinCosPtr Rotation of the billboards if null, Vector2f(0.f, 1.f) is used * \param alphaPtr Alpha parameters of the billboards if null, 1.f is used * * \remark Produces a NazaraAssert if material is invalid */ void DepthRenderQueue::AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr positionPtr, SparsePtr sizePtr, SparsePtr sinCosPtr, SparsePtr alphaPtr) { NazaraAssert(material, "Invalid material"); NazaraUnused(renderOrder); if (!IsMaterialSuitable(material)) return; if (material->HasDepthMaterial()) material = material->GetDepthMaterial(); else material = m_baseMaterial; ForwardRenderQueue::AddBillboards(0, material, count, positionPtr, sizePtr, sinCosPtr, alphaPtr); } /*! * \brief Adds multiple billboards to the queue * * \param renderOrder Order of rendering * \param material Material of the billboards * \param count Number of billboards * \param positionPtr Position of the billboards * \param sizePtr Sizes of the billboards * \param anglePtr Rotation of the billboards if null, 0.f is used * \param colorPtr Color of the billboards if null, Color::White is used * * \remark Produces a NazaraAssert if material is invalid */ void DepthRenderQueue::AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr positionPtr, SparsePtr sizePtr, SparsePtr anglePtr, SparsePtr colorPtr) { NazaraAssert(material, "Invalid material"); NazaraUnused(renderOrder); if (!IsMaterialSuitable(material)) return; if (material->HasDepthMaterial()) material = material->GetDepthMaterial(); else material = m_baseMaterial; ForwardRenderQueue::AddBillboards(0, material, count, positionPtr, sizePtr, anglePtr, colorPtr); } /*! * \brief Adds multiple billboards to the queue * * \param renderOrder Order of rendering * \param material Material of the billboards * \param count Number of billboards * \param positionPtr Position of the billboards * \param sizePtr Sizes of the billboards * \param anglePtr Rotation of the billboards if null, 0.f is used * \param alphaPtr Alpha parameters of the billboards if null, 1.f is used * * \remark Produces a NazaraAssert if material is invalid */ void DepthRenderQueue::AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr positionPtr, SparsePtr sizePtr, SparsePtr anglePtr, SparsePtr alphaPtr) { NazaraAssert(material, "Invalid material"); NazaraUnused(renderOrder); if (!IsMaterialSuitable(material)) return; if (material->HasDepthMaterial()) material = material->GetDepthMaterial(); else material = m_baseMaterial; ForwardRenderQueue::AddBillboards(0, material, count, positionPtr, sizePtr, anglePtr, alphaPtr); } /*! * \brief Adds multiple billboards to the queue * * \param renderOrder Order of rendering * \param material Material of the billboards * \param count Number of billboards * \param positionPtr Position of the billboards * \param sizePtr Size of the billboards * \param sinCosPtr Rotation of the billboards if null, Vector2f(0.f, 1.f) is used * \param colorPtr Color of the billboards if null, Color::White is used * * \remark Produces a NazaraAssert if material is invalid */ void DepthRenderQueue::AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr positionPtr, SparsePtr sizePtr, SparsePtr sinCosPtr, SparsePtr colorPtr) { NazaraAssert(material, "Invalid material"); NazaraUnused(renderOrder); if (!IsMaterialSuitable(material)) return; if (material->HasDepthMaterial()) material = material->GetDepthMaterial(); else material = m_baseMaterial; ForwardRenderQueue::AddBillboards(0, material, count, positionPtr, sizePtr, sinCosPtr, colorPtr); } /*! * \brief Adds multiple billboards to the queue * * \param renderOrder Order of rendering * \param material Material of the billboards * \param count Number of billboards * \param positionPtr Position of the billboards * \param sizePtr Size of the billboards * \param sinCosPtr Rotation of the billboards if null, Vector2f(0.f, 1.f) is used * \param alphaPtr Alpha parameters of the billboards if null, 1.f is used * * \remark Produces a NazaraAssert if material is invalid */ void DepthRenderQueue::AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr positionPtr, SparsePtr sizePtr, SparsePtr sinCosPtr, SparsePtr alphaPtr) { NazaraAssert(material, "Invalid material"); NazaraUnused(renderOrder); if (!IsMaterialSuitable(material)) return; if (material->HasDepthMaterial()) material = material->GetDepthMaterial(); else material = m_baseMaterial; ForwardRenderQueue::AddBillboards(0, material, count, positionPtr, sizePtr, sinCosPtr, alphaPtr); } /*! * \brief Adds multiple billboards to the queue * * \param renderOrder Order of rendering * \param material Material of the billboards * \param count Number of billboards * \param positionPtr Position of the billboards * \param sizePtr Size of the billboards * \param anglePtr Rotation of the billboards if null, 0.f is used * \param colorPtr Color of the billboards if null, Color::White is used * * \remark Produces a NazaraAssert if material is invalid */ void DepthRenderQueue::AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr positionPtr, SparsePtr sizePtr, SparsePtr anglePtr, SparsePtr colorPtr) { NazaraAssert(material, "Invalid material"); NazaraUnused(renderOrder); if (!IsMaterialSuitable(material)) return; if (material->HasDepthMaterial()) material = material->GetDepthMaterial(); else material = m_baseMaterial; ForwardRenderQueue::AddBillboards(0, material, count, positionPtr, sizePtr, anglePtr, colorPtr); } /*! * \brief Adds multiple billboards to the queue * * \param renderOrder Order of rendering * \param material Material of the billboards * \param count Number of billboards * \param positionPtr Position of the billboards * \param sizePtr Size of the billboards * \param anglePtr Rotation of the billboards if null, 0.f is used * \param alphaPtr Alpha parameters of the billboards if null, 1.f is used * * \remark Produces a NazaraAssert if material is invalid */ void DepthRenderQueue::AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr positionPtr, SparsePtr sizePtr, SparsePtr anglePtr, SparsePtr alphaPtr) { NazaraAssert(material, "Invalid material"); NazaraUnused(renderOrder); if (!IsMaterialSuitable(material)) return; if (material->HasDepthMaterial()) material = material->GetDepthMaterial(); else material = m_baseMaterial; ForwardRenderQueue::AddBillboards(0, material, count, positionPtr, sizePtr, anglePtr, alphaPtr); } /*! * \brief Adds a direcitonal light to the queue * * \param light Light to add * * \remark Produces a NazaraAssert */ void DepthRenderQueue::AddDirectionalLight(const DirectionalLight& light) { NazaraAssert(false, "Depth render queue doesn't handle lights"); NazaraUnused(light); } /*! * \brief Adds mesh to the queue * * \param renderOrder Order of rendering * \param material Material of the mesh * \param meshData Data of the mesh * \param meshAABB Box of the mesh * \param transformMatrix Matrix of the mesh * * \remark Produces a NazaraAssert if material is invalid */ void DepthRenderQueue::AddMesh(int renderOrder, const Material* material, const MeshData& meshData, const Boxf& meshAABB, const Matrix4f& transformMatrix) { NazaraAssert(material, "Invalid material"); NazaraUnused(renderOrder); NazaraUnused(meshAABB); if (!IsMaterialSuitable(material)) return; if (material->HasDepthMaterial()) material = material->GetDepthMaterial(); else material = m_baseMaterial; ForwardRenderQueue::AddMesh(0, material, meshData, meshAABB, transformMatrix); } /*! * \brief Adds a point light to the queue * * \param light Light to add * * \remark Produces a NazaraAssert */ void DepthRenderQueue::AddPointLight(const PointLight& light) { NazaraAssert(false, "Depth render queue doesn't handle lights"); NazaraUnused(light); } /*! * \brief Adds a spot light to the queue * * \param light Light to add * * \remark Produces a NazaraAssert */ void DepthRenderQueue::AddSpotLight(const SpotLight& light) { NazaraAssert(false, "Depth render queue doesn't handle lights"); NazaraUnused(light); } /*! * \brief Adds sprites to the queue * * \param renderOrder Order of rendering * \param material Material of the sprites * \param vertices Buffer of data for the sprites * \param spriteCount Number of sprites * \param overlay Texture of the sprites * * \remark Produces a NazaraAssert if material is invalid */ void DepthRenderQueue::AddSprites(int renderOrder, const Material* material, const VertexStruct_XYZ_Color_UV* vertices, unsigned int spriteCount, const Texture* overlay) { NazaraAssert(material, "Invalid material"); NazaraUnused(renderOrder); NazaraUnused(overlay); if (!IsMaterialSuitable(material)) return; if (material->HasDepthMaterial()) material = material->GetDepthMaterial(); else material = m_baseMaterial; ForwardRenderQueue::AddSprites(0, material, vertices, spriteCount, overlay); } }