Utility: First code cleaning pass
Former-commit-id: 5e8a6fe1d39919f583d6ec52c3a6441ea16db0d1 [formerly 6013fccf81504ad739456c6bf2a0f32f51cd0976] [formerly 6eca34e7eb539427281a09520652f6b63a09d2ef [formerly 42f25260bb808235785af682cc8227be5ced64dd]] Former-commit-id: 82fd5b55a89ae15950b1bae4164fc93f4761edf9 [formerly 7be9e16acf53f75829a6ef00cea4aca8032820de] Former-commit-id: f96d5a14ced9e7aa0a16c63c0a9c467d752ecf05
This commit is contained in:
@@ -20,16 +20,15 @@
|
||||
#include <Nazara/Utility/Config.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
#include <Nazara/Utility/Sequence.hpp>
|
||||
#include <limits>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
struct NAZARA_UTILITY_API AnimationParams : ResourceParameters
|
||||
{
|
||||
// La frame de fin à charger
|
||||
unsigned int endFrame = std::numeric_limits<unsigned int>::max();
|
||||
UInt32 endFrame = 0xFFFFFFFF;
|
||||
// La frame de début à charger
|
||||
unsigned int startFrame = 0;
|
||||
UInt32 startFrame = 0;
|
||||
|
||||
bool IsValid() const;
|
||||
};
|
||||
@@ -57,27 +56,27 @@ namespace Nz
|
||||
~Animation();
|
||||
|
||||
bool AddSequence(const Sequence& sequence);
|
||||
void AnimateSkeleton(Skeleton* targetSkeleton, unsigned int frameA, unsigned int frameB, float interpolation) const;
|
||||
void AnimateSkeleton(Skeleton* targetSkeleton, UInt32 frameA, UInt32 frameB, float interpolation) const;
|
||||
|
||||
bool CreateSkeletal(unsigned int frameCount, unsigned int jointCount);
|
||||
bool CreateSkeletal(UInt32 frameCount, UInt32 jointCount);
|
||||
void Destroy();
|
||||
|
||||
void EnableLoopPointInterpolation(bool loopPointInterpolation);
|
||||
|
||||
unsigned int GetFrameCount() const;
|
||||
unsigned int GetJointCount() const;
|
||||
UInt32 GetFrameCount() const;
|
||||
UInt32 GetJointCount() const;
|
||||
Sequence* GetSequence(const String& sequenceName);
|
||||
Sequence* GetSequence(unsigned int index);
|
||||
Sequence* GetSequence(UInt32 index);
|
||||
const Sequence* GetSequence(const String& sequenceName) const;
|
||||
const Sequence* GetSequence(unsigned int index) const;
|
||||
unsigned int GetSequenceCount() const;
|
||||
int GetSequenceIndex(const String& sequenceName) const;
|
||||
SequenceJoint* GetSequenceJoints(unsigned int frameIndex = 0);
|
||||
const SequenceJoint* GetSequenceJoints(unsigned int frameIndex = 0) const;
|
||||
const Sequence* GetSequence(UInt32 index) const;
|
||||
UInt32 GetSequenceCount() const;
|
||||
UInt32 GetSequenceIndex(const String& sequenceName) const;
|
||||
SequenceJoint* GetSequenceJoints(UInt32 frameIndex = 0);
|
||||
const SequenceJoint* GetSequenceJoints(UInt32 frameIndex = 0) const;
|
||||
AnimationType GetType() const;
|
||||
|
||||
bool HasSequence(const String& sequenceName) const;
|
||||
bool HasSequence(unsigned int index = 0) const;
|
||||
bool HasSequence(UInt32 index = 0) const;
|
||||
|
||||
bool IsLoopPointInterpolationEnabled() const;
|
||||
bool IsValid() const;
|
||||
@@ -87,7 +86,7 @@ namespace Nz
|
||||
bool LoadFromStream(Stream& stream, const AnimationParams& params = AnimationParams());
|
||||
|
||||
void RemoveSequence(const String& sequenceName);
|
||||
void RemoveSequence(unsigned int index);
|
||||
void RemoveSequence(UInt32 index);
|
||||
|
||||
template<typename... Args> static AnimationRef New(Args&&... args);
|
||||
|
||||
|
||||
@@ -34,12 +34,12 @@ namespace Nz
|
||||
|
||||
struct Joint
|
||||
{
|
||||
Int32 parent;
|
||||
Quaternionf bindOrient;
|
||||
String name;
|
||||
Vector3f bindPos;
|
||||
int parent;
|
||||
unsigned int flags;
|
||||
unsigned int index;
|
||||
UInt32 flags;
|
||||
UInt32 index;
|
||||
};
|
||||
|
||||
MD5AnimParser(Stream& stream);
|
||||
@@ -47,12 +47,12 @@ namespace Nz
|
||||
|
||||
Ternary Check();
|
||||
|
||||
std::size_t GetAnimatedComponentCount() const;
|
||||
UInt32 GetAnimatedComponentCount() const;
|
||||
const Frame* GetFrames() const;
|
||||
std::size_t GetFrameCount() const;
|
||||
std::size_t GetFrameRate() const;
|
||||
UInt32 GetFrameCount() const;
|
||||
UInt32 GetFrameRate() const;
|
||||
const Joint* GetJoints() const;
|
||||
std::size_t GetJointCount() const;
|
||||
UInt32 GetJointCount() const;
|
||||
|
||||
bool Parse();
|
||||
|
||||
|
||||
@@ -22,10 +22,10 @@ namespace Nz
|
||||
public:
|
||||
struct Joint
|
||||
{
|
||||
Int32 parent;
|
||||
Quaternionf bindOrient;
|
||||
String name;
|
||||
Vector3f bindPos;
|
||||
int parent;
|
||||
};
|
||||
|
||||
typedef Vector3ui Triangle;
|
||||
@@ -58,9 +58,9 @@ namespace Nz
|
||||
Ternary Check();
|
||||
|
||||
const Joint* GetJoints() const;
|
||||
std::size_t GetJointCount() const;
|
||||
UInt32 GetJointCount() const;
|
||||
const Mesh* GetMeshes() const;
|
||||
std::size_t GetMeshCount() const;
|
||||
UInt32 GetMeshCount() const;
|
||||
|
||||
bool Parse();
|
||||
|
||||
|
||||
@@ -31,43 +31,43 @@ namespace Nz
|
||||
|
||||
inline String* GetMaterials();
|
||||
inline const String* GetMaterials() const;
|
||||
inline unsigned int GetMaterialCount() const;
|
||||
inline UInt32 GetMaterialCount() const;
|
||||
inline Mesh* GetMeshes();
|
||||
inline const Mesh* GetMeshes() const;
|
||||
inline unsigned int GetMeshCount() const;
|
||||
inline UInt32 GetMeshCount() const;
|
||||
inline const String& GetMtlLib() const;
|
||||
inline Vector3f* GetNormals();
|
||||
inline const Vector3f* GetNormals() const;
|
||||
inline unsigned int GetNormalCount() const;
|
||||
inline UInt32 GetNormalCount() const;
|
||||
inline Vector4f* GetPositions();
|
||||
inline const Vector4f* GetPositions() const;
|
||||
inline unsigned int GetPositionCount() const;
|
||||
inline UInt32 GetPositionCount() const;
|
||||
inline Vector3f* GetTexCoords();
|
||||
inline const Vector3f* GetTexCoords() const;
|
||||
inline unsigned int GetTexCoordCount() const;
|
||||
inline UInt32 GetTexCoordCount() const;
|
||||
|
||||
bool Parse(Stream& stream, std::size_t reservedVertexCount = 100);
|
||||
bool Parse(Stream& stream, UInt32 reservedVertexCount = 100);
|
||||
|
||||
bool Save(Stream& stream) const;
|
||||
|
||||
inline String* SetMaterialCount(std::size_t materialCount);
|
||||
inline Mesh* SetMeshCount(std::size_t meshCount);
|
||||
inline String* SetMaterialCount(UInt32 materialCount);
|
||||
inline Mesh* SetMeshCount(UInt32 meshCount);
|
||||
inline void SetMtlLib(const String& mtlLib);
|
||||
inline Vector3f* SetNormalCount(std::size_t normalCount);
|
||||
inline Vector4f* SetPositionCount(std::size_t positionCount);
|
||||
inline Vector3f* SetTexCoordCount(std::size_t texCoordCount);
|
||||
inline Vector3f* SetNormalCount(UInt32 normalCount);
|
||||
inline Vector4f* SetPositionCount(UInt32 positionCount);
|
||||
inline Vector3f* SetTexCoordCount(UInt32 texCoordCount);
|
||||
|
||||
struct Face
|
||||
{
|
||||
std::size_t firstVertex;
|
||||
std::size_t vertexCount;
|
||||
UInt32 firstVertex;
|
||||
UInt32 vertexCount;
|
||||
};
|
||||
|
||||
struct FaceVertex
|
||||
{
|
||||
std::size_t normal;
|
||||
std::size_t position;
|
||||
std::size_t texCoord;
|
||||
UInt32 normal;
|
||||
UInt32 position;
|
||||
UInt32 texCoord;
|
||||
};
|
||||
|
||||
struct Mesh
|
||||
@@ -75,7 +75,7 @@ namespace Nz
|
||||
std::vector<Face> faces;
|
||||
std::vector<FaceVertex> vertices;
|
||||
String name;
|
||||
std::size_t material;
|
||||
UInt32 material;
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
@@ -27,9 +27,9 @@ namespace Nz
|
||||
return m_materials.data();
|
||||
}
|
||||
|
||||
inline unsigned int OBJParser::GetMaterialCount() const
|
||||
inline UInt32 OBJParser::GetMaterialCount() const
|
||||
{
|
||||
return m_materials.size();
|
||||
return static_cast<UInt32>(m_materials.size());
|
||||
}
|
||||
|
||||
inline OBJParser::Mesh* OBJParser::GetMeshes()
|
||||
@@ -42,9 +42,9 @@ namespace Nz
|
||||
return m_meshes.data();
|
||||
}
|
||||
|
||||
inline unsigned int OBJParser::GetMeshCount() const
|
||||
inline UInt32 OBJParser::GetMeshCount() const
|
||||
{
|
||||
return m_meshes.size();
|
||||
return static_cast<UInt32>(m_meshes.size());
|
||||
}
|
||||
|
||||
inline const String& OBJParser::GetMtlLib() const
|
||||
@@ -62,9 +62,9 @@ namespace Nz
|
||||
return m_normals.data();
|
||||
}
|
||||
|
||||
inline unsigned int OBJParser::GetNormalCount() const
|
||||
inline UInt32 OBJParser::GetNormalCount() const
|
||||
{
|
||||
return m_normals.size();
|
||||
return static_cast<UInt32>(m_normals.size());
|
||||
}
|
||||
|
||||
inline Vector4f* OBJParser::GetPositions()
|
||||
@@ -77,9 +77,9 @@ namespace Nz
|
||||
return m_positions.data();
|
||||
}
|
||||
|
||||
inline unsigned int OBJParser::GetPositionCount() const
|
||||
inline UInt32 OBJParser::GetPositionCount() const
|
||||
{
|
||||
return m_positions.size();
|
||||
return static_cast<UInt32>(m_positions.size());
|
||||
}
|
||||
|
||||
inline Vector3f* OBJParser::GetTexCoords()
|
||||
@@ -92,18 +92,18 @@ namespace Nz
|
||||
return m_texCoords.data();
|
||||
}
|
||||
|
||||
inline unsigned int OBJParser::GetTexCoordCount() const
|
||||
inline UInt32 OBJParser::GetTexCoordCount() const
|
||||
{
|
||||
return m_texCoords.size();
|
||||
return static_cast<UInt32>(m_texCoords.size());
|
||||
}
|
||||
|
||||
inline String* OBJParser::SetMaterialCount(std::size_t materialCount)
|
||||
inline String* OBJParser::SetMaterialCount(UInt32 materialCount)
|
||||
{
|
||||
m_materials.resize(materialCount);
|
||||
return m_materials.data();
|
||||
}
|
||||
|
||||
inline OBJParser::Mesh* OBJParser::SetMeshCount(std::size_t meshCount)
|
||||
inline OBJParser::Mesh* OBJParser::SetMeshCount(UInt32 meshCount)
|
||||
{
|
||||
m_meshes.resize(meshCount);
|
||||
return m_meshes.data();
|
||||
@@ -114,19 +114,19 @@ namespace Nz
|
||||
m_mtlLib = mtlLib;
|
||||
}
|
||||
|
||||
inline Vector3f* OBJParser::SetNormalCount(std::size_t normalCount)
|
||||
inline Vector3f* OBJParser::SetNormalCount(UInt32 normalCount)
|
||||
{
|
||||
m_normals.resize(normalCount);
|
||||
return m_normals.data();
|
||||
}
|
||||
|
||||
inline Vector4f* OBJParser::SetPositionCount(std::size_t positionCount)
|
||||
inline Vector4f* OBJParser::SetPositionCount(UInt32 positionCount)
|
||||
{
|
||||
m_positions.resize(positionCount);
|
||||
return m_positions.data();
|
||||
}
|
||||
|
||||
inline Vector3f* OBJParser::SetTexCoordCount(std::size_t texCoordCount)
|
||||
inline Vector3f* OBJParser::SetTexCoordCount(UInt32 texCoordCount)
|
||||
{
|
||||
m_texCoords.resize(texCoordCount);
|
||||
return m_texCoords.data();
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace Nz
|
||||
SubMesh* BuildSubMesh(const Primitive& primitive, const MeshParams& params = MeshParams());
|
||||
void BuildSubMeshes(const PrimitiveList& list, const MeshParams& params = MeshParams());
|
||||
|
||||
bool CreateSkeletal(unsigned int jointCount);
|
||||
bool CreateSkeletal(UInt32 jointCount);
|
||||
bool CreateStatic();
|
||||
void Destroy();
|
||||
|
||||
@@ -95,23 +95,23 @@ namespace Nz
|
||||
const Boxf& GetAABB() const;
|
||||
String GetAnimation() const;
|
||||
AnimationType GetAnimationType() const;
|
||||
unsigned int GetJointCount() const;
|
||||
ParameterList& GetMaterialData(unsigned int index);
|
||||
const ParameterList& GetMaterialData(unsigned int index) const;
|
||||
unsigned int GetMaterialCount() const;
|
||||
UInt32 GetJointCount() const;
|
||||
ParameterList& GetMaterialData(UInt32 index);
|
||||
const ParameterList& GetMaterialData(UInt32 index) const;
|
||||
UInt32 GetMaterialCount() const;
|
||||
Skeleton* GetSkeleton();
|
||||
const Skeleton* GetSkeleton() const;
|
||||
SubMesh* GetSubMesh(const String& identifier);
|
||||
SubMesh* GetSubMesh(unsigned int index);
|
||||
SubMesh* GetSubMesh(UInt32 index);
|
||||
const SubMesh* GetSubMesh(const String& identifier) const;
|
||||
const SubMesh* GetSubMesh(unsigned int index) const;
|
||||
unsigned int GetSubMeshCount() const;
|
||||
int GetSubMeshIndex(const String& identifier) const;
|
||||
unsigned int GetTriangleCount() const;
|
||||
unsigned int GetVertexCount() const;
|
||||
const SubMesh* GetSubMesh(UInt32 index) const;
|
||||
UInt32 GetSubMeshCount() const;
|
||||
UInt32 GetSubMeshIndex(const String& identifier) const;
|
||||
UInt32 GetTriangleCount() const;
|
||||
UInt32 GetVertexCount() const;
|
||||
|
||||
bool HasSubMesh(const String& identifier) const;
|
||||
bool HasSubMesh(unsigned int index = 0) const;
|
||||
bool HasSubMesh(UInt32 index = 0) const;
|
||||
|
||||
void InvalidateAABB() const;
|
||||
|
||||
@@ -125,14 +125,14 @@ namespace Nz
|
||||
void Recenter();
|
||||
|
||||
void RemoveSubMesh(const String& identifier);
|
||||
void RemoveSubMesh(unsigned int index);
|
||||
void RemoveSubMesh(UInt32 index);
|
||||
|
||||
bool SaveToFile(const String& filePath, const MeshParams& params = MeshParams());
|
||||
bool SaveToStream(Stream& stream, const String& format, const MeshParams& params = MeshParams());
|
||||
|
||||
void SetAnimation(const String& animationPath);
|
||||
void SetMaterialCount(unsigned int matCount);
|
||||
void SetMaterialData(unsigned int matIndex, ParameterList data);
|
||||
void SetMaterialCount(UInt32 matCount);
|
||||
void SetMaterialData(UInt32 matIndex, ParameterList data);
|
||||
|
||||
void Transform(const Matrix4f& matrix);
|
||||
|
||||
|
||||
@@ -16,9 +16,9 @@ namespace Nz
|
||||
struct Sequence
|
||||
{
|
||||
String name;
|
||||
unsigned int firstFrame;
|
||||
unsigned int frameCount;
|
||||
unsigned int frameRate;
|
||||
UInt32 firstFrame;
|
||||
UInt32 frameCount;
|
||||
UInt32 frameRate;
|
||||
};
|
||||
|
||||
struct SequenceJoint
|
||||
|
||||
@@ -37,21 +37,21 @@ namespace Nz
|
||||
Skeleton(const Skeleton& skeleton);
|
||||
~Skeleton();
|
||||
|
||||
bool Create(unsigned int jointCount);
|
||||
bool Create(UInt32 jointCount);
|
||||
void Destroy();
|
||||
|
||||
const Boxf& GetAABB() const;
|
||||
Joint* GetJoint(const String& jointName);
|
||||
Joint* GetJoint(unsigned int index);
|
||||
Joint* GetJoint(UInt32 index);
|
||||
const Joint* GetJoint(const String& jointName) const;
|
||||
const Joint* GetJoint(unsigned int index) const;
|
||||
const Joint* GetJoint(UInt32 index) const;
|
||||
Joint* GetJoints();
|
||||
const Joint* GetJoints() const;
|
||||
unsigned int GetJointCount() const;
|
||||
UInt32 GetJointCount() const;
|
||||
int GetJointIndex(const String& jointName) const;
|
||||
|
||||
void Interpolate(const Skeleton& skeletonA, const Skeleton& skeletonB, float interpolation);
|
||||
void Interpolate(const Skeleton& skeletonA, const Skeleton& skeletonB, float interpolation, unsigned int* indices, unsigned int indiceCount);
|
||||
void Interpolate(const Skeleton& skeletonA, const Skeleton& skeletonB, float interpolation, UInt32* indices, UInt32 indiceCount);
|
||||
|
||||
bool IsValid() const;
|
||||
|
||||
|
||||
@@ -39,15 +39,15 @@ namespace Nz
|
||||
virtual const Boxf& GetAABB() const = 0;
|
||||
virtual AnimationType GetAnimationType() const = 0;
|
||||
virtual const IndexBuffer* GetIndexBuffer() const = 0;
|
||||
unsigned int GetMaterialIndex() const;
|
||||
UInt32 GetMaterialIndex() const;
|
||||
const Mesh* GetParent() const;
|
||||
PrimitiveMode GetPrimitiveMode() const;
|
||||
unsigned int GetTriangleCount() const;
|
||||
virtual unsigned int GetVertexCount() const = 0;
|
||||
UInt32 GetTriangleCount() const;
|
||||
virtual UInt32 GetVertexCount() const = 0;
|
||||
|
||||
virtual bool IsAnimated() const = 0;
|
||||
|
||||
void SetMaterialIndex(unsigned int matIndex);
|
||||
void SetMaterialIndex(UInt32 matIndex);
|
||||
void SetPrimitiveMode(PrimitiveMode mode);
|
||||
|
||||
// Signals:
|
||||
@@ -56,7 +56,7 @@ namespace Nz
|
||||
protected:
|
||||
PrimitiveMode m_primitiveMode;
|
||||
const Mesh* m_parent;
|
||||
unsigned int m_matIndex;
|
||||
UInt32 m_matIndex;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,8 @@ namespace Nz
|
||||
{
|
||||
NazaraError("Attribute 0x" + String::Number(component, 16) + " is not enabled");
|
||||
return SparsePtr<T>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Utility/DebugOff.hpp>
|
||||
|
||||
Reference in New Issue
Block a user