Merge remote-tracking branch 'origin/master' into new_server
This commit is contained in:
commit
ba990318d1
@ -1,7 +1,7 @@
|
||||
|
||||
<supertuxkart_grand_prix name="Off the beaten track">
|
||||
|
||||
<track id="jungle" laps="3" reverse="false" />
|
||||
<track id="30_chocolate" laps="3" reverse="false" />
|
||||
<track id="snowmountain" laps="3" reverse="false" />
|
||||
<track id="hacienda" laps="3" reverse="false" />
|
||||
<track id="zengarden" laps="4" reverse="false" />
|
||||
|
@ -11,10 +11,13 @@
|
||||
<textbox id="textfield" width="75%" I18N="In the 'add new grand prix' dialog" align="center"/>
|
||||
|
||||
<spacer height="20" width="20" />
|
||||
|
||||
<button id="cancel" I18N="In the 'add new grand prix' dialog" text="Press ESC to cancel" align="center"/>
|
||||
|
||||
|
||||
<div width="100%" height="60" layout="horizontal-row">
|
||||
<button id="accept" I18N="In the 'add new grand prix' dialog" text="Create" align="center" proportion="1"/>
|
||||
<spacer height="15" width="20" />
|
||||
|
||||
<button id="cancel" I18N="In the 'add new grand prix' dialog" text="Cancel" align="center" proportion="1"/>
|
||||
<spacer height="15" width="20" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</stkgui>
|
||||
|
@ -22,10 +22,10 @@
|
||||
<div id="search_div" height="fit" width="100%" layout="vertical-row">
|
||||
<spacer width="10" height="10"/>
|
||||
<box height="fit" width="100%" layout="vertical-row">
|
||||
<label height="fit" text_align="left" I18N="In the profile screen" text="Look for more friends:"/>
|
||||
<label text_align="left" I18N="In the profile screen" text="Look for more friends:"/>
|
||||
<spacer width="10" height="10"/>
|
||||
<div height="fit" width="100%" layout="horizontal-row" align="center">
|
||||
<textbox id="search_box" proportion="1" height="fit"/>
|
||||
<textbox id="search_box" proportion="1"/>
|
||||
<spacer width="10" height="100%"/>
|
||||
<button id="search_button" height="100%" width="fit" text="Search" />
|
||||
</div>
|
||||
|
@ -1,6 +1,6 @@
|
||||
uniform int idx;
|
||||
|
||||
in vec3 Position;
|
||||
layout(location = 0) in vec3 Position;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
|
@ -1,5 +1,13 @@
|
||||
uniform mat4 ModelMatrix;
|
||||
uniform mat4 InverseModelMatrix;
|
||||
uniform mat4 ModelMatrix =
|
||||
mat4(1., 0., 0., 0.,
|
||||
0., 1., 0., 0.,
|
||||
0., 0., 1., 0.,
|
||||
0., 0., 0., 1.);
|
||||
uniform mat4 InverseModelMatrix =
|
||||
mat4(1., 0., 0., 0.,
|
||||
0., 1., 0., 0.,
|
||||
0., 0., 1., 0.,
|
||||
0., 0., 0., 1.);
|
||||
|
||||
uniform mat4 TextureMatrix =
|
||||
mat4(1., 0., 0., 0.,
|
||||
|
@ -7,5 +7,5 @@ vec3 SpecularIBL(vec3 normal, vec3 V, float roughness)
|
||||
|
||||
// Assume 8 level of lod (ie 256x256 texture)
|
||||
float lodval = 8. * (1. - roughness);
|
||||
return max(textureLod(probe, sampleDirection, lodval).rgb, vec3(0.));
|
||||
}
|
||||
return clamp( textureLod(probe, sampleDirection, lodval).rgb, 0., 1.);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Modify this file to change the last-modified date when you add/remove a file.
|
||||
# This will then trigger a new cmake run automatically.
|
||||
# This will then trigger a new cmake run automatically.
|
||||
file(GLOB_RECURSE STK_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.hpp")
|
||||
file(GLOB_RECURSE STK_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp")
|
||||
file(GLOB_RECURSE STK_SHADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "data/shaders/*")
|
||||
|
@ -260,6 +260,9 @@ GLuint generateSpecularCubemap(GLuint probe)
|
||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGBA16F, cubemap_size, cubemap_size, 0, GL_BGRA, GL_FLOAT, 0);
|
||||
glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
|
||||
|
||||
if (!UserConfigParams::m_dynamic_lights)
|
||||
return cubemap_texture;
|
||||
|
||||
GLuint fbo;
|
||||
glGenFramebuffers(1, &fbo);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
||||
|
@ -275,12 +275,12 @@ void draw3DLine(const core::vector3df& start,
|
||||
end.X, end.Y, end.Z
|
||||
};
|
||||
|
||||
glBindVertexArray(UtilShader::ColoredLine::vao);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, UtilShader::ColoredLine::vbo);
|
||||
glBindVertexArray(UtilShader::ColoredLine::getInstance()->vao);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, UtilShader::ColoredLine::getInstance()->vbo);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, 0, 6 * sizeof(float), vertex);
|
||||
|
||||
glUseProgram(UtilShader::ColoredLine::Program);
|
||||
UtilShader::ColoredLine::setUniforms(color);
|
||||
glUseProgram(UtilShader::ColoredLine::getInstance()->Program);
|
||||
UtilShader::ColoredLine::getInstance()->setUniforms(color);
|
||||
glDrawArrays(GL_LINES, 0, 2);
|
||||
|
||||
glGetError();
|
||||
|
@ -607,6 +607,14 @@ void IrrDriver::initDevice()
|
||||
{
|
||||
Log::info("irr_driver", "GLSL supported.");
|
||||
}
|
||||
|
||||
if (!supportGeometryShader())
|
||||
{
|
||||
// these options require geometry shaders
|
||||
UserConfigParams::m_shadows = 0;
|
||||
UserConfigParams::m_gi = false;
|
||||
}
|
||||
|
||||
// m_glsl might be reset in rtt if an error occurs.
|
||||
if(m_glsl)
|
||||
{
|
||||
@ -1392,7 +1400,7 @@ scene::ISceneNode *IrrDriver::addSkyBox(const std::vector<video::ITexture*> &tex
|
||||
SphericalHarmonicsTextures = sphericalHarmonics;
|
||||
SkyboxCubeMap = 0;
|
||||
SkyboxSpecularProbe = 0;
|
||||
m_SH_dirty = true;
|
||||
m_skybox_ready = false;
|
||||
return m_scene_manager->addSkyBoxSceneNode(texture[0], texture[1],
|
||||
texture[2], texture[3],
|
||||
texture[4], texture[5]);
|
||||
@ -1402,7 +1410,7 @@ void IrrDriver::suppressSkyBox()
|
||||
{
|
||||
SkyboxTextures.clear();
|
||||
SphericalHarmonicsTextures.clear();
|
||||
m_SH_dirty = true;
|
||||
m_skybox_ready = false;
|
||||
if ((SkyboxCubeMap) && (!ProfileWorld::isNoGraphics()))
|
||||
{
|
||||
glDeleteTextures(1, &SkyboxCubeMap);
|
||||
@ -1788,7 +1796,7 @@ void IrrDriver::onUnloadWorld()
|
||||
void IrrDriver::setAmbientLight(const video::SColorf &light)
|
||||
{
|
||||
m_scene_manager->setAmbientLight(light);
|
||||
m_SH_dirty = true;
|
||||
m_skybox_ready = false;
|
||||
} // setAmbientLight
|
||||
|
||||
video::SColorf IrrDriver::getAmbientLight() const
|
||||
|
@ -236,7 +236,7 @@ private:
|
||||
|
||||
std::vector<video::ITexture *> SkyboxTextures;
|
||||
std::vector<video::ITexture *> SphericalHarmonicsTextures;
|
||||
bool m_SH_dirty;
|
||||
bool m_skybox_ready;
|
||||
|
||||
float blueSHCoeff[9];
|
||||
float greenSHCoeff[9];
|
||||
@ -293,6 +293,21 @@ public:
|
||||
return m_support_texture_compression;
|
||||
}
|
||||
|
||||
bool supportGeometryShader() const
|
||||
{
|
||||
return getGLSLVersion() >= 330;
|
||||
}
|
||||
|
||||
bool usesShadows() const
|
||||
{
|
||||
return supportGeometryShader() && UserConfigParams::m_shadows && !needUBOWorkaround();
|
||||
}
|
||||
|
||||
bool usesGI() const
|
||||
{
|
||||
return supportGeometryShader() && UserConfigParams::m_gi && !needUBOWorkaround();
|
||||
}
|
||||
|
||||
bool usesTextureCompression() const
|
||||
{
|
||||
return UserConfigParams::m_texture_compression && m_support_texture_compression;
|
||||
@ -455,7 +470,7 @@ public:
|
||||
void getOpenGLData(std::string *vendor, std::string *renderer,
|
||||
std::string *version);
|
||||
|
||||
void generateSkyboxCubemap();
|
||||
void prepareSkybox();
|
||||
void generateDiffuseCoefficients();
|
||||
void renderSkybox(const scene::ICameraSceneNode *camera);
|
||||
void setPhase(STKRenderingPass);
|
||||
|
@ -867,7 +867,10 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode, boo
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("- Motion blur", 0xFF, 0x00, 0x00);
|
||||
ScopedGPUTimer Timer(irr_driver->getGPUTimer(Q_MOTIONBLUR));
|
||||
if (isRace && UserConfigParams::m_motionblur && World::getWorld() != NULL) // motion blur
|
||||
MotionBlurProvider * const cb = (MotionBlurProvider *)irr_driver->
|
||||
getCallback(ES_MOTIONBLUR);
|
||||
|
||||
if (isRace && UserConfigParams::m_motionblur && World::getWorld() != NULL && cb->getBoostTime(0) > 0.) // motion blur
|
||||
{
|
||||
renderMotionBlur(0, *in_fbo, *out_fbo);
|
||||
std::swap(in_fbo, out_fbo);
|
||||
|
@ -176,7 +176,11 @@ void IrrDriver::renderGLSL(float dt)
|
||||
irr_driver->getSceneManager()->setAmbientLight(SColor(0, 0, 0, 0));
|
||||
|
||||
// TODO: put this outside of the rendering loop
|
||||
generateDiffuseCoefficients();
|
||||
if (!m_skybox_ready)
|
||||
{
|
||||
prepareSkybox();
|
||||
m_skybox_ready = true;
|
||||
}
|
||||
if (!UserConfigParams::m_dynamic_lights)
|
||||
glEnable(GL_FRAMEBUFFER_SRGB);
|
||||
|
||||
@ -191,10 +195,10 @@ void IrrDriver::renderGLSL(float dt)
|
||||
// Render bounding boxes
|
||||
if (irr_driver->getBoundingBoxesViz())
|
||||
{
|
||||
glUseProgram(UtilShader::ColoredLine::Program);
|
||||
glBindVertexArray(UtilShader::ColoredLine::vao);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, UtilShader::ColoredLine::vbo);
|
||||
UtilShader::ColoredLine::setUniforms(SColor(255, 255, 0, 0));
|
||||
glUseProgram(UtilShader::ColoredLine::getInstance()->Program);
|
||||
glBindVertexArray(UtilShader::ColoredLine::getInstance()->vao);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, UtilShader::ColoredLine::getInstance()->vbo);
|
||||
UtilShader::ColoredLine::getInstance()->setUniforms(SColor(255, 255, 0, 0));
|
||||
const float *tmp = BoundingBoxes.data();
|
||||
for (unsigned int i = 0; i < BoundingBoxes.size(); i += 1024 * 6)
|
||||
{
|
||||
@ -220,13 +224,12 @@ void IrrDriver::renderGLSL(float dt)
|
||||
const std::map<video::SColor, std::vector<float> >& lines = debug_drawer->getLines();
|
||||
std::map<video::SColor, std::vector<float> >::const_iterator it;
|
||||
|
||||
|
||||
glUseProgram(UtilShader::ColoredLine::Program);
|
||||
glBindVertexArray(UtilShader::ColoredLine::vao);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, UtilShader::ColoredLine::vbo);
|
||||
glUseProgram(UtilShader::ColoredLine::getInstance()->Program);
|
||||
glBindVertexArray(UtilShader::ColoredLine::getInstance()->vao);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, UtilShader::ColoredLine::getInstance()->vbo);
|
||||
for (it = lines.begin(); it != lines.end(); it++)
|
||||
{
|
||||
UtilShader::ColoredLine::setUniforms(it->first);
|
||||
UtilShader::ColoredLine::getInstance()->setUniforms(it->first);
|
||||
const std::vector<float> &vertex = it->second;
|
||||
const float *tmp = vertex.data();
|
||||
for (unsigned int i = 0; i < vertex.size(); i += 1024 * 6)
|
||||
@ -349,12 +352,12 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
|
||||
// To avoid wrong culling, use the largest view possible
|
||||
m_scene_manager->setActiveCamera(m_suncam);
|
||||
if (UserConfigParams::m_dynamic_lights &&
|
||||
UserConfigParams::m_shadows && !irr_driver->needUBOWorkaround() && hasShadow)
|
||||
UserConfigParams::m_shadows && irr_driver->usesShadows() && hasShadow)
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("- Shadow", 0x30, 0x6F, 0x90);
|
||||
renderShadows();
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
if (UserConfigParams::m_gi)
|
||||
if (irr_driver->usesGI())
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("- RSM", 0xFF, 0x0, 0xFF);
|
||||
renderRSM();
|
||||
@ -964,12 +967,12 @@ void IrrDriver::computeCameraMatrix(scene::ICameraSceneNode * const camnode, siz
|
||||
|
||||
static void renderWireFrameFrustrum(float *tmp, unsigned i)
|
||||
{
|
||||
glUseProgram(MeshShader::ViewFrustrumShader::Program);
|
||||
glBindVertexArray(MeshShader::ViewFrustrumShader::frustrumvao);
|
||||
glUseProgram(MeshShader::ViewFrustrumShader::getInstance()->Program);
|
||||
glBindVertexArray(MeshShader::ViewFrustrumShader::getInstance()->frustrumvao);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, SharedObject::frustrumvbo);
|
||||
|
||||
glBufferSubData(GL_ARRAY_BUFFER, 0, 8 * 3 * sizeof(float), (void *)tmp);
|
||||
MeshShader::ViewFrustrumShader::setUniforms(video::SColor(255, 0, 255, 0), i);
|
||||
MeshShader::ViewFrustrumShader::getInstance()->setUniforms(video::SColor(255, 0, 255, 0), i);
|
||||
glDrawElements(GL_LINES, 24, GL_UNSIGNED_INT, 0);
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ void IrrDriver::renderLights(unsigned pointlightcount, bool hasShadow)
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
m_rtts->getFBO(FBO_DIFFUSE).Bind();
|
||||
if (UserConfigParams::m_gi && UserConfigParams::m_shadows && hasShadow)
|
||||
if (irr_driver->usesGI() && hasShadow)
|
||||
{
|
||||
ScopedGPUTimer timer(irr_driver->getGPUTimer(Q_GI));
|
||||
m_post_processing->renderGI(rh_matrix, rh_extend, m_rtts->getRH().getRTT()[0], m_rtts->getRH().getRTT()[1], m_rtts->getRH().getRTT()[2]);
|
||||
@ -162,7 +162,7 @@ void IrrDriver::renderLights(unsigned pointlightcount, bool hasShadow)
|
||||
if (!World::getWorld() || World::getWorld()->getTrack()->hasShadows())
|
||||
{
|
||||
ScopedGPUTimer timer(irr_driver->getGPUTimer(Q_SUN));
|
||||
if (World::getWorld() && UserConfigParams::m_shadows && !irr_driver->needUBOWorkaround() && hasShadow)
|
||||
if (World::getWorld() && irr_driver->usesShadows() && hasShadow)
|
||||
m_post_processing->renderShadowedSunlight(irr_driver->getSunDirection(), irr_driver->getSunColor(), sun_ortho_matrix, m_rtts->getShadowFBO().getRTT()[0]);
|
||||
else
|
||||
m_post_processing->renderSunlight(irr_driver->getSunDirection(), irr_driver->getSunColor());
|
||||
|
@ -274,20 +274,20 @@ GLuint generateCubeMapFromTextures(const std::vector<video::ITexture *> &texture
|
||||
return result;
|
||||
}
|
||||
|
||||
void IrrDriver::generateSkyboxCubemap()
|
||||
void IrrDriver::prepareSkybox()
|
||||
{
|
||||
glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
|
||||
|
||||
assert(SkyboxTextures.size() == 6);
|
||||
SkyboxCubeMap = generateCubeMapFromTextures(SkyboxTextures);
|
||||
SkyboxSpecularProbe = generateSpecularCubemap(SkyboxCubeMap);
|
||||
generateDiffuseCoefficients();
|
||||
if (!SkyboxTextures.empty())
|
||||
{
|
||||
SkyboxCubeMap = generateCubeMapFromTextures(SkyboxTextures);
|
||||
SkyboxSpecularProbe = generateSpecularCubemap(SkyboxCubeMap);
|
||||
}
|
||||
}
|
||||
|
||||
void IrrDriver::generateDiffuseCoefficients()
|
||||
{
|
||||
if (!m_SH_dirty)
|
||||
return;
|
||||
m_SH_dirty = false;
|
||||
const unsigned texture_permutation[] = { 2, 3, 0, 1, 5, 4 };
|
||||
|
||||
unsigned sh_w = 0, sh_h = 0;
|
||||
@ -379,8 +379,6 @@ void IrrDriver::renderSkybox(const scene::ICameraSceneNode *camera)
|
||||
{
|
||||
if (SkyboxTextures.empty())
|
||||
return;
|
||||
if (!SkyboxCubeMap)
|
||||
generateSkyboxCubemap();
|
||||
glBindVertexArray(MeshShader::SkyboxShader::getInstance()->cubevao);
|
||||
glDisable(GL_CULL_FACE);
|
||||
assert(SkyboxTextures.size() == 6);
|
||||
|
@ -528,8 +528,6 @@ void Shaders::loadShaders()
|
||||
initFrustrumVBO();
|
||||
initShadowVPMUBO();
|
||||
initParticleQuadVBO();
|
||||
MeshShader::ViewFrustrumShader::init();
|
||||
UtilShader::ColoredLine::init();
|
||||
}
|
||||
|
||||
void Shaders::killShaders()
|
||||
@ -580,33 +578,23 @@ void bypassUBO(GLuint Program)
|
||||
|
||||
namespace UtilShader
|
||||
{
|
||||
GLuint ColoredLine::Program;
|
||||
GLuint ColoredLine::uniform_color;
|
||||
GLuint ColoredLine::vao;
|
||||
GLuint ColoredLine::vbo;
|
||||
|
||||
void ColoredLine::init()
|
||||
ColoredLine::ColoredLine()
|
||||
{
|
||||
Program = LoadProgram(OBJECT,
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/object_pass.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/coloredquad.frag").c_str());
|
||||
|
||||
AssignUniforms("color");
|
||||
|
||||
glGenVertexArrays(1, &vao);
|
||||
glBindVertexArray(vao);
|
||||
glGenBuffers(1, &vbo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, 6 * 1024 * sizeof(float), 0, GL_DYNAMIC_DRAW);
|
||||
GLuint attrib_position = glGetAttribLocation(Program, "Position");
|
||||
glEnableVertexAttribArray(attrib_position);
|
||||
glVertexAttribPointer(attrib_position, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), 0);
|
||||
uniform_color = glGetUniformLocation(Program, "color");
|
||||
}
|
||||
|
||||
void ColoredLine::setUniforms(const irr::video::SColor &col)
|
||||
{
|
||||
if (irr_driver->needUBOWorkaround())
|
||||
bypassUBO(Program);
|
||||
glUniform4i(uniform_color, col.getRed(), col.getGreen(), col.getBlue(), col.getAlpha());
|
||||
glUniformMatrix4fv(glGetUniformLocation(Program, "ModelMatrix"), 1, GL_FALSE, core::IdentityMatrix.pointer());
|
||||
glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), 0);
|
||||
glBindVertexArray(0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
struct TexUnit
|
||||
@ -1399,36 +1387,22 @@ namespace MeshShader
|
||||
AssignUniforms("color");
|
||||
}
|
||||
|
||||
GLuint ViewFrustrumShader::Program;
|
||||
GLuint ViewFrustrumShader::attrib_position;
|
||||
GLuint ViewFrustrumShader::uniform_color;
|
||||
GLuint ViewFrustrumShader::uniform_idx;
|
||||
GLuint ViewFrustrumShader::frustrumvao;
|
||||
|
||||
void ViewFrustrumShader::init()
|
||||
ViewFrustrumShader::ViewFrustrumShader()
|
||||
{
|
||||
Program = LoadProgram(OBJECT,
|
||||
GL_VERTEX_SHADER, file_manager->getAsset("shaders/frustrum.vert").c_str(),
|
||||
GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/coloredquad.frag").c_str());
|
||||
attrib_position = glGetAttribLocation(Program, "Position");
|
||||
|
||||
uniform_color = glGetUniformLocation(Program, "color");
|
||||
uniform_idx = glGetUniformLocation(Program, "idx");
|
||||
AssignUniforms("color", "idx");
|
||||
|
||||
glGenVertexArrays(1, &frustrumvao);
|
||||
glBindVertexArray(frustrumvao);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, SharedObject::frustrumvbo);
|
||||
glEnableVertexAttribArray(attrib_position);
|
||||
glVertexAttribPointer(attrib_position, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), 0);
|
||||
glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), 0);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, SharedObject::frustrumindexes);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
void ViewFrustrumShader::setUniforms(const video::SColor &color, unsigned idx)
|
||||
{
|
||||
glUniform4i(uniform_color, color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha());
|
||||
glUniform1i(uniform_idx, idx);
|
||||
}
|
||||
}
|
||||
|
||||
namespace LightShader
|
||||
|
@ -38,15 +38,12 @@ public:
|
||||
|
||||
namespace UtilShader
|
||||
{
|
||||
class ColoredLine
|
||||
class ColoredLine : public ShaderHelperSingleton<ColoredLine, video::SColor>
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint uniform_color;
|
||||
static GLuint vao, vbo;
|
||||
GLuint vao, vbo;
|
||||
|
||||
static void init();
|
||||
static void setUniforms(const irr::video::SColor &);
|
||||
ColoredLine();
|
||||
};
|
||||
|
||||
class SpecularIBLGenerator : public ShaderHelperSingleton<SpecularIBLGenerator, core::matrix4, float >, public TextureRead<Trilinear_cubemap>
|
||||
@ -297,16 +294,12 @@ public:
|
||||
NormalVisualizer();
|
||||
};
|
||||
|
||||
class ViewFrustrumShader
|
||||
class ViewFrustrumShader : public ShaderHelperSingleton<ViewFrustrumShader, video::SColor, int>
|
||||
{
|
||||
public:
|
||||
static GLuint Program;
|
||||
static GLuint attrib_position;
|
||||
static GLuint uniform_color, uniform_idx;
|
||||
static GLuint frustrumvao;
|
||||
GLuint frustrumvao;
|
||||
|
||||
static void init();
|
||||
static void setUniforms(const video::SColor &color, unsigned idx);
|
||||
ViewFrustrumShader();
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -239,6 +239,18 @@ void LayoutManager::readCoords(Widget* self)
|
||||
}
|
||||
}
|
||||
|
||||
//Add padding to <box> elements
|
||||
if (self->getType() == WTYPE_DIV && self->m_show_bounding_box)
|
||||
{
|
||||
int padding = 15;
|
||||
if (self->m_properties[PROP_DIV_PADDING].length() > 0)
|
||||
padding = atoi(self->m_properties[PROP_DIV_PADDING].c_str());
|
||||
child_max_height += padding * 2;
|
||||
total_height += padding * 2;
|
||||
total_width += padding * 2;
|
||||
child_max_width = padding * 2;
|
||||
}
|
||||
|
||||
if (self->m_properties[PROP_WIDTH] == "fit")
|
||||
{
|
||||
self->m_absolute_w = (is_horizontal_row ? total_width : child_max_width);
|
||||
|
@ -1112,8 +1112,11 @@ void initRest()
|
||||
race_manager->setMinorMode (RaceManager::MINOR_MODE_NORMAL_RACE);
|
||||
race_manager->setDifficulty(
|
||||
(RaceManager::Difficulty)(int)UserConfigParams::m_difficulty);
|
||||
if(track_manager->getTrack(UserConfigParams::m_last_track))
|
||||
race_manager->setTrack(UserConfigParams::m_last_track);
|
||||
|
||||
if (!track_manager->getTrack(UserConfigParams::m_last_track))
|
||||
UserConfigParams::m_last_track.revertToDefaults();
|
||||
|
||||
race_manager->setTrack(UserConfigParams::m_last_track);
|
||||
|
||||
} // initRest
|
||||
|
||||
|
@ -740,14 +740,11 @@ void LinearWorld::updateRacePosition()
|
||||
#endif
|
||||
|
||||
// Switch on faster music if not already done so, if the
|
||||
// first kart is doing its last lap, and if the estimated
|
||||
// remaining time is less than 30 seconds.
|
||||
// first kart is doing its last lap.
|
||||
if(!m_faster_music_active &&
|
||||
kart_info.m_race_lap == race_manager->getNumLaps()-1 &&
|
||||
p==1 &&
|
||||
useFastMusicNearEnd() &&
|
||||
kart_info.m_estimated_finish > 0 &&
|
||||
kart_info.m_estimated_finish - getTime() < 30.0f )
|
||||
p == 1 &&
|
||||
kart_info.m_race_lap == race_manager->getNumLaps() - 1 &&
|
||||
useFastMusicNearEnd() )
|
||||
{
|
||||
music_manager->switchToFastMusic();
|
||||
m_faster_music_active=true;
|
||||
|
@ -106,6 +106,12 @@ void CustomVideoSettingsDialog::beforeAddingWidgets()
|
||||
cb_tex_cmp->setState(false);
|
||||
cb_tex_cmp->setDeactivated();
|
||||
}
|
||||
|
||||
if (!irr_driver->supportGeometryShader())
|
||||
{
|
||||
shadows->setDeactivated();
|
||||
getWidget<CheckBoxWidget>("global_illumination")->setDeactivated();
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -123,7 +129,7 @@ GUIEngine::EventPropagation CustomVideoSettingsDialog::processEvent(const std::s
|
||||
UserConfigParams::m_motionblur =
|
||||
advanced_pipeline && getWidget<CheckBoxWidget>("motionblur")->getState();
|
||||
|
||||
if (advanced_pipeline)
|
||||
if (advanced_pipeline && irr_driver->supportGeometryShader())
|
||||
{
|
||||
UserConfigParams::m_shadows =
|
||||
getWidget<SpinnerWidget>("shadows")->getValue();
|
||||
@ -143,7 +149,8 @@ GUIEngine::EventPropagation CustomVideoSettingsDialog::processEvent(const std::s
|
||||
advanced_pipeline && getWidget<CheckBoxWidget>("lightshaft")->getState();
|
||||
|
||||
UserConfigParams::m_gi =
|
||||
advanced_pipeline && getWidget<CheckBoxWidget>("global_illumination")->getState();
|
||||
advanced_pipeline && irr_driver->supportGeometryShader() &&
|
||||
getWidget<CheckBoxWidget>("global_illumination")->getState();
|
||||
|
||||
UserConfigParams::m_glow =
|
||||
advanced_pipeline && getWidget<CheckBoxWidget>("glow")->getState();
|
||||
@ -236,5 +243,11 @@ void CustomVideoSettingsDialog::updateActivation()
|
||||
getWidget<CheckBoxWidget>("glow")->setDeactivated();
|
||||
getWidget<CheckBoxWidget>("bloom")->setDeactivated();
|
||||
}
|
||||
|
||||
if (!irr_driver->supportGeometryShader())
|
||||
{
|
||||
getWidget<SpinnerWidget>("shadows")->setDeactivated();
|
||||
getWidget<CheckBoxWidget>("global_illumination")->setDeactivated();
|
||||
}
|
||||
} // updateActivation
|
||||
|
||||
|
@ -62,6 +62,10 @@ GUIEngine::EventPropagation EnterGPNameDialog::processEvent(const std::string& e
|
||||
dismiss();
|
||||
return GUIEngine::EVENT_BLOCK;
|
||||
}
|
||||
else if (eventSource == "accept")
|
||||
{
|
||||
validateName();
|
||||
}
|
||||
return GUIEngine::EVENT_LET;
|
||||
}
|
||||
|
||||
@ -77,7 +81,39 @@ void EnterGPNameDialog::onEnterPressedInternal()
|
||||
return;
|
||||
}
|
||||
|
||||
//Otherwise, see if we can accept the new name
|
||||
//Otherwise, see if we can accept the new name and create the grand prix
|
||||
validateName();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void EnterGPNameDialog::onUpdate(float dt)
|
||||
{
|
||||
// It's unsafe to delete from inside the event handler so we do it here
|
||||
if (m_self_destroy)
|
||||
{
|
||||
TextBoxWidget* textCtrl = getWidget<TextBoxWidget>("textfield");
|
||||
stringw name = textCtrl->getText().trim();
|
||||
|
||||
// irrLicht is too stupid to remove focus from deleted widgets
|
||||
// so do it by hand
|
||||
GUIEngine::getGUIEnv()->removeFocus( textCtrl->getIrrlichtElement() );
|
||||
GUIEngine::getGUIEnv()->removeFocus( m_irrlicht_window );
|
||||
|
||||
// we will destroy the dialog before notifying the listener to be safer.
|
||||
// but in order not to crash we must make a local copy of the listern
|
||||
// otherwise we will crash
|
||||
INewGPListener* listener = m_listener;
|
||||
|
||||
ModalDialog::dismiss();
|
||||
|
||||
if (listener != NULL)
|
||||
listener->onNewGPWithName(name);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void EnterGPNameDialog::validateName()
|
||||
{
|
||||
TextBoxWidget* textCtrl = getWidget<TextBoxWidget>("textfield");
|
||||
assert(textCtrl != NULL);
|
||||
LabelWidget* label = getWidget<LabelWidget>("title");
|
||||
@ -106,30 +142,5 @@ void EnterGPNameDialog::onEnterPressedInternal()
|
||||
// in onUpdate (which checks for m_self_destroy)
|
||||
m_self_destroy = true;
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void EnterGPNameDialog::onUpdate(float dt)
|
||||
{
|
||||
// It's unsafe to delete from inside the event handler so we do it here
|
||||
if (m_self_destroy)
|
||||
{
|
||||
TextBoxWidget* textCtrl = getWidget<TextBoxWidget>("textfield");
|
||||
stringw name = textCtrl->getText().trim();
|
||||
|
||||
// irrLicht is too stupid to remove focus from deleted widgets
|
||||
// so do it by hand
|
||||
GUIEngine::getGUIEnv()->removeFocus( textCtrl->getIrrlichtElement() );
|
||||
GUIEngine::getGUIEnv()->removeFocus( m_irrlicht_window );
|
||||
|
||||
// we will destroy the dialog before notifying the listener to be safer.
|
||||
// but in order not to crash we must make a local copy of the listern
|
||||
// otherwise we will crash
|
||||
INewGPListener* listener = m_listener;
|
||||
|
||||
ModalDialog::dismiss();
|
||||
|
||||
if (listener != NULL)
|
||||
listener->onNewGPWithName(name);
|
||||
}
|
||||
}
|
||||
}
|
@ -62,8 +62,8 @@ public:
|
||||
~EnterGPNameDialog();
|
||||
|
||||
void onEnterPressedInternal();
|
||||
void validateName();
|
||||
GUIEngine::EventPropagation processEvent(const std::string& eventSource);
|
||||
|
||||
virtual void onUpdate(float dt);
|
||||
};
|
||||
|
||||
|
@ -722,7 +722,8 @@ void KartSelectionScreen::playerConfirm(const int player_id)
|
||||
UserConfigParams::m_default_kart = selection;
|
||||
}
|
||||
|
||||
if (m_kart_widgets[player_id].getKartInternalName().size() == 0)
|
||||
if (m_kart_widgets[player_id].getKartInternalName().size() == 0 ||
|
||||
m_kart_widgets[player_id].getKartInternalName() == RibbonWidget::NO_ITEM_ID)
|
||||
{
|
||||
SFXManager::get()->quickSound( "anvil" );
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user