Get rid of STK::Tuple

This commit is contained in:
Benau 2017-03-16 09:16:06 +08:00
parent cc2c2c6f33
commit 1ba3fce7b8
9 changed files with 163 additions and 277 deletions

View File

@ -28,9 +28,9 @@ void InstanceFiller<InstanceDataSingleTex>::add(GLMesh* mesh,
const InstanceSettings& is, const InstanceSettings& is,
InstanceDataSingleTex& instance) InstanceDataSingleTex& instance)
{ {
fillOriginOrientationScale<InstanceDataSingleTex>(STK::tuple_get<0>(is), instance); fillOriginOrientationScale<InstanceDataSingleTex>(std::get<0>(is), instance);
instance.Texture = mesh->TextureHandles[0]; instance.Texture = mesh->TextureHandles[0];
instance.skinning_offset = STK::tuple_get<3>(is); instance.skinning_offset = std::get<3>(is);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -39,15 +39,15 @@ void InstanceFiller<InstanceDataThreeTex>::add(GLMesh* mesh,
const InstanceSettings& is, const InstanceSettings& is,
InstanceDataThreeTex& instance) InstanceDataThreeTex& instance)
{ {
fillOriginOrientationScale<InstanceDataThreeTex>(STK::tuple_get<0>(is), instance); fillOriginOrientationScale<InstanceDataThreeTex>(std::get<0>(is), instance);
instance.MiscData.X = STK::tuple_get<1>(is).X; instance.MiscData.X = std::get<1>(is).X;
instance.MiscData.Y = STK::tuple_get<1>(is).Y; instance.MiscData.Y = std::get<1>(is).Y;
instance.MiscData.Z = STK::tuple_get<2>(is).X; instance.MiscData.Z = std::get<2>(is).X;
instance.MiscData.W = STK::tuple_get<2>(is).Y; instance.MiscData.W = std::get<2>(is).Y;
instance.Texture = mesh->TextureHandles[0]; instance.Texture = mesh->TextureHandles[0];
instance.SecondTexture = mesh->TextureHandles[1]; instance.SecondTexture = mesh->TextureHandles[1];
instance.ThirdTexture = mesh->TextureHandles[2]; instance.ThirdTexture = mesh->TextureHandles[2];
instance.skinning_offset = STK::tuple_get<3>(is); instance.skinning_offset = std::get<3>(is);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -56,16 +56,16 @@ void InstanceFiller<InstanceDataFourTex>::add(GLMesh* mesh,
const InstanceSettings& is, const InstanceSettings& is,
InstanceDataFourTex& instance) InstanceDataFourTex& instance)
{ {
fillOriginOrientationScale<InstanceDataFourTex>(STK::tuple_get<0>(is), instance); fillOriginOrientationScale<InstanceDataFourTex>(std::get<0>(is), instance);
instance.MiscData.X = STK::tuple_get<1>(is).X; instance.MiscData.X = std::get<1>(is).X;
instance.MiscData.Y = STK::tuple_get<1>(is).Y; instance.MiscData.Y = std::get<1>(is).Y;
instance.MiscData.Z = STK::tuple_get<2>(is).X; instance.MiscData.Z = std::get<2>(is).X;
instance.MiscData.W = STK::tuple_get<2>(is).Y; instance.MiscData.W = std::get<2>(is).Y;
instance.Texture = mesh->TextureHandles[0]; instance.Texture = mesh->TextureHandles[0];
instance.SecondTexture = mesh->TextureHandles[1]; instance.SecondTexture = mesh->TextureHandles[1];
instance.ThirdTexture = mesh->TextureHandles[2]; instance.ThirdTexture = mesh->TextureHandles[2];
instance.FourthTexture = mesh->TextureHandles[3]; instance.FourthTexture = mesh->TextureHandles[3];
instance.skinning_offset = STK::tuple_get<3>(is); instance.skinning_offset = std::get<3>(is);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -74,7 +74,7 @@ void InstanceFiller<GlowInstanceData>::add(GLMesh* mesh,
const InstanceSettings& is, const InstanceSettings& is,
GlowInstanceData& instance) GlowInstanceData& instance)
{ {
scene::ISceneNode* node = STK::tuple_get<0>(is); scene::ISceneNode* node = std::get<0>(is);
fillOriginOrientationScale<GlowInstanceData>(node, instance); fillOriginOrientationScale<GlowInstanceData>(node, instance);
STKMeshSceneNode *nd = dynamic_cast<STKMeshSceneNode*>(node); STKMeshSceneNode *nd = dynamic_cast<STKMeshSceneNode*>(node);
instance.Color = nd->getGlowColor().color; instance.Color = nd->getGlowColor().color;

View File

@ -32,7 +32,7 @@ void renderMeshes1stPass()
glBindVertexArray(VAOManager::getInstance()->getVAO(T::VertexType)); glBindVertexArray(VAOManager::getInstance()->getVAO(T::VertexType));
for (unsigned i = 0; i < meshes.size(); i++) for (unsigned i = 0; i < meshes.size(); i++)
{ {
GLMesh &mesh = *(STK::tuple_get<0>(meshes.at(i))); GLMesh &mesh = *(std::get<0>(meshes.at(i)));
if (!CVS->isARBBaseInstanceUsable()) if (!CVS->isARBBaseInstanceUsable())
glBindVertexArray(mesh.vao); glBindVertexArray(mesh.vao);
if (mesh.VAOType != T::VertexType) if (mesh.VAOType != T::VertexType)
@ -62,7 +62,7 @@ void renderMeshes2ndPass( const std::vector<uint64_t> &Prefilled_Handle,
glBindVertexArray(VAOManager::getInstance()->getVAO(T::VertexType)); glBindVertexArray(VAOManager::getInstance()->getVAO(T::VertexType));
for (unsigned i = 0; i < meshes.size(); i++) for (unsigned i = 0; i < meshes.size(); i++)
{ {
GLMesh &mesh = *(STK::tuple_get<0>(meshes.at(i))); GLMesh &mesh = *(std::get<0>(meshes.at(i)));
if (!CVS->isARBBaseInstanceUsable()) if (!CVS->isARBBaseInstanceUsable())
glBindVertexArray(mesh.vao); glBindVertexArray(mesh.vao);
@ -101,7 +101,7 @@ void renderMeshes2ndPass<GrassMat, 4, 3, 1>
glBindVertexArray(VAOManager::getInstance()->getVAO(GrassMat::VertexType)); glBindVertexArray(VAOManager::getInstance()->getVAO(GrassMat::VertexType));
for (unsigned i = 0; i < meshes.size(); i++) for (unsigned i = 0; i < meshes.size(); i++)
{ {
GLMesh &mesh = *(STK::tuple_get<0>(meshes.at(i))); GLMesh &mesh = *(std::get<0>(meshes.at(i)));
if (!CVS->isARBBaseInstanceUsable()) if (!CVS->isARBBaseInstanceUsable())
glBindVertexArray(mesh.vao); glBindVertexArray(mesh.vao);
@ -142,7 +142,7 @@ void renderShadow(unsigned cascade)
glBindVertexArray(VAOManager::getInstance()->getVAO(T::VertexType)); glBindVertexArray(VAOManager::getInstance()->getVAO(T::VertexType));
for (unsigned i = 0; i < t.size(); i++) for (unsigned i = 0; i < t.size(); i++)
{ {
GLMesh *mesh = STK::tuple_get<0>(t.at(i)); GLMesh *mesh = std::get<0>(t.at(i));
if (!CVS->isARBBaseInstanceUsable()) if (!CVS->isARBBaseInstanceUsable())
glBindVertexArray(mesh->vao); glBindVertexArray(mesh->vao);
if (CVS->isAZDOEnabled()) if (CVS->isAZDOEnabled())
@ -164,7 +164,7 @@ void drawRSM(const core::matrix4 & rsm_matrix)
for (unsigned i = 0; i < t.size(); i++) for (unsigned i = 0; i < t.size(); i++)
{ {
std::vector<GLuint> Textures; std::vector<GLuint> Textures;
GLMesh *mesh = STK::tuple_get<0>(t.at(i)); GLMesh *mesh = std::get<0>(t.at(i));
if (!CVS->isARBBaseInstanceUsable()) if (!CVS->isARBBaseInstanceUsable())
glBindVertexArray(mesh->vao); glBindVertexArray(mesh->vao);
if (CVS->isAZDOEnabled()) if (CVS->isAZDOEnabled())

View File

@ -40,10 +40,10 @@ struct CustomUnrollArgs<n, list...>
template<typename S, template<typename S,
typename ...TupleTypes, typename ...TupleTypes,
typename ...Args> typename ...Args>
static void drawMesh(const STK::Tuple<TupleTypes...> &t, static void drawMesh(const std::tuple<TupleTypes...> &t,
Args... args) Args... args)
{ {
CustomUnrollArgs<list...>::template drawMesh<S>(t, STK::tuple_get<n>(t), args...); CustomUnrollArgs<list...>::template drawMesh<S>(t, std::get<n>(t), args...);
} // drawMesh } // drawMesh
}; // CustomUnrollArgs }; // CustomUnrollArgs
@ -56,11 +56,11 @@ struct CustomUnrollArgs<>
template<typename S, template<typename S,
typename ...TupleTypes, typename ...TupleTypes,
typename ...Args> typename ...Args>
static void drawMesh(const STK::Tuple<TupleTypes...> &t, static void drawMesh(const std::tuple<TupleTypes...> &t,
Args... args) Args... args)
{ {
irr_driver->increaseObjectCount(); //TODO: move somewhere else irr_driver->increaseObjectCount(); //TODO: move somewhere else
GLMesh *mesh = STK::tuple_get<0>(t); GLMesh *mesh = std::get<0>(t);
if (!mesh->mb->getMaterial().BackfaceCulling) if (!mesh->mb->getMaterial().BackfaceCulling)
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
S::getInstance()->setUniforms(args...); S::getInstance()->setUniforms(args...);
@ -82,10 +82,10 @@ struct TexExpanderImpl
template<typename...TupleArgs, template<typename...TupleArgs,
typename... Args> typename... Args>
static void expandTex(const GLMesh &mesh, static void expandTex(const GLMesh &mesh,
const STK::Tuple<TupleArgs...> &tex_swizzle, const std::tuple<TupleArgs...> &tex_swizzle,
Args... args) Args... args)
{ {
size_t idx = STK::tuple_get<sizeof...(TupleArgs) - N>(tex_swizzle); size_t idx = std::get<sizeof...(TupleArgs) - N>(tex_swizzle);
TexExpanderImpl<T, N - 1>::template expandTex(mesh, tex_swizzle, TexExpanderImpl<T, N - 1>::template expandTex(mesh, tex_swizzle,
args..., mesh.textures[idx]->getOpenGLTextureName()); args..., mesh.textures[idx]->getOpenGLTextureName());
} // ExpandTex } // ExpandTex
@ -98,7 +98,7 @@ struct TexExpanderImpl<T, 0>
{ {
template<typename...TupleArgs, typename... Args> template<typename...TupleArgs, typename... Args>
static void expandTex(const GLMesh &mesh, static void expandTex(const GLMesh &mesh,
const STK::Tuple<TupleArgs...> &tex_swizzle, const std::tuple<TupleArgs...> &tex_swizzle,
Args... args) Args... args)
{ {
T::getInstance()->setTextureUnits(args...); T::getInstance()->setTextureUnits(args...);
@ -117,7 +117,7 @@ struct TexExpander
template<typename...TupleArgs, template<typename...TupleArgs,
typename... Args> typename... Args>
static void expandTex(const GLMesh &mesh, static void expandTex(const GLMesh &mesh,
const STK::Tuple<TupleArgs...> &tex_swizzle, const std::tuple<TupleArgs...> &tex_swizzle,
Args... args) Args... args)
{ {
TexExpanderImpl<T, sizeof...(TupleArgs)>::expandTex(mesh, TexExpanderImpl<T, sizeof...(TupleArgs)>::expandTex(mesh,
@ -134,10 +134,10 @@ struct HandleExpanderImpl
{ {
template<typename...TupleArgs, typename... Args> template<typename...TupleArgs, typename... Args>
static void expand(uint64_t *texture_handles, static void expand(uint64_t *texture_handles,
const STK::Tuple<TupleArgs...> &tex_swizzle, const std::tuple<TupleArgs...> &tex_swizzle,
Args... args) Args... args)
{ {
size_t idx = STK::tuple_get<sizeof...(TupleArgs)-N>(tex_swizzle); size_t idx = std::get<sizeof...(TupleArgs)-N>(tex_swizzle);
HandleExpanderImpl<T, N - 1>::template expand(texture_handles, HandleExpanderImpl<T, N - 1>::template expand(texture_handles,
tex_swizzle, tex_swizzle,
args..., args...,
@ -152,7 +152,7 @@ struct HandleExpanderImpl<T, 0>
{ {
template<typename...TupleArgs, typename... Args> template<typename...TupleArgs, typename... Args>
static void expand(uint64_t *texture_handles, static void expand(uint64_t *texture_handles,
const STK::Tuple<TupleArgs...> &tex_swizzle, const std::tuple<TupleArgs...> &tex_swizzle,
Args... args) Args... args)
{ {
T::getInstance()->setTextureHandles(args...); T::getInstance()->setTextureHandles(args...);
@ -174,7 +174,7 @@ struct HandleExpander
template<typename...TupleArgs, template<typename...TupleArgs,
typename... Args> typename... Args>
static void expand(uint64_t *texture_handles, static void expand(uint64_t *texture_handles,
const STK::Tuple<TupleArgs...> &tex_swizzle, const std::tuple<TupleArgs...> &tex_swizzle,
Args... args) Args... args)
{ {
HandleExpanderImpl<T, sizeof...(TupleArgs)>::expand(texture_handles, HandleExpanderImpl<T, sizeof...(TupleArgs)>::expand(texture_handles,

View File

@ -26,7 +26,7 @@
#include "graphics/shaders.hpp" #include "graphics/shaders.hpp"
#include "modes/world.hpp" #include "modes/world.hpp"
#include "tracks/track.hpp" #include "tracks/track.hpp"
#include "utils/tuple.hpp" #include <tuple>
#include <SColor.h> #include <SColor.h>
#include <S3DVertex.h> #include <S3DVertex.h>
@ -199,14 +199,14 @@ void AbstractGeometryPasses::setFirstPassRenderTargets(const std::vector<GLuint>
template<typename Shader, enum video::E_VERTEX_TYPE VertexType, int...List, template<typename Shader, enum video::E_VERTEX_TYPE VertexType, int...List,
typename... TupleType> typename... TupleType>
void renderTransparenPass(const std::vector<RenderGeometry::TexUnit> &TexUnits, void renderTransparenPass(const std::vector<RenderGeometry::TexUnit> &TexUnits,
std::vector<STK::Tuple<TupleType...> > *meshes) std::vector<std::tuple<TupleType...> > *meshes)
{ {
Shader::getInstance()->use(); Shader::getInstance()->use();
if (CVS->isARBBaseInstanceUsable()) if (CVS->isARBBaseInstanceUsable())
glBindVertexArray(VAOManager::getInstance()->getVAO(VertexType)); glBindVertexArray(VAOManager::getInstance()->getVAO(VertexType));
for (unsigned i = 0; i < meshes->size(); i++) for (unsigned i = 0; i < meshes->size(); i++)
{ {
GLMesh &mesh = *(STK::tuple_get<0>(meshes->at(i))); GLMesh &mesh = *(std::get<0>(meshes->at(i)));
if (!CVS->isARBBaseInstanceUsable()) if (!CVS->isARBBaseInstanceUsable())
glBindVertexArray(mesh.vao); glBindVertexArray(mesh.vao);
if (mesh.VAOType != VertexType) if (mesh.VAOType != VertexType)
@ -329,11 +329,11 @@ void AbstractGeometryPasses::renderTransparent(const DrawCalls& draw_calls,
for (unsigned i = 0; i < ListDisplacement::getInstance()->size(); i++) for (unsigned i = 0; i < ListDisplacement::getInstance()->size(); i++)
{ {
const GLMesh &mesh = const GLMesh &mesh =
*(STK::tuple_get<0>(ListDisplacement::getInstance()->at(i))); *(std::get<0>(ListDisplacement::getInstance()->at(i)));
if (!CVS->isARBBaseInstanceUsable()) if (!CVS->isARBBaseInstanceUsable())
glBindVertexArray(mesh.vao); glBindVertexArray(mesh.vao);
const core::matrix4 &AbsoluteTransformation const core::matrix4 &AbsoluteTransformation
= STK::tuple_get<1>(ListDisplacement::getInstance()->at(i)); = std::get<1>(ListDisplacement::getInstance()->at(i));
if (mesh.VAOType != video::EVT_2TCOORDS) if (mesh.VAOType != video::EVT_2TCOORDS)
{ {
#ifdef DEBUG #ifdef DEBUG
@ -360,11 +360,11 @@ void AbstractGeometryPasses::renderTransparent(const DrawCalls& draw_calls,
for (unsigned i = 0; i < ListDisplacement::getInstance()->size(); i++) for (unsigned i = 0; i < ListDisplacement::getInstance()->size(); i++)
{ {
const GLMesh &mesh = const GLMesh &mesh =
*(STK::tuple_get<0>(ListDisplacement::getInstance()->at(i))); *(std::get<0>(ListDisplacement::getInstance()->at(i)));
if (!CVS->isARBBaseInstanceUsable()) if (!CVS->isARBBaseInstanceUsable())
glBindVertexArray(mesh.vao); glBindVertexArray(mesh.vao);
const core::matrix4 &AbsoluteTransformation = const core::matrix4 &AbsoluteTransformation =
STK::tuple_get<1>(ListDisplacement::getInstance()->at(i)); std::get<1>(ListDisplacement::getInstance()->at(i));
if (mesh.VAOType != video::EVT_2TCOORDS) if (mesh.VAOType != video::EVT_2TCOORDS)
continue; continue;

View File

@ -742,111 +742,111 @@ InstancedSkinnedRefShadowShader::InstancedSkinnedRefShadowShader()
// ============================================================================ // ============================================================================
const InstanceType SkinnedSolid::Instance = InstanceTypeThreeTex; const InstanceType SkinnedSolid::Instance = InstanceTypeThreeTex;
const STK::Tuple<size_t> SkinnedSolid::FirstPassTextures const std::tuple<size_t> SkinnedSolid::FirstPassTextures
= STK::Tuple<size_t>(1); = std::tuple<size_t>(1);
const STK::Tuple<size_t, size_t, size_t> SkinnedSolid::SecondPassTextures const std::tuple<size_t, size_t, size_t> SkinnedSolid::SecondPassTextures
= STK::Tuple<size_t, size_t, size_t>(0, 1, 2); = std::tuple<size_t, size_t, size_t>(0, 1, 2);
const STK::Tuple<> SkinnedSolid::ShadowTextures; const std::tuple<> SkinnedSolid::ShadowTextures;
const STK::Tuple<size_t> SkinnedSolid::RSMTextures = STK::Tuple<size_t>(0); const std::tuple<size_t> SkinnedSolid::RSMTextures = std::tuple<size_t>(0);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
const InstanceType SkinnedAlphaRef::Instance = InstanceTypeThreeTex; const InstanceType SkinnedAlphaRef::Instance = InstanceTypeThreeTex;
const STK::Tuple<size_t, size_t> SkinnedAlphaRef::FirstPassTextures const std::tuple<size_t, size_t> SkinnedAlphaRef::FirstPassTextures
= STK::Tuple<size_t, size_t>(0, 1); = std::tuple<size_t, size_t>(0, 1);
const STK::Tuple<size_t, size_t, size_t> SkinnedAlphaRef::SecondPassTextures const std::tuple<size_t, size_t, size_t> SkinnedAlphaRef::SecondPassTextures
= STK::Tuple<size_t, size_t, size_t>(0, 1, 2); = std::tuple<size_t, size_t, size_t>(0, 1, 2);
const STK::Tuple<size_t> SkinnedAlphaRef::ShadowTextures const std::tuple<size_t> SkinnedAlphaRef::ShadowTextures
= STK::Tuple<size_t>(0); = std::tuple<size_t>(0);
const STK::Tuple<size_t> SkinnedAlphaRef::RSMTextures = STK::Tuple<size_t>(0); const std::tuple<size_t> SkinnedAlphaRef::RSMTextures = std::tuple<size_t>(0);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
const InstanceType SkinnedUnlitMat::Instance = InstanceTypeThreeTex; const InstanceType SkinnedUnlitMat::Instance = InstanceTypeThreeTex;
const STK::Tuple<size_t, size_t> SkinnedUnlitMat::FirstPassTextures const std::tuple<size_t, size_t> SkinnedUnlitMat::FirstPassTextures
= STK::Tuple<size_t, size_t>(0, 1); = std::tuple<size_t, size_t>(0, 1);
const STK::Tuple<size_t> SkinnedUnlitMat::SecondPassTextures const std::tuple<size_t> SkinnedUnlitMat::SecondPassTextures
= STK::Tuple<size_t>(0); = std::tuple<size_t>(0);
const STK::Tuple<size_t> SkinnedUnlitMat::ShadowTextures const std::tuple<size_t> SkinnedUnlitMat::ShadowTextures
= STK::Tuple<size_t>(0); = std::tuple<size_t>(0);
const STK::Tuple<size_t> SkinnedUnlitMat::RSMTextures = STK::Tuple<size_t>(0); const std::tuple<size_t> SkinnedUnlitMat::RSMTextures = std::tuple<size_t>(0);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
const InstanceType SkinnedNormalMat::Instance = InstanceTypeFourTex; const InstanceType SkinnedNormalMat::Instance = InstanceTypeFourTex;
const STK::Tuple<size_t, size_t> SkinnedNormalMat::FirstPassTextures const std::tuple<size_t, size_t> SkinnedNormalMat::FirstPassTextures
= STK::Tuple<size_t, size_t>(3, 1); = std::tuple<size_t, size_t>(3, 1);
const STK::Tuple<size_t, size_t, size_t> SkinnedNormalMat::SecondPassTextures const std::tuple<size_t, size_t, size_t> SkinnedNormalMat::SecondPassTextures
= STK::Tuple<size_t, size_t, size_t>(0, 1, 2); = std::tuple<size_t, size_t, size_t>(0, 1, 2);
const STK::Tuple<> SkinnedNormalMat::ShadowTextures; const std::tuple<> SkinnedNormalMat::ShadowTextures;
const STK::Tuple<size_t> SkinnedNormalMat::RSMTextures = STK::Tuple<size_t>(0); const std::tuple<size_t> SkinnedNormalMat::RSMTextures = std::tuple<size_t>(0);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
const InstanceType DefaultMaterial::Instance = InstanceTypeThreeTex; const InstanceType DefaultMaterial::Instance = InstanceTypeThreeTex;
const STK::Tuple<size_t> DefaultMaterial::FirstPassTextures const std::tuple<size_t> DefaultMaterial::FirstPassTextures
= STK::Tuple<size_t>(1); = std::tuple<size_t>(1);
const STK::Tuple<size_t, size_t, size_t> DefaultMaterial::SecondPassTextures const std::tuple<size_t, size_t, size_t> DefaultMaterial::SecondPassTextures
= STK::Tuple<size_t, size_t, size_t>(0, 1, 2); = std::tuple<size_t, size_t, size_t>(0, 1, 2);
const STK::Tuple<> DefaultMaterial::ShadowTextures; const std::tuple<> DefaultMaterial::ShadowTextures;
const STK::Tuple<size_t> DefaultMaterial::RSMTextures = STK::Tuple<size_t>(0); const std::tuple<size_t> DefaultMaterial::RSMTextures = std::tuple<size_t>(0);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
const InstanceType AlphaRef::Instance = InstanceTypeThreeTex; const InstanceType AlphaRef::Instance = InstanceTypeThreeTex;
const STK::Tuple<size_t, size_t> AlphaRef::FirstPassTextures const std::tuple<size_t, size_t> AlphaRef::FirstPassTextures
= STK::Tuple<size_t, size_t>(0, 1); = std::tuple<size_t, size_t>(0, 1);
const STK::Tuple<size_t, size_t, size_t> AlphaRef::SecondPassTextures const std::tuple<size_t, size_t, size_t> AlphaRef::SecondPassTextures
= STK::Tuple<size_t, size_t, size_t>(0, 1, 2); = std::tuple<size_t, size_t, size_t>(0, 1, 2);
const STK::Tuple<size_t> AlphaRef::ShadowTextures = STK::Tuple<size_t>(0); const std::tuple<size_t> AlphaRef::ShadowTextures = std::tuple<size_t>(0);
const STK::Tuple<size_t> AlphaRef::RSMTextures = STK::Tuple<size_t>(0); const std::tuple<size_t> AlphaRef::RSMTextures = std::tuple<size_t>(0);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
const InstanceType SphereMap::Instance = InstanceTypeThreeTex; const InstanceType SphereMap::Instance = InstanceTypeThreeTex;
const STK::Tuple<size_t> SphereMap::FirstPassTextures = STK::Tuple<size_t>(1); const std::tuple<size_t> SphereMap::FirstPassTextures = std::tuple<size_t>(1);
const STK::Tuple<size_t> SphereMap::SecondPassTextures = STK::Tuple<size_t>(0); const std::tuple<size_t> SphereMap::SecondPassTextures = std::tuple<size_t>(0);
const STK::Tuple<> SphereMap::ShadowTextures; const std::tuple<> SphereMap::ShadowTextures;
const STK::Tuple<size_t> SphereMap::RSMTextures = STK::Tuple<size_t>(0); const std::tuple<size_t> SphereMap::RSMTextures = std::tuple<size_t>(0);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
const InstanceType UnlitMat::Instance = InstanceTypeThreeTex; const InstanceType UnlitMat::Instance = InstanceTypeThreeTex;
const STK::Tuple<size_t, size_t> UnlitMat::FirstPassTextures const std::tuple<size_t, size_t> UnlitMat::FirstPassTextures
= STK::Tuple<size_t, size_t>(0, 1); = std::tuple<size_t, size_t>(0, 1);
const STK::Tuple<size_t> UnlitMat::SecondPassTextures = STK::Tuple<size_t>(0); const std::tuple<size_t> UnlitMat::SecondPassTextures = std::tuple<size_t>(0);
const STK::Tuple<size_t> UnlitMat::ShadowTextures = STK::Tuple<size_t>(0); const std::tuple<size_t> UnlitMat::ShadowTextures = std::tuple<size_t>(0);
const STK::Tuple<size_t> UnlitMat::RSMTextures = STK::Tuple<size_t>(0); const std::tuple<size_t> UnlitMat::RSMTextures = std::tuple<size_t>(0);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
const InstanceType GrassMat::Instance = InstanceTypeThreeTex; const InstanceType GrassMat::Instance = InstanceTypeThreeTex;
const STK::Tuple<size_t, size_t> GrassMat::FirstPassTextures const std::tuple<size_t, size_t> GrassMat::FirstPassTextures
= STK::Tuple<size_t, size_t>(0, 1); = std::tuple<size_t, size_t>(0, 1);
const STK::Tuple<size_t, size_t, size_t> GrassMat::SecondPassTextures const std::tuple<size_t, size_t, size_t> GrassMat::SecondPassTextures
= STK::Tuple<size_t, size_t, size_t>(0, 1, 2); = std::tuple<size_t, size_t, size_t>(0, 1, 2);
const STK::Tuple<size_t> GrassMat::ShadowTextures = STK::Tuple<size_t>(0); const std::tuple<size_t> GrassMat::ShadowTextures = std::tuple<size_t>(0);
const STK::Tuple<size_t> GrassMat::RSMTextures = STK::Tuple<size_t>(0); const std::tuple<size_t> GrassMat::RSMTextures = std::tuple<size_t>(0);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
const InstanceType NormalMat::Instance = InstanceTypeFourTex; const InstanceType NormalMat::Instance = InstanceTypeFourTex;
const STK::Tuple<size_t, size_t> NormalMat::FirstPassTextures const std::tuple<size_t, size_t> NormalMat::FirstPassTextures
= STK::Tuple<size_t, size_t>(3, 1); = std::tuple<size_t, size_t>(3, 1);
const STK::Tuple<size_t, size_t, size_t> NormalMat::SecondPassTextures const std::tuple<size_t, size_t, size_t> NormalMat::SecondPassTextures
= STK::Tuple<size_t, size_t, size_t>(0, 1, 2); = std::tuple<size_t, size_t, size_t>(0, 1, 2);
const STK::Tuple<> NormalMat::ShadowTextures; const std::tuple<> NormalMat::ShadowTextures;
const STK::Tuple<size_t> NormalMat::RSMTextures = STK::Tuple<size_t>(0); const std::tuple<size_t> NormalMat::RSMTextures = std::tuple<size_t>(0);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
const InstanceType DetailMat::Instance = InstanceTypeFourTex; const InstanceType DetailMat::Instance = InstanceTypeFourTex;
const STK::Tuple<size_t> DetailMat::FirstPassTextures = STK::Tuple<size_t>(1); const std::tuple<size_t> DetailMat::FirstPassTextures = std::tuple<size_t>(1);
const STK::Tuple<size_t, size_t, size_t> DetailMat::SecondPassTextures const std::tuple<size_t, size_t, size_t> DetailMat::SecondPassTextures
= STK::Tuple<size_t, size_t, size_t>(0, 3, 1); = std::tuple<size_t, size_t, size_t>(0, 3, 1);
const STK::Tuple<> DetailMat::ShadowTextures; const std::tuple<> DetailMat::ShadowTextures;
const STK::Tuple<size_t> DetailMat::RSMTextures = STK::Tuple<size_t>(0); const std::tuple<size_t> DetailMat::RSMTextures = std::tuple<size_t>(0);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
const STK::Tuple<size_t> SplattingMat::FirstPassTextures const std::tuple<size_t> SplattingMat::FirstPassTextures
= STK::Tuple<size_t>(7); = std::tuple<size_t>(7);
const STK::Tuple<size_t, size_t, size_t, size_t, size_t> const std::tuple<size_t, size_t, size_t, size_t, size_t>
SplattingMat::SecondPassTextures SplattingMat::SecondPassTextures
= STK::Tuple<size_t, size_t, size_t, size_t, size_t>(1, 3, 4, 5, 6); = std::tuple<size_t, size_t, size_t, size_t, size_t>(1, 3, 4, 5, 6);
const STK::Tuple<> SplattingMat::ShadowTextures; const std::tuple<> SplattingMat::ShadowTextures;
const STK::Tuple<size_t, size_t, size_t, size_t, size_t> const std::tuple<size_t, size_t, size_t, size_t, size_t>
SplattingMat::RSMTextures SplattingMat::RSMTextures
= STK::Tuple<size_t, size_t, size_t, size_t, size_t>(1, 3, 4, 5, 6); = std::tuple<size_t, size_t, size_t, size_t, size_t>(1, 3, 4, 5, 6);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#endif #endif

View File

@ -443,10 +443,10 @@ struct SkinnedSolid
static const enum Material::ShaderType MaterialType static const enum Material::ShaderType MaterialType
= Material::SHADERTYPE_SOLID_SKINNED_MESH; = Material::SHADERTYPE_SOLID_SKINNED_MESH;
static const enum InstanceType Instance; static const enum InstanceType Instance;
static const STK::Tuple<size_t> FirstPassTextures; static const std::tuple<size_t> FirstPassTextures;
static const STK::Tuple<size_t, size_t, size_t> SecondPassTextures; static const std::tuple<size_t, size_t, size_t> SecondPassTextures;
static const STK::Tuple<> ShadowTextures; static const std::tuple<> ShadowTextures;
static const STK::Tuple<size_t> RSMTextures; static const std::tuple<size_t> RSMTextures;
}; // SkinnedSolid }; // SkinnedSolid
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -464,10 +464,10 @@ struct SkinnedAlphaRef
static const enum Material::ShaderType MaterialType = static const enum Material::ShaderType MaterialType =
Material::SHADERTYPE_ALPHA_TEST_SKINNED_MESH; Material::SHADERTYPE_ALPHA_TEST_SKINNED_MESH;
static const enum InstanceType Instance; static const enum InstanceType Instance;
static const STK::Tuple<size_t, size_t> FirstPassTextures; static const std::tuple<size_t, size_t> FirstPassTextures;
static const STK::Tuple<size_t, size_t, size_t> SecondPassTextures; static const std::tuple<size_t, size_t, size_t> SecondPassTextures;
static const STK::Tuple<size_t> ShadowTextures; static const std::tuple<size_t> ShadowTextures;
static const STK::Tuple<size_t> RSMTextures; static const std::tuple<size_t> RSMTextures;
}; // SkinnedAlphaRef }; // SkinnedAlphaRef
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -485,10 +485,10 @@ struct SkinnedNormalMat
static const enum Material::ShaderType MaterialType = static const enum Material::ShaderType MaterialType =
Material::SHADERTYPE_NORMAL_MAP_SKINNED_MESH; Material::SHADERTYPE_NORMAL_MAP_SKINNED_MESH;
static const enum InstanceType Instance; static const enum InstanceType Instance;
static const STK::Tuple<size_t, size_t> FirstPassTextures; static const std::tuple<size_t, size_t> FirstPassTextures;
static const STK::Tuple<size_t, size_t, size_t> SecondPassTextures; static const std::tuple<size_t, size_t, size_t> SecondPassTextures;
static const STK::Tuple<> ShadowTextures; static const std::tuple<> ShadowTextures;
static const STK::Tuple<size_t> RSMTextures; static const std::tuple<size_t> RSMTextures;
}; // SkinnedNormalMat }; // SkinnedNormalMat
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -506,10 +506,10 @@ struct SkinnedUnlitMat
static const enum Material::ShaderType MaterialType = static const enum Material::ShaderType MaterialType =
Material::SHADERTYPE_SOLID_UNLIT_SKINNED_MESH; Material::SHADERTYPE_SOLID_UNLIT_SKINNED_MESH;
static const enum InstanceType Instance; static const enum InstanceType Instance;
static const STK::Tuple<size_t, size_t> FirstPassTextures; static const std::tuple<size_t, size_t> FirstPassTextures;
static const STK::Tuple<size_t> SecondPassTextures; static const std::tuple<size_t> SecondPassTextures;
static const STK::Tuple<size_t> ShadowTextures; static const std::tuple<size_t> ShadowTextures;
static const STK::Tuple<size_t> RSMTextures; static const std::tuple<size_t> RSMTextures;
}; // SkinnedUnlitMat }; // SkinnedUnlitMat
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -528,10 +528,10 @@ struct DefaultMaterial
static const enum Material::ShaderType MaterialType static const enum Material::ShaderType MaterialType
= Material::SHADERTYPE_SOLID; = Material::SHADERTYPE_SOLID;
static const enum InstanceType Instance; static const enum InstanceType Instance;
static const STK::Tuple<size_t> FirstPassTextures; static const std::tuple<size_t> FirstPassTextures;
static const STK::Tuple<size_t, size_t, size_t> SecondPassTextures; static const std::tuple<size_t, size_t, size_t> SecondPassTextures;
static const STK::Tuple<> ShadowTextures; static const std::tuple<> ShadowTextures;
static const STK::Tuple<size_t> RSMTextures; static const std::tuple<size_t> RSMTextures;
}; // DefaultMaterial }; // DefaultMaterial
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -549,10 +549,10 @@ struct AlphaRef
static const enum video::E_VERTEX_TYPE VertexType = video::EVT_STANDARD; static const enum video::E_VERTEX_TYPE VertexType = video::EVT_STANDARD;
static const enum Material::ShaderType MaterialType = Material::SHADERTYPE_ALPHA_TEST; static const enum Material::ShaderType MaterialType = Material::SHADERTYPE_ALPHA_TEST;
static const enum InstanceType Instance; static const enum InstanceType Instance;
static const STK::Tuple<size_t, size_t> FirstPassTextures; static const std::tuple<size_t, size_t> FirstPassTextures;
static const STK::Tuple<size_t, size_t, size_t> SecondPassTextures; static const std::tuple<size_t, size_t, size_t> SecondPassTextures;
static const STK::Tuple<size_t> ShadowTextures; static const std::tuple<size_t> ShadowTextures;
static const STK::Tuple<size_t> RSMTextures; static const std::tuple<size_t> RSMTextures;
}; // AlphaRef }; // AlphaRef
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -571,10 +571,10 @@ struct SphereMap
static const enum Material::ShaderType MaterialType static const enum Material::ShaderType MaterialType
= Material::SHADERTYPE_SPHERE_MAP; = Material::SHADERTYPE_SPHERE_MAP;
static const enum InstanceType Instance; static const enum InstanceType Instance;
static const STK::Tuple<size_t> FirstPassTextures; static const std::tuple<size_t> FirstPassTextures;
static const STK::Tuple<size_t> SecondPassTextures; static const std::tuple<size_t> SecondPassTextures;
static const STK::Tuple<> ShadowTextures; static const std::tuple<> ShadowTextures;
static const STK::Tuple<size_t> RSMTextures; static const std::tuple<size_t> RSMTextures;
}; // SphereMap }; // SphereMap
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -593,10 +593,10 @@ struct UnlitMat
static const enum Material::ShaderType MaterialType = static const enum Material::ShaderType MaterialType =
Material::SHADERTYPE_SOLID_UNLIT; Material::SHADERTYPE_SOLID_UNLIT;
static const enum InstanceType Instance; static const enum InstanceType Instance;
static const STK::Tuple<size_t, size_t> FirstPassTextures; static const std::tuple<size_t, size_t> FirstPassTextures;
static const STK::Tuple<size_t> SecondPassTextures; static const std::tuple<size_t> SecondPassTextures;
static const STK::Tuple<size_t> ShadowTextures; static const std::tuple<size_t> ShadowTextures;
static const STK::Tuple<size_t> RSMTextures; static const std::tuple<size_t> RSMTextures;
}; // UnlitMat }; // UnlitMat
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -615,10 +615,10 @@ struct GrassMat
static const enum Material::ShaderType MaterialType static const enum Material::ShaderType MaterialType
= Material::SHADERTYPE_VEGETATION; = Material::SHADERTYPE_VEGETATION;
static const enum InstanceType Instance; static const enum InstanceType Instance;
static const STK::Tuple<size_t, size_t> FirstPassTextures; static const std::tuple<size_t, size_t> FirstPassTextures;
static const STK::Tuple<size_t, size_t, size_t> SecondPassTextures; static const std::tuple<size_t, size_t, size_t> SecondPassTextures;
static const STK::Tuple<size_t> ShadowTextures; static const std::tuple<size_t> ShadowTextures;
static const STK::Tuple<size_t> RSMTextures; static const std::tuple<size_t> RSMTextures;
}; // GrassMat }; // GrassMat
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -637,10 +637,10 @@ struct NormalMat
static const enum Material::ShaderType MaterialType static const enum Material::ShaderType MaterialType
= Material::SHADERTYPE_NORMAL_MAP; = Material::SHADERTYPE_NORMAL_MAP;
static const enum InstanceType Instance; static const enum InstanceType Instance;
static const STK::Tuple<size_t, size_t> FirstPassTextures; static const std::tuple<size_t, size_t> FirstPassTextures;
static const STK::Tuple<size_t, size_t, size_t> SecondPassTextures; static const std::tuple<size_t, size_t, size_t> SecondPassTextures;
static const STK::Tuple<> ShadowTextures; static const std::tuple<> ShadowTextures;
static const STK::Tuple<size_t> RSMTextures; static const std::tuple<size_t> RSMTextures;
}; // NormalMat }; // NormalMat
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -659,10 +659,10 @@ struct DetailMat
static const enum Material::ShaderType MaterialType static const enum Material::ShaderType MaterialType
= Material::SHADERTYPE_DETAIL_MAP; = Material::SHADERTYPE_DETAIL_MAP;
static const enum InstanceType Instance; static const enum InstanceType Instance;
static const STK::Tuple<size_t> FirstPassTextures; static const std::tuple<size_t> FirstPassTextures;
static const STK::Tuple<size_t, size_t, size_t> SecondPassTextures; static const std::tuple<size_t, size_t, size_t> SecondPassTextures;
static const STK::Tuple<> ShadowTextures; static const std::tuple<> ShadowTextures;
static const STK::Tuple<size_t> RSMTextures; static const std::tuple<size_t> RSMTextures;
}; // DetailMat }; // DetailMat
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -678,11 +678,11 @@ struct SplattingMat
static const enum video::E_VERTEX_TYPE VertexType = video::EVT_2TCOORDS; static const enum video::E_VERTEX_TYPE VertexType = video::EVT_2TCOORDS;
static const enum Material::ShaderType MaterialType static const enum Material::ShaderType MaterialType
= Material::SHADERTYPE_SPLATTING; = Material::SHADERTYPE_SPLATTING;
static const STK::Tuple<size_t> FirstPassTextures; static const std::tuple<size_t> FirstPassTextures;
static const STK::Tuple<size_t, size_t, size_t, size_t, size_t> static const std::tuple<size_t, size_t, size_t, size_t, size_t>
SecondPassTextures; SecondPassTextures;
static const STK::Tuple<> ShadowTextures; static const std::tuple<> ShadowTextures;
static const STK::Tuple<size_t, size_t, size_t, size_t, size_t> static const std::tuple<size_t, size_t, size_t, size_t, size_t>
RSMTextures; RSMTextures;
}; // SplattingMat }; // SplattingMat

View File

@ -22,7 +22,7 @@
#include "graphics/irr_driver.hpp" #include "graphics/irr_driver.hpp"
#include "graphics/material.hpp" #include "graphics/material.hpp"
#include "utils/singleton.hpp" #include "utils/singleton.hpp"
#include "utils/tuple.hpp" #include <tuple>
#include <IMeshSceneNode.h> #include <IMeshSceneNode.h>
#include <IMesh.h> #include <IMesh.h>
@ -101,7 +101,7 @@ template<typename T, typename... Args>
class MeshList : public Singleton<T> class MeshList : public Singleton<T>
{ {
public: public:
std::vector<STK::Tuple<Args...> > SolidPass, Shadows[4], RSM; std::vector<std::tuple<Args...> > SolidPass, Shadows[4], RSM;
void clear() void clear()
{ {
SolidPass.clear(); SolidPass.clear();
@ -183,7 +183,7 @@ class ListMatDetails : public MeshList<ListMatDetails, GLMesh *, core::matrix4,
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Transparent // Transparent
template <typename T, typename ...Args> template <typename T, typename ...Args>
class MiscList : public Singleton<T>, public std::vector<STK::Tuple<Args...> > class MiscList : public Singleton<T>, public std::vector<std::tuple<Args...> >
{}; {};
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@ -20,7 +20,7 @@
#include "graphics/gl_headers.hpp" #include "graphics/gl_headers.hpp"
#include "utils/singleton.hpp" #include "utils/singleton.hpp"
#include "utils/tuple.hpp" #include <tuple>
#include <S3DVertex.h> #include <S3DVertex.h>
#include <IMeshBuffer.h> #include <IMeshBuffer.h>
#include <ISceneNode.h> #include <ISceneNode.h>
@ -40,7 +40,7 @@ enum InstanceType : unsigned int
InstanceTypeCount, InstanceTypeCount,
}; };
typedef STK::Tuple<scene::ISceneNode*, core::vector2df, core::vector2df, typedef std::tuple<scene::ISceneNode*, core::vector2df, core::vector2df,
int32_t> InstanceSettings; int32_t> InstanceSettings;
struct GLMesh; struct GLMesh;

View File

@ -1,114 +0,0 @@
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2014-2015 SuperTuxKart-Team
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef __STK_TUPLE_HPP__
#define __STK_TUPLE_HPP__
namespace STK {
// tuple
template<typename... _Types> class Tuple;
// empty tuple
template<> class Tuple<> {
public:
Tuple()
{
}
};
// recursive tuple definition
template<typename _This, typename... _Rest>
class Tuple<_This, _Rest...> : private Tuple<_Rest...>
{
public:
_This _Elem;
Tuple()
{
}
Tuple(_This val, _Rest... rest) : Tuple<_Rest...>(rest...)
{
_Elem = val;
}
};
// tuple_element
template<size_t _Index, typename _Tuple> struct tuple_element;
// select first element
template<typename _This, typename... _Rest>
struct tuple_element<0, Tuple<_This, _Rest...>>
{
typedef _This& type;
typedef Tuple<_This, _Rest...> _Ttype;
};
// recursive tuple_element definition
template <size_t _Index, typename _This, typename... _Rest>
struct tuple_element<_Index, Tuple<_This, _Rest...>>
: public tuple_element<_Index - 1, Tuple<_Rest...> >
{
};
template<size_t _Index, class... _Types> inline
typename tuple_element<_Index, Tuple<_Types...>>::type
tuple_get(Tuple<_Types...>& _Tuple)
{
typedef typename tuple_element<_Index, Tuple<_Types...>>::_Ttype _Ttype;
return (((_Ttype&)_Tuple)._Elem);
}
template<size_t _Index, class... _Types> inline
typename tuple_element<_Index, Tuple<_Types...>>::type tuple_get(const Tuple<_Types...>& _Tuple)
{
typedef typename tuple_element<_Index, Tuple<_Types...>>::_Ttype _Ttype;
return (((_Ttype&)_Tuple)._Elem);
}
template<size_t Index, typename... T> inline
Tuple<T...> make_tuple(T... values)
{
return Tuple<T...>(values...);
}
template<typename... T> inline
Tuple<T...> make_tuple(T... values)
{
return Tuple<T...>(values...);
}
//template<typename... T>
//int tuple_size(Tuple<T...> tuple)
//{
// return sizeof...(T);
//}
template<typename... T>
struct TupleSize
{
const int value;
TupleSize()
{
value = sizeof...(T);
}
};
}
#endif