Graphics/DepthRender: Fix compilation
Former-commit-id: 749e3b67038cba20c46bd5570e616608200733f5
This commit is contained in:
@@ -18,31 +18,36 @@
|
||||
#include <map>
|
||||
#include <tuple>
|
||||
|
||||
class NAZARA_GRAPHICS_API NzDepthRenderQueue : public NzForwardRenderQueue
|
||||
namespace Nz
|
||||
{
|
||||
public:
|
||||
NzDepthRenderQueue();
|
||||
~NzDepthRenderQueue() = default;
|
||||
class NAZARA_GRAPHICS_API DepthRenderQueue : public ForwardRenderQueue
|
||||
{
|
||||
public:
|
||||
DepthRenderQueue();
|
||||
~DepthRenderQueue() = default;
|
||||
|
||||
void AddBillboard(const NzMaterial* material, const NzVector3f& position, const NzVector2f& size, const NzVector2f& sinCos = NzVector2f(0.f, 1.f), const NzColor& color = NzColor::White) override;
|
||||
void AddBillboards(const NzMaterial* material, unsigned int count, NzSparsePtr<const NzVector3f> positionPtr, NzSparsePtr<const NzVector2f> sizePtr, NzSparsePtr<const NzVector2f> sinCosPtr = nullptr, NzSparsePtr<const NzColor> colorPtr = nullptr) override;
|
||||
void AddBillboards(const NzMaterial* material, unsigned int count, NzSparsePtr<const NzVector3f> positionPtr, NzSparsePtr<const NzVector2f> sizePtr, NzSparsePtr<const NzVector2f> sinCosPtr, NzSparsePtr<const float> alphaPtr) override;
|
||||
void AddBillboards(const NzMaterial* material, unsigned int count, NzSparsePtr<const NzVector3f> positionPtr, NzSparsePtr<const NzVector2f> sizePtr, NzSparsePtr<const float> anglePtr, NzSparsePtr<const NzColor> colorPtr = nullptr) override;
|
||||
void AddBillboards(const NzMaterial* material, unsigned int count, NzSparsePtr<const NzVector3f> positionPtr, NzSparsePtr<const NzVector2f> sizePtr, NzSparsePtr<const float> anglePtr, NzSparsePtr<const float> alphaPtr) override;
|
||||
void AddBillboards(const NzMaterial* material, unsigned int count, NzSparsePtr<const NzVector3f> positionPtr, NzSparsePtr<const float> sizePtr, NzSparsePtr<const NzVector2f> sinCosPtr = nullptr, NzSparsePtr<const NzColor> colorPtr = nullptr) override;
|
||||
void AddBillboards(const NzMaterial* material, unsigned int count, NzSparsePtr<const NzVector3f> positionPtr, NzSparsePtr<const float> sizePtr, NzSparsePtr<const NzVector2f> sinCosPtr, NzSparsePtr<const float> alphaPtr) override;
|
||||
void AddBillboards(const NzMaterial* material, unsigned int count, NzSparsePtr<const NzVector3f> positionPtr, NzSparsePtr<const float> sizePtr, NzSparsePtr<const float> anglePtr, NzSparsePtr<const NzColor> colorPtr = nullptr) override;
|
||||
void AddBillboards(const NzMaterial* material, unsigned int count, NzSparsePtr<const NzVector3f> positionPtr, NzSparsePtr<const float> sizePtr, NzSparsePtr<const float> anglePtr, NzSparsePtr<const float> alphaPtr) override;
|
||||
void AddDirectionalLight(const DirectionalLight& light) override;
|
||||
void AddMesh(const NzMaterial* material, const NzMeshData& meshData, const NzBoxf& meshAABB, const NzMatrix4f& transformMatrix) override;
|
||||
void AddPointLight(const PointLight& light) override;
|
||||
void AddSpotLight(const SpotLight& light) override;
|
||||
void AddSprites(const NzMaterial* material, const NzVertexStruct_XYZ_Color_UV* vertices, unsigned int spriteCount, const NzTexture* overlay = nullptr) override;
|
||||
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, 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 float> alphaPtr) override;
|
||||
void AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr<const Vector3f> positionPtr, SparsePtr<const float> 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 float> 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 float> 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 float> sizePtr, SparsePtr<const float> anglePtr, SparsePtr<const float> alphaPtr) override;
|
||||
void AddDirectionalLight(const DirectionalLight& light) override;
|
||||
void AddMesh(int renderOrder, const Material* material, const MeshData& meshData, const Boxf& meshAABB, const Matrix4f& transformMatrix) override;
|
||||
void AddPointLight(const PointLight& light) override;
|
||||
void AddSpotLight(const SpotLight& light) override;
|
||||
void AddSprites(int renderOrder, const Material* material, const VertexStruct_XYZ_Color_UV* vertices, unsigned int spriteCount, const Texture* overlay = nullptr) override;
|
||||
|
||||
private:
|
||||
bool IsMaterialSuitable(const NzMaterial* material) const;
|
||||
private:
|
||||
inline bool IsMaterialSuitable(const Material* material) const;
|
||||
|
||||
NzMaterialRef m_baseMaterial;
|
||||
};
|
||||
MaterialRef m_baseMaterial;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Graphics/DepthRenderQueue.inl>
|
||||
|
||||
#endif // NAZARA_DEPTHRENDERQUEUE_HPP
|
||||
|
||||
@@ -16,65 +16,62 @@
|
||||
#include <Nazara/Utility/IndexBuffer.hpp>
|
||||
#include <Nazara/Utility/VertexBuffer.hpp>
|
||||
|
||||
class NAZARA_GRAPHICS_API NzDepthRenderTechnique : public NzAbstractRenderTechnique
|
||||
namespace Nz
|
||||
{
|
||||
public:
|
||||
NzDepthRenderTechnique();
|
||||
~NzDepthRenderTechnique() = default;
|
||||
class NAZARA_GRAPHICS_API DepthRenderTechnique : public AbstractRenderTechnique
|
||||
{
|
||||
public:
|
||||
DepthRenderTechnique();
|
||||
~DepthRenderTechnique() = default;
|
||||
|
||||
bool Draw(const NzSceneData& sceneData) const override;
|
||||
bool Draw(const SceneData& sceneData) const override;
|
||||
|
||||
NzAbstractRenderQueue* GetRenderQueue() override;
|
||||
nzRenderTechniqueType GetType() const override;
|
||||
AbstractRenderQueue* GetRenderQueue() override;
|
||||
RenderTechniqueType GetType() const override;
|
||||
|
||||
static bool Initialize();
|
||||
static void Uninitialize();
|
||||
static bool Initialize();
|
||||
static void Uninitialize();
|
||||
|
||||
private:
|
||||
struct ShaderUniforms;
|
||||
private:
|
||||
struct ShaderUniforms;
|
||||
|
||||
void DrawBasicSprites(const NzSceneData& sceneData) const;
|
||||
void DrawBillboards(const NzSceneData& sceneData) const;
|
||||
void DrawOpaqueModels(const NzSceneData& sceneData) const;
|
||||
const ShaderUniforms* GetShaderUniforms(const NzShader* shader) const;
|
||||
void OnShaderInvalidated(const NzShader* shader) const;
|
||||
void DrawBasicSprites(const SceneData& sceneData, ForwardRenderQueue::Layer& layer) const;
|
||||
void DrawBillboards(const SceneData& sceneData, ForwardRenderQueue::Layer& layer) const;
|
||||
void DrawOpaqueModels(const SceneData& sceneData, ForwardRenderQueue::Layer& layer) const;
|
||||
const ShaderUniforms* GetShaderUniforms(const Shader* shader) const;
|
||||
void OnShaderInvalidated(const Shader* shader) const;
|
||||
|
||||
struct LightIndex
|
||||
{
|
||||
nzLightType type;
|
||||
float score;
|
||||
unsigned int index;
|
||||
};
|
||||
struct LightIndex
|
||||
{
|
||||
LightType type;
|
||||
float score;
|
||||
unsigned int index;
|
||||
};
|
||||
|
||||
struct ShaderUniforms
|
||||
{
|
||||
NazaraSlot(NzShader, OnShaderUniformInvalidated, shaderUniformInvalidatedSlot);
|
||||
NazaraSlot(NzShader, OnShaderRelease, shaderReleaseSlot);
|
||||
struct ShaderUniforms
|
||||
{
|
||||
NazaraSlot(Shader, OnShaderUniformInvalidated, shaderUniformInvalidatedSlot);
|
||||
NazaraSlot(Shader, OnShaderRelease, shaderReleaseSlot);
|
||||
|
||||
NzLightUniforms lightUniforms;
|
||||
bool hasLightUniforms;
|
||||
// Autre uniformes
|
||||
int eyePosition;
|
||||
int sceneAmbient;
|
||||
int textureOverlay;
|
||||
};
|
||||
|
||||
/// Moins coûteux en mémoire que de stocker un NzLightUniforms par index de lumière,
|
||||
/// à voir si ça fonctionne chez tout le monde
|
||||
int lightOffset; // "Distance" entre Lights[0].type et Lights[1].type
|
||||
mutable std::unordered_map<const Shader*, ShaderUniforms> m_shaderUniforms;
|
||||
Buffer m_vertexBuffer;
|
||||
mutable DepthRenderQueue m_renderQueue;
|
||||
VertexBuffer m_billboardPointBuffer;
|
||||
VertexBuffer m_spriteBuffer;
|
||||
|
||||
// Autre uniformes
|
||||
int eyePosition;
|
||||
int sceneAmbient;
|
||||
int textureOverlay;
|
||||
};
|
||||
static IndexBuffer s_quadIndexBuffer;
|
||||
static VertexBuffer s_quadVertexBuffer;
|
||||
static VertexDeclaration s_billboardInstanceDeclaration;
|
||||
static VertexDeclaration s_billboardVertexDeclaration;
|
||||
};
|
||||
}
|
||||
|
||||
mutable std::unordered_map<const NzShader*, ShaderUniforms> m_shaderUniforms;
|
||||
NzBuffer m_vertexBuffer;
|
||||
mutable NzDepthRenderQueue m_renderQueue;
|
||||
NzVertexBuffer m_billboardPointBuffer;
|
||||
NzVertexBuffer m_spriteBuffer;
|
||||
|
||||
static NzIndexBuffer s_quadIndexBuffer;
|
||||
static NzVertexBuffer s_quadVertexBuffer;
|
||||
static NzVertexDeclaration s_billboardInstanceDeclaration;
|
||||
static NzVertexDeclaration s_billboardVertexDeclaration;
|
||||
};
|
||||
|
||||
#include <Nazara/Graphics/dEPTHRenderTechnique.inl>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user