Merge branch 'enet_wip_nothing_to_see_here' of https://github.com/DigitalPulseSoftware/NazaraEngine into enet_wip_nothing_to_see_here
This commit is contained in:
@@ -51,7 +51,7 @@ namespace Nz
|
||||
virtual void AddMesh(int renderOrder, const Material* material, const MeshData& meshData, const Boxf& meshAABB, const Matrix4f& transformMatrix) = 0;
|
||||
virtual void AddPointLight(const PointLight& light);
|
||||
virtual void AddSpotLight(const SpotLight& light);
|
||||
virtual void AddSprites(int renderOrder, const Material* material, const VertexStruct_XYZ_Color_UV* vertices, unsigned int spriteCount, const Texture* overlay = nullptr) = 0;
|
||||
virtual void AddSprites(int renderOrder, const Material* material, const VertexStruct_XYZ_Color_UV* vertices, std::size_t spriteCount, const Texture* overlay = nullptr) = 0;
|
||||
|
||||
virtual void Clear(bool fully = false);
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace Nz
|
||||
virtual Vector3f GetForward() const = 0;
|
||||
virtual const Frustumf& GetFrustum() const = 0;
|
||||
virtual const Matrix4f& GetProjectionMatrix() const = 0;
|
||||
virtual Nz::ProjectionType GetProjectionType() const = 0;
|
||||
virtual const RenderTarget* GetTarget() const = 0;
|
||||
virtual const Matrix4f& GetViewMatrix() const = 0;
|
||||
virtual const Recti& GetViewport() const = 0;
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Nz
|
||||
void AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr<const Vector3f> positionPtr, SparsePtr<const float> sizePtr, SparsePtr<const float> anglePtr, SparsePtr<const float> alphaPtr) override;
|
||||
void AddDrawable(int renderOrder, const Drawable* drawable) override;
|
||||
void AddMesh(int renderOrder, const Material* material, const MeshData& meshData, const Boxf& meshAABB, const Matrix4f& transformMatrix) override;
|
||||
void AddSprites(int renderOrder, const Material* material, const VertexStruct_XYZ_Color_UV* vertices, unsigned int spriteCount, const Texture* overlay = nullptr) override;
|
||||
void AddSprites(int renderOrder, const Material* material, const VertexStruct_XYZ_Color_UV* vertices, std::size_t spriteCount, const Texture* overlay = nullptr) override;
|
||||
|
||||
void Clear(bool fully = false) override;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Nz
|
||||
void AddMesh(int renderOrder, const Material* material, const MeshData& meshData, const Boxf& meshAABB, const Matrix4f& transformMatrix) override;
|
||||
void AddPointLight(const PointLight& light) override;
|
||||
void AddSpotLight(const SpotLight& light) override;
|
||||
void AddSprites(int renderOrder, const Material* material, const VertexStruct_XYZ_Color_UV* vertices, unsigned int spriteCount, const Texture* overlay = nullptr) override;
|
||||
void AddSprites(int renderOrder, const Material* material, const VertexStruct_XYZ_Color_UV* vertices, std::size_t spriteCount, const Texture* overlay = nullptr) override;
|
||||
|
||||
private:
|
||||
inline bool IsMaterialSuitable(const Material* material) const;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <Nazara/Graphics/Material.hpp>
|
||||
#include <Nazara/Math/Box.hpp>
|
||||
#include <Nazara/Math/Matrix4.hpp>
|
||||
#include <Nazara/Math/Plane.hpp>
|
||||
#include <Nazara/Utility/IndexBuffer.hpp>
|
||||
#include <Nazara/Utility/MeshData.hpp>
|
||||
#include <Nazara/Utility/VertexBuffer.hpp>
|
||||
@@ -41,7 +42,7 @@ namespace Nz
|
||||
void AddBillboards(int renderOrder, const Material* material, unsigned int count, SparsePtr<const Vector3f> positionPtr, SparsePtr<const float> sizePtr, SparsePtr<const float> anglePtr, SparsePtr<const float> alphaPtr) override;
|
||||
void AddDrawable(int renderOrder, const Drawable* drawable) override;
|
||||
void AddMesh(int renderOrder, const Material* material, const MeshData& meshData, const Boxf& meshAABB, const Matrix4f& transformMatrix) override;
|
||||
void AddSprites(int renderOrder, const Material* material, const VertexStruct_XYZ_Color_UV* vertices, unsigned int spriteCount, const Texture* overlay = nullptr) override;
|
||||
void AddSprites(int renderOrder, const Material* material, const VertexStruct_XYZ_Color_UV* vertices, std::size_t spriteCount, const Texture* overlay = nullptr) override;
|
||||
|
||||
void Clear(bool fully = false) override;
|
||||
|
||||
@@ -73,7 +74,7 @@ namespace Nz
|
||||
std::vector<BillboardData> billboards;
|
||||
};
|
||||
|
||||
typedef std::map<const Material*, BatchedBillboardEntry, MaterialComparator> BatchedBillboardContainer;
|
||||
using BatchedBillboardContainer = std::map<const Material*, BatchedBillboardEntry, MaterialComparator>;
|
||||
|
||||
struct BatchedBillboardPipelineEntry
|
||||
{
|
||||
@@ -81,7 +82,7 @@ namespace Nz
|
||||
bool enabled = false;
|
||||
};
|
||||
|
||||
typedef std::map<const MaterialPipeline*, BatchedBillboardPipelineEntry, MaterialPipelineComparator> BillboardPipelineBatches;
|
||||
using BillboardPipelineBatches = std::map<const MaterialPipeline*, BatchedBillboardPipelineEntry, MaterialPipelineComparator>;
|
||||
|
||||
/// Sprites
|
||||
struct SpriteChain_XYZ_Color_UV
|
||||
@@ -97,7 +98,7 @@ namespace Nz
|
||||
std::vector<SpriteChain_XYZ_Color_UV> spriteChains;
|
||||
};
|
||||
|
||||
typedef std::map<const Texture*, BatchedSpriteEntry> SpriteOverlayBatches;
|
||||
using SpriteOverlayBatches = std::map<const Texture*, BatchedSpriteEntry>;
|
||||
|
||||
struct BatchedBasicSpriteEntry
|
||||
{
|
||||
@@ -107,7 +108,7 @@ namespace Nz
|
||||
bool enabled = false;
|
||||
};
|
||||
|
||||
typedef std::map<const Material*, BatchedBasicSpriteEntry, MaterialComparator> SpriteMaterialBatches;
|
||||
using SpriteMaterialBatches = std::map<const Material*, BatchedBasicSpriteEntry, MaterialComparator>;
|
||||
|
||||
struct BatchedSpritePipelineEntry
|
||||
{
|
||||
@@ -115,7 +116,7 @@ namespace Nz
|
||||
bool enabled = false;
|
||||
};
|
||||
|
||||
typedef std::map<const MaterialPipeline*, BatchedSpritePipelineEntry, MaterialPipelineComparator> SpritePipelineBatches;
|
||||
using SpritePipelineBatches = std::map<const MaterialPipeline*, BatchedSpritePipelineEntry, MaterialPipelineComparator>;
|
||||
|
||||
/// Meshes
|
||||
struct MeshDataComparator
|
||||
@@ -132,7 +133,7 @@ namespace Nz
|
||||
Spheref squaredBoundingSphere;
|
||||
};
|
||||
|
||||
typedef std::map<MeshData, MeshInstanceEntry, MeshDataComparator> MeshInstanceContainer;
|
||||
using MeshInstanceContainer = std::map<MeshData, MeshInstanceEntry, MeshDataComparator>;
|
||||
|
||||
struct BatchedModelEntry
|
||||
{
|
||||
@@ -142,7 +143,7 @@ namespace Nz
|
||||
bool enabled = false;
|
||||
};
|
||||
|
||||
typedef std::map<const Material*, BatchedModelEntry, MaterialComparator> MeshMaterialBatches;
|
||||
using MeshMaterialBatches = std::map<const Material*, BatchedModelEntry, MaterialComparator>;
|
||||
|
||||
struct BatchedMaterialEntry
|
||||
{
|
||||
@@ -150,25 +151,33 @@ namespace Nz
|
||||
MeshMaterialBatches materialMap;
|
||||
};
|
||||
|
||||
typedef std::map<const MaterialPipeline*, BatchedMaterialEntry, MaterialPipelineComparator> MeshPipelineBatches;
|
||||
using MeshPipelineBatches = std::map<const MaterialPipeline*, BatchedMaterialEntry, MaterialPipelineComparator>;
|
||||
|
||||
struct TransparentModelData
|
||||
struct UnbatchedModelData
|
||||
{
|
||||
Matrix4f transformMatrix;
|
||||
MeshData meshData;
|
||||
Spheref squaredBoundingSphere;
|
||||
Spheref obbSphere;
|
||||
const Material* material;
|
||||
};
|
||||
|
||||
typedef std::vector<std::size_t> TransparentModelContainer;
|
||||
struct UnbatchedSpriteData
|
||||
{
|
||||
std::size_t spriteCount;
|
||||
const Material* material;
|
||||
const Texture* overlay;
|
||||
const VertexStruct_XYZ_Color_UV* vertices;
|
||||
};
|
||||
|
||||
struct Layer
|
||||
{
|
||||
BillboardPipelineBatches billboards;
|
||||
SpritePipelineBatches basicSprites;
|
||||
SpritePipelineBatches opaqueSprites;
|
||||
MeshPipelineBatches opaqueModels;
|
||||
TransparentModelContainer transparentModels;
|
||||
std::vector<TransparentModelData> transparentModelData;
|
||||
std::vector<std::size_t> depthSortedMeshes;
|
||||
std::vector<std::size_t> depthSortedSprites;
|
||||
std::vector<UnbatchedModelData> depthSortedMeshData;
|
||||
std::vector<UnbatchedSpriteData> depthSortedSpriteData;
|
||||
std::vector<const Drawable*> otherDrawables;
|
||||
unsigned int clearCount = 0;
|
||||
};
|
||||
@@ -179,6 +188,10 @@ namespace Nz
|
||||
BillboardData* GetBillboardData(int renderOrder, const Material* material, unsigned int count);
|
||||
Layer& GetLayer(int i); ///TODO: Inline
|
||||
|
||||
void SortBillboards(Layer& layer, const Planef& nearPlane);
|
||||
void SortForOrthographic(const AbstractViewer* viewer);
|
||||
void SortForPerspective(const AbstractViewer* viewer);
|
||||
|
||||
void OnIndexBufferInvalidation(const IndexBuffer* indexBuffer);
|
||||
void OnMaterialInvalidation(const Material* material);
|
||||
void OnTextureInvalidation(const Texture* texture);
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace Nz
|
||||
void DrawBasicSprites(const SceneData& sceneData, ForwardRenderQueue::Layer& layer) const;
|
||||
void DrawBillboards(const SceneData& sceneData, ForwardRenderQueue::Layer& layer) const;
|
||||
void DrawOpaqueModels(const SceneData& sceneData, ForwardRenderQueue::Layer& layer) const;
|
||||
void DrawOrderedSprites(const SceneData& sceneData, ForwardRenderQueue::Layer& layer) const;
|
||||
void DrawTransparentModels(const SceneData& sceneData, ForwardRenderQueue::Layer& layer) const;
|
||||
const ShaderUniforms* GetShaderUniforms(const Shader* shader) const;
|
||||
void OnShaderInvalidated(const Shader* shader) const;
|
||||
|
||||
@@ -98,7 +98,13 @@ namespace Nz
|
||||
return 0;
|
||||
}
|
||||
|
||||
template<typename T> /*constexpr*/ std::enable_if_t<!std::is_signed<T>::value || !std::is_integral<T>::value, bool> NumberEquals(T a, T b, T maxDifference)
|
||||
template<typename T> /*constexpr*/ std::enable_if_t<std::is_floating_point<T>::value, bool> NumberEquals(T a, T b, T maxDifference)
|
||||
{
|
||||
T diff = std::abs(a - b);
|
||||
return diff <= maxDifference;
|
||||
}
|
||||
|
||||
template<typename T> /*constexpr*/ std::enable_if_t<!std::is_signed<T>::value || (!std::is_integral<T>::value && !std::is_floating_point<T>::value), bool> NumberEquals(T a, T b, T maxDifference)
|
||||
{
|
||||
if (b > a)
|
||||
std::swap(a, b);
|
||||
@@ -112,13 +118,8 @@ namespace Nz
|
||||
if (b > a)
|
||||
std::swap(a, b);
|
||||
|
||||
if ((b < 0) && (a > std::numeric_limits<T>::max() + b))
|
||||
return false;
|
||||
|
||||
if ((b > 0) && (a < std::numeric_limits<T>::min() + b))
|
||||
return false;
|
||||
|
||||
return std::abs(a - b) <= maxDifference;
|
||||
using UnsignedT = std::make_unsigned_t<T>;
|
||||
return static_cast<UnsignedT>(a) - static_cast<UnsignedT>(b) <= static_cast<UnsignedT>(maxDifference);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -487,7 +488,7 @@ namespace Nz
|
||||
template<typename T, typename T2>
|
||||
constexpr T Lerp(const T& from, const T& to, const T2& interpolation)
|
||||
{
|
||||
return from + interpolation * (to - from);
|
||||
return static_cast<T>(from + interpolation * (to - from));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -74,8 +74,8 @@ namespace Nz
|
||||
Box& Transform(const Matrix4<T>& matrix, bool applyTranslation = true);
|
||||
Box& Translate(const Vector3<T>& translation);
|
||||
|
||||
T& operator[](unsigned int i);
|
||||
T operator[](unsigned int i) const;
|
||||
T& operator[](std::size_t i);
|
||||
T operator[](std::size_t i) const;
|
||||
|
||||
Box operator*(T scalar) const;
|
||||
Box operator*(const Vector3<T>& vec) const;
|
||||
|
||||
@@ -735,24 +735,15 @@ namespace Nz
|
||||
* \brief Returns the ith element of the box
|
||||
* \return A reference to the ith element of the box
|
||||
*
|
||||
* \remark Access to index greather than 6 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to acces to index greather than 6 with NAZARA_MATH_SAFE defined
|
||||
* \remark Access to index greater than 6 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to access to index greater than 6 with NAZARA_MATH_SAFE defined
|
||||
* \throw std::domain_error if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 6
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
T& Box<T>::operator[](unsigned int i)
|
||||
T& Box<T>::operator[](std::size_t i)
|
||||
{
|
||||
#if NAZARA_MATH_SAFE
|
||||
if (i >= 6)
|
||||
{
|
||||
StringStream ss;
|
||||
ss << "Index out of range: (" << i << " >= 6)";
|
||||
|
||||
NazaraError(ss);
|
||||
throw std::domain_error(ss.ToString());
|
||||
}
|
||||
#endif
|
||||
NazaraAssert(i < 6, "Index out of range");
|
||||
|
||||
return *(&x+i);
|
||||
}
|
||||
@@ -761,24 +752,15 @@ namespace Nz
|
||||
* \brief Returns the ith element of the box
|
||||
* \return A value to the ith element of the box
|
||||
*
|
||||
* \remark Access to index greather than 6 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to acces to index greather than 6 with NAZARA_MATH_SAFE defined
|
||||
* \remark Access to index greater than 6 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to access to index greater than 6 with NAZARA_MATH_SAFE defined
|
||||
* \throw std::domain_error if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 6
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
T Box<T>::operator[](unsigned int i) const
|
||||
T Box<T>::operator[](std::size_t i) const
|
||||
{
|
||||
#if NAZARA_MATH_SAFE
|
||||
if (i >= 6)
|
||||
{
|
||||
StringStream ss;
|
||||
ss << "Index out of range: (" << i << " >= 6)";
|
||||
|
||||
NazaraError(ss);
|
||||
throw std::domain_error(ss.ToString());
|
||||
}
|
||||
#endif
|
||||
NazaraAssert(i < 6, "Index out of range");
|
||||
|
||||
return *(&x+i);
|
||||
}
|
||||
|
||||
@@ -64,8 +64,8 @@ namespace Nz
|
||||
|
||||
Rect& Translate(const Vector2<T>& translation);
|
||||
|
||||
T& operator[](unsigned int i);
|
||||
T operator[](unsigned int i) const;
|
||||
T& operator[](std::size_t i);
|
||||
T operator[](std::size_t i) const;
|
||||
|
||||
Rect operator*(T scalar) const;
|
||||
Rect operator*(const Vector2<T>& vec) const;
|
||||
|
||||
@@ -578,23 +578,14 @@ namespace Nz
|
||||
* \return A reference to the ith element of the rectangle
|
||||
*
|
||||
* \remark Access to index greather than 4 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to acces to index greather than 4 with NAZARA_MATH_SAFE defined
|
||||
* \remark Produce a NazaraError if you try to access to index greater than 4 with NAZARA_MATH_SAFE defined
|
||||
* \throw std::domain_error if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 4
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
T& Rect<T>::operator[](unsigned int i)
|
||||
T& Rect<T>::operator[](std::size_t i)
|
||||
{
|
||||
#if NAZARA_MATH_SAFE
|
||||
if (i >= 4)
|
||||
{
|
||||
StringStream ss;
|
||||
ss << "Index out of range: (" << i << " >= 4)";
|
||||
|
||||
NazaraError(ss);
|
||||
throw std::domain_error(ss.ToString());
|
||||
}
|
||||
#endif
|
||||
NazaraAssert(i < 4, "Index out of range");
|
||||
|
||||
return *(&x+i);
|
||||
}
|
||||
@@ -603,24 +594,15 @@ namespace Nz
|
||||
* \brief Returns the ith element of the rectangle
|
||||
* \return A value to the ith element of the rectangle
|
||||
*
|
||||
* \remark Access to index greather than 4 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to acces to index greather than 4 with NAZARA_MATH_SAFE defined
|
||||
* \remark Access to index greater than 4 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to access to index greater than 4 with NAZARA_MATH_SAFE defined
|
||||
* \throw std::domain_error if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 4
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
T Rect<T>::operator[](unsigned int i) const
|
||||
T Rect<T>::operator[](std::size_t i) const
|
||||
{
|
||||
#if NAZARA_MATH_SAFE
|
||||
if (i >= 4)
|
||||
{
|
||||
StringStream ss;
|
||||
ss << "Index out of range: (" << i << " >= 4)";
|
||||
|
||||
NazaraError(ss);
|
||||
throw std::domain_error(ss.ToString());
|
||||
}
|
||||
#endif
|
||||
NazaraAssert(i < 4, "Index out of range");
|
||||
|
||||
return *(&x+i);
|
||||
}
|
||||
|
||||
@@ -60,8 +60,8 @@ namespace Nz
|
||||
|
||||
String ToString() const;
|
||||
|
||||
T& operator[](unsigned int i);
|
||||
T operator[](unsigned int i) const;
|
||||
T& operator[](std::size_t i);
|
||||
T operator[](std::size_t i) const;
|
||||
|
||||
Sphere operator*(T scalar) const;
|
||||
Sphere& operator=(const Sphere& other) = default;
|
||||
|
||||
@@ -466,24 +466,15 @@ namespace Nz
|
||||
* \brief Returns the ith element of the sphere
|
||||
* \return A reference to the ith element of the sphere
|
||||
*
|
||||
* \remark Access to index greather than 4 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to acces to index greather than 4 with NAZARA_MATH_SAFE defined
|
||||
* \remark Access to index greater than 4 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to access to index greater than 4 with NAZARA_MATH_SAFE defined
|
||||
* \throw std::domain_error if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 4
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
T& Sphere<T>::operator[](unsigned int i)
|
||||
T& Sphere<T>::operator[](std::size_t i)
|
||||
{
|
||||
#if NAZARA_MATH_SAFE
|
||||
if (i >= 4)
|
||||
{
|
||||
StringStream ss;
|
||||
ss << "Index out of range: (" << i << " >= 4)";
|
||||
|
||||
NazaraError(ss);
|
||||
throw std::domain_error(ss.ToString());
|
||||
}
|
||||
#endif
|
||||
NazaraAssert(i < 4, "Index out of range");
|
||||
|
||||
return *(&x+i);
|
||||
}
|
||||
@@ -492,24 +483,15 @@ namespace Nz
|
||||
* \brief Returns the ith element of the sphere
|
||||
* \return A value to the ith element of the sphere
|
||||
*
|
||||
* \remark Access to index greather than 4 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to acces to index greather than 4 with NAZARA_MATH_SAFE defined
|
||||
* \remark Access to index greater than 4 is undefined behavior
|
||||
* \remark Produce a NazaraError if you try to access to index greater than 4 with NAZARA_MATH_SAFE defined
|
||||
* \throw std::domain_error if NAZARA_MATH_SAFE is defined and one of you try to acces to index greather than 4
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
T Sphere<T>::operator[](unsigned int i) const
|
||||
T Sphere<T>::operator[](std::size_t i) const
|
||||
{
|
||||
#if NAZARA_MATH_SAFE
|
||||
if (i >= 4)
|
||||
{
|
||||
StringStream ss;
|
||||
ss << "Index out of range: (" << i << " >= 4)";
|
||||
|
||||
NazaraError(ss);
|
||||
throw std::domain_error(ss.ToString());
|
||||
}
|
||||
#endif
|
||||
NazaraAssert(i < 4, "Index out of range");
|
||||
|
||||
return *(&x+i);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_ENUMS_NETWORK_HPP
|
||||
#define NAZARA_ENUMS_NETWORK_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/Flags.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -91,6 +91,23 @@ namespace Nz
|
||||
SocketError_Max = SocketError_UnreachableHost
|
||||
};
|
||||
|
||||
enum SocketPollEvent
|
||||
{
|
||||
SocketPollEvent_Read, //< One or more sockets is ready for a read operation
|
||||
SocketPollEvent_Write, //< One or more sockets is ready for a write operation
|
||||
|
||||
SocketPollEvent_Max = SocketPollEvent_Write
|
||||
};
|
||||
|
||||
template<>
|
||||
struct EnumAsFlags<SocketPollEvent>
|
||||
{
|
||||
static constexpr bool value = true;
|
||||
static constexpr int max = SocketPollEvent_Max;
|
||||
};
|
||||
|
||||
using SocketPollEventFlags = Flags<SocketPollEvent>;
|
||||
|
||||
enum SocketState
|
||||
{
|
||||
SocketState_Bound, //< The socket is currently bound
|
||||
|
||||
@@ -24,10 +24,11 @@ namespace Nz
|
||||
|
||||
void Clear();
|
||||
|
||||
bool IsReady(const AbstractSocket& socket) const;
|
||||
bool IsReadyToRead(const AbstractSocket& socket) const;
|
||||
bool IsReadyToWrite(const AbstractSocket& socket) const;
|
||||
bool IsRegistered(const AbstractSocket& socket) const;
|
||||
|
||||
bool RegisterSocket(AbstractSocket& socket);
|
||||
bool RegisterSocket(AbstractSocket& socket, SocketPollEventFlags eventFlags);
|
||||
void UnregisterSocket(AbstractSocket& socket);
|
||||
|
||||
bool Wait(UInt64 msTimeout);
|
||||
@@ -41,4 +42,4 @@ namespace Nz
|
||||
|
||||
#include <Nazara/Network/SocketPoller.inl>
|
||||
|
||||
#endif // NAZARA_SOCKETPOLLER_HPP
|
||||
#endif // NAZARA_SOCKETPOLLER_HPP
|
||||
|
||||
@@ -64,10 +64,10 @@ namespace Nz
|
||||
|
||||
struct Callback
|
||||
{
|
||||
ContactEndCallback endCallback;
|
||||
ContactPreSolveCallback preSolveCallback;
|
||||
ContactPostSolveCallback postSolveCallback;
|
||||
ContactStartCallback startCallback;
|
||||
ContactEndCallback endCallback = nullptr;
|
||||
ContactPreSolveCallback preSolveCallback = nullptr;
|
||||
ContactPostSolveCallback postSolveCallback = nullptr;
|
||||
ContactStartCallback startCallback = nullptr;
|
||||
void* userdata;
|
||||
};
|
||||
|
||||
|
||||
@@ -26,15 +26,15 @@ namespace Nz
|
||||
|
||||
Reference operator*() const;
|
||||
|
||||
Reference operator[](unsigned int index) const;
|
||||
Reference operator[](std::size_t index) const;
|
||||
|
||||
IndexIterator& operator=(const IndexIterator& iterator);
|
||||
|
||||
IndexIterator operator+(unsigned int indexCount) const;
|
||||
IndexIterator operator-(unsigned int indexCount) const;
|
||||
IndexIterator operator+(std::size_t indexCount) const;
|
||||
IndexIterator operator-(std::size_t indexCount) const;
|
||||
|
||||
IndexIterator& operator+=(unsigned int indexCount);
|
||||
IndexIterator& operator-=(unsigned int indexCount);
|
||||
IndexIterator& operator+=(std::size_t indexCount);
|
||||
IndexIterator& operator-=(std::size_t indexCount);
|
||||
|
||||
IndexIterator& operator++();
|
||||
IndexIterator operator++(int);
|
||||
@@ -50,10 +50,10 @@ namespace Nz
|
||||
friend bool operator>=(const IndexIterator& lhs, const IndexIterator& rhs);
|
||||
|
||||
private:
|
||||
IndexIterator(IndexMapper* mapper, unsigned int index);
|
||||
IndexIterator(IndexMapper* mapper, std::size_t index);
|
||||
|
||||
IndexMapper* m_mapper;
|
||||
unsigned int m_index;
|
||||
std::size_t m_index;
|
||||
};
|
||||
|
||||
class IndexIterator::Reference
|
||||
@@ -70,10 +70,10 @@ namespace Nz
|
||||
operator UInt32() const;
|
||||
|
||||
private:
|
||||
Reference(IndexMapper* mapper, unsigned int index);
|
||||
Reference(IndexMapper* mapper, std::size_t index);
|
||||
|
||||
IndexMapper* m_mapper;
|
||||
unsigned int m_index;
|
||||
std::size_t m_index;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Nz
|
||||
{
|
||||
}
|
||||
|
||||
inline IndexIterator::IndexIterator(IndexMapper* mapper, unsigned int index) :
|
||||
inline IndexIterator::IndexIterator(IndexMapper* mapper, std::size_t index) :
|
||||
m_mapper(mapper),
|
||||
m_index(index)
|
||||
{
|
||||
@@ -31,7 +31,7 @@ namespace Nz
|
||||
return Reference(m_mapper, m_index);
|
||||
}
|
||||
|
||||
inline IndexIterator::Reference IndexIterator::operator[](unsigned int index) const
|
||||
inline IndexIterator::Reference IndexIterator::operator[](std::size_t index) const
|
||||
{
|
||||
return Reference(m_mapper, m_index+index);
|
||||
}
|
||||
@@ -44,24 +44,24 @@ namespace Nz
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline IndexIterator IndexIterator::operator+(unsigned int indexCount) const
|
||||
inline IndexIterator IndexIterator::operator+(std::size_t indexCount) const
|
||||
{
|
||||
return IndexIterator(m_mapper, m_index + indexCount);
|
||||
}
|
||||
|
||||
inline IndexIterator IndexIterator::operator-(unsigned int indexCount) const
|
||||
inline IndexIterator IndexIterator::operator-(std::size_t indexCount) const
|
||||
{
|
||||
return IndexIterator(m_mapper, m_index - indexCount);
|
||||
}
|
||||
|
||||
inline IndexIterator& IndexIterator::operator+=(unsigned int indexCount)
|
||||
inline IndexIterator& IndexIterator::operator+=(std::size_t indexCount)
|
||||
{
|
||||
m_index += indexCount;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline IndexIterator& IndexIterator::operator-=(unsigned int indexCount)
|
||||
inline IndexIterator& IndexIterator::operator-=(std::size_t indexCount)
|
||||
{
|
||||
m_index += indexCount;
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace Nz
|
||||
|
||||
/**************************IndexIterator::Reference*************************/
|
||||
|
||||
inline IndexIterator::Reference::Reference(IndexMapper* mapper, unsigned int index) :
|
||||
inline IndexIterator::Reference::Reference(IndexMapper* mapper, std::size_t index) :
|
||||
m_mapper(mapper),
|
||||
m_index(index)
|
||||
{
|
||||
@@ -148,7 +148,7 @@ namespace Nz
|
||||
|
||||
inline IndexIterator::Reference& IndexIterator::Reference::operator=(const IndexIterator::Reference& reference)
|
||||
{
|
||||
m_mapper->Set(m_index, reference); // Conversion implicite en UInt32
|
||||
m_mapper->Set(m_index, reference); // Implicit conversion to UInt32
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -17,9 +17,6 @@ namespace Nz
|
||||
class IndexIterator;
|
||||
class SubMesh;
|
||||
|
||||
using IndexMapperGetter = UInt32 (*)(const void* buffer, unsigned int i);
|
||||
using IndexMapperSetter = void (*)(void* buffer, unsigned int i, UInt32 value);
|
||||
|
||||
class NAZARA_UTILITY_API IndexMapper
|
||||
{
|
||||
public:
|
||||
@@ -29,11 +26,11 @@ namespace Nz
|
||||
IndexMapper(const SubMesh* subMesh, BufferAccess access = BufferAccess_ReadOnly);
|
||||
~IndexMapper() = default;
|
||||
|
||||
UInt32 Get(unsigned int i) const;
|
||||
UInt32 Get(std::size_t i) const;
|
||||
const IndexBuffer* GetBuffer() const;
|
||||
unsigned int GetIndexCount() const;
|
||||
std::size_t GetIndexCount() const;
|
||||
|
||||
void Set(unsigned int i, UInt32 value);
|
||||
void Set(std::size_t i, UInt32 value);
|
||||
|
||||
void Unmap();
|
||||
|
||||
@@ -45,10 +42,13 @@ namespace Nz
|
||||
// Méthodes STD
|
||||
|
||||
private:
|
||||
using Getter = UInt32(*)(const void* buffer, std::size_t i);
|
||||
using Setter = void(*)(void* buffer, std::size_t i, UInt32 value);
|
||||
|
||||
BufferMapper<IndexBuffer> m_mapper;
|
||||
IndexMapperGetter m_getter;
|
||||
IndexMapperSetter m_setter;
|
||||
unsigned int m_indexCount;
|
||||
Getter m_getter;
|
||||
Setter m_setter;
|
||||
std::size_t m_indexCount;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Nz
|
||||
|
||||
bool Advance();
|
||||
|
||||
UInt32 operator[](unsigned int i) const;
|
||||
UInt32 operator[](std::size_t i) const;
|
||||
|
||||
void Unmap();
|
||||
|
||||
@@ -32,8 +32,8 @@ namespace Nz
|
||||
PrimitiveMode m_primitiveMode;
|
||||
UInt32 m_triangleIndices[3];
|
||||
IndexMapper m_indexMapper;
|
||||
unsigned int m_currentIndex;
|
||||
unsigned int m_indexCount;
|
||||
std::size_t m_currentIndex;
|
||||
std::size_t m_indexCount;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user