Graphics/Material: Fix depth sorting flag handling for meshes
This commit is contained in:
@@ -51,7 +51,7 @@ namespace Nz
|
||||
virtual void AddMesh(int renderOrder, const Material* material, const MeshData& meshData, const Boxf& meshAABB, const Matrix4f& transformMatrix) = 0;
|
||||
virtual void AddPointLight(const PointLight& light);
|
||||
virtual void AddSpotLight(const SpotLight& light);
|
||||
virtual void AddSprites(int renderOrder, const Material* material, const VertexStruct_XYZ_Color_UV* vertices, unsigned int spriteCount, const Texture* overlay = nullptr) = 0;
|
||||
virtual void AddSprites(int renderOrder, const Material* material, const VertexStruct_XYZ_Color_UV* vertices, std::size_t spriteCount, const Texture* overlay = nullptr) = 0;
|
||||
|
||||
virtual void Clear(bool fully = false);
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace Nz
|
||||
virtual Vector3f GetForward() const = 0;
|
||||
virtual const Frustumf& GetFrustum() const = 0;
|
||||
virtual const Matrix4f& GetProjectionMatrix() const = 0;
|
||||
virtual Nz::ProjectionType GetProjectionType() const = 0;
|
||||
virtual const RenderTarget* GetTarget() const = 0;
|
||||
virtual const Matrix4f& GetViewMatrix() const = 0;
|
||||
virtual const Recti& GetViewport() const = 0;
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Nz
|
||||
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 AddDrawable(int renderOrder, const Drawable* drawable) override;
|
||||
void AddMesh(int renderOrder, const Material* material, const MeshData& meshData, const Boxf& meshAABB, const Matrix4f& transformMatrix) override;
|
||||
void AddSprites(int renderOrder, const Material* material, const VertexStruct_XYZ_Color_UV* vertices, unsigned int spriteCount, const Texture* overlay = nullptr) override;
|
||||
void AddSprites(int renderOrder, const Material* material, const VertexStruct_XYZ_Color_UV* vertices, std::size_t spriteCount, const Texture* overlay = nullptr) override;
|
||||
|
||||
void Clear(bool fully = false) override;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Nz
|
||||
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;
|
||||
void AddSprites(int renderOrder, const Material* material, const VertexStruct_XYZ_Color_UV* vertices, std::size_t spriteCount, const Texture* overlay = nullptr) override;
|
||||
|
||||
private:
|
||||
inline bool IsMaterialSuitable(const Material* material) const;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <Nazara/Graphics/Material.hpp>
|
||||
#include <Nazara/Math/Box.hpp>
|
||||
#include <Nazara/Math/Matrix4.hpp>
|
||||
#include <Nazara/Math/Plane.hpp>
|
||||
#include <Nazara/Utility/IndexBuffer.hpp>
|
||||
#include <Nazara/Utility/MeshData.hpp>
|
||||
#include <Nazara/Utility/VertexBuffer.hpp>
|
||||
@@ -41,7 +42,7 @@ namespace Nz
|
||||
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 AddDrawable(int renderOrder, const Drawable* drawable) override;
|
||||
void AddMesh(int renderOrder, const Material* material, const MeshData& meshData, const Boxf& meshAABB, const Matrix4f& transformMatrix) override;
|
||||
void AddSprites(int renderOrder, const Material* material, const VertexStruct_XYZ_Color_UV* vertices, unsigned int spriteCount, const Texture* overlay = nullptr) override;
|
||||
void AddSprites(int renderOrder, const Material* material, const VertexStruct_XYZ_Color_UV* vertices, std::size_t spriteCount, const Texture* overlay = nullptr) override;
|
||||
|
||||
void Clear(bool fully = false) override;
|
||||
|
||||
@@ -156,7 +157,7 @@ namespace Nz
|
||||
{
|
||||
Matrix4f transformMatrix;
|
||||
MeshData meshData;
|
||||
Spheref squaredBoundingSphere;
|
||||
Spheref obbSphere;
|
||||
const Material* material;
|
||||
};
|
||||
|
||||
@@ -165,10 +166,11 @@ namespace Nz
|
||||
struct Layer
|
||||
{
|
||||
BillboardPipelineBatches billboards;
|
||||
SpritePipelineBatches basicSprites;
|
||||
SpritePipelineBatches opaqueSprites;
|
||||
SpritePipelineBatches depthSortedSprites;
|
||||
MeshPipelineBatches opaqueModels;
|
||||
TransparentModelContainer transparentModels;
|
||||
std::vector<TransparentModelData> transparentModelData;
|
||||
TransparentModelContainer depthSortedMeshes;
|
||||
std::vector<TransparentModelData> depthSortedMeshData;
|
||||
std::vector<const Drawable*> otherDrawables;
|
||||
unsigned int clearCount = 0;
|
||||
};
|
||||
@@ -179,6 +181,10 @@ namespace Nz
|
||||
BillboardData* GetBillboardData(int renderOrder, const Material* material, unsigned int count);
|
||||
Layer& GetLayer(int i); ///TODO: Inline
|
||||
|
||||
void SortBillboards(Layer& layer, const Planef& nearPlane);
|
||||
void SortForOrthographic(const AbstractViewer* viewer);
|
||||
void SortForPerspective(const AbstractViewer* viewer);
|
||||
|
||||
void OnIndexBufferInvalidation(const IndexBuffer* indexBuffer);
|
||||
void OnMaterialInvalidation(const Material* material);
|
||||
void OnTextureInvalidation(const Texture* texture);
|
||||
|
||||
Reference in New Issue
Block a user