Added indices optimisation algorithm

Former-commit-id: 89086e814ca11a048949fe0fc6e20648824bbb36
This commit is contained in:
Lynix
2013-06-05 19:39:48 +02:00
parent 910a79fc84
commit ccb6f5b729
4 changed files with 539 additions and 0 deletions

View File

@@ -16,6 +16,7 @@
#include <Nazara/Utility/Mesh.hpp>
NAZARA_API void NzComputeBoxIndexVertexCount(const NzVector3ui& subdivision, unsigned int* indexCount, unsigned int* vertexCount);
NAZARA_API unsigned int NzComputeCacheMissCount(NzIndexIterator indices, unsigned int indexCount);
NAZARA_API void NzComputeCubicSphereIndexVertexCount(unsigned int subdivision, unsigned int* indexCount, unsigned int* vertexCount);
NAZARA_API void NzComputeIcoSphereIndexVertexCount(unsigned int recursionLevel, unsigned int* indexCount, unsigned int* vertexCount);
NAZARA_API void NzComputePlaneIndexVertexCount(const NzVector2ui& subdivision, unsigned int* indexCount, unsigned int* vertexCount);
@@ -27,6 +28,8 @@ NAZARA_API void NzGenerateIcoSphere(float size, unsigned int recursionLevel, con
NAZARA_API void NzGeneratePlane(const NzVector2ui& subdivision, const NzVector3f& position, const NzVector3f& normal, const NzVector2f& size, NzMeshVertex* vertices, NzIndexIterator indices, NzBoxf* aabb = nullptr, unsigned int indexOffset = 0);
NAZARA_API void NzGenerateUvSphere(float size, unsigned int sliceCount, unsigned int stackCount, const NzMatrix4f& matrix, NzMeshVertex* vertices, NzIndexIterator indices, NzBoxf* aabb = nullptr, unsigned int indexOffset = 0);
NAZARA_API void NzOptimizeIndices(NzIndexIterator indices, unsigned int indexCount);
inline void NzTransformVertex(NzMeshVertex* vertex, const NzMatrix4f& matrix);
inline void NzTransformVertices(NzMeshVertex* vertices, unsigned int vertexCount, const NzMatrix4f& matrix);

View File

@@ -25,6 +25,8 @@ class NAZARA_API NzIndexBuffer : public NzResource
NzIndexBuffer(const NzIndexBuffer& indexBuffer);
~NzIndexBuffer();
unsigned int ComputeCacheMissCount() const;
bool Fill(const void* data, unsigned int offset, unsigned int length, bool forceDiscard = false);
NzBuffer* GetBuffer() const;
@@ -41,6 +43,8 @@ class NAZARA_API NzIndexBuffer : public NzResource
void* Map(nzBufferAccess access, unsigned int offset = 0, unsigned int length = 0);
void* Map(nzBufferAccess access, unsigned int offset = 0, unsigned int length = 0) const;
void Optimize();
bool SetStorage(nzBufferStorage storage);
void Unmap() const;