Merge remote-tracking branch 'upstream/master' into perPlayerDifficulties
This commit is contained in:
commit
4fe34007cd
3
.gitignore
vendored
3
.gitignore
vendored
@ -6,12 +6,15 @@ build-win/
|
|||||||
cmake_build/
|
cmake_build/
|
||||||
dependencies/
|
dependencies/
|
||||||
CMakeFiles/
|
CMakeFiles/
|
||||||
|
stk-editor/
|
||||||
|
|
||||||
.config/
|
.config/
|
||||||
supertuxkart-64
|
supertuxkart-64
|
||||||
|
|
||||||
|
data/editor
|
||||||
data/karts
|
data/karts
|
||||||
data/library
|
data/library
|
||||||
|
data/models
|
||||||
data/music
|
data/music
|
||||||
data/sfx
|
data/sfx
|
||||||
data/textures
|
data/textures
|
||||||
|
@ -15,8 +15,9 @@ before_install:
|
|||||||
- sudo apt-get update -qq
|
- sudo apt-get update -qq
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
- sudo apt-get install build-essential cmake libogg-dev libvorbis-dev libopenal-dev libxxf86vm-dev libcurl4-openssl-dev libfribidi-dev libbluetooth-dev
|
- sudo apt-get install build-essential cmake libogg-dev libvorbis-dev libopenal-dev libxxf86vm-dev libcurl4-openssl-dev libfribidi-dev libbluetooth-dev
|
||||||
# Install mesa from an other repo (a newer version is required)
|
# Install mesa from an other repo (a newer version is required). Quantal is not supported anymore, saucy is only supported till July 2014,
|
||||||
- sudo apt-add-repository "deb http://archive.ubuntu.com/ubuntu quantal main restricted"
|
# so we try to use trusty (precise which is what traiv uses a too old mesa version which doesn't link)
|
||||||
|
- sudo apt-add-repository "deb http://archive.ubuntu.com/ubuntu trusty main restricted"
|
||||||
- sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 3B4FE6ACC0B21F32
|
- sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 3B4FE6ACC0B21F32
|
||||||
- sudo apt-get update -qq
|
- sudo apt-get update -qq
|
||||||
- sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev
|
- sudo apt-get install libgl1-mesa-dev libglu1-mesa-dev
|
||||||
|
@ -70,27 +70,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<spacer height="20" width="10" />
|
|
||||||
|
|
||||||
<div layout="horizontal-row" width="100%" proportion="1">
|
|
||||||
<div layout="horizontal-row" proportion="1" height="fit">
|
|
||||||
<checkbox id="motionblur"/>
|
|
||||||
<spacer width="10" height="10"/>
|
|
||||||
<label text="Motion blur" I18N="Video settings"/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<spacer height="4" width="10" />
|
|
||||||
|
|
||||||
<div layout="horizontal-row" proportion="1" height="fit">
|
|
||||||
<checkbox id="texture_compression"/>
|
|
||||||
<spacer width="10" height="10"/>
|
|
||||||
<label text="Texture compression" I18N="Video settings"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<spacer height="4" width="10" />
|
<spacer height="4" width="10" />
|
||||||
|
|
||||||
<div layout="horizontal-row" width="100%" proportion="1">
|
<div layout="horizontal-row" width="100%" proportion="1">
|
||||||
|
<spacer width="70" height="10"/>
|
||||||
|
|
||||||
<div layout="horizontal-row" proportion="1" height="fit">
|
<div layout="horizontal-row" proportion="1" height="fit">
|
||||||
<checkbox id="glow"/>
|
<checkbox id="glow"/>
|
||||||
<spacer width="10" height="10"/>
|
<spacer width="10" height="10"/>
|
||||||
@ -105,7 +89,27 @@
|
|||||||
<label text="Anti-aliasing" I18N="Video settings"/>
|
<label text="Anti-aliasing" I18N="Video settings"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<spacer height="4" width="10" />
|
||||||
|
|
||||||
|
<div layout="horizontal-row" width="100%" proportion="1">
|
||||||
|
<spacer width="70" height="10"/>
|
||||||
|
|
||||||
|
<div layout="horizontal-row" proportion="1" height="fit">
|
||||||
|
<checkbox id="motionblur"/>
|
||||||
|
<spacer width="10" height="10"/>
|
||||||
|
<label text="Motion blur" I18N="Video settings"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<spacer height="4" width="10" />
|
||||||
|
|
||||||
|
<div layout="horizontal-row" proportion="1" height="fit">
|
||||||
|
<checkbox id="dof"/>
|
||||||
|
<spacer width="10" height="10"/>
|
||||||
|
<label text="Depth of field" I18N="Video settings"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<spacer height="4" width="10" />
|
<spacer height="4" width="10" />
|
||||||
|
|
||||||
<div layout="horizontal-row" width="100%" proportion="1">
|
<div layout="horizontal-row" width="100%" proportion="1">
|
||||||
@ -136,9 +140,9 @@
|
|||||||
<spacer height="4" width="10" />
|
<spacer height="4" width="10" />
|
||||||
|
|
||||||
<div layout="horizontal-row" proportion="1" height="fit">
|
<div layout="horizontal-row" proportion="1" height="fit">
|
||||||
<checkbox id="dof"/>
|
<checkbox id="texture_compression"/>
|
||||||
<spacer width="10" height="10"/>
|
<spacer width="10" height="10"/>
|
||||||
<label text="Depth of field" I18N="Video settings"/>
|
<label text="Texture compression" I18N="Video settings"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ uniform mat4 ViewMatrix;
|
|||||||
uniform mat4 ProjectionMatrix;
|
uniform mat4 ProjectionMatrix;
|
||||||
uniform mat4 InverseViewMatrix;
|
uniform mat4 InverseViewMatrix;
|
||||||
uniform mat4 InverseProjectionMatrix;
|
uniform mat4 InverseProjectionMatrix;
|
||||||
|
uniform vec2 screen;
|
||||||
#else
|
#else
|
||||||
layout (std140) uniform MatrixesData
|
layout (std140) uniform MatrixesData
|
||||||
{
|
{
|
||||||
|
@ -17,6 +17,7 @@ layout(location = 8) in vec3 Orientation;
|
|||||||
layout(location = 9) in vec3 Scale;
|
layout(location = 9) in vec3 Scale;
|
||||||
#else
|
#else
|
||||||
in vec3 Position;
|
in vec3 Position;
|
||||||
|
in vec4 Color;
|
||||||
in vec2 Texcoord;
|
in vec2 Texcoord;
|
||||||
|
|
||||||
in vec3 Origin;
|
in vec3 Origin;
|
||||||
|
@ -60,7 +60,7 @@ void main(void)
|
|||||||
vec2 uv = RHuv + offset * 0.01;
|
vec2 uv = RHuv + offset * 0.01;
|
||||||
|
|
||||||
// Get world position and normal from the RSM sample
|
// Get world position and normal from the RSM sample
|
||||||
float depth = texture2D(dtex, uv).z;
|
float depth = texture(dtex, uv).z;
|
||||||
vec4 RSMPos = inverse(RSMMatrix) * (2. * vec4(uv, depth, 1.) - 1.);
|
vec4 RSMPos = inverse(RSMMatrix) * (2. * vec4(uv, depth, 1.) - 1.);
|
||||||
RSMPos /= RSMPos.w;
|
RSMPos /= RSMPos.w;
|
||||||
vec3 RSMAlbedo = texture(ctex, uv).xyz;
|
vec3 RSMAlbedo = texture(ctex, uv).xyz;
|
||||||
|
@ -8,11 +8,17 @@ uniform mat4 TextureMatrix =
|
|||||||
0., 0., 1., 0.,
|
0., 0., 1., 0.,
|
||||||
0., 0., 0., 1.);
|
0., 0., 0., 1.);
|
||||||
|
|
||||||
|
#if __VERSION__ >= 330
|
||||||
layout(location = 0) in vec3 Position;
|
layout(location = 0) in vec3 Position;
|
||||||
layout(location = 1) in vec3 Normal;
|
layout(location = 1) in vec3 Normal;
|
||||||
layout(location = 2) in vec4 Color;
|
layout(location = 2) in vec4 Color;
|
||||||
layout(location = 3) in vec2 Texcoord;
|
layout(location = 3) in vec2 Texcoord;
|
||||||
|
#else
|
||||||
|
in vec3 Position;
|
||||||
|
in vec3 Normal;
|
||||||
|
in vec4 Color;
|
||||||
|
in vec2 Texcoord;
|
||||||
|
#endif
|
||||||
|
|
||||||
out vec3 nor;
|
out vec3 nor;
|
||||||
out vec2 uv;
|
out vec2 uv;
|
||||||
|
@ -9,8 +9,13 @@ layout (std140) uniform MatrixesData
|
|||||||
|
|
||||||
uniform mat4 ModelMatrix;
|
uniform mat4 ModelMatrix;
|
||||||
|
|
||||||
|
#if __VERSION__ >= 330
|
||||||
layout(location = 0) in vec3 Position;
|
layout(location = 0) in vec3 Position;
|
||||||
layout(location = 3) in vec2 Texcoord;
|
layout(location = 3) in vec2 Texcoord;
|
||||||
|
#else
|
||||||
|
in vec3 Position;
|
||||||
|
in vec2 Texcoord;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef VSLayer
|
#ifdef VSLayer
|
||||||
out vec2 uv;
|
out vec2 uv;
|
||||||
|
@ -10,9 +10,15 @@ layout (std140) uniform MatrixesData
|
|||||||
uniform mat4 ModelMatrix;
|
uniform mat4 ModelMatrix;
|
||||||
uniform vec3 windDir;
|
uniform vec3 windDir;
|
||||||
|
|
||||||
|
#if __VERSION__ >= 330
|
||||||
layout(location = 0) in vec3 Position;
|
layout(location = 0) in vec3 Position;
|
||||||
layout(location = 2) in vec4 Color;
|
layout(location = 2) in vec4 Color;
|
||||||
layout(location = 3) in vec2 Texcoord;
|
layout(location = 3) in vec2 Texcoord;
|
||||||
|
#else
|
||||||
|
in vec3 Position;
|
||||||
|
in vec4 Color;
|
||||||
|
in vec2 Texcoord;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef VSLayer
|
#ifdef VSLayer
|
||||||
out vec2 uv;
|
out vec2 uv;
|
||||||
|
@ -26,7 +26,7 @@ out float AO;
|
|||||||
|
|
||||||
const float sigma = 1.;
|
const float sigma = 1.;
|
||||||
const float tau = 7.;
|
const float tau = 7.;
|
||||||
const float beta = 0.001;
|
const float beta = 0.002;
|
||||||
const float epsilon = .00001;
|
const float epsilon = .00001;
|
||||||
const float radius = 1.;
|
const float radius = 1.;
|
||||||
const float k = 1.5;
|
const float k = 1.5;
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "config/device_config.hpp"
|
#include "config/device_config.hpp"
|
||||||
|
#include "utils/log.hpp"
|
||||||
#include <SKeyMap.h>
|
#include <SKeyMap.h>
|
||||||
using namespace irr;
|
using namespace irr;
|
||||||
|
|
||||||
@ -226,7 +227,7 @@ bool DeviceConfig::deserializeAction(irr::io::IrrXMLReader* xml)
|
|||||||
// Never hurts to check ;)
|
// Never hurts to check ;)
|
||||||
if (xml == NULL)
|
if (xml == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error: null pointer (DeviceConfig::deserializeAction)\n");
|
Log::error("DeviceConfig", "Null pointer (DeviceConfig::deserializeAction)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,8 +244,8 @@ bool DeviceConfig::deserializeAction(irr::io::IrrXMLReader* xml)
|
|||||||
}
|
}
|
||||||
if(binding_id==-1)
|
if(binding_id==-1)
|
||||||
{
|
{
|
||||||
printf("WARNING: DeviceConfig::deserializeAction : action '%s' is unknown\n",
|
Log::warn("DeviceConfig", "DeviceConfig::deserializeAction : action '%s' is unknown.",
|
||||||
name_string);
|
name_string);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,23 +350,15 @@ GamepadConfig::GamepadConfig(irr::io::IrrXMLReader* xml) : DeviceConfig( DEVICE_
|
|||||||
{
|
{
|
||||||
const char* name_string = xml->getAttributeValue("name");
|
const char* name_string = xml->getAttributeValue("name");
|
||||||
if(name_string == NULL)
|
if(name_string == NULL)
|
||||||
{
|
Log::error("DeviceConfig", "Unnamed joystick in config file.");
|
||||||
printf("ERROR: Unnamed joystick in config file\n");
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
m_name = name_string;
|
m_name = name_string;
|
||||||
}
|
|
||||||
|
|
||||||
const char* enabled_string = xml->getAttributeValue("enabled");
|
const char* enabled_string = xml->getAttributeValue("enabled");
|
||||||
if (enabled_string != NULL)
|
if (enabled_string != NULL)
|
||||||
{
|
|
||||||
m_enabled = (strcmp(enabled_string, "true") == 0);
|
m_enabled = (strcmp(enabled_string, "true") == 0);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
m_enabled = true;
|
m_enabled = true;
|
||||||
}
|
|
||||||
|
|
||||||
m_plugged = 0;
|
m_plugged = 0;
|
||||||
setDefaultBinds();
|
setDefaultBinds();
|
||||||
|
@ -713,8 +713,8 @@ bool UserConfig::loadConfig()
|
|||||||
// add back the code previously there that upgraded the config file to the new
|
// add back the code previously there that upgraded the config file to the new
|
||||||
// format instead of overwriting it.
|
// format instead of overwriting it.
|
||||||
|
|
||||||
GUIEngine::showMessage( _("Your config file was too old, so it was deleted and a new one will be created."), 10.0f);
|
GUIEngine::showMessage(_("Your config file was too old, so it was deleted and a new one will be created."), 10.0f);
|
||||||
printf("Your config file was too old, so it was deleted and a new one will be created.");
|
Log::info("UserConfig", "Your config file was too old, so it was deleted and a new one will be created.");
|
||||||
delete root;
|
delete root;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -205,8 +205,8 @@ void Camera::setupCamera()
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if(UserConfigParams::logMisc())
|
if(UserConfigParams::logMisc())
|
||||||
fprintf(stderr, "Incorrect number of players: '%d' - assuming 1.\n",
|
Log::warn("Camera", "Incorrect number of players: '%d' - assuming 1.",
|
||||||
race_manager->getNumLocalPlayers());
|
race_manager->getNumLocalPlayers());
|
||||||
m_viewport = core::recti(0, 0,
|
m_viewport = core::recti(0, 0,
|
||||||
UserConfigParams::m_width,
|
UserConfigParams::m_width,
|
||||||
UserConfigParams::m_height);
|
UserConfigParams::m_height);
|
||||||
|
@ -155,10 +155,9 @@ private:
|
|||||||
m_type = EC_AHEAD_OF_KART;
|
m_type = EC_AHEAD_OF_KART;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
Log::warn("Camera", "Invalid camera type '%s' - camera is ignored.",
|
||||||
"Invalid camera type '%s' - camera is ignored.\n",
|
s.c_str());
|
||||||
s.c_str());
|
return false;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
node.get("xyz", &m_position);
|
node.get("xyz", &m_position);
|
||||||
node.get("distance", &m_distance2);
|
node.get("distance", &m_distance2);
|
||||||
|
@ -1931,8 +1931,9 @@ void IrrDriver::update(float dt)
|
|||||||
// =================================
|
// =================================
|
||||||
if (!m_device->run())
|
if (!m_device->run())
|
||||||
{
|
{
|
||||||
GUIEngine::cleanUp();
|
// Don't bother cleaning up GUI, has no use and may result in crashes
|
||||||
GUIEngine::deallocate();
|
//GUIEngine::cleanUp();
|
||||||
|
//GUIEngine::deallocate();
|
||||||
main_loop->abort();
|
main_loop->abort();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -239,7 +239,7 @@ bool MaterialManager::pushTempMaterial(const XMLNode *root,
|
|||||||
if(!node)
|
if(!node)
|
||||||
{
|
{
|
||||||
// We don't have access to the filename at this stage anymore :(
|
// We don't have access to the filename at this stage anymore :(
|
||||||
fprintf(stderr, "Unknown node in material.xml file\n");
|
Log::warn("MaterialManager", "Unknown node in material.xml file.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
@ -249,7 +249,7 @@ bool MaterialManager::pushTempMaterial(const XMLNode *root,
|
|||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
{
|
{
|
||||||
// The message contains a '%s' for the filename
|
// The message contains a '%s' for the filename
|
||||||
fprintf(stderr, e.what(), filename.c_str());
|
Log::warn("MaterialManager", e.what(), filename.c_str());
|
||||||
}
|
}
|
||||||
} // for i<xml->getNumNodes)(
|
} // for i<xml->getNumNodes)(
|
||||||
return true;
|
return true;
|
||||||
|
@ -581,7 +581,7 @@ void ParticleEmitter::setParticleType(const ParticleKind* type)
|
|||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[ParticleEmitter] Unknown shape\n");
|
Log::error("ParticleEmitter", "Unknown shape");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ ParticleKind::ParticleKind(const std::string file) : m_min_start_color(255,255,2
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[ParticleKind] <particles> main node has unknown value for attribute 'emitter'\n");
|
Log::warn("ParticleKind", "<particles> main node has unknown value for attribute 'emitter'.");
|
||||||
m_shape = EMITTER_POINT;
|
m_shape = EMITTER_POINT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,8 +254,8 @@ Material* ParticleKind::getMaterial() const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[ParticleKind] WARNING: particle image '%s' does not appear in the list of "
|
Log::warn("ParticleKind", "Particle image '%s' does not appear in the list of "
|
||||||
"currently known materials\n", m_material_file.c_str());
|
"currently known materials.", m_material_file.c_str());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -266,10 +266,6 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
|
|||||||
{
|
{
|
||||||
glBindBufferBase(GL_UNIFORM_BUFFER, 0, SharedObject::ViewProjectionMatrixesUBO);
|
glBindBufferBase(GL_UNIFORM_BUFFER, 0, SharedObject::ViewProjectionMatrixesUBO);
|
||||||
|
|
||||||
PROFILER_PUSH_CPU_MARKER("- Solid Pass 1", 0xFF, 0x00, 0x00);
|
|
||||||
renderSolidFirstPass();
|
|
||||||
PROFILER_POP_CPU_MARKER();
|
|
||||||
|
|
||||||
// Shadows
|
// Shadows
|
||||||
{
|
{
|
||||||
PROFILER_PUSH_CPU_MARKER("- Shadow", 0x30, 0x6F, 0x90);
|
PROFILER_PUSH_CPU_MARKER("- Shadow", 0x30, 0x6F, 0x90);
|
||||||
@ -283,6 +279,12 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
|
|||||||
PROFILER_POP_CPU_MARKER();
|
PROFILER_POP_CPU_MARKER();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PROFILER_PUSH_CPU_MARKER("- Solid Pass 1", 0xFF, 0x00, 0x00);
|
||||||
|
renderSolidFirstPass();
|
||||||
|
PROFILER_POP_CPU_MARKER();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Lights
|
// Lights
|
||||||
{
|
{
|
||||||
PROFILER_PUSH_CPU_MARKER("- Light", 0x00, 0xFF, 0x00);
|
PROFILER_PUSH_CPU_MARKER("- Light", 0x00, 0xFF, 0x00);
|
||||||
|
@ -32,6 +32,31 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
|
||||||
|
template<typename Shader, typename...uniforms>
|
||||||
|
void draw(const GLMesh *mesh, uniforms... Args)
|
||||||
|
{
|
||||||
|
irr_driver->IncreaseObjectCount();
|
||||||
|
GLenum ptype = mesh->PrimitiveType;
|
||||||
|
GLenum itype = mesh->IndexType;
|
||||||
|
size_t count = mesh->IndexCount;
|
||||||
|
|
||||||
|
Shader::setUniforms(Args...);
|
||||||
|
glDrawElementsBaseVertex(ptype, count, itype, (GLvoid *)mesh->vaoOffset, mesh->vaoBaseVertex);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<typename T, typename...uniforms>
|
||||||
|
void draw(const T *Shader, const GLMesh *mesh, uniforms... Args)
|
||||||
|
{
|
||||||
|
irr_driver->IncreaseObjectCount();
|
||||||
|
GLenum ptype = mesh->PrimitiveType;
|
||||||
|
GLenum itype = mesh->IndexType;
|
||||||
|
size_t count = mesh->IndexCount;
|
||||||
|
|
||||||
|
Shader->setUniforms(Args...);
|
||||||
|
glDrawElementsBaseVertex(ptype, count, itype, (GLvoid *)mesh->vaoOffset, mesh->vaoBaseVertex);
|
||||||
|
}
|
||||||
|
|
||||||
template<unsigned N>
|
template<unsigned N>
|
||||||
struct unroll_args_instance
|
struct unroll_args_instance
|
||||||
{
|
{
|
||||||
@ -58,8 +83,32 @@ void apply_instance(const T *Shader, const std::tuple<TupleType...> &arg)
|
|||||||
unroll_args_instance<std::tuple_size<std::tuple<TupleType...> >::value >::template exec<T>(Shader, arg);
|
unroll_args_instance<std::tuple_size<std::tuple<TupleType...> >::value >::template exec<T>(Shader, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Shader, enum E_VERTEX_TYPE VertexType, typename... TupleType>
|
template<int...List>
|
||||||
void renderMeshes1stPass(const std::vector<GLuint> &TexUnits, std::vector<std::tuple<TupleType...> > &meshes)
|
struct custom_unroll_args;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct custom_unroll_args<>
|
||||||
|
{
|
||||||
|
template<typename T, typename ...TupleTypes, typename ...Args>
|
||||||
|
static void exec(const T *Shader, const std::tuple<TupleTypes...> &t, Args... args)
|
||||||
|
{
|
||||||
|
draw<T>(Shader, std::get<0>(t), args...);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<int N, int...List>
|
||||||
|
struct custom_unroll_args<N, List...>
|
||||||
|
{
|
||||||
|
template<typename T, typename ...TupleTypes, typename ...Args>
|
||||||
|
static void exec(const T *Shader, const std::tuple<TupleTypes...> &t, Args... args)
|
||||||
|
{
|
||||||
|
custom_unroll_args<List...>::template exec<T>(Shader, t, std::get<N>(t), args...);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<typename Shader, enum E_VERTEX_TYPE VertexType, int ...List, typename... TupleType>
|
||||||
|
void renderMeshes1stPass(const std::vector<std::pair<GLuint, bool> > &TexUnits, std::vector<std::tuple<TupleType...> > &meshes)
|
||||||
{
|
{
|
||||||
glUseProgram(Shader::getInstance()->Program);
|
glUseProgram(Shader::getInstance()->Program);
|
||||||
glBindVertexArray(getVAO(VertexType));
|
glBindVertexArray(getVAO(VertexType));
|
||||||
@ -70,8 +119,8 @@ void renderMeshes1stPass(const std::vector<GLuint> &TexUnits, std::vector<std::t
|
|||||||
{
|
{
|
||||||
if (!mesh.textures[j])
|
if (!mesh.textures[j])
|
||||||
mesh.textures[j] = getUnicolorTexture(video::SColor(255, 255, 255, 255));
|
mesh.textures[j] = getUnicolorTexture(video::SColor(255, 255, 255, 255));
|
||||||
compressTexture(mesh.textures[j], true);
|
compressTexture(mesh.textures[j], TexUnits[j].second);
|
||||||
setTexture(TexUnits[j], getTextureGLuint(mesh.textures[j]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(TexUnits[j].first, getTextureGLuint(mesh.textures[j]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
}
|
}
|
||||||
if (mesh.VAOType != VertexType)
|
if (mesh.VAOType != VertexType)
|
||||||
{
|
{
|
||||||
@ -80,7 +129,7 @@ void renderMeshes1stPass(const std::vector<GLuint> &TexUnits, std::vector<std::t
|
|||||||
#endif
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
apply_instance(Shader::getInstance(), meshes[i]);
|
custom_unroll_args<List...>::template exec(Shader::getInstance(), meshes[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,11 +146,14 @@ void IrrDriver::renderSolidFirstPass()
|
|||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
glEnable(GL_CULL_FACE);
|
glEnable(GL_CULL_FACE);
|
||||||
irr_driver->setPhase(SOLID_NORMAL_AND_DEPTH_PASS);
|
irr_driver->setPhase(SOLID_NORMAL_AND_DEPTH_PASS);
|
||||||
ListDefaultStandardG::Arguments.clear();
|
ListMatDefault::Arguments.clear();
|
||||||
ListDefault2TCoordG::Arguments.clear();
|
ListMatAlphaRef::Arguments.clear();
|
||||||
ListAlphaRefG::Arguments.clear();
|
ListMatSphereMap::Arguments.clear();
|
||||||
ListNormalG::Arguments.clear();
|
ListMatDetails::Arguments.clear();
|
||||||
ListGrassG::Arguments.clear();
|
ListMatUnlit::Arguments.clear();
|
||||||
|
ListMatNormalMap::Arguments.clear();
|
||||||
|
ListMatGrass::Arguments.clear();
|
||||||
|
ListMatSplatting::Arguments.clear();
|
||||||
m_scene_manager->drawAll(scene::ESNRP_SOLID);
|
m_scene_manager->drawAll(scene::ESNRP_SOLID);
|
||||||
|
|
||||||
if (!UserConfigParams::m_dynamic_lights)
|
if (!UserConfigParams::m_dynamic_lights)
|
||||||
@ -109,18 +161,21 @@ void IrrDriver::renderSolidFirstPass()
|
|||||||
|
|
||||||
{
|
{
|
||||||
ScopedGPUTimer Timer(getGPUTimer(Q_SOLID_PASS1));
|
ScopedGPUTimer Timer(getGPUTimer(Q_SOLID_PASS1));
|
||||||
renderMeshes1stPass<MeshShader::ObjectPass1Shader, video::EVT_STANDARD>({ MeshShader::ObjectPass1Shader::getInstance<MeshShader::ObjectPass1Shader>()->TU_tex }, ListDefaultStandardG::Arguments);
|
renderMeshes1stPass<MeshShader::ObjectPass1Shader, video::EVT_STANDARD, 2, 1>({ { MeshShader::ObjectPass1Shader::getInstance()->TU_tex, true } }, ListMatDefault::Arguments);
|
||||||
renderMeshes1stPass<MeshShader::ObjectPass1Shader, video::EVT_2TCOORDS>({ MeshShader::ObjectPass1Shader::getInstance<MeshShader::ObjectPass1Shader>()->TU_tex }, ListDefault2TCoordG::Arguments);
|
renderMeshes1stPass<MeshShader::ObjectPass1Shader, video::EVT_STANDARD, 2, 1>({ { MeshShader::ObjectPass1Shader::getInstance()->TU_tex, true } }, ListMatSphereMap::Arguments);
|
||||||
renderMeshes1stPass<MeshShader::ObjectRefPass1Shader, video::EVT_STANDARD>({ MeshShader::ObjectRefPass1Shader::getInstance<MeshShader::ObjectRefPass1Shader>()->TU_tex }, ListAlphaRefG::Arguments);
|
renderMeshes1stPass<MeshShader::ObjectPass1Shader, video::EVT_STANDARD, 2, 1>({ { MeshShader::ObjectPass1Shader::getInstance()->TU_tex, true } }, ListMatUnlit::Arguments);
|
||||||
renderMeshes1stPass<MeshShader::NormalMapShader, video::EVT_TANGENTS>({ MeshShader::NormalMapShader::getInstance<MeshShader::NormalMapShader>()->TU_glossy, MeshShader::NormalMapShader::getInstance<MeshShader::NormalMapShader>()->TU_normalmap }, ListNormalG::Arguments);
|
renderMeshes1stPass<MeshShader::ObjectPass1Shader, video::EVT_2TCOORDS, 2, 1>({ { MeshShader::ObjectPass1Shader::getInstance()->TU_tex, true } }, ListMatDetails::Arguments);
|
||||||
renderMeshes1stPass<MeshShader::GrassPass1Shader, video::EVT_STANDARD>({ MeshShader::GrassPass1Shader::getInstance<MeshShader::GrassPass1Shader>()->TU_tex }, ListGrassG::Arguments);
|
renderMeshes1stPass<MeshShader::ObjectPass1Shader, video::EVT_2TCOORDS, 2, 1>({ { MeshShader::ObjectPass1Shader::getInstance()->TU_tex, true } }, ListMatSplatting::Arguments);
|
||||||
|
renderMeshes1stPass<MeshShader::ObjectRefPass1Shader, video::EVT_STANDARD, 3, 2, 1>({ { MeshShader::ObjectRefPass1Shader::getInstance()->TU_tex, true } }, ListMatAlphaRef::Arguments);
|
||||||
|
renderMeshes1stPass<MeshShader::GrassPass1Shader, video::EVT_STANDARD, 3, 2, 1>({ { MeshShader::GrassPass1Shader::getInstance()->TU_tex, true } }, ListMatGrass::Arguments);
|
||||||
|
renderMeshes1stPass<MeshShader::NormalMapShader, video::EVT_TANGENTS, 2, 1>({ { MeshShader::NormalMapShader::getInstance()->TU_glossy, true }, { MeshShader::NormalMapShader::getInstance()->TU_normalmap, false } }, ListMatNormalMap::Arguments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, enum E_VERTEX_TYPE VertexType, typename... TupleType>
|
template<typename Shader, enum E_VERTEX_TYPE VertexType, int...List, typename... TupleType>
|
||||||
void renderMeshes2ndPass(const T *Shader, const std::vector<GLuint> &TexUnits, std::vector<std::tuple<TupleType...> > &meshes)
|
void renderMeshes2ndPass(const std::vector<std::pair<GLuint, bool> > &TexUnits, std::vector<std::tuple<TupleType...> > &meshes)
|
||||||
{
|
{
|
||||||
glUseProgram(Shader->Program);
|
glUseProgram(Shader::getInstance()->Program);
|
||||||
glBindVertexArray(getVAO(VertexType));
|
glBindVertexArray(getVAO(VertexType));
|
||||||
for (unsigned i = 0; i < meshes.size(); i++)
|
for (unsigned i = 0; i < meshes.size(); i++)
|
||||||
{
|
{
|
||||||
@ -129,8 +184,8 @@ void renderMeshes2ndPass(const T *Shader, const std::vector<GLuint> &TexUnits, s
|
|||||||
{
|
{
|
||||||
if (!mesh.textures[j])
|
if (!mesh.textures[j])
|
||||||
mesh.textures[j] = getUnicolorTexture(video::SColor(255, 255, 255, 255));
|
mesh.textures[j] = getUnicolorTexture(video::SColor(255, 255, 255, 255));
|
||||||
compressTexture(mesh.textures[j], true);
|
compressTexture(mesh.textures[j], TexUnits[j].second);
|
||||||
setTexture(TexUnits[j], getTextureGLuint(mesh.textures[j]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(TexUnits[j].first, getTextureGLuint(mesh.textures[j]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
if (irr_driver->getLightViz())
|
if (irr_driver->getLightViz())
|
||||||
{
|
{
|
||||||
GLint swizzleMask[] = { GL_ONE, GL_ONE, GL_ONE, GL_ALPHA };
|
GLint swizzleMask[] = { GL_ONE, GL_ONE, GL_ONE, GL_ALPHA };
|
||||||
@ -150,7 +205,7 @@ void renderMeshes2ndPass(const T *Shader, const std::vector<GLuint> &TexUnits, s
|
|||||||
#endif
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
apply_instance<T>(Shader, meshes[i]);
|
custom_unroll_args<List...>::template exec(Shader::getInstance(), meshes[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,14 +231,6 @@ void IrrDriver::renderSolidSecondPass()
|
|||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
glDisable(GL_ALPHA_TEST);
|
glDisable(GL_ALPHA_TEST);
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
ListDefaultStandardSM::Arguments.clear();
|
|
||||||
ListDefaultTangentSM::Arguments.clear();
|
|
||||||
ListAlphaRefSM::Arguments.clear();
|
|
||||||
ListSphereMapSM::Arguments.clear();
|
|
||||||
ListUnlitSM::Arguments.clear();
|
|
||||||
ListDetailSM::Arguments.clear();
|
|
||||||
ListSplattingSM::Arguments.clear();
|
|
||||||
ListGrassSM::Arguments.clear();
|
|
||||||
setTexture(0, m_rtts->getRenderTarget(RTT_TMP1), GL_NEAREST, GL_NEAREST);
|
setTexture(0, m_rtts->getRenderTarget(RTT_TMP1), GL_NEAREST, GL_NEAREST);
|
||||||
setTexture(1, m_rtts->getRenderTarget(RTT_TMP2), GL_NEAREST, GL_NEAREST);
|
setTexture(1, m_rtts->getRenderTarget(RTT_TMP2), GL_NEAREST, GL_NEAREST);
|
||||||
setTexture(2, m_rtts->getRenderTarget(RTT_HALF1_R), GL_LINEAR, GL_LINEAR);
|
setTexture(2, m_rtts->getRenderTarget(RTT_HALF1_R), GL_LINEAR, GL_LINEAR);
|
||||||
@ -193,14 +240,14 @@ void IrrDriver::renderSolidSecondPass()
|
|||||||
|
|
||||||
m_scene_manager->drawAll(scene::ESNRP_SOLID);
|
m_scene_manager->drawAll(scene::ESNRP_SOLID);
|
||||||
|
|
||||||
renderMeshes2ndPass<MeshShader::ObjectPass2Shader, video::EVT_STANDARD>(MeshShader::ObjectPass2ShaderInstance, { MeshShader::ObjectPass2ShaderInstance->TU_Albedo }, ListDefaultStandardSM::Arguments);
|
renderMeshes2ndPass<MeshShader::ObjectPass2Shader, video::EVT_STANDARD, 4, 3, 1>({ { MeshShader::ObjectPass2Shader::getInstance()->TU_Albedo, true } }, ListMatDefault::Arguments);
|
||||||
renderMeshes2ndPass<MeshShader::ObjectPass2Shader, video::EVT_TANGENTS>(MeshShader::ObjectPass2ShaderInstance, { MeshShader::ObjectPass2ShaderInstance->TU_Albedo }, ListDefaultTangentSM::Arguments);
|
renderMeshes2ndPass<MeshShader::ObjectRefPass2Shader, video::EVT_STANDARD, 4, 3, 1 >({ { MeshShader::ObjectRefPass2Shader::getInstance()->TU_Albedo, true } }, ListMatAlphaRef::Arguments);
|
||||||
renderMeshes2ndPass<MeshShader::ObjectRefPass2Shader, video::EVT_STANDARD>(MeshShader::ObjectRefPass2ShaderInstance, { MeshShader::ObjectRefPass2ShaderInstance->TU_Albedo }, ListAlphaRefSM::Arguments);
|
renderMeshes2ndPass<MeshShader::SphereMapShader, video::EVT_STANDARD, 4, 2, 1>({ { MeshShader::SphereMapShader::getInstance()->TU_tex, true } }, ListMatSphereMap::Arguments);
|
||||||
renderMeshes2ndPass<MeshShader::SphereMapShader, video::EVT_STANDARD>(MeshShader::SphereMapShaderInstance, { MeshShader::SphereMapShaderInstance->TU_tex }, ListSphereMapSM::Arguments);
|
renderMeshes2ndPass<MeshShader::DetailledObjectPass2Shader, video::EVT_2TCOORDS, 4, 1>({ { MeshShader::DetailledObjectPass2Shader::getInstance()->TU_Albedo, true }, { MeshShader::DetailledObjectPass2Shader::getInstance()->TU_detail, true } }, ListMatDetails::Arguments);
|
||||||
renderMeshes2ndPass<MeshShader::ObjectUnlitShader, video::EVT_STANDARD>(MeshShader::ObjectUnlitShaderInstance, { MeshShader::ObjectUnlitShaderInstance->TU_tex }, ListUnlitSM::Arguments);
|
renderMeshes2ndPass<MeshShader::GrassPass2Shader, video::EVT_STANDARD, 4, 3, 1>({ { MeshShader::GrassPass2Shader::getInstance()->TU_Albedo, true } }, ListMatGrass::Arguments);
|
||||||
renderMeshes2ndPass<MeshShader::DetailledObjectPass2Shader, video::EVT_2TCOORDS>(MeshShader::DetailledObjectPass2ShaderInstance, { MeshShader::DetailledObjectPass2ShaderInstance->TU_Albedo, MeshShader::DetailledObjectPass2ShaderInstance->TU_detail }, ListDetailSM::Arguments);
|
renderMeshes2ndPass<MeshShader::ObjectUnlitShader, video::EVT_STANDARD, 1>({ { MeshShader::ObjectUnlitShader::getInstance()->TU_tex, true } }, ListMatUnlit::Arguments);
|
||||||
renderMeshes2ndPass<MeshShader::SplattingShader, video::EVT_2TCOORDS>(MeshShader::SplattingShaderInstance, { 8, MeshShader::SplattingShaderInstance->TU_tex_layout, MeshShader::SplattingShaderInstance->TU_tex_detail0, MeshShader::SplattingShaderInstance->TU_tex_detail1, MeshShader::SplattingShaderInstance->TU_tex_detail2, MeshShader::SplattingShaderInstance->TU_tex_detail3 }, ListSplattingSM::Arguments);
|
renderMeshes2ndPass<MeshShader::SplattingShader, video::EVT_2TCOORDS, 3, 1>({ { 8, true }, { MeshShader::SplattingShader::getInstance()->TU_tex_layout, false }, { MeshShader::SplattingShader::getInstance()->TU_tex_detail0, true }, { MeshShader::SplattingShader::getInstance()->TU_tex_detail1, true }, { MeshShader::SplattingShader::getInstance()->TU_tex_detail2, true }, { MeshShader::SplattingShader::getInstance()->TU_tex_detail3, true } }, ListMatSplatting::Arguments);
|
||||||
renderMeshes2ndPass<MeshShader::GrassPass2Shader, video::EVT_STANDARD>(MeshShader::GrassPass2ShaderInstance, { MeshShader::GrassPass2ShaderInstance->TU_Albedo }, ListGrassSM::Arguments);
|
renderMeshes2ndPass<MeshShader::ObjectPass2Shader, video::EVT_TANGENTS, 4, 3, 1>({ { MeshShader::ObjectPass2Shader::getInstance()->TU_Albedo, true } }, ListMatNormalMap::Arguments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,16 +274,16 @@ void IrrDriver::renderTransparent()
|
|||||||
if (World::getWorld() && World::getWorld()->isFogEnabled())
|
if (World::getWorld() && World::getWorld()->isFogEnabled())
|
||||||
{
|
{
|
||||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
renderMeshes2ndPass<MeshShader::TransparentFogShader, video::EVT_STANDARD>(MeshShader::TransparentFogShaderInstance, { MeshShader::TransparentFogShaderInstance->TU_tex }, ListBlendTransparentFog::Arguments);
|
renderMeshes2ndPass<MeshShader::TransparentFogShader, video::EVT_STANDARD, 8, 7, 6, 5, 4, 3, 2, 1>({ { MeshShader::TransparentFogShader::getInstance()->TU_tex, true } }, ListBlendTransparentFog::Arguments);
|
||||||
glBlendFunc(GL_ONE, GL_ONE);
|
glBlendFunc(GL_ONE, GL_ONE);
|
||||||
renderMeshes2ndPass<MeshShader::TransparentFogShader, video::EVT_STANDARD>(MeshShader::TransparentFogShaderInstance, { MeshShader::TransparentFogShaderInstance->TU_tex }, ListAdditiveTransparentFog::Arguments);
|
renderMeshes2ndPass<MeshShader::TransparentFogShader, video::EVT_STANDARD, 8, 7, 6, 5, 4, 3, 2, 1>({ { MeshShader::TransparentFogShader::getInstance()->TU_tex, true } }, ListAdditiveTransparentFog::Arguments);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
renderMeshes2ndPass<MeshShader::TransparentShader, video::EVT_STANDARD>(MeshShader::TransparentShaderInstance, { MeshShader::TransparentShaderInstance->TU_tex }, ListBlendTransparent::Arguments);
|
renderMeshes2ndPass<MeshShader::TransparentShader, video::EVT_STANDARD, 2, 1>({ { MeshShader::TransparentShader::getInstance()->TU_tex, true } }, ListBlendTransparent::Arguments);
|
||||||
glBlendFunc(GL_ONE, GL_ONE);
|
glBlendFunc(GL_ONE, GL_ONE);
|
||||||
renderMeshes2ndPass<MeshShader::TransparentShader, video::EVT_STANDARD>(MeshShader::TransparentShaderInstance, { MeshShader::TransparentShaderInstance->TU_tex }, ListAdditiveTransparent::Arguments);
|
renderMeshes2ndPass<MeshShader::TransparentShader, video::EVT_STANDARD, 2, 1>({ { MeshShader::TransparentShader::getInstance()->TU_tex, true } }, ListAdditiveTransparent::Arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!UserConfigParams::m_dynamic_lights)
|
if (!UserConfigParams::m_dynamic_lights)
|
||||||
@ -318,48 +365,56 @@ void IrrDriver::renderTransparent()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, enum E_VERTEX_TYPE VertexType, typename... Args>
|
template<typename T, typename...uniforms>
|
||||||
void drawShadow(const T *Shader, const std::vector<GLuint> TextureUnits, const std::vector<std::tuple<GLMesh *, core::matrix4, Args...> >&t)
|
void drawShadow(const T *Shader, const GLMesh *mesh, uniforms... Args)
|
||||||
|
{
|
||||||
|
irr_driver->IncreaseObjectCount();
|
||||||
|
GLenum ptype = mesh->PrimitiveType;
|
||||||
|
GLenum itype = mesh->IndexType;
|
||||||
|
size_t count = mesh->IndexCount;
|
||||||
|
|
||||||
|
Shader->setUniforms(Args...);
|
||||||
|
glDrawElementsInstancedBaseVertex(ptype, count, itype, (GLvoid *)mesh->vaoOffset, 4, mesh->vaoBaseVertex);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int...List>
|
||||||
|
struct shadow_custom_unroll_args;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct shadow_custom_unroll_args<>
|
||||||
|
{
|
||||||
|
template<typename T, typename ...TupleTypes, typename ...Args>
|
||||||
|
static void exec(const T *Shader, const std::tuple<TupleTypes...> &t, Args... args)
|
||||||
|
{
|
||||||
|
drawShadow<T>(Shader, std::get<0>(t), args...);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<int N, int...List>
|
||||||
|
struct shadow_custom_unroll_args<N, List...>
|
||||||
|
{
|
||||||
|
template<typename T, typename ...TupleTypes, typename ...Args>
|
||||||
|
static void exec(const T *Shader, const std::tuple<TupleTypes...> &t, Args... args)
|
||||||
|
{
|
||||||
|
shadow_custom_unroll_args<List...>::template exec<T>(Shader, t, std::get<N>(t), args...);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T, enum E_VERTEX_TYPE VertexType, int...List, typename... Args>
|
||||||
|
void renderShadow(const T *Shader, const std::vector<GLuint> TextureUnits, const std::vector<std::tuple<GLMesh *, core::matrix4, Args...> >&t)
|
||||||
{
|
{
|
||||||
glUseProgram(Shader->Program);
|
glUseProgram(Shader->Program);
|
||||||
glBindVertexArray(getVAO(VertexType));
|
glBindVertexArray(getVAO(VertexType));
|
||||||
for (unsigned i = 0; i < t.size(); i++)
|
for (unsigned i = 0; i < t.size(); i++)
|
||||||
{
|
{
|
||||||
const GLMesh *mesh = std::get<0>(t[i]);
|
const GLMesh *mesh = std::get<0>(t[i]);
|
||||||
irr_driver->IncreaseObjectCount();
|
|
||||||
GLenum ptype = mesh->PrimitiveType;
|
|
||||||
GLenum itype = mesh->IndexType;
|
|
||||||
size_t count = mesh->IndexCount;
|
|
||||||
for (unsigned j = 0; j < TextureUnits.size(); j++)
|
for (unsigned j = 0; j < TextureUnits.size(); j++)
|
||||||
{
|
{
|
||||||
compressTexture(mesh->textures[j], true);
|
compressTexture(mesh->textures[j], true);
|
||||||
setTexture(TextureUnits[j], getTextureGLuint(mesh->textures[j]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(TextureUnits[j], getTextureGLuint(mesh->textures[j]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Shader->setUniforms(std::get<1>(t[i]));
|
shadow_custom_unroll_args<List...>::template exec<T>(Shader, t[i]);
|
||||||
glDrawElementsInstancedBaseVertex(ptype, count, itype, (GLvoid *)mesh->vaoOffset, 4, mesh->vaoBaseVertex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void drawShadowGrass(const std::vector<GLuint> TextureUnits, const std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, core::vector3df> > &t)
|
|
||||||
{
|
|
||||||
glUseProgram(MeshShader::GrassShadowShaderInstance->Program);
|
|
||||||
glBindVertexArray(getVAO(EVT_STANDARD));
|
|
||||||
for (unsigned i = 0; i < t.size(); i++)
|
|
||||||
{
|
|
||||||
const GLMesh *mesh = std::get<0>(t[i]);
|
|
||||||
irr_driver->IncreaseObjectCount();
|
|
||||||
GLenum ptype = mesh->PrimitiveType;
|
|
||||||
GLenum itype = mesh->IndexType;
|
|
||||||
size_t count = mesh->IndexCount;
|
|
||||||
for (unsigned j = 0; j < TextureUnits.size(); j++)
|
|
||||||
{
|
|
||||||
compressTexture(mesh->textures[j], true);
|
|
||||||
setTexture(TextureUnits[j], getTextureGLuint(mesh->textures[j]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
MeshShader::GrassShadowShaderInstance->setUniforms(std::get<1>(t[i]), std::get<3>(t[i]));
|
|
||||||
glDrawElementsInstancedBaseVertex(ptype, count, itype, (GLvoid *)mesh->vaoOffset, 4, mesh->vaoBaseVertex);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,9 +425,11 @@ void drawRSM(const core::matrix4 & rsm_matrix, const std::vector<GLuint> Texture
|
|||||||
glBindVertexArray(getVAO(VertexType));
|
glBindVertexArray(getVAO(VertexType));
|
||||||
for (unsigned i = 0; i < t.size(); i++)
|
for (unsigned i = 0; i < t.size(); i++)
|
||||||
{
|
{
|
||||||
const GLMesh *mesh = std::get<0>(t[i]);
|
GLMesh *mesh = std::get<0>(t[i]);
|
||||||
for (unsigned j = 0; j < TextureUnits.size(); j++)
|
for (unsigned j = 0; j < TextureUnits.size(); j++)
|
||||||
{
|
{
|
||||||
|
if (!mesh->textures[j])
|
||||||
|
mesh->textures[j] = getUnicolorTexture(video::SColor(255, 255, 255, 255));
|
||||||
compressTexture(mesh->textures[j], true);
|
compressTexture(mesh->textures[j], true);
|
||||||
setTexture(TextureUnits[j], getTextureGLuint(mesh->textures[j]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(TextureUnits[j], getTextureGLuint(mesh->textures[j]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
}
|
}
|
||||||
@ -382,23 +439,36 @@ void drawRSM(const core::matrix4 & rsm_matrix, const std::vector<GLuint> Texture
|
|||||||
|
|
||||||
void IrrDriver::renderShadows()
|
void IrrDriver::renderShadows()
|
||||||
{
|
{
|
||||||
irr_driver->setPhase(SHADOW_PASS);
|
glDepthFunc(GL_LEQUAL);
|
||||||
|
glDepthMask(GL_TRUE);
|
||||||
|
glEnable(GL_DEPTH_TEST);
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
|
glDisable(GL_ALPHA_TEST);
|
||||||
glEnable(GL_POLYGON_OFFSET_FILL);
|
glEnable(GL_POLYGON_OFFSET_FILL);
|
||||||
glPolygonOffset(1.5, 0.);
|
glPolygonOffset(1.5, 0.);
|
||||||
m_rtts->getShadowFBO().Bind();
|
m_rtts->getShadowFBO().Bind();
|
||||||
glClear(GL_DEPTH_BUFFER_BIT);
|
glClear(GL_DEPTH_BUFFER_BIT);
|
||||||
glDrawBuffer(GL_NONE);
|
glDrawBuffer(GL_NONE);
|
||||||
|
|
||||||
glBindBufferBase(GL_UNIFORM_BUFFER, 0, SharedObject::ViewProjectionMatrixesUBO);
|
irr_driver->setPhase(SHADOW_PASS);
|
||||||
|
ListMatDefault::Arguments.clear();
|
||||||
|
ListMatAlphaRef::Arguments.clear();
|
||||||
|
ListMatSphereMap::Arguments.clear();
|
||||||
|
ListMatDetails::Arguments.clear();
|
||||||
|
ListMatUnlit::Arguments.clear();
|
||||||
|
ListMatNormalMap::Arguments.clear();
|
||||||
|
ListMatGrass::Arguments.clear();
|
||||||
|
ListMatSplatting::Arguments.clear();
|
||||||
m_scene_manager->drawAll(scene::ESNRP_SOLID);
|
m_scene_manager->drawAll(scene::ESNRP_SOLID);
|
||||||
|
|
||||||
drawShadow<MeshShader::ShadowShader, EVT_STANDARD>(MeshShader::ShadowShaderInstance, {}, ListDefaultStandardG::Arguments);
|
renderShadow<MeshShader::ShadowShader, EVT_STANDARD, 1>(MeshShader::ShadowShaderInstance, {}, ListMatDefault::Arguments);
|
||||||
drawShadow<MeshShader::ShadowShader, EVT_2TCOORDS>(MeshShader::ShadowShaderInstance, {}, ListDefault2TCoordG::Arguments);
|
renderShadow<MeshShader::ShadowShader, EVT_STANDARD, 1>(MeshShader::ShadowShaderInstance, {}, ListMatSphereMap::Arguments);
|
||||||
drawShadow<MeshShader::ShadowShader, EVT_TANGENTS>(MeshShader::ShadowShaderInstance, {}, ListNormalG::Arguments);
|
renderShadow<MeshShader::ShadowShader, EVT_STANDARD, 1>(MeshShader::ShadowShaderInstance, {}, ListMatUnlit::Arguments);
|
||||||
drawShadow<MeshShader::RefShadowShader, EVT_STANDARD>(MeshShader::RefShadowShaderInstance, { MeshShader::RefShadowShaderInstance->TU_tex }, ListAlphaRefG::Arguments);
|
renderShadow<MeshShader::ShadowShader, EVT_2TCOORDS, 1>(MeshShader::ShadowShaderInstance, {}, ListMatDetails::Arguments);
|
||||||
drawShadowGrass({ MeshShader::GrassShadowShaderInstance->TU_tex }, ListGrassG::Arguments);
|
renderShadow<MeshShader::ShadowShader, EVT_2TCOORDS, 1>(MeshShader::ShadowShaderInstance, {}, ListMatSplatting::Arguments);
|
||||||
|
renderShadow<MeshShader::ShadowShader, EVT_TANGENTS, 1>(MeshShader::ShadowShaderInstance, {}, ListMatNormalMap::Arguments);
|
||||||
|
renderShadow<MeshShader::RefShadowShader, EVT_STANDARD, 1>(MeshShader::RefShadowShaderInstance, { MeshShader::RefShadowShaderInstance->TU_tex }, ListMatAlphaRef::Arguments);
|
||||||
|
renderShadow<MeshShader::GrassShadowShader, EVT_STANDARD, 3, 1>(MeshShader::GrassShadowShaderInstance, { MeshShader::GrassShadowShaderInstance->TU_tex }, ListMatGrass::Arguments);
|
||||||
|
|
||||||
glDisable(GL_POLYGON_OFFSET_FILL);
|
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||||
|
|
||||||
@ -408,6 +478,9 @@ void IrrDriver::renderShadows()
|
|||||||
m_rtts->getRSM().Bind();
|
m_rtts->getRSM().Bind();
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
drawRSM<EVT_STANDARD>(rsm_matrix, { MeshShader::RSMShader::TU_tex }, ListDefaultStandardG::Arguments);
|
drawRSM<EVT_STANDARD>(rsm_matrix, { MeshShader::RSMShader::TU_tex }, ListMatDefault::Arguments);
|
||||||
drawRSM<EVT_2TCOORDS>(rsm_matrix, { MeshShader::RSMShader::TU_tex }, ListDefault2TCoordG::Arguments);
|
drawRSM<EVT_STANDARD>(rsm_matrix, { MeshShader::RSMShader::TU_tex }, ListMatSphereMap::Arguments);
|
||||||
}
|
drawRSM<EVT_STANDARD>(rsm_matrix, { MeshShader::RSMShader::TU_tex }, ListMatUnlit::Arguments);
|
||||||
|
drawRSM<EVT_2TCOORDS>(rsm_matrix, { MeshShader::RSMShader::TU_tex }, ListMatDetails::Arguments);
|
||||||
|
drawRSM<EVT_2TCOORDS>(rsm_matrix, { MeshShader::RSMShader::TU_tex }, ListMatSplatting::Arguments);
|
||||||
|
}
|
||||||
|
@ -328,19 +328,10 @@ void Shaders::loadShaders()
|
|||||||
MeshShader::InstancedObjectPass1ShaderInstance = new MeshShader::InstancedObjectPass1Shader();
|
MeshShader::InstancedObjectPass1ShaderInstance = new MeshShader::InstancedObjectPass1Shader();
|
||||||
MeshShader::InstancedObjectRefPass1ShaderInstance = new MeshShader::InstancedObjectRefPass1Shader();
|
MeshShader::InstancedObjectRefPass1ShaderInstance = new MeshShader::InstancedObjectRefPass1Shader();
|
||||||
MeshShader::InstancedGrassPass1ShaderInstance = new MeshShader::InstancedGrassPass1Shader();
|
MeshShader::InstancedGrassPass1ShaderInstance = new MeshShader::InstancedGrassPass1Shader();
|
||||||
MeshShader::ObjectPass2ShaderInstance = new MeshShader::ObjectPass2Shader();
|
|
||||||
MeshShader::InstancedObjectPass2ShaderInstance = new MeshShader::InstancedObjectPass2Shader();
|
MeshShader::InstancedObjectPass2ShaderInstance = new MeshShader::InstancedObjectPass2Shader();
|
||||||
MeshShader::InstancedObjectRefPass2ShaderInstance = new MeshShader::InstancedObjectRefPass2Shader();
|
MeshShader::InstancedObjectRefPass2ShaderInstance = new MeshShader::InstancedObjectRefPass2Shader();
|
||||||
MeshShader::InstancedGrassPass2ShaderInstance = new MeshShader::InstancedGrassPass2Shader();
|
MeshShader::InstancedGrassPass2ShaderInstance = new MeshShader::InstancedGrassPass2Shader();
|
||||||
MeshShader::DetailledObjectPass2ShaderInstance = new MeshShader::DetailledObjectPass2Shader();
|
|
||||||
MeshShader::ObjectRefPass2ShaderInstance = new MeshShader::ObjectRefPass2Shader();
|
|
||||||
MeshShader::ObjectUnlitShaderInstance = new MeshShader::ObjectUnlitShader();
|
|
||||||
MeshShader::SphereMapShaderInstance = new MeshShader::SphereMapShader();
|
|
||||||
MeshShader::SplattingShaderInstance = new MeshShader::SplattingShader();
|
|
||||||
MeshShader::GrassPass2ShaderInstance = new MeshShader::GrassPass2Shader();
|
|
||||||
MeshShader::BubbleShader::init();
|
MeshShader::BubbleShader::init();
|
||||||
MeshShader::TransparentShaderInstance = new MeshShader::TransparentShader();
|
|
||||||
MeshShader::TransparentFogShaderInstance = new MeshShader::TransparentFogShader();
|
|
||||||
MeshShader::BillboardShader::init();
|
MeshShader::BillboardShader::init();
|
||||||
LightShader::PointLightShader::init();
|
LightShader::PointLightShader::init();
|
||||||
MeshShader::DisplaceShaderInstance = new MeshShader::DisplaceShader();
|
MeshShader::DisplaceShaderInstance = new MeshShader::DisplaceShader();
|
||||||
|
@ -198,7 +198,7 @@ public:
|
|||||||
|
|
||||||
extern InstancedGrassPass1Shader *InstancedGrassPass1ShaderInstance;
|
extern InstancedGrassPass1Shader *InstancedGrassPass1ShaderInstance;
|
||||||
|
|
||||||
class ObjectPass2Shader : public ShaderHelper<core::matrix4, core::matrix4, video::SColorf>
|
class ObjectPass2Shader : public ShaderHelperSingleton<ObjectPass2Shader, core::matrix4, core::matrix4, video::SColorf>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GLuint TU_Albedo;
|
GLuint TU_Albedo;
|
||||||
@ -206,8 +206,6 @@ public:
|
|||||||
ObjectPass2Shader();
|
ObjectPass2Shader();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern ObjectPass2Shader *ObjectPass2ShaderInstance;
|
|
||||||
|
|
||||||
class InstancedObjectPass2Shader : public ShaderHelper<video::SColorf>
|
class InstancedObjectPass2Shader : public ShaderHelper<video::SColorf>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -228,7 +226,7 @@ public:
|
|||||||
|
|
||||||
extern InstancedObjectRefPass2Shader *InstancedObjectRefPass2ShaderInstance;
|
extern InstancedObjectRefPass2Shader *InstancedObjectRefPass2ShaderInstance;
|
||||||
|
|
||||||
class DetailledObjectPass2Shader : public ShaderHelper<core::matrix4, video::SColorf>
|
class DetailledObjectPass2Shader : public ShaderHelperSingleton<DetailledObjectPass2Shader, core::matrix4, video::SColorf>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GLuint TU_Albedo, TU_detail;
|
GLuint TU_Albedo, TU_detail;
|
||||||
@ -236,9 +234,7 @@ public:
|
|||||||
DetailledObjectPass2Shader();
|
DetailledObjectPass2Shader();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern DetailledObjectPass2Shader *DetailledObjectPass2ShaderInstance;
|
class ObjectUnlitShader : public ShaderHelperSingleton<ObjectUnlitShader, core::matrix4>
|
||||||
|
|
||||||
class ObjectUnlitShader : public ShaderHelper<core::matrix4>
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GLuint TU_tex;
|
GLuint TU_tex;
|
||||||
@ -246,9 +242,7 @@ public:
|
|||||||
ObjectUnlitShader();
|
ObjectUnlitShader();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern ObjectUnlitShader *ObjectUnlitShaderInstance;
|
class ObjectRefPass2Shader : public ShaderHelperSingleton<ObjectRefPass2Shader, core::matrix4, core::matrix4, video::SColorf>
|
||||||
|
|
||||||
class ObjectRefPass2Shader : public ShaderHelper<core::matrix4, core::matrix4, video::SColorf>
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GLuint TU_Albedo;
|
GLuint TU_Albedo;
|
||||||
@ -256,9 +250,7 @@ public:
|
|||||||
ObjectRefPass2Shader();
|
ObjectRefPass2Shader();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern ObjectRefPass2Shader *ObjectRefPass2ShaderInstance;
|
class GrassPass2Shader : public ShaderHelperSingleton<GrassPass2Shader, core::matrix4, core::vector3df, video::SColorf>
|
||||||
|
|
||||||
class GrassPass2Shader : public ShaderHelper<core::matrix4, core::vector3df, video::SColorf>
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GLuint TU_Albedo;
|
GLuint TU_Albedo;
|
||||||
@ -266,8 +258,6 @@ public:
|
|||||||
GrassPass2Shader();
|
GrassPass2Shader();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern GrassPass2Shader *GrassPass2ShaderInstance;
|
|
||||||
|
|
||||||
class InstancedGrassPass2Shader : public ShaderHelper<core::vector3df, core::vector3df, video::SColorf>
|
class InstancedGrassPass2Shader : public ShaderHelper<core::vector3df, core::vector3df, video::SColorf>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -278,7 +268,7 @@ public:
|
|||||||
|
|
||||||
extern InstancedGrassPass2Shader *InstancedGrassPass2ShaderInstance;
|
extern InstancedGrassPass2Shader *InstancedGrassPass2ShaderInstance;
|
||||||
|
|
||||||
class SphereMapShader : public ShaderHelper<core::matrix4, core::matrix4, video::SColorf>
|
class SphereMapShader : public ShaderHelperSingleton<SphereMapShader, core::matrix4, core::matrix4, video::SColorf>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GLuint TU_tex;
|
GLuint TU_tex;
|
||||||
@ -286,9 +276,7 @@ public:
|
|||||||
SphereMapShader();
|
SphereMapShader();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern SphereMapShader *SphereMapShaderInstance;
|
class SplattingShader : public ShaderHelperSingleton<SplattingShader, core::matrix4, video::SColorf>
|
||||||
|
|
||||||
class SplattingShader : public ShaderHelper<core::matrix4, video::SColorf>
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GLuint TU_tex_layout, TU_tex_detail0, TU_tex_detail1, TU_tex_detail2, TU_tex_detail3;
|
GLuint TU_tex_layout, TU_tex_detail0, TU_tex_detail1, TU_tex_detail2, TU_tex_detail3;
|
||||||
@ -296,8 +284,6 @@ public:
|
|||||||
SplattingShader();
|
SplattingShader();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern SplattingShader *SplattingShaderInstance;
|
|
||||||
|
|
||||||
class BubbleShader
|
class BubbleShader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -308,7 +294,7 @@ public:
|
|||||||
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix, unsigned TU_tex, float time, float transparency);
|
static void setUniforms(const core::matrix4 &ModelViewProjectionMatrix, unsigned TU_tex, float time, float transparency);
|
||||||
};
|
};
|
||||||
|
|
||||||
class TransparentShader : public ShaderHelper<core::matrix4, core::matrix4>
|
class TransparentShader : public ShaderHelperSingleton<TransparentShader, core::matrix4, core::matrix4>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GLuint TU_tex;
|
GLuint TU_tex;
|
||||||
@ -316,9 +302,7 @@ public:
|
|||||||
TransparentShader();
|
TransparentShader();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern TransparentShader *TransparentShaderInstance;
|
class TransparentFogShader : public ShaderHelperSingleton<TransparentFogShader, core::matrix4, core::matrix4, float, float, float, float, float, video::SColorf>
|
||||||
|
|
||||||
class TransparentFogShader : public ShaderHelper<core::matrix4, core::matrix4, float, float, float, float, float, video::SColorf>
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GLuint TU_tex;
|
GLuint TU_tex;
|
||||||
@ -326,8 +310,6 @@ public:
|
|||||||
TransparentFogShader();
|
TransparentFogShader();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern TransparentFogShader *TransparentFogShaderInstance;
|
|
||||||
|
|
||||||
class BillboardShader
|
class BillboardShader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -39,10 +39,8 @@ void STKAnimatedMesh::setMesh(scene::IAnimatedMesh* mesh)
|
|||||||
{
|
{
|
||||||
firstTime = true;
|
firstTime = true;
|
||||||
GLmeshes.clear();
|
GLmeshes.clear();
|
||||||
for (unsigned i = 0; i < FPSM_COUNT; i++)
|
for (unsigned i = 0; i < MAT_COUNT; i++)
|
||||||
GeometricMesh[i].clearWithoutDeleting();
|
MeshSolidMaterial[i].clearWithoutDeleting();
|
||||||
for (unsigned i = 0; i < SM_COUNT; i++)
|
|
||||||
ShadedMesh[i].clearWithoutDeleting();
|
|
||||||
CAnimatedMeshSceneNode::setMesh(mesh);
|
CAnimatedMeshSceneNode::setMesh(mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,10 +96,8 @@ void STKAnimatedMesh::render()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GeometricMaterial GeometricType = MaterialTypeToGeometricMaterial(type, mb->getVertexType());
|
MeshMaterial MatType = MaterialTypeToMeshMaterial(type, mb->getVertexType());
|
||||||
ShadedMaterial ShadedType = MaterialTypeToShadedMaterial(type, mesh.textures, mb->getVertexType());
|
MeshSolidMaterial[MatType].push_back(&mesh);
|
||||||
GeometricMesh[GeometricType].push_back(&mesh);
|
|
||||||
ShadedMesh[ShadedType].push_back(&mesh);
|
|
||||||
}
|
}
|
||||||
std::pair<unsigned, unsigned> p = getVAOOffsetAndBase(mb);
|
std::pair<unsigned, unsigned> p = getVAOOffsetAndBase(mb);
|
||||||
mesh.vaoBaseVertex = p.first;
|
mesh.vaoBaseVertex = p.first;
|
||||||
@ -117,7 +113,7 @@ void STKAnimatedMesh::render()
|
|||||||
const video::SMaterial& material = ReadOnlyMaterials ? mb->getMaterial() : Materials[i];
|
const video::SMaterial& material = ReadOnlyMaterials ? mb->getMaterial() : Materials[i];
|
||||||
if (isObject(material.MaterialType))
|
if (isObject(material.MaterialType))
|
||||||
{
|
{
|
||||||
if (irr_driver->getPhase() == SOLID_NORMAL_AND_DEPTH_PASS || irr_driver->getPhase() == TRANSPARENT_PASS)
|
if (irr_driver->getPhase() == SOLID_NORMAL_AND_DEPTH_PASS || irr_driver->getPhase() == TRANSPARENT_PASS || irr_driver->getPhase() == SHADOW_PASS)
|
||||||
{
|
{
|
||||||
glBindVertexArray(0);
|
glBindVertexArray(0);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, getVBO(mb->getVertexType()));
|
glBindBuffer(GL_ARRAY_BUFFER, getVBO(mb->getVertexType()));
|
||||||
@ -137,45 +133,24 @@ void STKAnimatedMesh::render()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (irr_driver->getPhase() == SOLID_NORMAL_AND_DEPTH_PASS)
|
if (irr_driver->getPhase() == SOLID_NORMAL_AND_DEPTH_PASS || irr_driver->getPhase() == SHADOW_PASS)
|
||||||
{
|
{
|
||||||
ModelViewProjectionMatrix = computeMVP(AbsoluteTransformation);
|
ModelViewProjectionMatrix = computeMVP(AbsoluteTransformation);
|
||||||
core::matrix4 invmodel;
|
core::matrix4 invmodel;
|
||||||
AbsoluteTransformation.getInverse(invmodel);
|
AbsoluteTransformation.getInverse(invmodel);
|
||||||
|
|
||||||
GLMesh* mesh;
|
GLMesh* mesh;
|
||||||
for_in(mesh, GeometricMesh[FPSM_DEFAULT_STANDARD])
|
for_in(mesh, MeshSolidMaterial[MAT_DEFAULT])
|
||||||
ListDefaultStandardG::Arguments.push_back(std::make_tuple(mesh, AbsoluteTransformation, invmodel));
|
ListMatDefault::Arguments.emplace_back(mesh, AbsoluteTransformation, invmodel, mesh->TextureMatrix, irr_driver->getSceneManager()->getAmbientLight());
|
||||||
|
|
||||||
for_in(mesh, GeometricMesh[FPSM_DEFAULT_2TCOORD])
|
for_in(mesh, MeshSolidMaterial[MAT_ALPHA_REF])
|
||||||
ListDefault2TCoordG::Arguments.push_back(std::make_tuple(mesh, AbsoluteTransformation, invmodel));
|
ListMatAlphaRef::Arguments.emplace_back(mesh, AbsoluteTransformation, invmodel, mesh->TextureMatrix, irr_driver->getSceneManager()->getAmbientLight());
|
||||||
|
|
||||||
for_in(mesh, GeometricMesh[FPSM_ALPHA_REF_TEXTURE])
|
for_in(mesh, MeshSolidMaterial[MAT_DETAIL])
|
||||||
ListAlphaRefG::Arguments.push_back(std::make_tuple(mesh, AbsoluteTransformation, invmodel, mesh->TextureMatrix));
|
ListMatDetails::Arguments.emplace_back(mesh, AbsoluteTransformation, invmodel, mesh->TextureMatrix, irr_driver->getSceneManager()->getAmbientLight());
|
||||||
|
|
||||||
return;
|
for_in(mesh, MeshSolidMaterial[MAT_UNLIT])
|
||||||
}
|
ListMatUnlit::Arguments.emplace_back(mesh, AbsoluteTransformation, core::matrix4::EM4CONST_IDENTITY);
|
||||||
|
|
||||||
if (irr_driver->getPhase() == SOLID_LIT_PASS)
|
|
||||||
{
|
|
||||||
core::matrix4 invmodel;
|
|
||||||
AbsoluteTransformation.getInverse(invmodel);
|
|
||||||
|
|
||||||
GLMesh* mesh;
|
|
||||||
for_in(mesh, ShadedMesh[SM_DEFAULT_STANDARD])
|
|
||||||
ListDefaultStandardSM::Arguments.push_back(std::make_tuple(mesh, AbsoluteTransformation, mesh->TextureMatrix, irr_driver->getSceneManager()->getAmbientLight()));
|
|
||||||
|
|
||||||
for_in(mesh, ShadedMesh[SM_DEFAULT_TANGENT])
|
|
||||||
ListDefaultTangentSM::Arguments.push_back(std::make_tuple(mesh, AbsoluteTransformation, mesh->TextureMatrix, irr_driver->getSceneManager()->getAmbientLight()));
|
|
||||||
|
|
||||||
for_in(mesh, ShadedMesh[SM_ALPHA_REF_TEXTURE])
|
|
||||||
ListAlphaRefSM::Arguments.push_back(std::make_tuple(mesh, AbsoluteTransformation, mesh->TextureMatrix, irr_driver->getSceneManager()->getAmbientLight()));
|
|
||||||
|
|
||||||
for_in (mesh, ShadedMesh[SM_UNLIT])
|
|
||||||
ListUnlitSM::Arguments.push_back(std::make_tuple(mesh, AbsoluteTransformation));
|
|
||||||
|
|
||||||
for_in(mesh, ShadedMesh[SM_DETAILS])
|
|
||||||
ListDetailSM::Arguments.push_back(std::make_tuple(mesh, AbsoluteTransformation, irr_driver->getSceneManager()->getAmbientLight()));
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -216,10 +191,10 @@ void STKAnimatedMesh::render()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
for_in(mesh, TransparentMesh[TM_DEFAULT])
|
for_in(mesh, TransparentMesh[TM_DEFAULT])
|
||||||
ListBlendTransparent::Arguments.push_back(std::make_tuple(mesh, AbsoluteTransformation, mesh->TextureMatrix));
|
ListBlendTransparent::Arguments.emplace_back(mesh, AbsoluteTransformation, mesh->TextureMatrix);
|
||||||
|
|
||||||
for_in(mesh, TransparentMesh[TM_ADDITIVE])
|
for_in(mesh, TransparentMesh[TM_ADDITIVE])
|
||||||
ListAdditiveTransparent::Arguments.push_back(std::make_tuple(mesh, AbsoluteTransformation, mesh->TextureMatrix));
|
ListAdditiveTransparent::Arguments.emplace_back(mesh, AbsoluteTransformation, mesh->TextureMatrix);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,7 @@ class STKAnimatedMesh : public irr::scene::CAnimatedMeshSceneNode
|
|||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
bool firstTime;
|
bool firstTime;
|
||||||
PtrVector<GLMesh, REF> GeometricMesh[FPSM_COUNT];
|
PtrVector<GLMesh, REF> MeshSolidMaterial[MAT_COUNT];
|
||||||
PtrVector<GLMesh, REF> ShadedMesh[SM_COUNT];
|
|
||||||
PtrVector<GLMesh, REF> TransparentMesh[TM_COUNT];
|
PtrVector<GLMesh, REF> TransparentMesh[TM_COUNT];
|
||||||
std::vector<GLMesh> GLmeshes;
|
std::vector<GLMesh> GLmeshes;
|
||||||
core::matrix4 ModelViewProjectionMatrix;
|
core::matrix4 ModelViewProjectionMatrix;
|
||||||
|
@ -55,7 +55,7 @@ void STKInstancedSceneNode::createGLMeshes()
|
|||||||
isMaterialInitialized = false;
|
isMaterialInitialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void STKInstancedSceneNode::initinstancedvaostate(GLMesh &mesh, GeometricMaterial GeoMat, ShadedMaterial ShadedMat)
|
void STKInstancedSceneNode::initinstancedvaostate(GLMesh &mesh)
|
||||||
{
|
{
|
||||||
mesh.vao = createVAO(mesh.vertex_buffer, mesh.index_buffer, getVTXTYPEFromStride(mesh.Stride));
|
mesh.vao = createVAO(mesh.vertex_buffer, mesh.index_buffer, getVTXTYPEFromStride(mesh.Stride));
|
||||||
glGenBuffers(1, &instances_vbo);
|
glGenBuffers(1, &instances_vbo);
|
||||||
@ -99,11 +99,9 @@ void STKInstancedSceneNode::setFirstTimeMaterial()
|
|||||||
video::E_MATERIAL_TYPE type = mb->getMaterial().MaterialType;
|
video::E_MATERIAL_TYPE type = mb->getMaterial().MaterialType;
|
||||||
|
|
||||||
GLMesh &mesh = GLmeshes[i];
|
GLMesh &mesh = GLmeshes[i];
|
||||||
GeometricMaterial GeometricType = MaterialTypeToGeometricMaterial(type, mb->getVertexType());
|
MeshMaterial MatType = MaterialTypeToMeshMaterial(type, mb->getVertexType());
|
||||||
ShadedMaterial ShadedType = MaterialTypeToShadedMaterial(type, mesh.textures, mb->getVertexType());
|
initinstancedvaostate(mesh);
|
||||||
initinstancedvaostate(mesh, GeometricType, ShadedType);
|
MeshSolidMaterial[MatType].push_back(&mesh);
|
||||||
GeometricMesh[GeometricType].push_back(&mesh);
|
|
||||||
ShadedMesh[ShadedType].push_back(&mesh);
|
|
||||||
}
|
}
|
||||||
isMaterialInitialized = true;
|
isMaterialInitialized = true;
|
||||||
}
|
}
|
||||||
@ -224,7 +222,7 @@ static void drawFSPMGrass(GLMesh &mesh, const core::vector3df &windDir, size_t i
|
|||||||
glDrawElementsInstanced(ptype, count, itype, 0, instance_count);
|
glDrawElementsInstanced(ptype, count, itype, 0, instance_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drawSMDefault(GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix, size_t instance_count)
|
static void drawSMDefault(GLMesh &mesh, size_t instance_count)
|
||||||
{
|
{
|
||||||
irr_driver->IncreaseObjectCount();
|
irr_driver->IncreaseObjectCount();
|
||||||
GLenum ptype = mesh.PrimitiveType;
|
GLenum ptype = mesh.PrimitiveType;
|
||||||
@ -249,7 +247,7 @@ static void drawSMDefault(GLMesh &mesh, const core::matrix4 &ModelViewProjection
|
|||||||
glDrawElementsInstanced(ptype, count, itype, 0, instance_count);
|
glDrawElementsInstanced(ptype, count, itype, 0, instance_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drawSMAlphaRefTexture(GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix, size_t instance_count)
|
static void drawSMAlphaRefTexture(GLMesh &mesh, size_t instance_count)
|
||||||
{
|
{
|
||||||
irr_driver->IncreaseObjectCount();
|
irr_driver->IncreaseObjectCount();
|
||||||
GLenum ptype = mesh.PrimitiveType;
|
GLenum ptype = mesh.PrimitiveType;
|
||||||
@ -275,7 +273,7 @@ static void drawSMAlphaRefTexture(GLMesh &mesh, const core::matrix4 &ModelViewPr
|
|||||||
glDrawElementsInstanced(ptype, count, itype, 0, instance_count);
|
glDrawElementsInstanced(ptype, count, itype, 0, instance_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drawSMGrass(GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix, const core::vector3df &windDir, size_t instance_count)
|
static void drawSMGrass(GLMesh &mesh, const core::vector3df &windDir, size_t instance_count)
|
||||||
{
|
{
|
||||||
irr_driver->IncreaseObjectCount();
|
irr_driver->IncreaseObjectCount();
|
||||||
GLenum ptype = mesh.PrimitiveType;
|
GLenum ptype = mesh.PrimitiveType;
|
||||||
@ -318,59 +316,59 @@ void STKInstancedSceneNode::render()
|
|||||||
ModelViewProjectionMatrix = irr_driver->getProjMatrix();
|
ModelViewProjectionMatrix = irr_driver->getProjMatrix();
|
||||||
ModelViewProjectionMatrix *= irr_driver->getViewMatrix();
|
ModelViewProjectionMatrix *= irr_driver->getViewMatrix();
|
||||||
|
|
||||||
if (!GeometricMesh[FPSM_DEFAULT_STANDARD].empty())
|
if (!MeshSolidMaterial[MAT_DEFAULT].empty())
|
||||||
glUseProgram(MeshShader::InstancedObjectPass1ShaderInstance->Program);
|
glUseProgram(MeshShader::InstancedObjectPass1ShaderInstance->Program);
|
||||||
for (unsigned i = 0; i < GeometricMesh[FPSM_DEFAULT_STANDARD].size(); i++)
|
for (unsigned i = 0; i < MeshSolidMaterial[MAT_DEFAULT].size(); i++)
|
||||||
drawFSPMDefault(*GeometricMesh[FPSM_DEFAULT_STANDARD][i], instance_pos.size() / 9);
|
drawFSPMDefault(*MeshSolidMaterial[MAT_DEFAULT][i], instance_pos.size() / 9);
|
||||||
|
|
||||||
if (!GeometricMesh[FPSM_ALPHA_REF_TEXTURE].empty())
|
if (!MeshSolidMaterial[MAT_ALPHA_REF].empty())
|
||||||
glUseProgram(MeshShader::InstancedObjectRefPass1ShaderInstance->Program);
|
glUseProgram(MeshShader::InstancedObjectRefPass1ShaderInstance->Program);
|
||||||
for (unsigned i = 0; i < GeometricMesh[FPSM_ALPHA_REF_TEXTURE].size(); i++)
|
for (unsigned i = 0; i < MeshSolidMaterial[MAT_ALPHA_REF].size(); i++)
|
||||||
drawFSPMAlphaRefTexture(*GeometricMesh[FPSM_ALPHA_REF_TEXTURE][i], instance_pos.size() / 9);
|
drawFSPMAlphaRefTexture(*MeshSolidMaterial[MAT_ALPHA_REF][i], instance_pos.size() / 9);
|
||||||
|
|
||||||
windDir = getWind();
|
windDir = getWind();
|
||||||
if (!GeometricMesh[FPSM_GRASS].empty())
|
if (!MeshSolidMaterial[MAT_GRASS].empty())
|
||||||
glUseProgram(MeshShader::InstancedGrassPass1ShaderInstance->Program);
|
glUseProgram(MeshShader::InstancedGrassPass1ShaderInstance->Program);
|
||||||
for (unsigned i = 0; i < GeometricMesh[FPSM_GRASS].size(); i++)
|
for (unsigned i = 0; i < MeshSolidMaterial[MAT_GRASS].size(); i++)
|
||||||
drawFSPMGrass(*GeometricMesh[FPSM_GRASS][i], windDir, instance_pos.size() / 9);
|
drawFSPMGrass(*MeshSolidMaterial[MAT_GRASS][i], windDir, instance_pos.size() / 9);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (irr_driver->getPhase() == SOLID_LIT_PASS)
|
if (irr_driver->getPhase() == SOLID_LIT_PASS)
|
||||||
{
|
{
|
||||||
if (!ShadedMesh[SM_DEFAULT_STANDARD].empty())
|
if (!MeshSolidMaterial[MAT_DEFAULT].empty())
|
||||||
glUseProgram(MeshShader::InstancedObjectPass2ShaderInstance->Program);
|
glUseProgram(MeshShader::InstancedObjectPass2ShaderInstance->Program);
|
||||||
for (unsigned i = 0; i < ShadedMesh[SM_DEFAULT_STANDARD].size(); i++)
|
for (unsigned i = 0; i < MeshSolidMaterial[MAT_DEFAULT].size(); i++)
|
||||||
drawSMDefault(*ShadedMesh[SM_DEFAULT_STANDARD][i], ModelViewProjectionMatrix, instance_pos.size() / 9);
|
drawSMDefault(*MeshSolidMaterial[MAT_DEFAULT][i], instance_pos.size() / 9);
|
||||||
|
|
||||||
if (!ShadedMesh[SM_ALPHA_REF_TEXTURE].empty())
|
if (!MeshSolidMaterial[MAT_ALPHA_REF].empty())
|
||||||
glUseProgram(MeshShader::InstancedObjectRefPass2ShaderInstance->Program);
|
glUseProgram(MeshShader::InstancedObjectRefPass2ShaderInstance->Program);
|
||||||
for (unsigned i = 0; i < ShadedMesh[SM_ALPHA_REF_TEXTURE].size(); i++)
|
for (unsigned i = 0; i < MeshSolidMaterial[MAT_ALPHA_REF].size(); i++)
|
||||||
drawSMAlphaRefTexture(*ShadedMesh[SM_ALPHA_REF_TEXTURE][i], ModelViewProjectionMatrix, instance_pos.size() / 9);
|
drawSMAlphaRefTexture(*MeshSolidMaterial[MAT_ALPHA_REF][i], instance_pos.size() / 9);
|
||||||
|
|
||||||
if (!ShadedMesh[SM_GRASS].empty())
|
if (!MeshSolidMaterial[MAT_GRASS].empty())
|
||||||
glUseProgram(MeshShader::InstancedGrassPass2ShaderInstance->Program);
|
glUseProgram(MeshShader::InstancedGrassPass2ShaderInstance->Program);
|
||||||
for (unsigned i = 0; i < ShadedMesh[SM_GRASS].size(); i++)
|
for (unsigned i = 0; i < MeshSolidMaterial[MAT_GRASS].size(); i++)
|
||||||
drawSMGrass(*ShadedMesh[SM_GRASS][i], ModelViewProjectionMatrix, windDir, instance_pos.size() / 9);
|
drawSMGrass(*MeshSolidMaterial[MAT_GRASS][i], windDir, instance_pos.size() / 9);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (irr_driver->getPhase() == SHADOW_PASS)
|
if (irr_driver->getPhase() == SHADOW_PASS)
|
||||||
{
|
{
|
||||||
if (!GeometricMesh[FPSM_DEFAULT_STANDARD].empty())
|
if (!MeshSolidMaterial[MAT_DEFAULT].empty())
|
||||||
glUseProgram(MeshShader::InstancedShadowShaderInstance->Program);
|
glUseProgram(MeshShader::InstancedShadowShaderInstance->Program);
|
||||||
for (unsigned i = 0; i < GeometricMesh[FPSM_DEFAULT_STANDARD].size(); i++)
|
for (unsigned i = 0; i < MeshSolidMaterial[MAT_DEFAULT].size(); i++)
|
||||||
drawShadowDefault(*GeometricMesh[FPSM_DEFAULT_STANDARD][i], instance_pos.size() / 9);
|
drawShadowDefault(*MeshSolidMaterial[MAT_DEFAULT][i], instance_pos.size() / 9);
|
||||||
|
|
||||||
if (!GeometricMesh[FPSM_ALPHA_REF_TEXTURE].empty())
|
if (!MeshSolidMaterial[MAT_ALPHA_REF].empty())
|
||||||
glUseProgram(MeshShader::InstancedRefShadowShaderInstance->Program);
|
glUseProgram(MeshShader::InstancedRefShadowShaderInstance->Program);
|
||||||
for (unsigned i = 0; i < GeometricMesh[FPSM_ALPHA_REF_TEXTURE].size(); i++)
|
for (unsigned i = 0; i < MeshSolidMaterial[MAT_ALPHA_REF].size(); i++)
|
||||||
drawShadowAlphaRefTexture(*GeometricMesh[FPSM_ALPHA_REF_TEXTURE][i], instance_pos.size() / 9);
|
drawShadowAlphaRefTexture(*MeshSolidMaterial[MAT_ALPHA_REF][i], instance_pos.size() / 9);
|
||||||
|
|
||||||
if (!GeometricMesh[FPSM_GRASS].empty())
|
if (!MeshSolidMaterial[MAT_GRASS].empty())
|
||||||
glUseProgram(MeshShader::InstancedGrassShadowShaderInstance->Program);
|
glUseProgram(MeshShader::InstancedGrassShadowShaderInstance->Program);
|
||||||
for (unsigned i = 0; i < GeometricMesh[FPSM_GRASS].size(); i++)
|
for (unsigned i = 0; i < MeshSolidMaterial[MAT_GRASS].size(); i++)
|
||||||
drawShadowGrass(*GeometricMesh[FPSM_GRASS][i], windDir, instance_pos.size() / 9);
|
drawShadowGrass(*MeshSolidMaterial[MAT_GRASS][i], windDir, instance_pos.size() / 9);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,7 @@ class STKInstancedSceneNode : public irr::scene::CMeshSceneNode
|
|||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
int m_ref_count;
|
int m_ref_count;
|
||||||
std::vector<GLMesh *> GeometricMesh[FPSM_COUNT];
|
std::vector<GLMesh *> MeshSolidMaterial[MAT_COUNT];
|
||||||
std::vector<GLMesh *> ShadedMesh[SM_COUNT];
|
|
||||||
std::vector<GLMesh> GLmeshes;
|
std::vector<GLMesh> GLmeshes;
|
||||||
std::vector<float> instance_pos;
|
std::vector<float> instance_pos;
|
||||||
core::matrix4 ModelViewProjectionMatrix, TransposeInverseModelView;
|
core::matrix4 ModelViewProjectionMatrix, TransposeInverseModelView;
|
||||||
@ -17,7 +16,7 @@ protected:
|
|||||||
void createGLMeshes();
|
void createGLMeshes();
|
||||||
bool isMaterialInitialized;
|
bool isMaterialInitialized;
|
||||||
void setFirstTimeMaterial();
|
void setFirstTimeMaterial();
|
||||||
void initinstancedvaostate(GLMesh &mesh, GeometricMaterial GeoMat, ShadedMaterial ShadedMat);
|
void initinstancedvaostate(GLMesh &mesh);
|
||||||
void cleanGL();
|
void cleanGL();
|
||||||
core::vector3df windDir;
|
core::vector3df windDir;
|
||||||
public:
|
public:
|
||||||
|
@ -9,37 +9,23 @@
|
|||||||
#include "graphics/camera.hpp"
|
#include "graphics/camera.hpp"
|
||||||
#include "modes/world.hpp"
|
#include "modes/world.hpp"
|
||||||
|
|
||||||
GeometricMaterial MaterialTypeToGeometricMaterial(video::E_MATERIAL_TYPE MaterialType, video::E_VERTEX_TYPE tp)
|
MeshMaterial MaterialTypeToMeshMaterial(video::E_MATERIAL_TYPE MaterialType, video::E_VERTEX_TYPE tp)
|
||||||
{
|
{
|
||||||
|
if (MaterialType == irr_driver->getShader(ES_SPHERE_MAP))
|
||||||
|
return MAT_SPHEREMAP;
|
||||||
if (MaterialType == irr_driver->getShader(ES_NORMAL_MAP))
|
if (MaterialType == irr_driver->getShader(ES_NORMAL_MAP))
|
||||||
return FPSM_NORMAL_MAP;
|
return MAT_NORMAL_MAP;
|
||||||
else if (MaterialType == irr_driver->getShader(ES_OBJECTPASS_REF) || MaterialType == video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF)
|
else if (MaterialType == irr_driver->getShader(ES_OBJECTPASS_REF) || MaterialType == video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF)
|
||||||
return FPSM_ALPHA_REF_TEXTURE;
|
return MAT_ALPHA_REF;
|
||||||
else if (MaterialType == irr_driver->getShader(ES_GRASS) || MaterialType == irr_driver->getShader(ES_GRASS_REF))
|
else if (MaterialType == irr_driver->getShader(ES_GRASS) || MaterialType == irr_driver->getShader(ES_GRASS_REF))
|
||||||
return FPSM_GRASS;
|
return MAT_GRASS;
|
||||||
|
else if (MaterialType == irr_driver->getShader(ES_SPLATTING))
|
||||||
|
return MAT_SPLATTING;
|
||||||
|
else if (MaterialType == irr_driver->getShader(ES_OBJECT_UNLIT))
|
||||||
|
return MAT_UNLIT;
|
||||||
else if (tp == video::EVT_2TCOORDS)
|
else if (tp == video::EVT_2TCOORDS)
|
||||||
return FPSM_DEFAULT_2TCOORD;
|
return MAT_DETAIL;
|
||||||
assert(tp == video::EVT_STANDARD);
|
return MAT_DEFAULT;
|
||||||
return FPSM_DEFAULT_STANDARD;
|
|
||||||
}
|
|
||||||
|
|
||||||
ShadedMaterial MaterialTypeToShadedMaterial(video::E_MATERIAL_TYPE type, video::ITexture **textures, video::E_VERTEX_TYPE tp)
|
|
||||||
{
|
|
||||||
if (type == irr_driver->getShader(ES_SPHERE_MAP))
|
|
||||||
return SM_SPHEREMAP;
|
|
||||||
else if (type == irr_driver->getShader(ES_SPLATTING))
|
|
||||||
return SM_SPLATTING;
|
|
||||||
else if (type == irr_driver->getShader(ES_OBJECTPASS_REF) || type == video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF)
|
|
||||||
return SM_ALPHA_REF_TEXTURE;
|
|
||||||
else if (type == irr_driver->getShader(ES_GRASS) || type == irr_driver->getShader(ES_GRASS_REF))
|
|
||||||
return SM_GRASS;
|
|
||||||
else if (type == irr_driver->getShader(ES_OBJECT_UNLIT))
|
|
||||||
return SM_UNLIT;
|
|
||||||
else if (tp == video::EVT_2TCOORDS)
|
|
||||||
return SM_DETAILS;
|
|
||||||
else if (tp == video::EVT_TANGENTS)
|
|
||||||
return SM_DEFAULT_TANGENT;
|
|
||||||
return SM_DEFAULT_STANDARD;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TransparentMaterial MaterialTypeToTransparentMaterial(video::E_MATERIAL_TYPE type, f32 MaterialTypeParam)
|
TransparentMaterial MaterialTypeToTransparentMaterial(video::E_MATERIAL_TYPE type, f32 MaterialTypeParam)
|
||||||
@ -307,22 +293,17 @@ bool isObject(video::E_MATERIAL_TYPE type)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4> > ListDefaultStandardG::Arguments;
|
std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4, video::SColorf> > ListMatDefault::Arguments;
|
||||||
std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4> > ListDefault2TCoordG::Arguments;
|
std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4, video::SColorf> > ListMatAlphaRef::Arguments;
|
||||||
std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4> > ListAlphaRefG::Arguments;
|
std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4, video::SColorf> > ListMatSphereMap::Arguments;
|
||||||
std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4> > ListNormalG::Arguments;
|
std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4, video::SColorf> > ListMatDetails::Arguments;
|
||||||
std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, core::vector3df> > ListGrassG::Arguments;
|
std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, core::vector3df, video::SColorf> > ListMatGrass::Arguments;
|
||||||
|
std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4> > ListMatUnlit::Arguments;
|
||||||
|
std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, video::SColorf> > ListMatSplatting::Arguments;
|
||||||
|
std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4, video::SColorf> > ListMatNormalMap::Arguments;
|
||||||
|
|
||||||
std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, video::SColorf> > ListDefaultStandardSM::Arguments;
|
|
||||||
std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, video::SColorf> > ListDefaultTangentSM::Arguments;
|
|
||||||
std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, video::SColorf> > ListAlphaRefSM::Arguments;
|
|
||||||
std::vector<std::tuple<GLMesh *, core::matrix4, video::SColorf> > ListSplattingSM::Arguments;
|
|
||||||
std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, video::SColorf> > ListSphereMapSM::Arguments;
|
|
||||||
std::vector<std::tuple<GLMesh *, core::matrix4> > ListUnlitSM::Arguments;
|
|
||||||
std::vector<std::tuple<GLMesh *, core::matrix4, video::SColorf> > ListDetailSM::Arguments;
|
|
||||||
std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4> > ListBlendTransparent::Arguments;
|
std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4> > ListBlendTransparent::Arguments;
|
||||||
std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4> > ListAdditiveTransparent::Arguments;
|
std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4> > ListAdditiveTransparent::Arguments;
|
||||||
std::vector<std::tuple<GLMesh *, core::matrix4> > ListDisplacement::Arguments;
|
|
||||||
std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, float, float, float, float, float, video::SColorf> > ListBlendTransparentFog::Arguments;
|
std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, float, float, float, float, float, video::SColorf> > ListBlendTransparentFog::Arguments;
|
||||||
std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, float, float, float, float, float, video::SColorf> > ListAdditiveTransparentFog::Arguments;
|
std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, float, float, float, float, float, video::SColorf> > ListAdditiveTransparentFog::Arguments;
|
||||||
std::vector<std::tuple<GLMesh *, core::matrix4, core::vector3df, video::SColorf> > ListGrassSM::Arguments;
|
std::vector<std::tuple<GLMesh *, core::matrix4> > ListDisplacement::Arguments;
|
@ -11,27 +11,17 @@
|
|||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
enum GeometricMaterial
|
enum MeshMaterial
|
||||||
{
|
{
|
||||||
FPSM_DEFAULT_STANDARD,
|
MAT_DEFAULT,
|
||||||
FPSM_DEFAULT_2TCOORD,
|
MAT_ALPHA_REF,
|
||||||
FPSM_ALPHA_REF_TEXTURE,
|
MAT_NORMAL_MAP,
|
||||||
FPSM_NORMAL_MAP,
|
MAT_GRASS,
|
||||||
FPSM_GRASS,
|
MAT_SPHEREMAP,
|
||||||
FPSM_COUNT
|
MAT_SPLATTING,
|
||||||
};
|
MAT_UNLIT,
|
||||||
|
MAT_DETAIL,
|
||||||
enum ShadedMaterial
|
MAT_COUNT
|
||||||
{
|
|
||||||
SM_DEFAULT_STANDARD,
|
|
||||||
SM_DEFAULT_TANGENT,
|
|
||||||
SM_ALPHA_REF_TEXTURE,
|
|
||||||
SM_SPHEREMAP,
|
|
||||||
SM_SPLATTING,
|
|
||||||
SM_GRASS,
|
|
||||||
SM_UNLIT,
|
|
||||||
SM_DETAILS,
|
|
||||||
SM_COUNT
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum TransparentMaterial
|
enum TransparentMaterial
|
||||||
@ -69,109 +59,54 @@ bool isObject(video::E_MATERIAL_TYPE type);
|
|||||||
core::vector3df getWind();
|
core::vector3df getWind();
|
||||||
|
|
||||||
// Pass 1 shader (ie shaders that outputs normals and depth)
|
// Pass 1 shader (ie shaders that outputs normals and depth)
|
||||||
class ListDefaultStandardG
|
class ListMatDefault
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4, video::SColorf> > Arguments;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ListMatAlphaRef
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4, video::SColorf> > Arguments;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ListMatNormalMap
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4, video::SColorf> > Arguments;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ListMatGrass
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, core::vector3df, video::SColorf> > Arguments;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ListMatSphereMap
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4, video::SColorf> > Arguments;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ListMatSplatting
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, video::SColorf> > Arguments;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ListMatUnlit
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4> > Arguments;
|
static std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4> > Arguments;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ListDefault2TCoordG
|
class ListMatDetails
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4> > Arguments;
|
static std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4, video::SColorf> > Arguments;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ListAlphaRefG
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, core::matrix4> > Arguments;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ListNormalG
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4> > Arguments;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ListGrassG
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, core::vector3df> > Arguments;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename Shader, typename...uniforms>
|
|
||||||
void draw(const GLMesh *mesh, uniforms... Args)
|
|
||||||
{
|
|
||||||
irr_driver->IncreaseObjectCount();
|
|
||||||
GLenum ptype = mesh->PrimitiveType;
|
|
||||||
GLenum itype = mesh->IndexType;
|
|
||||||
size_t count = mesh->IndexCount;
|
|
||||||
|
|
||||||
Shader::setUniforms(Args...);
|
|
||||||
glDrawElementsBaseVertex(ptype, count, itype, (GLvoid *)mesh->vaoOffset, mesh->vaoBaseVertex);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<typename T, typename...uniforms>
|
|
||||||
void draw(const T *Shader, const GLMesh *mesh, uniforms... Args)
|
|
||||||
{
|
|
||||||
irr_driver->IncreaseObjectCount();
|
|
||||||
GLenum ptype = mesh->PrimitiveType;
|
|
||||||
GLenum itype = mesh->IndexType;
|
|
||||||
size_t count = mesh->IndexCount;
|
|
||||||
|
|
||||||
Shader->setUniforms(Args...);
|
|
||||||
glDrawElementsBaseVertex(ptype, count, itype, (GLvoid *)mesh->vaoOffset, mesh->vaoBaseVertex);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pass 2 shader (ie shaders that outputs final color)
|
|
||||||
class ListDefaultStandardSM
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, video::SColorf> > Arguments;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ListDefaultTangentSM
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, video::SColorf> > Arguments;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ListAlphaRefSM
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, video::SColorf> > Arguments;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ListSphereMapSM
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static std::vector<std::tuple<GLMesh *, core::matrix4, core::matrix4, video::SColorf> > Arguments;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ListSplattingSM
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static std::vector<std::tuple<GLMesh *, core::matrix4, video::SColorf> > Arguments;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ListUnlitSM
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static std::vector<std::tuple<GLMesh *, core::matrix4> > Arguments;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ListDetailSM
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static std::vector<std::tuple<GLMesh *, core::matrix4, video::SColorf> > Arguments;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ListGrassSM
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
static std::vector<std::tuple<GLMesh *, core::matrix4, core::vector3df, video::SColorf> > Arguments;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ListBlendTransparent
|
class ListBlendTransparent
|
||||||
{
|
{
|
||||||
@ -206,8 +141,7 @@ public:
|
|||||||
// Forward pass (for transparents meshes)
|
// Forward pass (for transparents meshes)
|
||||||
void drawBubble(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix);
|
void drawBubble(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix);
|
||||||
|
|
||||||
GeometricMaterial MaterialTypeToGeometricMaterial(video::E_MATERIAL_TYPE, video::E_VERTEX_TYPE);
|
MeshMaterial MaterialTypeToMeshMaterial(video::E_MATERIAL_TYPE, video::E_VERTEX_TYPE);
|
||||||
ShadedMaterial MaterialTypeToShadedMaterial(video::E_MATERIAL_TYPE, irr::video::ITexture **textures, video::E_VERTEX_TYPE tp);
|
|
||||||
TransparentMaterial MaterialTypeToTransparentMaterial(video::E_MATERIAL_TYPE, f32 MaterialTypeParam);
|
TransparentMaterial MaterialTypeToTransparentMaterial(video::E_MATERIAL_TYPE, f32 MaterialTypeParam);
|
||||||
|
|
||||||
#endif // STKMESH_H
|
#endif // STKMESH_H
|
||||||
|
@ -78,8 +78,7 @@ void STKMeshSceneNode::setFirstTimeMaterial()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(!isDisplacement);
|
assert(!isDisplacement);
|
||||||
GeometricMaterial GeometricType = MaterialTypeToGeometricMaterial(type, mb->getVertexType());
|
MeshMaterial MatType = MaterialTypeToMeshMaterial(type, mb->getVertexType());
|
||||||
ShadedMaterial ShadedType = MaterialTypeToShadedMaterial(type, mesh.textures, mb->getVertexType());
|
|
||||||
if (immediate_draw)
|
if (immediate_draw)
|
||||||
{
|
{
|
||||||
fillLocalBuffer(mesh, mb);
|
fillLocalBuffer(mesh, mb);
|
||||||
@ -87,10 +86,7 @@ void STKMeshSceneNode::setFirstTimeMaterial()
|
|||||||
glBindVertexArray(0);
|
glBindVertexArray(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
MeshSolidMaterials[MatType].push_back(&mesh);
|
||||||
GeometricMesh[GeometricType].push_back(&mesh);
|
|
||||||
ShadedMesh[ShadedType].push_back(&mesh);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!immediate_draw)
|
if (!immediate_draw)
|
||||||
@ -117,10 +113,8 @@ void STKMeshSceneNode::cleanGLMeshes()
|
|||||||
glDeleteBuffers(1, &(mesh.index_buffer));
|
glDeleteBuffers(1, &(mesh.index_buffer));
|
||||||
}
|
}
|
||||||
GLmeshes.clear();
|
GLmeshes.clear();
|
||||||
for (unsigned i = 0; i < FPSM_COUNT; i++)
|
for (unsigned i = 0; i < MAT_COUNT; i++)
|
||||||
GeometricMesh[i].clearWithoutDeleting();
|
MeshSolidMaterials[i].clearWithoutDeleting();
|
||||||
for (unsigned i = 0; i < SM_COUNT; i++)
|
|
||||||
ShadedMesh[i].clearWithoutDeleting();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void STKMeshSceneNode::setMesh(irr::scene::IMesh* mesh)
|
void STKMeshSceneNode::setMesh(irr::scene::IMesh* mesh)
|
||||||
@ -215,53 +209,65 @@ void STKMeshSceneNode::render()
|
|||||||
GLmeshes[i].TextureMatrix = getMaterial(i).getTextureMatrix(0);
|
GLmeshes[i].TextureMatrix = getMaterial(i).getTextureMatrix(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (irr_driver->getPhase() == SOLID_NORMAL_AND_DEPTH_PASS)
|
if (irr_driver->getPhase() == SOLID_NORMAL_AND_DEPTH_PASS && immediate_draw)
|
||||||
{
|
{
|
||||||
core::matrix4 invmodel;
|
core::matrix4 invmodel;
|
||||||
AbsoluteTransformation.getInverse(invmodel);
|
AbsoluteTransformation.getInverse(invmodel);
|
||||||
|
|
||||||
if (immediate_draw)
|
|
||||||
|
glDisable(GL_CULL_FACE);
|
||||||
|
if (update_each_frame)
|
||||||
|
updatevbo();
|
||||||
|
glUseProgram(MeshShader::ObjectPass1Shader::getInstance()->Program);
|
||||||
|
// Only untextured
|
||||||
|
for (unsigned i = 0; i < GLmeshes.size(); i++)
|
||||||
{
|
{
|
||||||
glDisable(GL_CULL_FACE);
|
irr_driver->IncreaseObjectCount();
|
||||||
if (update_each_frame)
|
GLMesh &mesh = GLmeshes[i];
|
||||||
updatevbo();
|
GLenum ptype = mesh.PrimitiveType;
|
||||||
glUseProgram(MeshShader::ObjectPass1Shader::getInstance()->Program);
|
GLenum itype = mesh.IndexType;
|
||||||
// Only untextured
|
size_t count = mesh.IndexCount;
|
||||||
for (unsigned i = 0; i < GLmeshes.size(); i++)
|
|
||||||
{
|
|
||||||
irr_driver->IncreaseObjectCount();
|
|
||||||
GLMesh &mesh = GLmeshes[i];
|
|
||||||
GLenum ptype = mesh.PrimitiveType;
|
|
||||||
GLenum itype = mesh.IndexType;
|
|
||||||
size_t count = mesh.IndexCount;
|
|
||||||
|
|
||||||
MeshShader::ObjectPass1Shader::getInstance()->setUniforms(AbsoluteTransformation, invmodel);
|
MeshShader::ObjectPass1Shader::getInstance()->setUniforms(AbsoluteTransformation, invmodel);
|
||||||
assert(mesh.vao);
|
assert(mesh.vao);
|
||||||
glBindVertexArray(mesh.vao);
|
glBindVertexArray(mesh.vao);
|
||||||
glDrawElements(ptype, count, itype, 0);
|
glDrawElements(ptype, count, itype, 0);
|
||||||
glBindVertexArray(0);
|
glBindVertexArray(0);
|
||||||
}
|
|
||||||
glEnable(GL_CULL_FACE);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
glEnable(GL_CULL_FACE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (irr_driver->getPhase() == SOLID_NORMAL_AND_DEPTH_PASS || irr_driver->getPhase() == SHADOW_PASS)
|
||||||
|
{
|
||||||
|
core::matrix4 invmodel;
|
||||||
|
AbsoluteTransformation.getInverse(invmodel);
|
||||||
|
|
||||||
GLMesh* mesh;
|
GLMesh* mesh;
|
||||||
for_in(mesh, GeometricMesh[FPSM_DEFAULT_STANDARD])
|
for_in(mesh, MeshSolidMaterials[MAT_DEFAULT])
|
||||||
ListDefaultStandardG::Arguments.push_back(std::make_tuple(mesh, AbsoluteTransformation, invmodel));
|
ListMatDefault::Arguments.emplace_back(mesh, AbsoluteTransformation, invmodel, mesh->TextureMatrix, irr_driver->getSceneManager()->getAmbientLight());
|
||||||
|
|
||||||
for_in(mesh, GeometricMesh[FPSM_DEFAULT_2TCOORD])
|
for_in(mesh, MeshSolidMaterials[MAT_ALPHA_REF])
|
||||||
ListDefault2TCoordG::Arguments.push_back(std::make_tuple(mesh, AbsoluteTransformation, invmodel));
|
ListMatAlphaRef::Arguments.emplace_back(mesh, AbsoluteTransformation, invmodel, mesh->TextureMatrix, irr_driver->getSceneManager()->getAmbientLight());
|
||||||
|
|
||||||
for_in(mesh, GeometricMesh[FPSM_ALPHA_REF_TEXTURE])
|
for_in(mesh, MeshSolidMaterials[MAT_SPHEREMAP])
|
||||||
ListAlphaRefG::Arguments.push_back(std::make_tuple(mesh, AbsoluteTransformation, invmodel, mesh->TextureMatrix));
|
ListMatSphereMap::Arguments.emplace_back(mesh, AbsoluteTransformation, invmodel, mesh->TextureMatrix, irr_driver->getSceneManager()->getAmbientLight());
|
||||||
|
|
||||||
for_in(mesh, GeometricMesh[FPSM_NORMAL_MAP])
|
for_in(mesh, MeshSolidMaterials[MAT_DETAIL])
|
||||||
ListNormalG::Arguments.push_back(std::make_tuple(mesh, AbsoluteTransformation, invmodel));
|
ListMatDetails::Arguments.emplace_back(mesh, AbsoluteTransformation, invmodel, mesh->TextureMatrix, irr_driver->getSceneManager()->getAmbientLight());
|
||||||
|
|
||||||
windDir = getWind();
|
windDir = getWind();
|
||||||
for_in(mesh, GeometricMesh[FPSM_GRASS])
|
for_in(mesh, MeshSolidMaterials[MAT_GRASS])
|
||||||
ListGrassG::Arguments.push_back(std::make_tuple(mesh, AbsoluteTransformation, invmodel, windDir));
|
ListMatGrass::Arguments.emplace_back(mesh, AbsoluteTransformation, invmodel, windDir, irr_driver->getSceneManager()->getAmbientLight());
|
||||||
|
|
||||||
|
for_in(mesh, MeshSolidMaterials[MAT_UNLIT])
|
||||||
|
ListMatUnlit::Arguments.emplace_back(mesh, AbsoluteTransformation, core::matrix4::EM4CONST_IDENTITY);
|
||||||
|
|
||||||
|
for_in(mesh, MeshSolidMaterials[MAT_SPLATTING])
|
||||||
|
ListMatSplatting::Arguments.emplace_back(mesh, AbsoluteTransformation, invmodel, irr_driver->getSceneManager()->getAmbientLight());
|
||||||
|
|
||||||
|
for_in(mesh, MeshSolidMaterials[MAT_NORMAL_MAP])
|
||||||
|
ListMatNormalMap::Arguments.emplace_back(mesh, AbsoluteTransformation, invmodel, core::matrix4::EM4CONST_IDENTITY, irr_driver->getSceneManager()->getAmbientLight());
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -276,7 +282,7 @@ void STKMeshSceneNode::render()
|
|||||||
glDisable(GL_CULL_FACE);
|
glDisable(GL_CULL_FACE);
|
||||||
if (!spareWhiteTex)
|
if (!spareWhiteTex)
|
||||||
spareWhiteTex = getUnicolorTexture(video::SColor(255, 255, 255, 255));
|
spareWhiteTex = getUnicolorTexture(video::SColor(255, 255, 255, 255));
|
||||||
glUseProgram(MeshShader::ObjectPass2ShaderInstance->Program);
|
glUseProgram(MeshShader::ObjectPass2Shader::getInstance()->Program);
|
||||||
// Only untextured
|
// Only untextured
|
||||||
for (unsigned i = 0; i < GLmeshes.size(); i++)
|
for (unsigned i = 0; i < GLmeshes.size(); i++)
|
||||||
{
|
{
|
||||||
@ -286,8 +292,8 @@ void STKMeshSceneNode::render()
|
|||||||
GLenum itype = mesh.IndexType;
|
GLenum itype = mesh.IndexType;
|
||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
|
|
||||||
setTexture(MeshShader::ObjectPass2ShaderInstance->TU_Albedo, getTextureGLuint(spareWhiteTex), GL_NEAREST, GL_NEAREST, false);
|
setTexture(MeshShader::ObjectPass2Shader::getInstance()->TU_Albedo, getTextureGLuint(spareWhiteTex), GL_NEAREST, GL_NEAREST, false);
|
||||||
MeshShader::ObjectPass2ShaderInstance->setUniforms(AbsoluteTransformation, mesh.TextureMatrix, irr_driver->getSceneManager()->getAmbientLight());
|
MeshShader::ObjectPass2Shader::getInstance()->setUniforms(AbsoluteTransformation, mesh.TextureMatrix, irr_driver->getSceneManager()->getAmbientLight());
|
||||||
assert(mesh.vao);
|
assert(mesh.vao);
|
||||||
glBindVertexArray(mesh.vao);
|
glBindVertexArray(mesh.vao);
|
||||||
glDrawElements(ptype, count, itype, 0);
|
glDrawElements(ptype, count, itype, 0);
|
||||||
@ -297,31 +303,6 @@ void STKMeshSceneNode::render()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLMesh* mesh;
|
|
||||||
for_in(mesh, ShadedMesh[SM_DEFAULT_STANDARD])
|
|
||||||
ListDefaultStandardSM::Arguments.push_back(std::make_tuple(mesh, AbsoluteTransformation, mesh->TextureMatrix, irr_driver->getSceneManager()->getAmbientLight()));
|
|
||||||
|
|
||||||
for_in(mesh, ShadedMesh[SM_DEFAULT_TANGENT])
|
|
||||||
ListDefaultTangentSM::Arguments.push_back(std::make_tuple(mesh, AbsoluteTransformation, mesh->TextureMatrix, irr_driver->getSceneManager()->getAmbientLight()));
|
|
||||||
|
|
||||||
for_in(mesh, ShadedMesh[SM_ALPHA_REF_TEXTURE])
|
|
||||||
ListAlphaRefSM::Arguments.push_back(std::make_tuple(mesh, AbsoluteTransformation, mesh->TextureMatrix, irr_driver->getSceneManager()->getAmbientLight()));
|
|
||||||
|
|
||||||
for_in(mesh, ShadedMesh[SM_SPHEREMAP])
|
|
||||||
ListSphereMapSM::Arguments.push_back(std::make_tuple(mesh, AbsoluteTransformation, invmodel, irr_driver->getSceneManager()->getAmbientLight()));
|
|
||||||
|
|
||||||
for_in(mesh, ShadedMesh[SM_SPLATTING])
|
|
||||||
ListSplattingSM::Arguments.push_back(std::make_tuple(mesh, AbsoluteTransformation, irr_driver->getSceneManager()->getAmbientLight()));
|
|
||||||
|
|
||||||
for_in(mesh, ShadedMesh[SM_UNLIT])
|
|
||||||
ListUnlitSM::Arguments.push_back(std::make_tuple(mesh, AbsoluteTransformation));
|
|
||||||
|
|
||||||
for_in(mesh, ShadedMesh[SM_DETAILS])
|
|
||||||
ListDetailSM::Arguments.push_back(std::make_tuple(mesh, AbsoluteTransformation, irr_driver->getSceneManager()->getAmbientLight()));
|
|
||||||
|
|
||||||
for_in(mesh, ShadedMesh[SM_GRASS])
|
|
||||||
ListGrassSM::Arguments.push_back(std::make_tuple(mesh, AbsoluteTransformation, windDir, irr_driver->getSceneManager()->getAmbientLight()));
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -350,7 +331,7 @@ void STKMeshSceneNode::render()
|
|||||||
|
|
||||||
if (World::getWorld() && World::getWorld()->isFogEnabled())
|
if (World::getWorld() && World::getWorld()->isFogEnabled())
|
||||||
{
|
{
|
||||||
glUseProgram(MeshShader::TransparentFogShaderInstance->Program);
|
glUseProgram(MeshShader::TransparentFogShader::getInstance()->Program);
|
||||||
for (unsigned i = 0; i < GLmeshes.size(); i++)
|
for (unsigned i = 0; i < GLmeshes.size(); i++)
|
||||||
{
|
{
|
||||||
GLMesh &mesh = GLmeshes[i];
|
GLMesh &mesh = GLmeshes[i];
|
||||||
@ -374,8 +355,8 @@ void STKMeshSceneNode::render()
|
|||||||
tmpcol.getBlue() / 255.0f);
|
tmpcol.getBlue() / 255.0f);
|
||||||
|
|
||||||
compressTexture(mesh.textures[0], true);
|
compressTexture(mesh.textures[0], true);
|
||||||
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(MeshShader::TransparentFogShader::getInstance()->TU_tex, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
MeshShader::TransparentFogShaderInstance->setUniforms(AbsoluteTransformation, mesh.TextureMatrix, fogmax, startH, endH, start, end, col);
|
MeshShader::TransparentFogShader::getInstance()->setUniforms(AbsoluteTransformation, mesh.TextureMatrix, fogmax, startH, endH, start, end, col);
|
||||||
|
|
||||||
assert(mesh.vao);
|
assert(mesh.vao);
|
||||||
glBindVertexArray(mesh.vao);
|
glBindVertexArray(mesh.vao);
|
||||||
@ -385,7 +366,7 @@ void STKMeshSceneNode::render()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glUseProgram(MeshShader::TransparentShaderInstance->Program);
|
glUseProgram(MeshShader::TransparentShader::getInstance()->Program);
|
||||||
for (unsigned i = 0; i < GLmeshes.size(); i++)
|
for (unsigned i = 0; i < GLmeshes.size(); i++)
|
||||||
{
|
{
|
||||||
irr_driver->IncreaseObjectCount();
|
irr_driver->IncreaseObjectCount();
|
||||||
@ -395,9 +376,9 @@ void STKMeshSceneNode::render()
|
|||||||
size_t count = mesh.IndexCount;
|
size_t count = mesh.IndexCount;
|
||||||
|
|
||||||
compressTexture(mesh.textures[0], true);
|
compressTexture(mesh.textures[0], true);
|
||||||
setTexture(MeshShader::TransparentShaderInstance->TU_tex, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
setTexture(MeshShader::TransparentShader::getInstance()->TU_tex, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
|
||||||
|
|
||||||
MeshShader::TransparentShaderInstance->setUniforms(AbsoluteTransformation, mesh.TextureMatrix);
|
MeshShader::TransparentShader::getInstance()->setUniforms(AbsoluteTransformation, mesh.TextureMatrix);
|
||||||
assert(mesh.vao);
|
assert(mesh.vao);
|
||||||
glBindVertexArray(mesh.vao);
|
glBindVertexArray(mesh.vao);
|
||||||
glDrawElements(ptype, count, itype, 0);
|
glDrawElements(ptype, count, itype, 0);
|
||||||
@ -426,25 +407,23 @@ void STKMeshSceneNode::render()
|
|||||||
tmpcol.getBlue() / 255.0f);
|
tmpcol.getBlue() / 255.0f);
|
||||||
|
|
||||||
for_in(mesh, TransparentMesh[TM_DEFAULT])
|
for_in(mesh, TransparentMesh[TM_DEFAULT])
|
||||||
ListBlendTransparentFog::Arguments.push_back(
|
ListBlendTransparentFog::Arguments.emplace_back(mesh, AbsoluteTransformation, mesh->TextureMatrix,
|
||||||
std::make_tuple(mesh, AbsoluteTransformation, mesh->TextureMatrix,
|
fogmax, startH, endH, start, end, col);
|
||||||
fogmax, startH, endH, start, end, col));
|
|
||||||
for_in(mesh, TransparentMesh[TM_ADDITIVE])
|
for_in(mesh, TransparentMesh[TM_ADDITIVE])
|
||||||
ListAdditiveTransparentFog::Arguments.push_back(
|
ListAdditiveTransparentFog::Arguments.emplace_back(mesh, AbsoluteTransformation, mesh->TextureMatrix,
|
||||||
std::make_tuple(mesh, AbsoluteTransformation, mesh->TextureMatrix,
|
fogmax, startH, endH, start, end, col);
|
||||||
fogmax, startH, endH, start, end, col));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for_in(mesh, TransparentMesh[TM_DEFAULT])
|
for_in(mesh, TransparentMesh[TM_DEFAULT])
|
||||||
ListBlendTransparent::Arguments.push_back(std::make_tuple(mesh, AbsoluteTransformation, mesh->TextureMatrix));
|
ListBlendTransparent::Arguments.emplace_back(mesh, AbsoluteTransformation, mesh->TextureMatrix);
|
||||||
|
|
||||||
for_in(mesh, TransparentMesh[TM_ADDITIVE])
|
for_in(mesh, TransparentMesh[TM_ADDITIVE])
|
||||||
ListAdditiveTransparent::Arguments.push_back(std::make_tuple(mesh, AbsoluteTransformation, mesh->TextureMatrix));
|
ListAdditiveTransparent::Arguments.emplace_back(mesh, AbsoluteTransformation, mesh->TextureMatrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
for_in(mesh, TransparentMesh[TM_DISPLACEMENT])
|
for_in(mesh, TransparentMesh[TM_DISPLACEMENT])
|
||||||
ListDisplacement::Arguments.push_back(std::make_tuple(mesh, AbsoluteTransformation));
|
ListDisplacement::Arguments.emplace_back(mesh, AbsoluteTransformation);
|
||||||
|
|
||||||
if (!TransparentMesh[TM_BUBBLE].empty())
|
if (!TransparentMesh[TM_BUBBLE].empty())
|
||||||
glUseProgram(MeshShader::BubbleShader::Program);
|
glUseProgram(MeshShader::BubbleShader::Program);
|
||||||
|
@ -7,8 +7,7 @@
|
|||||||
class STKMeshSceneNode : public irr::scene::CMeshSceneNode
|
class STKMeshSceneNode : public irr::scene::CMeshSceneNode
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
PtrVector<GLMesh, REF> GeometricMesh[FPSM_COUNT];
|
PtrVector<GLMesh, REF> MeshSolidMaterials[MAT_COUNT];
|
||||||
PtrVector<GLMesh, REF> ShadedMesh[SM_COUNT];
|
|
||||||
PtrVector<GLMesh, REF> TransparentMesh[TM_COUNT];
|
PtrVector<GLMesh, REF> TransparentMesh[TM_COUNT];
|
||||||
std::vector<GLMesh> GLmeshes;
|
std::vector<GLMesh> GLmeshes;
|
||||||
core::matrix4 ModelViewProjectionMatrix;
|
core::matrix4 ModelViewProjectionMatrix;
|
||||||
|
@ -140,6 +140,9 @@ void AbstractStateManager::pushScreen(Screen* screen)
|
|||||||
|
|
||||||
void AbstractStateManager::replaceTopMostScreen(Screen* screen, GUIEngine::GameState gameState)
|
void AbstractStateManager::replaceTopMostScreen(Screen* screen, GUIEngine::GameState gameState)
|
||||||
{
|
{
|
||||||
|
if (gameState == GUIEngine::CURRENT)
|
||||||
|
gameState = getGameState();
|
||||||
|
|
||||||
//assert(m_game_mode != GAME);
|
//assert(m_game_mode != GAME);
|
||||||
// you need to close any dialog before calling this
|
// you need to close any dialog before calling this
|
||||||
assert(!ModalDialog::isADialogActive());
|
assert(!ModalDialog::isADialogActive());
|
||||||
|
@ -40,7 +40,9 @@ namespace GUIEngine
|
|||||||
{
|
{
|
||||||
MENU,
|
MENU,
|
||||||
GAME,
|
GAME,
|
||||||
INGAME_MENU
|
INGAME_MENU,
|
||||||
|
/** Dummy GameState e. g. for parameters. */
|
||||||
|
CURRENT = MENU | GAME | INGAME_MENU
|
||||||
}; // GameState
|
}; // GameState
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,7 +84,7 @@ namespace GUIEngine
|
|||||||
* without displaying the second-topmost menu of the stack
|
* without displaying the second-topmost menu of the stack
|
||||||
* in-between)
|
* in-between)
|
||||||
*/
|
*/
|
||||||
void replaceTopMostScreen(Screen* screen, GUIEngine::GameState gameState = GUIEngine::MENU);
|
void replaceTopMostScreen(Screen* screen, GUIEngine::GameState gameState = GUIEngine::CURRENT);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief removes the menu at the top of the screens stack
|
* \brief removes the menu at the top of the screens stack
|
||||||
|
@ -87,12 +87,9 @@ namespace GUIEngine
|
|||||||
Widget* out = getWidget(name);
|
Widget* out = getWidget(name);
|
||||||
T* outCasted = dynamic_cast<T*>( out );
|
T* outCasted = dynamic_cast<T*>( out );
|
||||||
if (out != NULL && outCasted == NULL)
|
if (out != NULL && outCasted == NULL)
|
||||||
{
|
Log::fatal("Screen::getWidget", "Widget '%s' of type '%s'"
|
||||||
fprintf(stderr, "Screen::getWidget : Widget '%s' of type '%s'"
|
"cannot be casted to requested type '%s'!\n", name,
|
||||||
"cannot be casted to requested type '%s'!\n", name,
|
typeid(*out).name(), typeid(T).name());
|
||||||
typeid(*out).name(), typeid(T).name());
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
return outCasted;
|
return outCasted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -608,7 +608,7 @@ EventPropagation EventHandler::onGUIEvent(const SEvent& event)
|
|||||||
|
|
||||||
if (w == NULL) break;
|
if (w == NULL) break;
|
||||||
|
|
||||||
if (!w->m_focusable) return GUIEngine::EVENT_BLOCK;
|
if (!w->isFocusable() || !w->isActivated()) return GUIEngine::EVENT_BLOCK;
|
||||||
|
|
||||||
// When a modal dialog is shown, don't select widgets out of the dialog
|
// When a modal dialog is shown, don't select widgets out of the dialog
|
||||||
if (ModalDialog::isADialogActive() && !ModalDialog::getCurrent()->isMyChild(w))
|
if (ModalDialog::isADialogActive() && !ModalDialog::getCurrent()->isMyChild(w))
|
||||||
|
@ -47,7 +47,7 @@ int atoi_p(const char* val)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[LayoutManager] WARNING: Invalid value '%s' found in XML file where integer was expected\n", val);
|
Log::warn("LayoutManager", "Invalid value '%s' found in XML file where integer was expected.", val);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -461,7 +461,7 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev
|
|||||||
|
|
||||||
if (left_space < 0)
|
if (left_space < 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[LayoutManager] WARNING: statically sized widgets took all the place!!\n");
|
Log::warn("LayoutManager", "Statically sized widgets took all the place!!");
|
||||||
left_space = 0;
|
left_space = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -536,9 +536,9 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev
|
|||||||
|
|
||||||
if (widgets[n].m_w <= 0)
|
if (widgets[n].m_w <= 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "WARNING: widget '%s' has a width of %i (left_space = %i, "
|
Log::warn("LayoutManager", "Widget '%s' has a width of %i (left_space = %i, "
|
||||||
"fraction = %f, max_width = %s)\n", widgets[n].m_properties[PROP_ID].c_str(),
|
"fraction = %f, max_width = %s)", widgets[n].m_properties[PROP_ID].c_str(),
|
||||||
widgets[n].m_w, left_space, fraction, widgets[n].m_properties[PROP_MAX_WIDTH].c_str());
|
widgets[n].m_w, left_space, fraction, widgets[n].m_properties[PROP_MAX_WIDTH].c_str());
|
||||||
widgets[n].m_w = 1;
|
widgets[n].m_w = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -556,9 +556,9 @@ void LayoutManager::doCalculateLayout(PtrVector<Widget>& widgets, AbstractTopLev
|
|||||||
|
|
||||||
if (widgets[n].m_h <= 0)
|
if (widgets[n].m_h <= 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "WARNING: widget '%s' has a height of %i (left_space = %i, "
|
Log::warn("LayoutManager", "Widget '%s' has a height of %i (left_space = %i, "
|
||||||
"fraction = %f, max_width = %s)\n", widgets[n].m_properties[PROP_ID].c_str(),
|
"fraction = %f, max_width = %s)\n", widgets[n].m_properties[PROP_ID].c_str(),
|
||||||
widgets[n].m_h, left_space, fraction, widgets[n].m_properties[PROP_MAX_WIDTH].c_str());
|
widgets[n].m_h, left_space, fraction, widgets[n].m_properties[PROP_MAX_WIDTH].c_str());
|
||||||
widgets[n].m_h = 1;
|
widgets[n].m_h = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "utils/log.hpp"
|
#include "utils/log.hpp"
|
||||||
|
|
||||||
#include <IGUIEnvironment.h>
|
#include <IGUIEnvironment.h>
|
||||||
|
#include <IGUIButton.h>
|
||||||
|
|
||||||
using namespace irr;
|
using namespace irr;
|
||||||
using namespace core;
|
using namespace core;
|
||||||
@ -134,6 +135,8 @@ void ModalDialog::doInit()
|
|||||||
|
|
||||||
m_irrlicht_window = GUIEngine::getGUIEnv()->addWindow(m_area,
|
m_irrlicht_window = GUIEngine::getGUIEnv()->addWindow(m_area,
|
||||||
true /* modal */);
|
true /* modal */);
|
||||||
|
m_irrlicht_window->setDrawTitlebar(false);
|
||||||
|
m_irrlicht_window->getCloseButton()->setVisible(false);
|
||||||
|
|
||||||
GUIEngine::getSkin()->m_dialog = true;
|
GUIEngine::getSkin()->m_dialog = true;
|
||||||
GUIEngine::getSkin()->m_dialog_size = 0.0f;
|
GUIEngine::getSkin()->m_dialog_size = 0.0f;
|
||||||
|
@ -57,8 +57,7 @@ ScalableFont::ScalableFont(IGUIEnvironment *env, const std::string &filename)
|
|||||||
io::IXMLReader* reader = file_manager->createXMLReader(filename.c_str());
|
io::IXMLReader* reader = file_manager->createXMLReader(filename.c_str());
|
||||||
if (!load( reader ))
|
if (!load( reader ))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[ScalableFont] Loading font failed\n");
|
Log::fatal("ScalableFont", "Loading font failed");
|
||||||
assert(false);
|
|
||||||
}
|
}
|
||||||
reader->drop();
|
reader->drop();
|
||||||
|
|
||||||
@ -157,7 +156,7 @@ void ScalableFont::doReadXmlFile(io::IXMLReader* xml)
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (m_texture_files.find(i) != m_texture_files.end())
|
if (m_texture_files.find(i) != m_texture_files.end())
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[ScalableFont] WARNING: Font conflict, two images have texture %i\n", i);
|
Log::warn("ScalableFont", "Font conflict, two images have texture %i.", i);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -258,7 +257,7 @@ bool ScalableFont::load(io::IXMLReader* xml)
|
|||||||
{
|
{
|
||||||
if (!SpriteBank)
|
if (!SpriteBank)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[ScalableFont::load] SpriteBank is NULL!!\n");
|
Log::error("ScalableFont::load", "SpriteBank is NULL!!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -633,7 +632,7 @@ void ScalableFont::draw(const core::stringw& text,
|
|||||||
|
|
||||||
if (texture == NULL)
|
if (texture == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "WARNING: character not found in current font\n");
|
Log::warn("ScalableFont", "Character not found in current font");
|
||||||
continue; // no such character
|
continue; // no such character
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -709,7 +708,7 @@ void ScalableFont::lazyLoadTexture(int texID)
|
|||||||
// couldn't load texture, abort.
|
// couldn't load texture, abort.
|
||||||
if (!SpriteBank->getTexture(texID))
|
if (!SpriteBank->getTexture(texID))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "!!!!! Unable to load all textures in the font\n");
|
Log::error("ScalableFont::lazyLoadTexture", "Unable to load all textures in the font");
|
||||||
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
|
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ void Screen::addWidgets()
|
|||||||
Widget* w = getFirstWidget();
|
Widget* w = getFirstWidget();
|
||||||
//std::cout << "First widget is " << (w == NULL ? "null" : w->m_properties[PROP_ID].c_str()) << std::endl;
|
//std::cout << "First widget is " << (w == NULL ? "null" : w->m_properties[PROP_ID].c_str()) << std::endl;
|
||||||
if (w != NULL) w->setFocusForPlayer( PLAYER_ID_GAME_MASTER );
|
if (w != NULL) w->setFocusForPlayer( PLAYER_ID_GAME_MASTER );
|
||||||
else fprintf(stderr, "Couldn't select first widget, NULL was returned\n");
|
else Log::warn("Screen::AddWidgets", "Couldn't select first widget, NULL was returned");
|
||||||
} // addWidgets
|
} // addWidgets
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@ -206,9 +206,9 @@ void Screen::manualRemoveWidget(Widget* w)
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if(!m_widgets.contains(w))
|
if(!m_widgets.contains(w))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Widget '%d' not found in screen when removing.\n",
|
Log::info("Screen", "Widget '%d' not found in screen when removing.",
|
||||||
w->m_id);
|
w->m_id);
|
||||||
fprintf(stderr, "This can be ignored, but is probably wrong.\n");
|
Log::info("Screen", "This can be ignored, but is probably wrong.");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
m_widgets.remove(w);
|
m_widgets.remove(w);
|
||||||
|
@ -71,7 +71,7 @@ namespace GUIEngine
|
|||||||
GAMEPAD_BADGE = 16,
|
GAMEPAD_BADGE = 16,
|
||||||
/** A keyboard icon */
|
/** A keyboard icon */
|
||||||
KEYBOARD_BADGE = 32,
|
KEYBOARD_BADGE = 32,
|
||||||
/** An hourglass badge to indocate loading */
|
/** An hourglass badge to indicate loading */
|
||||||
LOADING_BADGE = 64
|
LOADING_BADGE = 64
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ void DynamicRibbonWidget::add()
|
|||||||
|
|
||||||
if (m_child_width <= 0 || m_child_height <= 0)
|
if (m_child_width <= 0 || m_child_height <= 0)
|
||||||
{
|
{
|
||||||
std::cerr << "/!\\ Warning /!\\ : ribbon grid widgets require 'child_width' and 'child_height' arguments" << std::endl;
|
Log::warn("DynamicRibbonWidget", "Ribbon grid widgets require 'child_width' and 'child_height' arguments");
|
||||||
m_child_width = 256;
|
m_child_width = 256;
|
||||||
m_child_height = 256;
|
m_child_height = 256;
|
||||||
}
|
}
|
||||||
@ -206,7 +206,7 @@ void DynamicRibbonWidget::add()
|
|||||||
|
|
||||||
if (m_h - m_label_height < 0)
|
if (m_h - m_label_height < 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[DynamicRibbonWidget] WARNING: the widget is too small for anything to fit in it!!\n");
|
Log::warn("DynamicRibbonWidget", "The widget is too small for anything to fit in it!!");
|
||||||
m_row_amount = 1;
|
m_row_amount = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -63,13 +63,9 @@ KartStatsWidget::KartStatsWidget(core::recti area, const int player_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!props)
|
if(!props)
|
||||||
{
|
Log::fatal("KartSelectionScreen", "Can't find default "
|
||||||
fprintf(stderr,
|
"kart '%s' nor any other kart.",
|
||||||
"[KartSelectionScreen] WARNING: Can't find default "
|
default_kart.c_str());
|
||||||
"kart '%s' nor any other kart.\n",
|
|
||||||
default_kart.c_str());
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,6 +50,8 @@ LabelWidget::LabelWidget(bool title, bool bright) : Widget(WTYPE_LABEL)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_has_color = false;
|
m_has_color = false;
|
||||||
|
|
||||||
|
setFocusable(false);
|
||||||
} // LabelWidget
|
} // LabelWidget
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@ -43,6 +43,7 @@ ListWidget::ListWidget() : Widget(WTYPE_LIST)
|
|||||||
m_sort_desc = false;
|
m_sort_desc = false;
|
||||||
m_sort_default = true;
|
m_sort_default = true;
|
||||||
m_sort_col = 0;
|
m_sort_col = 0;
|
||||||
|
m_sortable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@ -270,9 +271,11 @@ std::string ListWidget::getSelectionInternalName()
|
|||||||
|
|
||||||
CGUISTKListBox* list = getIrrlichtElement<CGUISTKListBox>();
|
CGUISTKListBox* list = getIrrlichtElement<CGUISTKListBox>();
|
||||||
assert(list != NULL);
|
assert(list != NULL);
|
||||||
if (getSelectionID() == -1 || (getSelectionID() >= (int)list->getItemCount()))
|
int selectionID = getSelectionID();
|
||||||
|
if (selectionID == -1 || selectionID >= (int)list->getItemCount())
|
||||||
return "";
|
return "";
|
||||||
return list->getItem(getSelectionID()).m_internal_name;
|
const CGUISTKListBox::ListItem& item = list->getItem(selectionID);
|
||||||
|
return item.m_internal_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@ -418,6 +421,8 @@ EventPropagation ListWidget::transmitEvent(Widget* w,
|
|||||||
|
|
||||||
if (originator.find(m_properties[PROP_ID] + "_column_") != std::string::npos)
|
if (originator.find(m_properties[PROP_ID] + "_column_") != std::string::npos)
|
||||||
{
|
{
|
||||||
|
if (!m_sortable) return EVENT_BLOCK;
|
||||||
|
|
||||||
if (m_sort_col != originator[(m_properties[PROP_ID] + "_column_").size()] - '0')
|
if (m_sort_col != originator[(m_properties[PROP_ID] + "_column_").size()] - '0')
|
||||||
{
|
{
|
||||||
m_sort_desc = false;
|
m_sort_desc = false;
|
||||||
|
@ -87,6 +87,8 @@ namespace GUIEngine
|
|||||||
|
|
||||||
IListWidgetHeaderListener* m_listener;
|
IListWidgetHeaderListener* m_listener;
|
||||||
|
|
||||||
|
bool m_sortable;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef irr::gui::CGUISTKListBox::ListItem ListItem;
|
typedef irr::gui::CGUISTKListBox::ListItem ListItem;
|
||||||
typedef ListItem::ListCell ListCell;
|
typedef ListItem::ListCell ListCell;
|
||||||
@ -240,6 +242,8 @@ namespace GUIEngine
|
|||||||
void addColumn(irr::core::stringw col, int proportion=1) { m_header.push_back( Column(col, proportion) ); }
|
void addColumn(irr::core::stringw col, int proportion=1) { m_header.push_back( Column(col, proportion) ); }
|
||||||
|
|
||||||
void clearColumns() { m_header.clear(); }
|
void clearColumns() { m_header.clear(); }
|
||||||
|
|
||||||
|
void setSortable(bool sortable) { m_sortable = sortable; }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ ProgressBarWidget::ProgressBarWidget(bool show_label) : Widget(WTYPE_PROGRESS)
|
|||||||
m_target_value = 0;
|
m_target_value = 0;
|
||||||
m_previous_value = 0;
|
m_previous_value = 0;
|
||||||
m_show_label = show_label;
|
m_show_label = show_label;
|
||||||
|
setFocusable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProgressBarWidget::~ProgressBarWidget()
|
ProgressBarWidget::~ProgressBarWidget()
|
||||||
|
@ -115,8 +115,8 @@ void RibbonWidget::add()
|
|||||||
if (m_active_children[i].m_type != WTYPE_ICON_BUTTON &&
|
if (m_active_children[i].m_type != WTYPE_ICON_BUTTON &&
|
||||||
m_active_children[i].m_type != WTYPE_BUTTON)
|
m_active_children[i].m_type != WTYPE_BUTTON)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "/!\\ Warning /!\\ : ribbon widgets can only have "
|
Log::warn("RiggonWidget", "Ribbon widgets can only have "
|
||||||
"(icon)button widgets as children\n");
|
"(icon)button widgets as children");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ void RibbonWidget::add()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Invalid tab bar contents\n");
|
Log::error("RibbonWidget", "Invalid tab bar contents");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_active_children[i].m_element = subbtn;
|
m_active_children[i].m_element = subbtn;
|
||||||
@ -375,8 +375,7 @@ void RibbonWidget::add()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
Log::warn("RiggonWidget", "Invalid contents type in ribbon");
|
||||||
"/!\\ Warning /!\\ : Invalid contents type in ribbon\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ bool Binding::deserialize(irr::io::IrrXMLReader* xml)
|
|||||||
// Proceed only if neccesary tags were found
|
// Proceed only if neccesary tags were found
|
||||||
if ((id_string == NULL) || (event_string == NULL))
|
if ((id_string == NULL) || (event_string == NULL))
|
||||||
{
|
{
|
||||||
printf("No id-string or event-string given - ignored.\n");
|
Log::warn("Binding", "No id-string or event-string given - ignored.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ bool Binding::deserialize(irr::io::IrrXMLReader* xml)
|
|||||||
// If the action is a stick motion & a direction is defined
|
// If the action is a stick motion & a direction is defined
|
||||||
if (dir_string == NULL)
|
if (dir_string == NULL)
|
||||||
{
|
{
|
||||||
printf("WARNING: IT_STICKMOTION without direction, ignoring.\n");
|
Log::warn("Binding", "IT_STICKMOTION without direction, ignoring.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ void GamePadDevice::resetAxisDirection(const int axis,
|
|||||||
AbstractKart* pk = player->getKart();
|
AbstractKart* pk = player->getKart();
|
||||||
if (pk == NULL)
|
if (pk == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error, trying to reset axis for an unknown player\n");
|
Log::error("Binding", "Trying to reset axis for an unknown player.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
class ClientNetworkManager : public NetworkManager
|
class ClientNetworkManager : public NetworkManager
|
||||||
{
|
{
|
||||||
friend class Singleton<NetworkManager>;
|
friend class AbstractSingleton<NetworkManager>;
|
||||||
public:
|
public:
|
||||||
/*! \brief Get the instance.
|
/*! \brief Get the instance.
|
||||||
* This is a utility function to avoid passing templates parameters
|
* This is a utility function to avoid passing templates parameters
|
||||||
@ -38,7 +38,7 @@ class ClientNetworkManager : public NetworkManager
|
|||||||
*/
|
*/
|
||||||
static ClientNetworkManager* getInstance()
|
static ClientNetworkManager* getInstance()
|
||||||
{
|
{
|
||||||
return Singleton<NetworkManager>::getInstance<ClientNetworkManager>();
|
return AbstractSingleton<NetworkManager>::getInstance<ClientNetworkManager>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief Initializes network.
|
/*! \brief Initializes network.
|
||||||
|
@ -33,9 +33,9 @@
|
|||||||
/** \class NetworkInterface
|
/** \class NetworkInterface
|
||||||
* \ingroup network
|
* \ingroup network
|
||||||
*/
|
*/
|
||||||
class NetworkInterface : public Singleton<NetworkInterface>
|
class NetworkInterface : public AbstractSingleton<NetworkInterface>
|
||||||
{
|
{
|
||||||
friend class Singleton<NetworkInterface>;
|
friend class AbstractSingleton<NetworkInterface>;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/*! \brief Used to init the network.
|
/*! \brief Used to init the network.
|
||||||
|
@ -43,9 +43,9 @@
|
|||||||
* Here are defined some functions that will be specifically implemented by
|
* Here are defined some functions that will be specifically implemented by
|
||||||
* the ServerNetworkManager and the ClientNetworkManager.
|
* the ServerNetworkManager and the ClientNetworkManager.
|
||||||
*/
|
*/
|
||||||
class NetworkManager : public Singleton<NetworkManager>
|
class NetworkManager : public AbstractSingleton<NetworkManager>
|
||||||
{
|
{
|
||||||
friend class Singleton<NetworkManager>;
|
friend class AbstractSingleton<NetworkManager>;
|
||||||
public:
|
public:
|
||||||
/** \brief Function to start the Network Manager (start threads) */
|
/** \brief Function to start the Network Manager (start threads) */
|
||||||
virtual void run();
|
virtual void run();
|
||||||
|
@ -34,9 +34,9 @@ class Item;
|
|||||||
/*! \brief Manages the world updates during an online game
|
/*! \brief Manages the world updates during an online game
|
||||||
* This function's update is to be called instead of the normal World update
|
* This function's update is to be called instead of the normal World update
|
||||||
*/
|
*/
|
||||||
class NetworkWorld : public Singleton<NetworkWorld>
|
class NetworkWorld : public AbstractSingleton<NetworkWorld>
|
||||||
{
|
{
|
||||||
friend class Singleton<NetworkWorld>;
|
friend class AbstractSingleton<NetworkWorld>;
|
||||||
public:
|
public:
|
||||||
void update(float dt);
|
void update(float dt);
|
||||||
|
|
||||||
|
@ -102,9 +102,9 @@ typedef struct EventProcessingInfo
|
|||||||
* frames per second. Then, the management of protocols is thread-safe: any
|
* frames per second. Then, the management of protocols is thread-safe: any
|
||||||
* object can start/pause/stop protocols whithout problems.
|
* object can start/pause/stop protocols whithout problems.
|
||||||
*/
|
*/
|
||||||
class ProtocolManager : public Singleton<ProtocolManager>
|
class ProtocolManager : public AbstractSingleton<ProtocolManager>
|
||||||
{
|
{
|
||||||
friend class Singleton<ProtocolManager>;
|
friend class AbstractSingleton<ProtocolManager>;
|
||||||
friend void* protocolManagerAsynchronousUpdate(void* data);
|
friend void* protocolManagerAsynchronousUpdate(void* data);
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ void GetPublicAddress::asynchronousUpdate()
|
|||||||
hints.ai_socktype = SOCK_STREAM;
|
hints.ai_socktype = SOCK_STREAM;
|
||||||
|
|
||||||
if ((status = getaddrinfo(stun_servers[rand_result].c_str(), NULL, &hints, &res)) != 0) {
|
if ((status = getaddrinfo(stun_servers[rand_result].c_str(), NULL, &hints, &res)) != 0) {
|
||||||
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(status));
|
Log::error("getaddrinfo", gai_strerror(status));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for(p = res;p != NULL; p = p->ai_next)
|
for(p = res;p != NULL; p = p->ai_next)
|
||||||
|
@ -27,11 +27,11 @@
|
|||||||
|
|
||||||
class ServerNetworkManager : public NetworkManager
|
class ServerNetworkManager : public NetworkManager
|
||||||
{
|
{
|
||||||
friend class Singleton<NetworkManager>;
|
friend class AbstractSingleton<NetworkManager>;
|
||||||
public:
|
public:
|
||||||
static ServerNetworkManager* getInstance()
|
static ServerNetworkManager* getInstance()
|
||||||
{
|
{
|
||||||
return Singleton<NetworkManager>::getInstance<ServerNetworkManager>();
|
return AbstractSingleton<NetworkManager>::getInstance<ServerNetworkManager>();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void run();
|
virtual void run();
|
||||||
|
@ -238,10 +238,7 @@ void PhysicalObject::init()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[PhysicalObject] Unknown node type\n");
|
Log::fatal("PhysicalObject", "Unknown node type");
|
||||||
max = 1.0f;
|
|
||||||
min = 0.0f;
|
|
||||||
assert(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (dynamic_cast<TrackObjectPresentationInstancing*>(presentation) != NULL)
|
else if (dynamic_cast<TrackObjectPresentationInstancing*>(presentation) != NULL)
|
||||||
@ -256,10 +253,7 @@ void PhysicalObject::init()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[PhysicalObject] Unknown node type\n");
|
Log::fatal("PhysicalObject", "Unknown node type");
|
||||||
max = 1.0f;
|
|
||||||
min = 0.0f;
|
|
||||||
assert(false);
|
|
||||||
}
|
}
|
||||||
Vec3 extend = max-min;
|
Vec3 extend = max-min;
|
||||||
// Adjust the mesth of the graphical object so that its center is where it
|
// Adjust the mesth of the graphical object so that its center is where it
|
||||||
@ -453,7 +447,7 @@ void PhysicalObject::init()
|
|||||||
}
|
}
|
||||||
case MP_NONE:
|
case MP_NONE:
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "WARNING: Uninitialised moving shape\n");
|
Log::warn("PhysicalObject", "Uninitialised moving shape");
|
||||||
// intended fall-through
|
// intended fall-through
|
||||||
case MP_BOX:
|
case MP_BOX:
|
||||||
{
|
{
|
||||||
|
@ -112,7 +112,7 @@ void TriangleMesh::createCollisionShape(bool create_collision_object, const char
|
|||||||
btOptimizedBvh* bhv = btOptimizedBvh::deSerializeInPlace(bytes, pos, !IS_LITTLE_ENDIAN);
|
btOptimizedBvh* bhv = btOptimizedBvh::deSerializeInPlace(bytes, pos, !IS_LITTLE_ENDIAN);
|
||||||
if (bhv == NULL)
|
if (bhv == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[TriangleMesh] WARNING, failed to load serialized BHV\n");
|
Log::warn("TriangleMesh", "Failed to load serialized BHV");
|
||||||
bhv_triangle_mesh = new btBvhTriangleMeshShape(&m_mesh, false /* useQuantizedAabbCompression */);
|
bhv_triangle_mesh = new btBvhTriangleMeshShape(&m_mesh, false /* useQuantizedAabbCompression */);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -37,6 +37,9 @@
|
|||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
/** Loads a grand prix definition from a file.
|
||||||
|
* \param filename Name of the file to load.
|
||||||
|
*/
|
||||||
GrandPrixData::GrandPrixData(const std::string& filename)
|
GrandPrixData::GrandPrixData(const std::string& filename)
|
||||||
{
|
{
|
||||||
m_filename = filename;
|
m_filename = filename;
|
||||||
@ -44,18 +47,34 @@ GrandPrixData::GrandPrixData(const std::string& filename)
|
|||||||
StringUtils::removeExtension(filename));
|
StringUtils::removeExtension(filename));
|
||||||
m_editable = (filename.find(file_manager->getGPDir(), 0) == 0);
|
m_editable = (filename.find(file_manager->getGPDir(), 0) == 0);
|
||||||
reload();
|
reload();
|
||||||
}
|
} // GrandPrixData
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
GrandPrixData::GrandPrixData(const unsigned int number_of_tracks,
|
/** Creates a random grand prix from the specified parameters.
|
||||||
const std::string& track_group,
|
* \param number_of_tracks How many tracks to select.
|
||||||
const RandomGPInfoDialog::REVERSED use_reverse)
|
* \param track_group From which track group to select the tracks.
|
||||||
|
* \param use_reverse How the reverse setting is to be determined.
|
||||||
|
* \param new_tracks If true, new tracks are selected, otherwise existing
|
||||||
|
* tracks will not be changed (used to e.g. increase the number of
|
||||||
|
* tracks in an already existing random grand prix).
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void GrandPrixData::createRandomGP(const unsigned int number_of_tracks,
|
||||||
|
const std::string &track_group,
|
||||||
|
const GPReverseType use_reverse,
|
||||||
|
bool new_tracks)
|
||||||
{
|
{
|
||||||
m_filename = "Random GP - Not loaded from a file!";
|
m_filename = "Random GP - Not loaded from a file!";
|
||||||
m_id = "random";
|
m_id = "random";
|
||||||
m_name = "Random Grand Prix";
|
m_name = "Random Grand Prix";
|
||||||
m_editable = false;
|
m_editable = false;
|
||||||
|
|
||||||
|
if(new_tracks)
|
||||||
|
{
|
||||||
|
m_tracks.clear();
|
||||||
|
m_laps.clear();
|
||||||
|
m_reversed.clear();
|
||||||
|
}
|
||||||
m_tracks.reserve(number_of_tracks);
|
m_tracks.reserve(number_of_tracks);
|
||||||
m_laps.reserve(number_of_tracks);
|
m_laps.reserve(number_of_tracks);
|
||||||
m_reversed.reserve(number_of_tracks);
|
m_reversed.reserve(number_of_tracks);
|
||||||
@ -117,48 +136,64 @@ void GrandPrixData::changeTrackNumber(const unsigned int number_of_tracks,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
/** Updates the GP data with newly decided reverse requirements.
|
||||||
void GrandPrixData::changeReverse(const RandomGPInfoDialog::REVERSED use_reverse)
|
* \param use_reverse How reverse setting for each track is to be determined.
|
||||||
|
*/
|
||||||
|
void GrandPrixData::changeReverse(const GrandPrixData::GPReverseType use_reverse)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < m_tracks.size(); i++)
|
for (unsigned int i = 0; i < m_tracks.size(); i++)
|
||||||
{
|
{
|
||||||
if (use_reverse == RandomGPInfoDialog::NO_REVERSE)
|
if (use_reverse == GP_NO_REVERSE)
|
||||||
m_reversed[i] = false;
|
m_reversed[i] = false;
|
||||||
else if (use_reverse == RandomGPInfoDialog::MIXED)
|
else if (use_reverse == GP_RANDOM_REVERSE)
|
||||||
if (track_manager->getTrack(m_tracks[i])->reverseAvailable())
|
if (track_manager->getTrack(m_tracks[i])->reverseAvailable())
|
||||||
m_reversed[i] = (rand() % 2 != 0);
|
m_reversed[i] = (rand() % 2 != 0);
|
||||||
else
|
else
|
||||||
m_reversed[i] = false;
|
m_reversed[i] = false;
|
||||||
else // all reversed
|
else // all reversed
|
||||||
m_reversed[i] = track_manager->getTrack(m_tracks[i])->reverseAvailable();
|
m_reversed[i] = track_manager->getTrack(m_tracks[i])->reverseAvailable();
|
||||||
}
|
} // for i < m_tracks.size()
|
||||||
}
|
} // changeReverse
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
/** Sets the id of this grand prix.
|
||||||
|
* \param id The new id.
|
||||||
|
*/
|
||||||
void GrandPrixData::setId(const std::string& id)
|
void GrandPrixData::setId(const std::string& id)
|
||||||
{
|
{
|
||||||
m_id = id;
|
m_id = id;
|
||||||
}
|
} // setId
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
/** Sets the name of the grand prix.
|
||||||
|
* \param name New name.
|
||||||
|
*/
|
||||||
void GrandPrixData::setName(const irr::core::stringw& name)
|
void GrandPrixData::setName(const irr::core::stringw& name)
|
||||||
{
|
{
|
||||||
m_name = name;
|
m_name = name;
|
||||||
}
|
} // setName
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
/** Sets the filename of this grand prix.
|
||||||
|
* \param filename New filename.
|
||||||
|
*/
|
||||||
void GrandPrixData::setFilename(const std::string& filename)
|
void GrandPrixData::setFilename(const std::string& filename)
|
||||||
{
|
{
|
||||||
m_filename = filename;
|
m_filename = filename;
|
||||||
}
|
} // setFilename
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
/** Sets if this grand prix can be edited.
|
||||||
|
* \param editable New value.
|
||||||
|
*/
|
||||||
void GrandPrixData::setEditable(const bool editable)
|
void GrandPrixData::setEditable(const bool editable)
|
||||||
{
|
{
|
||||||
m_editable = editable;
|
m_editable = editable;
|
||||||
}
|
} // setEditable
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
/** Reloads grand prix from file.
|
||||||
|
*/
|
||||||
void GrandPrixData::reload()
|
void GrandPrixData::reload()
|
||||||
{
|
{
|
||||||
m_tracks.clear();
|
m_tracks.clear();
|
||||||
@ -270,6 +305,8 @@ void GrandPrixData::reload()
|
|||||||
} // reload()
|
} // reload()
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
/** Saves the grand prix data to a file.
|
||||||
|
*/
|
||||||
bool GrandPrixData::writeToFile()
|
bool GrandPrixData::writeToFile()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -303,9 +340,12 @@ bool GrandPrixData::writeToFile()
|
|||||||
m_filename.c_str(), e.what());
|
m_filename.c_str(), e.what());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
} // writeToFile
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
/** Checks if the grand prix data are consistent.
|
||||||
|
* \param log_error: If errors should be sent to the logger.
|
||||||
|
*/
|
||||||
bool GrandPrixData::checkConsistency(bool log_error) const
|
bool GrandPrixData::checkConsistency(bool log_error) const
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < m_tracks.size(); i++)
|
for (unsigned int i = 0; i < m_tracks.size(); i++)
|
||||||
@ -323,8 +363,7 @@ bool GrandPrixData::checkConsistency(bool log_error) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
} // checkConsistency
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
/** Returns true if the track is available. This is used to test if Fort Magma
|
/** Returns true if the track is available. This is used to test if Fort Magma
|
||||||
@ -332,76 +371,99 @@ bool GrandPrixData::checkConsistency(bool log_error) const
|
|||||||
* story mode, but will be available once all challenges are done and nolok
|
* story mode, but will be available once all challenges are done and nolok
|
||||||
* is unlocked). It also prevents people from using the grand prix editor as
|
* is unlocked). It also prevents people from using the grand prix editor as
|
||||||
* a way to play tracks that still haven't been unlocked
|
* a way to play tracks that still haven't been unlocked
|
||||||
|
* \param id Name of the track to test.
|
||||||
|
* \param include_locked If set to true, all tracks (including locked tracks)
|
||||||
|
* are considered to be available.
|
||||||
*/
|
*/
|
||||||
bool GrandPrixData::isTrackAvailable(const std::string &id,
|
bool GrandPrixData::isTrackAvailable(const std::string &id,
|
||||||
bool includeLocked ) const
|
bool include_locked ) const
|
||||||
{
|
{
|
||||||
if (includeLocked)
|
if (include_locked)
|
||||||
return true;
|
return true;
|
||||||
else if (id == "fortmagma")
|
else if (id == "fortmagma")
|
||||||
return !PlayerManager::getCurrentPlayer()->isLocked("fortmagma");
|
return !PlayerManager::getCurrentPlayer()->isLocked("fortmagma");
|
||||||
else
|
else
|
||||||
return (!m_editable ||
|
return (!m_editable ||
|
||||||
!PlayerManager::get()->getCurrentPlayer()->isLocked(id));
|
!PlayerManager::get()->getCurrentPlayer()->isLocked(id));
|
||||||
}
|
} // isTrackAvailable
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
std::vector<std::string> GrandPrixData::getTrackNames(bool includeLocked) const
|
/** Returns the list of tracks that is available (i.e. unlocked) of this
|
||||||
|
* grand prix.
|
||||||
|
* \param include_locked If data for locked tracks should be included or not.
|
||||||
|
* \return A copy of the list of available tracks in this grand prix.
|
||||||
|
*/
|
||||||
|
std::vector<std::string> GrandPrixData::getTrackNames(bool include_locked) const
|
||||||
{
|
{
|
||||||
std::vector<std::string> names;
|
std::vector<std::string> names;
|
||||||
for (unsigned int i = 0; i < m_tracks.size(); i++)
|
for (unsigned int i = 0; i < m_tracks.size(); i++)
|
||||||
{
|
{
|
||||||
if(isTrackAvailable(m_tracks[i], includeLocked))
|
if(isTrackAvailable(m_tracks[i], include_locked))
|
||||||
names.push_back(m_tracks[i]);
|
names.push_back(m_tracks[i]);
|
||||||
}
|
}
|
||||||
return names;
|
return names;
|
||||||
}
|
} // getTrackNames
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
std::vector<int> GrandPrixData::getLaps(bool includeLocked) const
|
/** Returns the laps for each available track of the grand prix.
|
||||||
|
* \param include_locked If data for locked tracks should be included or not.
|
||||||
|
* \return a std::vector containing the laps for each grand prix.
|
||||||
|
*/
|
||||||
|
std::vector<int> GrandPrixData::getLaps(bool include_locked) const
|
||||||
{
|
{
|
||||||
std::vector<int> laps;
|
std::vector<int> laps;
|
||||||
for (unsigned int i = 0; i< m_tracks.size(); i++)
|
for (unsigned int i = 0; i< m_tracks.size(); i++)
|
||||||
if(isTrackAvailable(m_tracks[i], includeLocked))
|
if(isTrackAvailable(m_tracks[i], include_locked))
|
||||||
laps.push_back(m_laps[i]);
|
laps.push_back(m_laps[i]);
|
||||||
|
|
||||||
return laps;
|
return laps;
|
||||||
}
|
} // getLaps
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
std::vector<bool> GrandPrixData::getReverse(bool includeLocked) const
|
/** Returns the reverse setting for each available grand prix.
|
||||||
|
* \param include_locked If data for locked tracks should be included or not.
|
||||||
|
* \return A copy of alist with the reverse status for each track.
|
||||||
|
*/
|
||||||
|
std::vector<bool> GrandPrixData::getReverse(bool include_locked) const
|
||||||
{
|
{
|
||||||
std::vector<bool> reverse;
|
std::vector<bool> reverse;
|
||||||
for (unsigned int i = 0; i< m_tracks.size(); i++)
|
for (unsigned int i = 0; i< m_tracks.size(); i++)
|
||||||
if(isTrackAvailable(m_tracks[i], includeLocked))
|
if(isTrackAvailable(m_tracks[i], include_locked))
|
||||||
reverse.push_back(m_reversed[i]);
|
reverse.push_back(m_reversed[i]);
|
||||||
|
|
||||||
return reverse;
|
return reverse;
|
||||||
}
|
} // getReverse
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
/** Returns true if this grand prix can be edited.
|
||||||
|
*/
|
||||||
bool GrandPrixData::isEditable() const
|
bool GrandPrixData::isEditable() const
|
||||||
{
|
{
|
||||||
return m_editable;
|
return m_editable;
|
||||||
}
|
} // isEditable
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
/** Returns the number of tracks in this grand prix.
|
||||||
|
* \param include_locked If data for locked tracks should be included or not.
|
||||||
|
*/
|
||||||
unsigned int GrandPrixData::getNumberOfTracks(bool includeLocked) const
|
unsigned int GrandPrixData::getNumberOfTracks(bool includeLocked) const
|
||||||
{
|
{
|
||||||
if (includeLocked)
|
if (includeLocked)
|
||||||
return m_tracks.size();
|
return m_tracks.size();
|
||||||
else
|
else
|
||||||
return getTrackNames(false).size();
|
return getTrackNames(false).size();
|
||||||
}
|
} // getNumberOfTracks
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
/** Returns the (translated) name of the track with the specified index.
|
||||||
|
*/
|
||||||
irr::core::stringw GrandPrixData::getTrackName(const unsigned int track) const
|
irr::core::stringw GrandPrixData::getTrackName(const unsigned int track) const
|
||||||
{
|
{
|
||||||
assert(track < getNumberOfTracks(true));
|
assert(track < getNumberOfTracks(true));
|
||||||
Track* t = track_manager->getTrack(m_tracks[track]);
|
Track* t = track_manager->getTrack(m_tracks[track]);
|
||||||
assert(t != NULL);
|
assert(t != NULL);
|
||||||
return t->getName();
|
return t->getName();
|
||||||
}
|
} // getTrackName
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
const std::string& GrandPrixData::getTrackId(const unsigned int track) const
|
const std::string& GrandPrixData::getTrackId(const unsigned int track) const
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "states_screens/dialogs/random_gp_dialog.hpp"
|
|
||||||
#include "utils/translation.hpp"
|
#include "utils/translation.hpp"
|
||||||
|
|
||||||
using irr::core::stringw;
|
using irr::core::stringw;
|
||||||
@ -69,21 +68,35 @@ private:
|
|||||||
*/
|
*/
|
||||||
bool isTrackAvailable(const std::string &id, bool includeLocked) const;
|
bool isTrackAvailable(const std::string &id, bool includeLocked) const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/** Used to define the reverse setting when creating a random GP:
|
||||||
|
* No reverse, all reverse (if available on the track), random
|
||||||
|
* selection. */
|
||||||
|
enum GPReverseType
|
||||||
|
{
|
||||||
|
GP_NO_REVERSE = 0,
|
||||||
|
GP_ALL_REVERSE = 1,
|
||||||
|
GP_RANDOM_REVERSE = 2
|
||||||
|
}; // GPReverseType
|
||||||
|
|
||||||
public:
|
public:
|
||||||
#if (defined(WIN32) || defined(_WIN32)) && !defined(__MINGW32__)
|
#if (defined(WIN32) || defined(_WIN32)) && !defined(__MINGW32__)
|
||||||
# pragma warning(disable:4290)
|
# pragma warning(disable:4290)
|
||||||
#endif
|
#endif
|
||||||
/** Load the GrandPrixData from the given filename */
|
/** Load the GrandPrixData from the given filename */
|
||||||
GrandPrixData(const std::string& filename);
|
GrandPrixData(const std::string& filename);
|
||||||
|
|
||||||
/** Needed for simple creation of an instance of GrandPrixData */
|
/** Needed for simple creation of an instance of GrandPrixData */
|
||||||
GrandPrixData() {};
|
GrandPrixData() {};
|
||||||
/** Creates a new random GP */
|
|
||||||
GrandPrixData(const unsigned int number_of_tracks,
|
|
||||||
const std::string& track_group,
|
|
||||||
const RandomGPInfoDialog::REVERSED use_reverse);
|
|
||||||
void changeTrackNumber(const unsigned int number_of_tracks,
|
void changeTrackNumber(const unsigned int number_of_tracks,
|
||||||
const std::string& track_group);
|
const std::string& track_group);
|
||||||
void changeReverse(const RandomGPInfoDialog::REVERSED use_reverse);
|
void changeReverse(const GPReverseType use_reverse);
|
||||||
|
|
||||||
|
void createRandomGP(const unsigned int number_of_tracks,
|
||||||
|
const std::string& track_group,
|
||||||
|
const GPReverseType use_reverse,
|
||||||
|
bool new_tracks=false);
|
||||||
|
|
||||||
// Methods for the GP editor
|
// Methods for the GP editor
|
||||||
void setId(const std::string& id);
|
void setId(const std::string& id);
|
||||||
|
@ -34,7 +34,6 @@ const char* GrandPrixManager::SUFFIX = ".grandprix";
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
GrandPrixManager::GrandPrixManager()
|
GrandPrixManager::GrandPrixManager()
|
||||||
{
|
{
|
||||||
m_random_gp = NULL; // better do it explicitly and avoid weird stuff
|
|
||||||
loadFiles();
|
loadFiles();
|
||||||
} // GrandPrixManager
|
} // GrandPrixManager
|
||||||
|
|
||||||
@ -42,10 +41,7 @@ GrandPrixManager::GrandPrixManager()
|
|||||||
GrandPrixManager::~GrandPrixManager()
|
GrandPrixManager::~GrandPrixManager()
|
||||||
{
|
{
|
||||||
for(unsigned int i=0; i<m_gp_data.size(); i++)
|
for(unsigned int i=0; i<m_gp_data.size(); i++)
|
||||||
{
|
|
||||||
delete m_gp_data[i];
|
delete m_gp_data[i];
|
||||||
}
|
|
||||||
delete m_random_gp;
|
|
||||||
} // ~GrandPrixManager
|
} // ~GrandPrixManager
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -97,7 +93,7 @@ void GrandPrixManager::load(const std::string& filename)
|
|||||||
catch (std::runtime_error& e)
|
catch (std::runtime_error& e)
|
||||||
{
|
{
|
||||||
Log::error("GrandPrixManager",
|
Log::error("GrandPrixManager",
|
||||||
"Ignoring grand prix %s (%s)\n", filename.c_str(), e.what());
|
"Ignoring Grand Prix %s (%s)\n", filename.c_str(), e.what());
|
||||||
}
|
}
|
||||||
} // load
|
} // load
|
||||||
|
|
||||||
@ -156,9 +152,6 @@ GrandPrixData* GrandPrixManager::getGrandPrix(const std::string& s) const
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
GrandPrixData* GrandPrixManager::editGrandPrix(const std::string& s) const
|
GrandPrixData* GrandPrixManager::editGrandPrix(const std::string& s) const
|
||||||
{
|
{
|
||||||
if (s == "random")
|
|
||||||
return m_random_gp;
|
|
||||||
|
|
||||||
for(unsigned int i=0; i<m_gp_data.size(); i++)
|
for(unsigned int i=0; i<m_gp_data.size(); i++)
|
||||||
{
|
{
|
||||||
if(m_gp_data[i]->getId() == s)
|
if(m_gp_data[i]->getId() == s)
|
||||||
|
@ -22,7 +22,8 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "race/grand_prix_data.hpp"
|
#include "irrlicht.h"
|
||||||
|
class GrandPrixData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \ingroup race
|
* \ingroup race
|
||||||
@ -47,10 +48,6 @@ private:
|
|||||||
bool existsName(const irr::core::stringw& name) const;
|
bool existsName(const irr::core::stringw& name) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** saved here by a random GP dialog to avoid dangling pinters or
|
|
||||||
* memory leaks */
|
|
||||||
GrandPrixData* m_random_gp;
|
|
||||||
|
|
||||||
GrandPrixManager();
|
GrandPrixManager();
|
||||||
~GrandPrixManager();
|
~GrandPrixManager();
|
||||||
void reload();
|
void reload();
|
||||||
|
@ -212,10 +212,10 @@ void Highscores::getEntry(int number, std::string &kart_name,
|
|||||||
{
|
{
|
||||||
if(number<0 || number>getNumberEntries())
|
if(number<0 || number>getNumberEntries())
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error, accessing undefined highscore entry:\n");
|
Log::warn("Highscores", "Accessing undefined highscore entry:");
|
||||||
fprintf(stderr,"number %d, but %d entries are defined\n",number,
|
Log::warn("Highscores", "Number %d, but %d entries are defined.", number,
|
||||||
getNumberEntries());
|
getNumberEntries());
|
||||||
fprintf(stderr, "This error can be ignored, but no highscores are available\n");
|
Log::warn("Highscores", "This error can be ignored, but no highscores are available.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
kart_name = m_kart_name[number];
|
kart_name = m_kart_name[number];
|
||||||
|
@ -127,7 +127,7 @@ void History::updateReplay(float dt)
|
|||||||
World *world = World::getWorld();
|
World *world = World::getWorld();
|
||||||
if(m_current>=(int)m_all_deltas.size())
|
if(m_current>=(int)m_all_deltas.size())
|
||||||
{
|
{
|
||||||
printf("Replay finished.\n");
|
Log::info("History", "Replay finished");
|
||||||
m_current = 0;
|
m_current = 0;
|
||||||
// Note that for physics replay all physics parameters
|
// Note that for physics replay all physics parameters
|
||||||
// need to be reset, e.g. velocity, ...
|
// need to be reset, e.g. velocity, ...
|
||||||
@ -158,20 +158,19 @@ void History::Save()
|
|||||||
{
|
{
|
||||||
FILE *fd = fopen("history.dat","w");
|
FILE *fd = fopen("history.dat","w");
|
||||||
if(fd)
|
if(fd)
|
||||||
printf("History saved in ./history.dat.\n");
|
Log::info("History", "Saved in ./history.dat.");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string fn = file_manager->getUserConfigFile("history.dat");
|
std::string fn = file_manager->getUserConfigFile("history.dat");
|
||||||
fd = fopen(fn.c_str(), "w");
|
fd = fopen(fn.c_str(), "w");
|
||||||
if(fd)
|
if(fd)
|
||||||
printf("History saved in '%s'.\n",fn.c_str());
|
Log::info("History", "Saved in '%s'.", fn.c_str());
|
||||||
|
|
||||||
}
|
}
|
||||||
if(!fd)
|
if(!fd)
|
||||||
{
|
{
|
||||||
printf("Can't open history.dat file for writing - can't save history.\n");
|
Log::info("History", "Can't open history.dat file for writing - can't save history.");
|
||||||
printf("Make sure history.dat in the current directory or the config\n");
|
Log::info("History", "Make sure history.dat in the current directory "
|
||||||
printf("directory is writable.\n");
|
"or the config directory is writable.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,75 +230,46 @@ void History::Load()
|
|||||||
|
|
||||||
FILE *fd = fopen("history.dat","r");
|
FILE *fd = fopen("history.dat","r");
|
||||||
if(fd)
|
if(fd)
|
||||||
printf("Reading ./history.dat\n");
|
Log::info("History", "Reading ./history.dat");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string fn = file_manager->getUserConfigFile("history.dat");
|
std::string fn = file_manager->getUserConfigFile("history.dat");
|
||||||
fd = fopen(fn.c_str(), "r");
|
fd = fopen(fn.c_str(), "r");
|
||||||
if(fd)
|
if(fd)
|
||||||
printf("Reading '%s'.\n", fn.c_str());
|
Log::info("History", "Reading '%s'.", fn.c_str());
|
||||||
}
|
}
|
||||||
if(!fd)
|
if(!fd)
|
||||||
{
|
Log::fatal("History", "Could not open history.dat");
|
||||||
fprintf(stderr, "ERROR: could not open history.dat\n");
|
|
||||||
exit(-2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fgets(s, 1023, fd) == NULL)
|
if (fgets(s, 1023, fd) == NULL)
|
||||||
{
|
Log::fatal("History", "Could not read history.dat.");
|
||||||
fprintf(stderr, "ERROR: could not read history.dat\n");
|
|
||||||
exit(-2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sscanf(s,"Version: %1023s",s1)!=1)
|
if (sscanf(s,"Version: %1023s",s1)!=1)
|
||||||
{
|
Log::fatal("History", "No Version information found in history file (bogus history file).");
|
||||||
fprintf(stderr, "ERROR: no Version information found in history file (bogus history file)\n");
|
else if (strcmp(s1,STK_VERSION))
|
||||||
exit(-2);
|
Log::warn("History", "History is version '%s', STK version is '%s'.", s1, STK_VERSION);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (strcmp(s1,STK_VERSION))
|
|
||||||
{
|
|
||||||
fprintf(stderr, "WARNING: history is version '%s'\n",s1);
|
|
||||||
fprintf(stderr, " STK version is '%s'\n",STK_VERSION);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fgets(s, 1023, fd) == NULL)
|
if (fgets(s, 1023, fd) == NULL)
|
||||||
{
|
Log::fatal("History", "Could not read history.dat.");
|
||||||
fprintf(stderr, "ERROR: could not read history.dat\n");
|
|
||||||
exit(-2);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int num_karts;
|
unsigned int num_karts;
|
||||||
if(sscanf(s, "numkarts: %d",&num_karts)!=1)
|
if(sscanf(s, "numkarts: %d",&num_karts)!=1)
|
||||||
{
|
Log::fatal("History", "No number of karts found in history file.");
|
||||||
fprintf(stderr,"WARNING: No number of karts found in history file.\n");
|
|
||||||
exit(-2);
|
|
||||||
}
|
|
||||||
race_manager->setNumKarts(num_karts);
|
race_manager->setNumKarts(num_karts);
|
||||||
|
|
||||||
fgets(s, 1023, fd);
|
fgets(s, 1023, fd);
|
||||||
if(sscanf(s, "numplayers: %d",&n)!=1)
|
if(sscanf(s, "numplayers: %d",&n)!=1)
|
||||||
{
|
Log::fatal("History", "No number of players found in history file.");
|
||||||
fprintf(stderr,"WARNING: No number of players found in history file.\n");
|
|
||||||
exit(-2);
|
|
||||||
}
|
|
||||||
race_manager->setNumLocalPlayers(n);
|
race_manager->setNumLocalPlayers(n);
|
||||||
|
|
||||||
fgets(s, 1023, fd);
|
fgets(s, 1023, fd);
|
||||||
if(sscanf(s, "difficulty: %d",&n)!=1)
|
if(sscanf(s, "difficulty: %d",&n)!=1)
|
||||||
{
|
Log::fatal("History", "No difficulty found in history file.");
|
||||||
fprintf(stderr,"WARNING: No difficulty found in history file.\n");
|
|
||||||
exit(-2);
|
|
||||||
}
|
|
||||||
race_manager->setDifficulty((RaceManager::Difficulty)n);
|
race_manager->setDifficulty((RaceManager::Difficulty)n);
|
||||||
|
|
||||||
fgets(s, 1023, fd);
|
fgets(s, 1023, fd);
|
||||||
if(sscanf(s, "track: %1023s",s1)!=1)
|
if(sscanf(s, "track: %1023s",s1)!=1)
|
||||||
{
|
Log::warn("History", "Track not found in history file.");
|
||||||
fprintf(stderr,"WARNING: Track not found in history file.\n");
|
|
||||||
}
|
|
||||||
race_manager->setTrack(s1);
|
race_manager->setTrack(s1);
|
||||||
// This value doesn't really matter, but should be defined, otherwise
|
// This value doesn't really matter, but should be defined, otherwise
|
||||||
// the racing phase can switch to 'ending'
|
// the racing phase can switch to 'ending'
|
||||||
@ -308,12 +278,8 @@ void History::Load()
|
|||||||
for(unsigned int i=0; i<num_karts; i++)
|
for(unsigned int i=0; i<num_karts; i++)
|
||||||
{
|
{
|
||||||
fgets(s, 1023, fd);
|
fgets(s, 1023, fd);
|
||||||
if(sscanf(s, "model %d: %1023s",&n, s1)!=2)
|
if(sscanf(s, "model %d: %1023s",&n, s1) != 2)
|
||||||
{
|
Log::fatal("History", "No model information for kart %d found.", i);
|
||||||
fprintf(stderr,"WARNING: No model information for kart %d found.\n",
|
|
||||||
i);
|
|
||||||
exit(-2);
|
|
||||||
}
|
|
||||||
m_kart_ident.push_back(s1);
|
m_kart_ident.push_back(s1);
|
||||||
if(i<race_manager->getNumPlayers())
|
if(i<race_manager->getNumPlayers())
|
||||||
{
|
{
|
||||||
@ -323,10 +289,8 @@ void History::Load()
|
|||||||
// FIXME: The model information is currently ignored
|
// FIXME: The model information is currently ignored
|
||||||
fgets(s, 1023, fd);
|
fgets(s, 1023, fd);
|
||||||
if(sscanf(s,"size: %d",&m_size)!=1)
|
if(sscanf(s,"size: %d",&m_size)!=1)
|
||||||
{
|
Log::fatal("History", "Number of records not found in history file.");
|
||||||
fprintf(stderr,"WARNING: Number of records not found in history file.\n");
|
|
||||||
exit(-2);
|
|
||||||
}
|
|
||||||
allocateMemory(m_size);
|
allocateMemory(m_size);
|
||||||
m_current = -1;
|
m_current = -1;
|
||||||
|
|
||||||
|
@ -88,70 +88,51 @@ void ReplayPlay::Load()
|
|||||||
FILE *fd = openReplayFile(/*writeable*/false);
|
FILE *fd = openReplayFile(/*writeable*/false);
|
||||||
if(!fd)
|
if(!fd)
|
||||||
{
|
{
|
||||||
printf("Can't read '%s', ghost replay disabled.\n",
|
Log::error("Replay", "Can't read '%s', ghost replay disabled.",
|
||||||
getReplayFilename().c_str());
|
getReplayFilename().c_str());
|
||||||
destroy();
|
destroy();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Reading replay file '%s'.\n", getReplayFilename().c_str());
|
Log::info("Replay", "Reading replay file '%s'.", getReplayFilename().c_str());
|
||||||
|
|
||||||
if (fgets(s, 1023, fd) == NULL)
|
if (fgets(s, 1023, fd) == NULL)
|
||||||
{
|
Log::fatal("Replay", "Could not read '%s'.", getReplayFilename().c_str());
|
||||||
fprintf(stderr, "ERROR: could not read '%s'.\n",
|
|
||||||
getReplayFilename().c_str());
|
|
||||||
exit(-2);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int version;
|
unsigned int version;
|
||||||
if (sscanf(s,"Version: %d", &version)!=1)
|
if (sscanf(s,"Version: %d", &version) != 1)
|
||||||
{
|
Log::fatal("Replay", "No Version information found in replay file (bogus replay file).");
|
||||||
fprintf(stderr, "ERROR: no Version information found in replay file"
|
|
||||||
" (bogus replay file)\n");
|
|
||||||
exit(-2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (version!=getReplayVersion())
|
if (version != getReplayVersion())
|
||||||
{
|
{
|
||||||
fprintf(stderr, "WARNING: replay is version '%d'\n",version);
|
Log::warn("Replay", "Replay is version '%d'",version);
|
||||||
fprintf(stderr, " STK version is '%d'\n",getReplayVersion());
|
Log::warn("Replay", "STK version is '%d'",getReplayVersion());
|
||||||
fprintf(stderr, " We try to proceed, but it may fail.\n");
|
Log::warn("Replay", "We try to proceed, but it may fail.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fgets(s, 1023, fd) == NULL)
|
if (fgets(s, 1023, fd) == NULL)
|
||||||
{
|
Log::fatal("Replay", "Could not read '%s'.", getReplayFilename().c_str());
|
||||||
fprintf(stderr, "ERROR: could not read '%s'.\n",
|
|
||||||
getReplayFilename().c_str());
|
|
||||||
exit(-2);
|
|
||||||
}
|
|
||||||
|
|
||||||
int n;
|
int n;
|
||||||
if(sscanf(s, "difficulty: %d",&n)!=1)
|
if(sscanf(s, "difficulty: %d", &n) != 1)
|
||||||
{
|
Log::fatal("Replay", " No difficulty found in replay file.");
|
||||||
fprintf(stderr,"WARNING: No difficulty found in replay file.\n");
|
|
||||||
exit(-2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(race_manager->getDifficulty()!=(RaceManager::Difficulty)n)
|
if(race_manager->getDifficulty()!=(RaceManager::Difficulty)n)
|
||||||
printf("Warning, difficulty of replay is '%d', "
|
Log::warn("Replay", "Difficulty of replay is '%d', "
|
||||||
"while '%d' is selected.\n",
|
"while '%d' is selected.",
|
||||||
race_manager->getDifficulty(), n);
|
race_manager->getDifficulty(), n);
|
||||||
|
|
||||||
fgets(s, 1023, fd);
|
fgets(s, 1023, fd);
|
||||||
if(sscanf(s, "track: %s",s1)!=1)
|
if(sscanf(s, "track: %s", s1) != 1)
|
||||||
{
|
Log::warn("Replay", "Track not found in replay file.");
|
||||||
fprintf(stderr,"WARNING: Track not found in replay file.\n");
|
|
||||||
}
|
|
||||||
assert(std::string(s1)==race_manager->getTrackName());
|
assert(std::string(s1)==race_manager->getTrackName());
|
||||||
race_manager->setTrack(s1);
|
race_manager->setTrack(s1);
|
||||||
|
|
||||||
unsigned int num_laps;
|
unsigned int num_laps;
|
||||||
fgets(s, 1023, fd);
|
fgets(s, 1023, fd);
|
||||||
if(sscanf(s, "Laps: %d",&num_laps)!=1)
|
if(sscanf(s, "Laps: %d", &num_laps) != 1)
|
||||||
{
|
Log::fatal("Replay", "No number of laps found in replay file.");
|
||||||
fprintf(stderr,"WARNING: No number of laps found in replay file.\n");
|
|
||||||
exit(-2);
|
|
||||||
}
|
|
||||||
race_manager->setNumLaps(num_laps);
|
race_manager->setNumLaps(num_laps);
|
||||||
|
|
||||||
// eof actually doesn't trigger here, since it requires first to try
|
// eof actually doesn't trigger here, since it requires first to try
|
||||||
@ -175,25 +156,18 @@ void ReplayPlay::readKartData(FILE *fd, char *next_line)
|
|||||||
{
|
{
|
||||||
char s[1024];
|
char s[1024];
|
||||||
if(sscanf(next_line, "model: %s", s)!=1)
|
if(sscanf(next_line, "model: %s", s)!=1)
|
||||||
{
|
Log::fatal("Replay", "No model information for kart %d found.",
|
||||||
fprintf(stderr,
|
|
||||||
"WARNING: No model information for kart %d found.\n",
|
|
||||||
m_ghost_karts.size());
|
m_ghost_karts.size());
|
||||||
exit(-2);
|
|
||||||
}
|
|
||||||
m_ghost_karts.push_back(new GhostKart(std::string(s)));
|
m_ghost_karts.push_back(new GhostKart(std::string(s)));
|
||||||
m_ghost_karts[m_ghost_karts.size()-1].init(RaceManager::KT_GHOST);
|
m_ghost_karts[m_ghost_karts.size()-1].init(RaceManager::KT_GHOST);
|
||||||
|
|
||||||
fgets(s, 1023, fd);
|
fgets(s, 1023, fd);
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
if(sscanf(s,"size: %d",&size)!=1)
|
if(sscanf(s,"size: %d",&size)!=1)
|
||||||
{
|
Log::fatal("Replay", "Number of records not found in replay file "
|
||||||
fprintf(stderr,
|
"for kart %d.",
|
||||||
"WARNING: Number of records not found in replay file "
|
|
||||||
"for kart %d.\n",
|
|
||||||
m_ghost_karts.size()-1);
|
m_ghost_karts.size()-1);
|
||||||
exit(-2);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(unsigned int i=0; i<size; i++)
|
for(unsigned int i=0; i<size; i++)
|
||||||
{
|
{
|
||||||
@ -217,20 +191,17 @@ void ReplayPlay::readKartData(FILE *fd, char *next_line)
|
|||||||
{
|
{
|
||||||
// Invalid record found
|
// Invalid record found
|
||||||
// ---------------------
|
// ---------------------
|
||||||
fprintf(stderr, "Can't read replay data line %d:\n", i);
|
Log::warn("Replay", "Can't read replay data line %d:", i);
|
||||||
fprintf(stderr, "%s", s);
|
Log::warn("Replay", "%s", s);
|
||||||
fprintf(stderr, "Ignored.\n");
|
Log::warn("Replay", "Ignored.");
|
||||||
}
|
}
|
||||||
} // for i
|
} // for i
|
||||||
fgets(s, 1023, fd);
|
fgets(s, 1023, fd);
|
||||||
unsigned int num_events;
|
unsigned int num_events;
|
||||||
if(sscanf(s,"events: %d",&num_events)!=1)
|
if(sscanf(s,"events: %d",&num_events)!=1)
|
||||||
{
|
Log::warn("Replay", "Number of events not found in replay file "
|
||||||
fprintf(stderr,
|
"for kart %d.", m_ghost_karts.size()-1);
|
||||||
"WARNING: Number of events not found in replay file "
|
|
||||||
"for kart %d.\n",
|
|
||||||
m_ghost_karts.size()-1);
|
|
||||||
}
|
|
||||||
for(unsigned int i=0; i<num_events; i++)
|
for(unsigned int i=0; i<num_events; i++)
|
||||||
{
|
{
|
||||||
fgets(s, 1023, fd);
|
fgets(s, 1023, fd);
|
||||||
@ -245,9 +216,9 @@ void ReplayPlay::readKartData(FILE *fd, char *next_line)
|
|||||||
{
|
{
|
||||||
// Invalid record found
|
// Invalid record found
|
||||||
// ---------------------
|
// ---------------------
|
||||||
fprintf(stderr, "Can't read replay event line %d:\n", i);
|
Log::warn("Replay", "Can't read replay event line %d:", i);
|
||||||
fprintf(stderr, "%s", s);
|
Log::warn("Replay", "%s", s);
|
||||||
fprintf(stderr, "Ignored.\n");
|
Log::warn("Replay", "Ignored.");
|
||||||
}
|
}
|
||||||
|
|
||||||
} // for i < events
|
} // for i < events
|
||||||
|
@ -130,8 +130,12 @@ void ReplayRecorder::update(float dt)
|
|||||||
{
|
{
|
||||||
// Only print this message once.
|
// Only print this message once.
|
||||||
if(m_count_transforms[i]==m_transform_events[i].size())
|
if(m_count_transforms[i]==m_transform_events[i].size())
|
||||||
printf("Can't store more events for kart %s.\n",
|
{
|
||||||
|
char buffer[100];
|
||||||
|
sprintf(buffer, "Can't store more events for kart %s.",
|
||||||
kart->getIdent().c_str());
|
kart->getIdent().c_str());
|
||||||
|
Log::warn("ReplayRecorder", buffer);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
TransformEvent *p = &(m_transform_events[i][m_count_transforms[i]-1]);
|
TransformEvent *p = &(m_transform_events[i][m_count_transforms[i]-1]);
|
||||||
@ -153,12 +157,12 @@ void ReplayRecorder::Save()
|
|||||||
FILE *fd = openReplayFile(/*writeable*/true);
|
FILE *fd = openReplayFile(/*writeable*/true);
|
||||||
if(!fd)
|
if(!fd)
|
||||||
{
|
{
|
||||||
printf("Can't open '%s' for writing - can't save replay data.\n",
|
Log::error("ReplayRecorder", "Can't open '%s' for writing - can't save replay data.",
|
||||||
getReplayFilename().c_str());
|
getReplayFilename().c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Replay saved in '%s'.\n", getReplayFilename().c_str());
|
Log::info("ReplayRecorder", "Replay saved in '%s'.\n", getReplayFilename().c_str());
|
||||||
|
|
||||||
World *world = World::getWorld();
|
World *world = World::getWorld();
|
||||||
unsigned int num_karts = world->getNumKarts();
|
unsigned int num_karts = world->getNumKarts();
|
||||||
|
@ -85,7 +85,7 @@ bool CreditsScreen::getWideLine(std::ifstream& file, core::stringw* out)
|
|||||||
{
|
{
|
||||||
if (!file.good())
|
if (!file.good())
|
||||||
{
|
{
|
||||||
fprintf(stderr, "getWideLine : File is not good!\n");
|
Log::error("CreditsScreen", "getWideLine: File is not good!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
wchar_t wide_char;
|
wchar_t wide_char;
|
||||||
@ -147,8 +147,8 @@ void CreditsScreen::loadedFromFile()
|
|||||||
|
|
||||||
if (file.fail() || !file.is_open() || file.eof())
|
if (file.fail() || !file.is_open() || file.eof())
|
||||||
{
|
{
|
||||||
fprintf(stderr, "\n/!\\ Failed to open file at '%s'\n\n",
|
Log::error("CreditsScreen", "Failed to open file at '%s'.",
|
||||||
creditsfile.c_str());
|
creditsfile.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,10 +160,8 @@ void CreditsScreen::loadedFromFile()
|
|||||||
|
|
||||||
if (file.fail() || !file.is_open() || file.eof())
|
if (file.fail() || !file.is_open() || file.eof())
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
Log::error("CreditsScreen", "Failed to read file at '%s', unexpected EOF.",
|
||||||
"\n/!\\ Failed to read file at '%s', unexpected EOF\n\n",
|
creditsfile.c_str());
|
||||||
creditsfile.c_str());
|
|
||||||
assert(false);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,9 +201,7 @@ void CreditsScreen::loadedFromFile()
|
|||||||
|
|
||||||
if (lineCount == 0)
|
if (lineCount == 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
Log::error("CreditsScreen", "Could not read anything from CREDITS file!");
|
||||||
"\n/!\\ Could not read anything from CREDITS file!\n\n");
|
|
||||||
assert(false);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,11 +384,10 @@ void AddonsLoading::doUninstall()
|
|||||||
error = !addons_manager->uninstall(m_addon);
|
error = !addons_manager->uninstall(m_addon);
|
||||||
if(error)
|
if(error)
|
||||||
{
|
{
|
||||||
printf("[addons]Directory '%s' can not be removed.\n",
|
Log::warn("Addons", "Directory '%s' can not be removed.",
|
||||||
m_addon.getDataDir().c_str());
|
m_addon.getDataDir().c_str());
|
||||||
printf("[addons]Please remove this directory manually.\n");
|
Log::warn("Addons", "Please remove this directory manually.");
|
||||||
core::stringw msg = StringUtils::insertValues(
|
core::stringw msg = StringUtils::insertValues(_("Problems removing the addon '%s'."),
|
||||||
_("Problems removing the addon '%s'."),
|
|
||||||
core::stringw(m_addon.getName().c_str()));
|
core::stringw(m_addon.getName().c_str()));
|
||||||
getWidget<BubbleWidget>("description")->setText(msg.c_str());
|
getWidget<BubbleWidget>("description")->setText(msg.c_str());
|
||||||
}
|
}
|
||||||
|
@ -102,29 +102,19 @@ GUIEngine::EventPropagation CustomVideoSettingsDialog::processEvent(const std::s
|
|||||||
{
|
{
|
||||||
if (eventSource == "close")
|
if (eventSource == "close")
|
||||||
{
|
{
|
||||||
bool dynamic_light = getWidget<CheckBoxWidget>("dynamiclight")->getState();
|
bool advanced_pipeline = getWidget<CheckBoxWidget>("dynamiclight")->getState();
|
||||||
UserConfigParams::m_dynamic_lights = dynamic_light;
|
UserConfigParams::m_dynamic_lights = advanced_pipeline;
|
||||||
|
|
||||||
UserConfigParams::m_graphical_effects =
|
|
||||||
getWidget<CheckBoxWidget>("anim_gfx")->getState();
|
|
||||||
UserConfigParams::m_weather_effects =
|
|
||||||
getWidget<CheckBoxWidget>("weather_gfx")->getState();
|
|
||||||
UserConfigParams::m_ubo_disabled =
|
|
||||||
!getWidget<CheckBoxWidget>("ubo")->getState();
|
|
||||||
UserConfigParams::m_dof =
|
UserConfigParams::m_dof =
|
||||||
getWidget<CheckBoxWidget>("dof")->getState();
|
advanced_pipeline && getWidget<CheckBoxWidget>("dof")->getState();
|
||||||
UserConfigParams::m_high_definition_textures =
|
|
||||||
getWidget<CheckBoxWidget>("hd-textures")->getState();
|
|
||||||
|
|
||||||
UserConfigParams::m_motionblur =
|
UserConfigParams::m_motionblur =
|
||||||
getWidget<CheckBoxWidget>("motionblur")->getState();
|
advanced_pipeline && getWidget<CheckBoxWidget>("motionblur")->getState();
|
||||||
UserConfigParams::m_show_steering_animations =
|
|
||||||
getWidget<SpinnerWidget>("steering_animations")->getValue();
|
if (advanced_pipeline)
|
||||||
|
|
||||||
if (dynamic_light)
|
|
||||||
{
|
{
|
||||||
UserConfigParams::m_shadows =
|
UserConfigParams::m_shadows =
|
||||||
getWidget<SpinnerWidget>("shadows")->getValue();
|
advanced_pipeline && getWidget<SpinnerWidget>("shadows")->getValue();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -132,26 +122,41 @@ GUIEngine::EventPropagation CustomVideoSettingsDialog::processEvent(const std::s
|
|||||||
}
|
}
|
||||||
|
|
||||||
UserConfigParams::m_mlaa =
|
UserConfigParams::m_mlaa =
|
||||||
getWidget<CheckBoxWidget>("mlaa")->getState();
|
advanced_pipeline && getWidget<CheckBoxWidget>("mlaa")->getState();
|
||||||
|
|
||||||
UserConfigParams::m_ssao =
|
UserConfigParams::m_ssao =
|
||||||
getWidget<CheckBoxWidget>("ssao")->getState();
|
advanced_pipeline && getWidget<CheckBoxWidget>("ssao")->getState();
|
||||||
|
|
||||||
UserConfigParams::m_light_shaft =
|
UserConfigParams::m_light_shaft =
|
||||||
getWidget<CheckBoxWidget>("lightshaft")->getState();
|
advanced_pipeline && getWidget<CheckBoxWidget>("lightshaft")->getState();
|
||||||
|
|
||||||
UserConfigParams::m_gi =
|
UserConfigParams::m_gi =
|
||||||
getWidget<CheckBoxWidget>("global_illumination")->getState();
|
advanced_pipeline && getWidget<CheckBoxWidget>("global_illumination")->getState();
|
||||||
|
|
||||||
UserConfigParams::m_glow =
|
UserConfigParams::m_glow =
|
||||||
getWidget<CheckBoxWidget>("glow")->getState();
|
advanced_pipeline && getWidget<CheckBoxWidget>("glow")->getState();
|
||||||
|
|
||||||
UserConfigParams::m_bloom =
|
UserConfigParams::m_bloom =
|
||||||
getWidget<CheckBoxWidget>("bloom")->getState();
|
advanced_pipeline && getWidget<CheckBoxWidget>("bloom")->getState();
|
||||||
|
|
||||||
UserConfigParams::m_texture_compression =
|
UserConfigParams::m_texture_compression =
|
||||||
getWidget<CheckBoxWidget>("texture_compression")->getState();
|
getWidget<CheckBoxWidget>("texture_compression")->getState();
|
||||||
|
|
||||||
|
UserConfigParams::m_graphical_effects =
|
||||||
|
getWidget<CheckBoxWidget>("anim_gfx")->getState();
|
||||||
|
|
||||||
|
UserConfigParams::m_weather_effects =
|
||||||
|
getWidget<CheckBoxWidget>("weather_gfx")->getState();
|
||||||
|
|
||||||
|
UserConfigParams::m_ubo_disabled =
|
||||||
|
!getWidget<CheckBoxWidget>("ubo")->getState();
|
||||||
|
|
||||||
|
UserConfigParams::m_high_definition_textures =
|
||||||
|
getWidget<CheckBoxWidget>("hd-textures")->getState();
|
||||||
|
|
||||||
|
UserConfigParams::m_show_steering_animations =
|
||||||
|
getWidget<SpinnerWidget>("steering_animations")->getValue();
|
||||||
|
|
||||||
switch (getWidget<SpinnerWidget>("filtering")->getValue())
|
switch (getWidget<SpinnerWidget>("filtering")->getValue())
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -53,8 +53,8 @@ GPInfoDialog::GPInfoDialog(const std::string& gp_ident)
|
|||||||
doInit();
|
doInit();
|
||||||
m_curr_time = 0.0f;
|
m_curr_time = 0.0f;
|
||||||
|
|
||||||
m_gp = grand_prix_manager->getGrandPrix(gp_ident);
|
m_gp = *grand_prix_manager->getGrandPrix(gp_ident);
|
||||||
m_gp->checkConsistency();
|
m_gp.checkConsistency();
|
||||||
|
|
||||||
m_under_title = m_area.getHeight()/7;
|
m_under_title = m_area.getHeight()/7;
|
||||||
m_over_body = m_area.getHeight()/7;
|
m_over_body = m_area.getHeight()/7;
|
||||||
@ -72,7 +72,7 @@ GPInfoDialog::~GPInfoDialog()
|
|||||||
{
|
{
|
||||||
GUIEngine::Screen* curr_screen = GUIEngine::getCurrentScreen();
|
GUIEngine::Screen* curr_screen = GUIEngine::getCurrentScreen();
|
||||||
if (curr_screen->getName() == "tracks.stkgui")
|
if (curr_screen->getName() == "tracks.stkgui")
|
||||||
static_cast<TracksScreen*>(curr_screen)->setFocusOnGP(m_gp->getId());
|
static_cast<TracksScreen*>(curr_screen)->setFocusOnGP(m_gp.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -81,7 +81,7 @@ void GPInfoDialog::addTitle()
|
|||||||
{
|
{
|
||||||
core::rect< s32 > area_top(0, 0, m_area.getWidth(), m_under_title);
|
core::rect< s32 > area_top(0, 0, m_area.getWidth(), m_under_title);
|
||||||
IGUIStaticText* title = GUIEngine::getGUIEnv()->addStaticText(
|
IGUIStaticText* title = GUIEngine::getGUIEnv()->addStaticText(
|
||||||
translations->fribidize(m_gp->getName()),
|
translations->fribidize(m_gp.getName()),
|
||||||
area_top, false, true, // border, word wrap
|
area_top, false, true, // border, word wrap
|
||||||
m_irrlicht_window);
|
m_irrlicht_window);
|
||||||
title->setTabStop(false);
|
title->setTabStop(false);
|
||||||
@ -92,7 +92,7 @@ void GPInfoDialog::addTitle()
|
|||||||
|
|
||||||
void GPInfoDialog::addTracks()
|
void GPInfoDialog::addTracks()
|
||||||
{
|
{
|
||||||
const std::vector<std::string> tracks = m_gp->getTrackNames();
|
const std::vector<std::string> tracks = m_gp.getTrackNames();
|
||||||
const unsigned int track_amount = tracks.size();
|
const unsigned int track_amount = tracks.size();
|
||||||
|
|
||||||
int height_of_one_line = std::min((m_lower_bound - m_over_body)/(track_amount+1),
|
int height_of_one_line = std::min((m_lower_bound - m_over_body)/(track_amount+1),
|
||||||
@ -119,7 +119,7 @@ void GPInfoDialog::addTracks()
|
|||||||
|
|
||||||
Label* widget = dynamic_cast<Label*>(m_widgets.get(widgets_iter));
|
Label* widget = dynamic_cast<Label*>(m_widgets.get(widgets_iter));
|
||||||
widget->setText(translations->fribidize(track->getName()), false);
|
widget->setText(translations->fribidize(track->getName()), false);
|
||||||
widget->move(20, m_over_body + height_of_one_line*(i+1),
|
widget->move(20, m_over_body + height_of_one_line*i,
|
||||||
m_area.getWidth()/2 - 20, height_of_one_line);
|
m_area.getWidth()/2 - 20, height_of_one_line);
|
||||||
|
|
||||||
widgets_iter++;
|
widgets_iter++;
|
||||||
@ -141,7 +141,7 @@ void GPInfoDialog::addTracks()
|
|||||||
m_widgets.push_back(widget);
|
m_widgets.push_back(widget);
|
||||||
widget->add();
|
widget->add();
|
||||||
|
|
||||||
widget->move(20, m_over_body + height_of_one_line*(i+1),
|
widget->move(20, m_over_body + height_of_one_line*i,
|
||||||
m_area.getWidth()/2 - 20, height_of_one_line);
|
m_area.getWidth()/2 - 20, height_of_one_line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -185,7 +185,7 @@ void GPInfoDialog::addScreenshot()
|
|||||||
m_screenshot_widget->m_h = m_area.getWidth()*3/8; // *(3/4)*(1/2)
|
m_screenshot_widget->m_h = m_area.getWidth()*3/8; // *(3/4)*(1/2)
|
||||||
}
|
}
|
||||||
|
|
||||||
Track* track = track_manager->getTrack(m_gp->getTrackNames()[0]);
|
Track* track = track_manager->getTrack(m_gp.getTrackNames()[0]);
|
||||||
m_screenshot_widget->m_properties[GUIEngine::PROP_ICON] = (track->getScreenshotFile().c_str());
|
m_screenshot_widget->m_properties[GUIEngine::PROP_ICON] = (track->getScreenshotFile().c_str());
|
||||||
m_screenshot_widget->setParent(m_irrlicht_window);
|
m_screenshot_widget->setParent(m_irrlicht_window);
|
||||||
m_screenshot_widget->add();
|
m_screenshot_widget->add();
|
||||||
@ -203,7 +203,7 @@ void GPInfoDialog::addButtons()
|
|||||||
SavedGrandPrix* saved_gp = SavedGrandPrix::getSavedGP( StateManager::get()
|
SavedGrandPrix* saved_gp = SavedGrandPrix::getSavedGP( StateManager::get()
|
||||||
->getActivePlayerProfile(0)
|
->getActivePlayerProfile(0)
|
||||||
->getUniqueID(),
|
->getUniqueID(),
|
||||||
m_gp->getId(),
|
m_gp.getId(),
|
||||||
race_manager->getDifficulty(),
|
race_manager->getDifficulty(),
|
||||||
race_manager->getNumberOfKarts(),
|
race_manager->getNumberOfKarts(),
|
||||||
race_manager->getNumLocalPlayers());
|
race_manager->getNumLocalPlayers());
|
||||||
@ -250,7 +250,7 @@ void GPInfoDialog::addButtons()
|
|||||||
void GPInfoDialog::onEnterPressedInternal()
|
void GPInfoDialog::onEnterPressedInternal()
|
||||||
{
|
{
|
||||||
// Save the GP id because dismiss() will destroy this instance
|
// Save the GP id because dismiss() will destroy this instance
|
||||||
std::string gp_id = m_gp->getId();
|
std::string gp_id = m_gp.getId();
|
||||||
ModalDialog::dismiss();
|
ModalDialog::dismiss();
|
||||||
// Disable accidentally unlocking of a challenge
|
// Disable accidentally unlocking of a challenge
|
||||||
PlayerManager::getCurrentPlayer()->setCurrentChallenge("");
|
PlayerManager::getCurrentPlayer()->setCurrentChallenge("");
|
||||||
@ -264,7 +264,7 @@ GUIEngine::EventPropagation GPInfoDialog::processEvent(const std::string& event_
|
|||||||
if (event_source == "start" || event_source == "continue")
|
if (event_source == "start" || event_source == "continue")
|
||||||
{
|
{
|
||||||
// Save GP identifier, since dismiss will delete this object.
|
// Save GP identifier, since dismiss will delete this object.
|
||||||
std::string gp_id = m_gp->getId();
|
std::string gp_id = m_gp.getId();
|
||||||
// Also create a copy of the string: it is a reference to data
|
// Also create a copy of the string: it is a reference to data
|
||||||
// in a widget in the dialog - so if we call dismiss, this reference
|
// in a widget in the dialog - so if we call dismiss, this reference
|
||||||
// becomes invalid!
|
// becomes invalid!
|
||||||
@ -288,7 +288,7 @@ void GPInfoDialog::onUpdate(float dt)
|
|||||||
m_curr_time += dt;
|
m_curr_time += dt;
|
||||||
int frameAfter = (int)(m_curr_time / 1.5f);
|
int frameAfter = (int)(m_curr_time / 1.5f);
|
||||||
|
|
||||||
const std::vector<std::string> tracks = m_gp->getTrackNames();
|
const std::vector<std::string> tracks = m_gp.getTrackNames();
|
||||||
if (frameAfter >= (int)tracks.size())
|
if (frameAfter >= (int)tracks.size())
|
||||||
{
|
{
|
||||||
frameAfter = 0;
|
frameAfter = 0;
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#define HEADER_GP_INFO_DIALOG_HPP
|
#define HEADER_GP_INFO_DIALOG_HPP
|
||||||
|
|
||||||
#include "guiengine/modaldialog.hpp"
|
#include "guiengine/modaldialog.hpp"
|
||||||
// Don't include grand_prix_data.hpp here or the compilation will fail
|
#include "race/grand_prix_data.hpp"
|
||||||
|
|
||||||
|
|
||||||
class GrandPrixData;
|
class GrandPrixData;
|
||||||
@ -39,7 +39,9 @@ class GPInfoDialog : public GUIEngine::ModalDialog
|
|||||||
protected: // Necessary for RandomGPInfoDialog
|
protected: // Necessary for RandomGPInfoDialog
|
||||||
GUIEngine::IconButtonWidget* m_screenshot_widget;
|
GUIEngine::IconButtonWidget* m_screenshot_widget;
|
||||||
float m_curr_time;
|
float m_curr_time;
|
||||||
GrandPrixData* m_gp;
|
|
||||||
|
/** The grand prix data. */
|
||||||
|
GrandPrixData m_gp;
|
||||||
|
|
||||||
/** height of the separator over the body */
|
/** height of the separator over the body */
|
||||||
int m_over_body;
|
int m_over_body;
|
||||||
|
@ -33,11 +33,12 @@ using irr::gui::IGUIStaticText;
|
|||||||
typedef GUIEngine::SpinnerWidget Spinner;
|
typedef GUIEngine::SpinnerWidget Spinner;
|
||||||
|
|
||||||
RandomGPInfoDialog::RandomGPInfoDialog()
|
RandomGPInfoDialog::RandomGPInfoDialog()
|
||||||
|
|
||||||
{
|
{
|
||||||
// Defaults - loading selection from last time frrom a file would be better
|
// Defaults - loading selection from last time frrom a file would be better
|
||||||
m_number_of_tracks = 2; // We can assume that there are at least 2 standard tracks
|
m_number_of_tracks = 2; // We can assume that there are at least 2 standard tracks
|
||||||
m_trackgroup = "standard";
|
m_trackgroup = "standard";
|
||||||
m_use_reverse = NO_REVERSE;
|
m_use_reverse = GrandPrixData::GP_NO_REVERSE;
|
||||||
|
|
||||||
doInit();
|
doInit();
|
||||||
m_curr_time = 0.0f;
|
m_curr_time = 0.0f;
|
||||||
@ -46,14 +47,7 @@ RandomGPInfoDialog::RandomGPInfoDialog()
|
|||||||
m_over_body = m_area.getHeight()/7 + SPINNER_HEIGHT + 10; // 10px space
|
m_over_body = m_area.getHeight()/7 + SPINNER_HEIGHT + 10; // 10px space
|
||||||
m_lower_bound = m_area.getHeight()*6/7;
|
m_lower_bound = m_area.getHeight()*6/7;
|
||||||
|
|
||||||
// The GP manager is be used to make the GP live longer than this dialog
|
m_gp.createRandomGP(m_number_of_tracks, m_trackgroup, m_use_reverse);
|
||||||
if (grand_prix_manager->m_random_gp)
|
|
||||||
{
|
|
||||||
delete grand_prix_manager->m_random_gp;
|
|
||||||
grand_prix_manager->m_random_gp = NULL;
|
|
||||||
}
|
|
||||||
m_gp = new GrandPrixData(m_number_of_tracks, m_trackgroup, m_use_reverse);
|
|
||||||
grand_prix_manager->m_random_gp = m_gp;
|
|
||||||
|
|
||||||
addTitle();
|
addTitle();
|
||||||
addSpinners();
|
addSpinners();
|
||||||
@ -67,8 +61,18 @@ RandomGPInfoDialog::RandomGPInfoDialog()
|
|||||||
|
|
||||||
void RandomGPInfoDialog::addSpinners()
|
void RandomGPInfoDialog::addSpinners()
|
||||||
{
|
{
|
||||||
const int trackgroup_width = 200, laps_with = 150, reverse_width = 200;
|
const int laps_width = 150;
|
||||||
const int left = (m_area.getWidth() - trackgroup_width - 150 - 250)/2;
|
// "20*4" because there a 4 separators between the spinners with 20px each
|
||||||
|
int label_spinner_width = m_area.getWidth() - laps_width - 20*4;
|
||||||
|
// This scaling ensures that the spinners are smaller than the available
|
||||||
|
// area, look well and are (hopefully) big enough for their labels
|
||||||
|
if (m_area.getWidth() < 700)
|
||||||
|
label_spinner_width /= 2;
|
||||||
|
else if (m_area.getWidth() < 1500)
|
||||||
|
label_spinner_width /= 3;
|
||||||
|
else
|
||||||
|
label_spinner_width /= 4;
|
||||||
|
const int left = (m_area.getWidth() - label_spinner_width*2 - laps_width)/2;
|
||||||
|
|
||||||
// Trackgroup chooser
|
// Trackgroup chooser
|
||||||
Spinner* spinner = new Spinner(false);
|
Spinner* spinner = new Spinner(false);
|
||||||
@ -77,7 +81,7 @@ void RandomGPInfoDialog::addSpinners()
|
|||||||
spinner->setParent(m_irrlicht_window);
|
spinner->setParent(m_irrlicht_window);
|
||||||
m_widgets.push_back(spinner);
|
m_widgets.push_back(spinner);
|
||||||
spinner->add();
|
spinner->add();
|
||||||
spinner->move(left, m_under_title, trackgroup_width, SPINNER_HEIGHT);
|
spinner->move(left, m_under_title, label_spinner_width, SPINNER_HEIGHT);
|
||||||
// Fill it with all the track group names
|
// Fill it with all the track group names
|
||||||
spinner->addLabel("all");
|
spinner->addLabel("all");
|
||||||
int index_standard;
|
int index_standard;
|
||||||
@ -106,7 +110,7 @@ void RandomGPInfoDialog::addSpinners()
|
|||||||
spinner->m_properties[GUIEngine::PROP_WRAP_AROUND] = "true";
|
spinner->m_properties[GUIEngine::PROP_WRAP_AROUND] = "true";
|
||||||
m_widgets.push_back(spinner);
|
m_widgets.push_back(spinner);
|
||||||
spinner->add();
|
spinner->add();
|
||||||
spinner->move(left + trackgroup_width + 10, m_under_title, laps_with, SPINNER_HEIGHT);
|
spinner->move(left + label_spinner_width + 20/2, m_under_title, laps_width, SPINNER_HEIGHT);
|
||||||
|
|
||||||
// reverse choose
|
// reverse choose
|
||||||
spinner = new Spinner(false);
|
spinner = new Spinner(false);
|
||||||
@ -115,7 +119,7 @@ void RandomGPInfoDialog::addSpinners()
|
|||||||
spinner->m_properties[GUIEngine::PROP_WRAP_AROUND] = "true";
|
spinner->m_properties[GUIEngine::PROP_WRAP_AROUND] = "true";
|
||||||
m_widgets.push_back(spinner);
|
m_widgets.push_back(spinner);
|
||||||
spinner->add();
|
spinner->add();
|
||||||
spinner->move(left + trackgroup_width + laps_with + 10, m_under_title, reverse_width, SPINNER_HEIGHT);
|
spinner->move(left + label_spinner_width + laps_width + 20/2, m_under_title, label_spinner_width, SPINNER_HEIGHT);
|
||||||
spinner->addLabel("no reverse");
|
spinner->addLabel("no reverse");
|
||||||
spinner->addLabel("all reverse");
|
spinner->addLabel("all reverse");
|
||||||
spinner->addLabel("mixed");
|
spinner->addLabel("mixed");
|
||||||
@ -141,15 +145,17 @@ GUIEngine::EventPropagation RandomGPInfoDialog::processEvent(
|
|||||||
{
|
{
|
||||||
if (eventSource == "start")
|
if (eventSource == "start")
|
||||||
{
|
{
|
||||||
|
// Save GP data, since dismiss will delete this object.
|
||||||
|
GrandPrixData gp = m_gp;
|
||||||
ModalDialog::dismiss();
|
ModalDialog::dismiss();
|
||||||
race_manager->startGP(grand_prix_manager->m_random_gp, false, false);
|
race_manager->startGP(&gp, false, false);
|
||||||
return GUIEngine::EVENT_BLOCK;
|
return GUIEngine::EVENT_BLOCK;
|
||||||
}
|
}
|
||||||
else if (eventSource == "Number of tracks")
|
else if (eventSource == "Number of tracks")
|
||||||
{
|
{
|
||||||
// The old gp can be reused because there's only track deletion/adding
|
// The old gp can be reused because there's only track deletion/adding
|
||||||
m_number_of_tracks = getWidget<Spinner>("Number of tracks")->getValue();
|
m_number_of_tracks = getWidget<Spinner>("Number of tracks")->getValue();
|
||||||
m_gp->changeTrackNumber(m_number_of_tracks, m_trackgroup);
|
m_gp.changeTrackNumber(m_number_of_tracks, m_trackgroup);
|
||||||
addTracks();
|
addTracks();
|
||||||
}
|
}
|
||||||
else if (eventSource == "Trackgroup")
|
else if (eventSource == "Trackgroup")
|
||||||
@ -171,22 +177,22 @@ GUIEngine::EventPropagation RandomGPInfoDialog::processEvent(
|
|||||||
if (s->getValue() > (signed)max)
|
if (s->getValue() > (signed)max)
|
||||||
s->setValue(max);
|
s->setValue(max);
|
||||||
|
|
||||||
delete m_gp;
|
// Create a new (i.e. with new tracks) random gp, since the old
|
||||||
m_gp = new GrandPrixData(m_number_of_tracks, m_trackgroup, m_use_reverse);
|
// tracks might not all belong to the newly selected group.
|
||||||
grand_prix_manager->m_random_gp = m_gp;
|
m_gp.createRandomGP(m_number_of_tracks, m_trackgroup, m_use_reverse,
|
||||||
|
/*new_tracks*/true);
|
||||||
addTracks();
|
addTracks();
|
||||||
}
|
}
|
||||||
else if (eventSource == "reverse")
|
else if (eventSource == "reverse")
|
||||||
{
|
{
|
||||||
Spinner* r = getWidget<Spinner>("reverse");
|
Spinner* r = getWidget<Spinner>("reverse");
|
||||||
m_use_reverse = static_cast<REVERSED>(r->getValue());
|
m_use_reverse = static_cast<GrandPrixData::GPReverseType>(r->getValue());
|
||||||
m_gp->changeReverse(m_use_reverse);
|
m_gp.changeReverse(m_use_reverse);
|
||||||
}
|
}
|
||||||
else if (eventSource == "reload")
|
else if (eventSource == "reload")
|
||||||
{
|
{
|
||||||
delete m_gp;
|
m_gp.createRandomGP(m_number_of_tracks, m_trackgroup, m_use_reverse,
|
||||||
m_gp = new GrandPrixData(m_number_of_tracks, m_trackgroup, m_use_reverse);
|
/*new_tracks*/true);
|
||||||
grand_prix_manager->m_random_gp = m_gp;
|
|
||||||
addTracks();
|
addTracks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,17 +24,15 @@
|
|||||||
|
|
||||||
class RandomGPInfoDialog : public GPInfoDialog
|
class RandomGPInfoDialog : public GPInfoDialog
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
enum REVERSED
|
|
||||||
{
|
|
||||||
NO_REVERSE = 0,
|
|
||||||
ALL_REVERSE = 1,
|
|
||||||
MIXED = 2
|
|
||||||
};
|
|
||||||
private:
|
private:
|
||||||
|
/** How many tracks to pick. */
|
||||||
unsigned int m_number_of_tracks;
|
unsigned int m_number_of_tracks;
|
||||||
|
|
||||||
|
/** Name of the track group from which to pick tracks. */
|
||||||
std::string m_trackgroup;
|
std::string m_trackgroup;
|
||||||
REVERSED m_use_reverse;
|
|
||||||
|
/** How reverse settings should be determined. */
|
||||||
|
GrandPrixData::GPReverseType m_use_reverse;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const int SPINNER_HEIGHT = 40;
|
static const int SPINNER_HEIGHT = 40;
|
||||||
|
@ -252,9 +252,9 @@ void GrandPrixLose::setKarts(std::vector<std::string> ident_arg)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[GrandPrixLose] WARNING: could not find a kart named '%s'\n", ident_arg[n].c_str());
|
Log::warn("GrandPrixLose", "Could not find a kart named '%s'.", ident_arg[n].c_str());
|
||||||
m_kart_node[n] = NULL;
|
m_kart_node[n] = NULL;
|
||||||
}// if kart !=NULL
|
} // if kart != NULL
|
||||||
}
|
}
|
||||||
} // setKarts
|
} // setKarts
|
||||||
|
|
||||||
|
@ -71,8 +71,8 @@ void HelpScreen1::eventCallback(Widget* widget, const std::string& name, const i
|
|||||||
|
|
||||||
if (kart_properties_manager->getKart(UserConfigParams::m_default_kart) == NULL)
|
if (kart_properties_manager->getKart(UserConfigParams::m_default_kart) == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[MainMenuScreen] WARNING: cannot find kart '%s', will revert to default\n",
|
Log::warn("HelpScreen1", "Cannot find kart '%s', will revert to default",
|
||||||
UserConfigParams::m_default_kart.c_str());
|
UserConfigParams::m_default_kart.c_str());
|
||||||
UserConfigParams::m_default_kart.revertToDefaults();
|
UserConfigParams::m_default_kart.revertToDefaults();
|
||||||
}
|
}
|
||||||
race_manager->setLocalKartInfo(0, UserConfigParams::m_default_kart);
|
race_manager->setLocalKartInfo(0, UserConfigParams::m_default_kart);
|
||||||
@ -89,13 +89,19 @@ void HelpScreen1::eventCallback(Widget* widget, const std::string& name, const i
|
|||||||
}
|
}
|
||||||
else if (name == "category")
|
else if (name == "category")
|
||||||
{
|
{
|
||||||
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
|
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||||
|
|
||||||
//if (selection == "page1") StateManager::get()->replaceTopMostScreen(Help1Screen::getInstance());
|
Screen *screen = NULL;
|
||||||
//else
|
//if (selection == "page1")
|
||||||
if (selection == "page2") StateManager::get()->replaceTopMostScreen(HelpScreen2::getInstance());
|
// screen = HelpScreen1::getInstance();
|
||||||
else if (selection == "page3") StateManager::get()->replaceTopMostScreen(HelpScreen3::getInstance());
|
if (selection == "page2")
|
||||||
else if (selection == "page4") StateManager::get()->replaceTopMostScreen(HelpScreen4::getInstance());
|
screen = HelpScreen2::getInstance();
|
||||||
|
else if (selection == "page3")
|
||||||
|
screen = HelpScreen3::getInstance();
|
||||||
|
else if (selection == "page4")
|
||||||
|
screen = HelpScreen4::getInstance();
|
||||||
|
if(screen)
|
||||||
|
StateManager::get()->replaceTopMostScreen(screen);
|
||||||
}
|
}
|
||||||
else if (name == "back")
|
else if (name == "back")
|
||||||
{
|
{
|
||||||
|
@ -46,12 +46,19 @@ void HelpScreen2::eventCallback(Widget* widget, const std::string& name, const i
|
|||||||
{
|
{
|
||||||
if (name == "category")
|
if (name == "category")
|
||||||
{
|
{
|
||||||
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
|
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||||
|
|
||||||
if(selection == "page1") StateManager::get()->replaceTopMostScreen(HelpScreen1::getInstance());
|
Screen *screen = NULL;
|
||||||
//else if(selection == "page2") StateManager::get()->replaceTopMostScreen(HelpScreen2::getInstance());
|
if (selection == "page1")
|
||||||
else if(selection == "page3") StateManager::get()->replaceTopMostScreen(HelpScreen3::getInstance());
|
screen = HelpScreen1::getInstance();
|
||||||
else if(selection == "page4") StateManager::get()->replaceTopMostScreen(HelpScreen4::getInstance());
|
//else if (selection == "page2")
|
||||||
|
// screen = HelpScreen2::getInstance();
|
||||||
|
else if (selection == "page3")
|
||||||
|
screen = HelpScreen3::getInstance();
|
||||||
|
else if (selection == "page4")
|
||||||
|
screen = HelpScreen4::getInstance();
|
||||||
|
if(screen)
|
||||||
|
StateManager::get()->replaceTopMostScreen(screen);
|
||||||
}
|
}
|
||||||
else if (name == "back")
|
else if (name == "back")
|
||||||
{
|
{
|
||||||
|
@ -47,12 +47,20 @@ void HelpScreen3::eventCallback(Widget* widget, const std::string& name, const i
|
|||||||
{
|
{
|
||||||
if (name == "category")
|
if (name == "category")
|
||||||
{
|
{
|
||||||
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
|
|
||||||
|
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||||
|
|
||||||
if (selection == "page1") StateManager::get()->replaceTopMostScreen(HelpScreen1::getInstance());
|
Screen *screen = NULL;
|
||||||
else if (selection == "page2") StateManager::get()->replaceTopMostScreen(HelpScreen2::getInstance());
|
if (selection == "page1")
|
||||||
//else if(selection == "page3") StateManager::get()->replaceTopMostScreen(Help3Screen::getInstance());
|
screen = HelpScreen1::getInstance();
|
||||||
else if(selection == "page4") StateManager::get()->replaceTopMostScreen(HelpScreen4::getInstance());
|
else if (selection == "page2")
|
||||||
|
screen = HelpScreen2::getInstance();
|
||||||
|
//else if (selection == "page3")
|
||||||
|
// screen = HelpScreen3::getInstance();
|
||||||
|
else if (selection == "page4")
|
||||||
|
screen = HelpScreen4::getInstance();
|
||||||
|
if(screen)
|
||||||
|
StateManager::get()->replaceTopMostScreen(screen);
|
||||||
}
|
}
|
||||||
else if (name == "back")
|
else if (name == "back")
|
||||||
{
|
{
|
||||||
|
@ -47,11 +47,20 @@ void HelpScreen4::eventCallback(Widget* widget, const std::string& name, const i
|
|||||||
{
|
{
|
||||||
if (name == "category")
|
if (name == "category")
|
||||||
{
|
{
|
||||||
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
|
|
||||||
|
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||||
|
|
||||||
if (selection == "page1") StateManager::get()->replaceTopMostScreen(HelpScreen1::getInstance());
|
Screen *screen = NULL;
|
||||||
else if (selection == "page2") StateManager::get()->replaceTopMostScreen(HelpScreen2::getInstance());
|
if (selection == "page1")
|
||||||
else if(selection == "page3") StateManager::get()->replaceTopMostScreen(HelpScreen3::getInstance());
|
screen = HelpScreen1::getInstance();
|
||||||
|
else if (selection == "page2")
|
||||||
|
screen = HelpScreen2::getInstance();
|
||||||
|
else if (selection == "page3")
|
||||||
|
screen = HelpScreen3::getInstance();
|
||||||
|
//else if (selection == "page4")
|
||||||
|
// screen = HelpScreen4::getInstance();
|
||||||
|
if(screen)
|
||||||
|
StateManager::get()->replaceTopMostScreen(screen);
|
||||||
}
|
}
|
||||||
else if (name == "back")
|
else if (name == "back")
|
||||||
{
|
{
|
||||||
|
@ -339,13 +339,9 @@ PlayerKartWidget::PlayerKartWidget(KartSelectionScreen* parent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!props)
|
if(!props)
|
||||||
{
|
Log::fatal("KartSelectionScreen", "Can't find default "
|
||||||
fprintf(stderr,
|
"kart '%s' nor any other kart.",
|
||||||
"[KartSelectionScreen] WARNING: Can't find default "
|
default_kart.c_str());
|
||||||
"kart '%s' nor any other kart.\n",
|
|
||||||
default_kart.c_str());
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
m_kartInternalName = props->getIdent();
|
m_kartInternalName = props->getIdent();
|
||||||
|
|
||||||
@ -431,14 +427,12 @@ void PlayerKartWidget::setPlayerID(const int newPlayerID)
|
|||||||
if (StateManager::get()->getActivePlayer(newPlayerID)
|
if (StateManager::get()->getActivePlayer(newPlayerID)
|
||||||
!= m_associated_player)
|
!= m_associated_player)
|
||||||
{
|
{
|
||||||
Log::warn("[KartSelectionScreen]", "Internal "
|
Log::error("KartSelectionScreen", "Internal "
|
||||||
"inconsistency, PlayerKartWidget has IDs and "
|
"inconsistency, PlayerKartWidget has IDs and "
|
||||||
"pointers that do not correspond to one player");
|
"pointers that do not correspond to one player");
|
||||||
fprintf(stderr,
|
Log::fatal("KartSelectionScreen", " Player: %p - Index: %d - m_associated_player: %p",
|
||||||
" Player: %p - Index: %d - m_associated_player: %p\n",
|
StateManager::get()->getActivePlayer(newPlayerID),
|
||||||
StateManager::get()->getActivePlayer(newPlayerID),
|
newPlayerID, m_associated_player);
|
||||||
newPlayerID, m_associated_player);
|
|
||||||
assert(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove current focus, but remember it
|
// Remove current focus, but remember it
|
||||||
@ -1658,11 +1652,9 @@ void KartSelectionScreen::updateKartWidgetModel(uint8_t widget_id,
|
|||||||
->setText( selectionText.c_str(), false );
|
->setText( selectionText.c_str(), false );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
Log::warn("KartSelectionScreen", "could not "
|
||||||
fprintf(stderr, "[KartSelectionScreen] WARNING: could not "
|
"find a kart named '%s'",
|
||||||
"find a kart named '%s'\n",
|
selection.c_str());
|
||||||
selection.c_str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -380,8 +380,8 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
|
|||||||
|
|
||||||
if (kart_properties_manager->getKart(UserConfigParams::m_default_kart) == NULL)
|
if (kart_properties_manager->getKart(UserConfigParams::m_default_kart) == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[MainMenuScreen] WARNING: cannot find kart '%s', will revert to default\n",
|
Log::warn("MainMenuScreen", "Cannot find kart '%s', will revert to default",
|
||||||
UserConfigParams::m_default_kart.c_str());
|
UserConfigParams::m_default_kart.c_str());
|
||||||
UserConfigParams::m_default_kart.revertToDefaults();
|
UserConfigParams::m_default_kart.revertToDefaults();
|
||||||
}
|
}
|
||||||
race_manager->setLocalKartInfo(0, UserConfigParams::m_default_kart);
|
race_manager->setLocalKartInfo(0, UserConfigParams::m_default_kart);
|
||||||
|
@ -103,13 +103,21 @@ void OptionsScreenAudio::eventCallback(Widget* widget, const std::string& name,
|
|||||||
{
|
{
|
||||||
if (name == "options_choice")
|
if (name == "options_choice")
|
||||||
{
|
{
|
||||||
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
|
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||||
|
|
||||||
if (selection == "tab_audio") StateManager::get()->replaceTopMostScreen(OptionsScreenAudio::getInstance());
|
Screen *screen = NULL;
|
||||||
else if (selection == "tab_video") StateManager::get()->replaceTopMostScreen(OptionsScreenVideo::getInstance());
|
//if (selection == "tab_audio")
|
||||||
else if (selection == "tab_players") StateManager::get()->replaceTopMostScreen(TabbedUserScreen::getInstance());
|
// screen = OptionsScreenAudio::getInstance();
|
||||||
else if (selection == "tab_controls") StateManager::get()->replaceTopMostScreen(OptionsScreenInput::getInstance());
|
if (selection == "tab_video")
|
||||||
else if (selection == "tab_ui") StateManager::get()->replaceTopMostScreen(OptionsScreenUI::getInstance());
|
screen = OptionsScreenVideo::getInstance();
|
||||||
|
else if (selection == "tab_players")
|
||||||
|
screen = TabbedUserScreen::getInstance();
|
||||||
|
else if (selection == "tab_controls")
|
||||||
|
screen = OptionsScreenInput::getInstance();
|
||||||
|
else if (selection == "tab_ui")
|
||||||
|
screen = OptionsScreenUI::getInstance();
|
||||||
|
if(screen)
|
||||||
|
StateManager::get()->replaceTopMostScreen(screen);
|
||||||
}
|
}
|
||||||
else if(name == "back")
|
else if(name == "back")
|
||||||
{
|
{
|
||||||
|
@ -154,6 +154,15 @@ void OptionsScreenInput::init()
|
|||||||
const std::string name2("devices");
|
const std::string name2("devices");
|
||||||
eventCallback(devices, name2, PLAYER_ID_GAME_MASTER);
|
eventCallback(devices, name2, PLAYER_ID_GAME_MASTER);
|
||||||
*/
|
*/
|
||||||
|
// Disable adding keyboard configurations
|
||||||
|
if (StateManager::get()->getGameState() == GUIEngine::INGAME_MENU)
|
||||||
|
{
|
||||||
|
getWidget<ButtonWidget>("add_device")->setDeactivated();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
getWidget<ButtonWidget>("add_device")->setActivated();
|
||||||
|
}
|
||||||
} // init
|
} // init
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@ -184,13 +193,21 @@ void OptionsScreenInput::eventCallback(Widget* widget, const std::string& name,
|
|||||||
|
|
||||||
if (name == "options_choice")
|
if (name == "options_choice")
|
||||||
{
|
{
|
||||||
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
|
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||||
|
|
||||||
if (selection == "tab_audio") StateManager::get()->replaceTopMostScreen(OptionsScreenAudio::getInstance());
|
Screen *screen = NULL;
|
||||||
else if (selection == "tab_video") StateManager::get()->replaceTopMostScreen(OptionsScreenVideo::getInstance());
|
if (selection == "tab_audio")
|
||||||
else if (selection == "tab_players") StateManager::get()->replaceTopMostScreen(TabbedUserScreen::getInstance());
|
screen = OptionsScreenAudio::getInstance();
|
||||||
else if (selection == "tab_controls") StateManager::get()->replaceTopMostScreen(OptionsScreenInput::getInstance());
|
else if (selection == "tab_video")
|
||||||
else if (selection == "tab_ui") StateManager::get()->replaceTopMostScreen(OptionsScreenUI::getInstance());
|
screen = OptionsScreenVideo::getInstance();
|
||||||
|
else if (selection == "tab_players")
|
||||||
|
screen = TabbedUserScreen::getInstance();
|
||||||
|
//else if (selection == "tab_controls")
|
||||||
|
// screen = OptionsScreenInput::getInstance();
|
||||||
|
else if (selection == "tab_ui")
|
||||||
|
screen = OptionsScreenUI::getInstance();
|
||||||
|
if(screen)
|
||||||
|
StateManager::get()->replaceTopMostScreen(screen);
|
||||||
}
|
}
|
||||||
else if (name == "add_device")
|
else if (name == "add_device")
|
||||||
{
|
{
|
||||||
|
@ -61,6 +61,19 @@ void OptionsScreenInput2::loadedFromFile()
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void OptionsScreenInput2::beforeAddingWidget()
|
||||||
|
{
|
||||||
|
GUIEngine::ListWidget* w_list =
|
||||||
|
getWidget<GUIEngine::ListWidget>("actions");
|
||||||
|
assert(w_list != NULL);
|
||||||
|
w_list->clearColumns();
|
||||||
|
w_list->addColumn(_("Action"), 1);
|
||||||
|
w_list->addColumn(_("Key binding"), 1);
|
||||||
|
w_list->setSortable(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
void OptionsScreenInput2::init()
|
void OptionsScreenInput2::init()
|
||||||
{
|
{
|
||||||
Screen::init();
|
Screen::init();
|
||||||
@ -127,43 +140,72 @@ void OptionsScreenInput2::init()
|
|||||||
// their actualy contents will be adapted as needed after
|
// their actualy contents will be adapted as needed after
|
||||||
|
|
||||||
//I18N: Key binding section
|
//I18N: Key binding section
|
||||||
actions->addItem("game_keys_section", _("Game Keys") );
|
addListItemSubheader(actions, "game_keys_section", _("Game Keys"));
|
||||||
actions->addItem(KartActionStrings[PA_STEER_LEFT], L"" );
|
addListItem(actions, PA_STEER_LEFT);
|
||||||
actions->addItem(KartActionStrings[PA_STEER_RIGHT], L"" );
|
addListItem(actions, PA_STEER_RIGHT);
|
||||||
actions->addItem(KartActionStrings[PA_ACCEL], L"" );
|
addListItem(actions, PA_ACCEL);
|
||||||
actions->addItem(KartActionStrings[PA_BRAKE], L"" );
|
addListItem(actions, PA_BRAKE);
|
||||||
actions->addItem(KartActionStrings[PA_FIRE], L"" );
|
addListItem(actions, PA_FIRE);
|
||||||
actions->addItem(KartActionStrings[PA_NITRO], L"" );
|
addListItem(actions, PA_NITRO);
|
||||||
actions->addItem(KartActionStrings[PA_DRIFT], L"" );
|
addListItem(actions, PA_DRIFT);
|
||||||
actions->addItem(KartActionStrings[PA_LOOK_BACK], L"" );
|
addListItem(actions, PA_LOOK_BACK);
|
||||||
actions->addItem(KartActionStrings[PA_RESCUE], L"" );
|
addListItem(actions, PA_RESCUE);
|
||||||
actions->addItem(KartActionStrings[PA_PAUSE_RACE], L"" );
|
addListItem(actions, PA_PAUSE_RACE);
|
||||||
|
|
||||||
|
|
||||||
//I18N: Key binding section
|
//I18N: Key binding section
|
||||||
actions->addItem("menu_keys_section", _("Menu Keys") );
|
addListItemSubheader(actions, "menu_keys_section", _("Menu Keys"));
|
||||||
actions->addItem(KartActionStrings[PA_MENU_UP], L"" );
|
addListItem(actions, PA_MENU_UP);
|
||||||
actions->addItem(KartActionStrings[PA_MENU_DOWN], L"" );
|
addListItem(actions, PA_MENU_DOWN);
|
||||||
actions->addItem(KartActionStrings[PA_MENU_LEFT], L"" );
|
addListItem(actions, PA_MENU_LEFT);
|
||||||
actions->addItem(KartActionStrings[PA_MENU_RIGHT], L"" );
|
addListItem(actions, PA_MENU_RIGHT);
|
||||||
actions->addItem(KartActionStrings[PA_MENU_SELECT], L"");
|
addListItem(actions, PA_MENU_SELECT);
|
||||||
actions->addItem(KartActionStrings[PA_MENU_CANCEL], L"" );
|
addListItem(actions, PA_MENU_CANCEL);
|
||||||
|
|
||||||
updateInputButtons();
|
updateInputButtons();
|
||||||
|
|
||||||
|
// Disable deletion keyboard configurations
|
||||||
|
if (StateManager::get()->getGameState() == GUIEngine::INGAME_MENU)
|
||||||
|
{
|
||||||
|
getWidget<ButtonWidget>("delete")->setDeactivated();
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
getWidget<ButtonWidget>("delete")->setActivated();
|
||||||
|
}
|
||||||
} // init
|
} // init
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
irr::core::stringw OptionsScreenInput2::makeLabel(
|
void OptionsScreenInput2::addListItemSubheader(GUIEngine::ListWidget* actions,
|
||||||
|
const char* id,
|
||||||
|
const core::stringw& text)
|
||||||
|
{
|
||||||
|
std::vector<GUIEngine::ListWidget::ListCell> row;
|
||||||
|
row.push_back(GUIEngine::ListWidget::ListCell(text, -1, 1, false));
|
||||||
|
row.push_back(GUIEngine::ListWidget::ListCell(L"", -1, 1, false));
|
||||||
|
actions->addItem(id, row);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void OptionsScreenInput2::addListItem(GUIEngine::ListWidget* actions, PlayerAction pa)
|
||||||
|
{
|
||||||
|
std::vector<GUIEngine::ListWidget::ListCell> row;
|
||||||
|
row.push_back(GUIEngine::ListWidget::ListCell(core::stringw(KartActionStrings[pa].c_str()), -1, 1, false));
|
||||||
|
row.push_back(GUIEngine::ListWidget::ListCell(L"", -1, 1, false));
|
||||||
|
actions->addItem(KartActionStrings[pa], row);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void OptionsScreenInput2::renameRow(GUIEngine::ListWidget* actions,
|
||||||
|
int idRow,
|
||||||
const irr::core::stringw &translatedName,
|
const irr::core::stringw &translatedName,
|
||||||
PlayerAction action) const
|
PlayerAction action) const
|
||||||
{
|
{
|
||||||
//hack: one tab character is supported by out font object, it moves the
|
actions->renameCell(idRow, 0, core::stringw(" ") + translatedName);
|
||||||
// cursor to the middle of the area
|
actions->renameCell(idRow, 1, m_config->getBindingAsString(action));
|
||||||
core::stringw out = irr::core::stringw(" ") + translatedName + L"\t";
|
|
||||||
|
|
||||||
out += m_config->getBindingAsString(action);
|
|
||||||
return out;
|
|
||||||
} // makeLabel
|
} // makeLabel
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@ -182,54 +224,54 @@ void OptionsScreenInput2::updateInputButtons()
|
|||||||
i++; // section header
|
i++; // section header
|
||||||
|
|
||||||
//I18N: Key binding name
|
//I18N: Key binding name
|
||||||
actions->renameItem(i++, makeLabel( _("Steer Left"), PA_STEER_LEFT) );
|
renameRow(actions, i++, _("Steer Left"), PA_STEER_LEFT);
|
||||||
|
|
||||||
//I18N: Key binding name
|
//I18N: Key binding name
|
||||||
actions->renameItem(i++, makeLabel( _("Steer Right"), PA_STEER_RIGHT) );
|
renameRow(actions, i++, _("Steer Right"), PA_STEER_RIGHT);
|
||||||
|
|
||||||
//I18N: Key binding name
|
//I18N: Key binding name
|
||||||
actions->renameItem(i++, makeLabel( _("Accelerate"), PA_ACCEL) );
|
renameRow(actions, i++, _("Accelerate"), PA_ACCEL);
|
||||||
|
|
||||||
//I18N: Key binding name
|
//I18N: Key binding name
|
||||||
actions->renameItem(i++, makeLabel( _("Brake"), PA_BRAKE) );
|
renameRow(actions, i++, _("Brake"), PA_BRAKE);
|
||||||
|
|
||||||
//I18N: Key binding name
|
//I18N: Key binding name
|
||||||
actions->renameItem(i++, makeLabel( _("Fire"), PA_FIRE) );
|
renameRow(actions, i++, _("Fire"), PA_FIRE);
|
||||||
|
|
||||||
//I18N: Key binding name
|
//I18N: Key binding name
|
||||||
actions->renameItem(i++, makeLabel( _("Nitro"), PA_NITRO) );
|
renameRow(actions, i++, _("Nitro"), PA_NITRO);
|
||||||
|
|
||||||
//I18N: Key binding name
|
//I18N: Key binding name
|
||||||
actions->renameItem(i++, makeLabel( _("Skidding"), PA_DRIFT) );
|
renameRow(actions, i++, _("Skidding"), PA_DRIFT);
|
||||||
|
|
||||||
//I18N: Key binding name
|
//I18N: Key binding name
|
||||||
actions->renameItem(i++, makeLabel( _("Look Back"), PA_LOOK_BACK) );
|
renameRow(actions, i++, _("Look Back"), PA_LOOK_BACK);
|
||||||
|
|
||||||
//I18N: Key binding name
|
//I18N: Key binding name
|
||||||
actions->renameItem(i++, makeLabel( _("Rescue"), PA_RESCUE) );
|
renameRow(actions, i++, _("Rescue"), PA_RESCUE);
|
||||||
|
|
||||||
//I18N: Key binding name
|
//I18N: Key binding name
|
||||||
actions->renameItem(i++, makeLabel( _("Pause Game"), PA_PAUSE_RACE) );
|
renameRow(actions, i++, _("Pause Game"), PA_PAUSE_RACE);
|
||||||
|
|
||||||
i++; // section header
|
i++; // section header
|
||||||
|
|
||||||
//I18N: Key binding name
|
//I18N: Key binding name
|
||||||
actions->renameItem(i++, makeLabel( _("Up"), PA_MENU_UP) );
|
renameRow(actions, i++, _("Up"), PA_MENU_UP);
|
||||||
|
|
||||||
//I18N: Key binding name
|
//I18N: Key binding name
|
||||||
actions->renameItem(i++, makeLabel( _("Down"), PA_MENU_DOWN) );
|
renameRow(actions, i++, _("Down"), PA_MENU_DOWN);
|
||||||
|
|
||||||
//I18N: Key binding name
|
//I18N: Key binding name
|
||||||
actions->renameItem(i++, makeLabel( _("Left"), PA_MENU_LEFT) );
|
renameRow(actions, i++, _("Left"), PA_MENU_LEFT);
|
||||||
|
|
||||||
//I18N: Key binding name
|
//I18N: Key binding name
|
||||||
actions->renameItem(i++, makeLabel( _("Right"), PA_MENU_RIGHT) );
|
renameRow(actions, i++, _("Right"), PA_MENU_RIGHT);
|
||||||
|
|
||||||
//I18N: Key binding name
|
//I18N: Key binding name
|
||||||
actions->renameItem(i++, makeLabel( _("Select"), PA_MENU_SELECT) );
|
renameRow(actions, i++, _("Select"), PA_MENU_SELECT);
|
||||||
|
|
||||||
//I18N: Key binding name
|
//I18N: Key binding name
|
||||||
actions->renameItem(i++, makeLabel( _("Cancel/Back"), PA_MENU_CANCEL) );
|
renameRow(actions, i++, _("Cancel/Back"), PA_MENU_CANCEL);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -443,18 +485,21 @@ void OptionsScreenInput2::eventCallback(Widget* widget,
|
|||||||
StateManager *sm = StateManager::get();
|
StateManager *sm = StateManager::get();
|
||||||
if (name == "options_choice")
|
if (name == "options_choice")
|
||||||
{
|
{
|
||||||
const std::string &selection =
|
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||||
((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
|
||||||
|
|
||||||
if (selection == "tab_audio")
|
Screen *screen = NULL;
|
||||||
sm->replaceTopMostScreen(OptionsScreenAudio::getInstance());
|
if (selection == "tab_audio")
|
||||||
else if (selection == "tab_video")
|
screen = OptionsScreenAudio::getInstance();
|
||||||
sm->replaceTopMostScreen(OptionsScreenVideo::getInstance());
|
//else if (selection == "tab_video")
|
||||||
|
// screen = OptionsScreenVideo::getInstance();
|
||||||
else if (selection == "tab_players")
|
else if (selection == "tab_players")
|
||||||
sm->replaceTopMostScreen(TabbedUserScreen::getInstance());
|
screen = TabbedUserScreen::getInstance();
|
||||||
|
//else if (selection == "tab_controls")
|
||||||
|
// screen = OptionsScreenInput::getInstance();
|
||||||
else if (selection == "tab_ui")
|
else if (selection == "tab_ui")
|
||||||
sm->replaceTopMostScreen(OptionsScreenUI::getInstance());
|
screen = OptionsScreenUI::getInstance();
|
||||||
else if (selection == "tab_controls") {}
|
if(screen)
|
||||||
|
StateManager::get()->replaceTopMostScreen(screen);
|
||||||
}
|
}
|
||||||
else if (name == "back_to_device_list")
|
else if (name == "back_to_device_list")
|
||||||
{
|
{
|
||||||
@ -555,7 +600,8 @@ void OptionsScreenInput2::onConfirm()
|
|||||||
const bool success =
|
const bool success =
|
||||||
input_manager->getDeviceList()->deleteConfig(m_config);
|
input_manager->getDeviceList()->deleteConfig(m_config);
|
||||||
assert(success);
|
assert(success);
|
||||||
if (!success) fprintf(stderr, "Failed to delete config!\n");
|
if (!success)
|
||||||
|
Log::error("OptionsScreenInput2", "Failed to delete config!");
|
||||||
|
|
||||||
m_config = NULL;
|
m_config = NULL;
|
||||||
input_manager->getDeviceList()->serialize();
|
input_manager->getDeviceList()->serialize();
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include "guiengine/screen.hpp"
|
#include "guiengine/screen.hpp"
|
||||||
#include "states_screens/dialogs/message_dialog.hpp"
|
#include "states_screens/dialogs/message_dialog.hpp"
|
||||||
|
|
||||||
namespace GUIEngine { class Widget; }
|
namespace GUIEngine { class Widget; class ListWidget; }
|
||||||
class DeviceConfig;
|
class DeviceConfig;
|
||||||
namespace irr { namespace gui { class STKModifiedSpriteBank; } }
|
namespace irr { namespace gui { class STKModifiedSpriteBank; } }
|
||||||
|
|
||||||
@ -50,8 +50,15 @@ class OptionsScreenInput2 : public GUIEngine::Screen,
|
|||||||
|
|
||||||
DeviceConfig* m_config;
|
DeviceConfig* m_config;
|
||||||
|
|
||||||
irr::core::stringw makeLabel(const irr::core::stringw &translatedName,
|
void renameRow(GUIEngine::ListWidget* actions,
|
||||||
PlayerAction action) const;
|
int idRow,
|
||||||
|
const irr::core::stringw &translatedName,
|
||||||
|
PlayerAction action) const;
|
||||||
|
|
||||||
|
void addListItem(GUIEngine::ListWidget* actions, PlayerAction pa);
|
||||||
|
void addListItemSubheader(GUIEngine::ListWidget* actions,
|
||||||
|
const char* id,
|
||||||
|
const core::stringw& text);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
friend class GUIEngine::ScreenSingleton<OptionsScreenInput2>;
|
friend class GUIEngine::ScreenSingleton<OptionsScreenInput2>;
|
||||||
@ -84,6 +91,8 @@ public:
|
|||||||
|
|
||||||
/** \brief Implement IConfirmDialogListener callback */
|
/** \brief Implement IConfirmDialogListener callback */
|
||||||
virtual void onConfirm() OVERRIDE;
|
virtual void onConfirm() OVERRIDE;
|
||||||
|
|
||||||
|
virtual void beforeAddingWidget() OVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -206,12 +206,21 @@ void OptionsScreenUI::eventCallback(Widget* widget, const std::string& name, con
|
|||||||
{
|
{
|
||||||
if (name == "options_choice")
|
if (name == "options_choice")
|
||||||
{
|
{
|
||||||
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
|
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||||
|
|
||||||
if (selection == "tab_audio") StateManager::get()->replaceTopMostScreen(OptionsScreenAudio::getInstance());
|
Screen *screen = NULL;
|
||||||
else if (selection == "tab_video") StateManager::get()->replaceTopMostScreen(OptionsScreenVideo::getInstance());
|
if (selection == "tab_audio")
|
||||||
else if (selection == "tab_players") StateManager::get()->replaceTopMostScreen(TabbedUserScreen::getInstance());
|
screen = OptionsScreenAudio::getInstance();
|
||||||
else if (selection == "tab_controls") StateManager::get()->replaceTopMostScreen(OptionsScreenInput::getInstance());
|
else if (selection == "tab_video")
|
||||||
|
screen = OptionsScreenVideo::getInstance();
|
||||||
|
else if (selection == "tab_players")
|
||||||
|
screen = TabbedUserScreen::getInstance();
|
||||||
|
else if (selection == "tab_controls")
|
||||||
|
screen = OptionsScreenInput::getInstance();
|
||||||
|
//else if (selection == "tab_ui")
|
||||||
|
// screen = OptionsScreenUI::getInstance();
|
||||||
|
if(screen)
|
||||||
|
StateManager::get()->replaceTopMostScreen(screen);
|
||||||
}
|
}
|
||||||
else if(name == "back")
|
else if(name == "back")
|
||||||
{
|
{
|
||||||
|
@ -167,15 +167,6 @@ void OptionsScreenVideo::init()
|
|||||||
if (UserConfigParams::m_fullscreen) rememberWinpos->setDeactivated();
|
if (UserConfigParams::m_fullscreen) rememberWinpos->setDeactivated();
|
||||||
else rememberWinpos->setActivated();
|
else rememberWinpos->setActivated();
|
||||||
|
|
||||||
// Enable back widgets if they were visited in-game previously
|
|
||||||
if (StateManager::get()->getGameState() != GUIEngine::INGAME_MENU)
|
|
||||||
{
|
|
||||||
res->setActivated();
|
|
||||||
full->setActivated();
|
|
||||||
applyBtn->setActivated();
|
|
||||||
gfx->setActivated();
|
|
||||||
getWidget<ButtonWidget>("custom")->setActivated();
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- get resolution list from irrlicht the first time
|
// --- get resolution list from irrlicht the first time
|
||||||
if (!m_inited)
|
if (!m_inited)
|
||||||
@ -342,6 +333,15 @@ void OptionsScreenVideo::init()
|
|||||||
gfx->setDeactivated();
|
gfx->setDeactivated();
|
||||||
getWidget<ButtonWidget>("custom")->setDeactivated();
|
getWidget<ButtonWidget>("custom")->setDeactivated();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Enable back widgets if they were visited in-game previously
|
||||||
|
res->setActivated();
|
||||||
|
full->setActivated();
|
||||||
|
applyBtn->setActivated();
|
||||||
|
gfx->setActivated();
|
||||||
|
getWidget<ButtonWidget>("custom")->setActivated();
|
||||||
|
}
|
||||||
} // init
|
} // init
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -469,15 +469,13 @@ void OptionsScreenVideo::eventCallback(Widget* widget, const std::string& name,
|
|||||||
{
|
{
|
||||||
if (name == "options_choice")
|
if (name == "options_choice")
|
||||||
{
|
{
|
||||||
std::string selection =
|
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||||
((RibbonWidget*)widget)
|
|
||||||
->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
|
||||||
|
|
||||||
Screen *screen = NULL;
|
Screen *screen = NULL;
|
||||||
if (selection == "tab_audio")
|
if (selection == "tab_audio")
|
||||||
screen = OptionsScreenAudio::getInstance();
|
screen = OptionsScreenAudio::getInstance();
|
||||||
else if (selection == "tab_video")
|
//else if (selection == "tab_video")
|
||||||
screen = OptionsScreenVideo::getInstance();
|
// screen = OptionsScreenVideo::getInstance();
|
||||||
else if (selection == "tab_players")
|
else if (selection == "tab_players")
|
||||||
screen = TabbedUserScreen::getInstance();
|
screen = TabbedUserScreen::getInstance();
|
||||||
else if (selection == "tab_controls")
|
else if (selection == "tab_controls")
|
||||||
|
@ -108,7 +108,7 @@ RaceGUI::RaceGUI()
|
|||||||
int n = race_manager->getNumberOfKarts();
|
int n = race_manager->getNumberOfKarts();
|
||||||
|
|
||||||
m_animation_states.resize(n);
|
m_animation_states.resize(n);
|
||||||
m_rank_animation_start_times.resize(n);
|
m_rank_animation_duration.resize(n);
|
||||||
m_last_ranks.resize(n);
|
m_last_ranks.resize(n);
|
||||||
} // RaceGUI
|
} // RaceGUI
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ void RaceGUI::renderPlayerView(const Camera *camera, float dt)
|
|||||||
if(!World::getWorld()->isRacePhase()) return;
|
if(!World::getWorld()->isRacePhase()) return;
|
||||||
|
|
||||||
drawPowerupIcons (kart, viewport, scaling);
|
drawPowerupIcons (kart, viewport, scaling);
|
||||||
drawSpeedEnergyRank(kart, viewport, scaling);
|
drawSpeedEnergyRank(kart, viewport, scaling, dt);
|
||||||
|
|
||||||
if (!m_is_tutorial)
|
if (!m_is_tutorial)
|
||||||
drawLap(kart, viewport, scaling);
|
drawLap(kart, viewport, scaling);
|
||||||
@ -601,10 +601,18 @@ void RaceGUI::drawEnergyMeter(int x, int y, const AbstractKart *kart,
|
|||||||
} // drawEnergyMeter
|
} // drawEnergyMeter
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
/** Draws the rank of a player.
|
||||||
|
* \param kart The kart of the player.
|
||||||
|
* \param offset Offset of top left corner for this display (for splitscreen).
|
||||||
|
* \param min_ratio Scaling of the screen (for splitscreen).
|
||||||
|
* \param meter_width Width of the meter (inside which the rank is shown).
|
||||||
|
* \param meter_height Height of the meter (inside which the rank is shown).
|
||||||
|
* \param dt Time step size.
|
||||||
|
*/
|
||||||
void RaceGUI::drawRank(const AbstractKart *kart,
|
void RaceGUI::drawRank(const AbstractKart *kart,
|
||||||
const core::vector2df &offset,
|
const core::vector2df &offset,
|
||||||
float min_ratio, int meter_width,
|
float min_ratio, int meter_width,
|
||||||
int meter_height)
|
int meter_height, float dt)
|
||||||
{
|
{
|
||||||
// Draw rank
|
// Draw rank
|
||||||
WorldWithRank *world = dynamic_cast<WorldWithRank*>(World::getWorld());
|
WorldWithRank *world = dynamic_cast<WorldWithRank*>(World::getWorld());
|
||||||
@ -617,10 +625,14 @@ void RaceGUI::drawRank(const AbstractKart *kart,
|
|||||||
{
|
{
|
||||||
if (m_last_ranks[id] != kart->getPosition())
|
if (m_last_ranks[id] != kart->getPosition())
|
||||||
{
|
{
|
||||||
m_rank_animation_start_times[id] = world->getTime();
|
m_rank_animation_duration[id] = 0.0f;
|
||||||
m_animation_states[id] = AS_SMALLER;
|
m_animation_states[id] = AS_SMALLER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_rank_animation_duration[id] += dt;
|
||||||
|
}
|
||||||
|
|
||||||
float scale = 1.0f;
|
float scale = 1.0f;
|
||||||
int rank = kart->getPosition();
|
int rank = kart->getPosition();
|
||||||
@ -628,13 +640,12 @@ void RaceGUI::drawRank(const AbstractKart *kart,
|
|||||||
const float MIN_SHRINK = 0.3f;
|
const float MIN_SHRINK = 0.3f;
|
||||||
if (m_animation_states[id] == AS_SMALLER)
|
if (m_animation_states[id] == AS_SMALLER)
|
||||||
{
|
{
|
||||||
scale = 1.0f - (world->getTime() - m_rank_animation_start_times[id])
|
scale = 1.0f - m_rank_animation_duration[id]/ DURATION;
|
||||||
/ DURATION;
|
|
||||||
rank = m_last_ranks[id];
|
rank = m_last_ranks[id];
|
||||||
if (scale < MIN_SHRINK)
|
if (scale < MIN_SHRINK)
|
||||||
{
|
{
|
||||||
m_animation_states[id] = AS_BIGGER;
|
m_animation_states[id] = AS_BIGGER;
|
||||||
m_rank_animation_start_times[id] = world->getTime();
|
m_rank_animation_duration[id] = 0.0f;
|
||||||
// Store the new rank
|
// Store the new rank
|
||||||
m_last_ranks[id] = kart->getPosition();
|
m_last_ranks[id] = kart->getPosition();
|
||||||
scale = MIN_SHRINK;
|
scale = MIN_SHRINK;
|
||||||
@ -642,8 +653,7 @@ void RaceGUI::drawRank(const AbstractKart *kart,
|
|||||||
}
|
}
|
||||||
else if (m_animation_states[id] == AS_BIGGER)
|
else if (m_animation_states[id] == AS_BIGGER)
|
||||||
{
|
{
|
||||||
scale = (world->getTime() - m_rank_animation_start_times[id])
|
scale = m_rank_animation_duration[id] / DURATION + MIN_SHRINK;
|
||||||
/ DURATION + MIN_SHRINK;
|
|
||||||
rank = m_last_ranks[id];
|
rank = m_last_ranks[id];
|
||||||
if (scale > 1.0f)
|
if (scale > 1.0f)
|
||||||
{
|
{
|
||||||
@ -680,10 +690,12 @@ void RaceGUI::drawRank(const AbstractKart *kart,
|
|||||||
* \param kart The kart for which to show the data.
|
* \param kart The kart for which to show the data.
|
||||||
* \param viewport The viewport to use.
|
* \param viewport The viewport to use.
|
||||||
* \param scaling Which scaling to apply to the speedometer.
|
* \param scaling Which scaling to apply to the speedometer.
|
||||||
|
* \param dt Time step size.
|
||||||
*/
|
*/
|
||||||
void RaceGUI::drawSpeedEnergyRank(const AbstractKart* kart,
|
void RaceGUI::drawSpeedEnergyRank(const AbstractKart* kart,
|
||||||
const core::recti &viewport,
|
const core::recti &viewport,
|
||||||
const core::vector2df &scaling)
|
const core::vector2df &scaling,
|
||||||
|
float dt)
|
||||||
{
|
{
|
||||||
float min_ratio = std::min(scaling.X, scaling.Y);
|
float min_ratio = std::min(scaling.X, scaling.Y);
|
||||||
const int SPEEDWIDTH = 128;
|
const int SPEEDWIDTH = 128;
|
||||||
@ -712,7 +724,7 @@ void RaceGUI::drawSpeedEnergyRank(const AbstractKart* kart,
|
|||||||
|
|
||||||
const float speed = kart->getSpeed();
|
const float speed = kart->getSpeed();
|
||||||
|
|
||||||
drawRank(kart, offset, min_ratio, meter_width, meter_height);
|
drawRank(kart, offset, min_ratio, meter_width, meter_height, dt);
|
||||||
|
|
||||||
|
|
||||||
if(speed <=0) return; // Nothing to do if speed is negative.
|
if(speed <=0) return; // Nothing to do if speed is negative.
|
||||||
|
@ -89,8 +89,8 @@ private:
|
|||||||
enum AnimationState {AS_NONE, AS_SMALLER, AS_BIGGER};
|
enum AnimationState {AS_NONE, AS_SMALLER, AS_BIGGER};
|
||||||
std::vector<AnimationState> m_animation_states;
|
std::vector<AnimationState> m_animation_states;
|
||||||
|
|
||||||
/** When the animation state was changed. */
|
/** How long the rank animation has been shown. */
|
||||||
std::vector<float> m_rank_animation_start_times;
|
std::vector<float> m_rank_animation_duration;
|
||||||
|
|
||||||
/** Stores the previous rank for each kart. Used for the rank animation. */
|
/** Stores the previous rank for each kart. Used for the rank animation. */
|
||||||
std::vector<int> m_last_ranks;
|
std::vector<int> m_last_ranks;
|
||||||
@ -103,14 +103,14 @@ private:
|
|||||||
const core::vector2df &scaling);
|
const core::vector2df &scaling);
|
||||||
void drawSpeedEnergyRank (const AbstractKart* kart,
|
void drawSpeedEnergyRank (const AbstractKart* kart,
|
||||||
const core::recti &viewport,
|
const core::recti &viewport,
|
||||||
const core::vector2df &scaling);
|
const core::vector2df &scaling, float dt);
|
||||||
void drawLap (const AbstractKart* kart,
|
void drawLap (const AbstractKart* kart,
|
||||||
const core::recti &viewport,
|
const core::recti &viewport,
|
||||||
const core::vector2df &scaling);
|
const core::vector2df &scaling);
|
||||||
void drawRank (const AbstractKart *kart,
|
void drawRank (const AbstractKart *kart,
|
||||||
const core::vector2df &offset,
|
const core::vector2df &offset,
|
||||||
float min_ratio, int meter_width,
|
float min_ratio, int meter_width,
|
||||||
int meter_height);
|
int meter_height, float dt);
|
||||||
|
|
||||||
/** Display items that are shown once only (for all karts). */
|
/** Display items that are shown once only (for all karts). */
|
||||||
void drawGlobalMiniMap ();
|
void drawGlobalMiniMap ();
|
||||||
|
@ -471,8 +471,8 @@ void RaceGUIOverworld::drawGlobalMiniMap()
|
|||||||
|
|
||||||
if (challenge == NULL)
|
if (challenge == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[RaceGUIOverworld] ERROR: Cannot find challenge <%s>\n",
|
Log::error("RaceGUIOverworld", "Cannot find challenge <%s>.",
|
||||||
challenges[n].m_challenge_id.c_str());
|
challenges[n].m_challenge_id.c_str());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -483,10 +483,10 @@ void RaceGUIOverworld::drawGlobalMiniMap()
|
|||||||
|
|
||||||
if (gp == NULL)
|
if (gp == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[RaceGUIOverworld] ERROR: Cannot find GP <%s>, "
|
Log::error("RaceGUIOverworld", "Cannot find GP <%s>, "
|
||||||
"referenced from challenge <%s>\n",
|
"referenced from challenge <%s>",
|
||||||
challenge->getGPId().c_str(),
|
challenge->getGPId().c_str(),
|
||||||
challenges[n].m_challenge_id.c_str());
|
challenges[n].m_challenge_id.c_str());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -508,10 +508,10 @@ void RaceGUIOverworld::drawGlobalMiniMap()
|
|||||||
Track* track = track_manager->getTrack(challenge->getTrackId());
|
Track* track = track_manager->getTrack(challenge->getTrackId());
|
||||||
if (track == NULL)
|
if (track == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[RaceGUIOverworld] ERROR: Cannot find track <%s>, "
|
Log::error("RaceGUIOverworld", "Cannot find track <%s>, "
|
||||||
"referenced from challenge <%s>\n",
|
"referenced from challenge <%s>",
|
||||||
challenge->getTrackId().c_str(),
|
challenge->getTrackId().c_str(),
|
||||||
challenges[n].m_challenge_id.c_str());
|
challenges[n].m_challenge_id.c_str());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,9 +297,8 @@ void RaceResultGUI::eventCallback(GUIEngine::Widget* widget,
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "Incorrect event '%s' when things are unlocked.\n",
|
Log::fatal("RaceResultGUI", "Incorrect event '%s' when things are unlocked.",
|
||||||
name.c_str());
|
name.c_str());
|
||||||
assert(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're playing online :
|
// If we're playing online :
|
||||||
@ -342,11 +341,8 @@ void RaceResultGUI::eventCallback(GUIEngine::Widget* widget,
|
|||||||
MessageDialog::MESSAGE_DIALOG_CONFIRM, this, false);
|
MessageDialog::MESSAGE_DIALOG_CONFIRM, this, false);
|
||||||
}
|
}
|
||||||
else if (!getWidget(name.c_str())->isVisible())
|
else if (!getWidget(name.c_str())->isVisible())
|
||||||
{
|
Log::fatal("RaceResultGUI", "Incorrect event '%s' when things are unlocked.",
|
||||||
fprintf(stderr, "Incorrect event '%s' when things are unlocked.\n",
|
name.c_str());
|
||||||
name.c_str());
|
|
||||||
assert(false);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,10 +383,8 @@ void RaceResultGUI::eventCallback(GUIEngine::Widget* widget,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
Log::fatal("RaceResultGUI", "Incorrect event '%s' for normal race.",
|
||||||
fprintf(stderr, "Incorrect event '%s' for normal race.\n",
|
name.c_str());
|
||||||
name.c_str());
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
} // eventCallback
|
} // eventCallback
|
||||||
|
|
||||||
@ -615,8 +609,8 @@ void RaceResultGUI::onUpdate(float dt)
|
|||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[RaceResultGUI] WARNING: exception caught when "
|
Log::error("RaceResultGUI", "Exception caught when "
|
||||||
"trying to load music: %s\n", e.what());
|
"trying to load music: %s", e.what());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // onUpdate
|
} // onUpdate
|
||||||
|
@ -108,6 +108,21 @@ void BaseUserScreen::init()
|
|||||||
else if (PlayerManager::get()->getNumPlayers() > 0)
|
else if (PlayerManager::get()->getNumPlayers() > 0)
|
||||||
selectUser(0);
|
selectUser(0);
|
||||||
|
|
||||||
|
// Disable changing the user while in game
|
||||||
|
if (StateManager::get()->getGameState() == GUIEngine::INGAME_MENU)
|
||||||
|
{
|
||||||
|
getWidget<IconButtonWidget>("ok")->setDeactivated();
|
||||||
|
getWidget<IconButtonWidget>("new_user")->setDeactivated();
|
||||||
|
getWidget<IconButtonWidget>("rename")->setDeactivated();
|
||||||
|
getWidget<IconButtonWidget>("delete")->setDeactivated();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
getWidget<IconButtonWidget>("ok")->setActivated();
|
||||||
|
getWidget<IconButtonWidget>("new_user")->setActivated();
|
||||||
|
getWidget<IconButtonWidget>("rename")->setActivated();
|
||||||
|
getWidget<IconButtonWidget>("delete")->setActivated();
|
||||||
|
}
|
||||||
} // init
|
} // init
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -572,16 +587,21 @@ void TabbedUserScreen::eventCallback(GUIEngine::Widget* widget,
|
|||||||
{
|
{
|
||||||
if (name == "options_choice")
|
if (name == "options_choice")
|
||||||
{
|
{
|
||||||
const std::string &selection =
|
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||||
((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
|
||||||
Screen *s;
|
Screen *screen = NULL;
|
||||||
if (selection=="tab_audio" ) s = OptionsScreenAudio::getInstance();
|
if (selection == "tab_audio")
|
||||||
else if (selection=="tab_video" ) s = OptionsScreenVideo::getInstance();
|
screen = OptionsScreenAudio::getInstance();
|
||||||
else if (selection=="tab_players" ) s = TabbedUserScreen::getInstance();
|
else if (selection == "tab_video")
|
||||||
else if (selection=="tab_controls") s = OptionsScreenInput::getInstance();
|
screen = OptionsScreenVideo::getInstance();
|
||||||
else if (selection=="tab_ui" ) s = OptionsScreenUI::getInstance();
|
//else if (selection == "tab_players")
|
||||||
assert(s);
|
// screen = TabbedUserScreen::getInstance();
|
||||||
StateManager::get()->replaceTopMostScreen(s);
|
else if (selection == "tab_controls")
|
||||||
|
screen = OptionsScreenInput::getInstance();
|
||||||
|
else if (selection == "tab_ui")
|
||||||
|
screen = OptionsScreenUI::getInstance();
|
||||||
|
if(screen)
|
||||||
|
StateManager::get()->replaceTopMostScreen(screen);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
BaseUserScreen::eventCallback(widget, name, player_id);
|
BaseUserScreen::eventCallback(widget, name, player_id);
|
||||||
|
@ -36,12 +36,8 @@ CheckCannon::CheckCannon(const XMLNode &node, unsigned int index)
|
|||||||
: CheckLine(node, index)
|
: CheckLine(node, index)
|
||||||
{
|
{
|
||||||
core::vector3df p1, p2;
|
core::vector3df p1, p2;
|
||||||
if(!node.get("target-p1", &p1) ||
|
if(!node.get("target-p1", &p1) || !node.get("target-p2", &p2))
|
||||||
!node.get("target-p2", &p2) )
|
Log::fatal("CheckCannon", "No target line specified.");
|
||||||
{
|
|
||||||
printf("CheckCannon has no target line specified.\n");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
m_target.setLine(p1, p2);
|
m_target.setLine(p1, p2);
|
||||||
m_curve = new Ipo(*(node.getNode("curve")),
|
m_curve = new Ipo(*(node.getNode("curve")),
|
||||||
/*fps*/25,
|
/*fps*/25,
|
||||||
|
@ -72,8 +72,8 @@ void CheckGoal::update(float dt)
|
|||||||
if(isTriggered(m_previous_position[ball_index], xyz, ball_index))
|
if(isTriggered(m_previous_position[ball_index], xyz, ball_index))
|
||||||
{
|
{
|
||||||
if(UserConfigParams::m_check_debug)
|
if(UserConfigParams::m_check_debug)
|
||||||
printf("CHECK: Goal check structure %d triggered for object %s.\n",
|
Log::info("CheckGoal", "Goal check structure %d triggered for object %s.",
|
||||||
m_index, obj->getPresentation<TrackObjectPresentationMesh>()->getNode()->getDebugName());
|
m_index, obj->getPresentation<TrackObjectPresentationMesh>()->getNode()->getDebugName());
|
||||||
trigger(ball_index);
|
trigger(ball_index);
|
||||||
}
|
}
|
||||||
m_previous_position[ball_index] = xyz;
|
m_previous_position[ball_index] = xyz;
|
||||||
|
@ -71,11 +71,10 @@ bool CheckLap::isTriggered(const Vec3 &old_pos, const Vec3 &new_pos,
|
|||||||
bool result =(m_previous_distance[indx]>0.95f*track_length &&
|
bool result =(m_previous_distance[indx]>0.95f*track_length &&
|
||||||
current_distance<7.0f);
|
current_distance<7.0f);
|
||||||
if(UserConfigParams::m_check_debug && result)
|
if(UserConfigParams::m_check_debug && result)
|
||||||
{
|
Log::info("CheckLap", "Kart %s crossed start line from %f to %f.",
|
||||||
printf("CHECK: Kart %s crossed start line from %f to %f.\n",
|
World::getWorld()->getKart(indx)->getIdent().c_str(),
|
||||||
World::getWorld()->getKart(indx)->getIdent().c_str(),
|
m_previous_distance[indx], current_distance);
|
||||||
m_previous_distance[indx], current_distance);
|
|
||||||
}
|
|
||||||
m_previous_distance[indx] = current_distance;
|
m_previous_distance[indx] = current_distance;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -173,14 +173,14 @@ bool CheckLine::isTriggered(const Vec3 &old_pos, const Vec3 &new_pos,
|
|||||||
if(UserConfigParams::m_check_debug && !result)
|
if(UserConfigParams::m_check_debug && !result)
|
||||||
{
|
{
|
||||||
if(World::getWorld()->getNumKarts()>0)
|
if(World::getWorld()->getNumKarts()>0)
|
||||||
printf("CHECK: Kart %s crosses line, but wrong height "
|
Log::info("CheckLine", "Kart %s crosses line, but wrong height "
|
||||||
"(%f vs %f).\n",
|
"(%f vs %f).",
|
||||||
World::getWorld()->getKart(indx)->getIdent().c_str(),
|
World::getWorld()->getKart(indx)->getIdent().c_str(),
|
||||||
new_pos.getY(), m_min_height);
|
new_pos.getY(), m_min_height);
|
||||||
else
|
else
|
||||||
printf("CHECK: Kart %d crosses line, but wrong height "
|
Log::info("CheckLine", "Kart %d crosses line, but wrong height "
|
||||||
"(%f vs %f).\n",
|
"(%f vs %f).",
|
||||||
indx, new_pos.getY(), m_min_height);
|
indx, new_pos.getY(), m_min_height);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ void CheckManager::load(const XMLNode &node)
|
|||||||
m_all_checks.push_back(cs);
|
m_all_checks.push_back(cs);
|
||||||
} // checksphere
|
} // checksphere
|
||||||
else
|
else
|
||||||
printf("Unknown check structure '%s' - ignored.\n", type.c_str());
|
Log::warn("CheckManager", "Unknown check structure '%s' - ignored.", type.c_str());
|
||||||
} // for i<node.getNumNodes
|
} // for i<node.getNumNodes
|
||||||
|
|
||||||
// Now set all 'successors', i.e. check structures that need to get a
|
// Now set all 'successors', i.e. check structures that need to get a
|
||||||
@ -141,18 +141,15 @@ unsigned int CheckManager::getLapLineIndex() const
|
|||||||
|
|
||||||
if (dynamic_cast<CheckLap*>(c) != NULL) return i;
|
if (dynamic_cast<CheckLap*>(c) != NULL) return i;
|
||||||
}
|
}
|
||||||
fprintf(stderr,
|
Log::warn("CheckManager", "No check-lap structure found! This can cause incorrect kart");
|
||||||
"No check-lap structure found! This can cause incorrect kart\n");
|
Log::warn("CheckManager", "ranking when crossing the line, but can otherwise be ignored.");
|
||||||
fprintf(stderr,
|
|
||||||
"ranking when crossing the line, but can otherwise be ignored.\n");
|
|
||||||
for (unsigned int i=0; i<getCheckStructureCount(); i++)
|
for (unsigned int i=0; i<getCheckStructureCount(); i++)
|
||||||
{
|
{
|
||||||
if(getCheckStructure(i)->getType()==CheckStructure::CT_NEW_LAP)
|
if(getCheckStructure(i)->getType()==CheckStructure::CT_NEW_LAP)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "Error, no kind of lap line for track found, aborting.\n");
|
Log::fatal("CheckManager", "Error, no kind of lap line for track found, aborting.");
|
||||||
exit(-1);
|
|
||||||
} // getLapLineIndex
|
} // getLapLineIndex
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@ -54,9 +54,7 @@ CheckStructure::CheckStructure(const XMLNode &node, unsigned int index)
|
|||||||
else if(node.getName()=="cannon")
|
else if(node.getName()=="cannon")
|
||||||
m_check_type = CT_CANNON;
|
m_check_type = CT_CANNON;
|
||||||
else
|
else
|
||||||
{
|
Log::warn("CheckStructure", "Unknown check structure '%s' - ignored.", kind.c_str());
|
||||||
printf("Unknown check structure '%s' - ignored.\n", kind.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
node.get("same-group", &m_same_group);
|
node.get("same-group", &m_same_group);
|
||||||
// Make sure that the index of this check structure is included in
|
// Make sure that the index of this check structure is included in
|
||||||
@ -108,8 +106,8 @@ void CheckStructure::update(float dt)
|
|||||||
if(m_is_active[i] && isTriggered(m_previous_position[i], xyz, i))
|
if(m_is_active[i] && isTriggered(m_previous_position[i], xyz, i))
|
||||||
{
|
{
|
||||||
if(UserConfigParams::m_check_debug)
|
if(UserConfigParams::m_check_debug)
|
||||||
printf("CHECK: Check structure %d triggered for kart %s.\n",
|
Log::info("CheckStructure", "Check structure %d triggered for kart %s.",
|
||||||
m_index, world->getKart(i)->getIdent().c_str());
|
m_index, world->getKart(i)->getIdent().c_str());
|
||||||
trigger(i);
|
trigger(i);
|
||||||
}
|
}
|
||||||
m_previous_position[i] = xyz;
|
m_previous_position[i] = xyz;
|
||||||
@ -144,18 +142,18 @@ void CheckStructure::changeStatus(const std::vector<int> indices,
|
|||||||
cs->m_is_active[kart_index] = false;
|
cs->m_is_active[kart_index] = false;
|
||||||
if(UserConfigParams::m_check_debug)
|
if(UserConfigParams::m_check_debug)
|
||||||
{
|
{
|
||||||
printf("CHECK: Deactivating %d for %s.\n",
|
Log::info("CheckStructure", "Deactivating %d for %s.",
|
||||||
indices[i],
|
indices[i],
|
||||||
World::getWorld()->getKart(kart_index)->getIdent().c_str());
|
World::getWorld()->getKart(kart_index)->getIdent().c_str());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CS_ACTIVATE:
|
case CS_ACTIVATE:
|
||||||
cs->m_is_active[kart_index] = true;
|
cs->m_is_active[kart_index] = true;
|
||||||
if(UserConfigParams::m_check_debug)
|
if(UserConfigParams::m_check_debug)
|
||||||
{
|
{
|
||||||
printf("CHECK: Activating %d for %s.\n",
|
Log::info("CheckStructure", "Activating %d for %s.",
|
||||||
indices[i],
|
indices[i],
|
||||||
World::getWorld()->getKart(kart_index)->getIdent().c_str());
|
World::getWorld()->getKart(kart_index)->getIdent().c_str());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CS_TOGGLE:
|
case CS_TOGGLE:
|
||||||
@ -166,10 +164,10 @@ void CheckStructure::changeStatus(const std::vector<int> indices,
|
|||||||
// non-POD type 'struct std::_Bit_reference' through '...';
|
// non-POD type 'struct std::_Bit_reference' through '...';
|
||||||
// call will abort at runtime"). So we use this somewhat
|
// call will abort at runtime"). So we use this somewhat
|
||||||
// unusual but portable construct.
|
// unusual but portable construct.
|
||||||
printf("CHECK: Toggling %d for %s from %d.\n",
|
Log::info("CheckStructure", "Toggling %d for %s from %d.",
|
||||||
indices[i],
|
indices[i],
|
||||||
World::getWorld()->getKart(kart_index)->getIdent().c_str(),
|
World::getWorld()->getKart(kart_index)->getIdent().c_str(),
|
||||||
cs->m_is_active[kart_index]==true);
|
cs->m_is_active[kart_index]==true);
|
||||||
}
|
}
|
||||||
cs->m_is_active[kart_index] = !cs->m_is_active[kart_index];
|
cs->m_is_active[kart_index] = !cs->m_is_active[kart_index];
|
||||||
} // switch
|
} // switch
|
||||||
@ -213,9 +211,9 @@ void CheckStructure::trigger(unsigned int kart_index)
|
|||||||
World::getWorld()->newLap(kart_index);
|
World::getWorld()->newLap(kart_index);
|
||||||
if(UserConfigParams::m_check_debug)
|
if(UserConfigParams::m_check_debug)
|
||||||
{
|
{
|
||||||
printf("CHECK: %s new lap %d triggered\n",
|
Log::info("CheckStructure", "%s new lap %d triggered",
|
||||||
World::getWorld()->getKart(kart_index)->getIdent().c_str(),
|
World::getWorld()->getKart(kart_index)->getIdent().c_str(),
|
||||||
m_index);
|
m_index);
|
||||||
}
|
}
|
||||||
changeStatus(m_check_structures_to_change_state,
|
changeStatus(m_check_structures_to_change_state,
|
||||||
kart_index, CS_ACTIVATE);
|
kart_index, CS_ACTIVATE);
|
||||||
|
@ -30,10 +30,8 @@
|
|||||||
GraphNode::GraphNode(unsigned int quad_index, unsigned int node_index)
|
GraphNode::GraphNode(unsigned int quad_index, unsigned int node_index)
|
||||||
{
|
{
|
||||||
if (quad_index >= QuadSet::get()->getNumberOfQuads())
|
if (quad_index >= QuadSet::get()->getNumberOfQuads())
|
||||||
{
|
Log::fatal("GraphNode", "No driveline found, or empty driveline.");
|
||||||
fprintf(stderr, "[GraphNode] ERROR: No driveline found, or empty driveline");
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
m_quad_index = quad_index;
|
m_quad_index = quad_index;
|
||||||
m_node_index = node_index;
|
m_node_index = node_index;
|
||||||
m_distance_from_start = -1.0f;
|
m_distance_from_start = -1.0f;
|
||||||
@ -130,10 +128,10 @@ void GraphNode::setupPathsToNode()
|
|||||||
gn.markAllSuccessorsToUse(i, &m_path_to_node);
|
gn.markAllSuccessorsToUse(i, &m_path_to_node);
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
for(unsigned int i=0; i<m_path_to_node.size(); i++)
|
for(unsigned int i = 0; i < m_path_to_node.size(); ++i)
|
||||||
{
|
{
|
||||||
if(m_path_to_node[i]==-1)
|
if(m_path_to_node[i] == -1)
|
||||||
printf("[WARNING] No path to node %d found on graph node %d.\n",
|
Log::warn("GraphNode", "No path to node %d found on graph node %d.",
|
||||||
i, m_node_index);
|
i, m_node_index);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "tracks/quad.hpp"
|
#include "tracks/quad.hpp"
|
||||||
|
#include "utils/log.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <S3DVertex.h>
|
#include <S3DVertex.h>
|
||||||
@ -31,10 +32,10 @@ Quad::Quad(const Vec3 &p0, const Vec3 &p1, const Vec3 &p2, const Vec3 &p3,
|
|||||||
if(p1.sideOfLine2D(p0, p2)>0 ||
|
if(p1.sideOfLine2D(p0, p2)>0 ||
|
||||||
p3.sideOfLine2D(p0, p2)<0)
|
p3.sideOfLine2D(p0, p2)<0)
|
||||||
{
|
{
|
||||||
printf("Warning: quad has wrong orientation: p0=%f %f %f p1=%f %f %f\n",
|
Log::warn("Quad", "Quad has wrong orientation: p0=%f %f %f p1=%f %f %f",
|
||||||
p0.getX(), p0.getY(), p0.getZ(),p1.getX(), p1.getY(), p1.getZ());
|
p0.getX(), p0.getY(), p0.getZ(),p1.getX(), p1.getY(), p1.getZ());
|
||||||
printf("The quad will be swapped, nevertheless test for correctness -\n");
|
Log::warn("Quad", "The quad will be swapped, nevertheless test for correctness -");
|
||||||
printf("quads must be counter-clockwise oriented.\n");
|
Log::warn("Quad", "quads must be counter-clockwise oriented.");
|
||||||
m_p[0]=p1; m_p[1]=p0; m_p[2]=p3; m_p[3]=p2;
|
m_p[0]=p1; m_p[1]=p0; m_p[2]=p3; m_p[3]=p2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -498,10 +498,7 @@ public:
|
|||||||
btTransform getStartTransform (unsigned int index) const
|
btTransform getStartTransform (unsigned int index) const
|
||||||
{
|
{
|
||||||
if (index >= m_start_transforms.size())
|
if (index >= m_start_transforms.size())
|
||||||
{
|
Log::fatal("Tracj", "No start position for kart %i.", index);
|
||||||
fprintf(stderr, "No start position for kart %i\n", index);
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
return m_start_transforms[index];
|
return m_start_transforms[index];
|
||||||
}
|
}
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
@ -98,9 +98,8 @@ void TrackManager::setUnavailableTracks(const std::vector<std::string> &tracks)
|
|||||||
if (std::find(tracks.begin(), tracks.end(), id)==tracks.end())
|
if (std::find(tracks.begin(), tracks.end(), id)==tracks.end())
|
||||||
{
|
{
|
||||||
m_track_avail[i-m_tracks.begin()] = false;
|
m_track_avail[i-m_tracks.begin()] = false;
|
||||||
fprintf(stderr,
|
Log::warn("TrackManager", "Track '%s' not available on all clients, disabled.",
|
||||||
"Track '%s' not available on all clients, disabled.\n",
|
id.c_str());
|
||||||
id.c_str());
|
|
||||||
} // if id not in tracks
|
} // if id not in tracks
|
||||||
} // for all available tracks in track manager
|
} // for all available tracks in track manager
|
||||||
|
|
||||||
@ -174,7 +173,7 @@ bool TrackManager::loadTrack(const std::string& dirname)
|
|||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[TrackManager] ERROR: Cannot load track <%s> : %s\n",
|
Log::error("TrackManager", "Cannot load track <%s> : %s\n",
|
||||||
dirname.c_str(), e.what());
|
dirname.c_str(), e.what());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -182,12 +181,12 @@ bool TrackManager::loadTrack(const std::string& dirname)
|
|||||||
if (track->getVersion()<stk_config->m_min_track_version ||
|
if (track->getVersion()<stk_config->m_min_track_version ||
|
||||||
track->getVersion()>stk_config->m_max_track_version)
|
track->getVersion()>stk_config->m_max_track_version)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "[TrackManager] Warning: track '%s' is not supported "
|
Log::warn("TrackManager", "Track '%s' is not supported "
|
||||||
"by this binary, ignored. (Track is version %i, this "
|
"by this binary, ignored. (Track is version %i, this "
|
||||||
"executable supports from %i to %i)\n",
|
"executable supports from %i to %i).",
|
||||||
track->getIdent().c_str(), track->getVersion(),
|
track->getIdent().c_str(), track->getVersion(),
|
||||||
stk_config->m_min_track_version,
|
stk_config->m_min_track_version,
|
||||||
stk_config->m_max_track_version);
|
stk_config->m_max_track_version);
|
||||||
delete track;
|
delete track;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -206,22 +205,15 @@ void TrackManager::removeTrack(const std::string &ident)
|
|||||||
{
|
{
|
||||||
Track *track = getTrack(ident);
|
Track *track = getTrack(ident);
|
||||||
if (track == NULL)
|
if (track == NULL)
|
||||||
{
|
Log::fatal("TrackManager", "There is no track named '%s'!!", ident.c_str());
|
||||||
fprintf(stderr, "[TrackManager] ERROR: There is no track named '%s'!!\n", ident.c_str());
|
|
||||||
assert(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (track->isInternal()) return;
|
if (track->isInternal()) return;
|
||||||
|
|
||||||
std::vector<Track*>::iterator it = std::find(m_tracks.begin(),
|
std::vector<Track*>::iterator it = std::find(m_tracks.begin(),
|
||||||
m_tracks.end(), track);
|
m_tracks.end(), track);
|
||||||
if (it == m_tracks.end())
|
if (it == m_tracks.end())
|
||||||
{
|
Log::fatal("TrackManager", "Cannot find track '%s' in map!!", ident.c_str());
|
||||||
fprintf(stderr, "[TrackManager] INTERNAL ERROR: Cannot find track '%s' in map!!\n", ident.c_str());
|
|
||||||
assert(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int index = it - m_tracks.begin();
|
int index = it - m_tracks.begin();
|
||||||
|
|
||||||
// Remove the track from all groups it belongs to
|
// Remove the track from all groups it belongs to
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user