Graphics/RenderQueue: Replace AddLight method by variations
Former-commit-id: 79ad49d60bd8d397aa606cded7c0dd2d20a078dc
This commit is contained in:
@@ -15,11 +15,10 @@
|
||||
#include <Nazara/Math/Matrix4.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
#include <Nazara/Utility/VertexStruct.hpp>
|
||||
#include <vector>
|
||||
|
||||
class NzDrawable;
|
||||
class NzLight;
|
||||
class NzMaterial;
|
||||
class NzSprite;
|
||||
class NzTexture;
|
||||
struct NzMeshData;
|
||||
|
||||
@@ -41,11 +40,49 @@ class NAZARA_API NzAbstractRenderQueue : NzNonCopyable
|
||||
virtual 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) = 0;
|
||||
virtual void AddBillboards(const NzMaterial* material, unsigned int count, NzSparsePtr<const NzVector3f> positionPtr, NzSparsePtr<const float> sizePtr, NzSparsePtr<const float> anglePtr, NzSparsePtr<const float> alphaPtr) = 0;
|
||||
virtual void AddDrawable(const NzDrawable* drawable) = 0;
|
||||
virtual void AddLight(const NzLight* light) = 0;
|
||||
virtual void AddDirectionalLight(const NzColor& color, float ambientFactor, float diffuseFactor, const NzVector3f& direction);
|
||||
virtual void AddMesh(const NzMaterial* material, const NzMeshData& meshData, const NzBoxf& meshAABB, const NzMatrix4f& transformMatrix) = 0;
|
||||
virtual void AddPointLight(const NzColor& color, float ambientFactor, float diffuseFactor, const NzVector3f& position, float radius, float attenuation);
|
||||
virtual void AddSpotLight(const NzColor& color, float ambientFactor, float diffuseFactor, const NzVector3f& position, const NzVector3f& direction, float radius, float attenuation, float innerAngle, float outerAngle);
|
||||
virtual void AddSprites(const NzMaterial* material, const NzVertexStruct_XYZ_Color_UV* vertices, unsigned int spriteCount, const NzTexture* overlay = nullptr) = 0;
|
||||
|
||||
virtual void Clear(bool fully) = 0;
|
||||
virtual void Clear(bool fully);
|
||||
|
||||
protected:
|
||||
struct DirectionalLight
|
||||
{
|
||||
NzColor color;
|
||||
NzVector3f direction;
|
||||
float ambientFactor;
|
||||
float diffuseFactor;
|
||||
};
|
||||
|
||||
struct PointLight
|
||||
{
|
||||
NzColor color;
|
||||
NzVector3f position;
|
||||
float ambientFactor;
|
||||
float attenuation;
|
||||
float diffuseFactor;
|
||||
float radius;
|
||||
};
|
||||
|
||||
struct SpotLight
|
||||
{
|
||||
NzColor color;
|
||||
NzVector3f direction;
|
||||
NzVector3f position;
|
||||
float ambientFactor;
|
||||
float attenuation;
|
||||
float diffuseFactor;
|
||||
float innerAngle;
|
||||
float outerAngle;
|
||||
float radius;
|
||||
};
|
||||
|
||||
std::vector<DirectionalLight> m_directionalLights;
|
||||
std::vector<PointLight> m_pointLights;
|
||||
std::vector<SpotLight> m_spotLights;
|
||||
};
|
||||
|
||||
#endif // NAZARA_ABSTRACTRENDERQUEUE_HPP
|
||||
|
||||
@@ -38,7 +38,6 @@ class NAZARA_API NzDeferredRenderQueue : public NzAbstractRenderQueue, NzObjectL
|
||||
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 AddDrawable(const NzDrawable* drawable) override;
|
||||
void AddLight(const NzLight* light) override;
|
||||
void AddMesh(const NzMaterial* material, const NzMeshData& meshData, const NzBoxf& meshAABB, const NzMatrix4f& transformMatrix) override;
|
||||
void AddSprites(const NzMaterial* material, const NzVertexStruct_XYZ_Color_UV* vertices, unsigned int spriteCount, const NzTexture* overlay = nullptr) override;
|
||||
|
||||
@@ -83,12 +82,8 @@ class NAZARA_API NzDeferredRenderQueue : public NzAbstractRenderQueue, NzObjectL
|
||||
};
|
||||
|
||||
typedef std::map<const NzMaterial*, BatchedModelEntry, BatchedModelMaterialComparator> ModelBatches;
|
||||
typedef std::vector<const NzLight*> LightContainer;
|
||||
|
||||
ModelBatches opaqueModels;
|
||||
LightContainer directionalLights;
|
||||
LightContainer pointLights;
|
||||
LightContainer spotLights;
|
||||
NzForwardRenderQueue* m_forwardQueue;
|
||||
|
||||
private:
|
||||
|
||||
@@ -40,7 +40,6 @@ class NAZARA_API NzForwardRenderQueue : public NzAbstractRenderQueue, NzObjectLi
|
||||
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 AddDrawable(const NzDrawable* drawable) override;
|
||||
void AddLight(const NzLight* light) override;
|
||||
void AddMesh(const NzMaterial* material, const NzMeshData& meshData, const NzBoxf& meshAABB, const NzMatrix4f& transformMatrix) override;
|
||||
void AddSprites(const NzMaterial* material, const NzVertexStruct_XYZ_Color_UV* vertices, unsigned int spriteCount, const NzTexture* overlay = nullptr) override;
|
||||
|
||||
@@ -168,7 +167,6 @@ class NAZARA_API NzForwardRenderQueue : public NzAbstractRenderQueue, NzObjectLi
|
||||
const NzMaterial* material;
|
||||
};
|
||||
|
||||
typedef std::vector<const NzLight*> LightContainer;
|
||||
typedef std::vector<unsigned int> TransparentModelContainer;
|
||||
|
||||
BatchedBillboardContainer billboards;
|
||||
@@ -177,8 +175,6 @@ class NAZARA_API NzForwardRenderQueue : public NzAbstractRenderQueue, NzObjectLi
|
||||
TransparentModelContainer transparentModels;
|
||||
std::vector<TransparentModelData> transparentModelData;
|
||||
std::vector<const NzDrawable*> otherDrawables;
|
||||
LightContainer directionalLights;
|
||||
LightContainer lights;
|
||||
};
|
||||
|
||||
#endif // NAZARA_FORWARDRENDERQUEUE_HPP
|
||||
|
||||
Reference in New Issue
Block a user