Add proper support for IndexType and uint32 indices
This commit is contained in:
@@ -26,6 +26,7 @@ namespace Nz
|
||||
|
||||
inline const std::shared_ptr<RenderBuffer>& GetIndexBuffer(std::size_t subMesh) const;
|
||||
inline std::size_t GetIndexCount(std::size_t subMesh) const;
|
||||
inline IndexType GetIndexType(std::size_t subMesh) const;
|
||||
inline const std::shared_ptr<RenderBuffer>& GetVertexBuffer(std::size_t subMesh) const;
|
||||
inline const std::shared_ptr<const VertexDeclaration>& GetVertexDeclaration(std::size_t subMesh) const;
|
||||
inline std::size_t GetSubMeshCount() const;
|
||||
@@ -40,6 +41,7 @@ namespace Nz
|
||||
std::shared_ptr<RenderBuffer> vertexBuffer;
|
||||
std::size_t indexCount;
|
||||
std::shared_ptr<const VertexDeclaration> vertexDeclaration;
|
||||
IndexType indexType;
|
||||
};
|
||||
|
||||
std::vector<GraphicalSubMesh> m_subMeshes;
|
||||
|
||||
@@ -20,6 +20,12 @@ namespace Nz
|
||||
return m_subMeshes[subMesh].indexCount;
|
||||
}
|
||||
|
||||
inline IndexType GraphicalMesh::GetIndexType(std::size_t subMesh) const
|
||||
{
|
||||
assert(subMesh < m_subMeshes.size());
|
||||
return m_subMeshes[subMesh].indexType;
|
||||
}
|
||||
|
||||
inline const std::shared_ptr<RenderBuffer>& GraphicalMesh::GetVertexBuffer(std::size_t subMesh) const
|
||||
{
|
||||
assert(subMesh < m_subMeshes.size());
|
||||
|
||||
@@ -23,13 +23,14 @@ namespace Nz
|
||||
class RenderSubmesh : public RenderElement
|
||||
{
|
||||
public:
|
||||
inline RenderSubmesh(int renderLayer, std::shared_ptr<MaterialPass> materialPass, std::shared_ptr<RenderPipeline> renderPipeline, const WorldInstance& worldInstance, std::size_t indexCount, std::shared_ptr<RenderBuffer> indexBuffer, std::shared_ptr<RenderBuffer> vertexBuffer, const Recti& scissorBox);
|
||||
inline RenderSubmesh(int renderLayer, std::shared_ptr<MaterialPass> materialPass, std::shared_ptr<RenderPipeline> renderPipeline, const WorldInstance& worldInstance, std::size_t indexCount, IndexType indexType, std::shared_ptr<RenderBuffer> indexBuffer, std::shared_ptr<RenderBuffer> vertexBuffer, const Recti& scissorBox);
|
||||
~RenderSubmesh() = default;
|
||||
|
||||
inline UInt64 ComputeSortingScore(const Frustumf& frustum, const RenderQueueRegistry& registry) const override;
|
||||
|
||||
inline const RenderBuffer* GetIndexBuffer() const;
|
||||
inline std::size_t GetIndexCount() const;
|
||||
inline IndexType GetIndexType() const;
|
||||
inline const MaterialPass& GetMaterialPass() const;
|
||||
inline const RenderPipeline* GetRenderPipeline() const;
|
||||
inline const Recti& GetScissorBox() const;
|
||||
@@ -45,6 +46,7 @@ namespace Nz
|
||||
std::shared_ptr<RenderPipeline> m_renderPipeline;
|
||||
std::size_t m_indexCount;
|
||||
const WorldInstance& m_worldInstance;
|
||||
IndexType m_indexType;
|
||||
Recti m_scissorBox;
|
||||
int m_renderLayer;
|
||||
};
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline RenderSubmesh::RenderSubmesh(int renderLayer, std::shared_ptr<MaterialPass> materialPass, std::shared_ptr<RenderPipeline> renderPipeline, const WorldInstance& worldInstance, std::size_t indexCount, std::shared_ptr<RenderBuffer> indexBuffer, std::shared_ptr<RenderBuffer> vertexBuffer, const Recti& scissorBox) :
|
||||
inline RenderSubmesh::RenderSubmesh(int renderLayer, std::shared_ptr<MaterialPass> materialPass, std::shared_ptr<RenderPipeline> renderPipeline, const WorldInstance& worldInstance, std::size_t indexCount, IndexType indexType, std::shared_ptr<RenderBuffer> indexBuffer, std::shared_ptr<RenderBuffer> vertexBuffer, const Recti& scissorBox) :
|
||||
RenderElement(BasicRenderElement::Submesh),
|
||||
m_indexBuffer(std::move(indexBuffer)),
|
||||
m_vertexBuffer(std::move(vertexBuffer)),
|
||||
@@ -17,6 +17,7 @@ namespace Nz
|
||||
m_renderPipeline(std::move(renderPipeline)),
|
||||
m_indexCount(indexCount),
|
||||
m_worldInstance(worldInstance),
|
||||
m_indexType(indexType),
|
||||
m_scissorBox(scissorBox),
|
||||
m_renderLayer(renderLayer)
|
||||
{
|
||||
@@ -80,6 +81,11 @@ namespace Nz
|
||||
return m_indexCount;
|
||||
}
|
||||
|
||||
inline IndexType RenderSubmesh::GetIndexType() const
|
||||
{
|
||||
return m_indexType;
|
||||
}
|
||||
|
||||
inline const MaterialPass& RenderSubmesh::GetMaterialPass() const
|
||||
{
|
||||
return *m_materialPass;
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace Nz
|
||||
const ShaderBinding* shaderBinding;
|
||||
std::size_t firstIndex;
|
||||
std::size_t indexCount;
|
||||
IndexType indexType;
|
||||
Recti scissorBox;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user