Merge remote-tracking branch 'refs/remotes/origin/master' into culling
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include <Nazara/Core/Enums.hpp>
|
||||
#include <Nazara/Core/SerializationContext.hpp>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
|
||||
@@ -38,11 +39,13 @@ namespace Nz
|
||||
struct TypeTag {};
|
||||
|
||||
inline bool Serialize(SerializationContext& context, bool value);
|
||||
inline bool Serialize(SerializationContext& context, const std::string& value);
|
||||
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_arithmetic<T>::value, bool> Serialize(SerializationContext& context, T value);
|
||||
|
||||
inline bool Unserialize(SerializationContext& context, bool* value);
|
||||
inline bool Unserialize(SerializationContext& context, std::string* value);
|
||||
|
||||
template<typename T>
|
||||
std::enable_if_t<std::is_arithmetic<T>::value, bool> Unserialize(SerializationContext& context, T* value);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
// Merci à Ryan "FullMetal Alchemist" Lahfa
|
||||
// Merci aussi à Freedom de siteduzero.com
|
||||
|
||||
#include <Nazara/Core/Algorithm.hpp>
|
||||
#include <Nazara/Core/AbstractHash.hpp>
|
||||
#include <Nazara/Core/ByteArray.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
@@ -192,7 +193,7 @@ namespace Nz
|
||||
/*!
|
||||
* \ingroup core
|
||||
* \brief Serializes a boolean
|
||||
* \return true if serialization succedeed
|
||||
* \return true if serialization succeeded
|
||||
*
|
||||
* \param context Context for the serialization
|
||||
* \param value Boolean to serialize
|
||||
@@ -216,10 +217,26 @@ namespace Nz
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \ingroup core
|
||||
* \brief Serializes a std::string
|
||||
* \return true if successful
|
||||
*
|
||||
* \param context Context for the serialization
|
||||
* \param value String to serialize
|
||||
*/
|
||||
bool Serialize(SerializationContext& context, const std::string& value)
|
||||
{
|
||||
if (!Serialize(context, UInt32(value.size())))
|
||||
return false;
|
||||
|
||||
return context.stream->Write(value.data(), value.size()) == value.size();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \ingroup core
|
||||
* \brief Serializes an arithmetic type
|
||||
* \return true if serialization succedeed
|
||||
* \return true if serialization succeeded
|
||||
*
|
||||
* \param context Context for the serialization
|
||||
* \param value Arithmetic type to serialize
|
||||
@@ -266,6 +283,23 @@ namespace Nz
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Unserializes a string
|
||||
* \return true if successful
|
||||
*
|
||||
* \param context Context of unserialization
|
||||
* \param string std::string to unserialize
|
||||
*/
|
||||
bool Unserialize(SerializationContext& context, std::string* string)
|
||||
{
|
||||
UInt32 size;
|
||||
if (!Unserialize(context, &size))
|
||||
return false;
|
||||
|
||||
string->resize(size);
|
||||
return context.stream->Read(&string[0], size) == size;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \ingroup core
|
||||
* \brief Unserializes an arithmetic type
|
||||
|
||||
@@ -64,6 +64,9 @@ namespace Nz
|
||||
void Set(std::size_t bit, bool val = true);
|
||||
void SetBlock(std::size_t i, Block block);
|
||||
|
||||
void ShiftLeft(std::size_t pos);
|
||||
void ShiftRight(std::size_t pos);
|
||||
|
||||
void Swap(Bitset& bitset);
|
||||
|
||||
bool Test(std::size_t bit) const;
|
||||
@@ -88,6 +91,12 @@ namespace Nz
|
||||
template<typename T> Bitset& operator=(T value);
|
||||
Bitset& operator=(Bitset&& bitset) noexcept = default;
|
||||
|
||||
Bitset operator<<(std::size_t pos) const;
|
||||
Bitset& operator<<=(std::size_t pos);
|
||||
|
||||
Bitset operator>>(std::size_t pos) const;
|
||||
Bitset& operator>>=(std::size_t pos);
|
||||
|
||||
Bitset& operator&=(const Bitset& bitset);
|
||||
Bitset& operator|=(const Bitset& bitset);
|
||||
Bitset& operator^=(const Bitset& bitset);
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
// This file is part of the "Nazara Engine - Core module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Core/Bitset.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Math/Algorithm.hpp>
|
||||
#include <cstdlib>
|
||||
#include <limits>
|
||||
#include <utility>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
@@ -512,12 +514,117 @@ namespace Nz
|
||||
ResetExtraBits();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Shift all the bits toward the left
|
||||
*
|
||||
* \param pos Bit shifting to be applied
|
||||
*
|
||||
* \remark This does not changes the size of the bitset.
|
||||
*
|
||||
* \see operator<<=
|
||||
*/
|
||||
template<typename Block, class Allocator>
|
||||
void Bitset<Block, Allocator>::ShiftLeft(std::size_t pos)
|
||||
{
|
||||
if (pos == 0)
|
||||
return;
|
||||
|
||||
if (pos >= m_bitCount)
|
||||
{
|
||||
Reset();
|
||||
return;
|
||||
}
|
||||
|
||||
auto div = std::lldiv(pos, bitsPerBlock);
|
||||
if (div.rem != 0)
|
||||
{
|
||||
std::size_t lastIndex = m_blocks.size() - 1;
|
||||
std::size_t remaining = bitsPerBlock - div.rem;
|
||||
|
||||
for (std::size_t i = lastIndex - div.quot; i > 0; --i)
|
||||
m_blocks[i + div.quot] = (m_blocks[i] << div.rem) | (m_blocks[i - 1] >> remaining);
|
||||
|
||||
m_blocks[div.quot] = m_blocks[0] << div.rem;
|
||||
|
||||
std::fill_n(m_blocks.begin(), div.quot, Block(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (auto it = m_blocks.rbegin(); it != m_blocks.rend(); ++it)
|
||||
{
|
||||
if (static_cast<std::size_t>(std::distance(m_blocks.rbegin(), it) + div.quot) < m_blocks.size())
|
||||
{
|
||||
auto shiftedIt = it;
|
||||
std::advance(shiftedIt, div.quot);
|
||||
|
||||
*it = *shiftedIt;
|
||||
}
|
||||
else
|
||||
*it = 0U;
|
||||
}
|
||||
}
|
||||
|
||||
ResetExtraBits();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Shift all the bits toward the right
|
||||
*
|
||||
* \param pos Bit shifting to be applied
|
||||
*
|
||||
* \remark This does not changes the size of the bitset.
|
||||
*
|
||||
* \see operator>>=
|
||||
*/
|
||||
template<typename Block, class Allocator>
|
||||
void Bitset<Block, Allocator>::ShiftRight(std::size_t pos)
|
||||
{
|
||||
if (pos == 0)
|
||||
return;
|
||||
|
||||
if (pos >= m_bitCount)
|
||||
{
|
||||
Reset();
|
||||
return;
|
||||
}
|
||||
|
||||
auto div = std::lldiv(pos, bitsPerBlock);
|
||||
if (div.rem != 0)
|
||||
{
|
||||
std::size_t lastIndex = m_blocks.size() - 1;
|
||||
std::size_t remaining = bitsPerBlock - div.rem;
|
||||
|
||||
for (std::size_t i = div.quot; i < lastIndex; ++i)
|
||||
m_blocks[i - div.quot] = (m_blocks[i] >> div.rem) | (m_blocks[i + 1] << remaining);
|
||||
|
||||
m_blocks[lastIndex - div.quot] = m_blocks[lastIndex] >> div.rem;
|
||||
|
||||
std::fill_n(m_blocks.begin() + (m_blocks.size() - div.quot), div.quot, Block(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (auto it = m_blocks.begin(); it != m_blocks.end(); ++it)
|
||||
{
|
||||
if (static_cast<std::size_t>(std::distance(m_blocks.begin(), it) + div.quot) < m_blocks.size())
|
||||
{
|
||||
auto shiftedIt = it;
|
||||
std::advance(shiftedIt, div.quot);
|
||||
|
||||
*it = *shiftedIt;
|
||||
}
|
||||
else
|
||||
*it = 0U;
|
||||
}
|
||||
}
|
||||
|
||||
ResetExtraBits();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Swaps the two bitsets
|
||||
*
|
||||
* \param bitset Other bitset to swap
|
||||
*/
|
||||
|
||||
template<typename Block, class Allocator>
|
||||
void Bitset<Block, Allocator>::Swap(Bitset& bitset)
|
||||
{
|
||||
@@ -763,6 +870,80 @@ namespace Nz
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Shift all the bits toward the left
|
||||
*
|
||||
* \param pos Bit shifting to be applied
|
||||
*
|
||||
* \return A copies of the bitset with shifted bits
|
||||
*
|
||||
* \remark This does not changes the size of the bitset.
|
||||
*
|
||||
* \see ShiftLeft
|
||||
*/
|
||||
template<typename Block, class Allocator>
|
||||
Bitset<Block, Allocator> Bitset<Block, Allocator>::operator<<(std::size_t pos) const
|
||||
{
|
||||
Bitset bitset(*this);
|
||||
return bitset <<= pos;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Shift all the bits toward the left
|
||||
*
|
||||
* \param pos Bit shifting to be applied
|
||||
*
|
||||
* \return A reference to this
|
||||
*
|
||||
* \remark This does not changes the size of the bitset.
|
||||
*
|
||||
* \see ShiftLeft
|
||||
*/
|
||||
template<typename Block, class Allocator>
|
||||
Bitset<Block, Allocator>& Bitset<Block, Allocator>::operator<<=(std::size_t pos)
|
||||
{
|
||||
ShiftLeft(pos);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Shift all the bits toward the right
|
||||
*
|
||||
* \param pos Bit shifting to be applied
|
||||
*
|
||||
* \return A copies of the bitset with shifted bits
|
||||
*
|
||||
* \remark This does not changes the size of the bitset.
|
||||
*
|
||||
* \see ShiftRight
|
||||
*/
|
||||
template<typename Block, class Allocator>
|
||||
Bitset<Block, Allocator> Bitset<Block, Allocator>::operator>>(std::size_t pos) const
|
||||
{
|
||||
Bitset bitset(*this);
|
||||
return bitset >>= pos;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Shift all the bits toward the right
|
||||
*
|
||||
* \param pos Bit shifting to be applied
|
||||
*
|
||||
* \return A reference to this
|
||||
*
|
||||
* \remark This does not changes the size of the bitset.
|
||||
*
|
||||
* \see ShiftRight
|
||||
*/
|
||||
template<typename Block, class Allocator>
|
||||
Bitset<Block, Allocator>& Bitset<Block, Allocator>::operator>>=(std::size_t pos)
|
||||
{
|
||||
ShiftRight(pos);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Performs an "AND" with another bitset
|
||||
* \return A reference to this
|
||||
|
||||
@@ -72,8 +72,8 @@
|
||||
// Number of spinlocks to use with the Windows critical sections (0 to disable)
|
||||
#define NAZARA_CORE_WINDOWS_CS_SPINLOCKS 4096
|
||||
|
||||
// Optimize the Windows implementation with technologies of Windows vista (and greather) (Break the compatibility with XP)
|
||||
#define NAZARA_CORE_WINDOWS_VISTA 0
|
||||
// Optimize the Windows implementation with technologies of Windows NT 6.0 (and greater) (Break the compatibility with Windows XP)
|
||||
#define NAZARA_CORE_WINDOWS_NT6 0
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#define NAZARA_LOG_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/AbstractLogger.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/Signal.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
@@ -29,8 +30,6 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class AbstractLogger;
|
||||
|
||||
class NAZARA_CORE_API Log
|
||||
{
|
||||
friend class Core;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_MEMORYHELPER_HPP
|
||||
#define NAZARA_MEMORYHELPER_HPP
|
||||
|
||||
#if defined(NAZARA_COMPILER_MSVC)
|
||||
#if defined(NAZARA_COMPILER_MSVC) || defined(NAZARA_COMPILER_MINGW)
|
||||
|
||||
#include <malloc.h>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// This file was automatically generated on 20 Jul 2016 at 13:49:17
|
||||
// This file was automatically generated on 15 Sep 2016 at 00:43:26
|
||||
|
||||
/*
|
||||
Nazara Engine - Graphics module
|
||||
@@ -58,10 +58,14 @@
|
||||
#include <Nazara/Graphics/InstancedRenderable.hpp>
|
||||
#include <Nazara/Graphics/Light.hpp>
|
||||
#include <Nazara/Graphics/Material.hpp>
|
||||
#include <Nazara/Graphics/MaterialPipeline.hpp>
|
||||
#include <Nazara/Graphics/Model.hpp>
|
||||
#include <Nazara/Graphics/ParticleController.hpp>
|
||||
#include <Nazara/Graphics/ParticleDeclaration.hpp>
|
||||
#include <Nazara/Graphics/ParticleEmitter.hpp>
|
||||
#include <Nazara/Graphics/ParticleFunctionController.hpp>
|
||||
#include <Nazara/Graphics/ParticleFunctionGenerator.hpp>
|
||||
#include <Nazara/Graphics/ParticleFunctionRenderer.hpp>
|
||||
#include <Nazara/Graphics/ParticleGenerator.hpp>
|
||||
#include <Nazara/Graphics/ParticleGroup.hpp>
|
||||
#include <Nazara/Graphics/ParticleMapper.hpp>
|
||||
@@ -77,5 +81,6 @@
|
||||
#include <Nazara/Graphics/Sprite.hpp>
|
||||
#include <Nazara/Graphics/TextSprite.hpp>
|
||||
#include <Nazara/Graphics/TextureBackground.hpp>
|
||||
#include <Nazara/Graphics/TileMap.hpp>
|
||||
|
||||
#endif // NAZARA_GLOBAL_GRAPHICS_HPP
|
||||
|
||||
@@ -38,19 +38,25 @@ namespace Nz
|
||||
shader->SendVector(uniforms.locations.factors + uniformOffset, Vector2f(light.ambientFactor, light.diffuseFactor));
|
||||
shader->SendVector(uniforms.locations.parameters1 + uniformOffset, Vector4f(light.direction));
|
||||
|
||||
shader->SendBoolean(uniforms.locations.shadowMapping + uniformOffset, light.shadowMap != nullptr);
|
||||
if (uniforms.locations.shadowMapping != -1)
|
||||
shader->SendBoolean(uniforms.locations.shadowMapping + uniformOffset, light.shadowMap != nullptr);
|
||||
|
||||
if (light.shadowMap)
|
||||
{
|
||||
Renderer::SetTexture(availableTextureUnit, light.shadowMap);
|
||||
Renderer::SetTextureSampler(availableTextureUnit, s_shadowSampler);
|
||||
|
||||
shader->SendMatrix(uniforms.locations.lightViewProjMatrix + index, light.transformMatrix);
|
||||
shader->SendInteger(uniforms.locations.directionalSpotLightShadowMap + index, availableTextureUnit);
|
||||
if (uniforms.locations.lightViewProjMatrix != -1)
|
||||
shader->SendMatrix(uniforms.locations.lightViewProjMatrix + index, light.transformMatrix);
|
||||
|
||||
if (uniforms.locations.directionalSpotLightShadowMap != -1)
|
||||
shader->SendInteger(uniforms.locations.directionalSpotLightShadowMap + index, availableTextureUnit);
|
||||
}
|
||||
else
|
||||
else if (uniforms.locations.directionalSpotLightShadowMap != -1)
|
||||
shader->SendInteger(uniforms.locations.directionalSpotLightShadowMap + index, dummyTexture);
|
||||
|
||||
shader->SendInteger(uniforms.locations.pointLightShadowMap + index, dummyCubemap);
|
||||
if (uniforms.locations.directionalSpotLightShadowMap != -1)
|
||||
shader->SendInteger(uniforms.locations.pointLightShadowMap + index, dummyCubemap);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -63,18 +69,22 @@ namespace Nz
|
||||
shader->SendVector(uniforms.locations.parameters1 + uniformOffset, Vector4f(light.position, light.attenuation));
|
||||
shader->SendVector(uniforms.locations.parameters2 + uniformOffset, Vector4f(0.f, 0.f, 0.f, light.invRadius));
|
||||
|
||||
shader->SendBoolean(uniforms.locations.shadowMapping + uniformOffset, light.shadowMap != nullptr);
|
||||
if (uniforms.locations.shadowMapping != -1)
|
||||
shader->SendBoolean(uniforms.locations.shadowMapping + uniformOffset, light.shadowMap != nullptr);
|
||||
|
||||
if (light.shadowMap)
|
||||
{
|
||||
Renderer::SetTexture(availableTextureUnit, light.shadowMap);
|
||||
Renderer::SetTextureSampler(availableTextureUnit, s_shadowSampler);
|
||||
|
||||
shader->SendInteger(uniforms.locations.pointLightShadowMap + index, availableTextureUnit);
|
||||
if (uniforms.locations.pointLightShadowMap != -1)
|
||||
shader->SendInteger(uniforms.locations.pointLightShadowMap + index, availableTextureUnit);
|
||||
}
|
||||
else
|
||||
else if (uniforms.locations.pointLightShadowMap != -1)
|
||||
shader->SendInteger(uniforms.locations.pointLightShadowMap + index, dummyCubemap);
|
||||
|
||||
shader->SendInteger(uniforms.locations.directionalSpotLightShadowMap + index, dummyTexture);
|
||||
if (uniforms.locations.directionalSpotLightShadowMap != -1)
|
||||
shader->SendInteger(uniforms.locations.directionalSpotLightShadowMap + index, dummyTexture);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -88,19 +98,25 @@ namespace Nz
|
||||
shader->SendVector(uniforms.locations.parameters2 + uniformOffset, Vector4f(light.direction, light.invRadius));
|
||||
shader->SendVector(uniforms.locations.parameters3 + uniformOffset, Vector2f(light.innerAngleCosine, light.outerAngleCosine));
|
||||
|
||||
shader->SendBoolean(uniforms.locations.shadowMapping + uniformOffset, light.shadowMap != nullptr);
|
||||
if (uniforms.locations.shadowMapping != -1)
|
||||
shader->SendBoolean(uniforms.locations.shadowMapping + uniformOffset, light.shadowMap != nullptr);
|
||||
|
||||
if (light.shadowMap)
|
||||
{
|
||||
Renderer::SetTexture(availableTextureUnit, light.shadowMap);
|
||||
Renderer::SetTextureSampler(availableTextureUnit, s_shadowSampler);
|
||||
|
||||
shader->SendMatrix(uniforms.locations.lightViewProjMatrix + index, light.transformMatrix);
|
||||
shader->SendInteger(uniforms.locations.directionalSpotLightShadowMap + index, availableTextureUnit);
|
||||
if (uniforms.locations.lightViewProjMatrix != -1)
|
||||
shader->SendMatrix(uniforms.locations.lightViewProjMatrix + index, light.transformMatrix);
|
||||
|
||||
if (uniforms.locations.directionalSpotLightShadowMap != -1)
|
||||
shader->SendInteger(uniforms.locations.directionalSpotLightShadowMap + index, availableTextureUnit);
|
||||
}
|
||||
else
|
||||
else if (uniforms.locations.directionalSpotLightShadowMap != -1)
|
||||
shader->SendInteger(uniforms.locations.directionalSpotLightShadowMap + index, dummyTexture);
|
||||
|
||||
shader->SendInteger(uniforms.locations.pointLightShadowMap + index, dummyCubemap);
|
||||
if (uniforms.locations.pointLightShadowMap != -1)
|
||||
shader->SendInteger(uniforms.locations.pointLightShadowMap + index, dummyCubemap);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -108,9 +124,14 @@ namespace Nz
|
||||
}
|
||||
else
|
||||
{
|
||||
shader->SendInteger(uniforms.locations.type + uniformOffset, -1); //< Disable the light in the shader
|
||||
shader->SendInteger(uniforms.locations.directionalSpotLightShadowMap + index, dummyTexture);
|
||||
shader->SendInteger(uniforms.locations.pointLightShadowMap + index, dummyCubemap);
|
||||
if (uniforms.locations.type != -1)
|
||||
shader->SendInteger(uniforms.locations.type + uniformOffset, -1); //< Disable the light in the shader
|
||||
|
||||
if (uniforms.locations.directionalSpotLightShadowMap != -1)
|
||||
shader->SendInteger(uniforms.locations.directionalSpotLightShadowMap + index, dummyTexture);
|
||||
|
||||
if (uniforms.locations.pointLightShadowMap != -1)
|
||||
shader->SendInteger(uniforms.locations.pointLightShadowMap + index, dummyCubemap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace Nz
|
||||
struct ParticleStruct_Billboard
|
||||
{
|
||||
Color color;
|
||||
Vector2f size;
|
||||
Vector3f normal;
|
||||
Vector3f position;
|
||||
Vector3f velocity;
|
||||
|
||||
@@ -41,6 +41,8 @@ namespace Nz
|
||||
inline void DisableTiles();
|
||||
inline void DisableTiles(const Vector2ui* tilesPos, std::size_t tileCount);
|
||||
|
||||
inline void EnableIsometricMode(bool isometric);
|
||||
|
||||
inline void EnableTile(const Vector2ui& tilePos, const Rectf& coords, const Color& color = Color::White, std::size_t materialIndex = 0U);
|
||||
inline void EnableTile(const Vector2ui& tilePos, const Rectui& rect, const Color& color = Color::White, std::size_t materialIndex = 0U);
|
||||
inline void EnableTiles(const Rectf& coords, const Color& color = Color::White, std::size_t materialIndex = 0U);
|
||||
@@ -55,6 +57,8 @@ namespace Nz
|
||||
inline const Tile& GetTile(const Vector2ui& tilePos) const;
|
||||
inline const Vector2f& GetTileSize() const;
|
||||
|
||||
inline bool IsIsometricModeEnabled() const;
|
||||
|
||||
inline void SetMaterial(std::size_t index, MaterialRef material);
|
||||
|
||||
inline TileMap& operator=(const TileMap& TileMap);
|
||||
@@ -87,6 +91,7 @@ namespace Nz
|
||||
std::vector<Layer> m_layers;
|
||||
Vector2ui m_mapSize;
|
||||
Vector2f m_tileSize;
|
||||
bool m_isometricModeEnabled;
|
||||
|
||||
static TileMapLibrary::LibraryMap s_library;
|
||||
};
|
||||
|
||||
@@ -25,7 +25,8 @@ namespace Nz
|
||||
m_tiles(mapSize.x * mapSize.y),
|
||||
m_layers(materialCount),
|
||||
m_mapSize(mapSize),
|
||||
m_tileSize(tileSize)
|
||||
m_tileSize(tileSize),
|
||||
m_isometricModeEnabled(false)
|
||||
{
|
||||
NazaraAssert(m_tiles.size() != 0U, "Invalid map size");
|
||||
NazaraAssert(m_tileSize.x != 0U && m_tileSize.y != 0U, "Invalid tile size");
|
||||
@@ -108,6 +109,22 @@ namespace Nz
|
||||
InvalidateInstanceData(invalidatedLayers);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Enable/Disable isometric mode
|
||||
*
|
||||
* If enabled, every odd line will overlap by half the tile size with the upper line
|
||||
*
|
||||
* \param isometric Should the isometric mode be enabled for this TileMap
|
||||
*
|
||||
* \see IsIsometricModeEnabled
|
||||
*/
|
||||
inline void TileMap::EnableIsometricMode(bool isometric)
|
||||
{
|
||||
m_isometricModeEnabled = isometric;
|
||||
|
||||
InvalidateInstanceData(0xFFFFFFFF);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Enable and sets the tile at position tilePos
|
||||
*
|
||||
@@ -387,6 +404,17 @@ namespace Nz
|
||||
return m_tileSize;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Gets the actual state of the isometric mode
|
||||
* \return True if the isometric mode is enabled
|
||||
*
|
||||
* \see EnableIsometricMode
|
||||
*/
|
||||
inline bool TileMap::IsIsometricModeEnabled() const
|
||||
{
|
||||
return m_isometricModeEnabled;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets a material of the TileMap
|
||||
*
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Nz
|
||||
public:
|
||||
using ClassFunc = std::function<int(LuaInstance& lua, T& instance)>;
|
||||
using ClassIndexFunc = std::function<bool(LuaInstance& lua, T& instance)>;
|
||||
using ConstructorFunc = std::function<bool(LuaInstance& lua, T* instance)>;
|
||||
using ConstructorFunc = std::function<bool(LuaInstance& lua, T* instance, std::size_t argumentCount)>;
|
||||
template<typename P> using ConvertToParent = std::function<P*(T*)>;
|
||||
using FinalizerFunc = std::function<bool(LuaInstance& lua, T& instance)>;
|
||||
using StaticIndexFunc = std::function<bool(LuaInstance& lua)>;
|
||||
|
||||
@@ -19,9 +19,10 @@ namespace Nz
|
||||
template<class T>
|
||||
inline void LuaClass<T>::BindDefaultConstructor()
|
||||
{
|
||||
SetConstructor([] (Nz::LuaInstance& lua, T* instance)
|
||||
SetConstructor([] (Nz::LuaInstance& lua, T* instance, std::size_t argumentCount)
|
||||
{
|
||||
NazaraUnused(lua);
|
||||
NazaraUnused(argumentCount);
|
||||
|
||||
PlacementNew(instance);
|
||||
return true;
|
||||
@@ -334,9 +335,11 @@ namespace Nz
|
||||
|
||||
lua.Remove(1); // On enlève l'argument "table" du stack
|
||||
|
||||
std::size_t argCount = lua.GetStackTop();
|
||||
|
||||
T* instance = static_cast<T*>(lua.PushUserdata(sizeof(T)));
|
||||
|
||||
if (!constructor(lua, instance))
|
||||
if (!constructor(lua, instance, argCount))
|
||||
{
|
||||
lua.Error("Constructor failed");
|
||||
return 0; // Normalement jamais exécuté (l'erreur provoquant une exception)
|
||||
|
||||
@@ -16,11 +16,11 @@ namespace Nz
|
||||
inline LuaInstance::LuaInstance(LuaInstance&& instance) noexcept :
|
||||
m_memoryLimit(instance.m_memoryLimit),
|
||||
m_memoryUsage(instance.m_memoryUsage),
|
||||
m_timeLimit(m_timeLimit),
|
||||
m_clock(std::move(m_clock)),
|
||||
m_lastError(std::move(m_lastError)),
|
||||
m_state(m_state),
|
||||
m_level(m_level)
|
||||
m_timeLimit(instance.m_timeLimit),
|
||||
m_clock(std::move(instance.m_clock)),
|
||||
m_lastError(std::move(instance.m_lastError)),
|
||||
m_state(instance.m_state),
|
||||
m_level(instance.m_level)
|
||||
{
|
||||
instance.m_state = nullptr;
|
||||
}
|
||||
@@ -52,13 +52,13 @@ namespace Nz
|
||||
|
||||
inline LuaInstance& LuaInstance::operator=(LuaInstance&& instance) noexcept
|
||||
{
|
||||
m_clock = std::move(m_clock);
|
||||
m_lastError = std::move(m_lastError);
|
||||
m_level = m_level;
|
||||
m_clock = std::move(instance.m_clock);
|
||||
m_lastError = std::move(instance.m_lastError);
|
||||
m_level = instance.m_level;
|
||||
m_memoryLimit = instance.m_memoryLimit;
|
||||
m_memoryUsage = instance.m_memoryUsage;
|
||||
m_state = m_state;
|
||||
m_timeLimit = m_timeLimit;
|
||||
m_state = instance.m_state;
|
||||
m_timeLimit = instance.m_timeLimit;
|
||||
|
||||
instance.m_state = nullptr;
|
||||
|
||||
|
||||
44
include/Nazara/Network/SocketPoller.hpp
Normal file
44
include/Nazara/Network/SocketPoller.hpp
Normal file
@@ -0,0 +1,44 @@
|
||||
// Copyright (C) 2015 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Network module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_SOCKETPOLLER_HPP
|
||||
#define NAZARA_SOCKETPOLLER_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Network/AbstractSocket.hpp>
|
||||
#include <Nazara/Network/IpAddress.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class SocketPollerImpl;
|
||||
|
||||
class NAZARA_NETWORK_API SocketPoller
|
||||
{
|
||||
public:
|
||||
SocketPoller();
|
||||
inline SocketPoller(SocketPoller&& socketPoller);
|
||||
~SocketPoller();
|
||||
|
||||
void Clear();
|
||||
|
||||
bool IsReady(const AbstractSocket& socket) const;
|
||||
bool IsRegistered(const AbstractSocket& socket) const;
|
||||
|
||||
bool RegisterSocket(AbstractSocket& socket);
|
||||
void UnregisterSocket(AbstractSocket& socket);
|
||||
|
||||
bool Wait(UInt64 msTimeout);
|
||||
|
||||
inline SocketPoller& operator=(SocketPoller&& socketPoller);
|
||||
|
||||
private:
|
||||
SocketPollerImpl* m_impl;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Network/SocketPoller.inl>
|
||||
|
||||
#endif // NAZARA_SOCKETPOLLER_HPP
|
||||
37
include/Nazara/Network/SocketPoller.inl
Normal file
37
include/Nazara/Network/SocketPoller.inl
Normal file
@@ -0,0 +1,37 @@
|
||||
// Copyright (C) 2015 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Network module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Network/SocketPoller.hpp>
|
||||
#include <utility>
|
||||
#include <Nazara/Network/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
/*!
|
||||
* \brief Constructs a SocketPoller object with another one by move semantic
|
||||
*
|
||||
* \param socketPoller SocketPoller to move into this
|
||||
*/
|
||||
inline SocketPoller::SocketPoller(SocketPoller&& socketPoller) :
|
||||
m_impl(socketPoller.m_impl)
|
||||
{
|
||||
socketPoller.m_impl = nullptr;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Moves the SocketPoller into this
|
||||
* \return A reference to this
|
||||
*
|
||||
* \param socketPoller SocketPoller to move in this
|
||||
*/
|
||||
inline SocketPoller& SocketPoller::operator=(SocketPoller&& socketPoller)
|
||||
{
|
||||
m_impl = socketPoller.m_impl;
|
||||
socketPoller.m_impl = nullptr;
|
||||
|
||||
return *this;
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Network/DebugOff.hpp>
|
||||
@@ -2,8 +2,8 @@
|
||||
// This file is part of the "Nazara Engine - Noise module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#ifndef SIMPLEX_HPP
|
||||
#define SIMPLE_HPP
|
||||
#ifndef NAZARA_SIMPLEX_HPP
|
||||
#define NAZARA_SIMPLEX_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Noise/Config.hpp>
|
||||
@@ -25,4 +25,4 @@ namespace Nz
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SIMPLEX_HPP
|
||||
#endif // NAZARA_SIMPLEX_HPP
|
||||
|
||||
@@ -74,9 +74,10 @@
|
||||
#error Nazara requires a C++11 compliant compiler
|
||||
#endif
|
||||
|
||||
// Version du moteur
|
||||
// Nazara version macro
|
||||
#define NAZARA_VERSION_MAJOR 0
|
||||
#define NAZARA_VERSION_MINOR 1
|
||||
#define NAZARA_VERSION_PATCH 1
|
||||
|
||||
#include <Nazara/Core/Config.hpp>
|
||||
|
||||
@@ -97,7 +98,7 @@
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
|
||||
#if NAZARA_CORE_WINDOWS_VISTA
|
||||
#if NAZARA_CORE_WINDOWS_NT6
|
||||
// Version de Windows minimale : Vista
|
||||
#define NAZARA_WINNT 0x0600
|
||||
#else
|
||||
|
||||
@@ -29,6 +29,8 @@ namespace Nz
|
||||
|
||||
inline void Clear();
|
||||
|
||||
bool Check(Stream& stream);
|
||||
|
||||
inline String* GetMaterials();
|
||||
inline const String* GetMaterials() const;
|
||||
inline UInt32 GetMaterialCount() const;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/Initializer.hpp>
|
||||
#include <Nazara/Core/ParameterList.hpp>
|
||||
#include <Nazara/Utility/Config.hpp>
|
||||
#include <Nazara/Utility/Enums.hpp>
|
||||
|
||||
@@ -24,12 +25,15 @@ namespace Nz
|
||||
|
||||
static bool IsInitialized();
|
||||
|
||||
static void SetParameters(const ParameterList& parameters);
|
||||
|
||||
static void Uninitialize();
|
||||
|
||||
static unsigned int ComponentCount[ComponentType_Max+1];
|
||||
static std::size_t ComponentStride[ComponentType_Max+1];
|
||||
|
||||
private:
|
||||
static ParameterList s_initializationParameters;
|
||||
static unsigned int s_moduleReferenceCounter;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -55,11 +55,6 @@ namespace Nz
|
||||
window.m_impl = nullptr;
|
||||
}
|
||||
|
||||
inline Window::~Window()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
inline void Window::Close()
|
||||
{
|
||||
m_closed = true; // The window will be closed at the next non-const IsOpen() call
|
||||
@@ -146,7 +141,7 @@ namespace Nz
|
||||
{
|
||||
Destroy();
|
||||
|
||||
m_closed = window.m_closed;
|
||||
m_closed = window.m_closed;
|
||||
m_closeOnQuit = window.m_closeOnQuit;
|
||||
m_eventPolling = window.m_eventPolling;
|
||||
m_impl = window.m_impl;
|
||||
|
||||
Reference in New Issue
Block a user