Merge remote-tracking branch 'origin/master' into Resource-Update
Conflicts: include/Nazara/Audio/Music.hpp include/Nazara/Audio/SoundBuffer.hpp include/Nazara/Core/Resource.hpp include/Nazara/Core/ResourceListener.hpp include/Nazara/Graphics/Material.hpp include/Nazara/Renderer/Context.hpp include/Nazara/Renderer/RenderBuffer.hpp include/Nazara/Renderer/Shader.hpp include/Nazara/Renderer/Texture.hpp include/Nazara/Renderer/UberShader.hpp include/Nazara/Utility/Animation.hpp include/Nazara/Utility/Buffer.hpp include/Nazara/Utility/Image.hpp include/Nazara/Utility/IndexBuffer.hpp include/Nazara/Utility/Mesh.hpp include/Nazara/Utility/SkeletalMesh.hpp include/Nazara/Utility/Skeleton.hpp include/Nazara/Utility/StaticMesh.hpp include/Nazara/Utility/SubMesh.hpp include/Nazara/Utility/VertexBuffer.hpp include/Nazara/Utility/VertexDeclaration.hpp src/Nazara/Core/Resource.cpp src/Nazara/Core/ResourceListener.cpp src/Nazara/Graphics/DeferredRenderQueue.cpp src/Nazara/Graphics/ForwardRenderQueue.cpp src/Nazara/Graphics/SkinningManager.cpp src/Nazara/Renderer/RenderTexture.cpp src/Nazara/Renderer/Renderer.cpp src/Nazara/Utility/Mesh.cpp Former-commit-id: 99b5ad26a19fe9c9f8118da7b5920bffe89f60f8
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2014 Jérôme Leclercq
|
||||
// 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
|
||||
|
||||
@@ -11,16 +11,16 @@
|
||||
#include <Nazara/Core/Color.hpp>
|
||||
#include <Nazara/Core/ObjectListener.hpp>
|
||||
#include <Nazara/Graphics/AbstractRenderQueue.hpp>
|
||||
#include <Nazara/Graphics/Material.hpp>
|
||||
#include <Nazara/Math/Box.hpp>
|
||||
#include <Nazara/Math/Matrix4.hpp>
|
||||
#include <Nazara/Utility/IndexBuffer.hpp>
|
||||
#include <Nazara/Utility/MeshData.hpp>
|
||||
#include <Nazara/Utility/VertexBuffer.hpp>
|
||||
#include <map>
|
||||
#include <tuple>
|
||||
|
||||
class NzAbstractViewer;
|
||||
class NzMaterial;
|
||||
class NzSkeletalMesh;
|
||||
class NzStaticMesh;
|
||||
|
||||
class NAZARA_API NzForwardRenderQueue : public NzAbstractRenderQueue, NzObjectListener
|
||||
{
|
||||
@@ -28,12 +28,21 @@ class NAZARA_API NzForwardRenderQueue : public NzAbstractRenderQueue, NzObjectLi
|
||||
|
||||
public:
|
||||
NzForwardRenderQueue() = default;
|
||||
~NzForwardRenderQueue();
|
||||
~NzForwardRenderQueue() = 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 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 AddSprite(const NzSprite* sprite) override;
|
||||
void AddSprites(const NzMaterial* material, const NzVertexStruct_XYZ_Color_UV* vertices, unsigned int spriteCount, const NzTexture* overlay = nullptr) override;
|
||||
|
||||
void Clear(bool fully);
|
||||
|
||||
@@ -43,37 +52,128 @@ class NAZARA_API NzForwardRenderQueue : public NzAbstractRenderQueue, NzObjectLi
|
||||
bool OnObjectDestroy(const NzRefCounted* object, int index) override;
|
||||
void OnObjectReleased(const NzRefCounted* object, int index) override;
|
||||
|
||||
struct TransparentModelData
|
||||
/// Billboards
|
||||
struct BillboardData
|
||||
{
|
||||
NzMatrix4f transformMatrix;
|
||||
NzMeshData meshData;
|
||||
NzSpheref boundingSphere;
|
||||
const NzMaterial* material;
|
||||
NzColor color;
|
||||
NzVector3f center;
|
||||
NzVector2f size;
|
||||
NzVector2f sinCos;
|
||||
};
|
||||
|
||||
struct BatchedModelMaterialComparator
|
||||
struct BatchedBillboardComparator
|
||||
{
|
||||
bool operator()(const NzMaterial* mat1, const NzMaterial* mat2);
|
||||
};
|
||||
|
||||
struct BatchedBillboardEntry
|
||||
{
|
||||
BatchedBillboardEntry(NzObjectListener* listener, int materialValue) :
|
||||
materialListener(listener, materialValue)
|
||||
{
|
||||
}
|
||||
|
||||
NzMaterialConstListener materialListener;
|
||||
std::vector<BillboardData> billboards;
|
||||
};
|
||||
|
||||
typedef std::map<const NzMaterial*, BatchedBillboardEntry, BatchedBillboardComparator> BatchedBillboardContainer;
|
||||
|
||||
/// Sprites
|
||||
struct SpriteChain_XYZ_Color_UV
|
||||
{
|
||||
const NzVertexStruct_XYZ_Color_UV* vertices;
|
||||
unsigned int spriteCount;
|
||||
};
|
||||
|
||||
struct BatchedSpriteEntry
|
||||
{
|
||||
BatchedSpriteEntry(NzObjectListener* listener, int textureValue) :
|
||||
textureListener(listener, textureValue)
|
||||
{
|
||||
}
|
||||
|
||||
std::vector<SpriteChain_XYZ_Color_UV> spriteChains;
|
||||
NzTextureConstListener textureListener;
|
||||
};
|
||||
|
||||
struct BatchedSpriteMaterialComparator
|
||||
{
|
||||
bool operator()(const NzMaterial* mat1, const NzMaterial* mat2);
|
||||
};
|
||||
|
||||
typedef std::map<const NzTexture*, BatchedSpriteEntry> BasicSpriteOverlayContainer;
|
||||
|
||||
struct BatchedBasicSpriteEntry
|
||||
{
|
||||
BatchedBasicSpriteEntry(NzObjectListener* listener, int materialValue) :
|
||||
materialListener(listener, materialValue)
|
||||
{
|
||||
}
|
||||
|
||||
NzMaterialConstListener materialListener;
|
||||
BasicSpriteOverlayContainer overlayMap;
|
||||
bool enabled = false;
|
||||
};
|
||||
|
||||
typedef std::map<const NzMaterial*, BatchedBasicSpriteEntry> BasicSpriteBatches;
|
||||
|
||||
/// Meshes
|
||||
struct MeshDataComparator
|
||||
{
|
||||
bool operator()(const NzMeshData& data1, const NzMeshData& data2);
|
||||
};
|
||||
|
||||
typedef std::map<NzMeshData, std::pair<NzSpheref, std::vector<NzMatrix4f>>, MeshDataComparator> MeshInstanceContainer;
|
||||
typedef std::map<const NzMaterial*, std::tuple<bool, bool, MeshInstanceContainer>, BatchedModelMaterialComparator> ModelBatches;
|
||||
typedef std::map<const NzMaterial*, std::vector<const NzSprite*>> BatchedSpriteContainer;
|
||||
struct MeshInstanceEntry
|
||||
{
|
||||
MeshInstanceEntry(NzObjectListener* listener, int indexBufferValue, int vertexBufferValue) :
|
||||
indexBufferListener(listener, indexBufferValue),
|
||||
vertexBufferListener(listener, vertexBufferValue)
|
||||
{
|
||||
}
|
||||
|
||||
std::vector<NzMatrix4f> instances;
|
||||
NzIndexBufferConstListener indexBufferListener;
|
||||
NzSpheref squaredBoundingSphere;
|
||||
NzVertexBufferConstListener vertexBufferListener;
|
||||
};
|
||||
|
||||
typedef std::map<NzMeshData, MeshInstanceEntry, MeshDataComparator> MeshInstanceContainer;
|
||||
|
||||
struct BatchedModelMaterialComparator
|
||||
{
|
||||
bool operator()(const NzMaterial* mat1, const NzMaterial* mat2);
|
||||
};
|
||||
|
||||
struct BatchedModelEntry
|
||||
{
|
||||
BatchedModelEntry(NzObjectListener* listener, int materialValue) :
|
||||
materialListener(listener, materialValue)
|
||||
{
|
||||
}
|
||||
|
||||
NzMaterialConstListener materialListener;
|
||||
MeshInstanceContainer meshMap;
|
||||
bool enabled = false;
|
||||
bool instancingEnabled = false;
|
||||
};
|
||||
|
||||
typedef std::map<const NzMaterial*, BatchedModelEntry, BatchedModelMaterialComparator> ModelBatches;
|
||||
|
||||
struct TransparentModelData
|
||||
{
|
||||
NzMatrix4f transformMatrix;
|
||||
NzMeshData meshData;
|
||||
NzSpheref squaredBoundingSphere;
|
||||
const NzMaterial* material;
|
||||
};
|
||||
|
||||
typedef std::vector<const NzLight*> LightContainer;
|
||||
typedef std::vector<unsigned int> TransparentModelContainer;
|
||||
|
||||
BatchedBillboardContainer billboards;
|
||||
BasicSpriteBatches basicSprites;
|
||||
ModelBatches opaqueModels;
|
||||
BatchedSpriteContainer sprites;
|
||||
TransparentModelContainer transparentModels;
|
||||
std::vector<TransparentModelData> transparentModelData;
|
||||
std::vector<const NzDrawable*> otherDrawables;
|
||||
|
||||
Reference in New Issue
Block a user