Fix compilation for gcc/clang + tests for serialization

Former-commit-id: db9c93a1db3c57f268fc17e411402e071fc8675a
This commit is contained in:
Gawaboumga
2016-04-04 10:17:05 +02:00
parent 85c2cd43e7
commit 265e1c0fbd
20 changed files with 747 additions and 22 deletions

View File

@@ -87,7 +87,6 @@ namespace Nz
static bool OpenDevice();
static OpenALFunc LoadEntry(const char* name, bool throwException = false);
};
}
// al
NAZARA_AUDIO_API extern OpenALDetail::LPALBUFFER3F alBuffer3f;
@@ -186,6 +185,8 @@ NAZARA_AUDIO_API extern OpenALDetail::LPALCOPENDEVICE alcOpenDevice;
NAZARA_AUDIO_API extern OpenALDetail::LPALCPROCESSCONTEXT alcProcessContext;
NAZARA_AUDIO_API extern OpenALDetail::LPALCSUSPENDCONTEXT alcSuspendContext;
}
#endif // NAZARA_AUDIO_OPENAL
#endif // NAZARA_OPENAL_HPP

View File

@@ -27,6 +27,7 @@ namespace Nz
friend Type;
public:
using ExtensionGetter = bool (*)(const String& extension);
using FormatQuerier = bool (*)(const String& format);
using FileSaver = bool (*)(const Type& resource, const String& filePath, const Parameters& parameters);
using StreamSaver = bool (*)(const Type& resource, const String& format, Stream& stream, const Parameters& parameters);

View File

@@ -28,7 +28,7 @@ namespace Nz
{
for (Saver& saver : Type::s_savers)
{
ExtensionGetter isExtensionSupported = std::get<0>(loader);
ExtensionGetter isExtensionSupported = std::get<0>(saver);
if (isExtensionSupported && isExtensionSupported(extension))
return true;

View File

@@ -30,7 +30,7 @@ namespace Nz
SkyboxBackground(TextureRef cubemapTexture = TextureRef());
~SkyboxBackground() = default;
void Draw(const AbstractViewer* viewer) const;
void Draw(const AbstractViewer* viewer) const override;
BackgroundType GetBackgroundType() const override;
inline const Vector3f& GetMovementOffset() const;

View File

@@ -636,7 +636,7 @@ namespace Nz
if (extend > Extend_Max)
return false;
boundingVolume->extend = extend;
boundingVolume->extend = static_cast<Extend>(extend);
if (!Unserialize(context, &boundingVolume->aabb))
return false;

View File

@@ -55,6 +55,11 @@ namespace Nz
String ToString() const;
template<typename U>
friend bool Serialize(SerializationContext& context, const Frustum<U>& frustum);
template<typename U>
friend bool Unserialize(SerializationContext& context, Frustum<U>* frustum);
private:
Vector3<T> m_corners[BoxCorner_Max+1];
Plane<T> m_planes[FrustumPlane_Max+1];
@@ -62,9 +67,6 @@ namespace Nz
typedef Frustum<double> Frustumd;
typedef Frustum<float> Frustumf;
template<typename T> bool Serialize(SerializationContext& context, const Frustum<T>& frustum);
template<typename T> bool Unserialize(SerializationContext& context, Frustum<T>* frustum);
}
template<typename T>

View File

@@ -688,13 +688,13 @@ namespace Nz
{
for (unsigned int i = 0; i <= BoxCorner_Max; ++i)
{
if (!Serialize(context, m_corners[i]))
if (!Serialize(context, frustum.m_corners[i]))
return false;
}
for (unsigned int i = 0; i <= FrustumPlane_Max; ++i)
{
if (!Serialize(context, m_planes[i]))
if (!Serialize(context, frustum.m_planes[i]))
return false;
}
@@ -702,24 +702,24 @@ namespace Nz
}
/*!
* \brief Unserializes a Matrix4
* \brief Unserializes a Frustum
* \return true if successfully unserialized
*
* \param context Serialization context
* \param matrix Output matrix
* \param matrix Output frustum
*/
template<typename T>
bool Unserialize(SerializationContext& context, Frustum<T>* frustum)
{
for (unsigned int i = 0; i <= BoxCorner_Max; ++i)
{
if (!Unserialize(context, &m_corners[i]))
if (!Unserialize(context, &frustum->m_corners[i]))
return false;
}
for (unsigned int i = 0; i <= FrustumPlane_Max; ++i)
{
if (!Unserialize(context, &m_planes[i]))
if (!Unserialize(context, &frustum->m_planes[i]))
return false;
}

View File

@@ -119,6 +119,10 @@ namespace Nz
struct PeerData //TODO: Move this to RUdpClient
{
PeerData() = default;
PeerData(PeerData&& other) = default;
PeerData& operator=(PeerData&& other) = default;
std::array<std::vector<PendingPacket>, PacketPriority_Max + 1> pendingPackets;
std::deque<PendingAckPacket> pendingAckQueue;
std::set<UInt16> receivedQueue;
@@ -153,6 +157,6 @@ namespace Nz
};
}
#include <Nazara/Network/RudpConnection.inl>
#include <Nazara/Network/RUdpConnection.inl>
#endif // NAZARA_RUDPSERVER_HPP
#endif // NAZARA_RUDPSERVER_HPP

View File

@@ -153,7 +153,6 @@ namespace Nz
static void OnContextChanged(const Context* newContext);
static void OnContextDestruction(const Context* context);
};
}
NAZARA_RENDERER_API extern PFNGLACTIVETEXTUREPROC glActiveTexture;
NAZARA_RENDERER_API extern PFNGLATTACHSHADERPROC glAttachShader;
@@ -336,6 +335,8 @@ NAZARA_RENDERER_API extern GLX::PFNGLXSWAPINTERVALMESAPROC NzglXSwapInter
NAZARA_RENDERER_API extern GLX::PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI;
#endif
}
#endif // NAZARA_RENDERER_OPENGL
#endif // NAZARA_OPENGL_HPP