Files
NazaraEngine/src/Nazara/Utility/SkeletalMesh.cpp
2023-01-22 17:41:18 +01:00

66 lines
1.4 KiB
C++

// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
// This file is part of the "Nazara Engine - Utility module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Utility/SkeletalMesh.hpp>
#include <Nazara/Utility/Config.hpp>
#include <Nazara/Utility/Debug.hpp>
namespace Nz
{
SkeletalMesh::SkeletalMesh(std::shared_ptr<VertexBuffer> vertexBuffer, std::shared_ptr<IndexBuffer> indexBuffer) :
m_aabb(Nz::Boxf::Zero()),
m_indexBuffer(std::move(indexBuffer)),
m_vertexBuffer(std::move(vertexBuffer))
{
NazaraAssert(m_vertexBuffer, "Invalid vertex buffer");
}
const Boxf& SkeletalMesh::GetAABB() const
{
return m_aabb;
}
AnimationType SkeletalMesh::GetAnimationType() const
{
return AnimationType::Skeletal;
}
const std::shared_ptr<IndexBuffer>& SkeletalMesh::GetIndexBuffer() const
{
return m_indexBuffer;
}
const std::shared_ptr<VertexBuffer>& SkeletalMesh::GetVertexBuffer() const
{
return m_vertexBuffer;
}
UInt32 SkeletalMesh::GetVertexCount() const
{
return m_vertexBuffer->GetVertexCount();
}
bool SkeletalMesh::IsAnimated() const
{
return true;
}
bool SkeletalMesh::IsValid() const
{
return m_vertexBuffer != nullptr;
}
void SkeletalMesh::SetAABB(const Boxf& aabb)
{
m_aabb = aabb;
OnSubMeshInvalidateAABB(this);
}
void SkeletalMesh::SetIndexBuffer(std::shared_ptr<IndexBuffer> indexBuffer)
{
m_indexBuffer = std::move(indexBuffer);
}
}