Merge branch 'master' into vulkan
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_LOADERS_SNDFILE_HPP
|
||||
#define NAZARA_LOADERS_SNDFILE_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Nz
|
||||
*/
|
||||
float Clock::GetSeconds() const
|
||||
{
|
||||
return GetMicroseconds()/1000000.f;
|
||||
return GetMicroseconds()/1'000'000.f;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -132,15 +132,26 @@ namespace Nz
|
||||
|
||||
/*!
|
||||
* \brief Restart the clock
|
||||
* \return Microseconds elapsed
|
||||
*
|
||||
* Restarts the clock, putting it's time counter back to zero (as if the clock got constructed).
|
||||
* It also compute the elapsed microseconds since the last Restart() call without any time loss (a problem that the combination of GetElapsedMicroseconds and Restart have).
|
||||
*/
|
||||
void Clock::Restart()
|
||||
UInt64 Clock::Restart()
|
||||
{
|
||||
NazaraLock(m_mutex);
|
||||
|
||||
Nz::UInt64 now = GetElapsedMicroseconds();
|
||||
|
||||
Nz::UInt64 elapsedTime = m_elapsedTime;
|
||||
if (!m_paused)
|
||||
elapsedTime += (now - m_refTime);
|
||||
|
||||
m_elapsedTime = 0;
|
||||
m_refTime = GetElapsedMicroseconds();
|
||||
m_refTime = now;
|
||||
m_paused = false;
|
||||
|
||||
return elapsedTime;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
#ifndef NAZARA_HASH_SHA2_INTERNAL_HPP
|
||||
#define NAZARA_HASH_SHA2_INTERNAL_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
|
||||
/* Digest lengths for SHA-1/224/256/384/512 */
|
||||
#define SHA1_DIGEST_LENGTH 20
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_CLOCKIMPL_POSIX_HPP
|
||||
#define NAZARA_CLOCKIMPL_POSIX_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#ifndef NAZARA_CONDITIONVARIABLEIMPL_HPP
|
||||
#define NAZARA_CONDITIONVARIABLEIMPL_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <pthread.h>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_DIRECTORYIMPL_HPP
|
||||
#define NAZARA_DIRECTORYIMPL_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <dirent.h>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#define _LARGEFILE64_SOURCE
|
||||
#endif
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/Enums.hpp>
|
||||
#include <ctime>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_HARDWAREINFOIMPL_POSIX_HPP
|
||||
#define NAZARA_HARDWAREINFOIMPL_POSIX_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_SEMAPHOREIMPL_HPP
|
||||
#define NAZARA_SEMAPHOREIMPL_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <semaphore.h>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_TASKSCHEDULERIMPL_HPP
|
||||
#define NAZARA_TASKSCHEDULERIMPL_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
#include <pthread.h>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_THREADIMPL_HPP
|
||||
#define NAZARA_THREADIMPL_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
|
||||
#if defined(__GNUC__) && !defined(_GNU_SOURCE)
|
||||
#define _GNU_SOURCE
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_CLOCKIMPL_WINDOWS_HPP
|
||||
#define NAZARA_CLOCKIMPL_WINDOWS_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#ifndef NAZARA_CONDITIONVARIABLEIMPL_HPP
|
||||
#define NAZARA_CONDITIONVARIABLEIMPL_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <atomic>
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_DIRECTORYIMPL_HPP
|
||||
#define NAZARA_DIRECTORYIMPL_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <windows.h>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_DYNLIBIMPL_HPP
|
||||
#define NAZARA_DYNLIBIMPL_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/DynLib.hpp>
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_FILEIMPL_HPP
|
||||
#define NAZARA_FILEIMPL_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/File.hpp>
|
||||
#include <ctime>
|
||||
#include <windows.h>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_HARDWAREINFOIMPL_WINDOWS_HPP
|
||||
#define NAZARA_HARDWAREINFOIMPL_WINDOWS_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_MUTEXIMPL_HPP
|
||||
#define NAZARA_MUTEXIMPL_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <windows.h>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_SEMAPHOREIMPL_HPP
|
||||
#define NAZARA_SEMAPHOREIMPL_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <windows.h>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_TASKSCHEDULERIMPL_HPP
|
||||
#define NAZARA_TASKSCHEDULERIMPL_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/Functor.hpp>
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
#ifdef NAZARA_COMPILER_MSVC
|
||||
namespace
|
||||
{
|
||||
#pragma pack(push,8)
|
||||
@@ -23,6 +24,7 @@ namespace Nz
|
||||
};
|
||||
#pragma pack(pop)
|
||||
}
|
||||
#endif
|
||||
|
||||
ThreadImpl::ThreadImpl(Functor* functor)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#ifndef NAZARA_THREADIMPL_HPP
|
||||
#define NAZARA_THREADIMPL_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_WINDOWS_TIME_HPP
|
||||
#define NAZARA_WINDOWS_TIME_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <ctime>
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_LOADERS_MESH_HPP
|
||||
#define NAZARA_LOADERS_MESH_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_LOADERS_TEXTURE_HPP
|
||||
#define NAZARA_LOADERS_TEXTURE_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <Lua/lualib.h>
|
||||
#include <Nazara/Core/Clock.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <stdexcept>
|
||||
@@ -35,7 +36,6 @@ namespace Nz
|
||||
m_state = lua_newstate(MemoryAllocator, this);
|
||||
lua_atpanic(m_state, AtPanic);
|
||||
lua_sethook(m_state, TimeLimiter, LUA_MASKCOUNT, 1000);
|
||||
luaL_openlibs(m_state);
|
||||
}
|
||||
|
||||
LuaInstance::LuaInstance(LuaInstance&& instance) :
|
||||
@@ -60,6 +60,48 @@ namespace Nz
|
||||
lua_close(m_state);
|
||||
}
|
||||
|
||||
void LuaInstance::LoadLibraries(LuaLibFlags libFlags)
|
||||
{
|
||||
// From luaL_openlibs
|
||||
std::array<luaL_Reg, LuaLib_Max + 1> libs;
|
||||
std::size_t libCount = 0;
|
||||
|
||||
libs[libCount++] = { "_G", luaopen_base };
|
||||
|
||||
if (libFlags & LuaLib_Coroutine)
|
||||
libs[libCount++] = { LUA_COLIBNAME, luaopen_coroutine };
|
||||
|
||||
if (libFlags & LuaLib_Debug)
|
||||
libs[libCount++] = { LUA_DBLIBNAME, luaopen_debug };
|
||||
|
||||
if (libFlags & LuaLib_Io)
|
||||
libs[libCount++] = { LUA_IOLIBNAME, luaopen_io };
|
||||
|
||||
if (libFlags & LuaLib_Math)
|
||||
libs[libCount++] = { LUA_MATHLIBNAME, luaopen_math };
|
||||
|
||||
if (libFlags & LuaLib_Os)
|
||||
libs[libCount++] = { LUA_OSLIBNAME, luaopen_os };
|
||||
|
||||
if (libFlags & LuaLib_Package)
|
||||
libs[libCount++] = { LUA_LOADLIBNAME, luaopen_package };
|
||||
|
||||
if (libFlags & LuaLib_String)
|
||||
libs[libCount++] = { LUA_STRLIBNAME, luaopen_string };
|
||||
|
||||
if (libFlags & LuaLib_Table)
|
||||
libs[libCount++] = { LUA_TABLIBNAME, luaopen_table };
|
||||
|
||||
if (libFlags & LuaLib_Utf8)
|
||||
libs[libCount++] = { LUA_UTF8LIBNAME, luaopen_utf8 };
|
||||
|
||||
for (std::size_t i = 0; i < libCount; ++i)
|
||||
{
|
||||
luaL_requiref(m_state, libs[i].name, libs[i].func, 1);
|
||||
lua_pop(m_state, 1); /* remove lib */
|
||||
}
|
||||
}
|
||||
|
||||
LuaInstance& LuaInstance::operator=(LuaInstance&& instance)
|
||||
{
|
||||
LuaState::operator=(std::move(instance));
|
||||
|
||||
@@ -9,6 +9,15 @@
|
||||
#include <cstring>
|
||||
#include <Nazara/Network/Debug.hpp>
|
||||
|
||||
// some MinGW distributions seem to lack some defines
|
||||
#ifndef ERROR_NOT_ENOUGH_MEMORY
|
||||
#define ERROR_NOT_ENOUGH_MEMORY 8L
|
||||
#endif
|
||||
|
||||
#ifndef WSA_NOT_ENOUGH_MEMORY
|
||||
#define WSA_NOT_ENOUGH_MEMORY (ERROR_NOT_ENOUGH_MEMORY)
|
||||
#endif
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
namespace Detail
|
||||
|
||||
@@ -8,8 +8,15 @@
|
||||
#include <Nazara/Core/MemoryHelper.hpp>
|
||||
#include <Nazara/Network/Win32/IpAddressImpl.hpp>
|
||||
|
||||
#if defined(NAZARA_COMPILER_MINGW) && __GNUC__ < 5
|
||||
// Some compilers (olders versions of MinGW) are lacking Mstcpip.h which defines the following struct/#define
|
||||
// Some compilers (older versions of MinGW) lack Mstcpip.h which defines some structs/defines
|
||||
#if defined(__has_include)
|
||||
#define NZ_HAS_MSTCPIP_HEADER __has_include(<Mstcpip.h>)
|
||||
#else
|
||||
// If this version of MinGW doesn't support __has_include, assume it hasn't Mstcpip.h
|
||||
#define NZ_HAS_MSTCPIP_HEADER !defined(NAZARA_COMPILER_MINGW)
|
||||
#endif
|
||||
|
||||
#if NZ_HAS_MSTCPIP_HEADER
|
||||
struct tcp_keepalive
|
||||
{
|
||||
u_long onoff;
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Nz
|
||||
#if NAZARA_NETWORK_POLL_SUPPORT
|
||||
return m_readyToReadSockets.count(socket) != 0;
|
||||
#else
|
||||
return FD_ISSET(socket, &m_readyToReadSockets) != 0;
|
||||
return FD_ISSET(socket, const_cast<fd_set*>(&m_readyToReadSockets)) != 0; //< FD_ISSET is not const-correct
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Nz
|
||||
#if NAZARA_NETWORK_POLL_SUPPORT
|
||||
return m_readyToWriteSockets.count(socket) != 0;
|
||||
#else
|
||||
return FD_ISSET(socket, &m_readyToWriteSockets) != 0;
|
||||
return FD_ISSET(socket, const_cast<fd_set*>(&m_readyToWriteSockets)) != 0; //< FD_ISSET is not const-correct
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -55,8 +55,9 @@ namespace Nz
|
||||
#if NAZARA_NETWORK_POLL_SUPPORT
|
||||
return m_allSockets.count(socket) != 0;
|
||||
#else
|
||||
return FD_ISSET(socket, &m_readSockets) != 0 ||
|
||||
FD_ISSET(socket, &m_writeSockets) != 0;
|
||||
// FD_ISSET is not const-correct
|
||||
return FD_ISSET(socket, const_cast<fd_set*>(&m_readSockets)) != 0 ||
|
||||
FD_ISSET(socket, const_cast<fd_set*>(&m_writeSockets)) != 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ namespace Nz
|
||||
}
|
||||
|
||||
PhysWorld2D::PhysWorld2D() :
|
||||
m_maxStepCount(50),
|
||||
m_stepSize(0.005f),
|
||||
m_timestepAccumulator(0.f)
|
||||
{
|
||||
@@ -144,6 +145,16 @@ namespace Nz
|
||||
return m_handle;
|
||||
}
|
||||
|
||||
std::size_t PhysWorld2D::GetIterationCount() const
|
||||
{
|
||||
return cpSpaceGetIterations(m_handle);
|
||||
}
|
||||
|
||||
std::size_t PhysWorld2D::GetMaxStepCount() const
|
||||
{
|
||||
return m_maxStepCount;
|
||||
}
|
||||
|
||||
float PhysWorld2D::GetStepSize() const
|
||||
{
|
||||
return m_stepSize;
|
||||
@@ -281,6 +292,16 @@ namespace Nz
|
||||
cpSpaceSetGravity(m_handle, cpv(gravity.x, gravity.y));
|
||||
}
|
||||
|
||||
void PhysWorld2D::SetIterationCount(std::size_t iterationCount)
|
||||
{
|
||||
cpSpaceSetIterations(m_handle, int(iterationCount));
|
||||
}
|
||||
|
||||
void PhysWorld2D::SetMaxStepCount(std::size_t maxStepCount)
|
||||
{
|
||||
m_maxStepCount = maxStepCount;
|
||||
}
|
||||
|
||||
void PhysWorld2D::SetStepSize(float stepSize)
|
||||
{
|
||||
m_stepSize = stepSize;
|
||||
@@ -290,7 +311,8 @@ namespace Nz
|
||||
{
|
||||
m_timestepAccumulator += timestep;
|
||||
|
||||
while (m_timestepAccumulator >= m_stepSize)
|
||||
std::size_t stepCount = 0;
|
||||
while (m_timestepAccumulator >= m_stepSize && stepCount < m_maxStepCount)
|
||||
{
|
||||
OnPhysWorld2DPreStep(this);
|
||||
|
||||
@@ -309,9 +331,15 @@ namespace Nz
|
||||
}
|
||||
|
||||
m_timestepAccumulator -= m_stepSize;
|
||||
stepCount++;
|
||||
}
|
||||
}
|
||||
|
||||
void PhysWorld2D::UseSpatialHash(float cellSize, std::size_t entityCount)
|
||||
{
|
||||
cpSpaceUseSpatialHash(m_handle, cpFloat(cellSize), int(entityCount));
|
||||
}
|
||||
|
||||
void PhysWorld2D::InitCallbacks(cpCollisionHandler* handler, const Callback& callbacks)
|
||||
{
|
||||
auto it = m_callbacks.emplace(handler, std::make_unique<Callback>(callbacks)).first;
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace Nz
|
||||
m_geom(),
|
||||
m_userData(nullptr),
|
||||
m_world(world),
|
||||
m_isRegistered(false),
|
||||
m_isSimulationEnabled(true),
|
||||
m_isStatic(false),
|
||||
m_gravityFactor(1.f),
|
||||
m_mass(mass)
|
||||
@@ -34,6 +36,8 @@ namespace Nz
|
||||
m_geom(object.m_geom),
|
||||
m_userData(object.m_userData),
|
||||
m_world(object.m_world),
|
||||
m_isRegistered(false),
|
||||
m_isSimulationEnabled(true),
|
||||
m_isStatic(object.m_isStatic),
|
||||
m_gravityFactor(object.m_gravityFactor),
|
||||
m_mass(object.GetMass())
|
||||
@@ -58,6 +62,8 @@ namespace Nz
|
||||
m_handle(object.m_handle),
|
||||
m_userData(object.m_userData),
|
||||
m_world(object.m_world),
|
||||
m_isRegistered(object.m_isRegistered),
|
||||
m_isSimulationEnabled(object.m_isSimulationEnabled),
|
||||
m_isStatic(object.m_isStatic),
|
||||
m_gravityFactor(object.m_gravityFactor),
|
||||
m_mass(object.m_mass)
|
||||
@@ -121,6 +127,19 @@ namespace Nz
|
||||
cpBodySetTorque(m_handle, cpBodyGetTorque(m_handle) + ToRadians(torque));
|
||||
}
|
||||
|
||||
void RigidBody2D::EnableSimulation(bool simulation)
|
||||
{
|
||||
if (m_isRegistered != simulation)
|
||||
{
|
||||
m_isRegistered = simulation;
|
||||
|
||||
if (simulation)
|
||||
RegisterToSpace();
|
||||
else
|
||||
UnregisterFromSpace();
|
||||
}
|
||||
}
|
||||
|
||||
Rectf RigidBody2D::GetAABB() const
|
||||
{
|
||||
if (m_shapes.empty())
|
||||
@@ -217,6 +236,11 @@ namespace Nz
|
||||
return m_mass <= 0.f;
|
||||
}
|
||||
|
||||
bool RigidBody2D::IsSimulationEnabled() const
|
||||
{
|
||||
return m_isRegistered;
|
||||
}
|
||||
|
||||
bool RigidBody2D::IsSleeping() const
|
||||
{
|
||||
return cpBodyIsSleeping(m_handle) != 0;
|
||||
@@ -244,6 +268,7 @@ namespace Nz
|
||||
cpBody* newHandle = Create(static_cast<float>(mass), static_cast<float>(moment));
|
||||
|
||||
CopyBodyData(m_handle, newHandle);
|
||||
|
||||
Destroy();
|
||||
|
||||
m_handle = newHandle;
|
||||
@@ -258,10 +283,10 @@ namespace Nz
|
||||
|
||||
cpSpace* space = m_world->GetHandle();
|
||||
for (cpShape* shape : m_shapes)
|
||||
{
|
||||
cpShapeSetUserData(shape, this);
|
||||
cpSpaceAddShape(space, shape);
|
||||
}
|
||||
|
||||
if (m_isSimulationEnabled)
|
||||
RegisterToSpace();
|
||||
|
||||
if (recomputeMoment)
|
||||
{
|
||||
@@ -383,14 +408,16 @@ namespace Nz
|
||||
OnRigidBody2DMove = std::move(object.OnRigidBody2DMove);
|
||||
OnRigidBody2DRelease = std::move(object.OnRigidBody2DRelease);
|
||||
|
||||
m_handle = object.m_handle;
|
||||
m_isStatic = object.m_isStatic;
|
||||
m_geom = std::move(object.m_geom);
|
||||
m_gravityFactor = object.m_gravityFactor;
|
||||
m_mass = object.m_mass;
|
||||
m_shapes = std::move(object.m_shapes);
|
||||
m_userData = object.m_userData;
|
||||
m_world = object.m_world;
|
||||
m_handle = object.m_handle;
|
||||
m_isRegistered = object.m_isRegistered;
|
||||
m_isSimulationEnabled = object.m_isSimulationEnabled;
|
||||
m_isStatic = object.m_isStatic;
|
||||
m_geom = std::move(object.m_geom);
|
||||
m_gravityFactor = object.m_gravityFactor;
|
||||
m_mass = object.m_mass;
|
||||
m_shapes = std::move(object.m_shapes);
|
||||
m_userData = object.m_userData;
|
||||
m_world = object.m_world;
|
||||
|
||||
cpBodySetUserData(m_handle, this);
|
||||
for (cpShape* shape : m_shapes)
|
||||
@@ -417,28 +444,54 @@ namespace Nz
|
||||
handle = cpBodyNew(mass, moment);
|
||||
|
||||
cpBodySetUserData(handle, this);
|
||||
cpSpaceAddBody(m_world->GetHandle(), handle);
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
||||
void RigidBody2D::Destroy()
|
||||
{
|
||||
UnregisterFromSpace();
|
||||
|
||||
cpSpace* space = m_world->GetHandle();
|
||||
for (cpShape* shape : m_shapes)
|
||||
{
|
||||
cpSpaceRemoveShape(space, shape);
|
||||
cpShapeFree(shape);
|
||||
}
|
||||
|
||||
if (m_handle)
|
||||
{
|
||||
cpSpaceRemoveBody(space, m_handle);
|
||||
cpBodyFree(m_handle);
|
||||
}
|
||||
|
||||
m_shapes.clear();
|
||||
}
|
||||
|
||||
void RigidBody2D::RegisterToSpace()
|
||||
{
|
||||
if (!m_isRegistered)
|
||||
{
|
||||
cpSpace* space = m_world->GetHandle();
|
||||
for (cpShape* shape : m_shapes)
|
||||
cpSpaceAddShape(space, shape);
|
||||
|
||||
if (m_handle)
|
||||
cpSpaceAddBody(space, m_handle);
|
||||
|
||||
m_isRegistered = true;
|
||||
}
|
||||
}
|
||||
|
||||
void RigidBody2D::UnregisterFromSpace()
|
||||
{
|
||||
if (m_isRegistered)
|
||||
{
|
||||
cpSpace* space = m_world->GetHandle();
|
||||
for (cpShape* shape : m_shapes)
|
||||
cpSpaceRemoveShape(space, shape);
|
||||
|
||||
if (m_handle)
|
||||
cpSpaceRemoveBody(space, m_handle);
|
||||
|
||||
m_isRegistered = false;
|
||||
}
|
||||
}
|
||||
|
||||
void RigidBody2D::CopyBodyData(cpBody* from, cpBody* to)
|
||||
{
|
||||
cpBodySetAngle(to, cpBodyGetAngle(from));
|
||||
|
||||
@@ -3,18 +3,23 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Physics3D/PhysWorld3D.hpp>
|
||||
#include <Nazara/Core/MemoryHelper.hpp>
|
||||
#include <Newton/Newton.h>
|
||||
#include <cassert>
|
||||
#include <Nazara/Physics3D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
PhysWorld3D::PhysWorld3D() :
|
||||
m_gravity(Vector3f::Zero()),
|
||||
m_maxStepCount(50),
|
||||
m_stepSize(0.005f),
|
||||
m_timestepAccumulator(0.f)
|
||||
{
|
||||
m_world = NewtonCreate();
|
||||
NewtonWorldSetUserData(m_world, this);
|
||||
|
||||
m_materialIds.emplace("default", NewtonMaterialGetDefaultGroupID(m_world));
|
||||
}
|
||||
|
||||
PhysWorld3D::~PhysWorld3D()
|
||||
@@ -22,6 +27,28 @@ namespace Nz
|
||||
NewtonDestroy(m_world);
|
||||
}
|
||||
|
||||
int PhysWorld3D::CreateMaterial(Nz::String name)
|
||||
{
|
||||
NazaraAssert(m_materialIds.find(name) == m_materialIds.end(), "Material \"" + name + "\" already exists");
|
||||
|
||||
int materialId = NewtonMaterialCreateGroupID(m_world);
|
||||
m_materialIds.emplace(std::move(name), materialId);
|
||||
|
||||
return materialId;
|
||||
}
|
||||
|
||||
void PhysWorld3D::ForEachBodyInAABB(const Nz::Boxf& box, const BodyIterator& iterator)
|
||||
{
|
||||
auto NewtonCallback = [](const NewtonBody* const body, void* const userdata) -> int
|
||||
{
|
||||
const BodyIterator& iterator = *static_cast<BodyIterator*>(userdata);
|
||||
RigidBody3D* nzBody = static_cast<RigidBody3D*>(NewtonBodyGetUserData(body));
|
||||
return iterator(*nzBody);
|
||||
};
|
||||
|
||||
NewtonWorldForEachBodyInAABBDo(m_world, box.GetMinimum(), box.GetMaximum(), NewtonCallback, const_cast<void*>(static_cast<const void*>(&iterator)));
|
||||
}
|
||||
|
||||
Vector3f PhysWorld3D::GetGravity() const
|
||||
{
|
||||
return m_gravity;
|
||||
@@ -32,6 +59,19 @@ namespace Nz
|
||||
return m_world;
|
||||
}
|
||||
|
||||
int PhysWorld3D::GetMaterial(const Nz::String& name)
|
||||
{
|
||||
auto it = m_materialIds.find(name);
|
||||
NazaraAssert(it != m_materialIds.end(), "Material \"" + name + "\" does not exists");
|
||||
|
||||
return it->second;
|
||||
}
|
||||
|
||||
std::size_t PhysWorld3D::GetMaxStepCount() const
|
||||
{
|
||||
return m_maxStepCount;
|
||||
}
|
||||
|
||||
float PhysWorld3D::GetStepSize() const
|
||||
{
|
||||
return m_stepSize;
|
||||
@@ -42,6 +82,11 @@ namespace Nz
|
||||
m_gravity = gravity;
|
||||
}
|
||||
|
||||
void PhysWorld3D::SetMaxStepCount(std::size_t maxStepCount)
|
||||
{
|
||||
m_maxStepCount = maxStepCount;
|
||||
}
|
||||
|
||||
void PhysWorld3D::SetSolverModel(unsigned int model)
|
||||
{
|
||||
NewtonSetSolverModel(m_world, model);
|
||||
@@ -52,14 +97,100 @@ namespace Nz
|
||||
m_stepSize = stepSize;
|
||||
}
|
||||
|
||||
void PhysWorld3D::SetMaterialCollisionCallback(int firstMaterial, int secondMaterial, AABBOverlapCallback aabbOverlapCallback, CollisionCallback collisionCallback)
|
||||
{
|
||||
static_assert(sizeof(Nz::UInt64) >= 2 * sizeof(int), "Oops");
|
||||
|
||||
auto callbackPtr = std::make_unique<Callback>();
|
||||
callbackPtr->aabbOverlapCallback = std::move(aabbOverlapCallback);
|
||||
callbackPtr->collisionCallback = std::move(collisionCallback);
|
||||
|
||||
NewtonMaterialSetCollisionCallback(m_world, firstMaterial, secondMaterial, callbackPtr.get(), (callbackPtr->aabbOverlapCallback) ? OnAABBOverlap : nullptr, (callbackPtr->collisionCallback) ? ProcessContact : nullptr);
|
||||
|
||||
Nz::UInt64 firstMaterialId(firstMaterial);
|
||||
Nz::UInt64 secondMaterialId(secondMaterial);
|
||||
|
||||
Nz::UInt64 callbackIndex = firstMaterialId << 32 | secondMaterialId;
|
||||
m_callbacks[callbackIndex] = std::move(callbackPtr);
|
||||
}
|
||||
|
||||
void PhysWorld3D::SetMaterialDefaultCollidable(int firstMaterial, int secondMaterial, bool collidable)
|
||||
{
|
||||
NewtonMaterialSetDefaultCollidable(m_world, firstMaterial, secondMaterial, collidable);
|
||||
}
|
||||
|
||||
void PhysWorld3D::SetMaterialDefaultElasticity(int firstMaterial, int secondMaterial, float elasticCoef)
|
||||
{
|
||||
NewtonMaterialSetDefaultElasticity(m_world, firstMaterial, secondMaterial, elasticCoef);
|
||||
}
|
||||
|
||||
void PhysWorld3D::SetMaterialDefaultFriction(int firstMaterial, int secondMaterial, float staticFriction, float kineticFriction)
|
||||
{
|
||||
NewtonMaterialSetDefaultFriction(m_world, firstMaterial, secondMaterial, staticFriction, kineticFriction);
|
||||
}
|
||||
|
||||
void PhysWorld3D::SetMaterialDefaultSoftness(int firstMaterial, int secondMaterial, float softness)
|
||||
{
|
||||
NewtonMaterialSetDefaultSoftness(m_world, firstMaterial, secondMaterial, softness);
|
||||
}
|
||||
|
||||
void PhysWorld3D::SetMaterialSurfaceThickness(int firstMaterial, int secondMaterial, float thickness)
|
||||
{
|
||||
NewtonMaterialSetSurfaceThickness(m_world, firstMaterial, secondMaterial, thickness);
|
||||
}
|
||||
|
||||
void PhysWorld3D::Step(float timestep)
|
||||
{
|
||||
m_timestepAccumulator += timestep;
|
||||
|
||||
while (m_timestepAccumulator >= m_stepSize)
|
||||
std::size_t stepCount = 0;
|
||||
while (m_timestepAccumulator >= m_stepSize && stepCount < m_maxStepCount)
|
||||
{
|
||||
NewtonUpdate(m_world, m_stepSize);
|
||||
m_timestepAccumulator -= m_stepSize;
|
||||
stepCount++;
|
||||
}
|
||||
}
|
||||
|
||||
int PhysWorld3D::OnAABBOverlap(const NewtonMaterial* const material, const NewtonBody* const body0, const NewtonBody* const body1, int threadIndex)
|
||||
{
|
||||
Nz::RigidBody3D* bodyA = static_cast<Nz::RigidBody3D*>(NewtonBodyGetUserData(body0));
|
||||
Nz::RigidBody3D* bodyB = static_cast<Nz::RigidBody3D*>(NewtonBodyGetUserData(body1));
|
||||
assert(bodyA && bodyB);
|
||||
|
||||
Callback* callbackData = static_cast<Callback*>(NewtonMaterialGetMaterialPairUserData(material));
|
||||
assert(callbackData);
|
||||
assert(callbackData->aabbOverlapCallback);
|
||||
|
||||
return callbackData->aabbOverlapCallback(*bodyA, *bodyB);
|
||||
}
|
||||
|
||||
void PhysWorld3D::ProcessContact(const NewtonJoint* const contactJoint, float timestep, int threadIndex)
|
||||
{
|
||||
Nz::RigidBody3D* bodyA = static_cast<Nz::RigidBody3D*>(NewtonBodyGetUserData(NewtonJointGetBody0(contactJoint)));
|
||||
Nz::RigidBody3D* bodyB = static_cast<Nz::RigidBody3D*>(NewtonBodyGetUserData(NewtonJointGetBody1(contactJoint)));
|
||||
assert(bodyA && bodyB);
|
||||
|
||||
using ContactJoint = void*;
|
||||
|
||||
// Query all joints first, to prevent removing a joint from the list while iterating on it
|
||||
Nz::StackArray<ContactJoint> contacts = NazaraStackAllocationNoInit(ContactJoint, NewtonContactJointGetContactCount(contactJoint));
|
||||
std::size_t contactIndex = 0;
|
||||
for (ContactJoint contact = NewtonContactJointGetFirstContact(contactJoint); contact; contact = NewtonContactJointGetNextContact(contactJoint, contact))
|
||||
{
|
||||
assert(contactIndex < contacts.size());
|
||||
contacts[contactIndex++] = contact;
|
||||
}
|
||||
|
||||
for (ContactJoint contact : contacts)
|
||||
{
|
||||
NewtonMaterial* material = NewtonContactGetMaterial(contact);
|
||||
Callback* callbackData = static_cast<Callback*>(NewtonMaterialGetMaterialPairUserData(material));
|
||||
assert(callbackData);
|
||||
assert(callbackData->collisionCallback);
|
||||
|
||||
if (!callbackData->collisionCallback(*bodyA, *bodyB))
|
||||
NewtonContactJointRemoveContact(contactJoint, contact);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,6 +216,11 @@ namespace Nz
|
||||
return center;
|
||||
}
|
||||
|
||||
int RigidBody3D::GetMaterial() const
|
||||
{
|
||||
return NewtonBodyGetMaterialGroupID(m_body);
|
||||
}
|
||||
|
||||
const Matrix4f& RigidBody3D::GetMatrix() const
|
||||
{
|
||||
return m_matrix;
|
||||
@@ -231,6 +236,11 @@ namespace Nz
|
||||
return m_matrix.GetRotation();
|
||||
}
|
||||
|
||||
void* RigidBody3D::GetUserdata() const
|
||||
{
|
||||
return m_userdata;
|
||||
}
|
||||
|
||||
PhysWorld3D* RigidBody3D::GetWorld() const
|
||||
{
|
||||
return m_world;
|
||||
@@ -335,6 +345,16 @@ namespace Nz
|
||||
NewtonBodySetCentreOfMass(m_body, center);
|
||||
}
|
||||
|
||||
void RigidBody3D::SetMaterial(const Nz::String& materialName)
|
||||
{
|
||||
SetMaterial(m_world->GetMaterial(materialName));
|
||||
}
|
||||
|
||||
void RigidBody3D::SetMaterial(int materialIndex)
|
||||
{
|
||||
NewtonBodySetMaterialGroupID(m_body, materialIndex);
|
||||
}
|
||||
|
||||
void RigidBody3D::SetPosition(const Vector3f& position)
|
||||
{
|
||||
m_matrix.SetTranslation(position);
|
||||
@@ -349,6 +369,11 @@ namespace Nz
|
||||
UpdateBody();
|
||||
}
|
||||
|
||||
void RigidBody3D::SetUserdata(void* ud)
|
||||
{
|
||||
m_userdata = ud;
|
||||
}
|
||||
|
||||
RigidBody3D& RigidBody3D::operator=(const RigidBody3D& object)
|
||||
{
|
||||
RigidBody3D physObj(object);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_CURSORIMPL_HPP
|
||||
#define NAZARA_CURSORIMPL_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Platform/Enums.hpp>
|
||||
#include <array>
|
||||
#include <windows.h>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_ICONIMPL_HPP
|
||||
#define NAZARA_ICONIMPL_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <windows.h>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#ifndef NAZARA_WINDOWIMPL_HPP
|
||||
#define NAZARA_WINDOWIMPL_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Core/Thread.hpp>
|
||||
#include <Nazara/Math/Rect.hpp>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_CURSORIMPL_HPP
|
||||
#define NAZARA_CURSORIMPL_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Platform/Enums.hpp>
|
||||
#include <xcb/xcb_cursor.h>
|
||||
#include <array>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_X11DISPLAY_HPP
|
||||
#define NAZARA_X11DISPLAY_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Platform/Config.hpp>
|
||||
#include <xcb/xcb.h>
|
||||
#include <xcb/xcb_ewmh.h>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_ICONIMPL_HPP
|
||||
#define NAZARA_ICONIMPL_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Platform/X11/ScopedXCB.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_INPUTIMPL_HPP
|
||||
#define NAZARA_INPUTIMPL_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Math/Vector2.hpp>
|
||||
#include <Nazara/Platform/Keyboard.hpp>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_SCOPEDXCB_HPP
|
||||
#define NAZARA_SCOPEDXCB_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <xcb/xcb.h>
|
||||
#include <xcb/xcb_ewmh.h>
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_VIDEOMODEIMPL_HPP
|
||||
#define NAZARA_VIDEOMODEIMPL_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Platform/VideoMode.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#ifndef NAZARA_WINDOWIMPL_HPP
|
||||
#define NAZARA_WINDOWIMPL_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/Thread.hpp>
|
||||
#include <Nazara/Math/Vector2.hpp>
|
||||
#include <Nazara/Platform/Enums.hpp>
|
||||
|
||||
44
src/Nazara/Renderer/HardwareBuffer.hpp
Normal file
44
src/Nazara/Renderer/HardwareBuffer.hpp
Normal file
@@ -0,0 +1,44 @@
|
||||
// Copyright (C) 2017 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Renderer module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_HARDWAREBUFFER_HPP
|
||||
#define NAZARA_HARDWAREBUFFER_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Renderer/OpenGL.hpp>
|
||||
#include <Nazara/Utility/AbstractBuffer.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class Buffer;
|
||||
|
||||
class HardwareBuffer : public AbstractBuffer
|
||||
{
|
||||
public:
|
||||
HardwareBuffer(Buffer* parent, BufferType type);
|
||||
~HardwareBuffer();
|
||||
|
||||
bool Fill(const void* data, UInt32 offset, UInt32 size) override;
|
||||
|
||||
bool Initialize(unsigned int size, BufferUsageFlags usage) override;
|
||||
|
||||
DataStorage GetStorage() const override;
|
||||
|
||||
void* Map(BufferAccess access, UInt32 offset = 0, UInt32 size = 0) override;
|
||||
bool Unmap() override;
|
||||
|
||||
// Fonctions OpenGL
|
||||
void Bind() const;
|
||||
GLuint GetOpenGLID() const;
|
||||
|
||||
private:
|
||||
GLuint m_buffer;
|
||||
BufferType m_type;
|
||||
Buffer* m_parent;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // NAZARA_HARDWAREBUFFER_HPP
|
||||
41
src/Nazara/Renderer/Win32/ContextImpl.hpp
Normal file
41
src/Nazara/Renderer/Win32/ContextImpl.hpp
Normal file
@@ -0,0 +1,41 @@
|
||||
// Copyright (C) 2017 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_CONTEXTIMPL_HPP
|
||||
#define NAZARA_CONTEXTIMPL_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Renderer/ContextParameters.hpp>
|
||||
#include <windows.h>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class ContextImpl
|
||||
{
|
||||
public:
|
||||
ContextImpl();
|
||||
|
||||
bool Activate() const;
|
||||
|
||||
bool Create(ContextParameters& parameters);
|
||||
|
||||
void Destroy();
|
||||
|
||||
void EnableVerticalSync(bool enabled);
|
||||
|
||||
void SwapBuffers();
|
||||
|
||||
static bool Desactivate();
|
||||
|
||||
private:
|
||||
HDC m_deviceContext;
|
||||
HGLRC m_context;
|
||||
HWND m_window;
|
||||
bool m_ownsWindow;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // NAZARA_CONTEXTIMPL_HPP
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_LOADERS_DDS_CONSTANTS_HPP
|
||||
#define NAZARA_LOADERS_DDS_CONSTANTS_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/SerializationContext.hpp>
|
||||
#include <Nazara/Utility/Config.hpp>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_LOADERS_DDS_HPP
|
||||
#define NAZARA_LOADERS_DDS_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_LOADERS_FREETYPE_HPP
|
||||
#define NAZARA_LOADERS_FREETYPE_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifndef NAZARA_LOADERS_MD2_CONSTANTS_HPP
|
||||
#define NAZARA_LOADERS_MD2_CONSTANTS_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_LOADERS_MD2_HPP
|
||||
#define NAZARA_LOADERS_MD2_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_LOADERS_MD5ANIM_HPP
|
||||
#define NAZARA_LOADERS_MD5ANIM_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_LOADERS_MD5MESH_HPP
|
||||
#define NAZARA_LOADERS_MD5MESH_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_LOADERS_OBJ_HPP
|
||||
#define NAZARA_LOADERS_OBJ_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_FORMATS_OBJSAVER_HPP
|
||||
#define NAZARA_FORMATS_OBJSAVER_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_LOADERS_PCX_HPP
|
||||
#define NAZARA_LOADERS_PCX_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_FORMATS_STBLOADER_HPP
|
||||
#define NAZARA_FORMATS_STBLOADER_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#ifndef NAZARA_FORMATS_STBSAVER_HPP
|
||||
#define NAZARA_FORMATS_STBSAVER_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
||||
@@ -354,7 +354,7 @@ namespace Nz
|
||||
{
|
||||
glyph.atlas = nullptr;
|
||||
|
||||
glyph.bounds.Set(float(m_drawPos.x), float(m_drawPos.y), float(advance), float(sizeInfo.lineHeight));
|
||||
glyph.bounds.Set(float(m_drawPos.x), float(0.f), float(advance), float(sizeInfo.lineHeight));
|
||||
|
||||
glyph.corners[0].Set(glyph.bounds.GetCorner(RectCorner_LeftTop));
|
||||
glyph.corners[1].Set(glyph.bounds.GetCorner(RectCorner_RightTop));
|
||||
|
||||
Reference in New Issue
Block a user