Merge branch 'master' of github.com:supertuxkart/stk-code
This commit is contained in:
commit
c733378bf3
@ -89,6 +89,19 @@ static PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribs_ARB;
|
||||
static HGLRC getMeAGLContext(HDC HDc)
|
||||
{
|
||||
HGLRC hrc = 0;
|
||||
int ctx44[] =
|
||||
{
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB, 4,
|
||||
WGL_CONTEXT_MINOR_VERSION_ARB, 3,
|
||||
WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_DEBUG_BIT_ARB,
|
||||
WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
|
||||
0
|
||||
};
|
||||
|
||||
hrc = wglCreateContextAttribs_ARB(HDc, 0, ctx44);
|
||||
if (hrc)
|
||||
return hrc;
|
||||
|
||||
int ctx40[] =
|
||||
{
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB, 4,
|
||||
|
@ -71,6 +71,9 @@ PFNGLUNIFORMBLOCKBINDINGPROC glUniformBlockBinding;
|
||||
PFNGLBLENDCOLORPROC glBlendColor;
|
||||
PFNGLCOMPRESSEDTEXIMAGE2DPROC glCompressedTexImage2D;
|
||||
PFNGLGETCOMPRESSEDTEXIMAGEPROC glGetCompressedTexImage;
|
||||
PFNGLTEXSTORAGE1DPROC glTexStorage1D;
|
||||
PFNGLTEXSTORAGE2DPROC glTexStorage2D;
|
||||
PFNGLTEXSTORAGE3DPROC glTexStorage3D;
|
||||
#endif
|
||||
|
||||
static bool is_gl_init = false;
|
||||
@ -220,6 +223,9 @@ void initGL()
|
||||
glBlendColor = (PFNGLBLENDCOLORPROC)IRR_OGL_LOAD_EXTENSION("glBlendColor");
|
||||
glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)IRR_OGL_LOAD_EXTENSION("glCompressedTexImage2D");
|
||||
glGetCompressedTexImage = (PFNGLGETCOMPRESSEDTEXIMAGEPROC)IRR_OGL_LOAD_EXTENSION("glGetCompressedTexImage");
|
||||
glTexStorage1D = (PFNGLTEXSTORAGE1DPROC)IRR_OGL_LOAD_EXTENSION("glTexStorage1D");
|
||||
glTexStorage2D = (PFNGLTEXSTORAGE2DPROC)IRR_OGL_LOAD_EXTENSION("glTexStorage2D");
|
||||
glTexStorage3D = (PFNGLTEXSTORAGE3DPROC)IRR_OGL_LOAD_EXTENSION("glTexStorage3D");
|
||||
#ifdef DEBUG
|
||||
glDebugMessageCallbackARB = (PFNGLDEBUGMESSAGECALLBACKARBPROC)IRR_OGL_LOAD_EXTENSION("glDebugMessageCallbackARB");
|
||||
#endif
|
||||
|
@ -94,6 +94,9 @@ 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
|
||||
|
@ -740,7 +740,7 @@ void IrrDriver::computeCameraMatrix(scene::ICameraSceneNode * const camnode, siz
|
||||
|
||||
sun_ortho_matrix.push_back(getVideoDriver()->getTransform(video::ETS_PROJECTION) * getVideoDriver()->getTransform(video::ETS_VIEW));
|
||||
}
|
||||
if (!(tick % 100))
|
||||
if ((tick % 100) == 2)
|
||||
rsm_matrix = sun_ortho_matrix[3];
|
||||
rh_extend = core::vector3df(128, 64, 128);
|
||||
core::vector3df campos = camnode->getAbsolutePosition();
|
||||
@ -940,7 +940,9 @@ void IrrDriver::renderLights(scene::ICameraSceneNode * const camnode, float dt)
|
||||
if (!m_lights[i]->isPointLight())
|
||||
{
|
||||
m_lights[i]->render();
|
||||
if (UserConfigParams::m_shadows && World::getWorld()->getTrack()->hasShadows())
|
||||
if (!World::getWorld()->getTrack()->hasShadows())
|
||||
continue;
|
||||
if (UserConfigParams::m_shadows)
|
||||
m_post_processing->renderShadowedSunlight(sun_ortho_matrix, m_rtts->getShadowDepthTex());
|
||||
else
|
||||
m_post_processing->renderSunlight();
|
||||
|
@ -27,7 +27,10 @@ static GLuint generateRTT(const core::dimension2du &res, GLint internalFormat, G
|
||||
GLuint result;
|
||||
glGenTextures(1, &result);
|
||||
glBindTexture(GL_TEXTURE_2D, result);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, res.Width, res.Height, 0, format, type, 0);
|
||||
if (irr_driver->getGLSLVersion() < 420)
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, res.Width, res.Height, 0, format, type, 0);
|
||||
else
|
||||
glTexStorage2D(GL_TEXTURE_2D, 1, internalFormat, res.Width, res.Height);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -188,7 +191,7 @@ RTT::RTT(size_t width, size_t height)
|
||||
somevector.push_back(RenderTargetTextures[RTT_TMP_128]);
|
||||
FrameBuffers.push_back(new FrameBuffer(somevector, 128, 128));
|
||||
|
||||
if (irr_driver->getGLSLVersion() >= 150)
|
||||
if (UserConfigParams::m_shadows)
|
||||
{
|
||||
glGenTextures(1, &shadowColorTex);
|
||||
glBindTexture(GL_TEXTURE_2D_ARRAY, shadowColorTex);
|
||||
@ -200,7 +203,10 @@ RTT::RTT(size_t width, size_t height)
|
||||
somevector.clear();
|
||||
somevector.push_back(shadowColorTex);
|
||||
m_shadow_FBO = new FrameBuffer(somevector, shadowDepthTex, 1024, 1024, true);
|
||||
}
|
||||
|
||||
if (UserConfigParams::m_gi)
|
||||
{
|
||||
//Todo : use "normal" shadowtex
|
||||
glGenTextures(1, &RSM_Color);
|
||||
glBindTexture(GL_TEXTURE_2D, RSM_Color);
|
||||
@ -240,10 +246,13 @@ RTT::~RTT()
|
||||
{
|
||||
glDeleteTextures(RTT_COUNT, RenderTargetTextures);
|
||||
glDeleteTextures(1, &DepthStencilTexture);
|
||||
if (irr_driver->getGLSLVersion() >= 150)
|
||||
if (UserConfigParams::m_shadows)
|
||||
{
|
||||
glDeleteTextures(1, &shadowColorTex);
|
||||
glDeleteTextures(1, &shadowDepthTex);
|
||||
}
|
||||
if (UserConfigParams::m_gi)
|
||||
{
|
||||
glDeleteTextures(1, &RSM_Color);
|
||||
glDeleteTextures(1, &RSM_Normal);
|
||||
glDeleteTextures(1, &RSM_Depth);
|
||||
|
@ -98,12 +98,20 @@ void GrandPrixData::reload()
|
||||
{
|
||||
Log::error("GrandPrixData",
|
||||
"Error while trying to read grandprix file '%s': "
|
||||
"missing 'name' attribute", m_filename.c_str());
|
||||
"Missing 'name' attribute", m_filename.c_str());
|
||||
throw std::runtime_error("Missing name attribute");
|
||||
}
|
||||
|
||||
// Every iteration means parsing one track entry
|
||||
const int amount = root->getNumNodes();
|
||||
if (amount == 0)
|
||||
{
|
||||
Log::error("GrandPrixData",
|
||||
"Error while trying to read grandprix file '%s': "
|
||||
"There is no track defined", m_filename.c_str());
|
||||
throw std::runtime_error("No track defined");
|
||||
}
|
||||
|
||||
// Every iteration means parsing one track entry
|
||||
for (int i = 0; i < amount; i++)
|
||||
{
|
||||
const XMLNode* node = root->getNode(i);
|
||||
@ -235,7 +243,7 @@ bool GrandPrixData::checkConsistency(bool log_error) const
|
||||
* is unlocked). It also prevents people from using the grand prix editor as
|
||||
* a way to play tracks that still haven't been unlocked
|
||||
*/
|
||||
bool GrandPrixData::isTrackAvailable(const std::string &id,
|
||||
bool GrandPrixData::isTrackAvailable(const std::string &id,
|
||||
bool includeLocked ) const
|
||||
{
|
||||
if (includeLocked)
|
||||
|
@ -57,13 +57,7 @@ GPInfoDialog::GPInfoDialog(const std::string& gpIdent, const float w, const floa
|
||||
m_gp_ident = gpIdent;
|
||||
|
||||
const GrandPrixData* gp = grand_prix_manager->getGrandPrix(gpIdent);
|
||||
if (gp == NULL)
|
||||
{
|
||||
assert(false);
|
||||
std::cerr << "ERROR at " << __FILE__ << " : " << __LINE__ << "; trying to continue\n";
|
||||
ModalDialog::dismiss();
|
||||
return;
|
||||
}
|
||||
assert (gp != NULL);
|
||||
|
||||
// ---- GP Name
|
||||
core::rect< s32 > area_top(0, 0, m_area.getWidth(), y1);
|
||||
@ -183,14 +177,14 @@ GPInfoDialog::GPInfoDialog(const std::string& gpIdent, const float w, const floa
|
||||
continueBtn->add();
|
||||
continueBtn->getIrrlichtElement()->setTabStop(true);
|
||||
continueBtn->getIrrlichtElement()->setTabGroup(false);
|
||||
|
||||
|
||||
okBtn->m_x = m_area.getWidth()/2 - 310;
|
||||
}
|
||||
else
|
||||
{
|
||||
okBtn->m_x = m_area.getWidth()/2 - 200;
|
||||
}
|
||||
|
||||
|
||||
okBtn->m_y = y2;
|
||||
okBtn->m_w = 400;
|
||||
okBtn->m_h = m_area.getHeight() - y2 - 15;
|
||||
@ -201,7 +195,7 @@ GPInfoDialog::GPInfoDialog(const std::string& gpIdent, const float w, const floa
|
||||
okBtn->getIrrlichtElement()->setTabGroup(false);
|
||||
|
||||
okBtn->setFocusForPlayer( PLAYER_ID_GAME_MASTER );
|
||||
|
||||
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
|
@ -46,20 +46,8 @@ DEFINE_SCREEN_SINGLETON( TracksScreen );
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
TracksScreen::TracksScreen() : Screen("tracks.stkgui")
|
||||
{
|
||||
} // TracksScreen
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void TracksScreen::loadedFromFile()
|
||||
{
|
||||
} // loadedFromFile
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void TracksScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
const int playerID )
|
||||
const int playerID)
|
||||
{
|
||||
// -- track selection screen
|
||||
if (name == "tracks")
|
||||
@ -87,8 +75,8 @@ void TracksScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
std::string track = m_random_track_list.front();
|
||||
m_random_track_list.pop_front();
|
||||
m_random_track_list.push_back(track);
|
||||
Track* clicked_track = track_manager->getTrack(track);
|
||||
|
||||
Track* clicked_track = track_manager->getTrack(track);
|
||||
|
||||
if (clicked_track)
|
||||
{
|
||||
@ -129,29 +117,17 @@ void TracksScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
else if (name == "gps")
|
||||
{
|
||||
DynamicRibbonWidget* gps_widget = dynamic_cast<DynamicRibbonWidget*>(widget);
|
||||
if (gps_widget)
|
||||
{
|
||||
const std::string &selection =
|
||||
const std::string &selection =
|
||||
gps_widget->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||
|
||||
if (selection == "locked")
|
||||
{
|
||||
unlock_manager->playLockSound();
|
||||
}
|
||||
else
|
||||
{
|
||||
new GPInfoDialog( selection, 0.8f, 0.7f );
|
||||
}
|
||||
}
|
||||
if (selection == "locked")
|
||||
unlock_manager->playLockSound();
|
||||
else
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
} // name=="gps"
|
||||
new GPInfoDialog(selection, 0.8f, 0.7f);
|
||||
}
|
||||
else if (name == "trackgroups")
|
||||
{
|
||||
RibbonWidget* tabs = getWidget<RibbonWidget>("trackgroups");
|
||||
assert( tabs );
|
||||
RibbonWidget* tabs = this->getWidget<RibbonWidget>("trackgroups");
|
||||
UserConfigParams::m_last_used_track_group = tabs->getSelectionIDString(0);
|
||||
buildTrackList();
|
||||
}
|
||||
@ -166,10 +142,7 @@ void TracksScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
void TracksScreen::beforeAddingWidget()
|
||||
{
|
||||
Screen::init();
|
||||
// Dynamically add tabs
|
||||
RibbonWidget* tabs = getWidget<RibbonWidget>("trackgroups");
|
||||
assert( tabs );
|
||||
|
||||
tabs->clearAllChildren();
|
||||
|
||||
const std::vector<std::string>& groups = track_manager->getAllTrackGroups();
|
||||
@ -188,15 +161,11 @@ void TracksScreen::beforeAddingWidget()
|
||||
//I18N: track group name
|
||||
FOR_GETTEXT_ONLY( _("Add-Ons") )
|
||||
|
||||
// add others after
|
||||
// add behind the other categories
|
||||
for (int n=0; n<group_amount; n++)
|
||||
{
|
||||
// try to translate the group name
|
||||
tabs->addTextChild( _(groups[n].c_str()), groups[n] );
|
||||
}
|
||||
|
||||
DynamicRibbonWidget* tracks_widget = getWidget<DynamicRibbonWidget>("tracks");
|
||||
assert( tracks_widget );
|
||||
tracks_widget->setItemCountHint( track_manager->getNumberOfTracks()+1 );
|
||||
} // beforeAddingWidget
|
||||
|
||||
@ -204,69 +173,60 @@ void TracksScreen::beforeAddingWidget()
|
||||
|
||||
void TracksScreen::init()
|
||||
{
|
||||
DynamicRibbonWidget* gps_widget = getWidget<DynamicRibbonWidget>("gps");
|
||||
assert( gps_widget );
|
||||
|
||||
DynamicRibbonWidget* gps_widget = getWidget<DynamicRibbonWidget>("gps");
|
||||
DynamicRibbonWidget* tracks_widget = getWidget<DynamicRibbonWidget>("tracks");
|
||||
assert( tracks_widget );
|
||||
assert(tracks_widget != NULL);
|
||||
|
||||
// Reset GP list everytime (accounts for locking changes, etc.)
|
||||
gps_widget->clearItems();
|
||||
|
||||
// Ensure that no GP and no track is NULL
|
||||
grand_prix_manager->checkConsistency();
|
||||
|
||||
// Build GP list
|
||||
const int gpAmount = grand_prix_manager->getNumberOfGrandPrix();
|
||||
for (int n=0; n<gpAmount; n++)
|
||||
{
|
||||
const GrandPrixData* gp = grand_prix_manager->getGrandPrix(n);
|
||||
|
||||
const std::vector<std::string> tracks = gp->getTrackNames(true);
|
||||
|
||||
std::vector<std::string> sshot_files;
|
||||
std::vector<std::string> screenshots;
|
||||
for (unsigned int t=0; t<tracks.size(); t++)
|
||||
{
|
||||
Track* curr = track_manager->getTrack(tracks[t]);
|
||||
if (!curr )
|
||||
{
|
||||
Log::warn("TracksScreen", "Grand Prix '%s' refers to track '%s',"
|
||||
"which does not exist.",
|
||||
gp->getId().c_str(), tracks[t].c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
sshot_files.push_back(curr->getScreenshotFile());
|
||||
}
|
||||
}
|
||||
if (sshot_files.size() == 0)
|
||||
{
|
||||
Log::warn("TracksScreen",
|
||||
"Grand Prix '%s' does not contain any valid track.",
|
||||
gp->getId().c_str());
|
||||
sshot_files.push_back("gui/main_help.png");
|
||||
const Track* curr = track_manager->getTrack(tracks[t]);
|
||||
screenshots.push_back(curr->getScreenshotFile());
|
||||
}
|
||||
assert(screenshots.size() > 0);
|
||||
|
||||
if (PlayerManager::getCurrentPlayer()->isLocked(gp->getId()))
|
||||
{
|
||||
gps_widget->addAnimatedItem(_("Locked!"),
|
||||
"locked", sshot_files, 1.5f,
|
||||
gps_widget->addAnimatedItem(_("Locked!"), "locked",
|
||||
screenshots, 1.5f,
|
||||
LOCKED_BADGE | TROPHY_BADGE,
|
||||
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gps_widget->addAnimatedItem(translations->fribidize(gp->getName()),
|
||||
gp->getId(),
|
||||
sshot_files, 1.5f, TROPHY_BADGE,
|
||||
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE );
|
||||
gp->getId(), screenshots, 1.5f,
|
||||
TROPHY_BADGE,
|
||||
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);
|
||||
}
|
||||
}
|
||||
|
||||
/*// Random GP - not finished yet
|
||||
std::vector<std::string> screenshots;
|
||||
screenshots.push_back("gui/main_help.png");
|
||||
gps_widget->addAnimatedItem(translations->fribidize("Random"), "Random",
|
||||
screenshots, 1.5f, 0,
|
||||
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);*/
|
||||
|
||||
gps_widget->updateItemDisplay();
|
||||
|
||||
|
||||
RibbonWidget* tabs = getWidget<RibbonWidget>("trackgroups");
|
||||
assert( tabs );
|
||||
tabs->select(UserConfigParams::m_last_used_track_group, PLAYER_ID_GAME_MASTER);
|
||||
|
||||
|
||||
buildTrackList();
|
||||
|
||||
// select old track for the game master (if found)
|
||||
@ -287,11 +247,8 @@ void TracksScreen::init()
|
||||
*/
|
||||
void TracksScreen::buildTrackList()
|
||||
{
|
||||
DynamicRibbonWidget* tracks_widget = getWidget<DynamicRibbonWidget>("tracks");
|
||||
assert( tracks_widget);
|
||||
|
||||
RibbonWidget* tabs = getWidget<RibbonWidget>("trackgroups");
|
||||
assert( tabs );
|
||||
DynamicRibbonWidget* tracks_widget = this->getWidget<DynamicRibbonWidget>("tracks");
|
||||
RibbonWidget* tabs = this->getWidget<RibbonWidget>("trackgroups");
|
||||
|
||||
// Reset track list everytime (accounts for locking changes, etc.)
|
||||
tracks_widget->clearItems();
|
||||
@ -338,8 +295,8 @@ void TracksScreen::buildTrackList()
|
||||
}
|
||||
}
|
||||
|
||||
tracks_widget->addItem(_("Random Track"), "random_track",
|
||||
"/gui/track_random.png", 0 /* no badge */,
|
||||
tracks_widget->addItem(_("Random Track"), "random_track",
|
||||
"/gui/track_random.png", 0 /* no badge */,
|
||||
IconButtonWidget::ICON_PATH_TYPE_RELATIVE);
|
||||
|
||||
tracks_widget->updateItemDisplay();
|
||||
@ -350,8 +307,7 @@ void TracksScreen::buildTrackList()
|
||||
|
||||
void TracksScreen::setFocusOnTrack(const std::string& trackName)
|
||||
{
|
||||
DynamicRibbonWidget* tracks_widget = getWidget<DynamicRibbonWidget>("tracks");
|
||||
assert( tracks_widget);
|
||||
DynamicRibbonWidget* tracks_widget = this->getWidget<DynamicRibbonWidget>("tracks");
|
||||
|
||||
// only the game master can select tracks,
|
||||
// so it's safe to use 'PLAYER_ID_GAME_MASTER'
|
||||
@ -363,7 +319,6 @@ void TracksScreen::setFocusOnTrack(const std::string& trackName)
|
||||
void TracksScreen::setFocusOnGP(const std::string& gpName)
|
||||
{
|
||||
DynamicRibbonWidget* gps_widget = getWidget<DynamicRibbonWidget>("gps");
|
||||
assert( gps_widget );
|
||||
|
||||
// only the game master can select tracks/GPs,
|
||||
// so it's safe to use 'PLAYER_ID_GAME_MASTER'
|
||||
|
@ -27,11 +27,12 @@ namespace GUIEngine { class Widget; }
|
||||
* \brief screen where the user can select a track
|
||||
* \ingroup states_screens
|
||||
*/
|
||||
class TracksScreen : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<TracksScreen>
|
||||
class TracksScreen : public GUIEngine::Screen,
|
||||
public GUIEngine::ScreenSingleton<TracksScreen>
|
||||
{
|
||||
friend class GUIEngine::ScreenSingleton<TracksScreen>;
|
||||
|
||||
TracksScreen();
|
||||
TracksScreen() : Screen("tracks.stkgui") {}
|
||||
|
||||
/** adds the tracks from the current track group into the tracks ribbon */
|
||||
void buildTrackList();
|
||||
@ -41,10 +42,11 @@ class TracksScreen : public GUIEngine::Screen, public GUIEngine::ScreenSingleton
|
||||
public:
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void loadedFromFile() OVERRIDE;
|
||||
virtual void loadedFromFile() OVERRIDE {};
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name,
|
||||
virtual void eventCallback(GUIEngine::Widget* widget,
|
||||
const std::string& name,
|
||||
const int playerID) OVERRIDE;
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
|
Loading…
Reference in New Issue
Block a user