Merge branch 'Flakebi-master'

This commit is contained in:
hiker 2014-06-05 09:52:43 +10:00
commit 67c6e1b61e
44 changed files with 1524 additions and 1478 deletions

View File

@ -237,8 +237,10 @@ when the border that intersect at this corner are enabled.
<!-- Text field color -->
<color type="text_field" state="background" a="255" r="200" g="200" b="200" />
<color type="text_field" state="background_focused" a="255" r="223" g="238" b="248" />
<color type="text_field" state="background_deactivated" a="255" r="200" g="200" b="200" />
<color type="text_field" state="neutral" a="255" r="138" g="138" b="138" />
<color type="text_field" state="focused" a="255" r="42" g="169" b="211" />
<color type="text_field" state="deactivated" a="255" r="138" g="138" b="138" />
<!-- Rating star image -->
<element type="rating" state="neutral" image="ocean/rating_star.png" />

View File

@ -235,8 +235,10 @@ when the border that intersect at this corner are enabled.
<!-- Text field color -->
<color type="text_field" state="background" a="255" r="200" g="200" b="200" />
<color type="text_field" state="background_focused" a="255" r="236" g="226" b="201" />
<color type="text_field" state="background_deactivated" a="255" r="200" g="200" b="200" />
<color type="text_field" state="neutral" a="255" r="138" g="138" b="138" />
<color type="text_field" state="focused" a="255" r="243" g="164" b="80" />
<color type="text_field" state="deactivated" a="255" r="138" g="138" b="138" />
<!-- Rating star image -->
<element type="rating" state="neutral" image="peach/rating_star.png" />

View File

@ -268,7 +268,7 @@ void PlayerManager::save()
if(m_current_player && UserConfigParams::m_remember_user)
{
players_file << L" <current player=\""
players_file << L" <current player=\""
<< m_current_player->getName() << L"\"/>\n";
}
@ -468,7 +468,7 @@ PlayerProfile *PlayerManager::getPlayer(const irr::core::stringw &name)
} // getPlayer
// ----------------------------------------------------------------------------
/** Sets the current player. This is the player that is used for story mode
* and achievements.
* and achievements.
* \param Player profile to be the current player.
*/
void PlayerManager::setCurrentPlayer(PlayerProfile *player)

View File

@ -31,7 +31,7 @@
class AchievementsStatus;
namespace Online
namespace Online
{
class CurrentUser;
class HTTPRequest;
@ -42,10 +42,10 @@ class PlayerProfile;
/** A special class that manages all local player accounts. It reads all player
* accounts from the players.xml file in the user config directory. For each
* player an instance of PlayerProfile is created, which keeps track of
* player an instance of PlayerProfile is created, which keeps track of
* story mode progress, achievements and other data. It also keeps track of
* the currently logged in player.
* It includes several handy static functions which avoid long call
* It includes several handy static functions which avoid long call
* sequences, e.g.:
* PlayerManager::getCurrentOnlineId()
* which is just:
@ -116,9 +116,9 @@ public:
// ------------------------------------------------------------------------
/** Returns the current player. */
static PlayerProfile* getCurrentPlayer()
static PlayerProfile* getCurrentPlayer()
{
return get()->m_current_player;
return get()->m_current_player;
} // getCurrentPlayer
// ------------------------------------------------------------------------

View File

@ -61,7 +61,7 @@ PlayerProfile::PlayerProfile(const core::stringw& name, bool is_guest)
* as soon as the network thread is started) to avoid the player having to
* wait for the login to finish , which needs the main player data (i.e.
* the default player, and saved session data). So the constructor only
* reads this data, the rest of the player data is handled in
* reads this data, the rest of the player data is handled in
* loadRemainingData later in the initialisation process.
* \param node The XML node representing this player.
*/
@ -156,7 +156,7 @@ void PlayerProfile::addIcon()
// followed by .png or .jpg.
std::ostringstream out;
out << m_unique_id <<"."<<StringUtils::getExtension(source);
if(file_manager->copyFile(source,
if(file_manager->copyFile(source,
file_manager->getUserConfigFile(out.str())) )
{
m_icon_filename = out.str();
@ -172,7 +172,7 @@ void PlayerProfile::addIcon()
* file is undefined, it returns a "?" mark texture. Note, getAsset does
* not return a reference, but only a temporary string. So we must return a
* copy of the string (not a reference to).
*/
*/
const std::string PlayerProfile::getIconFilename() const
{
// If the icon file is undefined or does not exist, return the "?" icon
@ -200,7 +200,7 @@ void PlayerProfile::save(UTFWriter &out)
out << L" unique-id=\"" << m_unique_id
<< L"\" saved-session=\"" << m_saved_session << L"\"\n";
out << L" saved-user=\"" << m_saved_user_id
out << L" saved-user=\"" << m_saved_user_id
<< L"\" saved-token=\"" << m_saved_token << L"\"\n";
out << L" last-online-name=\"" << m_last_online_name
<< L"\" last-was-online=\"" << m_last_was_online<< L"\">\n";

View File

@ -32,7 +32,7 @@ using namespace irr;
class AchievementsStatus;
namespace Online
{
class CurrentUser;
class CurrentUser;
class HTTPRequest;
class OnlineProfile;
class XMLRequest;
@ -167,9 +167,9 @@ public:
} // isGuestAccount
// ------------------------------------------------------------------------
/** Returns the last used online name. */
const core::stringw& getLastOnlineName() const
const core::stringw& getLastOnlineName() const
{
return m_last_online_name;
return m_last_online_name;
} // getLastOnlineName
// ------------------------------------------------------------------------
/** Sets the last used online name. */
@ -250,7 +250,7 @@ public:
// ------------------------------------------------------------------------
/** If a session was saved, return the id of the saved user. */
int getSavedUserId() const
{
{
assert(m_saved_session);
return m_saved_user_id;
} // getSavedUserId

View File

@ -346,7 +346,7 @@ void Camera::smoothMoveCamera(float dt)
if ((m_kart->getSpeed() > 5 ) || (m_kart->getSpeed() < 0 ))
{
current_position += ((wanted_position - current_position) * dt
current_position += ((wanted_position - current_position) * dt
* (m_kart->getSpeed()>0 ? m_kart->getSpeed()/3 + 1.0f
: -1.5f * m_kart->getSpeed() + 2.0f));
}

File diff suppressed because it is too large Load Diff

View File

@ -1,232 +1,232 @@
#ifndef GLWRAP_HEADER_H
#define GLWRAP_HEADER_H
#if defined(__APPLE__)
# include <OpenGL/gl.h>
# include <OpenGL/gl3.h>
# define OGL32CTX
# ifdef GL_ARB_instanced_arrays
# define glVertexAttribDivisor glVertexAttribDivisorARB
# endif
# ifndef GL_TEXTURE_SWIZZLE_RGBA
# define GL_TEXTURE_SWIZZLE_RGBA 0x8E46
# endif
#elif defined(ANDROID)
# include <GLES/gl.h>
#elif defined(WIN32)
# define _WINSOCKAPI_
// has to be included before gl.h because of WINGDIAPI and APIENTRY definitions
# include <windows.h>
# include <GL/gl.h>
#else
#define GL_GLEXT_PROTOTYPES
#define DEBUG_OUTPUT_DECLARED
# include <GL/gl.h>
#endif
#include <vector>
#include "utils/log.hpp"
// already includes glext.h, which defines useful GL constants.
// COpenGLDriver has already loaded the extension GL functions we use (e.g glBeginQuery)
#include "../../lib/irrlicht/source/Irrlicht/COpenGLDriver.h"
#ifdef WIN32
extern PFNGLGENTRANSFORMFEEDBACKSPROC glGenTransformFeedbacks;
extern PFNGLBINDTRANSFORMFEEDBACKPROC glBindTransformFeedback;
extern PFNGLDRAWTRANSFORMFEEDBACKPROC glDrawTransformFeedback;
extern PFNGLBEGINTRANSFORMFEEDBACKPROC glBeginTransformFeedback;
extern PFNGLENDTRANSFORMFEEDBACKPROC glEndTransformFeedback;
extern PFNGLTRANSFORMFEEDBACKVARYINGSPROC glTransformFeedbackVaryings;
extern PFNGLBINDBUFFERBASEPROC glBindBufferBase;
extern PFNGLGENBUFFERSPROC glGenBuffers;
extern PFNGLBINDBUFFERPROC glBindBuffer;
extern PFNGLBUFFERDATAPROC glBufferData;
extern PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer;
extern PFNGLCREATESHADERPROC glCreateShader;
extern PFNGLCOMPILESHADERPROC glCompileShader;
extern PFNGLSHADERSOURCEPROC glShaderSource;
extern PFNGLCREATEPROGRAMPROC glCreateProgram;
extern PFNGLATTACHSHADERPROC glAttachShader;
extern PFNGLLINKPROGRAMPROC glLinkProgram;
extern PFNGLUSEPROGRAMPROC glUseProgram;
extern PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray;
extern PFNGLDISABLEVERTEXATTRIBARRAYPROC glDisableVertexAttribArray;
extern PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation;
extern PFNGLUNIFORMMATRIX4FVPROC glUniformMatrix4fv;
extern PFNGLUNIFORM1FPROC glUniform1f;
extern PFNGLUNIFORM3FPROC glUniform3f;
extern PFNGLUNIFORM1FVPROC glUniform1fv;
extern PFNGLUNIFORM4FVPROC glUniform4fv;
extern PFNGLDELETESHADERPROC glDeleteShader;
extern PFNGLGETSHADERIVPROC glGetShaderiv;
extern PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog;
extern PFNGLACTIVETEXTUREPROC glActiveTexture;
extern PFNGLUNIFORM2FPROC glUniform2f;
extern PFNGLUNIFORM1IPROC glUniform1i;
extern PFNGLUNIFORM3IPROC glUniform3i;
extern PFNGLUNIFORM4IPROC glUniform4i;
extern PFNGLGETPROGRAMIVPROC glGetProgramiv;
extern PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog;
extern PFNGLGETATTRIBLOCATIONPROC glGetAttribLocation;
extern PFNGLBLENDEQUATIONPROC glBlendEquation;
extern PFNGLVERTEXATTRIBDIVISORPROC glVertexAttribDivisor;
extern PFNGLDRAWARRAYSINSTANCEDPROC glDrawArraysInstanced;
extern PFNGLDRAWELEMENTSINSTANCEDPROC glDrawElementsInstanced;
extern PFNGLDELETEBUFFERSPROC glDeleteBuffers;
extern PFNGLGENVERTEXARRAYSPROC glGenVertexArrays;
extern PFNGLBINDVERTEXARRAYPROC glBindVertexArray;
extern PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays;
extern PFNGLTEXBUFFERPROC glTexBuffer;
extern PFNGLBUFFERSUBDATAPROC glBufferSubData;
extern PFNGLVERTEXATTRIBIPOINTERPROC glVertexAttribIPointer;
extern PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers;
extern PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers;
extern PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer;
extern PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D;
extern PFNGLFRAMEBUFFERTEXTUREPROC glFramebufferTexture;
extern PFNGLTEXIMAGE3DPROC glTexImage3D;
extern PFNGLGENERATEMIPMAPPROC glGenerateMipmap;
extern PFNGLCHECKFRAMEBUFFERSTATUSPROC glCheckFramebufferStatus;
extern PFNGLTEXIMAGE2DMULTISAMPLEPROC glTexImage2DMultisample;
extern PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer;
extern PFNGLGETUNIFORMBLOCKINDEXPROC glGetUniformBlockIndex;
extern PFNGLUNIFORMBLOCKBINDINGPROC glUniformBlockBinding;
extern PFNGLBLENDCOLORPROC glBlendColor;
extern PFNGLCOMPRESSEDTEXIMAGE2DPROC glCompressedTexImage2D;
extern PFNGLGETCOMPRESSEDTEXIMAGEPROC glGetCompressedTexImage;
extern PFNGLTEXSTORAGE1DPROC glTexStorage1D;
extern PFNGLTEXSTORAGE2DPROC glTexStorage2D;
extern PFNGLTEXSTORAGE3DPROC glTexStorage3D;
#ifdef DEBUG
extern PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARB;
#endif
#endif
void initGL();
GLuint LoadTFBProgram(const char * vertex_file_path, const char **varyings, unsigned varyingscount);
void setTexture(unsigned TextureUnit, GLuint TextureId, GLenum MagFilter, GLenum MinFilter, bool allowAF = false);
GLuint LoadShader(const char * file, unsigned type);
template<typename ... Types>
void loadAndAttach(GLint ProgramID)
{
return;
}
template<typename ... Types>
void loadAndAttach(GLint ProgramID, GLint ShaderType, const char *filepath, Types ... args)
{
GLint ShaderID = LoadShader(filepath, ShaderType);
glAttachShader(ProgramID, ShaderID);
glDeleteShader(ShaderID);
loadAndAttach(ProgramID, args...);
}
template<typename ...Types>
void printFileList()
{
return;
}
template<typename ...Types>
void printFileList(GLint ShaderType, const char *filepath, Types ... args)
{
Log::error("GLWrapp", filepath);
printFileList(args...);
}
template<typename ... Types>
GLint LoadProgram(Types ... args)
{
GLint ProgramID = glCreateProgram();
loadAndAttach(ProgramID, args...);
glLinkProgram(ProgramID);
GLint Result = GL_FALSE;
int InfoLogLength;
glGetProgramiv(ProgramID, GL_LINK_STATUS, &Result);
if (Result == GL_FALSE) {
Log::error("GLWrapp", "Error when linking these shaders :");
printFileList(args...);
glGetProgramiv(ProgramID, GL_INFO_LOG_LENGTH, &InfoLogLength);
char *ErrorMessage = new char[InfoLogLength];
glGetProgramInfoLog(ProgramID, InfoLogLength, NULL, ErrorMessage);
Log::error("GLWrapp", ErrorMessage);
delete[] ErrorMessage;
}
GLenum glErr = glGetError();
if (glErr != GL_NO_ERROR)
{
Log::warn("IrrDriver", "GLWrap : OpenGL error %i\n", glErr);
}
return ProgramID;
}
class GPUTimer;
class ScopedGPUTimer
{
public:
ScopedGPUTimer(GPUTimer &);
~ScopedGPUTimer();
};
class GPUTimer
{
friend class ScopedGPUTimer;
GLuint query;
bool initialised;
public:
GPUTimer();
unsigned elapsedTimeus();
};
class FrameBuffer
{
private:
GLuint fbo;
std::vector<GLuint> RenderTargets;
GLuint DepthTexture;
size_t width, height;
public:
FrameBuffer();
FrameBuffer(const std::vector <GLuint> &RTTs, size_t w, size_t h, bool layered = false);
FrameBuffer(const std::vector <GLuint> &RTTs, GLuint DS, size_t w, size_t h, bool layered = false);
~FrameBuffer();
void Bind();
std::vector<GLuint> &getRTT() { return RenderTargets; }
GLuint &getDepthTexture() { assert(DepthTexture); return DepthTexture; }
size_t getWidth() const { return width; }
size_t getHeight() const { return height; }
static void Blit(const FrameBuffer &Src, FrameBuffer &Dst, GLbitfield mask = GL_COLOR_BUFFER_BIT, GLenum filter = GL_NEAREST);
void BlitToDefault(size_t, size_t, size_t, size_t);
};
// core::rect<s32> needs these includes
#include <rect.h>
#include "utils/vec3.hpp"
GLuint getTextureGLuint(irr::video::ITexture *tex);
GLuint getDepthTexture(irr::video::ITexture *tex);
void resetTextureTable();
void compressTexture(irr::video::ITexture *tex, bool srgb, bool premul_alpha = false);
bool loadCompressedTexture(const std::string& compressed_tex);
void saveCompressedTexture(const std::string& compressed_tex);
void draw3DLine(const core::vector3df& start,
const core::vector3df& end, irr::video::SColor color);
void draw2DImage(const irr::video::ITexture* texture, const irr::core::rect<s32>& destRect,
const irr::core::rect<s32>& sourceRect, const irr::core::rect<s32>* clipRect,
const irr::video::SColor &color, bool useAlphaChannelOfTexture);
void draw2DImage(const irr::video::ITexture* texture, const irr::core::rect<s32>& destRect,
const irr::core::rect<s32>& sourceRect, const irr::core::rect<s32>* clipRect,
const irr::video::SColor* const colors, bool useAlphaChannelOfTexture);
void GL32_draw2DRectangle(irr::video::SColor color, const irr::core::rect<s32>& position,
const irr::core::rect<s32>* clip = 0);
#endif
#ifndef GLWRAP_HEADER_H
#define GLWRAP_HEADER_H
#if defined(__APPLE__)
# include <OpenGL/gl.h>
# include <OpenGL/gl3.h>
# define OGL32CTX
# ifdef GL_ARB_instanced_arrays
# define glVertexAttribDivisor glVertexAttribDivisorARB
# endif
# ifndef GL_TEXTURE_SWIZZLE_RGBA
# define GL_TEXTURE_SWIZZLE_RGBA 0x8E46
# endif
#elif defined(ANDROID)
# include <GLES/gl.h>
#elif defined(WIN32)
# define _WINSOCKAPI_
// has to be included before gl.h because of WINGDIAPI and APIENTRY definitions
# include <windows.h>
# include <GL/gl.h>
#else
#define GL_GLEXT_PROTOTYPES
#define DEBUG_OUTPUT_DECLARED
# include <GL/gl.h>
#endif
#include <vector>
#include "utils/log.hpp"
// already includes glext.h, which defines useful GL constants.
// COpenGLDriver has already loaded the extension GL functions we use (e.g glBeginQuery)
#include "../../lib/irrlicht/source/Irrlicht/COpenGLDriver.h"
#ifdef WIN32
extern PFNGLGENTRANSFORMFEEDBACKSPROC glGenTransformFeedbacks;
extern PFNGLBINDTRANSFORMFEEDBACKPROC glBindTransformFeedback;
extern PFNGLDRAWTRANSFORMFEEDBACKPROC glDrawTransformFeedback;
extern PFNGLBEGINTRANSFORMFEEDBACKPROC glBeginTransformFeedback;
extern PFNGLENDTRANSFORMFEEDBACKPROC glEndTransformFeedback;
extern PFNGLTRANSFORMFEEDBACKVARYINGSPROC glTransformFeedbackVaryings;
extern PFNGLBINDBUFFERBASEPROC glBindBufferBase;
extern PFNGLGENBUFFERSPROC glGenBuffers;
extern PFNGLBINDBUFFERPROC glBindBuffer;
extern PFNGLBUFFERDATAPROC glBufferData;
extern PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer;
extern PFNGLCREATESHADERPROC glCreateShader;
extern PFNGLCOMPILESHADERPROC glCompileShader;
extern PFNGLSHADERSOURCEPROC glShaderSource;
extern PFNGLCREATEPROGRAMPROC glCreateProgram;
extern PFNGLATTACHSHADERPROC glAttachShader;
extern PFNGLLINKPROGRAMPROC glLinkProgram;
extern PFNGLUSEPROGRAMPROC glUseProgram;
extern PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray;
extern PFNGLDISABLEVERTEXATTRIBARRAYPROC glDisableVertexAttribArray;
extern PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation;
extern PFNGLUNIFORMMATRIX4FVPROC glUniformMatrix4fv;
extern PFNGLUNIFORM1FPROC glUniform1f;
extern PFNGLUNIFORM3FPROC glUniform3f;
extern PFNGLUNIFORM1FVPROC glUniform1fv;
extern PFNGLUNIFORM4FVPROC glUniform4fv;
extern PFNGLDELETESHADERPROC glDeleteShader;
extern PFNGLGETSHADERIVPROC glGetShaderiv;
extern PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog;
extern PFNGLACTIVETEXTUREPROC glActiveTexture;
extern PFNGLUNIFORM2FPROC glUniform2f;
extern PFNGLUNIFORM1IPROC glUniform1i;
extern PFNGLUNIFORM3IPROC glUniform3i;
extern PFNGLUNIFORM4IPROC glUniform4i;
extern PFNGLGETPROGRAMIVPROC glGetProgramiv;
extern PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog;
extern PFNGLGETATTRIBLOCATIONPROC glGetAttribLocation;
extern PFNGLBLENDEQUATIONPROC glBlendEquation;
extern PFNGLVERTEXATTRIBDIVISORPROC glVertexAttribDivisor;
extern PFNGLDRAWARRAYSINSTANCEDPROC glDrawArraysInstanced;
extern PFNGLDRAWELEMENTSINSTANCEDPROC glDrawElementsInstanced;
extern PFNGLDELETEBUFFERSPROC glDeleteBuffers;
extern PFNGLGENVERTEXARRAYSPROC glGenVertexArrays;
extern PFNGLBINDVERTEXARRAYPROC glBindVertexArray;
extern PFNGLDELETEVERTEXARRAYSPROC glDeleteVertexArrays;
extern PFNGLTEXBUFFERPROC glTexBuffer;
extern PFNGLBUFFERSUBDATAPROC glBufferSubData;
extern PFNGLVERTEXATTRIBIPOINTERPROC glVertexAttribIPointer;
extern PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers;
extern PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers;
extern PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer;
extern PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D;
extern PFNGLFRAMEBUFFERTEXTUREPROC glFramebufferTexture;
extern PFNGLTEXIMAGE3DPROC glTexImage3D;
extern PFNGLGENERATEMIPMAPPROC glGenerateMipmap;
extern PFNGLCHECKFRAMEBUFFERSTATUSPROC glCheckFramebufferStatus;
extern PFNGLTEXIMAGE2DMULTISAMPLEPROC glTexImage2DMultisample;
extern PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer;
extern PFNGLGETUNIFORMBLOCKINDEXPROC glGetUniformBlockIndex;
extern PFNGLUNIFORMBLOCKBINDINGPROC glUniformBlockBinding;
extern PFNGLBLENDCOLORPROC glBlendColor;
extern PFNGLCOMPRESSEDTEXIMAGE2DPROC glCompressedTexImage2D;
extern PFNGLGETCOMPRESSEDTEXIMAGEPROC glGetCompressedTexImage;
extern PFNGLTEXSTORAGE1DPROC glTexStorage1D;
extern PFNGLTEXSTORAGE2DPROC glTexStorage2D;
extern PFNGLTEXSTORAGE3DPROC glTexStorage3D;
#ifdef DEBUG
extern PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARB;
#endif
#endif
void initGL();
GLuint LoadTFBProgram(const char * vertex_file_path, const char **varyings, unsigned varyingscount);
void setTexture(unsigned TextureUnit, GLuint TextureId, GLenum MagFilter, GLenum MinFilter, bool allowAF = false);
GLuint LoadShader(const char * file, unsigned type);
template<typename ... Types>
void loadAndAttach(GLint ProgramID)
{
return;
}
template<typename ... Types>
void loadAndAttach(GLint ProgramID, GLint ShaderType, const char *filepath, Types ... args)
{
GLint ShaderID = LoadShader(filepath, ShaderType);
glAttachShader(ProgramID, ShaderID);
glDeleteShader(ShaderID);
loadAndAttach(ProgramID, args...);
}
template<typename ...Types>
void printFileList()
{
return;
}
template<typename ...Types>
void printFileList(GLint ShaderType, const char *filepath, Types ... args)
{
Log::error("GLWrapp", filepath);
printFileList(args...);
}
template<typename ... Types>
GLint LoadProgram(Types ... args)
{
GLint ProgramID = glCreateProgram();
loadAndAttach(ProgramID, args...);
glLinkProgram(ProgramID);
GLint Result = GL_FALSE;
int InfoLogLength;
glGetProgramiv(ProgramID, GL_LINK_STATUS, &Result);
if (Result == GL_FALSE) {
Log::error("GLWrapp", "Error when linking these shaders :");
printFileList(args...);
glGetProgramiv(ProgramID, GL_INFO_LOG_LENGTH, &InfoLogLength);
char *ErrorMessage = new char[InfoLogLength];
glGetProgramInfoLog(ProgramID, InfoLogLength, NULL, ErrorMessage);
Log::error("GLWrapp", ErrorMessage);
delete[] ErrorMessage;
}
GLenum glErr = glGetError();
if (glErr != GL_NO_ERROR)
{
Log::warn("IrrDriver", "GLWrap : OpenGL error %i\n", glErr);
}
return ProgramID;
}
class GPUTimer;
class ScopedGPUTimer
{
public:
ScopedGPUTimer(GPUTimer &);
~ScopedGPUTimer();
};
class GPUTimer
{
friend class ScopedGPUTimer;
GLuint query;
bool initialised;
public:
GPUTimer();
unsigned elapsedTimeus();
};
class FrameBuffer
{
private:
GLuint fbo;
std::vector<GLuint> RenderTargets;
GLuint DepthTexture;
size_t width, height;
public:
FrameBuffer();
FrameBuffer(const std::vector <GLuint> &RTTs, size_t w, size_t h, bool layered = false);
FrameBuffer(const std::vector <GLuint> &RTTs, GLuint DS, size_t w, size_t h, bool layered = false);
~FrameBuffer();
void Bind();
std::vector<GLuint> &getRTT() { return RenderTargets; }
GLuint &getDepthTexture() { assert(DepthTexture); return DepthTexture; }
size_t getWidth() const { return width; }
size_t getHeight() const { return height; }
static void Blit(const FrameBuffer &Src, FrameBuffer &Dst, GLbitfield mask = GL_COLOR_BUFFER_BIT, GLenum filter = GL_NEAREST);
void BlitToDefault(size_t, size_t, size_t, size_t);
};
// core::rect<s32> needs these includes
#include <rect.h>
#include "utils/vec3.hpp"
GLuint getTextureGLuint(irr::video::ITexture *tex);
GLuint getDepthTexture(irr::video::ITexture *tex);
void resetTextureTable();
void compressTexture(irr::video::ITexture *tex, bool srgb, bool premul_alpha = false);
bool loadCompressedTexture(const std::string& compressed_tex);
void saveCompressedTexture(const std::string& compressed_tex);
void draw3DLine(const core::vector3df& start,
const core::vector3df& end, irr::video::SColor color);
void draw2DImage(const irr::video::ITexture* texture, const irr::core::rect<s32>& destRect,
const irr::core::rect<s32>& sourceRect, const irr::core::rect<s32>* clipRect,
const irr::video::SColor &color, bool useAlphaChannelOfTexture);
void draw2DImage(const irr::video::ITexture* texture, const irr::core::rect<s32>& destRect,
const irr::core::rect<s32>& sourceRect, const irr::core::rect<s32>* clipRect,
const irr::video::SColor* const colors, bool useAlphaChannelOfTexture);
void GL32_draw2DRectangle(irr::video::SColor color, const irr::core::rect<s32>& position,
const irr::core::rect<s32>* clip = 0);
#endif

View File

@ -1261,8 +1261,8 @@ void IrrDriver::unsetTextureErrorMessage()
// ----------------------------------------------------------------------------
/** Retrieve all textures in the specified directory, generate a smaller
* version for each of them and save them in the cache. Smaller textures are
* generated only if they do not already exist or if their original version
* version for each of them and save them in the cache. Smaller textures are
* generated only if they do not already exist or if their original version
* is newer than the cached one.
* \param dir Directory from where textures will be retrieved.
* Must end with '/'.
@ -1914,6 +1914,8 @@ void IrrDriver::update(float dt)
// =================================
if (!m_device->run())
{
GUIEngine::cleanUp();
GUIEngine::deallocate();
main_loop->abort();
return;
}
@ -2392,7 +2394,7 @@ GLuint IrrDriver::getRenderTargetTexture(TypeRTT which)
// ----------------------------------------------------------------------------
FrameBuffer& IrrDriver::getFBO(TypeFBO which)
FrameBuffer& IrrDriver::getFBO(TypeFBO which)
{
return m_rtts->getFBO(which);
}
@ -2402,4 +2404,5 @@ FrameBuffer& IrrDriver::getFBO(TypeFBO which)
GLuint IrrDriver::getDepthStencilTexture()
{
return m_rtts->getDepthStencilTexture();
}
}

View File

@ -811,7 +811,7 @@ void Material::setMaterialProperties(video::SMaterial *m, scene::IMeshBuffer* m
// ITexture* tex = irr_driver->getTexture("cloud_mask.png");
// m->setTexture(1, tex);
//
//
//
// m->MaterialType = irr_driver->getShader(ES_SKYBOX);
//}

View File

@ -124,19 +124,17 @@ void IrrDriver::renderGLSL(float dt)
RaceGUIBase *rg = world->getRaceGUI();
if (rg) rg->update(dt);
irr::video::COpenGLDriver* gl_driver = (irr::video::COpenGLDriver*)m_device->getVideoDriver();
irr::video::COpenGLDriver* gl_driver = (irr::video::COpenGLDriver*)m_device->getVideoDriver();
for(unsigned int cam = 0; cam < Camera::getNumCameras(); cam++)
{
Camera * const camera = Camera::getCamera(cam);
scene::ICameraSceneNode * const camnode = camera->getCameraSceneNode();
#ifdef ENABLE_PROFILER
std::ostringstream oss;
oss << "drawAll() for kart " << cam << std::flush;
oss << "drawAll() for kart " << cam;
PROFILER_PUSH_CPU_MARKER(oss.str().c_str(), (cam+1)*60,
0x00, 0x00);
#endif
camera->activate();
rg->preRenderCallback(camera); // adjusts start referee
m_scene_manager->setActiveCamera(camnode);
@ -228,10 +226,10 @@ void IrrDriver::renderGLSL(float dt)
for(unsigned int i=0; i<Camera::getNumCameras(); i++)
{
Camera *camera = Camera::getCamera(i);
char marker_name[100];
sprintf(marker_name, "renderPlayerView() for kart %d", i);
std::ostringstream oss;
oss << "renderPlayerView() for kart " << i;
PROFILER_PUSH_CPU_MARKER(marker_name, 0x00, 0x00, (i+1)*60);
PROFILER_PUSH_CPU_MARKER(oss.str().c_str(), 0x00, 0x00, (i+1)*60);
rg->renderPlayerView(camera, dt);
PROFILER_POP_CPU_MARKER();
@ -407,12 +405,10 @@ void IrrDriver::renderFixed(float dt)
{
Camera *camera = Camera::getCamera(i);
#ifdef ENABLE_PROFILER
std::ostringstream oss;
oss << "drawAll() for kart " << i << std::flush;
oss << "drawAll() for kart " << i;
PROFILER_PUSH_CPU_MARKER(oss.str().c_str(), (i+1)*60,
0x00, 0x00);
#endif
camera->activate();
rg->preRenderCallback(camera); // adjusts start referee
@ -437,10 +433,10 @@ void IrrDriver::renderFixed(float dt)
for(unsigned int i=0; i<Camera::getNumCameras(); i++)
{
Camera *camera = Camera::getCamera(i);
char marker_name[100];
sprintf(marker_name, "renderPlayerView() for kart %d", i);
std::ostringstream oss;
oss << "renderPlayerView() for kart " << i;
PROFILER_PUSH_CPU_MARKER(marker_name, 0x00, 0x00, (i+1)*60);
PROFILER_PUSH_CPU_MARKER(oss.str().c_str(), 0x00, 0x00, (i+1)*60);
rg->renderPlayerView(camera, dt);
PROFILER_POP_CPU_MARKER();
@ -469,7 +465,7 @@ void IrrDriver::computeSunVisibility()
// Is the lens flare enabled & visible? Check last frame's query.
const bool hasflare = World::getWorld()->getTrack()->hasLensFlare();
const bool hasgodrays = World::getWorld()->getTrack()->hasGodRays();
irr::video::COpenGLDriver* gl_driver = (irr::video::COpenGLDriver*)m_device->getVideoDriver();
irr::video::COpenGLDriver* gl_driver = (irr::video::COpenGLDriver*)m_device->getVideoDriver();
if (UserConfigParams::m_light_shaft && hasgodrays)//hasflare || hasgodrays)
{
GLuint res = 0;
@ -833,10 +829,10 @@ void IrrDriver::renderGlow(std::vector<GlowData>& glows)
glStencilFunc(GL_ALWAYS, 1, ~0);
glEnable(GL_STENCIL_TEST);
glEnable(GL_DEPTH_TEST);
glDisable(GL_ALPHA_TEST);
glDepthMask(GL_FALSE);
glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
glDisable(GL_ALPHA_TEST);
glDepthMask(GL_FALSE);
glDisable(GL_BLEND);
for (u32 i = 0; i < glowcount; i++)
{
@ -864,11 +860,11 @@ void IrrDriver::renderGlow(std::vector<GlowData>& glows)
FrameBuffer::Blit(irr_driver->getFBO(FBO_HALF1), irr_driver->getFBO(FBO_QUARTER1), GL_COLOR_BUFFER_BIT, GL_LINEAR);
glEnable(GL_BLEND);
glBlendEquation(GL_FUNC_ADD);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glStencilFunc(GL_EQUAL, 0, ~0);
glEnable(GL_STENCIL_TEST);
glEnable(GL_BLEND);
glBlendEquation(GL_FUNC_ADD);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glStencilFunc(GL_EQUAL, 0, ~0);
glEnable(GL_STENCIL_TEST);
m_rtts->getFBO(FBO_COLORS).Bind();
m_post_processing->renderGlow(m_rtts->getRenderTarget(RTT_QUARTER1));
glDisable(GL_STENCIL_TEST);
@ -1484,16 +1480,16 @@ void IrrDriver::renderSkybox(const scene::ICameraSceneNode *camera)
if (!SkyboxCubeMap)
generateSkyboxCubemap();
glBindVertexArray(MeshShader::SkyboxShader::cubevao);
glDisable(GL_CULL_FACE);
assert(SkyboxTextures.size() == 6);
glDisable(GL_CULL_FACE);
assert(SkyboxTextures.size() == 6);
core::matrix4 translate;
translate.setTranslation(camera->getAbsolutePosition());
core::matrix4 translate;
translate.setTranslation(camera->getAbsolutePosition());
// Draw the sky box between the near and far clip plane
const f32 viewDistance = (camera->getNearValue() + camera->getFarValue()) * 0.5f;
core::matrix4 scale;
scale.setScale(core::vector3df(viewDistance, viewDistance, viewDistance));
// Draw the sky box between the near and far clip plane
const f32 viewDistance = (camera->getNearValue() + camera->getFarValue()) * 0.5f;
core::matrix4 scale;
scale.setScale(core::vector3df(viewDistance, viewDistance, viewDistance));
core::matrix4 transform = translate * scale;
core::matrix4 invtransform;
transform.getInverse(invtransform);
@ -1503,7 +1499,7 @@ void IrrDriver::renderSkybox(const scene::ICameraSceneNode *camera)
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glUseProgram(MeshShader::SkyboxShader::Program);
MeshShader::SkyboxShader::setUniforms(transform,
MeshShader::SkyboxShader::setUniforms(transform,
core::vector2df(float(UserConfigParams::m_width),
float(UserConfigParams::m_height)),
0);
@ -1520,15 +1516,15 @@ void IrrDriver::renderDisplacement()
irr_driver->getFBO(FBO_DISPLACE).Bind();
glClear(GL_COLOR_BUFFER_BIT);
DisplaceProvider * const cb = (DisplaceProvider *)irr_driver->getCallback(ES_DISPLACE);
cb->update();
DisplaceProvider * const cb = (DisplaceProvider *)irr_driver->getCallback(ES_DISPLACE);
cb->update();
const int displacingcount = m_displacing.size();
irr_driver->setPhase(DISPLACEMENT_PASS);
glEnable(GL_DEPTH_TEST);
glDisable(GL_ALPHA_TEST);
glDepthMask(GL_FALSE);
glDisable(GL_BLEND);
irr_driver->setPhase(DISPLACEMENT_PASS);
glEnable(GL_DEPTH_TEST);
glDisable(GL_ALPHA_TEST);
glDepthMask(GL_FALSE);
glDisable(GL_BLEND);
glClear(GL_STENCIL_BUFFER_BIT);
glEnable(GL_STENCIL_TEST);
glStencilFunc(GL_ALWAYS, 1, 0xFF);

View File

@ -60,129 +60,129 @@ GLuint createVAO(GLuint vbo, GLuint idx, GLuint attrib_position, GLuint attrib_t
{
if (attrib_position == -1)
return 0;
GLuint vao;
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glEnableVertexAttribArray(attrib_position);
if ((GLint)attrib_texcoord != -1)
glEnableVertexAttribArray(attrib_texcoord);
if ((GLint)attrib_second_texcoord != -1)
glEnableVertexAttribArray(attrib_second_texcoord);
if ((GLint)attrib_normal != -1)
glEnableVertexAttribArray(attrib_normal);
if ((GLint)attrib_tangent != -1)
glEnableVertexAttribArray(attrib_tangent);
if ((GLint)attrib_bitangent != -1)
glEnableVertexAttribArray(attrib_bitangent);
if ((GLint)attrib_color != -1)
glEnableVertexAttribArray(attrib_color);
glVertexAttribPointer(attrib_position, 3, GL_FLOAT, GL_FALSE, stride, 0);
if ((GLint)attrib_texcoord != -1)
glVertexAttribPointer(attrib_texcoord, 2, GL_FLOAT, GL_FALSE, stride, (GLvoid*) 28);
if ((GLint)attrib_second_texcoord != -1)
{
if (stride < 44)
Log::error("material", "Second texcoords not present in VBO");
glVertexAttribPointer(attrib_second_texcoord, 2, GL_FLOAT, GL_FALSE, stride, (GLvoid*) 36);
}
if ((GLint)attrib_normal != -1)
glVertexAttribPointer(attrib_normal, 3, GL_FLOAT, GL_FALSE, stride, (GLvoid*) 12);
if ((GLint)attrib_tangent != -1)
{
if (stride < 48)
Log::error("material", "Tangents not present in VBO");
glVertexAttribPointer(attrib_tangent, 3, GL_FLOAT, GL_FALSE, stride, (GLvoid*)36);
}
if ((GLint)attrib_bitangent != -1)
{
if (stride < 60)
Log::error("material", "Bitangents not present in VBO");
glVertexAttribPointer(attrib_bitangent, 3, GL_FLOAT, GL_FALSE, stride, (GLvoid*)48);
}
if ((GLint)attrib_color != -1)
glVertexAttribPointer(attrib_color, 4, GL_UNSIGNED_BYTE, GL_TRUE, stride, (GLvoid*)24);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, idx);
return vao;
GLuint vao;
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glEnableVertexAttribArray(attrib_position);
if ((GLint)attrib_texcoord != -1)
glEnableVertexAttribArray(attrib_texcoord);
if ((GLint)attrib_second_texcoord != -1)
glEnableVertexAttribArray(attrib_second_texcoord);
if ((GLint)attrib_normal != -1)
glEnableVertexAttribArray(attrib_normal);
if ((GLint)attrib_tangent != -1)
glEnableVertexAttribArray(attrib_tangent);
if ((GLint)attrib_bitangent != -1)
glEnableVertexAttribArray(attrib_bitangent);
if ((GLint)attrib_color != -1)
glEnableVertexAttribArray(attrib_color);
glVertexAttribPointer(attrib_position, 3, GL_FLOAT, GL_FALSE, stride, 0);
if ((GLint)attrib_texcoord != -1)
glVertexAttribPointer(attrib_texcoord, 2, GL_FLOAT, GL_FALSE, stride, (GLvoid*) 28);
if ((GLint)attrib_second_texcoord != -1)
{
if (stride < 44)
Log::error("material", "Second texcoords not present in VBO");
glVertexAttribPointer(attrib_second_texcoord, 2, GL_FLOAT, GL_FALSE, stride, (GLvoid*) 36);
}
if ((GLint)attrib_normal != -1)
glVertexAttribPointer(attrib_normal, 3, GL_FLOAT, GL_FALSE, stride, (GLvoid*) 12);
if ((GLint)attrib_tangent != -1)
{
if (stride < 48)
Log::error("material", "Tangents not present in VBO");
glVertexAttribPointer(attrib_tangent, 3, GL_FLOAT, GL_FALSE, stride, (GLvoid*)36);
}
if ((GLint)attrib_bitangent != -1)
{
if (stride < 60)
Log::error("material", "Bitangents not present in VBO");
glVertexAttribPointer(attrib_bitangent, 3, GL_FLOAT, GL_FALSE, stride, (GLvoid*)48);
}
if ((GLint)attrib_color != -1)
glVertexAttribPointer(attrib_color, 4, GL_UNSIGNED_BYTE, GL_TRUE, stride, (GLvoid*)24);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, idx);
return vao;
}
GLMesh allocateMeshBuffer(scene::IMeshBuffer* mb)
{
GLMesh result = {};
if (!mb)
return result;
glBindVertexArray(0);
glGenBuffers(1, &(result.vertex_buffer));
glGenBuffers(1, &(result.index_buffer));
GLMesh result = {};
if (!mb)
return result;
glBindVertexArray(0);
glGenBuffers(1, &(result.vertex_buffer));
glGenBuffers(1, &(result.index_buffer));
glBindBuffer(GL_ARRAY_BUFFER, result.vertex_buffer);
const void* vertices = mb->getVertices();
const u32 vertexCount = mb->getVertexCount();
const irr::video::E_VERTEX_TYPE vType = mb->getVertexType();
result.Stride = getVertexPitchFromType(vType);
const c8* vbuf = static_cast<const c8*>(vertices);
glBufferData(GL_ARRAY_BUFFER, vertexCount * result.Stride, vbuf, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, result.vertex_buffer);
const void* vertices = mb->getVertices();
const u32 vertexCount = mb->getVertexCount();
const irr::video::E_VERTEX_TYPE vType = mb->getVertexType();
result.Stride = getVertexPitchFromType(vType);
const c8* vbuf = static_cast<const c8*>(vertices);
glBufferData(GL_ARRAY_BUFFER, vertexCount * result.Stride, vbuf, GL_STATIC_DRAW);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, result.index_buffer);
const void* indices = mb->getIndices();
u32 indexCount = mb->getIndexCount();
GLenum indexSize;
switch (mb->getIndexType())
{
case irr::video::EIT_16BIT:
{
indexSize = sizeof(u16);
result.IndexType = GL_UNSIGNED_SHORT;
break;
}
case irr::video::EIT_32BIT:
{
indexSize = sizeof(u32);
result.IndexType = GL_UNSIGNED_INT;
break;
}
default:
{
assert(0 && "Wrong index size");
}
}
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexCount * indexSize, indices, GL_STATIC_DRAW);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, result.index_buffer);
const void* indices = mb->getIndices();
u32 indexCount = mb->getIndexCount();
GLenum indexSize;
switch (mb->getIndexType())
{
case irr::video::EIT_16BIT:
{
indexSize = sizeof(u16);
result.IndexType = GL_UNSIGNED_SHORT;
break;
}
case irr::video::EIT_32BIT:
{
indexSize = sizeof(u32);
result.IndexType = GL_UNSIGNED_INT;
break;
}
default:
{
assert(0 && "Wrong index size");
}
}
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexCount * indexSize, indices, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
result.IndexCount = mb->getIndexCount();
switch (mb->getPrimitiveType())
{
case scene::EPT_POINTS:
result.PrimitiveType = GL_POINTS;
break;
case scene::EPT_TRIANGLE_STRIP:
result.PrimitiveType = GL_TRIANGLE_STRIP;
break;
case scene::EPT_TRIANGLE_FAN:
result.PrimitiveType = GL_TRIANGLE_FAN;
break;
case scene::EPT_LINES:
result.PrimitiveType = GL_LINES;
result.IndexCount = mb->getIndexCount();
switch (mb->getPrimitiveType())
{
case scene::EPT_POINTS:
result.PrimitiveType = GL_POINTS;
break;
case scene::EPT_TRIANGLES:
result.PrimitiveType = GL_TRIANGLES;
break;
case scene::EPT_POINT_SPRITES:
case scene::EPT_LINE_LOOP:
case scene::EPT_POLYGON:
case scene::EPT_LINE_STRIP:
case scene::EPT_QUAD_STRIP:
case scene::EPT_QUADS:
assert(0 && "Unsupported primitive type");
}
for (unsigned i = 0; i < 6; i++)
case scene::EPT_TRIANGLE_STRIP:
result.PrimitiveType = GL_TRIANGLE_STRIP;
break;
case scene::EPT_TRIANGLE_FAN:
result.PrimitiveType = GL_TRIANGLE_FAN;
break;
case scene::EPT_LINES:
result.PrimitiveType = GL_LINES;
break;
case scene::EPT_TRIANGLES:
result.PrimitiveType = GL_TRIANGLES;
break;
case scene::EPT_POINT_SPRITES:
case scene::EPT_LINE_LOOP:
case scene::EPT_POLYGON:
case scene::EPT_LINE_STRIP:
case scene::EPT_QUAD_STRIP:
case scene::EPT_QUADS:
assert(0 && "Unsupported primitive type");
}
for (unsigned i = 0; i < 6; i++)
result.textures[i] = mb->getMaterial().getTexture(i);
result.TextureMatrix = 0;
return result;
return result;
}
@ -215,18 +215,18 @@ core::vector3df getWind()
void drawGrassPass1(const GLMesh &mesh, const core::matrix4 & ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView, core::vector3df windDir)
{
irr_driver->IncreaseObjectCount();
GLenum ptype = mesh.PrimitiveType;
GLenum itype = mesh.IndexType;
size_t count = mesh.IndexCount;
GLenum ptype = mesh.PrimitiveType;
GLenum itype = mesh.IndexType;
size_t count = mesh.IndexCount;
compressTexture(mesh.textures[0], true);
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
MeshShader::GrassPass1Shader::setUniforms(ModelViewProjectionMatrix, TransposeInverseModelView, windDir, 0);
MeshShader::GrassPass1Shader::setUniforms(ModelViewProjectionMatrix, TransposeInverseModelView, windDir, 0);
assert(mesh.vao_first_pass);
glBindVertexArray(mesh.vao_first_pass);
glDrawElements(ptype, count, itype, 0);
glBindVertexArray(mesh.vao_first_pass);
glDrawElements(ptype, count, itype, 0);
}
void drawSphereMap(const GLMesh &mesh, const core::matrix4 &ModelMatrix, const core::matrix4 &InverseModelMatrix)
@ -367,28 +367,28 @@ static video::ITexture *CausticTex = 0;
void drawGrassPass2(const GLMesh &mesh, const core::matrix4 & ModelViewProjectionMatrix, core::vector3df windDir)
{
irr_driver->IncreaseObjectCount();
GLenum ptype = mesh.PrimitiveType;
GLenum itype = mesh.IndexType;
size_t count = mesh.IndexCount;
GLenum ptype = mesh.PrimitiveType;
GLenum itype = mesh.IndexType;
size_t count = mesh.IndexCount;
compressTexture(mesh.textures[0], true);
setTexture(MeshShader::GrassPass2Shader::TU_Albedo, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
if (irr_driver->getLightViz())
{
GLint swizzleMask[] = {GL_ONE, GL_ONE, GL_ONE, GL_ALPHA};
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
}
else
{
GLint swizzleMask[] = {GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA};
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
}
if (irr_driver->getLightViz())
{
GLint swizzleMask[] = {GL_ONE, GL_ONE, GL_ONE, GL_ALPHA};
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
}
else
{
GLint swizzleMask[] = {GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA};
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
}
MeshShader::GrassPass2Shader::setUniforms(ModelViewProjectionMatrix, windDir);
assert(mesh.vao_second_pass);
glBindVertexArray(mesh.vao_second_pass);
glDrawElements(ptype, count, itype, 0);
glBindVertexArray(mesh.vao_second_pass);
glDrawElements(ptype, count, itype, 0);
}
void drawUntexturedObject(const GLMesh &mesh, const core::matrix4 &ModelMatrix)
@ -408,55 +408,55 @@ void drawUntexturedObject(const GLMesh &mesh, const core::matrix4 &ModelMatrix)
void drawObjectRimLimit(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TransposeInverseModelView, const core::matrix4 &TextureMatrix)
{
irr_driver->IncreaseObjectCount();
GLenum ptype = mesh.PrimitiveType;
GLenum itype = mesh.IndexType;
size_t count = mesh.IndexCount;
GLenum ptype = mesh.PrimitiveType;
GLenum itype = mesh.IndexType;
size_t count = mesh.IndexCount;
compressTexture(mesh.textures[0], true);
setTexture(MeshShader::ObjectRimLimitShader::TU_Albedo, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
if (irr_driver->getLightViz())
{
GLint swizzleMask[] = { GL_ONE, GL_ONE, GL_ONE, GL_ALPHA };
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
}
else
{
GLint swizzleMask[] = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA };
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
}
if (irr_driver->getLightViz())
{
GLint swizzleMask[] = { GL_ONE, GL_ONE, GL_ONE, GL_ALPHA };
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
}
else
{
GLint swizzleMask[] = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA };
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
}
MeshShader::ObjectRimLimitShader::setUniforms(ModelViewProjectionMatrix, TransposeInverseModelView, TextureMatrix);
assert(mesh.vao_second_pass);
glBindVertexArray(mesh.vao_second_pass);
glDrawElements(ptype, count, itype, 0);
glBindVertexArray(mesh.vao_second_pass);
glDrawElements(ptype, count, itype, 0);
}
void drawObjectUnlit(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix)
{
irr_driver->IncreaseObjectCount();
GLenum ptype = mesh.PrimitiveType;
GLenum itype = mesh.IndexType;
size_t count = mesh.IndexCount;
GLenum ptype = mesh.PrimitiveType;
GLenum itype = mesh.IndexType;
size_t count = mesh.IndexCount;
compressTexture(mesh.textures[0], true);
setTexture(MeshShader::ObjectUnlitShader::TU_tex, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
if (irr_driver->getLightViz())
{
GLint swizzleMask[] = { GL_ONE, GL_ONE, GL_ONE, GL_ALPHA };
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
}
else
{
GLint swizzleMask[] = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA };
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
}
if (irr_driver->getLightViz())
{
GLint swizzleMask[] = { GL_ONE, GL_ONE, GL_ONE, GL_ALPHA };
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
}
else
{
GLint swizzleMask[] = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA };
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
}
MeshShader::ObjectUnlitShader::setUniforms(ModelViewProjectionMatrix);
assert(mesh.vao_second_pass);
glBindVertexArray(mesh.vao_second_pass);
glDrawElements(ptype, count, itype, 0);
glBindVertexArray(mesh.vao_second_pass);
glDrawElements(ptype, count, itype, 0);
}
void drawDetailledObjectPass2(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix)
@ -491,36 +491,36 @@ void drawDetailledObjectPass2(const GLMesh &mesh, const core::matrix4 &ModelView
void drawObjectPass2(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix)
{
irr_driver->IncreaseObjectCount();
GLenum ptype = mesh.PrimitiveType;
GLenum itype = mesh.IndexType;
size_t count = mesh.IndexCount;
GLenum ptype = mesh.PrimitiveType;
GLenum itype = mesh.IndexType;
size_t count = mesh.IndexCount;
compressTexture(mesh.textures[0], true);
setTexture(MeshShader::ObjectPass2Shader::TU_Albedo, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
if (irr_driver->getLightViz())
{
GLint swizzleMask[] = { GL_ONE, GL_ONE, GL_ONE, GL_ALPHA };
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
}
else
{
GLint swizzleMask[] = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA };
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
}
if (irr_driver->getLightViz())
{
GLint swizzleMask[] = { GL_ONE, GL_ONE, GL_ONE, GL_ALPHA };
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
}
else
{
GLint swizzleMask[] = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA };
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
}
MeshShader::ObjectPass2Shader::setUniforms(ModelViewProjectionMatrix, TextureMatrix);
assert(mesh.vao_second_pass);
glBindVertexArray(mesh.vao_second_pass);
glDrawElements(ptype, count, itype, 0);
glBindVertexArray(mesh.vao_second_pass);
glDrawElements(ptype, count, itype, 0);
}
void drawTransparentObject(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix)
{
irr_driver->IncreaseObjectCount();
GLenum ptype = mesh.PrimitiveType;
GLenum itype = mesh.IndexType;
size_t count = mesh.IndexCount;
GLenum ptype = mesh.PrimitiveType;
GLenum itype = mesh.IndexType;
size_t count = mesh.IndexCount;
compressTexture(mesh.textures[0], true);
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
@ -528,8 +528,8 @@ void drawTransparentObject(const GLMesh &mesh, const core::matrix4 &ModelViewPro
MeshShader::TransparentShader::setUniforms(ModelViewProjectionMatrix, TextureMatrix, 0);
assert(mesh.vao_first_pass);
glBindVertexArray(mesh.vao_first_pass);
glDrawElements(ptype, count, itype, 0);
glBindVertexArray(mesh.vao_first_pass);
glDrawElements(ptype, count, itype, 0);
}
void drawTransparentFogObject(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix, const core::matrix4 &TextureMatrix)
@ -567,21 +567,21 @@ void drawTransparentFogObject(const GLMesh &mesh, const core::matrix4 &ModelView
void drawBubble(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix)
{
irr_driver->IncreaseObjectCount();
const float time = irr_driver->getDevice()->getTimer()->getTime() / 1000.0f;
float transparency = 1.;
const float time = irr_driver->getDevice()->getTimer()->getTime() / 1000.0f;
float transparency = 1.;
GLenum ptype = mesh.PrimitiveType;
GLenum itype = mesh.IndexType;
size_t count = mesh.IndexCount;
GLenum ptype = mesh.PrimitiveType;
GLenum itype = mesh.IndexType;
size_t count = mesh.IndexCount;
compressTexture(mesh.textures[0], true);
setTexture(0, getTextureGLuint(mesh.textures[0]), GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, true);
MeshShader::BubbleShader::setUniforms(ModelViewProjectionMatrix, 0, time, transparency);
MeshShader::BubbleShader::setUniforms(ModelViewProjectionMatrix, 0, time, transparency);
assert(mesh.vao_first_pass);
glBindVertexArray(mesh.vao_first_pass);
glDrawElements(ptype, count, itype, 0);
glBindVertexArray(mesh.vao_first_pass);
glDrawElements(ptype, count, itype, 0);
}
void drawShadowRef(const GLMesh &mesh, const core::matrix4 &ModelMatrix)
@ -616,39 +616,39 @@ void drawShadow(const GLMesh &mesh, const core::matrix4 &ModelMatrix)
bool isObject(video::E_MATERIAL_TYPE type)
{
if (type == irr_driver->getShader(ES_OBJECTPASS))
return true;
if (type == irr_driver->getShader(ES_OBJECTPASS_REF))
return true;
if (type == irr_driver->getShader(ES_OBJECTPASS_RIMLIT))
return true;
if (type == irr_driver->getShader(ES_NORMAL_MAP))
return true;
if (type == irr_driver->getShader(ES_SPHERE_MAP))
return true;
if (type == irr_driver->getShader(ES_SPLATTING))
return true;
if (type == irr_driver->getShader(ES_GRASS))
return true;
if (type == irr_driver->getShader(ES_GRASS_REF))
return true;
if (type == irr_driver->getShader(ES_BUBBLES))
return true;
if (type == irr_driver->getShader(ES_OBJECT_UNLIT))
return true;
if (type == video::EMT_TRANSPARENT_ALPHA_CHANNEL)
return true;
if (type == video::EMT_ONETEXTURE_BLEND)
return true;
if (type == video::EMT_TRANSPARENT_ADD_COLOR)
return true;
if (type == irr_driver->getShader(ES_OBJECTPASS))
return true;
if (type == irr_driver->getShader(ES_OBJECTPASS_REF))
return true;
if (type == irr_driver->getShader(ES_OBJECTPASS_RIMLIT))
return true;
if (type == irr_driver->getShader(ES_NORMAL_MAP))
return true;
if (type == irr_driver->getShader(ES_SPHERE_MAP))
return true;
if (type == irr_driver->getShader(ES_SPLATTING))
return true;
if (type == irr_driver->getShader(ES_GRASS))
return true;
if (type == irr_driver->getShader(ES_GRASS_REF))
return true;
if (type == irr_driver->getShader(ES_BUBBLES))
return true;
if (type == irr_driver->getShader(ES_OBJECT_UNLIT))
return true;
if (type == video::EMT_TRANSPARENT_ALPHA_CHANNEL)
return true;
if (type == video::EMT_ONETEXTURE_BLEND)
return true;
if (type == video::EMT_TRANSPARENT_ADD_COLOR)
return true;
if (type == video::EMT_SOLID)
return true;
if (type == video::EMT_LIGHTMAP_LIGHTING)
return true;
if (type == video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF)
return true;
return false;
return false;
}
void initvaostate(GLMesh &mesh, GeometricMaterial GeoMat, ShadedMaterial ShadedMat)

View File

@ -168,7 +168,7 @@ void STKMeshSceneNode::drawDisplace(const GLMesh &mesh)
core::vector2df(cb->getDirX(), cb->getDirY()),
core::vector2df(cb->getDir2X(), cb->getDir2Y()),
core::vector2df(float(UserConfigParams::m_width),
float(UserConfigParams::m_height)),
float(UserConfigParams::m_height)),
0, 1, 2);
assert(mesh.vao_displace_pass);

View File

@ -691,7 +691,6 @@ X##_yflip.LowerRightCorner.Y = w->m_skin_dest_y + \
void Skin::drawButton(Widget* w, const core::recti &rect,
const bool pressed, const bool focused)
{
// if within an appearing dialog, grow
if (m_dialog && m_dialog_size < 1.0f && w->m_parent != NULL &&
w->m_parent->getType() == gui::EGUIET_WINDOW)
@ -2101,8 +2100,10 @@ void Skin::draw3DSunkenPane (IGUIElement *element, video::SColor bgcolor,
{
SColor& bg_color = SkinConfig::m_colors["text_field::background"];
SColor& bg_color_focused = SkinConfig::m_colors["text_field::background_focused"];
SColor& bg_color_deactivated = SkinConfig::m_colors["text_field::background_deactivated"];
SColor& border_color = SkinConfig::m_colors["text_field::neutral"];
SColor& border_color_focus = SkinConfig::m_colors["text_field::focused"];
SColor& border_color_deactivated = SkinConfig::m_colors["text_field::deactivated"];
core::recti borderArea = rect;
//borderArea.UpperLeftCorner -= position2d< s32 >( 2, 2 );
@ -2128,12 +2129,22 @@ void Skin::draw3DSunkenPane (IGUIElement *element, video::SColor bgcolor,
center.Y + (int)(((int)rect.LowerRightCorner.Y
- (int)center.Y)*texture_size);
}
GL32_draw2DRectangle(focused ? border_color_focus : border_color, borderArea);
if(widget->m_deactivated)
GL32_draw2DRectangle(border_color_deactivated, borderArea);
else if(focused)
GL32_draw2DRectangle(border_color_focus, borderArea);
else
GL32_draw2DRectangle(border_color, borderArea);
core::recti innerArea = borderArea;
innerArea.UpperLeftCorner += position2d< s32 >( 3, 3 );
innerArea.LowerRightCorner -= position2d< s32 >( 3, 3 );
GL32_draw2DRectangle(focused ? bg_color_focused : bg_color, innerArea);
if(widget->m_deactivated)
GL32_draw2DRectangle(bg_color_deactivated, innerArea);
else if(focused)
GL32_draw2DRectangle(bg_color_focused, innerArea);
else
GL32_draw2DRectangle(bg_color, innerArea);
return;
}
else if (type == WTYPE_LIST)

View File

@ -859,7 +859,7 @@ void FileManager::checkAndCreateScreenshotDir()
} // checkAndCreateScreenshotDir
// ----------------------------------------------------------------------------
/** Creates the directories for cached textures. This will set
/** Creates the directories for cached textures. This will set
* m_cached_textures_dir with the appropriate path.
*/
void FileManager::checkAndCreateCachedTexturesDir()
@ -1032,12 +1032,12 @@ void FileManager::redirectOutput()
} // redirectOutput
//-----------------------------------------------------------------------------
/** Returns the theoretical location of the cached version of a texture
/** Returns the theoretical location of the cached version of a texture
* depending of the current config. (This function also works for directories:
* in this case the returned directory will be the cache location for all
* textures that you will find in the specified directory. The specified
* directory must end with '/')
* \note The returned location is where the cached data should be read or
* \note The returned location is where the cached data should be read or
* written but the file itseft does not necessarity exist. However, the
* directory structure is automatically created if it does not exist.
*/
@ -1246,7 +1246,7 @@ bool FileManager::copyFile(const std::string &source, const std::string &dest)
if(!f_source) return false;
FILE *f_dest = fopen(dest.c_str(), "wb");
if(!f_dest)
if(!f_dest)
{
fclose(f_source);
return false;

View File

@ -1260,8 +1260,8 @@ void SkiddingAI::handleItems(const float dt)
// slower. Also, if the kart behind is closer and not slower than
// this kart.
bool fire_backwards = !m_kart_ahead ||
(m_kart_behind &&
(m_distance_behind < m_distance_ahead ||
(m_kart_behind &&
(m_distance_behind < m_distance_ahead ||
kart_ahead_is_slow ) &&
!kart_behind_is_slow
);
@ -1271,7 +1271,7 @@ void SkiddingAI::handleItems(const float dt)
// the kart anyway, or that this might force the kart ahead to
// use its nitro/zipper (and then we will shoot since then the
// kart is faster).
if ((fire_backwards && kart_behind_is_slow) ||
if ((fire_backwards && kart_behind_is_slow) ||
(!fire_backwards && kart_ahead_is_slow) )
break;
@ -1750,7 +1750,7 @@ void SkiddingAI::checkCrashes(const Vec3& pos )
// Ignore karts ahead that are faster than this kart.
if(m_kart->getVelocityLC().getZ() < other_kart->getVelocityLC().getZ())
continue;
Vec3 other_kart_xyz = other_kart->getXYZ()
Vec3 other_kart_xyz = other_kart->getXYZ()
+ other_kart->getVelocity()*(i*dt);
float kart_distance = (step_coord - other_kart_xyz).length_2d();

View File

@ -361,7 +361,7 @@ void gamepadVisualisation()
} // gamepadVisualisation
// ============================================================================
/** Sets the hat mesh name depending on the current christmas mode
/** Sets the hat mesh name depending on the current christmas mode
* m_xmas_mode (0: use current date, 1: always on, 2: always off).
*/
void handleXmasMode()

View File

@ -29,6 +29,7 @@
#include "karts/kart_properties.hpp"
#include "karts/kart_properties_manager.hpp"
#include "karts/rescue_animation.hpp"
#include "physics/btKart.hpp"
#include "physics/physics.hpp"
#include "states_screens/dialogs/select_challenge.hpp"
#include "states_screens/offline_kart_selection.hpp"
@ -54,7 +55,6 @@ OverWorld::~OverWorld()
/** Function to simplify the start process */
void OverWorld::enterOverWorld()
{
race_manager->setNumLocalPlayers(1);
race_manager->setMajorMode (RaceManager::MAJOR_MODE_SINGLE);
race_manager->setMinorMode (RaceManager::MINOR_MODE_OVERWORLD);
@ -231,6 +231,7 @@ void OverWorld::onMouseClick(int x, int y)
// be the location of the challenge bubble.
AbstractKart* kart = getKart(0);
kart->setXYZ(challenge->m_position);
kart->getVehicle()->capSpeed(0);
unsigned int index = getRescuePositionIndex(kart);
btTransform s = getRescueTransform(index);

View File

@ -235,9 +235,9 @@ void ProfileWorld::enterRaceOverState()
min_t = std::min(min_t, kart->getFinishTime());
av_t += kart->getFinishTime();
std::ostringstream ss;
ss << kart->getIdent() << " "
ss << kart->getIdent() << " "
<< kart->getController()->getControllerName() << " ";
ss << 1+(int)i << " " << kart->getPosition() << " "
ss << 1+(int)i << " " << kart->getPosition() << " "
<< kart->getFinishTime() << " ";
all_groups.insert(kart->getController()->getControllerName());
@ -269,7 +269,7 @@ void ProfileWorld::enterRaceOverState()
std::ostringstream ss;
Log::verbose("profile", "");
ss << "name" << std::setw(max_len-4) << " "
ss << "name" << std::setw(max_len-4) << " "
<< "Strt End Time AvSp Top Skid Resc Rsc Brake Expl Exp Itm Ban SNitLNit Bub Off";
Log::verbose("profile", ss.str().c_str());
for(std::set<std::string>::iterator it = all_groups.begin();
@ -301,7 +301,7 @@ void ProfileWorld::enterRaceOverState()
? race_manager->getNumLaps() : 1);
distance *= m_track->getTrackLength();
Log::verbose("profile",
Log::verbose("profile",
"%s %4.2f %3.2f %6.2f %4.2f %3d %5d %4.2f %3d %3d %3d %3d %3d %3d %5d",
ss.str().c_str(), distance/kart->getFinishTime(),
kart->getTopSpeed(),

View File

@ -468,10 +468,10 @@ void ThreeStrikesBattle::getKartsDisplayInfo(
break;
}
char lives[4];
sprintf(lives, "%i", m_kart_info[i].m_lives);
std::ostringstream oss;
oss << m_kart_info[i].m_lives;
rank_info.m_text = lives;
rank_info.m_text = oss.str().c_str();
}
} // getKartsDisplayInfo

View File

@ -28,7 +28,7 @@ using namespace Online;
/** Constructor. Stores the server id.
* \param server_id Id of the server.
*/
RequestConnection::RequestConnection(uint32_t server_id)
RequestConnection::RequestConnection(uint32_t server_id)
: Protocol(NULL, PROTOCOL_SILENT)
{
m_server_id = server_id;
@ -72,7 +72,7 @@ void RequestConnection::asynchronousUpdate()
case NONE:
{
m_request = new ServerJoinRequest();
PlayerManager::setUserDetails(m_request, "request-connection",
PlayerManager::setUserDetails(m_request, "request-connection",
"address-management.php");
m_request->addParameter("server_id",m_server_id);
m_request->queue();
@ -95,7 +95,7 @@ void RequestConnection::asynchronousUpdate()
}
else
{
Log::error("RequestConnection",
Log::error("RequestConnection",
"Fail to make a request to connecto to server %d",
m_server_id);
}

View File

@ -43,7 +43,7 @@ void ShowPublicAddress::asynchronousUpdate()
{
TransportAddress addr = NetworkManager::getInstance()->getPublicAddress();
m_request = new Online::XMLRequest();
PlayerManager::setUserDetails(m_request, "set",
PlayerManager::setUserDetails(m_request, "set",
"address-management.php");
m_request->addParameter("address",addr.ip);
m_request->addParameter("port",addr.port);

View File

@ -18,7 +18,7 @@
#include "utils/log.hpp"
#include "utils/time.hpp"
StartGameProtocol::StartGameProtocol(GameSetup* game_setup)
StartGameProtocol::StartGameProtocol(GameSetup* game_setup)
: Protocol(NULL, PROTOCOL_START_GAME)
{
m_game_setup = game_setup;
@ -105,7 +105,7 @@ void StartGameProtocol::update()
// have to add self first
for (unsigned int i = 0; i < players.size(); i++)
{
bool is_me = (players[i]->user_profile ==
bool is_me = (players[i]->user_profile ==
PlayerManager::getCurrentOnlineProfile());
if (is_me)
{
@ -134,7 +134,7 @@ void StartGameProtocol::update()
}
for (unsigned int i = 0; i < players.size(); i++)
{
bool is_me = (players[i]->user_profile ==
bool is_me = (players[i]->user_profile ==
PlayerManager::getCurrentOnlineProfile());
NetworkPlayerProfile* profile = players[i];
RemoteKartInfo rki(profile->race_id, profile->kart_name,

View File

@ -116,7 +116,7 @@ namespace Online
{
// If the player changes the online account, there can be a
// logout stil happening.
assert(m_online_state == OS_SIGNED_OUT ||
assert(m_online_state == OS_SIGNED_OUT ||
m_online_state == OS_SIGNING_OUT );
SignInRequest * request = new SignInRequest(false);
// We can't use setUserDetail here, since there is no token yet
@ -125,7 +125,7 @@ namespace Online
request->addParameter("username",username);
request->addParameter("password",password);
request->addParameter("save-session",
UserConfigParams::m_remember_user ? "true"
UserConfigParams::m_remember_user ? "true"
: "false");
request->queue();
m_online_state = OS_SIGNING_IN;
@ -150,7 +150,7 @@ namespace Online
{
PlayerProfile *player = PlayerManager::get()->getPlayer(i);
if(player!=current &&
player->hasSavedSession() &&
player->hasSavedSession() &&
player->getLastOnlineName() == current->getLastOnlineName())
{
player->clearSession();
@ -209,7 +209,7 @@ namespace Online
// ------------------------------------------------------------------------
/** Requests a sign out from the server. If the user should be remembered,
* a 'client-quit' request is sent (which will log the user out, but
* a 'client-quit' request is sent (which will log the user out, but
* remember the token), otherwise a 'disconnect' is sent.
*/
void OnlinePlayerProfile::requestSignOut()
@ -237,8 +237,8 @@ namespace Online
: XMLRequest(true,/*priority*/RequestManager::HTTP_MAX_PRIORITY)
{
m_player = player;
m_player->setUserDetails(this,
UserConfigParams::m_remember_user ? "client-quit"
m_player->setUserDetails(this,
UserConfigParams::m_remember_user ? "client-quit"
:"disconnect");
setAbortable(false);
} // SignOutRequest
@ -251,7 +251,7 @@ namespace Online
} // requestSignOut
// ------------------------------------------------------------------------
/** Callback once the logout event has been processed.
/** Callback once the logout event has been processed.
* \param success If the request was successful.
* \param input
*/
@ -437,7 +437,7 @@ namespace Online
// ------------------------------------------------------------------------
/** \return the online id, or 0 if the user is not signed in.
*/
uint32_t OnlinePlayerProfile::getOnlineId() const
uint32_t OnlinePlayerProfile::getOnlineId() const
{
if((m_online_state == OS_SIGNED_IN ))
{

View File

@ -73,7 +73,7 @@ namespace Online
PlayerProfile::OnlineState m_online_state;
virtual void signIn(bool success, const XMLNode * input);
virtual void signOut(bool success, const XMLNode * input,
virtual void signOut(bool success, const XMLNode * input,
const irr::core::stringw &info);
virtual uint32_t getOnlineId() const;
virtual void setUserDetails(Online::HTTPRequest *request,
@ -83,7 +83,7 @@ namespace Online
virtual void requestPoll() const;
// ----------------------------------------------------------------
/** Returns if this user is logged in. */
virtual bool isLoggedIn() const
virtual bool isLoggedIn() const
{
return m_online_state == PlayerProfile::OS_SIGNED_IN;
} // isLoggedIn

View File

@ -103,7 +103,7 @@ namespace Online
* use network_http - a very subtle race condition. So the thread can
* only be started after the assignment (in main) has been done.
* \pre PlayerManager was created and has read the main data for each
* player so that all data for automatic login is
* player so that all data for automatic login is
* availale.
*/
void RequestManager::startNetworkThread()
@ -128,10 +128,10 @@ namespace Online
errno);
}
pthread_attr_destroy(&attr);
// In case that login id was not saved (or first start of stk),
// In case that login id was not saved (or first start of stk),
// current player would not be defined at this stage.
PlayerProfile *player = PlayerManager::getCurrentPlayer();
if(player && player->wasOnlineLastTime() &&
if(player && player->wasOnlineLastTime() &&
!UserConfigParams::m_always_show_login_screen)
{
PlayerManager::resumeSavedSession();

View File

@ -975,8 +975,11 @@ void btKart::capSpeed(float max_speed)
{
const btVector3 &velocity = m_chassisBody->getLinearVelocity();
float speed = velocity.length();
const float velocity_ratio = max_speed/speed;
m_chassisBody->setLinearVelocity( velocity * velocity_ratio);
if(speed!=0)
{
const float velocity_ratio = max_speed / speed;
m_chassisBody->setLinearVelocity(velocity * velocity_ratio);
}
} // capSpeed
// ----------------------------------------------------------------------------

View File

@ -39,7 +39,7 @@ using namespace Online;
/** Creates a modal dialog with given percentage of screen width and height
*/
ChangePasswordDialog::ChangePasswordDialog()
ChangePasswordDialog::ChangePasswordDialog()
: ModalDialog(0.8f,0.7f)
{
m_self_destroy = false;
@ -157,13 +157,13 @@ void ChangePasswordDialog::submit()
} // submit
// ----------------------------------------------------------------------------
GUIEngine::EventPropagation
GUIEngine::EventPropagation
ChangePasswordDialog::processEvent(const std::string& eventSource)
{
if (eventSource == m_options_widget->m_properties[PROP_ID])
{
const std::string& selection =
const std::string& selection =
m_options_widget->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if (selection == m_cancel_widget->m_properties[PROP_ID])
{

View File

@ -302,7 +302,7 @@ void UserInfoDialog::removeExistingFriend()
else
info_text = getInfo();
UserInfoDialog *info = new UserInfoDialog(m_id, info_text,
UserInfoDialog *info = new UserInfoDialog(m_id, info_text,
!isSuccess(), true);
GUIEngine::DialogQueue::get()->pushDialog(info, true);

View File

@ -143,7 +143,7 @@ GUIEngine::EventPropagation VoteDialog::processEvent(const std::string& event)
if (event == m_options_widget->m_properties[PROP_ID])
{
const std::string& selection =
const std::string& selection =
m_options_widget->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if (selection == m_cancel_widget->m_properties[PROP_ID])
{
@ -164,7 +164,7 @@ void VoteDialog::updateFetchVote()
if (!m_fetch_vote_request->isDone())
{
// request still pending
m_info_widget->setText(irr::core::stringw(_("Fetching last vote"))
m_info_widget->setText(irr::core::stringw(_("Fetching last vote"))
+ Messages::loadingDots(), false);
return;
} // !isDone
@ -236,7 +236,7 @@ void VoteDialog::onUpdate(float dt)
} // isDone
else
{
m_info_widget->setText(irr::core::stringw(_("Performing vote"))
m_info_widget->setText(irr::core::stringw(_("Performing vote"))
+ Messages::loadingDots(), false);
} // !isDone
}

View File

@ -187,12 +187,12 @@ void EditTrackScreen::loadTrackList()
belongsToGroup = (m_track_group.empty() ||
m_track_group == ALL_TRACKS_GROUP_ID ||
t->isInGroup(m_track_group) );
if (!t->isArena() && !t->isSoccer() &&
if (!t->isArena() && !t->isSoccer() &&
!t->isInternal() && belongsToGroup )
{
tracks_widget->addItem(translations->fribidize(t->getName()),
tracks_widget->addItem(translations->fribidize(t->getName()),
t->getIdent(),
t->getScreenshotFile(), 0,
t->getScreenshotFile(), 0,
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);
}
}

View File

@ -137,7 +137,7 @@ void OnlineScreen::init()
Screen::init();
setInitialFocus();
DemoWorld::resetIdleTime();
core::stringw m = _("Signed in as: %s.",
core::stringw m = _("Signed in as: %s.",
PlayerManager::getCurrentOnlineUserName());
m_online_status_widget->setText(m, false);
} // init
@ -198,7 +198,7 @@ void OnlineScreen::doQuickPlay()
{
delete request2;
StateManager::get()->pushScreen(NetworkingLobby::getInstance());
ConnectToServer *cts = new ConnectToServer(server->getServerId(),
ConnectToServer *cts = new ConnectToServer(server->getServerId(),
server->getHostId());
ProtocolManager::getInstance()->requestStart(cts);
}
@ -255,7 +255,7 @@ void OnlineScreen::tearDown()
}
// ----------------------------------------------------------------------------
/** Sets which widget has to be focused. Depends on the user state.
/** Sets which widget has to be focused. Depends on the user state.
*/
void OnlineScreen::setInitialFocus()
{

View File

@ -717,10 +717,10 @@ void RaceGUI::drawSpeedAndEnergy(const AbstractKart* kart,
font = GUIEngine::getSmallFont();
static video::SColor color = video::SColor(255, 255, 255, 255);
char str[256];
sprintf(str, "%d", (int)(speed*10));
std::ostringstream oss;
oss << (int)(speed*10);
font->draw(core::stringw(str).c_str(), pos, color);
font->draw(oss.str().c_str(), pos, color);
}

View File

@ -18,6 +18,7 @@
#include "states_screens/register_screen.hpp"
#include "config/player_manager.hpp"
#include "config/user_config.hpp"
#include "audio/sfx_manager.hpp"
#include "guiengine/widgets/check_box_widget.hpp"
#include "guiengine/widgets/label_widget.hpp"
@ -78,12 +79,27 @@ void RegisterScreen::init()
m_info_widget = getWidget<LabelWidget>("info");
assert(m_info_widget);
m_info_widget->setDefaultColor();
m_info_widget->setText("", false);
m_options_widget = getWidget<RibbonWidget>("options");
assert(m_options_widget);
m_signup_request = NULL;
m_info_message_shown = false;
makeEntryFieldsVisible(true);
getWidget<CheckBoxWidget>("online")->setVisible(true);
getWidget<LabelWidget>("label_online")->setVisible(true);
// Check if online is allowed
if (UserConfigParams::m_internet_status != Online::RequestManager::IPERM_NOT_ALLOWED)
{
getWidget<CheckBoxWidget>("online")->setState(true);
makeEntryFieldsVisible(true);
}
else
{
getWidget<CheckBoxWidget>("online")->setState(false);
makeEntryFieldsVisible(false);
}
} // init
// -----------------------------------------------------------------------------
@ -172,7 +188,7 @@ void RegisterScreen::doRegister()
->getText().trim();
handleLocalName(local_name);
// If no online account is requested, don't register
if(!getWidget<CheckBoxWidget>("online")->getState() || m_existing_player)
{
@ -303,7 +319,14 @@ void RegisterScreen::eventCallback(Widget* widget, const std::string& name,
{
if (name == "online")
{
makeEntryFieldsVisible(getWidget<CheckBoxWidget>("online")->getState());
if (UserConfigParams::m_internet_status == Online::RequestManager::IPERM_NOT_ALLOWED)
{
m_info_widget->setErrorColor();
m_info_widget->setText(_("Internet access is disabled, please enable it in the options"), false);
getWidget<CheckBoxWidget>("online")->setState(false);
}
else
makeEntryFieldsVisible(getWidget<CheckBoxWidget>("online")->getState());
}
else if (name=="options")
{

View File

@ -102,7 +102,7 @@ void BaseUserScreen::init()
m_players->updateItemDisplay();
// Select the current player. That can only be done after
// Select the current player. That can only be done after
// updateItemDisplay is called.
if(current_player_index.size()>0)
{
@ -240,7 +240,7 @@ void BaseUserScreen::eventCallback(Widget* widget,
}
else if (name == "remember-user")
{
UserConfigParams::m_remember_user =
UserConfigParams::m_remember_user =
getWidget<CheckBoxWidget>("remember-user")->getState();
}
else if (name == "online")
@ -251,7 +251,7 @@ void BaseUserScreen::eventCallback(Widget* widget,
Online::RequestManager::IPERM_NOT_ALLOWED)
{
m_info_widget->setText(
"Internet access is disabled, please enable it in the options",
_("Internet access is disabled, please enable it in the options"),
true);
sfx_manager->quickSound( "anvil" );
m_online_cb->setState(false);
@ -260,7 +260,7 @@ void BaseUserScreen::eventCallback(Widget* widget,
}
else if (name == "options")
{
const std::string &button =
const std::string &button =
m_options_widget->getSelectionIDString(player_id);
if (button == "ok")
{
@ -280,7 +280,7 @@ void BaseUserScreen::eventCallback(Widget* widget,
PlayerProfile *cp = getSelectedPlayer();
RegisterScreen::getInstance()->setRename(cp);
StateManager::get()->pushScreen(RegisterScreen::getInstance());
// Init will automatically be called, which
// Init will automatically be called, which
// refreshes the player list
}
else if (button == "delete")
@ -401,7 +401,7 @@ void BaseUserScreen::onUpdate(float dt)
{
if (!m_options_widget->isActivated())
{
core::stringw message = (m_state & STATE_LOGOUT)
core::stringw message = (m_state & STATE_LOGOUT)
? _(L"Signing out '%s'",m_sign_out_name.c_str())
: _(L"Signing in '%s'", m_sign_in_name.c_str());
m_info_widget->setText(Online::Messages::loadingDots(message.c_str()),
@ -542,7 +542,7 @@ void BaseUserScreen::doDeletePlayer()
for(unsigned int i=0; i<PlayerManager::get()->getNumPlayers(); i++)
{
PlayerProfile *player = PlayerManager::get()->getPlayer(i);
if(!player->isGuestAccount())
if(!player->isGuestAccount())
{
PlayerManager::get()->setCurrentPlayer(player);
break;
@ -568,7 +568,7 @@ void BaseUserScreen::onDialogClose()
{
return;
// To allow players to exit the game without creating a player, we count
// how often this function was called. The first time is after the
// how often this function was called. The first time is after the
// internet allowed dialog, the 2nd time
static int number_of_calls = 0;
number_of_calls++;
@ -605,12 +605,12 @@ void TabbedUserScreen::init()
/** Switch to the correct tab.
*/
void TabbedUserScreen::eventCallback(GUIEngine::Widget* widget,
const std::string& name,
const std::string& name,
const int player_id)
{
if (name == "options_choice")
{
const std::string &selection =
const std::string &selection =
((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
Screen *s;
if (selection=="tab_audio" ) s = OptionsScreenAudio::getInstance();

View File

@ -23,13 +23,13 @@
#include "guiengine/screen.hpp"
namespace GUIEngine
namespace GUIEngine
{
class CheckBoxWidget;
class LabelWidget;
class RibbonWidget;
class TextBoxWidget;
class Widget;
class Widget;
}
class PlayerProfile;
@ -39,7 +39,7 @@ class PlayerProfile;
* \brief The user management screen. The screen cames in two variations:
* either as a stand-alone screen before the main menu (on first time STK
* is started, or it the user is not remembered), but also as tab in the
* options menu. To implement this, we use one common base class that
* options menu. To implement this, we use one common base class that
* implements nearly all functionality, and derive to classes - one for
* the stand alone version, one for the version with tabs.
* \ingroup states_screens.

View File

@ -152,4 +152,4 @@ void ModelDefinitionLoader::clear()
scene::IMesh* ModelDefinitionLoader::getFirstMeshFor(const std::string& name)
{
return irr_driver->getMesh(m_lod_groups[name][0].m_model_file);
}
}

View File

@ -209,7 +209,7 @@ core::stringw Track::getSortName() const
*/
bool Track::isInGroup(const std::string &group_name)
{
return std::find(m_groups.begin(), m_groups.end(), group_name)
return std::find(m_groups.begin(), m_groups.end(), group_name)
!= m_groups.end();
} // isInGroup

View File

@ -169,7 +169,7 @@ void TrackObject::init(const XMLNode &xml_node, scene::ISceneNode* parent,
else if (lod_instance)
{
m_type = "lod";
TrackObjectPresentationLOD* lod_node =
TrackObjectPresentationLOD* lod_node =
new TrackObjectPresentationLOD(xml_node, parent, model_def_loader);
m_presentation = lod_node;
@ -187,7 +187,7 @@ void TrackObject::init(const XMLNode &xml_node, scene::ISceneNode* parent,
std::string render_pass;
xml_node.get("renderpass", &render_pass);
if (m_interaction != "ghost" && m_interaction != "none" &&
if (m_interaction != "ghost" && m_interaction != "none" &&
render_pass != "skybox" )
{
m_physical_object = PhysicalObject::fromXML(type == "movable",
@ -282,7 +282,7 @@ void TrackObject::move(const core::vector3df& xyz, const core::vector3df& hpr,
const core::vector3df& scale, bool update_rigid_body)
{
if (m_presentation != NULL) m_presentation->move(xyz, hpr, scale);
if (update_rigid_body && m_physical_object != NULL)
if (update_rigid_body && m_physical_object != NULL)
{
// If we set a bullet position from an irrlicht position, we need to
// get the absolute transform from the presentation object (as set in

View File

@ -275,7 +275,7 @@ bool onEvent(const SEvent &event)
{
World* world = World::getWorld();
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE);
irr_driver->resetDebugModes();
irr_driver->toggleRSM();
}
@ -283,7 +283,7 @@ bool onEvent(const SEvent &event)
{
World* world = World::getWorld();
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE);
irr_driver->resetDebugModes();
irr_driver->toggleRH();
}
@ -291,7 +291,7 @@ bool onEvent(const SEvent &event)
{
World* world = World::getWorld();
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE);
irr_driver->resetDebugModes();
irr_driver->toggleGI();
}

View File

@ -33,7 +33,7 @@
Synchronised<int> m_lock_stacktrace;
#ifdef GET_STACK_TRACE
#ifdef GET_STACK_TRACE
# ifdef __APPLE__
# include <Availability.h>
# include <execinfo.h>

View File

@ -6,7 +6,7 @@ cd data/gui
l=""
for i in $(find . -iname "*.stkgui"); do
s=$(basename $i)
x=$(find ../../src/states_screens -exec grep -H $s \{} \; | wc -l)
x=$(find ../../src/states_screens -type f -exec grep -H $s \{} \; | wc -l)
echo -n "."
if [ $x == "0" ]; then
l="$l $i"

View File

@ -39,7 +39,9 @@ def main():
if statistics:
lines_total += len(lines)
modified = False
for i in range(len(lines)):
oldLine = lines[i]
# replacing tabs with four spaces
lines[i] = lines[i].replace("\t", " ")
@ -48,12 +50,15 @@ def main():
if statistics:
if lines[i].lstrip().startswith("//"):
lines_code += 1
if not modified and oldLine != lines[i]:
modified = True
src_file.close()
# writing back
src_file = open(dirpath + "/" + filename, "w")
src_file.write("".join(lines))
src_file.close()
if modified:
src_file = open(dirpath + "/" + filename, "w")
src_file.write("".join(lines))
src_file.close()
if statistics:
print("Total number of files in " + directory + ": "