7 #ifndef NAZARA_FORWARDRENDERQUEUE_HPP 8 #define NAZARA_FORWARDRENDERQUEUE_HPP 10 #include <Nazara/Prerequesites.hpp> 11 #include <Nazara/Core/Color.hpp> 12 #include <Nazara/Graphics/AbstractRenderQueue.hpp> 13 #include <Nazara/Graphics/Material.hpp> 14 #include <Nazara/Math/Box.hpp> 15 #include <Nazara/Math/Matrix4.hpp> 16 #include <Nazara/Math/Plane.hpp> 17 #include <Nazara/Utility/IndexBuffer.hpp> 18 #include <Nazara/Utility/MeshData.hpp> 19 #include <Nazara/Utility/VertexBuffer.hpp> 42 void AddDrawable(
int renderOrder,
const Drawable* drawable)
override;
43 void AddMesh(
int renderOrder,
const Material* material,
const MeshData& meshData,
const Boxf& meshAABB,
const Matrix4f& transformMatrix)
override;
44 void AddSprites(
int renderOrder,
const Material* material,
const VertexStruct_XYZ_Color_UV* vertices, std::size_t spriteCount,
const Texture* overlay =
nullptr)
override;
46 void Clear(
bool fully =
false)
override;
50 struct MaterialComparator
55 struct MaterialPipelineComparator
69 struct BatchedBillboardEntry
71 NazaraSlot(
Material, OnMaterialRelease, materialReleaseSlot);
73 std::vector<BillboardData> billboards;
76 using BatchedBillboardContainer = std::map<const Material*, BatchedBillboardEntry, MaterialComparator>;
78 struct BatchedBillboardPipelineEntry
80 BatchedBillboardContainer materialMap;
84 using BillboardPipelineBatches = std::map<const MaterialPipeline*, BatchedBillboardPipelineEntry, MaterialPipelineComparator>;
89 const VertexStruct_XYZ_Color_UV* vertices;
90 std::size_t spriteCount;
93 struct BatchedSpriteEntry
95 NazaraSlot(Texture, OnTextureRelease, textureReleaseSlot);
97 std::vector<SpriteChain_XYZ_Color_UV> spriteChains;
100 using SpriteOverlayBatches = std::map<const Texture*, BatchedSpriteEntry>;
102 struct BatchedBasicSpriteEntry
104 NazaraSlot(
Material, OnMaterialRelease, materialReleaseSlot);
106 SpriteOverlayBatches overlayMap;
107 bool enabled =
false;
110 using SpriteMaterialBatches = std::map<const Material*, BatchedBasicSpriteEntry, MaterialComparator>;
112 struct BatchedSpritePipelineEntry
114 SpriteMaterialBatches materialMap;
115 bool enabled =
false;
118 using SpritePipelineBatches = std::map<const MaterialPipeline*, BatchedSpritePipelineEntry, MaterialPipelineComparator>;
123 bool operator()(
const MeshData& data1,
const MeshData& data2)
const;
126 struct MeshInstanceEntry
128 NazaraSlot(IndexBuffer, OnIndexBufferRelease, indexBufferReleaseSlot);
129 NazaraSlot(VertexBuffer, OnVertexBufferRelease, vertexBufferReleaseSlot);
131 std::vector<Matrix4f> instances;
135 using MeshInstanceContainer = std::map<MeshData, MeshInstanceEntry, MeshDataComparator>;
137 struct BatchedModelEntry
139 NazaraSlot(
Material, OnMaterialRelease, materialReleaseSlot);
141 MeshInstanceContainer meshMap;
142 bool enabled =
false;
145 using MeshMaterialBatches = std::map<const Material*, BatchedModelEntry, MaterialComparator>;
147 struct BatchedMaterialEntry
149 std::size_t maxInstanceCount = 0;
150 MeshMaterialBatches materialMap;
153 using MeshPipelineBatches = std::map<const MaterialPipeline*, BatchedMaterialEntry, MaterialPipelineComparator>;
155 struct UnbatchedModelData
163 struct UnbatchedSpriteData
165 std::size_t spriteCount;
167 const Texture* overlay;
168 const VertexStruct_XYZ_Color_UV* vertices;
173 BillboardPipelineBatches billboards;
174 SpritePipelineBatches opaqueSprites;
175 MeshPipelineBatches opaqueModels;
176 std::vector<std::size_t> depthSortedMeshes;
177 std::vector<std::size_t> depthSortedSprites;
178 std::vector<UnbatchedModelData> depthSortedMeshData;
179 std::vector<UnbatchedSpriteData> depthSortedSpriteData;
180 std::vector<const Drawable*> otherDrawables;
181 unsigned int clearCount = 0;
184 std::map<int, Layer> layers;
188 Layer& GetLayer(
int i);
190 void SortBillboards(Layer& layer,
const Planef& nearPlane);
194 void OnIndexBufferInvalidation(
const IndexBuffer* indexBuffer);
195 void OnMaterialInvalidation(
const Material* material);
196 void OnTextureInvalidation(
const Texture* texture);
197 void OnVertexBufferInvalidation(
const VertexBuffer* vertexBuffer);
201 #endif // NAZARA_FORWARDRENDERQUEUE_HPP Core class that represents a color.
Definition: Color.hpp:18
TODO: Inherit SoundEmitter from Node.
Definition: Algorithm.hpp:12
Graphics class that represents the viewer for our scene.
Definition: AbstractViewer.hpp:21
Meshes.
Definition: ForwardRenderQueue.hpp:121
Math class that represents a plane in 3D.
Definition: Plane.hpp:18
Sprites.
Definition: ForwardRenderQueue.hpp:87
Graphics class that represents the rendering queue for our scene.
Definition: AbstractRenderQueue.hpp:26
Core class that represents a pointer and the step between two elements.
Definition: SparsePtr.hpp:19
Billboards.
Definition: ForwardRenderQueue.hpp:61
Graphics class that represents the technique used in forward rendering.
Definition: ForwardRenderTechnique.hpp:21
Graphics class that represents a material.
Definition: Material.hpp:51
Graphics class used to contains all rendering states that are not allowed to change individually on r...
Definition: MaterialPipeline.hpp:44
Graphics class that represents the rendering queue for forward rendering.
Definition: ForwardRenderQueue.hpp:26
Graphics class that represents something drawable for our scene.
Definition: Drawable.hpp:15