Big skeletal animation update
Added MeshInfos demo Added MD5Mesh/MD5Anim loader support Added Node class Fixed ResourceParams not being exported Added support for skeletal animation (Animation/Mesh/Joint/SkeletalMesh/Skeleton) Meshes are now only stored with VertexStruct_XYZ_Normal_UV_Tangent type Moved Sequence declaration to Sequence.hpp -Animation: Renamed Create to Create[Keyframe|Skeletal] -AxisAlignedBox: Added Contains method Added GetCorner method Added GetCube method Added Transform method -Cube/Rect: Added GetPosition method Added GetSize method (Almost) Fixed ExtendTo method Fixed GetCenter method -File: Added GetDirectory static function Added GetPath method Renamed GetDirectoryPath method to GetDirectory -Math module: Fixed constructor/methods taking a non-const array GetNormal/Normalize methods now takes an optionnal integer pointer (returning length) Made all classes default constructor trivial Inverse, MakeIdentity, MakeZero, Normalize, Set methods now returns reference to object -Matrix4: Modified methods to avoid copies Removed COW (Too much overhead) Removed Concatenate[Affine] static function -Mesh: Renamed Create to Create[Keyframe|Skeletal|Static] Renamed Skin to Material -MeshParams: No longer takes declaration argument Renamed loadAnimations to animated Storage default to BufferStorage_Hardware if supported and BufferStorage_Software otherwise -OpenGL: Added glGetBooleanv function Added glIsEnabled function -Quaternion: Added ComputeW method Added Conjugate method -Renderer: Added IsEnabled static function Fixed GetLineWidth function not being static Removed SetVertexDeclaration -RenderWindow: Made CopyTo[Image|Texture] method constant -Resource Fixed RemoveResourceListener crash -ResourceLoader: Loaders are now used in a LIFO context -Stream: Renamed GetLine method to ReadLine -String: Fixed Simplified -Utility module Added configuration define for strict resource parsing -VertexBuffer Now takes a VertexDeclaration pointer -VertexDeclaration No longer throw an error when getting a non-existing element Former-commit-id: f7358c1231d6af48b799d2f24f077a001e16785b
This commit is contained in:
@@ -9,35 +9,54 @@
|
||||
|
||||
///FIXME: Gérer efficacement les erreurs de création du buffer
|
||||
|
||||
NzVertexBuffer::NzVertexBuffer(NzBuffer* buffer, unsigned int startVertex, unsigned int vertexCount) :
|
||||
NzVertexBuffer::NzVertexBuffer(const NzVertexDeclaration* vertexDeclaration, NzBuffer* buffer, unsigned int startVertex, unsigned int vertexCount) :
|
||||
m_buffer(buffer),
|
||||
m_vertexDeclaration(vertexDeclaration),
|
||||
m_ownsBuffer(false),
|
||||
m_startVertex(startVertex),
|
||||
m_vertexCount(vertexCount)
|
||||
{
|
||||
#ifdef NAZARA_DEBUG
|
||||
if (!m_buffer)
|
||||
if (!m_buffer || !m_buffer->IsValid())
|
||||
{
|
||||
NazaraError("Buffer is null");
|
||||
NazaraError("Buffer is invalid");
|
||||
throw std::invalid_argument("Buffer must be valid");
|
||||
}
|
||||
|
||||
if (!m_vertexDeclaration || !m_vertexDeclaration->IsValid())
|
||||
{
|
||||
NazaraError("Vertex declaration is invalid");
|
||||
throw std::invalid_argument("Invalid vertex declaration");
|
||||
}
|
||||
#endif
|
||||
|
||||
m_buffer->AddResourceReference();
|
||||
m_vertexDeclaration->AddResourceReference();
|
||||
}
|
||||
|
||||
NzVertexBuffer::NzVertexBuffer(unsigned int length, nzUInt8 typeSize, nzBufferStorage storage, nzBufferUsage usage) :
|
||||
NzVertexBuffer::NzVertexBuffer(const NzVertexDeclaration* vertexDeclaration, unsigned int length, nzBufferStorage storage, nzBufferUsage usage) :
|
||||
m_vertexDeclaration(vertexDeclaration),
|
||||
m_ownsBuffer(true),
|
||||
m_startVertex(0),
|
||||
m_vertexCount(length)
|
||||
{
|
||||
m_buffer = new NzBuffer(nzBufferType_Vertex, length, typeSize, storage, usage);
|
||||
#ifdef NAZARA_DEBUG
|
||||
if (!m_vertexDeclaration || !m_vertexDeclaration->IsValid())
|
||||
{
|
||||
NazaraError("Vertex declaration is invalid");
|
||||
throw std::invalid_argument("Invalid vertex declaration");
|
||||
}
|
||||
#endif
|
||||
|
||||
m_buffer = new NzBuffer(nzBufferType_Vertex, length, vertexDeclaration->GetStride(nzElementStream_VertexData), storage, usage);
|
||||
m_buffer->AddResourceReference();
|
||||
m_buffer->SetPersistent(false);
|
||||
m_vertexDeclaration->AddResourceReference();
|
||||
}
|
||||
|
||||
NzVertexBuffer::NzVertexBuffer(const NzVertexBuffer& vertexBuffer) :
|
||||
NzResource(true),
|
||||
m_vertexDeclaration(vertexBuffer.m_vertexDeclaration),
|
||||
m_ownsBuffer(vertexBuffer.m_ownsBuffer),
|
||||
m_startVertex(vertexBuffer.m_startVertex),
|
||||
m_vertexCount(vertexBuffer.m_vertexCount)
|
||||
@@ -56,11 +75,14 @@ m_vertexCount(vertexBuffer.m_vertexCount)
|
||||
m_buffer = vertexBuffer.m_buffer;
|
||||
m_buffer->AddResourceReference();
|
||||
}
|
||||
|
||||
m_vertexDeclaration->AddResourceReference();
|
||||
}
|
||||
|
||||
NzVertexBuffer::~NzVertexBuffer()
|
||||
{
|
||||
m_buffer->RemoveResourceReference();
|
||||
m_vertexDeclaration->RemoveResourceReference();
|
||||
}
|
||||
|
||||
bool NzVertexBuffer::Fill(const void* data, unsigned int offset, unsigned int length)
|
||||
@@ -106,6 +128,11 @@ unsigned int NzVertexBuffer::GetVertexCount() const
|
||||
return m_vertexCount;
|
||||
}
|
||||
|
||||
const NzVertexDeclaration* NzVertexBuffer::GetVertexDeclaration() const
|
||||
{
|
||||
return m_vertexDeclaration;
|
||||
}
|
||||
|
||||
bool NzVertexBuffer::IsHardware() const
|
||||
{
|
||||
return m_buffer->IsHardware();
|
||||
|
||||
Reference in New Issue
Block a user