New mesh policy

Former-commit-id: cc5854d55e1e4bb83e5e081434b87ec22fcb8bff
This commit is contained in:
Lynix
2013-03-02 00:17:40 +01:00
parent 347b267d43
commit 0df64e03ae
19 changed files with 132 additions and 209 deletions

View File

@@ -16,7 +16,9 @@
struct NAZARA_API NzAnimationParams
{
// La frame de fin à charger
unsigned int endFrame = static_cast<unsigned int>(-1);
// La frame de début à charger
unsigned int startFrame = 0;
bool IsValid() const;

View File

@@ -36,7 +36,7 @@
#define NAZARA_UTILITY_MEMORYLEAKTRACKER 0
// Le skinning doit-il prendre avantage du multi-threading ? (Boost de performances sur les processeurs multi-coeurs)
#define NAZARA_UTILITY_MULTITHREADED_SKINNING 1
#define NAZARA_UTILITY_MULTITHREADED_SKINNING 0 ///FIXME: Bug du TaskScheduler
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
#define NAZARA_UTILITY_SAFE 1

View File

@@ -37,9 +37,9 @@ class NAZARA_API NzKeyframeMesh final : public NzSubMesh
NzVector3f GetTangent(unsigned int frameIndex, unsigned int vertexIndex) const;
NzVector2f GetTexCoords(unsigned int vertexIndex) const;
void GetVertex(unsigned int frameIndex, unsigned int vertexIndex, NzMeshVertex* dest) const;
NzVertexBuffer* GetVertexBuffer() override;
const NzVertexBuffer* GetVertexBuffer() const override;
NzVertexBuffer* GetVertexBuffer();
const NzVertexBuffer* GetVertexBuffer() const;
unsigned int GetVertexCount() const override;
void Interpolate(const NzAnimation* animation, unsigned int frameA, unsigned int frameB, float interpolation) const;

View File

@@ -20,9 +20,12 @@
struct NAZARA_API NzMeshParams
{
NzMeshParams(); // Vérifie que le storage indiqué un peu plus bas est supporté
NzMeshParams(); // Vérifie que le storage par défaut est supporté (software autrement)
// Si ceci sera le stockage choisi par le loader
nzBufferStorage storage = nzBufferStorage_Hardware;
// Le loader doit-il charger une version animée du mesh si possible ?
bool animated = true;
bool IsValid() const;
@@ -48,8 +51,6 @@ class NAZARA_API NzMesh : public NzResource, NzResourceListener
bool AddSubMesh(NzSubMesh* subMesh);
bool AddSubMesh(const NzString& identifier, NzSubMesh* subMesh);
void Animate(const NzAnimation* animation, unsigned int frameA, unsigned int frameB, float interpolation, NzSkeleton* skeleton) const;
bool CreateKeyframe();
bool CreateSkeletal(unsigned int jointCount);
bool CreateStatic();
@@ -94,8 +95,6 @@ class NAZARA_API NzMesh : public NzResource, NzResourceListener
void SetMaterial(unsigned int matIndex, const NzString& materialPath);
void SetMaterialCount(unsigned int matCount);
void Skin(const NzSkeleton* skeleton) const;
static const NzVertexDeclaration* GetDeclaration();
private:

View File

@@ -263,7 +263,7 @@ inline nzUInt8 NzPixelFormat::GetBytesPerPixel(nzPixelFormat format)
#if NAZARA_UTILITY_SAFE
if (bytesPerPixel == 0)
NazaraWarning("This format is invalid or uses less than one byte per pixel");
NazaraWarning("This format is either invalid or using less than one byte per pixel");
#endif
return bytesPerPixel;

View File

@@ -32,7 +32,7 @@ class NAZARA_API NzSkeletalMesh final : public NzSubMesh
NzSkeletalMesh(const NzMesh* parent);
virtual ~NzSkeletalMesh();
bool Create(NzVertexBuffer* vertexBuffer, unsigned int weightCount);
bool Create(unsigned int vertexCount, unsigned int weightCount);
void Destroy();
void Finish();
@@ -42,8 +42,7 @@ class NAZARA_API NzSkeletalMesh final : public NzSubMesh
void* GetBindPoseBuffer();
const void* GetBindPoseBuffer() const;
const NzIndexBuffer* GetIndexBuffer() const override;
NzVertexBuffer* GetVertexBuffer() override;
const NzVertexBuffer* GetVertexBuffer() const override;
unsigned int GetVertexCount() const override;
NzVertexWeight* GetVertexWeight(unsigned int vertexIndex = 0);
const NzVertexWeight* GetVertexWeight(unsigned int vertexIndex = 0) const;
NzWeight* GetWeight(unsigned int weightIndex = 0);
@@ -53,8 +52,8 @@ class NAZARA_API NzSkeletalMesh final : public NzSubMesh
bool IsAnimated() const final;
bool IsValid() const;
void Skin() const;
void Skin(const NzSkeleton* skeleton) const;
void Skin(NzMeshVertex* outputBuffer) const;
void Skin(NzMeshVertex* outputBuffer, const NzSkeleton* skeleton) const;
void SetIndexBuffer(const NzIndexBuffer* indexBuffer);

View File

@@ -27,8 +27,9 @@ class NAZARA_API NzStaticMesh final : public NzSubMesh, NzResourceListener
const NzCubef& GetAABB() const override;
nzAnimationType GetAnimationType() const final;
const NzIndexBuffer* GetIndexBuffer() const override;
NzVertexBuffer* GetVertexBuffer() override;
const NzVertexBuffer* GetVertexBuffer() const override;
NzVertexBuffer* GetVertexBuffer();
const NzVertexBuffer* GetVertexBuffer() const;
unsigned int GetVertexCount() const override;
bool IsAnimated() const final;
bool IsValid() const;

View File

@@ -33,9 +33,7 @@ class NAZARA_API NzSubMesh : public NzResource
unsigned int GetMaterialIndex() const;
const NzMesh* GetParent() const;
nzPrimitiveType GetPrimitiveType() const;
virtual NzVertexBuffer* GetVertexBuffer() = 0;
virtual const NzVertexBuffer* GetVertexBuffer() const = 0;
virtual unsigned int GetVertexCount() const;
virtual unsigned int GetVertexCount() const = 0;
virtual bool IsAnimated() const = 0;