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:
58
include/Nazara/Utility/AbstractAtlas.hpp
Normal file
58
include/Nazara/Utility/AbstractAtlas.hpp
Normal file
@@ -0,0 +1,58 @@
|
||||
// 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
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_ABSTRACTATLAS_HPP
|
||||
#define NAZARA_ABSTRACTATLAS_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/SparsePtr.hpp>
|
||||
#include <Nazara/Math/Rect.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
#include <unordered_map>
|
||||
|
||||
class NzAbstractImage;
|
||||
class NzImage;
|
||||
|
||||
class NAZARA_API NzAbstractAtlas
|
||||
{
|
||||
public:
|
||||
class Listener;
|
||||
|
||||
NzAbstractAtlas();
|
||||
virtual ~NzAbstractAtlas();
|
||||
|
||||
void AddListener(Listener* font, void* userdata = nullptr) const;
|
||||
|
||||
virtual void Clear() = 0;
|
||||
virtual void Free(NzSparsePtr<const NzRectui> rects, NzSparsePtr<unsigned int> layers, unsigned int count) = 0;
|
||||
virtual NzAbstractImage* GetLayer(unsigned int layerIndex) const = 0;
|
||||
virtual unsigned int GetLayerCount() const = 0;
|
||||
virtual nzUInt32 GetStorage() const = 0;
|
||||
virtual bool Insert(const NzImage& image, NzRectui* rect, bool* flipped, unsigned int* layerIndex) = 0;
|
||||
|
||||
void RemoveListener(Listener* font) const;
|
||||
|
||||
class NAZARA_API Listener
|
||||
{
|
||||
public:
|
||||
Listener() = default;
|
||||
virtual ~Listener();
|
||||
|
||||
virtual bool OnAtlasCleared(const NzAbstractAtlas* atlas, void* userdata);
|
||||
virtual bool OnAtlasLayerChange(const NzAbstractAtlas* atlas, NzAbstractImage* oldLayer, NzAbstractImage* newLayer, void* userdata);
|
||||
virtual void OnAtlasReleased(const NzAbstractAtlas* atlas, void* userdata);
|
||||
};
|
||||
|
||||
protected:
|
||||
void NotifyCleared();
|
||||
void NotifyLayerChange(NzAbstractImage* oldLayer, NzAbstractImage* newLayer);
|
||||
|
||||
private:
|
||||
mutable std::unordered_map<Listener*, void*> m_listeners;
|
||||
bool m_listenersLocked;
|
||||
};
|
||||
|
||||
#endif // NAZARA_ABSTRACTATLAS_HPP
|
||||
@@ -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
|
||||
|
||||
|
||||
42
include/Nazara/Utility/AbstractImage.hpp
Normal file
42
include/Nazara/Utility/AbstractImage.hpp
Normal file
@@ -0,0 +1,42 @@
|
||||
// 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
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_ABSTRACTIMAGE_HPP
|
||||
#define NAZARA_ABSTRACTIMAGE_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Math/Box.hpp>
|
||||
#include <Nazara/Math/Rect.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
|
||||
class NAZARA_API NzAbstractImage
|
||||
{
|
||||
public:
|
||||
NzAbstractImage() = default;
|
||||
virtual ~NzAbstractImage();
|
||||
|
||||
nzUInt8 GetBytesPerPixel() const;
|
||||
virtual unsigned int GetDepth(nzUInt8 level = 0) const = 0;
|
||||
virtual nzPixelFormat GetFormat() const = 0;
|
||||
virtual unsigned int GetHeight(nzUInt8 level = 0) const = 0;
|
||||
virtual nzUInt8 GetLevelCount() const = 0;
|
||||
virtual nzUInt8 GetMaxLevel() const = 0;
|
||||
virtual unsigned int GetMemoryUsage() const = 0;
|
||||
virtual unsigned int GetMemoryUsage(nzUInt8 level) const = 0;
|
||||
virtual NzVector3ui GetSize(nzUInt8 level = 0) const = 0;
|
||||
virtual nzImageType GetType() const = 0;
|
||||
virtual unsigned int GetWidth(nzUInt8 level = 0) const = 0;
|
||||
|
||||
bool IsCompressed() const;
|
||||
bool IsCubemap() const;
|
||||
|
||||
virtual bool Update(const nzUInt8* pixels, unsigned int srcWidth = 0, unsigned int srcHeight = 0, nzUInt8 level = 0) = 0;
|
||||
virtual bool Update(const nzUInt8* pixels, const NzBoxui& box, unsigned int srcWidth = 0, unsigned int srcHeight = 0, nzUInt8 level = 0) = 0;
|
||||
virtual bool Update(const nzUInt8* pixels, const NzRectui& rect, unsigned int z = 0, unsigned int srcWidth = 0, unsigned int srcHeight = 0, nzUInt8 level = 0) = 0;
|
||||
};
|
||||
|
||||
#endif // NAZARA_IMAGE_HPP
|
||||
42
include/Nazara/Utility/AbstractTextDrawer.hpp
Normal file
42
include/Nazara/Utility/AbstractTextDrawer.hpp
Normal file
@@ -0,0 +1,42 @@
|
||||
// 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
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_ABSTRACTTEXTDRAWER_HPP
|
||||
#define NAZARA_ABSTRACTTEXTDRAWER_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/Color.hpp>
|
||||
#include <Nazara/Math/Rect.hpp>
|
||||
#include <Nazara/Math/Vector2.hpp>
|
||||
|
||||
class NzAbstractImage;
|
||||
class NzFont;
|
||||
|
||||
class NAZARA_API NzAbstractTextDrawer
|
||||
{
|
||||
public:
|
||||
struct Glyph;
|
||||
|
||||
NzAbstractTextDrawer() = default;
|
||||
virtual ~NzAbstractTextDrawer();
|
||||
|
||||
virtual const NzRectui& GetBounds() const = 0;
|
||||
virtual NzFont* GetFont(unsigned int index) const = 0;
|
||||
virtual unsigned int GetFontCount() const = 0;
|
||||
virtual const Glyph& GetGlyph(unsigned int index) const = 0;
|
||||
virtual unsigned int GetGlyphCount() const = 0;
|
||||
|
||||
struct Glyph
|
||||
{
|
||||
NzColor color;
|
||||
NzRectui atlasRect;
|
||||
NzVector2f corners[4];
|
||||
NzAbstractImage* atlas;
|
||||
bool flipped;
|
||||
};
|
||||
};
|
||||
|
||||
#endif // NAZARA_ABSTRACTTEXTDRAWER_HPP
|
||||
@@ -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
|
||||
|
||||
@@ -32,6 +32,7 @@ NAZARA_API void NzComputePlaneIndexVertexCount(const NzVector2ui& subdivision, u
|
||||
NAZARA_API void NzComputeUvSphereIndexVertexCount(unsigned int sliceCount, unsigned int stackCount, unsigned int* indexCount, unsigned int* vertexCount);
|
||||
template<typename T> NzBoxf NzComputeVerticesAABB(const T* vertices, unsigned int vertexCount);
|
||||
|
||||
///TODO: Remplacer le pointeur vertices par une structure composée de plusieurs SparsePtr
|
||||
NAZARA_API void NzGenerateBox(const NzVector3f& lengths, const NzVector3ui& subdivision, const NzMatrix4f& matrix, const NzRectf& textureCoords, NzMeshVertex* vertices, NzIndexIterator indices, NzBoxf* aabb = nullptr, unsigned int indexOffset = 0);
|
||||
NAZARA_API void NzGenerateCone(float length, float radius, unsigned int subdivision, const NzMatrix4f& matrix, const NzRectf& textureCoords, NzMeshVertex* vertices, NzIndexIterator indices, NzBoxf* aabb = nullptr, unsigned int indexOffset = 0);
|
||||
NAZARA_API void NzGenerateCubicSphere(float size, unsigned int subdivision, const NzMatrix4f& matrix, const NzRectf& textureCoords, NzMeshVertex* vertices, NzIndexIterator indices, NzBoxf* aabb = nullptr, unsigned int indexOffset = 0);
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#define NAZARA_ANIMATION_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/ObjectListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ObjectRef.hpp>
|
||||
#include <Nazara/Core/RefCounted.hpp>
|
||||
#include <Nazara/Core/Resource.hpp>
|
||||
@@ -15,11 +16,12 @@
|
||||
#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;
|
||||
|
||||
@@ -29,7 +31,9 @@ struct NAZARA_API NzAnimationParams
|
||||
class NzAnimation;
|
||||
class NzSkeleton;
|
||||
|
||||
using NzAnimationConstListener = NzObjectListenerWrapper<const NzAnimation>;
|
||||
using NzAnimationConstRef = NzObjectRef<const NzAnimation>;
|
||||
using NzAnimationListener = NzObjectListenerWrapper<NzAnimation>;
|
||||
using NzAnimationLoader = NzResourceLoader<NzAnimation, NzAnimationParams>;
|
||||
using NzAnimationRef = NzObjectRef<NzAnimation>;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -9,13 +9,16 @@
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/NonCopyable.hpp>
|
||||
#include <Nazara/Core/ObjectListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ObjectRef.hpp>
|
||||
#include <Nazara/Core/RefCounted.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
|
||||
class NzBuffer;
|
||||
|
||||
using NzBufferConstListener = NzObjectListenerWrapper<const NzBuffer>;
|
||||
using NzBufferConstRef = NzObjectRef<const NzBuffer>;
|
||||
using NzBufferListener = NzObjectListenerWrapper<NzBuffer>;
|
||||
using NzBufferRef = NzObjectRef<NzBuffer>;
|
||||
|
||||
class NzAbstractBuffer;
|
||||
@@ -25,22 +28,22 @@ class NAZARA_API NzBuffer : public NzRefCounted, NzNonCopyable
|
||||
friend class NzUtility;
|
||||
|
||||
public:
|
||||
using BufferFunction = NzAbstractBuffer* (*)(NzBuffer* parent, nzBufferType type);
|
||||
using BufferFactory = NzAbstractBuffer* (*)(NzBuffer* parent, nzBufferType type);
|
||||
|
||||
NzBuffer(nzBufferType type);
|
||||
NzBuffer(nzBufferType type, unsigned int size, nzBufferStorage storage = nzBufferStorage_Software, nzBufferUsage usage = nzBufferUsage_Static);
|
||||
NzBuffer(nzBufferType type, unsigned int size, nzUInt32 storage = nzDataStorage_Software, nzBufferUsage usage = nzBufferUsage_Static);
|
||||
~NzBuffer();
|
||||
|
||||
bool CopyContent(const NzBuffer& buffer);
|
||||
|
||||
bool Create(unsigned int size, nzBufferStorage storage = nzBufferStorage_Software, nzBufferUsage usage = nzBufferUsage_Static);
|
||||
bool Create(unsigned int size, nzUInt32 storage = nzDataStorage_Software, nzBufferUsage usage = nzBufferUsage_Static);
|
||||
void Destroy();
|
||||
|
||||
bool Fill(const void* data, unsigned int offset, unsigned int size, bool forceDiscard = false);
|
||||
|
||||
NzAbstractBuffer* GetImpl() const;
|
||||
unsigned int GetSize() const;
|
||||
nzBufferStorage GetStorage() const;
|
||||
nzUInt32 GetStorage() const;
|
||||
nzBufferType GetType() const;
|
||||
nzBufferUsage GetUsage() const;
|
||||
|
||||
@@ -50,24 +53,24 @@ class NAZARA_API NzBuffer : public NzRefCounted, NzNonCopyable
|
||||
void* Map(nzBufferAccess access, unsigned int offset = 0, unsigned int size = 0);
|
||||
void* Map(nzBufferAccess access, unsigned int offset = 0, unsigned int size = 0) const;
|
||||
|
||||
bool SetStorage(nzBufferStorage storage);
|
||||
bool SetStorage(nzUInt32 storage);
|
||||
|
||||
void Unmap() const;
|
||||
|
||||
static bool IsSupported(nzBufferStorage storage);
|
||||
static void SetBufferFunction(nzBufferStorage storage, BufferFunction func);
|
||||
static bool IsStorageSupported(nzUInt32 storage);
|
||||
static void SetBufferFactory(nzUInt32 storage, BufferFactory func);
|
||||
|
||||
private:
|
||||
static bool Initialize();
|
||||
static void Uninitialize();
|
||||
|
||||
nzBufferStorage m_storage;
|
||||
nzBufferType m_type;
|
||||
nzBufferUsage m_usage;
|
||||
nzUInt32 m_storage;
|
||||
NzAbstractBuffer* m_impl;
|
||||
unsigned int m_size;
|
||||
|
||||
static BufferFunction s_bufferFunctions[nzBufferStorage_Max+1];
|
||||
static BufferFactory s_bufferFactories[nzDataStorage_Max+1];
|
||||
};
|
||||
|
||||
#endif // NAZARA_BUFFER_HPP
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
Nazara Engine - Utility module
|
||||
|
||||
Copyright (C) 2014 Jérôme "Lynix" Leclercq (Lynix680@gmail.com)
|
||||
Copyright (C) 2015 Jérôme "Lynix" Leclercq (Lynix680@gmail.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal 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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -25,15 +25,6 @@ enum nzBufferAccess
|
||||
nzBufferAccess_Max = nzBufferAccess_WriteOnly
|
||||
};
|
||||
|
||||
enum nzBufferStorage
|
||||
{
|
||||
//nzBufferStorage_Both, ///TODO
|
||||
nzBufferStorage_Hardware,
|
||||
nzBufferStorage_Software,
|
||||
|
||||
nzBufferStorage_Max = nzBufferStorage_Software
|
||||
};
|
||||
|
||||
enum nzBufferType
|
||||
{
|
||||
nzBufferType_Index,
|
||||
@@ -84,6 +75,16 @@ enum nzCubemapFace
|
||||
nzCubemapFace_Max = nzCubemapFace_NegativeZ
|
||||
};
|
||||
|
||||
enum nzDataStorageFlags
|
||||
{
|
||||
nzDataStorage_Hardware = 0x1,
|
||||
nzDataStorage_Software = 0x2,
|
||||
|
||||
nzDataStorage_Both = nzDataStorage_Hardware | nzDataStorage_Software,
|
||||
|
||||
nzDataStorage_Max = nzDataStorage_Software*2-1
|
||||
};
|
||||
|
||||
enum nzEventType
|
||||
{
|
||||
nzEventType_GainedFocus,
|
||||
@@ -130,6 +131,7 @@ enum nzPixelFormat
|
||||
{
|
||||
nzPixelFormat_Undefined = -1,
|
||||
|
||||
nzPixelFormat_A8, // 1*uint8
|
||||
nzPixelFormat_BGR8, // 3*uint8
|
||||
nzPixelFormat_BGRA8, // 4*uint8
|
||||
nzPixelFormat_DXT1,
|
||||
@@ -217,16 +219,39 @@ enum nzPrimitiveMode
|
||||
nzPrimitiveMode_Max = nzPrimitiveMode_TriangleFan
|
||||
};
|
||||
|
||||
enum nzTextAlign
|
||||
{
|
||||
nzTextAlign_Left,
|
||||
nzTextAlign_Middle,
|
||||
nzTextAlign_Right,
|
||||
|
||||
nzTextAlign_Max = nzTextAlign_Right
|
||||
};
|
||||
|
||||
enum nzTextStyleFlags
|
||||
{
|
||||
nzTextStyle_Regular = 0x0,
|
||||
|
||||
nzTextStyle_Bold = 0x1,
|
||||
nzTextStyle_Italic = 0x2,
|
||||
nzTextStyle_StrikeThrough = 0x4,
|
||||
nzTextStyle_Underlined = 0x8,
|
||||
|
||||
nzTextStyle_Max = nzTextStyle_Underlined*2-1
|
||||
};
|
||||
|
||||
enum nzVertexComponent
|
||||
{
|
||||
nzVertexComponent_Unused = -1,
|
||||
|
||||
// Nous nous limitons à 16 composants de sommets car c'est le minimum supporté par le GPU
|
||||
nzVertexComponent_InstanceData0,
|
||||
nzVertexComponent_InstanceData1,
|
||||
nzVertexComponent_InstanceData2,
|
||||
nzVertexComponent_InstanceData3,
|
||||
nzVertexComponent_InstanceData4,
|
||||
nzVertexComponent_InstanceData5,
|
||||
nzVertexComponent_Color,
|
||||
nzVertexComponent_Normal,
|
||||
nzVertexComponent_Position,
|
||||
nzVertexComponent_Tangent,
|
||||
@@ -236,22 +261,24 @@ enum nzVertexComponent
|
||||
nzVertexComponent_Userdata2,
|
||||
nzVertexComponent_Userdata3,
|
||||
nzVertexComponent_Userdata4,
|
||||
nzVertexComponent_Userdata5,
|
||||
|
||||
nzVertexComponent_FirstInstanceData = nzVertexComponent_InstanceData0,
|
||||
nzVertexComponent_FirstVertexData = nzVertexComponent_Normal,
|
||||
nzVertexComponent_FirstVertexData = nzVertexComponent_Color,
|
||||
nzVertexComponent_LastInstanceData = nzVertexComponent_InstanceData5,
|
||||
nzVertexComponent_LastVertexData = nzVertexComponent_Userdata5,
|
||||
nzVertexComponent_LastVertexData = nzVertexComponent_Userdata4,
|
||||
|
||||
nzVertexComponent_Max = nzVertexComponent_Userdata5
|
||||
nzVertexComponent_Max = nzVertexComponent_Userdata4
|
||||
};
|
||||
|
||||
enum nzVertexLayout
|
||||
{
|
||||
// Déclarations destinées au rendu
|
||||
nzVertexLayout_XY,
|
||||
nzVertexLayout_XY_Color,
|
||||
nzVertexLayout_XY_UV,
|
||||
nzVertexLayout_XYZ,
|
||||
nzVertexLayout_XYZ_Color,
|
||||
nzVertexLayout_XYZ_Color_UV,
|
||||
nzVertexLayout_XYZ_Normal,
|
||||
nzVertexLayout_XYZ_Normal_UV,
|
||||
nzVertexLayout_XYZ_Normal_UV_Tangent,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#ifndef NAZARA_EVENT_HPP
|
||||
#define NAZARA_EVENT_HPP
|
||||
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
#include <Nazara/Utility/Keyboard.hpp>
|
||||
#include <Nazara/Utility/Mouse.hpp>
|
||||
|
||||
|
||||
147
include/Nazara/Utility/Font.hpp
Normal file
147
include/Nazara/Utility/Font.hpp
Normal file
@@ -0,0 +1,147 @@
|
||||
// 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
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_FONT_HPP
|
||||
#define NAZARA_FONT_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/NonCopyable.hpp>
|
||||
#include <Nazara/Core/ObjectListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ObjectRef.hpp>
|
||||
#include <Nazara/Core/Resource.hpp>
|
||||
#include <Nazara/Core/ResourceLoader.hpp>
|
||||
#include <Nazara/Utility/AbstractAtlas.hpp>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
struct NAZARA_API NzFontParams
|
||||
{
|
||||
bool IsValid() const;
|
||||
};
|
||||
|
||||
class NzFont;
|
||||
class NzFontData;
|
||||
|
||||
struct NzFontGlyph;
|
||||
|
||||
using NzFontConstListener = NzObjectListenerWrapper<const NzFont>;
|
||||
using NzFontConstRef = NzObjectRef<const NzFont>;
|
||||
using NzFontListener = NzObjectListenerWrapper<NzFont>;
|
||||
using NzFontLoader = NzResourceLoader<NzFont, NzFontParams>;
|
||||
using NzFontRef = NzObjectRef<NzFont>;
|
||||
|
||||
class NAZARA_API NzFont : public NzRefCounted, public NzResource, NzAbstractAtlas::Listener, NzNonCopyable
|
||||
{
|
||||
friend NzFontLoader;
|
||||
|
||||
public:
|
||||
struct Glyph;
|
||||
struct SizeInfo;
|
||||
|
||||
NzFont();
|
||||
~NzFont();
|
||||
|
||||
void ClearGlyphCache();
|
||||
void ClearKerningCache();
|
||||
void ClearSizeInfoCache();
|
||||
|
||||
bool Create(NzFontData* data);
|
||||
void Destroy();
|
||||
|
||||
bool ExtractGlyph(unsigned int characterSize, char32_t character, nzUInt32 style, NzFontGlyph* glyph) const;
|
||||
|
||||
const std::shared_ptr<NzAbstractAtlas>& GetAtlas() const;
|
||||
unsigned int GetCachedGlyphCount(unsigned int characterSize, nzUInt32 style) const;
|
||||
unsigned int GetCachedGlyphCount() const;
|
||||
NzString GetFamilyName() const;
|
||||
int GetKerning(unsigned int characterSize, char32_t first, char32_t second) const;
|
||||
const Glyph& GetGlyph(unsigned int characterSize, nzUInt32 style, char32_t character) const;
|
||||
unsigned int GetGlyphBorder() const;
|
||||
unsigned int GetMinimumStepSize() const;
|
||||
const SizeInfo& GetSizeInfo(unsigned int characterSize) const;
|
||||
NzString GetStyleName() const;
|
||||
|
||||
bool IsValid() const;
|
||||
|
||||
bool Precache(unsigned int characterSize, nzUInt32 style, char32_t character) const;
|
||||
bool Precache(unsigned int characterSize, nzUInt32 style, const NzString& characterSet) const;
|
||||
|
||||
// Open
|
||||
bool OpenFromFile(const NzString& filePath, const NzFontParams& params = NzFontParams());
|
||||
bool OpenFromMemory(const void* data, std::size_t size, const NzFontParams& params = NzFontParams());
|
||||
bool OpenFromStream(NzInputStream& stream, const NzFontParams& params = NzFontParams());
|
||||
|
||||
void SetAtlas(const std::shared_ptr<NzAbstractAtlas>& atlas);
|
||||
void SetGlyphBorder(unsigned int borderSize);
|
||||
void SetMinimumStepSize(unsigned int minimumStepSize);
|
||||
|
||||
static std::shared_ptr<NzAbstractAtlas> GetDefaultAtlas();
|
||||
static NzFont* GetDefault();
|
||||
static unsigned int GetDefaultGlyphBorder();
|
||||
static unsigned int GetDefaultMinimumStepSize();
|
||||
|
||||
static bool Initialize();
|
||||
|
||||
static void SetDefaultAtlas(const std::shared_ptr<NzAbstractAtlas>& atlas);
|
||||
static void SetDefaultGlyphBorder(unsigned int borderSize);
|
||||
static void SetDefaultMinimumStepSize(unsigned int minimumStepSize);
|
||||
|
||||
static void Uninitialize();
|
||||
|
||||
enum ModicationCode
|
||||
{
|
||||
ModificationCode_AtlasChanged,
|
||||
ModificationCode_AtlasLayerChanged,
|
||||
ModificationCode_GlyphCacheCleared,
|
||||
ModificationCode_KerningCacheCleared,
|
||||
ModificationCode_SizeInfoCacheCleared
|
||||
};
|
||||
|
||||
struct Glyph
|
||||
{
|
||||
NzRecti aabb;
|
||||
NzRectui atlasRect;
|
||||
bool requireFauxBold;
|
||||
bool requireFauxItalic;
|
||||
bool flipped;
|
||||
bool valid;
|
||||
int advance;
|
||||
unsigned int layerIndex;
|
||||
};
|
||||
|
||||
struct SizeInfo
|
||||
{
|
||||
int spaceAdvance;
|
||||
unsigned int lineHeight;
|
||||
float underlinePosition;
|
||||
float underlineThickness;
|
||||
};
|
||||
|
||||
private:
|
||||
using GlyphMap = std::unordered_map<char32_t, Glyph>;
|
||||
|
||||
nzUInt64 ComputeKey(unsigned int characterSize, nzUInt32 style) const;
|
||||
bool OnAtlasCleared(const NzAbstractAtlas* atlas, void* userdata) override;
|
||||
bool OnAtlasLayerChange(const NzAbstractAtlas* atlas, NzAbstractImage* oldLayer, NzAbstractImage* newLayer, void* userdata) override;
|
||||
void OnAtlasReleased(const NzAbstractAtlas* atlas, void* userdata) override;
|
||||
const Glyph& PrecacheGlyph(GlyphMap& glyphMap, unsigned int characterSize, nzUInt32 style, char32_t character) const;
|
||||
|
||||
std::shared_ptr<NzAbstractAtlas> m_atlas;
|
||||
std::unique_ptr<NzFontData> m_data;
|
||||
mutable std::unordered_map<nzUInt64, std::unordered_map<nzUInt64, int>> m_kerningCache;
|
||||
mutable std::unordered_map<nzUInt64, GlyphMap> m_glyphes;
|
||||
mutable std::unordered_map<nzUInt64, SizeInfo> m_sizeInfoCache;
|
||||
unsigned int m_glyphBorder;
|
||||
unsigned int m_minimumStepSize;
|
||||
|
||||
static std::shared_ptr<NzAbstractAtlas> s_defaultAtlas;
|
||||
static NzFont* s_defaultFont;
|
||||
static NzFontLoader::LoaderList s_loaders;
|
||||
static unsigned int s_defaultGlyphBorder;
|
||||
static unsigned int s_defaultMinimumStepSize;
|
||||
};
|
||||
|
||||
#endif // NAZARA_FONT_HPP
|
||||
38
include/Nazara/Utility/FontData.hpp
Normal file
38
include/Nazara/Utility/FontData.hpp
Normal file
@@ -0,0 +1,38 @@
|
||||
// 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
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_FONTDATA_HPP
|
||||
#define NAZARA_FONTDATA_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
|
||||
struct NzFontGlyph;
|
||||
|
||||
class NAZARA_API NzFontData
|
||||
{
|
||||
public:
|
||||
NzFontData() = default;
|
||||
virtual ~NzFontData();
|
||||
|
||||
virtual bool ExtractGlyph(unsigned int characterSize, char32_t character, nzUInt32 style, NzFontGlyph* dst) = 0;
|
||||
|
||||
virtual NzString GetFamilyName() const = 0;
|
||||
virtual NzString GetStyleName() const = 0;
|
||||
|
||||
virtual bool HasKerning() const = 0;
|
||||
|
||||
virtual bool IsScalable() const = 0;
|
||||
|
||||
virtual int QueryKerning(unsigned int characterSize, char32_t first, char32_t second) const = 0;
|
||||
virtual unsigned int QueryLineHeight(unsigned int characterSize) const = 0;
|
||||
virtual float QueryUnderlinePosition(unsigned int characterSize) const = 0;
|
||||
virtual float QueryUnderlineThickness(unsigned int characterSize) const = 0;
|
||||
|
||||
virtual bool SupportsStyle(nzUInt32 style) const = 0;
|
||||
};
|
||||
|
||||
#endif // NAZARA_FONTDATA_HPP
|
||||
19
include/Nazara/Utility/FontGlyph.hpp
Normal file
19
include/Nazara/Utility/FontGlyph.hpp
Normal file
@@ -0,0 +1,19 @@
|
||||
// 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
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_FONTGLYPH_HPP
|
||||
#define NAZARA_FONTGLYPH_HPP
|
||||
|
||||
#include <Nazara/Utility/Image.hpp>
|
||||
|
||||
struct NzFontGlyph
|
||||
{
|
||||
NzImage image;
|
||||
NzRecti aabb;
|
||||
int advance;
|
||||
};
|
||||
|
||||
#endif // NAZARA_FONTGLYPH_HPP
|
||||
67
include/Nazara/Utility/GuillotineImageAtlas.hpp
Normal file
67
include/Nazara/Utility/GuillotineImageAtlas.hpp
Normal file
@@ -0,0 +1,67 @@
|
||||
// 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
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_GUILLOTINEIMAGEATLAS_HPP
|
||||
#define NAZARA_GUILLOTINEIMAGEATLAS_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/GuillotineBinPack.hpp>
|
||||
#include <Nazara/Utility/AbstractAtlas.hpp>
|
||||
#include <Nazara/Utility/AbstractImage.hpp>
|
||||
#include <Nazara/Utility/Image.hpp>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
class NAZARA_API NzGuillotineImageAtlas : public NzAbstractAtlas
|
||||
{
|
||||
public:
|
||||
NzGuillotineImageAtlas();
|
||||
virtual ~NzGuillotineImageAtlas();
|
||||
|
||||
void Clear();
|
||||
void Free(NzSparsePtr<const NzRectui> rects, NzSparsePtr<unsigned int> layers, unsigned int count);
|
||||
|
||||
NzGuillotineBinPack::FreeRectChoiceHeuristic GetRectChoiceHeuristic() const;
|
||||
NzGuillotineBinPack::GuillotineSplitHeuristic GetRectSplitHeuristic() const;
|
||||
NzAbstractImage* GetLayer(unsigned int layerIndex) const;
|
||||
unsigned int GetLayerCount() const;
|
||||
nzUInt32 GetStorage() const;
|
||||
|
||||
bool Insert(const NzImage& image, NzRectui* rect, bool* flipped, unsigned int* layerIndex);
|
||||
|
||||
void SetRectChoiceHeuristic(NzGuillotineBinPack::FreeRectChoiceHeuristic heuristic);
|
||||
void SetRectSplitHeuristic(NzGuillotineBinPack::GuillotineSplitHeuristic heuristic);
|
||||
|
||||
protected:
|
||||
struct Layer;
|
||||
|
||||
virtual NzAbstractImage* ResizeImage(NzAbstractImage* oldImage, const NzVector2ui& size) const;
|
||||
bool ResizeLayer(Layer& layer, const NzVector2ui& size);
|
||||
|
||||
struct QueuedGlyph
|
||||
{
|
||||
NzImage image;
|
||||
NzRectui rect;
|
||||
bool flipped;
|
||||
};
|
||||
|
||||
struct Layer
|
||||
{
|
||||
std::vector<QueuedGlyph> queuedGlyphs;
|
||||
std::unique_ptr<NzAbstractImage> image;
|
||||
NzGuillotineBinPack binPack;
|
||||
unsigned int freedRectangles = 0;
|
||||
};
|
||||
|
||||
private:
|
||||
void ProcessGlyphQueue(Layer& layer) const;
|
||||
|
||||
mutable std::vector<Layer> m_layers;
|
||||
NzGuillotineBinPack::FreeRectChoiceHeuristic m_rectChoiceHeuristic;
|
||||
NzGuillotineBinPack::GuillotineSplitHeuristic m_rectSplitHeuristic;
|
||||
};
|
||||
|
||||
#endif // NAZARA_GUILLOTINEIMAGEATLAS_HPP
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -10,16 +10,13 @@
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/Color.hpp>
|
||||
#include <Nazara/Core/InputStream.hpp>
|
||||
#include <Nazara/Core/ObjectListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ObjectRef.hpp>
|
||||
#include <Nazara/Core/RefCounted.hpp>
|
||||
#include <Nazara/Core/Resource.hpp>
|
||||
#include <Nazara/Core/ResourceLoader.hpp>
|
||||
#include <Nazara/Math/Box.hpp>
|
||||
#include <Nazara/Math/Rect.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
#include <Nazara/Utility/AbstractImage.hpp>
|
||||
#include <Nazara/Utility/CubemapParams.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
#include <Nazara/Utility/PixelFormat.hpp>
|
||||
#include <atomic>
|
||||
|
||||
///TODO: Filtres
|
||||
@@ -37,11 +34,13 @@ struct NAZARA_API NzImageParams
|
||||
|
||||
class NzImage;
|
||||
|
||||
using NzImageConstListener = NzObjectListenerWrapper<const NzImage>;
|
||||
using NzImageConstRef = NzObjectRef<const NzImage>;
|
||||
using NzImageListener = NzObjectListenerWrapper<NzImage>;
|
||||
using NzImageLoader = NzResourceLoader<NzImage, NzImageParams>;
|
||||
using NzImageRef = NzObjectRef<NzImage>;
|
||||
|
||||
class NAZARA_API NzImage : public NzRefCounted, public NzResource
|
||||
class NAZARA_API NzImage : public NzAbstractImage, public NzRefCounted, public NzResource
|
||||
{
|
||||
friend NzImageLoader;
|
||||
|
||||
@@ -51,7 +50,6 @@ class NAZARA_API NzImage : public NzRefCounted, public NzResource
|
||||
NzImage();
|
||||
NzImage(nzImageType type, nzPixelFormat format, unsigned int width, unsigned int height, unsigned int depth = 1, nzUInt8 levelCount = 1);
|
||||
NzImage(const NzImage& image);
|
||||
NzImage(NzImage&& image) noexcept;
|
||||
NzImage(SharedImage* sharedImage);
|
||||
~NzImage();
|
||||
|
||||
@@ -69,22 +67,20 @@ class NAZARA_API NzImage : public NzRefCounted, public NzResource
|
||||
bool FlipHorizontally();
|
||||
bool FlipVertically();
|
||||
|
||||
nzUInt8 GetBytesPerPixel() const;
|
||||
const nzUInt8* GetConstPixels(unsigned int x = 0, unsigned int y = 0, unsigned int z = 0, nzUInt8 level = 0) const;
|
||||
unsigned int GetDepth(nzUInt8 level = 0) const;
|
||||
nzPixelFormat GetFormat() const;
|
||||
unsigned int GetHeight(nzUInt8 level = 0) const;
|
||||
nzUInt8 GetLevelCount() const;
|
||||
nzUInt8 GetMaxLevel() const;
|
||||
unsigned int GetMemoryUsage() const;
|
||||
unsigned int GetMemoryUsage(nzUInt8 level) const;
|
||||
NzColor GetPixelColor(unsigned int x, unsigned int y = 0, unsigned int z = 0) const;
|
||||
nzUInt8* GetPixels(unsigned int x = 0, unsigned int y = 0, unsigned int z = 0, nzUInt8 level = 0);
|
||||
unsigned int GetSize() const;
|
||||
unsigned int GetSize(nzUInt8 level) const;
|
||||
NzVector3ui GetSize(nzUInt8 level = 0) const;
|
||||
nzImageType GetType() const;
|
||||
unsigned int GetWidth(nzUInt8 level = 0) const;
|
||||
|
||||
bool IsCompressed() const;
|
||||
bool IsCubemap() const;
|
||||
bool IsValid() const;
|
||||
|
||||
// Load
|
||||
@@ -92,6 +88,12 @@ class NAZARA_API NzImage : public NzRefCounted, public NzResource
|
||||
bool LoadFromMemory(const void* data, std::size_t size, const NzImageParams& params = NzImageParams());
|
||||
bool LoadFromStream(NzInputStream& stream, const NzImageParams& params = NzImageParams());
|
||||
|
||||
// LoadArray
|
||||
bool LoadArrayFromFile(const NzString& filePath, const NzImageParams& imageParams = NzImageParams(), const NzVector2ui& atlasSize = NzVector2ui(2, 2));
|
||||
bool LoadArrayFromImage(const NzImage& image, const NzVector2ui& atlasSize = NzVector2ui(2, 2));
|
||||
bool LoadArrayFromMemory(const void* data, std::size_t size, const NzImageParams& imageParams = NzImageParams(), const NzVector2ui& atlasSize = NzVector2ui(2, 2));
|
||||
bool LoadArrayFromStream(NzInputStream& stream, const NzImageParams& imageParams = NzImageParams(), const NzVector2ui& atlasSize = NzVector2ui(2, 2));
|
||||
|
||||
// LoadCubemap
|
||||
bool LoadCubemapFromFile(const NzString& filePath, const NzImageParams& imageParams = NzImageParams(), const NzCubemapParams& cubemapParams = NzCubemapParams());
|
||||
bool LoadCubemapFromImage(const NzImage& image, const NzCubemapParams& params = NzCubemapParams());
|
||||
@@ -101,15 +103,15 @@ class NAZARA_API NzImage : public NzRefCounted, public NzResource
|
||||
void SetLevelCount(nzUInt8 levelCount);
|
||||
bool SetPixelColor(const NzColor& color, unsigned int x, unsigned int y = 0, unsigned int z = 0);
|
||||
|
||||
void Update(const nzUInt8* pixels, unsigned int srcWidth = 0, unsigned int srcHeight = 0, nzUInt8 level = 0);
|
||||
void Update(const nzUInt8* pixels, const NzBoxui& box, unsigned int srcWidth = 0, unsigned int srcHeight = 0, nzUInt8 level = 0);
|
||||
void Update(const nzUInt8* pixels, const NzRectui& rect, unsigned int z = 0, unsigned int srcWidth = 0, unsigned int srcHeight = 0, nzUInt8 level = 0);
|
||||
bool Update(const nzUInt8* pixels, unsigned int srcWidth = 0, unsigned int srcHeight = 0, nzUInt8 level = 0);
|
||||
bool Update(const nzUInt8* pixels, const NzBoxui& box, unsigned int srcWidth = 0, unsigned int srcHeight = 0, nzUInt8 level = 0);
|
||||
bool Update(const nzUInt8* pixels, const NzRectui& rect, unsigned int z = 0, unsigned int srcWidth = 0, unsigned int srcHeight = 0, nzUInt8 level = 0);
|
||||
|
||||
NzImage& operator=(const NzImage& image);
|
||||
NzImage& operator=(NzImage&& image) noexcept;
|
||||
|
||||
static void Copy(nzUInt8* destination, const nzUInt8* source, nzUInt8 bpp, unsigned int width, unsigned int height, unsigned int depth = 1, unsigned int dstWidth = 0, unsigned int dstHeight = 0, unsigned int srcWidth = 0, unsigned int srcHeight = 0);
|
||||
static nzUInt8 GetMaxLevel(unsigned int width, unsigned int height, unsigned int depth = 1);
|
||||
static nzUInt8 GetMaxLevel(nzImageType type, unsigned int width, unsigned int height, unsigned int depth = 1);
|
||||
|
||||
struct SharedImage
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -8,23 +8,25 @@
|
||||
#define NAZARA_INDEXBUFFER_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/ObjectListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ObjectRef.hpp>
|
||||
#include <Nazara/Core/Resource.hpp>
|
||||
#include <Nazara/Utility/Buffer.hpp>
|
||||
|
||||
class NzIndexBuffer;
|
||||
|
||||
using NzIndexBufferConstListener = NzObjectListenerWrapper<const NzIndexBuffer>;
|
||||
using NzIndexBufferConstRef = NzObjectRef<const NzIndexBuffer>;
|
||||
using NzIndexBufferListener = NzObjectListenerWrapper<NzIndexBuffer>;
|
||||
using NzIndexBufferRef = NzObjectRef<NzIndexBuffer>;
|
||||
|
||||
class NAZARA_API NzIndexBuffer : public NzRefCounted
|
||||
{
|
||||
public:
|
||||
NzIndexBuffer() = default;
|
||||
NzIndexBuffer(bool largeIndices, NzBuffer* buffer);
|
||||
NzIndexBuffer(bool largeIndices, NzBuffer* buffer, unsigned int startOffset, unsigned int endOffset);
|
||||
NzIndexBuffer(bool largeIndices, unsigned int length, nzBufferStorage storage = nzBufferStorage_Software, nzBufferUsage usage = nzBufferUsage_Static);
|
||||
NzIndexBuffer(bool largeIndices, unsigned int length, nzUInt32 storage = nzDataStorage_Software, nzBufferUsage usage = nzBufferUsage_Static);
|
||||
NzIndexBuffer(const NzIndexBuffer& indexBuffer);
|
||||
NzIndexBuffer(NzIndexBuffer&& indexBuffer) noexcept;
|
||||
~NzIndexBuffer();
|
||||
|
||||
unsigned int ComputeCacheMissCount() const;
|
||||
@@ -51,17 +53,16 @@ class NAZARA_API NzIndexBuffer : public NzRefCounted
|
||||
void Optimize();
|
||||
|
||||
void Reset();
|
||||
void Reset(bool largeIndices, NzBuffer* buffer);
|
||||
void Reset(bool largeIndices, NzBuffer* buffer, unsigned int startOffset, unsigned int endOffset);
|
||||
void Reset(bool largeIndices, unsigned int length, nzBufferStorage storage = nzBufferStorage_Software, nzBufferUsage usage = nzBufferUsage_Static);
|
||||
void Reset(bool largeIndices, unsigned int length, nzUInt32 storage = nzDataStorage_Software, nzBufferUsage usage = nzBufferUsage_Static);
|
||||
void Reset(const NzIndexBuffer& indexBuffer);
|
||||
void Reset(NzIndexBuffer&& indexBuffer) noexcept;
|
||||
|
||||
bool SetStorage(nzBufferStorage storage);
|
||||
bool SetStorage(nzUInt32 storage);
|
||||
|
||||
void Unmap() const;
|
||||
|
||||
NzIndexBuffer& operator=(const NzIndexBuffer& indexBuffer);
|
||||
NzIndexBuffer& operator=(NzIndexBuffer&& indexBuffer) noexcept;
|
||||
|
||||
private:
|
||||
NzBufferRef m_buffer;
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 - Core module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
24
include/Nazara/Utility/Joystick.hpp
Normal file
24
include/Nazara/Utility/Joystick.hpp
Normal file
@@ -0,0 +1,24 @@
|
||||
// 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
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_JOYSTICK_HPP
|
||||
#define NAZARA_JOYSTICK_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
|
||||
class NAZARA_API NzJoystick
|
||||
{
|
||||
public:
|
||||
NzJoystick() = delete;
|
||||
~NzJoystick() = delete;
|
||||
|
||||
static unsigned int GetMaxJoystickCount();
|
||||
|
||||
static void Update();
|
||||
};
|
||||
|
||||
#endif // NAZARA_JOYSTICK_HPP
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/InputStream.hpp>
|
||||
#include <Nazara/Core/ObjectListener.hpp>
|
||||
#include <Nazara/Core/ObjectListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ObjectRef.hpp>
|
||||
#include <Nazara/Core/Primitive.hpp>
|
||||
#include <Nazara/Core/RefCounted.hpp>
|
||||
@@ -25,18 +25,21 @@ struct NAZARA_API NzMeshParams
|
||||
{
|
||||
NzMeshParams(); // Vérifie que le storage par défaut est supporté (software autrement)
|
||||
|
||||
// Si ceci sera le stockage utilisé par les buffers
|
||||
nzBufferStorage storage = nzBufferStorage_Hardware;
|
||||
|
||||
// La mise à l'échelle éventuelle que subira le mesh
|
||||
NzVector3f scale = NzVector3f::Unit();
|
||||
|
||||
// Si ceci sera le stockage utilisé par les buffers
|
||||
nzUInt32 storage = nzDataStorage_Hardware;
|
||||
|
||||
// Charger une version animée du mesh si possible ?
|
||||
bool animated = true;
|
||||
|
||||
// Faut-il centrer le mesh autour de l'origine ?
|
||||
bool center = false;
|
||||
|
||||
// Faut-il retourner les UV ?
|
||||
bool flipUVs = false;
|
||||
|
||||
// Faut-il optimiser les index buffers ? (Rendu plus rapide, mais le chargement dure plus longtemps)
|
||||
bool optimizeIndexBuffers = true;
|
||||
|
||||
@@ -50,13 +53,15 @@ class NzPrimitiveList;
|
||||
typedef NzVertexStruct_XYZ_Normal_UV_Tangent NzMeshVertex;
|
||||
typedef NzVertexStruct_XYZ_Normal_UV_Tangent_Skinning NzSkeletalMeshVertex;
|
||||
|
||||
using NzMeshConstListener = NzObjectListenerWrapper<const NzMesh>;
|
||||
using NzMeshConstRef = NzObjectRef<const NzMesh>;
|
||||
using NzMeshListener = NzObjectListenerWrapper<NzMesh>;
|
||||
using NzMeshLoader = NzResourceLoader<NzMesh, NzMeshParams>;
|
||||
using NzMeshRef = NzObjectRef<NzMesh>;
|
||||
|
||||
struct NzMeshImpl;
|
||||
|
||||
class NAZARA_API NzMesh : public NzRefCounted, public NzResource, NzObjectListener
|
||||
class NAZARA_API NzMesh : public NzRefCounted, public NzResource
|
||||
{
|
||||
friend NzMeshLoader;
|
||||
|
||||
@@ -119,8 +124,6 @@ class NAZARA_API NzMesh : public NzRefCounted, public NzResource, NzObjectListen
|
||||
void Transform(const NzMatrix4f& matrix);
|
||||
|
||||
private:
|
||||
void OnObjectReleased(const NzRefCounted* object, int index) override;
|
||||
|
||||
NzMeshImpl* m_impl = nullptr;
|
||||
|
||||
static NzMeshLoader::LoaderList s_loaders;
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -24,39 +24,38 @@ class NAZARA_API NzNode
|
||||
void EnsureDerivedUpdate() const;
|
||||
void EnsureTransformMatrixUpdate() const;
|
||||
|
||||
NzVector3f GetBackward() const;
|
||||
virtual NzVector3f GetBackward() const;
|
||||
const std::vector<NzNode*>& GetChilds() const;
|
||||
NzVector3f GetDown() const;
|
||||
NzVector3f GetForward() const;
|
||||
virtual NzVector3f GetDown() const;
|
||||
virtual NzVector3f GetForward() const;
|
||||
bool GetInheritPosition() const;
|
||||
bool GetInheritRotation() const;
|
||||
bool GetInheritScale() const;
|
||||
NzVector3f GetInitialPosition() const;
|
||||
NzQuaternionf GetInitialRotation() const;
|
||||
NzVector3f GetInitialScale() const;
|
||||
NzVector3f GetLeft() const;
|
||||
const NzString& GetName() const;
|
||||
virtual NzVector3f GetLeft() const;
|
||||
virtual nzNodeType GetNodeType() const;
|
||||
const NzNode* GetParent() const;
|
||||
NzVector3f GetPosition(nzCoordSys coordSys = nzCoordSys_Global) const;
|
||||
NzVector3f GetRight() const;
|
||||
virtual NzVector3f GetRight() const;
|
||||
NzQuaternionf GetRotation(nzCoordSys coordSys = nzCoordSys_Global) const;
|
||||
NzVector3f GetScale(nzCoordSys coordSys = nzCoordSys_Global) const;
|
||||
const NzMatrix4f& GetTransformMatrix() const;
|
||||
NzVector3f GetUp() const;
|
||||
virtual NzVector3f GetUp() const;
|
||||
|
||||
bool HasChilds() const;
|
||||
|
||||
NzNode& Interpolate(const NzNode& nodeA, const NzNode& nodeB, float interpolation, nzCoordSys coordSys = nzCoordSys_Global);
|
||||
|
||||
NzNode& Move(const NzVector3f& movement, nzCoordSys coordSys = nzCoordSys_Local);
|
||||
NzNode& Move(float movementX, float movementY, float movementZ, nzCoordSys coordSys = nzCoordSys_Local);
|
||||
NzNode& Move(float movementX, float movementY, float movementZ = 0.f, nzCoordSys coordSys = nzCoordSys_Local);
|
||||
|
||||
NzNode& Rotate(const NzQuaternionf& rotation, nzCoordSys coordSys = nzCoordSys_Local);
|
||||
|
||||
NzNode& Scale(const NzVector3f& scale);
|
||||
NzNode& Scale(float scale);
|
||||
NzNode& Scale(float scaleX, float scaleY, float scaleZ);
|
||||
NzNode& Scale(float scaleX, float scaleY, float scaleZ = 1.f);
|
||||
|
||||
void SetInheritRotation(bool inheritRotation);
|
||||
void SetInheritScale(bool inheritScale);
|
||||
@@ -64,18 +63,17 @@ class NAZARA_API NzNode
|
||||
void SetInitialRotation(const NzQuaternionf& quat);
|
||||
void SetInitialScale(const NzVector3f& scale);
|
||||
void SetInitialScale(float scale);
|
||||
void SetInitialScale(float scaleX, float scaleY, float scaleZ);
|
||||
void SetInitialScale(float scaleX, float scaleY, float scaleZ = 1.f);
|
||||
void SetInitialPosition(const NzVector3f& translation);
|
||||
void SetInitialPosition(float translationX, float translationXY, float translationZ);
|
||||
void SetName(const NzString& name);
|
||||
void SetInitialPosition(float translationX, float translationXY, float translationZ = 0.f);
|
||||
void SetParent(const NzNode* node = nullptr, bool keepDerived = false);
|
||||
void SetParent(const NzNode& node, bool keepDerived = false);
|
||||
void SetPosition(const NzVector3f& translation, nzCoordSys coordSys = nzCoordSys_Local);
|
||||
void SetPosition(float translationX, float translationXY, float translationZ, nzCoordSys coordSys = nzCoordSys_Local);
|
||||
void SetPosition(float translationX, float translationY, float translationZ = 0.f, nzCoordSys coordSys = nzCoordSys_Local);
|
||||
void SetRotation(const NzQuaternionf& quat, nzCoordSys coordSys = nzCoordSys_Local);
|
||||
void SetScale(const NzVector3f& scale, nzCoordSys coordSys = nzCoordSys_Local);
|
||||
void SetScale(float scale, nzCoordSys coordSys = nzCoordSys_Local);
|
||||
void SetScale(float scaleX, float scaleY, float scaleZ, nzCoordSys coordSys = nzCoordSys_Local);
|
||||
void SetScale(float scaleX, float scaleY, float scaleZ = 1.f, nzCoordSys coordSys = nzCoordSys_Local);
|
||||
void SetTransformMatrix(const NzMatrix4f& matrix);
|
||||
|
||||
// Local -> global
|
||||
@@ -95,7 +93,7 @@ class NAZARA_API NzNode
|
||||
virtual void InvalidateNode();
|
||||
virtual void OnParenting(const NzNode* parent);
|
||||
void RemoveChild(NzNode* node) const;
|
||||
void UpdateDerived() const;
|
||||
virtual void UpdateDerived() const;
|
||||
virtual void UpdateTransformMatrix() const;
|
||||
|
||||
mutable std::vector<NzNode*> m_childs;
|
||||
@@ -103,7 +101,6 @@ class NAZARA_API NzNode
|
||||
mutable NzQuaternionf m_derivedRotation;
|
||||
NzQuaternionf m_initialRotation;
|
||||
NzQuaternionf m_rotation;
|
||||
NzString m_name;
|
||||
mutable NzVector3f m_derivedPosition;
|
||||
mutable NzVector3f m_derivedScale;
|
||||
NzVector3f m_initialPosition;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -13,6 +13,10 @@
|
||||
#include <functional>
|
||||
#include <map>
|
||||
|
||||
///TODO: Permettre la conversion automatique entre les formats via des renseignements de bits et de type pour chaque format.
|
||||
/// Ce serait plus lent que la conversion spécialisée (qui ne disparaîtra donc pas) mais ça permettrait au moteur de faire la conversion
|
||||
/// entre n'importe quels formats non-compressés.
|
||||
|
||||
class NzPixelFormat
|
||||
{
|
||||
friend class NzUtility;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -168,6 +168,9 @@ inline nzUInt8 NzPixelFormat::GetBitsPerPixel(nzPixelFormat format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case nzPixelFormat_A8:
|
||||
return 8;
|
||||
|
||||
case nzPixelFormat_BGR8:
|
||||
return 24;
|
||||
|
||||
@@ -287,20 +290,14 @@ inline nzUInt8 NzPixelFormat::GetBitsPerPixel(nzPixelFormat format)
|
||||
|
||||
inline nzUInt8 NzPixelFormat::GetBytesPerPixel(nzPixelFormat format)
|
||||
{
|
||||
nzUInt8 bytesPerPixel = GetBitsPerPixel(format)/8;
|
||||
|
||||
#if NAZARA_UTILITY_SAFE
|
||||
if (bytesPerPixel == 0)
|
||||
NazaraWarning("This format is either invalid or using less than one byte per pixel");
|
||||
#endif
|
||||
|
||||
return bytesPerPixel;
|
||||
return GetBitsPerPixel(format)/8;
|
||||
}
|
||||
|
||||
inline nzPixelFormatType NzPixelFormat::GetType(nzPixelFormat format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case nzPixelFormat_A8:
|
||||
case nzPixelFormat_BGR8:
|
||||
case nzPixelFormat_BGRA8:
|
||||
case nzPixelFormat_DXT1:
|
||||
@@ -372,6 +369,7 @@ inline bool NzPixelFormat::HasAlpha(nzPixelFormat format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case nzPixelFormat_A8:
|
||||
case nzPixelFormat_BGRA8:
|
||||
case nzPixelFormat_DXT3:
|
||||
case nzPixelFormat_DXT5:
|
||||
@@ -444,6 +442,7 @@ inline bool NzPixelFormat::IsCompressed(nzPixelFormat format)
|
||||
case nzPixelFormat_DXT5:
|
||||
return true;
|
||||
|
||||
case nzPixelFormat_A8:
|
||||
case nzPixelFormat_BGR8:
|
||||
case nzPixelFormat_BGRA8:
|
||||
case nzPixelFormat_L8:
|
||||
@@ -529,6 +528,9 @@ inline NzString NzPixelFormat::ToString(nzPixelFormat format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case nzPixelFormat_A8:
|
||||
return "A8";
|
||||
|
||||
case nzPixelFormat_BGR8:
|
||||
return "BGR8";
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
60
include/Nazara/Utility/SimpleTextDrawer.hpp
Normal file
60
include/Nazara/Utility/SimpleTextDrawer.hpp
Normal file
@@ -0,0 +1,60 @@
|
||||
// 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
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_SIMPLETEXTDRAWER_HPP
|
||||
#define NAZARA_SIMPLETEXTDRAWER_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/ObjectListener.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Utility/AbstractTextDrawer.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
#include <Nazara/Utility/Font.hpp>
|
||||
#include <vector>
|
||||
|
||||
class NAZARA_API NzSimpleTextDrawer : public NzAbstractTextDrawer, NzObjectListener
|
||||
{
|
||||
public:
|
||||
NzSimpleTextDrawer();
|
||||
virtual ~NzSimpleTextDrawer() = default;
|
||||
|
||||
const NzRectui& GetBounds() const;
|
||||
unsigned int GetCharacterSize() const;
|
||||
const NzColor& GetColor() const;
|
||||
NzFont* GetFont() const;
|
||||
nzUInt32 GetStyle() const;
|
||||
|
||||
void SetCharacterSize(unsigned int characterSize);
|
||||
void SetColor(const NzColor& color);
|
||||
void SetFont(NzFont* font);
|
||||
void SetStyle(nzUInt32 style);
|
||||
void SetText(const NzString& str);
|
||||
|
||||
static NzSimpleTextDrawer Draw(const NzString& str, unsigned int characterSize, nzUInt32 style = nzTextStyle_Regular, const NzColor& color = NzColor::White);
|
||||
static NzSimpleTextDrawer Draw(NzFont* font, const NzString& str, unsigned int characterSize, nzUInt32 style = nzTextStyle_Regular, const NzColor& color = NzColor::White);
|
||||
|
||||
private:
|
||||
NzFont* GetFont(unsigned int index) const override;
|
||||
unsigned int GetFontCount() const override;
|
||||
const Glyph& GetGlyph(unsigned int index) const override;
|
||||
unsigned int GetGlyphCount() const override;
|
||||
|
||||
bool OnObjectModified(const NzRefCounted* object, int index, unsigned int code) override;
|
||||
void OnObjectReleased(const NzRefCounted* object, int index) override;
|
||||
void UpdateGlyphs() const;
|
||||
|
||||
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;
|
||||
mutable bool m_glyphUpdated;
|
||||
unsigned int m_characterSize;
|
||||
};
|
||||
|
||||
#endif // NAZARA_SIMPLETEXTDRAWER_HPP
|
||||
@@ -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
|
||||
|
||||
@@ -8,12 +8,15 @@
|
||||
#define NAZARA_SKELETALMESH_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Utility/Mesh.hpp>
|
||||
#include <Nazara/Core/ObjectListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ObjectRef.hpp>
|
||||
#include <Nazara/Utility/SubMesh.hpp>
|
||||
|
||||
class NzSkeletalMesh;
|
||||
|
||||
using NzSkeletalMeshConstListener = NzObjectListenerWrapper<const NzSkeletalMesh>;
|
||||
using NzSkeletalMeshConstRef = NzObjectRef<const NzSkeletalMesh>;
|
||||
using NzSkeletalMeshListener = NzObjectListenerWrapper<NzSkeletalMesh>;
|
||||
using NzSkeletalMeshRef = NzObjectRef<NzSkeletalMesh>;
|
||||
|
||||
class NAZARA_API NzSkeletalMesh final : public NzSubMesh
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -8,11 +8,20 @@
|
||||
#define NAZARA_SKELETON_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/ObjectListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ObjectRef.hpp>
|
||||
#include <Nazara/Core/RefCounted.hpp>
|
||||
#include <Nazara/Math/Box.hpp>
|
||||
#include <Nazara/Utility/Joint.hpp>
|
||||
#include <vector>
|
||||
|
||||
class NzSkeleton;
|
||||
|
||||
using NzSkeletonConstListener = NzObjectListenerWrapper<const NzSkeleton>;
|
||||
using NzSkeletonConstRef = NzObjectRef<const NzSkeleton>;
|
||||
using NzSkeletonListener = NzObjectListenerWrapper<NzSkeleton>;
|
||||
using NzSkeletonRef = NzObjectRef<NzSkeleton>;
|
||||
|
||||
struct NzSkeletonImpl;
|
||||
|
||||
class NAZARA_API NzSkeleton : public NzRefCounted
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -8,11 +8,15 @@
|
||||
#define NAZARA_STATICMESH_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/ObjectListener.hpp>
|
||||
#include <Nazara/Core/ObjectListenerWrapper.hpp>
|
||||
#include <Nazara/Utility/SubMesh.hpp>
|
||||
|
||||
class NzStaticMesh;
|
||||
|
||||
using NzStaticMeshConstListener = NzObjectListenerWrapper<const NzStaticMesh>;
|
||||
using NzStaticMeshConstRef = NzObjectRef<const NzStaticMesh>;
|
||||
using NzStaticMeshListener = NzObjectListenerWrapper<NzStaticMesh>;
|
||||
using NzStaticMeshRef = NzObjectRef<NzStaticMesh>;
|
||||
|
||||
class NAZARA_API NzStaticMesh final : public NzSubMesh
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#define NAZARA_SUBMESH_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/ObjectListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ObjectRef.hpp>
|
||||
#include <Nazara/Core/RefCounted.hpp>
|
||||
#include <Nazara/Math/Box.hpp>
|
||||
@@ -19,7 +20,9 @@
|
||||
class NzMesh;
|
||||
class NzSubMesh;
|
||||
|
||||
using NzSubMeshConstListener = NzObjectListenerWrapper<const NzSubMesh>;
|
||||
using NzSubMeshConstRef = NzObjectRef<const NzSubMesh>;
|
||||
using NzSubMeshListener = NzObjectListenerWrapper<NzSubMesh>;
|
||||
using NzSubMeshRef = NzObjectRef<NzSubMesh>;
|
||||
|
||||
class NAZARA_API NzSubMesh : public NzRefCounted
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#define NAZARA_VERTEXBUFFER_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/ObjectListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ObjectRef.hpp>
|
||||
#include <Nazara/Core/RefCounted.hpp>
|
||||
#include <Nazara/Utility/Buffer.hpp>
|
||||
@@ -15,17 +16,19 @@
|
||||
|
||||
class NzVertexBuffer;
|
||||
|
||||
using NzVertexBufferConstListener = NzObjectListenerWrapper<const NzVertexBuffer>;
|
||||
using NzVertexBufferConstRef = NzObjectRef<NzVertexBuffer>;
|
||||
using NzVertexBufferListener = NzObjectListenerWrapper<NzVertexBuffer>;
|
||||
using NzVertexBufferRef = NzObjectRef<NzVertexBuffer>;
|
||||
|
||||
class NAZARA_API NzVertexBuffer : public NzRefCounted
|
||||
{
|
||||
public:
|
||||
NzVertexBuffer() = default;
|
||||
NzVertexBuffer(const NzVertexDeclaration* vertexDeclaration, NzBuffer* buffer);
|
||||
NzVertexBuffer(const NzVertexDeclaration* vertexDeclaration, NzBuffer* buffer, unsigned int startOffset, unsigned int endOffset);
|
||||
NzVertexBuffer(const NzVertexDeclaration* vertexDeclaration, unsigned int length, nzBufferStorage storage = nzBufferStorage_Software, nzBufferUsage usage = nzBufferUsage_Static);
|
||||
NzVertexBuffer(const NzVertexDeclaration* vertexDeclaration, unsigned int length, nzUInt32 storage = nzDataStorage_Software, nzBufferUsage usage = nzBufferUsage_Static);
|
||||
NzVertexBuffer(const NzVertexBuffer& vertexBuffer);
|
||||
NzVertexBuffer(NzVertexBuffer&& vertexBuffer) noexcept;
|
||||
~NzVertexBuffer();
|
||||
|
||||
bool Fill(const void* data, unsigned int startVertex, unsigned int length, bool forceDiscard = false);
|
||||
@@ -47,18 +50,17 @@ class NAZARA_API NzVertexBuffer : public NzRefCounted
|
||||
void* MapRaw(nzBufferAccess access, unsigned int offset = 0, unsigned int size = 0) const;
|
||||
|
||||
void Reset();
|
||||
void Reset(const NzVertexDeclaration* vertexDeclaration, NzBuffer* buffer);
|
||||
void Reset(const NzVertexDeclaration* vertexDeclaration, NzBuffer* buffer, unsigned int startOffset, unsigned int endOffset);
|
||||
void Reset(const NzVertexDeclaration* vertexDeclaration, unsigned int length, nzBufferStorage storage = nzBufferStorage_Software, nzBufferUsage usage = nzBufferUsage_Static);
|
||||
void Reset(const NzVertexDeclaration* vertexDeclaration, unsigned int length, nzUInt32 storage = nzDataStorage_Software, nzBufferUsage usage = nzBufferUsage_Static);
|
||||
void Reset(const NzVertexBuffer& vertexBuffer);
|
||||
void Reset(NzVertexBuffer&& vertexBuffer) noexcept;
|
||||
|
||||
bool SetStorage(nzBufferStorage storage);
|
||||
bool SetStorage(nzUInt32 storage);
|
||||
void SetVertexDeclaration(const NzVertexDeclaration* vertexDeclaration);
|
||||
|
||||
void Unmap() const;
|
||||
|
||||
NzVertexBuffer& operator=(const NzVertexBuffer& vertexBuffer);
|
||||
NzVertexBuffer& operator=(NzVertexBuffer&& vertexBuffer) noexcept;
|
||||
|
||||
private:
|
||||
NzBufferRef m_buffer;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -8,13 +8,16 @@
|
||||
#define NAZARA_VERTEXDECLARATION_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/ObjectListenerWrapper.hpp>
|
||||
#include <Nazara/Core/ObjectRef.hpp>
|
||||
#include <Nazara/Core/RefCounted.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
|
||||
class NzVertexDeclaration;
|
||||
|
||||
using NzVertexDeclarationConstListener = NzObjectListenerWrapper<const NzVertexDeclaration>;
|
||||
using NzVertexDeclarationConstRef = NzObjectRef<const NzVertexDeclaration>;
|
||||
using NzVertexDeclarationListener = NzObjectListenerWrapper<NzVertexDeclaration>;
|
||||
using NzVertexDeclarationRef = NzObjectRef<NzVertexDeclaration>;
|
||||
|
||||
class NAZARA_API NzVertexDeclaration : public NzRefCounted
|
||||
@@ -45,9 +48,9 @@ class NAZARA_API NzVertexDeclaration : public NzRefCounted
|
||||
|
||||
struct Component
|
||||
{
|
||||
nzComponentType type;
|
||||
bool enabled = false;
|
||||
unsigned int offset;
|
||||
nzComponentType type; // Le type de donnée
|
||||
bool enabled = false; // Ce composant est-il activé ?/
|
||||
unsigned int offset; // La position, en octets, de la première donnée
|
||||
|
||||
/*
|
||||
** -Lynix:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -9,18 +9,16 @@
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/SparsePtr.hpp>
|
||||
#include <Nazara/Math/Vector2.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
#include <Nazara/Utility/BufferMapper.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
#include <Nazara/Utility/Mesh.hpp>
|
||||
#include <Nazara/Utility/VertexDeclaration.hpp>
|
||||
#include <Nazara/Utility/VertexBuffer.hpp>
|
||||
|
||||
class NzSubMesh;
|
||||
|
||||
class NAZARA_API NzVertexMapper
|
||||
{
|
||||
public:
|
||||
NzVertexMapper(NzVertexBuffer* vertexBuffer, unsigned int vertexCount);
|
||||
NzVertexMapper(NzSubMesh* subMesh);
|
||||
~NzVertexMapper();
|
||||
|
||||
@@ -31,7 +29,6 @@ class NAZARA_API NzVertexMapper
|
||||
|
||||
private:
|
||||
NzBufferMapper<NzVertexBuffer> m_mapper;
|
||||
NzVertexDeclarationConstRef m_declaration;
|
||||
unsigned int m_vertexCount;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,21 +1,26 @@
|
||||
// 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
|
||||
|
||||
#include <Nazara/Utility/Debug.hpp>
|
||||
#include <Nazara/Utility/VertexDeclaration.hpp>
|
||||
|
||||
template <typename T>
|
||||
NzSparsePtr<T> NzVertexMapper::GetComponentPtr(nzVertexComponent component)
|
||||
{
|
||||
// On récupère la déclaration depuis le buffer
|
||||
const NzVertexDeclaration* declaration = m_mapper.GetBuffer()->GetVertexDeclaration();
|
||||
|
||||
// Ensuite le composant qui nous intéresse
|
||||
bool enabled;
|
||||
nzComponentType type;
|
||||
unsigned int offset;
|
||||
m_declaration->GetComponent(component, &enabled, &type, &offset);
|
||||
declaration->GetComponent(component, &enabled, &type, &offset);
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
///TODO: Vérifier le rapport entre le type de l'attribut et le type template ?
|
||||
return NzSparsePtr<T>(static_cast<nzUInt8*>(m_mapper.GetPointer()) + offset, m_declaration->GetStride());
|
||||
return NzSparsePtr<T>(static_cast<nzUInt8*>(m_mapper.GetPointer()) + offset, declaration->GetStride());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#ifndef NAZARA_VERTEXSTRUCT_HPP
|
||||
#define NAZARA_VERTEXSTRUCT_HPP
|
||||
|
||||
#include <Nazara/Core/Color.hpp>
|
||||
#include <Nazara/Math/Vector2.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
|
||||
@@ -17,7 +18,12 @@ struct NzVertexStruct_XY
|
||||
NzVector2f position;
|
||||
};
|
||||
|
||||
struct NzVertexStruct_XY_UV : public NzVertexStruct_XY
|
||||
struct NzVertexStruct_XY_Color : NzVertexStruct_XY
|
||||
{
|
||||
NzColor color;
|
||||
};
|
||||
|
||||
struct NzVertexStruct_XY_UV : NzVertexStruct_XY
|
||||
{
|
||||
NzVector2f uv;
|
||||
};
|
||||
@@ -29,29 +35,39 @@ struct NzVertexStruct_XYZ
|
||||
NzVector3f position;
|
||||
};
|
||||
|
||||
struct NzVertexStruct_XYZ_Normal : public NzVertexStruct_XYZ
|
||||
struct NzVertexStruct_XYZ_Color : NzVertexStruct_XYZ
|
||||
{
|
||||
NzVector3f normal;
|
||||
NzColor color;
|
||||
};
|
||||
|
||||
struct NzVertexStruct_XYZ_Normal_UV : public NzVertexStruct_XYZ_Normal
|
||||
struct NzVertexStruct_XYZ_Color_UV : NzVertexStruct_XYZ_Color
|
||||
{
|
||||
NzVector2f uv;
|
||||
};
|
||||
|
||||
struct NzVertexStruct_XYZ_Normal_UV_Tangent : public NzVertexStruct_XYZ_Normal_UV
|
||||
struct NzVertexStruct_XYZ_Normal : NzVertexStruct_XYZ
|
||||
{
|
||||
NzVector3f normal;
|
||||
};
|
||||
|
||||
struct NzVertexStruct_XYZ_Normal_UV : NzVertexStruct_XYZ_Normal
|
||||
{
|
||||
NzVector2f uv;
|
||||
};
|
||||
|
||||
struct NzVertexStruct_XYZ_Normal_UV_Tangent : NzVertexStruct_XYZ_Normal_UV
|
||||
{
|
||||
NzVector3f tangent;
|
||||
};
|
||||
|
||||
struct NzVertexStruct_XYZ_UV : public NzVertexStruct_XYZ
|
||||
struct NzVertexStruct_XYZ_UV : NzVertexStruct_XYZ
|
||||
{
|
||||
NzVector2f uv;
|
||||
};
|
||||
|
||||
/************************* Structures 3D (+ Skinning) ************************/
|
||||
|
||||
struct NzVertexStruct_XYZ_Normal_UV_Tangent_Skinning : public NzVertexStruct_XYZ_Normal_UV_Tangent
|
||||
struct NzVertexStruct_XYZ_Normal_UV_Tangent_Skinning : NzVertexStruct_XYZ_Normal_UV_Tangent
|
||||
{
|
||||
nzInt32 weightCount;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user