Merge upstream/master into Flakebi/master
This commit is contained in:
@@ -417,12 +417,16 @@ void PostProcessing::renderGaussian17TapBlur(FrameBuffer &in_fbo, FrameBuffer &a
|
||||
}
|
||||
else
|
||||
{
|
||||
#if !defined(__linux__) || defined(GL_VERSION_4_2)
|
||||
glUseProgram(FullScreenShader::ComputeGaussian17TapHShader::Program);
|
||||
glBindImageTexture(0, in_fbo.getRTT()[0], 0, false, 0, GL_READ_ONLY, GL_R16F);
|
||||
glBindImageTexture(1, auxiliary.getRTT()[0], 0, false, 0, GL_WRITE_ONLY, GL_R16F);
|
||||
glUniform1i(FullScreenShader::ComputeGaussian17TapHShader::uniform_source, 0);
|
||||
glUniform1i(FullScreenShader::ComputeGaussian17TapHShader::uniform_dest, 1);
|
||||
glDispatchCompute(in_fbo.getWidth() / 8, in_fbo.getHeight() / 8, 1);
|
||||
#else
|
||||
assert(false);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
{
|
||||
@@ -443,12 +447,16 @@ void PostProcessing::renderGaussian17TapBlur(FrameBuffer &in_fbo, FrameBuffer &a
|
||||
}
|
||||
else
|
||||
{
|
||||
#if !defined(__linux__) || defined(GL_VERSION_4_3)
|
||||
glUseProgram(FullScreenShader::ComputeGaussian17TapVShader::Program);
|
||||
glBindImageTexture(0, auxiliary.getRTT()[0], 0, false, 0, GL_READ_ONLY, GL_R16F);
|
||||
glBindImageTexture(1, in_fbo.getRTT()[0], 0, false, 0, GL_WRITE_ONLY, GL_R16F);
|
||||
glUniform1i(FullScreenShader::ComputeGaussian17TapVShader::uniform_source, 0);
|
||||
glUniform1i(FullScreenShader::ComputeGaussian17TapVShader::uniform_dest, 1);
|
||||
glDispatchCompute(in_fbo.getWidth() / 8, in_fbo.getHeight() / 8, 1);
|
||||
#else
|
||||
assert(false);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,13 @@ static GLuint generateRTT3D(GLenum target, size_t w, size_t h, size_t d, GLint i
|
||||
if (irr_driver->getGLSLVersion() < 420)
|
||||
glTexImage3D(target, 0, internalFormat, w, h, d, 0, format, type, 0);
|
||||
else
|
||||
{
|
||||
#if !defined(__linux__) || defined(GL_VERSION_4_2)
|
||||
glTexStorage3D(target, 1, internalFormat, w, h, d);
|
||||
#else
|
||||
assert(false);
|
||||
#endif
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -42,7 +48,13 @@ static GLuint generateRTT(const core::dimension2du &res, GLint internalFormat, G
|
||||
if (irr_driver->getGLSLVersion() < 420)
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, res.Width, res.Height, 0, format, type, 0);
|
||||
else
|
||||
{
|
||||
#if !defined(__linux__) || defined(GL_VERSION_4_2)
|
||||
glTexStorage2D(GL_TEXTURE_2D, mipmaplevel, internalFormat, res.Width, res.Height);
|
||||
#else
|
||||
assert(false);
|
||||
#endif
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -277,11 +277,15 @@ void Shaders::loadShaders()
|
||||
FullScreenShader::DepthOfFieldShader::init();
|
||||
FullScreenShader::FogShader::init();
|
||||
FullScreenShader::Gaussian17TapHShader::init();
|
||||
#if !defined(__linux__) || defined(GL_VERSION_4_3)
|
||||
FullScreenShader::ComputeGaussian17TapHShader::init();
|
||||
#endif
|
||||
FullScreenShader::Gaussian3HBlurShader::init();
|
||||
FullScreenShader::Gaussian3VBlurShader::init();
|
||||
FullScreenShader::Gaussian17TapVShader::init();
|
||||
#if !defined(__linux__) || defined(GL_VERSION_4_3)
|
||||
FullScreenShader::ComputeGaussian17TapVShader::init();
|
||||
#endif
|
||||
FullScreenShader::Gaussian6HBlurShader::init();
|
||||
FullScreenShader::Gaussian6VBlurShader::init();
|
||||
FullScreenShader::GlowShader::init();
|
||||
@@ -2441,6 +2445,7 @@ namespace FullScreenShader
|
||||
vao = createFullScreenVAO(Program);
|
||||
}
|
||||
|
||||
#if !defined(__linux__) || defined(GL_VERSION_4_3)
|
||||
GLuint ComputeGaussian17TapHShader::Program;
|
||||
GLuint ComputeGaussian17TapHShader::uniform_source;
|
||||
GLuint ComputeGaussian17TapHShader::uniform_dest;
|
||||
@@ -2451,7 +2456,7 @@ namespace FullScreenShader
|
||||
uniform_source = glGetUniformLocation(Program, "source");
|
||||
uniform_dest = glGetUniformLocation(Program, "dest");
|
||||
}
|
||||
|
||||
#endif
|
||||
GLuint Gaussian6HBlurShader::Program;
|
||||
GLuint Gaussian6HBlurShader::uniform_tex;
|
||||
GLuint Gaussian6HBlurShader::uniform_pixel;
|
||||
@@ -2497,6 +2502,7 @@ namespace FullScreenShader
|
||||
GLuint ComputeGaussian17TapVShader::Program;
|
||||
GLuint ComputeGaussian17TapVShader::uniform_source;
|
||||
GLuint ComputeGaussian17TapVShader::uniform_dest;
|
||||
#if !defined(__linux__) || defined(GL_VERSION_4_3)
|
||||
void ComputeGaussian17TapVShader::init()
|
||||
{
|
||||
Program = LoadProgram(
|
||||
@@ -2504,7 +2510,7 @@ namespace FullScreenShader
|
||||
uniform_source = glGetUniformLocation(Program, "source");
|
||||
uniform_dest = glGetUniformLocation(Program, "dest");
|
||||
}
|
||||
|
||||
#endif
|
||||
GLuint Gaussian6VBlurShader::Program;
|
||||
GLuint Gaussian6VBlurShader::uniform_tex;
|
||||
GLuint Gaussian6VBlurShader::uniform_pixel;
|
||||
|
||||
@@ -1752,7 +1752,7 @@ void Kart::crashed(const Material *m, const Vec3 &normal)
|
||||
btVector3 gravity = m_body->getGravity();
|
||||
gravity.normalize();
|
||||
// Cast necessary since otherwise to operator- (vec3/btvector) exists
|
||||
Vec3 impulse = (btVector3)normal - gravity* btDot(normal, gravity);
|
||||
Vec3 impulse = normal - gravity* btDot(normal, gravity);
|
||||
if(impulse.getX() || impulse.getZ())
|
||||
impulse.normalize();
|
||||
else
|
||||
|
||||
@@ -413,7 +413,7 @@ void CutsceneWorld::enterRaceOverState()
|
||||
OverWorld::enterOverWorld();
|
||||
}
|
||||
// TODO: remove hardcoded knowledge of cutscenes, replace with scripting probably
|
||||
else if (m_parts.size() == 1 && m_parts[0] == "gplose")
|
||||
else if (m_parts.size() == 1 && m_parts[0] == "gplose")
|
||||
{
|
||||
race_manager->exitRace();
|
||||
StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
|
||||
@@ -438,6 +438,28 @@ void CutsceneWorld::enterRaceOverState()
|
||||
StateManager::get()->pushScreen( s );
|
||||
}
|
||||
}
|
||||
// TODO: remove hardcoded knowledge of cutscenes, replace with scripting probably
|
||||
else if (m_parts.size() == 1 && m_parts[0] == "featunlocked")
|
||||
{
|
||||
if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_GRAND_PRIX)
|
||||
{
|
||||
// in GP mode, continue GP after viewing this screen
|
||||
StateManager::get()->popMenu();
|
||||
race_manager->next();
|
||||
}
|
||||
else
|
||||
{
|
||||
// back to menu or overworld
|
||||
race_manager->exitRace();
|
||||
StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
|
||||
//StateManager::get()->popMenu();
|
||||
|
||||
if (race_manager->raceWasStartedFromOverworld())
|
||||
{
|
||||
OverWorld::enterOverWorld();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
race_manager->exitRace();
|
||||
|
||||
@@ -188,7 +188,7 @@ void PhysicalObject::move(const Vec3& xyz, const core::vector3df& hpr)
|
||||
irr::core::quaternion tempQuat(mat);
|
||||
q = btQuaternion(tempQuat.X, tempQuat.Y, tempQuat.Z, tempQuat.W);
|
||||
|
||||
btTransform trans(q,(btVector3)xyz-quatRotate(q,m_graphical_offset));
|
||||
btTransform trans(q, xyz-quatRotate(q,m_graphical_offset));
|
||||
m_motion_state->setWorldTransform(trans);
|
||||
} // move
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ void FeatureUnlockedCutScene::onCutsceneEnd()
|
||||
irr_driver->removeNode(m_avoid_irrlicht_bug);
|
||||
m_avoid_irrlicht_bug = NULL;
|
||||
#endif
|
||||
|
||||
|
||||
m_unlocked_stuff.clearAndDeleteAll();
|
||||
m_all_kart_models.clearAndDeleteAll();
|
||||
|
||||
@@ -353,7 +353,6 @@ void FeatureUnlockedCutScene::init()
|
||||
void FeatureUnlockedCutScene::tearDown()
|
||||
{
|
||||
Screen::tearDown();
|
||||
((CutsceneWorld*)World::getWorld())->abortCutscene();
|
||||
} // tearDown
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -379,8 +378,6 @@ void FeatureUnlockedCutScene::onUpdate(float dt)
|
||||
float progress_factor = (m_global_time - GIFT_EXIT_FROM) / (GIFT_EXIT_TO - GIFT_EXIT_FROM);
|
||||
float smoothed_progress_factor = sin((progress_factor - 0.5f)*M_PI)/2.0f + 0.5f;
|
||||
|
||||
Log::info("smoothed_progress_factor", "%f", smoothed_progress_factor);
|
||||
|
||||
for (int n=0; n<unlockedStuffCount; n++)
|
||||
{
|
||||
if (m_unlocked_stuff[n].m_root_gift_node == NULL) continue;
|
||||
@@ -546,7 +543,6 @@ void FeatureUnlockedCutScene::addUnlockedGP(const GrandPrixData* gp)
|
||||
|
||||
bool FeatureUnlockedCutScene::onEscapePressed()
|
||||
{
|
||||
((CutsceneWorld*)World::getWorld())->abortCutscene();
|
||||
continueButtonPressed();
|
||||
return false; // continueButtonPressed already pop'ed the menu
|
||||
} // onEscapePressed
|
||||
@@ -555,35 +551,20 @@ bool FeatureUnlockedCutScene::onEscapePressed()
|
||||
|
||||
void FeatureUnlockedCutScene::continueButtonPressed()
|
||||
{
|
||||
if (m_global_time < GIFT_EXIT_TO)
|
||||
{
|
||||
// If animation was not over yet, the button is used to skip the animation
|
||||
while (m_global_time < GIFT_EXIT_TO)
|
||||
{
|
||||
// simulate all the steps of the animation until we reach the end
|
||||
onUpdate(0.4f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_GRAND_PRIX)
|
||||
{
|
||||
// in GP mode, continue GP after viewing this screen
|
||||
StateManager::get()->popMenu();
|
||||
race_manager->next();
|
||||
}
|
||||
else
|
||||
{
|
||||
// back to menu or overworld
|
||||
race_manager->exitRace();
|
||||
StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
|
||||
|
||||
if (race_manager->raceWasStartedFromOverworld())
|
||||
{
|
||||
OverWorld::enterOverWorld();
|
||||
}
|
||||
}
|
||||
}
|
||||
//if (m_global_time < GIFT_EXIT_TO)
|
||||
//{
|
||||
// // If animation was not over yet, the button is used to skip the animation
|
||||
// while (m_global_time < GIFT_EXIT_TO)
|
||||
// {
|
||||
// // simulate all the steps of the animation until we reach the end
|
||||
// onUpdate(0.4f);
|
||||
// World::getWorld()->updateWorld(0.4f);
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
((CutsceneWorld*)World::getWorld())->abortCutscene();
|
||||
//}
|
||||
|
||||
} // continueButtonPressed
|
||||
|
||||
|
||||
@@ -117,9 +117,18 @@ void GrandPrixLose::onCutsceneEnd()
|
||||
PlayerManager::getCurrentPlayer()->getRecentlyCompletedChallenges();
|
||||
if (unlocked.size() > 0)
|
||||
{
|
||||
StateManager::get()->enterGameState();
|
||||
race_manager->setMinorMode(RaceManager::MINOR_MODE_CUTSCENE);
|
||||
race_manager->setNumKarts(0);
|
||||
race_manager->setNumPlayers(0);
|
||||
race_manager->setNumLocalPlayers(0);
|
||||
race_manager->startSingleRace("featunlocked", 999, false);
|
||||
|
||||
FeatureUnlockedCutScene* scene =
|
||||
FeatureUnlockedCutScene::getInstance();
|
||||
std::vector<std::string> parts;
|
||||
parts.push_back("featunlocked");
|
||||
((CutsceneWorld*)World::getWorld())->setParts(parts);
|
||||
|
||||
scene->addTrophy(race_manager->getDifficulty());
|
||||
scene->findWhatWasUnlocked(race_manager->getDifficulty());
|
||||
|
||||
@@ -127,7 +127,18 @@ void GrandPrixWin::onCutsceneEnd()
|
||||
PlayerManager::getCurrentPlayer()->getRecentlyCompletedChallenges();
|
||||
PlayerManager::getCurrentPlayer()->clearUnlocked();
|
||||
|
||||
FeatureUnlockedCutScene* scene = FeatureUnlockedCutScene::getInstance();
|
||||
StateManager::get()->enterGameState();
|
||||
race_manager->setMinorMode(RaceManager::MINOR_MODE_CUTSCENE);
|
||||
race_manager->setNumKarts(0);
|
||||
race_manager->setNumPlayers(0);
|
||||
race_manager->setNumLocalPlayers(0);
|
||||
race_manager->startSingleRace("featunlocked", 999, false);
|
||||
|
||||
FeatureUnlockedCutScene* scene =
|
||||
FeatureUnlockedCutScene::getInstance();
|
||||
std::vector<std::string> parts;
|
||||
parts.push_back("featunlocked");
|
||||
((CutsceneWorld*)World::getWorld())->setParts(parts);
|
||||
|
||||
assert(unlocked.size() > 0);
|
||||
scene->addTrophy(race_manager->getDifficulty());
|
||||
|
||||
@@ -275,6 +275,10 @@ void RaceResultGUI::eventCallback(GUIEngine::Widget* widget,
|
||||
{
|
||||
FeatureUnlockedCutScene* scene =
|
||||
FeatureUnlockedCutScene::getInstance();
|
||||
std::vector<std::string> parts;
|
||||
parts.push_back("featunlocked");
|
||||
((CutsceneWorld*)World::getWorld())->setParts(parts);
|
||||
|
||||
scene->addTrophy(race_manager->getDifficulty());
|
||||
scene->findWhatWasUnlocked(race_manager->getDifficulty());
|
||||
StateManager::get()->popMenu();
|
||||
|
||||
@@ -89,17 +89,11 @@ void RegisterScreen::init()
|
||||
|
||||
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);
|
||||
}
|
||||
onDialogClose();
|
||||
bool online = UserConfigParams::m_internet_status
|
||||
!= Online::RequestManager::IPERM_NOT_ALLOWED;
|
||||
getWidget<CheckBoxWidget>("online")->setState(online);
|
||||
makeEntryFieldsVisible(online);
|
||||
} // init
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -108,6 +102,19 @@ void RegisterScreen::setRename(PlayerProfile *player)
|
||||
m_existing_player = player;
|
||||
} // setRename
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
/** Will be called first time STK is started, when the 'internet yes/no' dialog
|
||||
* is closed. Adjust the state of the online checkbox depending on that
|
||||
* answer.
|
||||
*/
|
||||
void RegisterScreen::onDialogClose()
|
||||
{
|
||||
bool online = UserConfigParams::m_internet_status
|
||||
!= Online::RequestManager::IPERM_NOT_ALLOWED;
|
||||
getWidget<CheckBoxWidget>("online")->setState(online);
|
||||
makeEntryFieldsVisible(online);
|
||||
} // onDialogClose
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
/** Shows or hides the entry fields for online registration, depending on
|
||||
* online mode.
|
||||
|
||||
@@ -64,6 +64,7 @@ public:
|
||||
virtual void loadedFromFile() OVERRIDE {};
|
||||
virtual void onUpdate(float dt) OVERRIDE;
|
||||
virtual bool onEscapePressed() OVERRIDE;
|
||||
virtual void onDialogClose() OVERRIDE;
|
||||
void setRename(PlayerProfile *player);
|
||||
|
||||
void acceptTerms();
|
||||
|
||||
@@ -177,6 +177,10 @@ void BaseUserScreen::selectUser(int index)
|
||||
m_username_tb->setText(profile->getLastOnlineName());
|
||||
getWidget<CheckBoxWidget>("remember-user")->setState(
|
||||
profile->rememberPassword());
|
||||
if(profile->getLastOnlineName().size()>0)
|
||||
m_username_tb->setDeactivated();
|
||||
else
|
||||
m_username_tb->setActivated();
|
||||
|
||||
// And make the password invisible if the session is saved (i.e
|
||||
// the user does not need to enter a password).
|
||||
@@ -339,10 +343,11 @@ void BaseUserScreen::login()
|
||||
m_sign_out_name = current->getLastOnlineName();
|
||||
current->requestSignOut();
|
||||
m_state = (UserScreenState)(m_state | STATE_LOGOUT);
|
||||
|
||||
// If the online user name was changed, reset the save data
|
||||
// for this user (otherwise later the saved session will be
|
||||
// resumed, not logging the user with the new account).
|
||||
if(current->getLastOnlineName()!=new_username)
|
||||
if(player==current && current->getLastOnlineName()!=new_username)
|
||||
current->clearSession();
|
||||
}
|
||||
PlayerManager::get()->setCurrentPlayer(player);
|
||||
@@ -567,34 +572,6 @@ void BaseUserScreen::unloaded()
|
||||
} // unloaded
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Gets called when a dialog closes. At a first time start of STK the
|
||||
* internet dialog is shown first. Only when this dialog closes is it possible
|
||||
* to open the next dialog, which is the one to create a new player (which
|
||||
* is conventient on a first start).
|
||||
*/
|
||||
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
|
||||
// internet allowed dialog, the 2nd time
|
||||
static int number_of_calls = 0;
|
||||
number_of_calls++;
|
||||
if(PlayerManager::get()->getNumPlayers() == 0)
|
||||
{
|
||||
// Still 0 players after the enter player dialog was shown
|
||||
// --> User wanted to abort, so pop this menu, which will
|
||||
// trigger the end of STK.
|
||||
if (number_of_calls > 1)
|
||||
{
|
||||
StateManager::get()->popMenu();
|
||||
return;
|
||||
}
|
||||
StateManager::get()->pushScreen(RegisterScreen::getInstance());
|
||||
} // getNumPlayers == 0
|
||||
} // onDialogClose
|
||||
|
||||
|
||||
// ============================================================================
|
||||
/** In the tab version, make sure the right tab is selected.
|
||||
|
||||
@@ -89,7 +89,6 @@ private:
|
||||
void deletePlayer();
|
||||
void doDeletePlayer();
|
||||
PlayerProfile* getSelectedPlayer();
|
||||
virtual void onDialogClose();
|
||||
virtual void onUpdate(float dt) OVERRIDE;
|
||||
|
||||
public:
|
||||
|
||||
@@ -168,6 +168,14 @@ public:
|
||||
Vec3 operator-(const Vec3& v1) const {return (Vec3)(*(btVector3*)this
|
||||
-(btVector3)v1); }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Computes this = this - v1. On VS this special version is needed,
|
||||
* since otherwise Vec3-btVector3 is ont unique (could be cast to
|
||||
* btVector3-btVector3, or convert btVector3 to Vec3()). */
|
||||
Vec3 operator-(const btVector3 v1) const
|
||||
{
|
||||
return *(btVector3*)this - v1;
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Helper functions to treat this vec3 as a 2d vector. This returns the
|
||||
* square of the length of the first 2 dimensions. */
|
||||
float length2_2d() const { return m_floats[0]*m_floats[0]
|
||||
|
||||
Reference in New Issue
Block a user