Added ResourceListenerWrapper
This class wraps the call to Resource::AddResourceListener/RemoveResourceListener using RAII and help a lot with some of the dependencies. Thanks to this, the render queues now handle their resources listening properly. Former-commit-id: 7f215ffa4ccadcc4f44f777656970e92ce01087a
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include <Nazara/Core/InputStream.hpp>
|
||||
#include <Nazara/Core/NonCopyable.hpp>
|
||||
#include <Nazara/Core/Resource.hpp>
|
||||
#include <Nazara/Core/ResourceListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ResourceLoader.hpp>
|
||||
#include <Nazara/Core/ResourceRef.hpp>
|
||||
|
||||
@@ -25,7 +26,9 @@ struct NzSoundBufferParams
|
||||
class NzSound;
|
||||
class NzSoundBuffer;
|
||||
|
||||
using NzSoundBufferConstListener = NzResourceListenerWrapper<const NzSoundBuffer>;
|
||||
using NzSoundBufferConstRef = NzResourceRef<const NzSoundBuffer>;
|
||||
using NzSoundBufferListener = NzResourceListenerWrapper<NzSoundBuffer>;
|
||||
using NzSoundBufferLoader = NzResourceLoader<NzSoundBuffer, NzSoundBufferParams>;
|
||||
using NzSoundBufferRef = NzResourceRef<NzSoundBuffer>;
|
||||
|
||||
|
||||
45
include/Nazara/Core/ResourceListenerWrapper.hpp
Normal file
45
include/Nazara/Core/ResourceListenerWrapper.hpp
Normal file
@@ -0,0 +1,45 @@
|
||||
// Copyright (C) 2015 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Core module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_RESOURCELISTENERWRAPPER_HPP
|
||||
#define NAZARA_RESOURCELISTENERWRAPPER_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/Resource.hpp>
|
||||
#include <Nazara/Core/ResourceListener.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
template<typename T>
|
||||
class NzResourceListenerWrapper
|
||||
{
|
||||
static_assert(std::is_base_of<NzResource, T>::value, "ResourceRef should only be used with resource type");
|
||||
|
||||
public:
|
||||
NzResourceListenerWrapper(NzResourceListener* listener, int index = 0, T* resource = nullptr);
|
||||
NzResourceListenerWrapper(const NzResourceListenerWrapper& listener);
|
||||
NzResourceListenerWrapper(NzResourceListenerWrapper&& listener);
|
||||
~NzResourceListenerWrapper();
|
||||
|
||||
bool IsValid() const;
|
||||
void Reset(T* resource = nullptr);
|
||||
|
||||
operator bool() const;
|
||||
operator T*() const;
|
||||
T* operator->() const;
|
||||
|
||||
NzResourceListenerWrapper& operator=(T* resource);
|
||||
NzResourceListenerWrapper& operator=(const NzResourceListenerWrapper& listener);
|
||||
NzResourceListenerWrapper& operator=(NzResourceListenerWrapper&& listener);
|
||||
|
||||
private:
|
||||
T* m_resource;
|
||||
NzResourceListener* m_listener;
|
||||
int m_index;
|
||||
};
|
||||
|
||||
#include <Nazara/Core/ResourceListenerWrapper.inl>
|
||||
|
||||
#endif // NAZARA_RESOURCELISTENERWRAPPER_HPP
|
||||
108
include/Nazara/Core/ResourceListenerWrapper.inl
Normal file
108
include/Nazara/Core/ResourceListenerWrapper.inl
Normal file
@@ -0,0 +1,108 @@
|
||||
// Copyright (C) 2015 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Core module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
template<typename T>
|
||||
NzResourceListenerWrapper<T>::NzResourceListenerWrapper(NzResourceListener* listener, int index, T* resource) :
|
||||
m_resource(nullptr),
|
||||
m_listener(listener),
|
||||
m_index(index)
|
||||
{
|
||||
Reset(resource);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzResourceListenerWrapper<T>::NzResourceListenerWrapper(const NzResourceListenerWrapper& listener) :
|
||||
m_resource(nullptr),
|
||||
m_listener(listener.m_listener),
|
||||
m_index(listener.m_index)
|
||||
{
|
||||
Reset(listener.m_resource);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzResourceListenerWrapper<T>::NzResourceListenerWrapper(NzResourceListenerWrapper&& listener) :
|
||||
m_resource(listener.m_resource),
|
||||
m_listener(listener.m_listener),
|
||||
m_index(listener.m_index)
|
||||
{
|
||||
listener.m_resource = nullptr;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzResourceListenerWrapper<T>::~NzResourceListenerWrapper()
|
||||
{
|
||||
Reset(nullptr);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool NzResourceListenerWrapper<T>::IsValid() const
|
||||
{
|
||||
return m_resource != nullptr;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void NzResourceListenerWrapper<T>::Reset(T* resource)
|
||||
{
|
||||
if (resource)
|
||||
resource->AddResourceListener(m_listener, m_index);
|
||||
|
||||
if (m_resource)
|
||||
m_resource->RemoveResourceListener(m_listener);
|
||||
|
||||
m_resource = resource;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzResourceListenerWrapper<T>::operator bool() const
|
||||
{
|
||||
return IsValid();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzResourceListenerWrapper<T>::operator T*() const
|
||||
{
|
||||
return m_resource;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T* NzResourceListenerWrapper<T>::operator->() const
|
||||
{
|
||||
return m_resource;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzResourceListenerWrapper<T>& NzResourceListenerWrapper<T>::operator=(T* resource)
|
||||
{
|
||||
Reset(resource);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzResourceListenerWrapper<T>& NzResourceListenerWrapper<T>::operator=(const NzResourceListenerWrapper& listener)
|
||||
{
|
||||
m_index = listener.m_index;
|
||||
m_listener = listener.m_listener;
|
||||
Reset(listener.m_resource);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzResourceListenerWrapper<T>& NzResourceListenerWrapper<T>::operator=(NzResourceListenerWrapper&& listener)
|
||||
{
|
||||
Reset();
|
||||
|
||||
m_index = listener.m_index;
|
||||
m_listener = listener.m_listener;
|
||||
m_resource = listener.m_resource;
|
||||
|
||||
listener.m_resource = nullptr;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
@@ -11,22 +11,22 @@
|
||||
#include <Nazara/Core/Color.hpp>
|
||||
#include <Nazara/Core/ResourceListener.hpp>
|
||||
#include <Nazara/Graphics/AbstractRenderQueue.hpp>
|
||||
#include <Nazara/Graphics/Material.hpp>
|
||||
#include <Nazara/Math/Box.hpp>
|
||||
#include <Nazara/Math/Matrix4.hpp>
|
||||
#include <Nazara/Utility/IndexBuffer.hpp>
|
||||
#include <Nazara/Utility/MeshData.hpp>
|
||||
#include <Nazara/Utility/VertexBuffer.hpp>
|
||||
#include <map>
|
||||
#include <tuple>
|
||||
|
||||
class NzForwardRenderQueue;
|
||||
class NzMaterial;
|
||||
class NzSkeletalMesh;
|
||||
class NzStaticMesh;
|
||||
|
||||
class NAZARA_API NzDeferredRenderQueue : public NzAbstractRenderQueue, NzResourceListener
|
||||
{
|
||||
public:
|
||||
NzDeferredRenderQueue(NzForwardRenderQueue* forwardQueue);
|
||||
~NzDeferredRenderQueue();
|
||||
~NzDeferredRenderQueue() = default;
|
||||
|
||||
void AddDrawable(const NzDrawable* drawable) override;
|
||||
void AddLight(const NzLight* light) override;
|
||||
@@ -35,28 +35,48 @@ class NAZARA_API NzDeferredRenderQueue : public NzAbstractRenderQueue, NzResourc
|
||||
|
||||
void Clear(bool fully);
|
||||
|
||||
struct BatchedModelMaterialComparator
|
||||
{
|
||||
bool operator()(const NzMaterial* mat1, const NzMaterial* mat2);
|
||||
};
|
||||
|
||||
struct BatchedSpriteMaterialComparator
|
||||
{
|
||||
bool operator()(const NzMaterial* mat1, const NzMaterial* mat2);
|
||||
};
|
||||
|
||||
struct MeshDataComparator
|
||||
{
|
||||
bool operator()(const NzMeshData& data1, const NzMeshData& data2);
|
||||
};
|
||||
|
||||
typedef std::map<NzMeshData, std::vector<NzMatrix4f>, MeshDataComparator> MeshInstanceContainer;
|
||||
typedef std::map<const NzMaterial*, std::tuple<bool, bool, MeshInstanceContainer>, BatchedModelMaterialComparator> ModelBatches;
|
||||
typedef std::map<const NzMaterial*, std::vector<const NzSprite*>> BatchedSpriteContainer;
|
||||
struct MeshInstanceEntry
|
||||
{
|
||||
MeshInstanceEntry(NzDeferredRenderQueue* listener, int indexBufferValue, int vertexBufferValue) :
|
||||
indexBufferListener(listener, indexBufferValue),
|
||||
vertexBufferListener(listener, vertexBufferValue)
|
||||
{
|
||||
}
|
||||
|
||||
std::vector<NzMatrix4f> instances;
|
||||
NzIndexBufferConstListener indexBufferListener;
|
||||
NzVertexBufferConstListener vertexBufferListener;
|
||||
};
|
||||
|
||||
typedef std::map<NzMeshData, MeshInstanceEntry, MeshDataComparator> MeshInstanceContainer;
|
||||
|
||||
struct BatchedModelMaterialComparator
|
||||
{
|
||||
bool operator()(const NzMaterial* mat1, const NzMaterial* mat2);
|
||||
};
|
||||
|
||||
struct BatchedModelEntry
|
||||
{
|
||||
BatchedModelEntry(NzDeferredRenderQueue* listener, int materialValue) :
|
||||
materialListener(listener, materialValue)
|
||||
{
|
||||
}
|
||||
|
||||
NzMaterialConstListener materialListener;
|
||||
MeshInstanceContainer meshMap;
|
||||
bool enabled = false;
|
||||
bool instancingEnabled = false;
|
||||
};
|
||||
|
||||
typedef std::map<const NzMaterial*, BatchedModelEntry, BatchedModelMaterialComparator> ModelBatches;
|
||||
typedef std::vector<const NzLight*> LightContainer;
|
||||
|
||||
ModelBatches opaqueModels;
|
||||
BatchedSpriteContainer sprites;
|
||||
LightContainer directionalLights;
|
||||
LightContainer pointLights;
|
||||
LightContainer spotLights;
|
||||
|
||||
@@ -11,16 +11,16 @@
|
||||
#include <Nazara/Core/Color.hpp>
|
||||
#include <Nazara/Core/ResourceListener.hpp>
|
||||
#include <Nazara/Graphics/AbstractRenderQueue.hpp>
|
||||
#include <Nazara/Graphics/Material.hpp>
|
||||
#include <Nazara/Math/Box.hpp>
|
||||
#include <Nazara/Math/Matrix4.hpp>
|
||||
#include <Nazara/Utility/IndexBuffer.hpp>
|
||||
#include <Nazara/Utility/MeshData.hpp>
|
||||
#include <Nazara/Utility/VertexBuffer.hpp>
|
||||
#include <map>
|
||||
#include <tuple>
|
||||
|
||||
class NzAbstractViewer;
|
||||
class NzMaterial;
|
||||
class NzSkeletalMesh;
|
||||
class NzStaticMesh;
|
||||
|
||||
class NAZARA_API NzForwardRenderQueue : public NzAbstractRenderQueue, NzResourceListener
|
||||
{
|
||||
@@ -28,7 +28,7 @@ class NAZARA_API NzForwardRenderQueue : public NzAbstractRenderQueue, NzResource
|
||||
|
||||
public:
|
||||
NzForwardRenderQueue() = default;
|
||||
~NzForwardRenderQueue();
|
||||
~NzForwardRenderQueue() = default;
|
||||
|
||||
void AddDrawable(const NzDrawable* drawable) override;
|
||||
void AddLight(const NzLight* light) override;
|
||||
@@ -49,17 +49,15 @@ class NAZARA_API NzForwardRenderQueue : public NzAbstractRenderQueue, NzResource
|
||||
unsigned int spriteCount;
|
||||
};
|
||||
|
||||
struct TransparentModelData
|
||||
struct BatchedSpriteEntry
|
||||
{
|
||||
NzMatrix4f transformMatrix;
|
||||
NzMeshData meshData;
|
||||
NzSpheref boundingSphere;
|
||||
const NzMaterial* material;
|
||||
};
|
||||
BatchedSpriteEntry(NzForwardRenderQueue* listener, int textureValue) :
|
||||
textureListener(listener, textureValue)
|
||||
{
|
||||
}
|
||||
|
||||
struct BatchedModelMaterialComparator
|
||||
{
|
||||
bool operator()(const NzMaterial* mat1, const NzMaterial* mat2);
|
||||
std::vector<SpriteChain_XYZ_Color_UV> spriteChains;
|
||||
NzTextureConstListener textureListener;
|
||||
};
|
||||
|
||||
struct BatchedSpriteMaterialComparator
|
||||
@@ -67,15 +65,71 @@ class NAZARA_API NzForwardRenderQueue : public NzAbstractRenderQueue, NzResource
|
||||
bool operator()(const NzMaterial* mat1, const NzMaterial* mat2);
|
||||
};
|
||||
|
||||
typedef std::map<const NzTexture*, BatchedSpriteEntry> BasicSpriteOverlayContainer;
|
||||
|
||||
struct BatchedBasicSpriteEntry
|
||||
{
|
||||
BatchedBasicSpriteEntry(NzForwardRenderQueue* listener, int materialValue) :
|
||||
materialListener(listener, materialValue)
|
||||
{
|
||||
}
|
||||
|
||||
NzMaterialConstListener materialListener;
|
||||
BasicSpriteOverlayContainer overlayMap;
|
||||
bool enabled = false;
|
||||
};
|
||||
|
||||
typedef std::map<const NzMaterial*, BatchedBasicSpriteEntry> BasicSpriteBatches;
|
||||
|
||||
struct MeshDataComparator
|
||||
{
|
||||
bool operator()(const NzMeshData& data1, const NzMeshData& data2);
|
||||
};
|
||||
|
||||
typedef std::map<NzMeshData, std::pair<NzSpheref, std::vector<NzMatrix4f>>, MeshDataComparator> MeshInstanceContainer;
|
||||
typedef std::map<const NzMaterial*, std::tuple<bool, bool, MeshInstanceContainer>, BatchedModelMaterialComparator> ModelBatches;
|
||||
typedef std::map<const NzTexture*, std::vector<SpriteChain_XYZ_Color_UV>> BasicSpriteOverlayContainer;
|
||||
typedef std::map<const NzMaterial*, BasicSpriteOverlayContainer> BasicSpriteBatches;
|
||||
struct MeshInstanceEntry
|
||||
{
|
||||
MeshInstanceEntry(NzForwardRenderQueue* listener, int indexBufferValue, int vertexBufferValue) :
|
||||
indexBufferListener(listener, indexBufferValue),
|
||||
vertexBufferListener(listener, vertexBufferValue)
|
||||
{
|
||||
}
|
||||
|
||||
std::vector<NzMatrix4f> instances;
|
||||
NzIndexBufferConstListener indexBufferListener;
|
||||
NzSpheref squaredBoundingSphere;
|
||||
NzVertexBufferConstListener vertexBufferListener;
|
||||
};
|
||||
|
||||
typedef std::map<NzMeshData, MeshInstanceEntry, MeshDataComparator> MeshInstanceContainer;
|
||||
|
||||
struct BatchedModelMaterialComparator
|
||||
{
|
||||
bool operator()(const NzMaterial* mat1, const NzMaterial* mat2);
|
||||
};
|
||||
|
||||
struct BatchedModelEntry
|
||||
{
|
||||
BatchedModelEntry(NzForwardRenderQueue* listener, int materialValue) :
|
||||
materialListener(listener, materialValue)
|
||||
{
|
||||
}
|
||||
|
||||
NzMaterialConstListener materialListener;
|
||||
MeshInstanceContainer meshMap;
|
||||
bool enabled = false;
|
||||
bool instancingEnabled = false;
|
||||
};
|
||||
|
||||
typedef std::map<const NzMaterial*, BatchedModelEntry, BatchedModelMaterialComparator> ModelBatches;
|
||||
|
||||
struct TransparentModelData
|
||||
{
|
||||
NzMatrix4f transformMatrix;
|
||||
NzMeshData meshData;
|
||||
NzSpheref squaredBoundingSphere;
|
||||
const NzMaterial* material;
|
||||
};
|
||||
|
||||
typedef std::vector<const NzLight*> LightContainer;
|
||||
typedef std::vector<unsigned int> TransparentModelContainer;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/Color.hpp>
|
||||
#include <Nazara/Core/Resource.hpp>
|
||||
#include <Nazara/Core/ResourceListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ResourceLoader.hpp>
|
||||
#include <Nazara/Core/ResourceRef.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
@@ -34,7 +35,9 @@ struct NAZARA_API NzMaterialParams
|
||||
|
||||
class NzMaterial;
|
||||
|
||||
using NzMaterialConstListener = NzResourceListenerWrapper<const NzMaterial>;
|
||||
using NzMaterialConstRef = NzResourceRef<const NzMaterial>;
|
||||
using NzMaterialListener = NzResourceListenerWrapper<NzMaterial>;
|
||||
using NzMaterialLoader = NzResourceLoader<NzMaterial, NzMaterialParams>;
|
||||
using NzMaterialRef = NzResourceRef<NzMaterial>;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/Resource.hpp>
|
||||
#include <Nazara/Core/ResourceListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ResourceRef.hpp>
|
||||
#include <Nazara/Renderer/ContextParameters.hpp>
|
||||
#include <memory>
|
||||
@@ -16,7 +17,9 @@
|
||||
|
||||
class NzContext;
|
||||
|
||||
using NzContextConstListener = NzResourceListenerWrapper<const NzContext>;
|
||||
using NzContextConstRef = NzResourceRef<const NzContext>;
|
||||
using NzContextListener = NzResourceListenerWrapper<NzContext>;
|
||||
using NzContextRef = NzResourceRef<NzContext>;
|
||||
|
||||
class NzContextImpl;
|
||||
|
||||
@@ -10,12 +10,15 @@
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/NonCopyable.hpp>
|
||||
#include <Nazara/Core/Resource.hpp>
|
||||
#include <Nazara/Core/ResourceListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ResourceRef.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
|
||||
class NzRenderBuffer;
|
||||
|
||||
using NzRenderBufferConstListener = NzResourceListenerWrapper<const NzRenderBuffer>;
|
||||
using NzRenderBufferConstRef = NzResourceRef<const NzRenderBuffer>;
|
||||
using NzRenderBufferListener = NzResourceListenerWrapper<NzRenderBuffer>;
|
||||
using NzRenderBufferRef = NzResourceRef<NzRenderBuffer>;
|
||||
|
||||
class NAZARA_API NzRenderBuffer : public NzResource, NzNonCopyable
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <Nazara/Core/Color.hpp>
|
||||
#include <Nazara/Core/NonCopyable.hpp>
|
||||
#include <Nazara/Core/Resource.hpp>
|
||||
#include <Nazara/Core/ResourceListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ResourceRef.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Math/Matrix4.hpp>
|
||||
@@ -23,7 +24,9 @@
|
||||
class NzShader;
|
||||
class NzShaderStage;
|
||||
|
||||
using NzShaderConstListener = NzResourceListenerWrapper<const NzShader>;
|
||||
using NzShaderConstRef = NzResourceRef<const NzShader>;
|
||||
using NzShaderListener = NzResourceListenerWrapper<NzShader>;
|
||||
using NzShaderRef = NzResourceRef<NzShader>;
|
||||
|
||||
class NAZARA_API NzShader : public NzResource, NzNonCopyable
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/NonCopyable.hpp>
|
||||
#include <Nazara/Core/Resource.hpp>
|
||||
#include <Nazara/Core/ResourceListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ResourceRef.hpp>
|
||||
#include <Nazara/Renderer/Enums.hpp>
|
||||
#include <Nazara/Utility/AbstractImage.hpp>
|
||||
@@ -18,7 +19,9 @@
|
||||
|
||||
class NzTexture;
|
||||
|
||||
using NzTextureConstListener = NzResourceListenerWrapper<const NzTexture>;
|
||||
using NzTextureConstRef = NzResourceRef<const NzTexture>;
|
||||
using NzTextureListener = NzResourceListenerWrapper<NzTexture>;
|
||||
using NzTextureRef = NzResourceRef<NzTexture>;
|
||||
|
||||
struct NzTextureImpl;
|
||||
|
||||
@@ -10,13 +10,16 @@
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/ParameterList.hpp>
|
||||
#include <Nazara/Core/Resource.hpp>
|
||||
#include <Nazara/Core/ResourceListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ResourceRef.hpp>
|
||||
#include <Nazara/Renderer/UberShaderInstance.hpp>
|
||||
#include <unordered_map>
|
||||
|
||||
class NzUberShader;
|
||||
|
||||
using NzUberShaderConstListener = NzResourceListenerWrapper<const NzUberShader>;
|
||||
using NzUberShaderConstRef = NzResourceRef<const NzUberShader>;
|
||||
using NzUberShaderListener = NzResourceListenerWrapper<NzUberShader>;
|
||||
using NzUberShaderRef = NzResourceRef<NzUberShader>;
|
||||
|
||||
class NAZARA_API NzUberShader : public NzResource
|
||||
|
||||
@@ -9,16 +9,18 @@
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/Resource.hpp>
|
||||
#include <Nazara/Core/ResourceListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ResourceLoader.hpp>
|
||||
#include <Nazara/Core/ResourceRef.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
#include <Nazara/Utility/Sequence.hpp>
|
||||
#include <limits>
|
||||
|
||||
struct NAZARA_API NzAnimationParams
|
||||
{
|
||||
// La frame de fin à charger
|
||||
unsigned int endFrame = static_cast<unsigned int>(-1);
|
||||
unsigned int endFrame = std::numeric_limits<unsigned int>::max();
|
||||
// La frame de début à charger
|
||||
unsigned int startFrame = 0;
|
||||
|
||||
@@ -28,7 +30,9 @@ struct NAZARA_API NzAnimationParams
|
||||
class NzAnimation;
|
||||
class NzSkeleton;
|
||||
|
||||
using NzAnimationConstListener = NzResourceListenerWrapper<const NzAnimation>;
|
||||
using NzAnimationConstRef = NzResourceRef<const NzAnimation>;
|
||||
using NzAnimationListener = NzResourceListenerWrapper<NzAnimation>;
|
||||
using NzAnimationLoader = NzResourceLoader<NzAnimation, NzAnimationParams>;
|
||||
using NzAnimationRef = NzResourceRef<NzAnimation>;
|
||||
|
||||
|
||||
@@ -10,12 +10,15 @@
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/NonCopyable.hpp>
|
||||
#include <Nazara/Core/Resource.hpp>
|
||||
#include <Nazara/Core/ResourceListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ResourceRef.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
|
||||
class NzBuffer;
|
||||
|
||||
using NzBufferConstListener = NzResourceListenerWrapper<const NzBuffer>;
|
||||
using NzBufferConstRef = NzResourceRef<const NzBuffer>;
|
||||
using NzBufferListener = NzResourceListenerWrapper<NzBuffer>;
|
||||
using NzBufferRef = NzResourceRef<NzBuffer>;
|
||||
|
||||
class NzAbstractBuffer;
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/NonCopyable.hpp>
|
||||
#include <Nazara/Core/ResourceRef.hpp>
|
||||
#include <Nazara/Core/ResourceListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ResourceLoader.hpp>
|
||||
#include <Nazara/Core/ResourceRef.hpp>
|
||||
#include <Nazara/Utility/AbstractAtlas.hpp>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
@@ -25,7 +26,9 @@ class NzFontData;
|
||||
|
||||
struct NzFontGlyph;
|
||||
|
||||
using NzFontConstListener = NzResourceListenerWrapper<const NzFont>;
|
||||
using NzFontConstRef = NzResourceRef<const NzFont>;
|
||||
using NzFontListener = NzResourceListenerWrapper<NzFont>;
|
||||
using NzFontLoader = NzResourceLoader<NzFont, NzFontParams>;
|
||||
using NzFontRef = NzResourceRef<NzFont>;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <Nazara/Core/Color.hpp>
|
||||
#include <Nazara/Core/InputStream.hpp>
|
||||
#include <Nazara/Core/Resource.hpp>
|
||||
#include <Nazara/Core/ResourceListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ResourceLoader.hpp>
|
||||
#include <Nazara/Core/ResourceRef.hpp>
|
||||
#include <Nazara/Utility/AbstractImage.hpp>
|
||||
@@ -32,7 +33,9 @@ struct NAZARA_API NzImageParams
|
||||
|
||||
class NzImage;
|
||||
|
||||
using NzImageConstListener = NzResourceListenerWrapper<const NzImage>;
|
||||
using NzImageConstRef = NzResourceRef<const NzImage>;
|
||||
using NzImageListener = NzResourceListenerWrapper<NzImage>;
|
||||
using NzImageLoader = NzResourceLoader<NzImage, NzImageParams>;
|
||||
using NzImageRef = NzResourceRef<NzImage>;
|
||||
|
||||
|
||||
@@ -9,12 +9,15 @@
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/Resource.hpp>
|
||||
#include <Nazara/Core/ResourceListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ResourceRef.hpp>
|
||||
#include <Nazara/Utility/Buffer.hpp>
|
||||
|
||||
class NzIndexBuffer;
|
||||
|
||||
using NzIndexBufferConstListener = NzResourceListenerWrapper<const NzIndexBuffer>;
|
||||
using NzIndexBufferConstRef = NzResourceRef<const NzIndexBuffer>;
|
||||
using NzIndexBufferListener = NzResourceListenerWrapper<NzIndexBuffer>;
|
||||
using NzIndexBufferRef = NzResourceRef<NzIndexBuffer>;
|
||||
|
||||
class NAZARA_API NzIndexBuffer : public NzResource
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <Nazara/Core/InputStream.hpp>
|
||||
#include <Nazara/Core/Primitive.hpp>
|
||||
#include <Nazara/Core/Resource.hpp>
|
||||
#include <Nazara/Core/ResourceListener.hpp>
|
||||
#include <Nazara/Core/ResourceListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ResourceLoader.hpp>
|
||||
#include <Nazara/Core/ResourceRef.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
@@ -52,13 +52,15 @@ class NzPrimitiveList;
|
||||
typedef NzVertexStruct_XYZ_Normal_UV_Tangent NzMeshVertex;
|
||||
typedef NzVertexStruct_XYZ_Normal_UV_Tangent_Skinning NzSkeletalMeshVertex;
|
||||
|
||||
using NzMeshConstListener = NzResourceListenerWrapper<const NzMesh>;
|
||||
using NzMeshConstRef = NzResourceRef<const NzMesh>;
|
||||
using NzMeshListener = NzResourceListenerWrapper<NzMesh>;
|
||||
using NzMeshLoader = NzResourceLoader<NzMesh, NzMeshParams>;
|
||||
using NzMeshRef = NzResourceRef<NzMesh>;
|
||||
|
||||
struct NzMeshImpl;
|
||||
|
||||
class NAZARA_API NzMesh : public NzResource, NzResourceListener
|
||||
class NAZARA_API NzMesh : public NzResource
|
||||
{
|
||||
friend NzMeshLoader;
|
||||
|
||||
@@ -121,8 +123,6 @@ class NAZARA_API NzMesh : public NzResource, NzResourceListener
|
||||
void Transform(const NzMatrix4f& matrix);
|
||||
|
||||
private:
|
||||
void OnResourceReleased(const NzResource* resource, int index) override;
|
||||
|
||||
NzMeshImpl* m_impl = nullptr;
|
||||
|
||||
static NzMeshLoader::LoaderList s_loaders;
|
||||
|
||||
@@ -19,7 +19,7 @@ class NAZARA_API NzSimpleTextDrawer : public NzAbstractTextDrawer, NzResourceLis
|
||||
{
|
||||
public:
|
||||
NzSimpleTextDrawer();
|
||||
virtual ~NzSimpleTextDrawer();
|
||||
virtual ~NzSimpleTextDrawer() = default;
|
||||
|
||||
const NzRectui& GetBounds() const;
|
||||
unsigned int GetCharacterSize() const;
|
||||
@@ -49,6 +49,7 @@ class NAZARA_API NzSimpleTextDrawer : public NzAbstractTextDrawer, NzResourceLis
|
||||
mutable std::vector<Glyph> m_glyphs;
|
||||
NzColor m_color;
|
||||
NzFontRef m_font;
|
||||
NzFontListener m_fontListener; // Doit se situer après le FontRef (pour être libéré avant)
|
||||
mutable NzRectui m_bounds;
|
||||
NzString m_text;
|
||||
nzUInt32 m_style;
|
||||
|
||||
@@ -8,12 +8,16 @@
|
||||
#define NAZARA_SKELETALMESH_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/ResourceListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ResourceRef.hpp>
|
||||
#include <Nazara/Utility/Mesh.hpp>
|
||||
#include <Nazara/Utility/SubMesh.hpp>
|
||||
|
||||
class NzSkeletalMesh;
|
||||
|
||||
using NzSkeletalMeshConstListener = NzResourceListenerWrapper<const NzSkeletalMesh>;
|
||||
using NzSkeletalMeshConstRef = NzResourceRef<const NzSkeletalMesh>;
|
||||
using NzSkeletalMeshListener = NzResourceListenerWrapper<NzSkeletalMesh>;
|
||||
using NzSkeletalMeshRef = NzResourceRef<NzSkeletalMesh>;
|
||||
|
||||
class NAZARA_API NzSkeletalMesh final : public NzSubMesh
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/Resource.hpp>
|
||||
#include <Nazara/Core/ResourceListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ResourceRef.hpp>
|
||||
#include <Nazara/Math/Box.hpp>
|
||||
#include <Nazara/Utility/Joint.hpp>
|
||||
@@ -16,7 +17,9 @@
|
||||
|
||||
class NzSkeleton;
|
||||
|
||||
using NzSkeletonConstListener = NzResourceListenerWrapper<const NzSkeleton>;
|
||||
using NzSkeletonConstRef = NzResourceRef<const NzSkeleton>;
|
||||
using NzSkeletonListener = NzResourceListenerWrapper<NzSkeleton>;
|
||||
using NzSkeletonRef = NzResourceRef<NzSkeleton>;
|
||||
|
||||
struct NzSkeletonImpl;
|
||||
|
||||
@@ -9,11 +9,14 @@
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/ResourceListener.hpp>
|
||||
#include <Nazara/Core/ResourceListenerWrapper.hpp>
|
||||
#include <Nazara/Utility/SubMesh.hpp>
|
||||
|
||||
class NzStaticMesh;
|
||||
|
||||
using NzStaticMeshConstListener = NzResourceListenerWrapper<const NzStaticMesh>;
|
||||
using NzStaticMeshConstRef = NzResourceRef<const NzStaticMesh>;
|
||||
using NzStaticMeshListener = NzResourceListenerWrapper<NzStaticMesh>;
|
||||
using NzStaticMeshRef = NzResourceRef<NzStaticMesh>;
|
||||
|
||||
class NAZARA_API NzStaticMesh final : public NzSubMesh, NzResourceListener
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/Resource.hpp>
|
||||
#include <Nazara/Core/ResourceListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ResourceRef.hpp>
|
||||
#include <Nazara/Math/Box.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
@@ -19,7 +20,9 @@
|
||||
class NzMesh;
|
||||
class NzSubMesh;
|
||||
|
||||
using NzSubMeshConstListener = NzResourceListenerWrapper<const NzSubMesh>;
|
||||
using NzSubMeshConstRef = NzResourceRef<const NzSubMesh>;
|
||||
using NzSubMeshListener = NzResourceListenerWrapper<NzSubMesh>;
|
||||
using NzSubMeshRef = NzResourceRef<NzSubMesh>;
|
||||
|
||||
class NAZARA_API NzSubMesh : public NzResource
|
||||
|
||||
@@ -9,13 +9,16 @@
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/Resource.hpp>
|
||||
#include <Nazara/Core/ResourceListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ResourceRef.hpp>
|
||||
#include <Nazara/Utility/Buffer.hpp>
|
||||
#include <Nazara/Utility/VertexDeclaration.hpp>
|
||||
|
||||
class NzVertexBuffer;
|
||||
|
||||
using NzVertexBufferConstListener = NzResourceListenerWrapper<const NzVertexBuffer>;
|
||||
using NzVertexBufferConstRef = NzResourceRef<NzVertexBuffer>;
|
||||
using NzVertexBufferListener = NzResourceListenerWrapper<NzVertexBuffer>;
|
||||
using NzVertexBufferRef = NzResourceRef<NzVertexBuffer>;
|
||||
|
||||
class NAZARA_API NzVertexBuffer : public NzResource
|
||||
|
||||
@@ -9,12 +9,15 @@
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/Resource.hpp>
|
||||
#include <Nazara/Core/ResourceListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ResourceRef.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
|
||||
class NzVertexDeclaration;
|
||||
|
||||
using NzVertexDeclarationConstListener = NzResourceListenerWrapper<const NzVertexDeclaration>;
|
||||
using NzVertexDeclarationConstRef = NzResourceRef<const NzVertexDeclaration>;
|
||||
using NzVertexDeclarationListener = NzResourceListenerWrapper<NzVertexDeclaration>;
|
||||
using NzVertexDeclarationRef = NzResourceRef<NzVertexDeclaration>;
|
||||
|
||||
class NAZARA_API NzVertexDeclaration : public NzResource
|
||||
|
||||
Reference in New Issue
Block a user