Separated reference counting from Resources

Former-commit-id: 7380818cfee9e249c11fd15da9ff7883a6e76565
This commit is contained in:
Lynix
2014-07-15 00:59:02 +02:00
parent 0af8bc4829
commit 9e04e8a0e4
51 changed files with 566 additions and 508 deletions

View File

@@ -8,9 +8,10 @@
#define NAZARA_ANIMATION_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/ObjectRef.hpp>
#include <Nazara/Core/RefCounted.hpp>
#include <Nazara/Core/Resource.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>
@@ -28,13 +29,13 @@ struct NAZARA_API NzAnimationParams
class NzAnimation;
class NzSkeleton;
using NzAnimationConstRef = NzResourceRef<const NzAnimation>;
using NzAnimationConstRef = NzObjectRef<const NzAnimation>;
using NzAnimationLoader = NzResourceLoader<NzAnimation, NzAnimationParams>;
using NzAnimationRef = NzResourceRef<NzAnimation>;
using NzAnimationRef = NzObjectRef<NzAnimation>;
struct NzAnimationImpl;
class NAZARA_API NzAnimation : public NzResource
class NAZARA_API NzAnimation : public NzRefCounted, public NzResource
{
friend NzAnimationLoader;

View File

@@ -9,18 +9,18 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/NonCopyable.hpp>
#include <Nazara/Core/Resource.hpp>
#include <Nazara/Core/ResourceRef.hpp>
#include <Nazara/Core/ObjectRef.hpp>
#include <Nazara/Core/RefCounted.hpp>
#include <Nazara/Utility/Enums.hpp>
class NzBuffer;
using NzBufferConstRef = NzResourceRef<const NzBuffer>;
using NzBufferRef = NzResourceRef<NzBuffer>;
using NzBufferConstRef = NzObjectRef<const NzBuffer>;
using NzBufferRef = NzObjectRef<NzBuffer>;
class NzAbstractBuffer;
class NAZARA_API NzBuffer : public NzResource, NzNonCopyable
class NAZARA_API NzBuffer : public NzRefCounted, NzNonCopyable
{
friend class NzUtility;

View File

@@ -10,9 +10,10 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Color.hpp>
#include <Nazara/Core/InputStream.hpp>
#include <Nazara/Core/ObjectRef.hpp>
#include <Nazara/Core/RefCounted.hpp>
#include <Nazara/Core/Resource.hpp>
#include <Nazara/Core/ResourceLoader.hpp>
#include <Nazara/Core/ResourceRef.hpp>
#include <Nazara/Math/Box.hpp>
#include <Nazara/Math/Rect.hpp>
#include <Nazara/Math/Vector3.hpp>
@@ -36,11 +37,11 @@ struct NAZARA_API NzImageParams
class NzImage;
using NzImageConstRef = NzResourceRef<const NzImage>;
using NzImageConstRef = NzObjectRef<const NzImage>;
using NzImageLoader = NzResourceLoader<NzImage, NzImageParams>;
using NzImageRef = NzResourceRef<NzImage>;
using NzImageRef = NzObjectRef<NzImage>;
class NAZARA_API NzImage : public NzResource
class NAZARA_API NzImage : public NzRefCounted, public NzResource
{
friend NzImageLoader;

View File

@@ -8,16 +8,16 @@
#define NAZARA_INDEXBUFFER_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/ObjectRef.hpp>
#include <Nazara/Core/Resource.hpp>
#include <Nazara/Core/ResourceRef.hpp>
#include <Nazara/Utility/Buffer.hpp>
class NzIndexBuffer;
using NzIndexBufferConstRef = NzResourceRef<const NzIndexBuffer>;
using NzIndexBufferRef = NzResourceRef<NzIndexBuffer>;
using NzIndexBufferConstRef = NzObjectRef<const NzIndexBuffer>;
using NzIndexBufferRef = NzObjectRef<NzIndexBuffer>;
class NAZARA_API NzIndexBuffer : public NzResource
class NAZARA_API NzIndexBuffer : public NzRefCounted
{
public:
NzIndexBuffer() = default;

View File

@@ -9,11 +9,12 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/InputStream.hpp>
#include <Nazara/Core/ObjectListener.hpp>
#include <Nazara/Core/ObjectRef.hpp>
#include <Nazara/Core/Primitive.hpp>
#include <Nazara/Core/RefCounted.hpp>
#include <Nazara/Core/Resource.hpp>
#include <Nazara/Core/ResourceListener.hpp>
#include <Nazara/Core/ResourceLoader.hpp>
#include <Nazara/Core/ResourceRef.hpp>
#include <Nazara/Core/String.hpp>
#include <Nazara/Math/Box.hpp>
#include <Nazara/Utility/Skeleton.hpp>
@@ -49,13 +50,13 @@ class NzPrimitiveList;
typedef NzVertexStruct_XYZ_Normal_UV_Tangent NzMeshVertex;
typedef NzVertexStruct_XYZ_Normal_UV_Tangent_Skinning NzSkeletalMeshVertex;
using NzMeshConstRef = NzResourceRef<const NzMesh>;
using NzMeshConstRef = NzObjectRef<const NzMesh>;
using NzMeshLoader = NzResourceLoader<NzMesh, NzMeshParams>;
using NzMeshRef = NzResourceRef<NzMesh>;
using NzMeshRef = NzObjectRef<NzMesh>;
struct NzMeshImpl;
class NAZARA_API NzMesh : public NzResource, NzResourceListener
class NAZARA_API NzMesh : public NzRefCounted, public NzResource, NzObjectListener
{
friend NzMeshLoader;
@@ -118,7 +119,7 @@ class NAZARA_API NzMesh : public NzResource, NzResourceListener
void Transform(const NzMatrix4f& matrix);
private:
void OnResourceReleased(const NzResource* resource, int index) override;
void OnObjectReleased(const NzRefCounted* object, int index) override;
NzMeshImpl* m_impl = nullptr;

View File

@@ -13,8 +13,8 @@
class NzSkeletalMesh;
using NzSkeletalMeshConstRef = NzResourceRef<const NzSkeletalMesh>;
using NzSkeletalMeshRef = NzResourceRef<NzSkeletalMesh>;
using NzSkeletalMeshConstRef = NzObjectRef<const NzSkeletalMesh>;
using NzSkeletalMeshRef = NzObjectRef<NzSkeletalMesh>;
class NAZARA_API NzSkeletalMesh final : public NzSubMesh
{

View File

@@ -8,14 +8,14 @@
#define NAZARA_SKELETON_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Resource.hpp>
#include <Nazara/Core/RefCounted.hpp>
#include <Nazara/Math/Box.hpp>
#include <Nazara/Utility/Joint.hpp>
#include <vector>
struct NzSkeletonImpl;
class NAZARA_API NzSkeleton : public NzResource
class NAZARA_API NzSkeleton : public NzRefCounted
{
friend NzJoint;

View File

@@ -8,15 +8,14 @@
#define NAZARA_STATICMESH_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/ResourceListener.hpp>
#include <Nazara/Utility/SubMesh.hpp>
class NzStaticMesh;
using NzStaticMeshConstRef = NzResourceRef<const NzStaticMesh>;
using NzStaticMeshRef = NzResourceRef<NzStaticMesh>;
using NzStaticMeshConstRef = NzObjectRef<const NzStaticMesh>;
using NzStaticMeshRef = NzObjectRef<NzStaticMesh>;
class NAZARA_API NzStaticMesh final : public NzSubMesh, NzResourceListener
class NAZARA_API NzStaticMesh final : public NzSubMesh
{
public:
NzStaticMesh(const NzMesh* parent);

View File

@@ -8,8 +8,8 @@
#define NAZARA_SUBMESH_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Resource.hpp>
#include <Nazara/Core/ResourceRef.hpp>
#include <Nazara/Core/ObjectRef.hpp>
#include <Nazara/Core/RefCounted.hpp>
#include <Nazara/Math/Box.hpp>
#include <Nazara/Utility/Enums.hpp>
#include <Nazara/Utility/IndexBuffer.hpp>
@@ -19,10 +19,10 @@
class NzMesh;
class NzSubMesh;
using NzSubMeshConstRef = NzResourceRef<const NzSubMesh>;
using NzSubMeshRef = NzResourceRef<NzSubMesh>;
using NzSubMeshConstRef = NzObjectRef<const NzSubMesh>;
using NzSubMeshRef = NzObjectRef<NzSubMesh>;
class NAZARA_API NzSubMesh : public NzResource
class NAZARA_API NzSubMesh : public NzRefCounted
{
friend NzMesh;

View File

@@ -8,17 +8,17 @@
#define NAZARA_VERTEXBUFFER_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Resource.hpp>
#include <Nazara/Core/ResourceRef.hpp>
#include <Nazara/Core/ObjectRef.hpp>
#include <Nazara/Core/RefCounted.hpp>
#include <Nazara/Utility/Buffer.hpp>
#include <Nazara/Utility/VertexDeclaration.hpp>
class NzVertexBuffer;
using NzVertexBufferConstRef = NzResourceRef<NzVertexBuffer>;
using NzVertexBufferRef = NzResourceRef<NzVertexBuffer>;
using NzVertexBufferConstRef = NzObjectRef<NzVertexBuffer>;
using NzVertexBufferRef = NzObjectRef<NzVertexBuffer>;
class NAZARA_API NzVertexBuffer : public NzResource
class NAZARA_API NzVertexBuffer : public NzRefCounted
{
public:
NzVertexBuffer() = default;

View File

@@ -8,16 +8,16 @@
#define NAZARA_VERTEXDECLARATION_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Resource.hpp>
#include <Nazara/Core/ResourceRef.hpp>
#include <Nazara/Core/ObjectRef.hpp>
#include <Nazara/Core/RefCounted.hpp>
#include <Nazara/Utility/Enums.hpp>
class NzVertexDeclaration;
using NzVertexDeclarationConstRef = NzResourceRef<const NzVertexDeclaration>;
using NzVertexDeclarationRef = NzResourceRef<NzVertexDeclaration>;
using NzVertexDeclarationConstRef = NzObjectRef<const NzVertexDeclaration>;
using NzVertexDeclarationRef = NzObjectRef<NzVertexDeclaration>;
class NAZARA_API NzVertexDeclaration : public NzResource
class NAZARA_API NzVertexDeclaration : public NzRefCounted
{
friend class NzUtility;