Merge remote-tracking branch 'origin/master' into Resource-Update
Conflicts: include/Nazara/Audio/Music.hpp include/Nazara/Audio/SoundBuffer.hpp include/Nazara/Core/Resource.hpp include/Nazara/Core/ResourceListener.hpp include/Nazara/Graphics/Material.hpp include/Nazara/Renderer/Context.hpp include/Nazara/Renderer/RenderBuffer.hpp include/Nazara/Renderer/Shader.hpp include/Nazara/Renderer/Texture.hpp include/Nazara/Renderer/UberShader.hpp include/Nazara/Utility/Animation.hpp include/Nazara/Utility/Buffer.hpp include/Nazara/Utility/Image.hpp include/Nazara/Utility/IndexBuffer.hpp include/Nazara/Utility/Mesh.hpp include/Nazara/Utility/SkeletalMesh.hpp include/Nazara/Utility/Skeleton.hpp include/Nazara/Utility/StaticMesh.hpp include/Nazara/Utility/SubMesh.hpp include/Nazara/Utility/VertexBuffer.hpp include/Nazara/Utility/VertexDeclaration.hpp src/Nazara/Core/Resource.cpp src/Nazara/Core/ResourceListener.cpp src/Nazara/Graphics/DeferredRenderQueue.cpp src/Nazara/Graphics/ForwardRenderQueue.cpp src/Nazara/Graphics/SkinningManager.cpp src/Nazara/Renderer/RenderTexture.cpp src/Nazara/Renderer/Renderer.cpp src/Nazara/Utility/Mesh.cpp Former-commit-id: 99b5ad26a19fe9c9f8118da7b5920bffe89f60f8
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2014 Jérôme Leclercq
|
||||
// Copyright (C) 2015 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Utility module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <Nazara/Core/Enums.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/PrimitiveList.hpp>
|
||||
#include <Nazara/Math/Basic.hpp>
|
||||
#include <Nazara/Math/Algorithm.hpp>
|
||||
#include <Nazara/Utility/Algorithm.hpp>
|
||||
#include <Nazara/Utility/Animation.hpp>
|
||||
#include <Nazara/Utility/Buffer.hpp>
|
||||
@@ -25,13 +25,13 @@
|
||||
|
||||
NzMeshParams::NzMeshParams()
|
||||
{
|
||||
if (!NzBuffer::IsSupported(storage))
|
||||
storage = nzBufferStorage_Software;
|
||||
if (!NzBuffer::IsStorageSupported(storage))
|
||||
storage = nzDataStorage_Software;
|
||||
}
|
||||
|
||||
bool NzMeshParams::IsValid() const
|
||||
{
|
||||
if (!NzBuffer::IsSupported(storage))
|
||||
if (!NzBuffer::IsStorageSupported(storage))
|
||||
{
|
||||
NazaraError("Storage not supported");
|
||||
return false;
|
||||
@@ -55,7 +55,7 @@ struct NzMeshImpl
|
||||
|
||||
std::unordered_map<NzString, unsigned int> subMeshMap;
|
||||
std::vector<NzString> materials;
|
||||
std::vector<NzSubMesh*> subMeshes;
|
||||
std::vector<NzSubMeshRef> subMeshes;
|
||||
nzAnimationType animationType;
|
||||
NzBoxf aabb;
|
||||
NzSkeleton skeleton; // Uniquement pour les meshs squelettiques
|
||||
@@ -91,9 +91,6 @@ void NzMesh::AddSubMesh(NzSubMesh* subMesh)
|
||||
}
|
||||
#endif
|
||||
|
||||
subMesh->AddObjectListener(this, m_impl->subMeshes.size());
|
||||
subMesh->AddReference();
|
||||
|
||||
m_impl->aabbUpdated = false; // On invalide l'AABB
|
||||
m_impl->subMeshes.push_back(subMesh);
|
||||
}
|
||||
@@ -135,9 +132,6 @@ void NzMesh::AddSubMesh(const NzString& identifier, NzSubMesh* subMesh)
|
||||
|
||||
int index = m_impl->subMeshes.size();
|
||||
|
||||
subMesh->AddObjectListener(this, index);
|
||||
subMesh->AddReference();
|
||||
|
||||
m_impl->aabbUpdated = false; // On invalide l'AABB
|
||||
m_impl->subMeshes.push_back(subMesh);
|
||||
m_impl->subMeshMap[identifier] = index;
|
||||
@@ -371,12 +365,6 @@ void NzMesh::Destroy()
|
||||
{
|
||||
NotifyDestroy();
|
||||
|
||||
for (NzSubMesh* subMesh : m_impl->subMeshes)
|
||||
{
|
||||
subMesh->RemoveObjectListener(this);
|
||||
subMesh->RemoveReference();
|
||||
}
|
||||
|
||||
delete m_impl;
|
||||
m_impl = nullptr;
|
||||
}
|
||||
@@ -863,12 +851,6 @@ void NzMesh::RemoveSubMesh(const NzString& identifier)
|
||||
// On déplace l'itérateur du début d'une distance de x
|
||||
auto it2 = m_impl->subMeshes.begin();
|
||||
std::advance(it2, index);
|
||||
|
||||
// On libère la ressource
|
||||
NzSubMesh* subMesh = *it2;
|
||||
subMesh->RemoveObjectListener(this);
|
||||
subMesh->RemoveReference();
|
||||
|
||||
m_impl->subMeshes.erase(it2);
|
||||
|
||||
m_impl->aabbUpdated = false; // On invalide l'AABB
|
||||
@@ -893,12 +875,6 @@ void NzMesh::RemoveSubMesh(unsigned int index)
|
||||
// On déplace l'itérateur du début de x
|
||||
auto it = m_impl->subMeshes.begin();
|
||||
std::advance(it, index);
|
||||
|
||||
// On libère la ressource
|
||||
NzSubMesh* subMesh = *it;
|
||||
subMesh->RemoveObjectListener(this);
|
||||
subMesh->RemoveReference();
|
||||
|
||||
m_impl->subMeshes.erase(it);
|
||||
|
||||
m_impl->aabbUpdated = false; // On invalide l'AABB
|
||||
@@ -1011,11 +987,4 @@ void NzMesh::Transform(const NzMatrix4f& matrix)
|
||||
m_impl->aabbUpdated = false;
|
||||
}
|
||||
|
||||
void NzMesh::OnObjectReleased(const NzRefCounted* object, int index)
|
||||
{
|
||||
NazaraUnused(object);
|
||||
|
||||
RemoveSubMesh(index);
|
||||
}
|
||||
|
||||
NzMeshLoader::LoaderList NzMesh::s_loaders;
|
||||
|
||||
Reference in New Issue
Block a user