Added ResourceRef (Automatic resource reference)

Former-commit-id: 97a0b2732f4dc443b8e1676e68b33b1b53ddf4fb
This commit is contained in:
Lynix
2013-03-15 03:09:58 +01:00
parent 4ee6ca05ed
commit 6c2fb1eb89
29 changed files with 344 additions and 299 deletions

View File

@@ -10,6 +10,7 @@
#include <Nazara/Prerequesites.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>
@@ -27,7 +28,9 @@ struct NAZARA_API NzAnimationParams
class NzAnimation;
class NzSkeleton;
using NzAnimationConstRef = NzResourceRef<const NzAnimation>;
using NzAnimationLoader = NzResourceLoader<NzAnimation, NzAnimationParams>;
using NzAnimationRef = NzResourceRef<NzAnimation>;
struct NzAnimationImpl;

View File

@@ -10,8 +10,14 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/NonCopyable.hpp>
#include <Nazara/Core/Resource.hpp>
#include <Nazara/Core/ResourceRef.hpp>
#include <Nazara/Utility/Enums.hpp>
class NzBuffer;
using NzBufferConstRef = NzResourceRef<const NzBuffer>;
using NzBufferRef = NzResourceRef<NzBuffer>;
class NzBufferImpl;
class NAZARA_API NzBuffer : public NzResource, NzNonCopyable

View File

@@ -12,6 +12,7 @@
#include <Nazara/Core/InputStream.hpp>
#include <Nazara/Core/Resource.hpp>
#include <Nazara/Core/ResourceLoader.hpp>
#include <Nazara/Core/ResourceRef.hpp>
#include <Nazara/Math/Cube.hpp>
#include <Nazara/Math/Rect.hpp>
#include <Nazara/Math/Vector3.hpp>
@@ -39,7 +40,9 @@ struct NAZARA_API NzImageParams
class NzImage;
using NzImageConstRef = NzResourceRef<const NzImage>;
using NzImageLoader = NzResourceLoader<NzImage, NzImageParams>;
using NzImageRef = NzResourceRef<NzImage>;
class NAZARA_API NzImage : public NzResource
{

View File

@@ -9,8 +9,14 @@
#include <Nazara/Prerequesites.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>;
class NAZARA_API NzIndexBuffer : public NzResource
{
public:
@@ -40,7 +46,7 @@ class NAZARA_API NzIndexBuffer : public NzResource
void Unmap() const;
private:
NzBuffer* m_buffer;
NzBufferRef m_buffer;
bool m_ownsBuffer;
unsigned int m_indexCount;
unsigned int m_startIndex;

View File

@@ -12,6 +12,7 @@
#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/Cube.hpp>
#include <Nazara/Utility/Skeleton.hpp>
@@ -36,7 +37,9 @@ class NzMesh;
typedef NzVertexStruct_XYZ_Normal_UV_Tangent NzMeshVertex;
using NzMeshConstRef = NzResourceRef<const NzMesh>;
using NzMeshLoader = NzResourceLoader<NzMesh, NzMeshParams>;
using NzMeshRef = NzResourceRef<NzMesh>;
struct NzMeshImpl;

View File

@@ -24,6 +24,11 @@ struct NzWeight
unsigned int jointIndex;
};
class NzSkeletalMesh;
using NzSkeletalMeshConstRef = NzResourceRef<const NzSkeletalMesh>;
using NzSkeletalMeshRef = NzResourceRef<NzSkeletalMesh>;
struct NzSkeletalMeshImpl;
class NAZARA_API NzSkeletalMesh final : public NzSubMesh

View File

@@ -11,6 +11,11 @@
#include <Nazara/Core/ResourceListener.hpp>
#include <Nazara/Utility/SubMesh.hpp>
class NzStaticMesh;
using NzStaticMeshConstRef = NzResourceRef<const NzStaticMesh>;
using NzStaticMeshRef = NzResourceRef<NzStaticMesh>;
class NAZARA_API NzStaticMesh final : public NzSubMesh, NzResourceListener
{
public:

View File

@@ -9,6 +9,7 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Resource.hpp>
#include <Nazara/Core/ResourceRef.hpp>
#include <Nazara/Math/Cube.hpp>
#include <Nazara/Utility/Enums.hpp>
#include <Nazara/Utility/IndexBuffer.hpp>
@@ -16,6 +17,10 @@
#include <Nazara/Utility/VertexDeclaration.hpp>
class NzMesh;
class NzSubMesh;
using NzSubMeshConstRef = NzResourceRef<const NzSubMesh>;
using NzSubMeshRef = NzResourceRef<NzSubMesh>;
class NAZARA_API NzSubMesh : public NzResource
{

View File

@@ -9,9 +9,15 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Resource.hpp>
#include <Nazara/Core/ResourceRef.hpp>
#include <Nazara/Utility/Buffer.hpp>
#include <Nazara/Utility/VertexDeclaration.hpp>
class NzVertexBuffer;
using NzVertexBufferConstRef = NzResourceRef<NzVertexBuffer>;
using NzVertexBufferRef = NzResourceRef<NzVertexBuffer>;
class NAZARA_API NzVertexBuffer : public NzResource
{
public:
@@ -40,8 +46,8 @@ class NAZARA_API NzVertexBuffer : public NzResource
void Unmap() const;
private:
NzBuffer* m_buffer;
const NzVertexDeclaration* m_vertexDeclaration;
NzBufferRef m_buffer;
NzVertexDeclarationConstRef m_vertexDeclaration;
bool m_ownsBuffer;
unsigned int m_startVertex;
unsigned int m_vertexCount;

View File

@@ -9,6 +9,7 @@
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Core/Resource.hpp>
#include <Nazara/Core/ResourceRef.hpp>
#include <Nazara/Utility/Enums.hpp>
struct NzVertexElement
@@ -20,6 +21,11 @@ struct NzVertexElement
nzElementUsage usage;
};
class NzVertexDeclaration;
using NzVertexDeclarationConstRef = NzResourceRef<const NzVertexDeclaration>;
using NzVertexDeclarationRef = NzResourceRef<NzVertexDeclaration>;
struct NzVertexDeclarationImpl;
class NAZARA_API NzVertexDeclaration : public NzResource