Merge remote-tracking branch 'upstream/master' into perPlayerDifficulties
Conflicts: data/gui/user_screen.stkgui data/gui/user_screen_tab.stkgui src/karts/kart.cpp
This commit is contained in:
commit
dc78c35b50
22
data/fonts/materials.xml
Normal file
22
data/fonts/materials.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
<materials>
|
||||
<!-- Fonts -->
|
||||
<material name="title_font.png" shader="unlit"/>
|
||||
<material name="title_font_2.png" shader="unlit"/>
|
||||
<material name="sigmar0.png" shader="unlit"/>
|
||||
<material name="AR_PL_SungtiL_GB0.png" shader="unlit"/>
|
||||
<material name="comix.png" shader="unlit"/>
|
||||
<material name="LayneHansom0.png" shader="unlit"/>
|
||||
<material name="LayneHansomBigDigits.png" shader="unlit"/>
|
||||
<material name="Mplus2p_JP0.png" shader="unlit"/>
|
||||
<material name="rasheeq0.png" shader="unlit"/>
|
||||
<material name="rasheeq3.png" shader="unlit"/>
|
||||
<material name="rasheeq4.png" shader="unlit"/>
|
||||
<material name="wqyMicroHei0.png" shader="unlit"/>
|
||||
<material name="wqyMicroHei1.png" shader="unlit"/>
|
||||
<material name="wqyMicroHei2.png" shader="unlit"/>
|
||||
<material name="wqyMicroHei3.png" shader="unlit"/>
|
||||
<material name="wqyMicroHei4.png" shader="unlit"/>
|
||||
<material name="wqyMicroHei5.png" shader="unlit"/>
|
||||
|
||||
</materials>
|
@ -9,9 +9,8 @@
|
||||
<spacer height="25" width="10"/>
|
||||
|
||||
<tabs id="profile_tabs" height="10%" max_height="110" x="2%" width="98%" align="center">
|
||||
<icon-button id="tab_overview" width="128" height="128" icon="gui/options_ui.png" />
|
||||
<icon-button id="tab_friends" width="128" height="128" icon="gui/options_players.png"/>
|
||||
<icon-button id="tab_achievements" width="128" height="128" icon="gui/options_players.png" I18N="Section in the profile menu" text="Achievements"/>
|
||||
<icon-button id="tab_friends" width="128" height="128" icon="gui/options_players.png"/>
|
||||
<icon-button id="tab_settings" width="128" height="128" icon="gui/main_options.png"/>
|
||||
</tabs>
|
||||
|
||||
|
@ -9,9 +9,8 @@
|
||||
<spacer height="25" width="10"/>
|
||||
|
||||
<tabs id="profile_tabs" height="10%" max_height="110" x="2%" width="98%" align="center">
|
||||
<icon-button id="tab_overview" width="128" height="128" icon="gui/options_ui.png" />
|
||||
<icon-button id="tab_friends" width="128" height="128" icon="gui/options_players.png" I18N="Section in the profile menu" text="Friends"/>
|
||||
<icon-button id="tab_achievements" width="128" height="128" icon="gui/options_players.png"/>
|
||||
<icon-button id="tab_friends" width="128" height="128" icon="gui/options_players.png" I18N="Section in the profile menu" text="Friends"/>
|
||||
<icon-button id="tab_settings" width="128" height="128" icon="gui/main_options.png"/>
|
||||
</tabs>
|
||||
|
||||
|
@ -9,9 +9,8 @@
|
||||
<spacer height="25" width="10"/>
|
||||
|
||||
<tabs id="profile_tabs" height="10%" max_height="110" x="2%" width="98%" align="center">
|
||||
<icon-button id="tab_overview" width="128" height="128" icon="gui/options_ui.png"/>
|
||||
<icon-button id="tab_friends" width="128" height="128" icon="gui/options_players.png" />
|
||||
<icon-button id="tab_achievements" width="128" height="128" icon="gui/options_players.png"/>
|
||||
<icon-button id="tab_friends" width="128" height="128" icon="gui/options_players.png" />
|
||||
<icon-button id="tab_settings" width="128" height="128" icon="gui/main_options.png" I18N="Section in the profile menu" text="Account Settings"/>
|
||||
</tabs>
|
||||
|
||||
|
@ -13,23 +13,27 @@
|
||||
square_items="true" child_width="128" child_height="128" />
|
||||
|
||||
<spacer height="15" width="10"/>
|
||||
<div width="80%" align="center" layout="vertical-row" height="fit">
|
||||
<div width="90%" align="center" layout="vertical-row" height="fit">
|
||||
<div width="100%" height="fit" layout="horizontal-row" >
|
||||
<label proportion="1" height="100%" text_align="left" I18N="In the user screen" text="Multiplayer Boost/Handicap"/>
|
||||
<gauge id="difficulty" min_value="0" max_value="4" width="300" align="center" />
|
||||
<spacer width="10"/>
|
||||
<label id="label_difficulty" height="100%" text_align="left" I18N="In the user screen" text="Multiplayer Boost/Handicap"/>
|
||||
</div>
|
||||
<div width="100%" height="fit" layout="horizontal-row" >
|
||||
<label proportion="1" height="100%" text_align="left" I18N="In the user screen" text="Apply Boost/Handicap in singleplayer too"/>
|
||||
<checkbox id="singleplayer-difficulty" I18N="In the user screen" text_align="left"/>
|
||||
<spacer width="10"/>
|
||||
<label id="label_singleplayer-difficulty" height="100%" text_align="left" I18N="In the user screen" text="Apply Boost/Handicap in singleplayer too"/>
|
||||
</div>
|
||||
<div width="100%" height="fit" layout="horizontal-row" >
|
||||
<label proportion="1" height="100%" text_align="left" I18N="In the user screen" text="Online"/>
|
||||
<checkbox id="online" I18N="In the user screen" text_align="left"/>
|
||||
<checkbox id="online" I18N="In the login screen" text_align="left"/>
|
||||
<spacer width="10"/>
|
||||
<label height="100%" text_align="left" I18N="In the login screen" text="Online"/>
|
||||
</div>
|
||||
<div width="100%" height="fit" layout="horizontal-row" >
|
||||
<label id="label_remember" proportion="1" height="100%" text_align="left"
|
||||
I18N="In the user screen" text="Remember password"/>
|
||||
<checkbox id="remember-user" I18N="In the user screen" text_align="left"/>
|
||||
<checkbox id="remember-user" I18N="In the login screen" text_align="left"/>
|
||||
<spacer width="10"/>
|
||||
<label id="label_remember" height="100%" text_align="left"
|
||||
I18N="In the login screen" text="Remember password"/>
|
||||
</div>
|
||||
<!-- Disable guest accounts for now
|
||||
<div width="100%" height="fit" layout="horizontal-row" >
|
||||
|
@ -20,23 +20,27 @@
|
||||
square_items="true" child_width="128" child_height="128" />
|
||||
|
||||
<spacer height="5" width="10"/>
|
||||
<div width="80%" align="center" layout="vertical-row" height="fit">
|
||||
<div width="90%" align="center" layout="vertical-row" height="fit">
|
||||
<div width="100%" height="fit" layout="horizontal-row" >
|
||||
<label proportion="1" height="100%" text_align="left" I18N="In the user screen" text="Multiplayer Boost/Handicap"/>
|
||||
<gauge id="difficulty" min_value="0" max_value="4" width="300" align="center" />
|
||||
<spacer width="10"/>
|
||||
<label id="label_difficulty" height="100%" text_align="left" I18N="In the user screen" text="Multiplayer Boost/Handicap"/>
|
||||
</div>
|
||||
<div width="100%" height="fit" layout="horizontal-row" >
|
||||
<label proportion="1" height="100%" text_align="left" I18N="In the user screen" text="Apply Boost/Handicap in singleplayer too"/>
|
||||
<checkbox id="singleplayer-difficulty" I18N="In the user screen" text_align="left"/>
|
||||
<spacer width="10"/>
|
||||
<label id="label_singleplayer-difficulty" height="100%" text_align="left" I18N="In the user screen" text="Apply Boost/Handicap in singleplayer too"/>
|
||||
</div>
|
||||
<div width="100%" height="fit" layout="horizontal-row" >
|
||||
<label proportion="1" height="100%" text_align="left" I18N="In the user screen" text="Online"/>
|
||||
<checkbox id="online" I18N="In the user screen" text_align="left"/>
|
||||
<spacer width="10"/>
|
||||
<label height="100%" text_align="left" I18N="In the user screen" text="Online"/>
|
||||
</div>
|
||||
<div width="100%" height="fit" layout="horizontal-row" >
|
||||
<label id="label_remember" proportion="1" height="100%" text_align="left"
|
||||
I18N="In the user screen" text="Remember password"/>
|
||||
<checkbox id="remember-user" I18N="In the user screen" text_align="left"/>
|
||||
<spacer width="10"/>
|
||||
<label id="label_remember" height="100%" text_align="left"
|
||||
I18N="In the user screen" text="Remember password"/>
|
||||
</div>
|
||||
<!-- Disable guest accounts for now
|
||||
<div width="100%" height="fit" layout="horizontal-row" >
|
||||
|
@ -35,7 +35,7 @@ void main(void)
|
||||
float updated_lifetime = lifetime + (float(dt)/lifetime_initial);
|
||||
if (updated_lifetime > 1.)
|
||||
{
|
||||
if (gl_VertexID <= level)
|
||||
if (gl_VertexID < level)
|
||||
{
|
||||
float dt_from_last_frame = fract(updated_lifetime) * lifetime_initial;
|
||||
vec4 updated_initialposition = sourcematrix * vec4(particle_position_initial, 1.0);
|
||||
|
@ -11,8 +11,9 @@ void main(void)
|
||||
{
|
||||
vec3 eyedir = gl_FragCoord.xyz / vec3(screen, 1.);
|
||||
eyedir = 2.0 * eyedir - 1.0;
|
||||
vec4 tmp = (InverseViewMatrix * InverseProjectionMatrix * vec4(eyedir, 1.));
|
||||
eyedir = tmp.xyz / tmp.w;
|
||||
vec4 tmp = (InverseProjectionMatrix * vec4(eyedir, 1.));
|
||||
tmp /= tmp.w;
|
||||
eyedir = (InverseViewMatrix * vec4(tmp.xyz, 0.)).xyz;
|
||||
vec4 color = texture(tex, eyedir);
|
||||
FragColor = vec4(color.xyz, 1.);
|
||||
}
|
||||
|
@ -153,8 +153,8 @@
|
||||
when the camera is pointing backwards. This is usually
|
||||
larger than the forward-up-angle, since the kart itself
|
||||
otherwise obstricts too much of the view. -->
|
||||
<camera distance="1.5" forward-up-angle="15"
|
||||
backward-up-angle="30"/>
|
||||
<camera distance="1.0" forward-up-angle="15"
|
||||
backward-up-angle="5"/>
|
||||
<!-- Additional offset to move graphical chassis with regards to the physics. -->
|
||||
<graphics y-offset="0.0"/>
|
||||
|
||||
@ -473,7 +473,7 @@
|
||||
<stability roll-influence="0.3"
|
||||
chassis-linear-damping="0.2"
|
||||
chassis-angular-damping="0"
|
||||
downward-impulse-factor="0"
|
||||
downward-impulse-factor="5"
|
||||
track-connection-accel="2"
|
||||
smooth-flying-impulse="25"/>
|
||||
|
||||
|
@ -77,6 +77,8 @@ struct btWheelInfo
|
||||
|
||||
bool m_bIsFrontWheel;
|
||||
|
||||
bool m_was_on_ground;
|
||||
|
||||
void* m_clientInfo;//can be used to store pointer to sync transforms...
|
||||
|
||||
btWheelInfo(btWheelInfoConstructionInfo& ci)
|
||||
@ -102,7 +104,7 @@ struct btWheelInfo
|
||||
m_rollInfluence = btScalar(0.1);
|
||||
m_bIsFrontWheel = ci.m_bIsFrontWheel;
|
||||
m_maxSuspensionForce = ci.m_maxSuspensionForce;
|
||||
|
||||
m_was_on_ground = true;
|
||||
}
|
||||
|
||||
void updateWheel(const btRigidBody& chassis,RaycastInfo& raycastInfo);
|
||||
|
@ -277,7 +277,7 @@ void CGUIButton::draw()
|
||||
pos.X += skin->getSize(EGDS_BUTTON_PRESSED_IMAGE_OFFSET_X);
|
||||
pos.Y += skin->getSize(EGDS_BUTTON_PRESSED_IMAGE_OFFSET_Y);
|
||||
}
|
||||
driver->draw2DImage(PressedImage,
|
||||
skin->draw2DImage(PressedImage,
|
||||
ScaleImage? AbsoluteRect :
|
||||
core::recti(pos, PressedImageRect.getSize()),
|
||||
PressedImageRect, &AbsoluteClippingRect,
|
||||
@ -285,7 +285,7 @@ void CGUIButton::draw()
|
||||
}
|
||||
}
|
||||
|
||||
if (SpriteBank)
|
||||
if (false) //SpriteBank)
|
||||
{
|
||||
// pressed / unpressed animation
|
||||
u32 state = Pressed ? (u32)EGBS_BUTTON_DOWN : (u32)EGBS_BUTTON_UP;
|
||||
|
@ -584,30 +584,30 @@ void CGUIContextMenu::draw()
|
||||
skin->getColor(c), false, true, clip);
|
||||
|
||||
// draw submenu symbol
|
||||
if (Items[i].SubMenu && sprites)
|
||||
{
|
||||
core::rect<s32> r = rect;
|
||||
r.UpperLeftCorner.X = r.LowerRightCorner.X - 15;
|
||||
|
||||
sprites->draw2DSprite(skin->getIcon(EGDI_CURSOR_RIGHT),
|
||||
r.getCenter(), clip, skin->getColor(c),
|
||||
(i == HighLighted) ? ChangeTime : 0,
|
||||
(i == HighLighted) ? os::Timer::getTime() : 0,
|
||||
(i == HighLighted), true);
|
||||
}
|
||||
//if (Items[i].SubMenu && sprites)
|
||||
//{
|
||||
// core::rect<s32> r = rect;
|
||||
// r.UpperLeftCorner.X = r.LowerRightCorner.X - 15;
|
||||
//
|
||||
// sprites->draw2DSprite(skin->getIcon(EGDI_CURSOR_RIGHT),
|
||||
// r.getCenter(), clip, skin->getColor(c),
|
||||
// (i == HighLighted) ? ChangeTime : 0,
|
||||
// (i == HighLighted) ? os::Timer::getTime() : 0,
|
||||
// (i == HighLighted), true);
|
||||
//}
|
||||
|
||||
// draw checked symbol
|
||||
if (Items[i].Checked && sprites)
|
||||
{
|
||||
core::rect<s32> r = rect;
|
||||
r.LowerRightCorner.X = r.UpperLeftCorner.X - 15;
|
||||
r.UpperLeftCorner.X = r.LowerRightCorner.X + 15;
|
||||
sprites->draw2DSprite(skin->getIcon(EGDI_CHECK_BOX_CHECKED),
|
||||
r.getCenter(), clip, skin->getColor(c),
|
||||
(i == HighLighted) ? ChangeTime : 0,
|
||||
(i == HighLighted) ? os::Timer::getTime() : 0,
|
||||
(i == HighLighted), true);
|
||||
}
|
||||
//if (Items[i].Checked && sprites)
|
||||
//{
|
||||
// core::rect<s32> r = rect;
|
||||
// r.LowerRightCorner.X = r.UpperLeftCorner.X - 15;
|
||||
// r.UpperLeftCorner.X = r.LowerRightCorner.X + 15;
|
||||
// sprites->draw2DSprite(skin->getIcon(EGDI_CHECK_BOX_CHECKED),
|
||||
// r.getCenter(), clip, skin->getColor(c),
|
||||
// (i == HighLighted) ? ChangeTime : 0,
|
||||
// (i == HighLighted) ? os::Timer::getTime() : 0,
|
||||
// (i == HighLighted), true);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,20 +78,20 @@ void CGUIImage::draw()
|
||||
|
||||
if (Texture)
|
||||
{
|
||||
if (ScaleImage)
|
||||
{
|
||||
//if (ScaleImage)
|
||||
//{
|
||||
const video::SColor Colors[] = {Color,Color,Color,Color};
|
||||
|
||||
driver->draw2DImage(Texture, AbsoluteRect,
|
||||
skin->draw2DImage(Texture, AbsoluteRect,
|
||||
core::rect<s32>(core::position2d<s32>(0,0), core::dimension2di(Texture->getOriginalSize())),
|
||||
&AbsoluteClippingRect, Colors, UseAlphaChannel);
|
||||
}
|
||||
else
|
||||
{
|
||||
driver->draw2DImage(Texture, AbsoluteRect.UpperLeftCorner,
|
||||
core::rect<s32>(core::position2d<s32>(0,0), core::dimension2di(Texture->getOriginalSize())),
|
||||
&AbsoluteClippingRect, Color, UseAlphaChannel);
|
||||
}
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// driver->draw2DImage(Texture, AbsoluteRect.UpperLeftCorner,
|
||||
// core::rect<s32>(core::position2d<s32>(0,0), core::dimension2di(Texture->getOriginalSize())),
|
||||
// &AbsoluteClippingRect, Color, UseAlphaChannel);
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Modify this file to change the last-modified date when you add/remove a file.
|
||||
# This will then trigger a new cmake run automatically.
|
||||
# This will then trigger a new cmake run automatically.
|
||||
file(GLOB_RECURSE STK_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.hpp")
|
||||
file(GLOB_RECURSE STK_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp")
|
||||
file(GLOB_RECURSE STK_SHADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "data/shaders/*")
|
||||
|
@ -113,7 +113,7 @@ irr::core::stringw AchievementInfo::toString() const
|
||||
count = m_goal_values.begin()->second;
|
||||
break;
|
||||
default:
|
||||
Log::fatal("AchievementInfo", "Missing toString for tpye %d.",
|
||||
Log::fatal("AchievementInfo", "Missing toString for type %d.",
|
||||
m_check_type);
|
||||
}
|
||||
return StringUtils::toWString(count);
|
||||
|
@ -350,6 +350,18 @@ void Camera::smoothMoveCamera(float dt)
|
||||
current_position += (wanted_position - current_position) * dt * 5;
|
||||
}
|
||||
|
||||
// Avoid camera crash: if the speed is negative, the current_position
|
||||
// can oscillate between plus and minus, getting bigger and bigger. If
|
||||
// this happens often enough, floating point overflow happens (large
|
||||
// negative speeds can happen when the kart is tumbling/falling)
|
||||
// To avoid this, we just move the camera to the wanted position if
|
||||
// the distance becomes too large (see #1356).
|
||||
if( (current_position - wanted_position).getLengthSQ() > 100)
|
||||
{
|
||||
Log::debug("camera", "Resetting camera position to avoid crash");
|
||||
current_position = wanted_position;
|
||||
}
|
||||
|
||||
if(m_mode!=CM_FALLING)
|
||||
m_camera->setPosition(current_position);
|
||||
m_camera->setTarget(current_target);//set new target
|
||||
|
@ -820,7 +820,6 @@ void getGLLimits(HardwareStats::Json *json)
|
||||
STRING(VERSION);
|
||||
STRING(VENDOR);
|
||||
STRING(RENDERER);
|
||||
STRING(EXTENSIONS);
|
||||
INTEGER(SUBPIXEL_BITS);
|
||||
INTEGER(MAX_TEXTURE_SIZE);
|
||||
INTEGER(MAX_CUBE_MAP_TEXTURE_SIZE);
|
||||
|
@ -449,21 +449,4 @@ void ParticleSystemProxy::render() {
|
||||
m_first_execution = false;
|
||||
simulate();
|
||||
draw();
|
||||
}
|
||||
|
||||
bool ParticleSystemProxy::update()
|
||||
{
|
||||
doParticleSystem(os::Timer::getTime());
|
||||
return (IsVisible && (Particles.size() != 0));
|
||||
}
|
||||
|
||||
void ParticleSystemProxy::OnRegisterSceneNode()
|
||||
{
|
||||
doParticleSystem(os::Timer::getTime());
|
||||
|
||||
if (IsVisible && (Particles.size() != 0))
|
||||
{
|
||||
SceneManager->registerNodeForRendering(this, scene::ESNRP_TRANSPARENT_EFFECT);
|
||||
ISceneNode::OnRegisterSceneNode();
|
||||
}
|
||||
}
|
||||
}
|
@ -70,7 +70,6 @@ public:
|
||||
|
||||
virtual void setEmitter(scene::IParticleEmitter* emitter);
|
||||
virtual void render();
|
||||
virtual void OnRegisterSceneNode();
|
||||
void setAlphaAdditive(bool val) { m_alpha_additive = val; }
|
||||
void setIncreaseFactor(float val) { size_increase_factor = val; }
|
||||
void setColorFrom(float r, float g, float b) { m_color_from[0] = r; m_color_from[1] = g; m_color_from[2] = b; }
|
||||
@ -79,7 +78,6 @@ public:
|
||||
const float* getColorTo() const { return m_color_to; }
|
||||
void setHeightmap(const std::vector<std::vector<float> >&, float, float, float, float);
|
||||
void setFlip();
|
||||
bool update();
|
||||
};
|
||||
|
||||
#endif // GPUPARTICLES_H
|
||||
|
@ -108,31 +108,6 @@ enum TypeFBO
|
||||
FBO_COUNT
|
||||
};
|
||||
|
||||
enum QueryPerf
|
||||
{
|
||||
Q_SOLID_PASS1,
|
||||
Q_SHADOWS,
|
||||
Q_RSM,
|
||||
Q_RH,
|
||||
Q_GI,
|
||||
Q_ENVMAP,
|
||||
Q_SUN,
|
||||
Q_POINTLIGHTS,
|
||||
Q_SSAO,
|
||||
Q_SOLID_PASS2,
|
||||
Q_TRANSPARENT,
|
||||
Q_PARTICLES,
|
||||
Q_DISPLACEMENT,
|
||||
Q_DOF,
|
||||
Q_GODRAYS,
|
||||
Q_BLOOM,
|
||||
Q_TONEMAP,
|
||||
Q_MOTIONBLUR,
|
||||
Q_MLAA,
|
||||
Q_GUI,
|
||||
Q_LAST
|
||||
};
|
||||
|
||||
enum TypeRTT
|
||||
{
|
||||
RTT_TMP1 = 0,
|
||||
|
@ -80,7 +80,11 @@ int LODNode::getLevel()
|
||||
if (camera == NULL)
|
||||
return (int)m_detail.size() - 1;
|
||||
AbstractKart* kart = camera->getKart();
|
||||
const Vec3 &pos = kart->getFrontXYZ();
|
||||
// use kart position and not camera position when a kart is available,
|
||||
// because for some effects the camera will be moved to various locations
|
||||
// (for instance shadows), so using camera position for LOD may result
|
||||
// in objects being culled when they shouldn't
|
||||
const Vec3 &pos = (kart != NULL ? kart->getFrontXYZ() : camera->getCameraSceneNode()->getAbsolutePosition());
|
||||
|
||||
const int dist =
|
||||
(int)((m_nodes[0]->getAbsolutePosition()).getDistanceFromSQ(pos.toIrrVector() ));
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "utils/profiler.hpp"
|
||||
#include "utils/tuple.hpp"
|
||||
#include "stkscenemanager.hpp"
|
||||
#include "utils/profiler.hpp"
|
||||
|
||||
#include <S3DVertex.h>
|
||||
|
||||
@ -860,8 +861,6 @@ static void multidrawShadow(unsigned i, Args ...args)
|
||||
|
||||
void IrrDriver::renderShadows()
|
||||
{
|
||||
ScopedGPUTimer Timer(getGPUTimer(Q_SHADOWS));
|
||||
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
glDepthMask(GL_TRUE);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
@ -875,7 +874,7 @@ void IrrDriver::renderShadows()
|
||||
|
||||
for (unsigned cascade = 0; cascade < 4; cascade++)
|
||||
{
|
||||
|
||||
ScopedGPUTimer Timer(getGPUTimer(Q_SHADOWS_CASCADE0 + cascade));
|
||||
std::vector<GLuint> noTexUnits;
|
||||
|
||||
renderShadow<MeshShader::ShadowShader, video::EVT_STANDARD, 1>(noTexUnits, cascade, ListMatDefault::getInstance()->Shadows[cascade]);
|
||||
|
@ -142,7 +142,11 @@ void STKAnimatedMesh::updateGL()
|
||||
if (!rnd->isTransparent())
|
||||
{
|
||||
Material* material = material_manager->getMaterialFor(mb->getMaterial().getTexture(0), mb);
|
||||
Material::ShaderType MatType = MaterialTypeToMeshMaterial(type, mb->getVertexType(), material);
|
||||
Material* material2 = NULL;
|
||||
if (mb->getMaterial().getTexture(1) != NULL)
|
||||
material2 = material_manager->getMaterialFor(mb->getMaterial().getTexture(1), mb);
|
||||
|
||||
Material::ShaderType MatType = MaterialTypeToMeshMaterial(type, mb->getVertexType(), material, material2);
|
||||
InitTextures(mesh, MatType);
|
||||
}
|
||||
|
||||
|
@ -11,12 +11,16 @@
|
||||
#include "modes/world.hpp"
|
||||
|
||||
|
||||
Material::ShaderType MaterialTypeToMeshMaterial(video::E_MATERIAL_TYPE MaterialType, video::E_VERTEX_TYPE tp, Material* material)
|
||||
Material::ShaderType MaterialTypeToMeshMaterial(video::E_MATERIAL_TYPE MaterialType, video::E_VERTEX_TYPE tp,
|
||||
Material* material, Material* layer2Material)
|
||||
{
|
||||
if (layer2Material != NULL && layer2Material->getShaderType() == Material::SHADERTYPE_SPLATTING)
|
||||
return Material::SHADERTYPE_SPLATTING;
|
||||
|
||||
switch (material->getShaderType())
|
||||
{
|
||||
default:
|
||||
return material->getShaderType();
|
||||
return material->getShaderType();
|
||||
case Material::SHADERTYPE_SOLID:
|
||||
if (MaterialType == irr_driver->getShader(ES_NORMAL_MAP))
|
||||
return Material::SHADERTYPE_NORMAL_MAP;
|
||||
|
@ -174,7 +174,8 @@ class ListDisplacement : public MiscList<ListDisplacement, GLMesh *, core::matri
|
||||
class ListInstancedGlow : public Singleton<ListInstancedGlow>, public std::vector<GLMesh *>
|
||||
{};
|
||||
|
||||
Material::ShaderType MaterialTypeToMeshMaterial(video::E_MATERIAL_TYPE MaterialType, video::E_VERTEX_TYPE tp, Material* material);
|
||||
Material::ShaderType MaterialTypeToMeshMaterial(video::E_MATERIAL_TYPE MaterialType, video::E_VERTEX_TYPE tp,
|
||||
Material* material, Material* layer2Material);
|
||||
TransparentMaterial MaterialTypeToTransparentMaterial(video::E_MATERIAL_TYPE, f32 MaterialTypeParam, Material* material);
|
||||
|
||||
void InitTextures(GLMesh &mesh, Material::ShaderType);
|
||||
|
@ -143,7 +143,10 @@ void STKMeshSceneNode::updateNoGL()
|
||||
else
|
||||
{
|
||||
assert(!isDisplacement);
|
||||
Material::ShaderType MatType = MaterialTypeToMeshMaterial(type, mb->getVertexType(), material);
|
||||
Material* material2 = NULL;
|
||||
if (mb->getMaterial().getTexture(1) != NULL)
|
||||
material2 = material_manager->getMaterialFor(mb->getMaterial().getTexture(1), mb);
|
||||
Material::ShaderType MatType = MaterialTypeToMeshMaterial(type, mb->getVertexType(), material, material2);
|
||||
if (!immediate_draw)
|
||||
MeshSolidMaterial[MatType].push_back(&mesh);
|
||||
}
|
||||
@ -179,7 +182,10 @@ void STKMeshSceneNode::updateGL()
|
||||
if (!rnd->isTransparent())
|
||||
{
|
||||
Material* material = material_manager->getMaterialFor(mb->getMaterial().getTexture(0), mb);
|
||||
Material::ShaderType MatType = material->getShaderType();// MaterialTypeToMeshMaterial(type, mb->getVertexType(), material);
|
||||
Material* material2 = NULL;
|
||||
if (mb->getMaterial().getTexture(1) != NULL)
|
||||
material2 = material_manager->getMaterialFor(mb->getMaterial().getTexture(1), mb);
|
||||
Material::ShaderType MatType = MaterialTypeToMeshMaterial(type, mb->getVertexType(), material, material2);
|
||||
if (!immediate_draw)
|
||||
InitTextures(mesh, MatType);
|
||||
}
|
||||
|
@ -435,7 +435,7 @@ parseSceneManager(core::list<scene::ISceneNode*> List, std::vector<scene::IScene
|
||||
|
||||
if (ParticleSystemProxy *node = dynamic_cast<ParticleSystemProxy *>(*I))
|
||||
{
|
||||
if (!isCulledPrecise(cam, *I) && node->update())
|
||||
if (!isCulledPrecise(cam, *I))
|
||||
ParticlesList::getInstance()->push_back(node);
|
||||
continue;
|
||||
}
|
||||
|
@ -43,7 +43,6 @@ IconButtonWidget::IconButtonWidget(ScaleMode scale_mode, const bool tab_stop,
|
||||
m_font = NULL;
|
||||
m_texture = NULL;
|
||||
m_highlight_texture = NULL;
|
||||
m_deactivated_texture = NULL;
|
||||
m_custom_aspect_ratio = 1.0f;
|
||||
|
||||
m_texture_w = 0;
|
||||
@ -56,12 +55,6 @@ IconButtonWidget::IconButtonWidget(ScaleMode scale_mode, const bool tab_stop,
|
||||
m_icon_path_type = pathType;
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
IconButtonWidget::~IconButtonWidget()
|
||||
{
|
||||
if (m_deactivated_texture != NULL)
|
||||
m_deactivated_texture->drop();
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
void IconButtonWidget::add()
|
||||
{
|
||||
// ---- Icon
|
||||
@ -196,6 +189,9 @@ void IconButtonWidget::add()
|
||||
m_id = m_element->getID();
|
||||
if (m_tab_stop) m_element->setTabOrder(m_id);
|
||||
m_element->setTabGroup(false);
|
||||
|
||||
if (!m_is_visible)
|
||||
m_element->setVisible(false);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -278,57 +274,22 @@ void IconButtonWidget::unfocused(const int playerID, Widget* new_focus)
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
video::ITexture* IconButtonWidget::getDeactivatedTexture(video::ITexture* texture)
|
||||
{
|
||||
SColor c;
|
||||
u32 g;
|
||||
|
||||
video::IVideoDriver* driver = irr_driver->getVideoDriver();
|
||||
video::IImage* image = driver->createImageFromData (texture->getColorFormat(),
|
||||
texture->getSize(), texture->lock(), false);
|
||||
texture->unlock();
|
||||
|
||||
//Turn the image into grayscale
|
||||
for (u32 x = 0; x < image->getDimension().Width; x++)
|
||||
{
|
||||
for (u32 y = 0; y < image->getDimension().Height; y++)
|
||||
{
|
||||
c = image->getPixel(x, y);
|
||||
g = ((c.getRed() + c.getGreen() + c.getBlue()) / 3);
|
||||
c.set(std::max (0, (int)c.getAlpha() - 120), g, g, g);
|
||||
image->setPixel(x, y, c);
|
||||
}
|
||||
}
|
||||
|
||||
texture = driver->addTexture(texture->getName().getPath() + "_disabled", image);
|
||||
texture->grab();
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void IconButtonWidget::setTexture(video::ITexture* texture)
|
||||
{
|
||||
m_texture = texture;
|
||||
if (texture == NULL)
|
||||
{
|
||||
if (m_deactivated_texture != NULL)
|
||||
m_deactivated_texture->drop();
|
||||
|
||||
m_deactivated_texture = NULL;
|
||||
m_texture_w = 0;
|
||||
m_texture_h = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deactivated_texture = getDeactivatedTexture(texture);
|
||||
m_texture_w = texture->getSize().Width;
|
||||
m_texture_h = texture->getSize().Height;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void IconButtonWidget::setLabelFont()
|
||||
{
|
||||
|
@ -44,10 +44,8 @@ namespace GUIEngine
|
||||
private:
|
||||
irr::video::ITexture* m_texture;
|
||||
irr::video::ITexture* m_highlight_texture;
|
||||
irr::video::ITexture* m_deactivated_texture;
|
||||
int m_texture_w, m_texture_h;
|
||||
|
||||
video::ITexture* getDeactivatedTexture(video::ITexture* texture);
|
||||
void setLabelFont();
|
||||
|
||||
public:
|
||||
@ -90,7 +88,7 @@ namespace GUIEngine
|
||||
|
||||
IconButtonWidget(ScaleMode scale_mode=SCALE_MODE_KEEP_TEXTURE_ASPECT_RATIO, const bool tab_stop=true,
|
||||
const bool focusable=true, IconPathType pathType=ICON_PATH_TYPE_RELATIVE);
|
||||
virtual ~IconButtonWidget();
|
||||
virtual ~IconButtonWidget() {};
|
||||
|
||||
/** \brief Implement callback from base class Widget */
|
||||
virtual void add();
|
||||
@ -160,8 +158,7 @@ namespace GUIEngine
|
||||
virtual void unfocused(const int playerID, Widget* new_focus);
|
||||
// --------------------------------------------------------------------
|
||||
/** Returns the texture of this button. */
|
||||
const video::ITexture* getTexture() const {
|
||||
return (Widget::isActivated() ? m_texture : m_deactivated_texture); }
|
||||
const video::ITexture* getTexture() const { return m_texture; }
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -575,8 +575,9 @@ void Kart::createPhysics()
|
||||
{
|
||||
// First: Create the chassis of the kart
|
||||
// -------------------------------------
|
||||
float kart_length = getKartLength();
|
||||
float kart_height = getKartHeight();
|
||||
const float kart_length = getKartLength();
|
||||
const float kart_width = getKartWidth();
|
||||
float kart_height = getKartHeight();
|
||||
|
||||
// improve physics for tall karts
|
||||
if (kart_height > kart_length*0.6f)
|
||||
@ -598,9 +599,9 @@ void Kart::createPhysics()
|
||||
{
|
||||
for (int x = -1; x <= 1; x += 2)
|
||||
{
|
||||
Vec3 p(x*getKartModel()->getWidth() *0.5f,
|
||||
y*getKartModel()->getHeight()*0.5f,
|
||||
z*getKartModel()->getLength()*0.5f);
|
||||
Vec3 p(x*kart_width *0.5f,
|
||||
y*kart_height *0.5f,
|
||||
z*kart_length *0.5f);
|
||||
|
||||
hull->addPoint(p*orig_factor);
|
||||
hull->addPoint(p*bevel_factor);
|
||||
@ -616,7 +617,7 @@ void Kart::createPhysics()
|
||||
{
|
||||
// All wheel positions are relative to the center of
|
||||
// the collision shape.
|
||||
wheel_pos[index].setX(x*0.5f*getKartWidth());
|
||||
wheel_pos[index].setX(x*0.5f*kart_width);
|
||||
float radius = getKartProperties()->getWheelRadius();
|
||||
// The y position of the wheels (i.e. the points where
|
||||
// the suspension is attached to) is just at the
|
||||
@ -626,8 +627,8 @@ void Kart::createPhysics()
|
||||
// point 'radius' up. That means that if the suspension
|
||||
// is fully compressed (0), the wheel will just be at
|
||||
// the bottom of the kart chassis and touch the ground
|
||||
wheel_pos[index].setY(- 0.5f*getKartHeight() + radius);
|
||||
wheel_pos[index].setZ((0.5f*getKartLength() - radius)* z);
|
||||
wheel_pos[index].setY(- 0.5f*kart_height + radius);
|
||||
wheel_pos[index].setZ((0.5f*kart_length - radius)* z);
|
||||
|
||||
}
|
||||
else
|
||||
@ -2575,8 +2576,9 @@ void Kart::updateGraphics(float dt, const Vec3& offset_xyz,
|
||||
float lean_height = tan(fabsf(m_current_lean)) * getKartWidth()*0.5f;
|
||||
|
||||
float heading = m_skidding->getVisualSkidRotation();
|
||||
float xx = fabsf(m_speed)* getKartProperties()->getDownwardImpulseFactor()*0.0006f;
|
||||
Vec3 center_shift = Vec3(0, m_skidding->getGraphicalJumpOffset()
|
||||
+ lean_height +m_graphical_y_offset, 0);
|
||||
+ lean_height +m_graphical_y_offset+xx, 0);
|
||||
center_shift = getTrans().getBasis() * center_shift;
|
||||
|
||||
Moveable::updateGraphics(dt, center_shift,
|
||||
|
@ -441,7 +441,6 @@ scene::ISceneNode* KartModel::attachModel(bool animated_models, bool always_anim
|
||||
obj.m_node = irr_driver->addAnimatedMesh(obj.m_model, node);
|
||||
obj.m_node->grab();
|
||||
|
||||
obj.m_node->setAnimationStrength(0.0f);
|
||||
obj.m_node->setFrameLoop(m_animation_frame[AF_SPEED_WEIGHTED_START], m_animation_frame[AF_SPEED_WEIGHTED_END]);
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -826,7 +825,6 @@ void KartModel::update(float dt, float rotation_dt, float steer, float speed)
|
||||
strength = speed * strength_factor;
|
||||
btClamp<float>(strength, 0.0f, 1.0f);
|
||||
}
|
||||
obj.m_node->setAnimationStrength(strength);
|
||||
|
||||
// Animation speed
|
||||
const float speed_factor = GET_VALUE(obj, m_speed_factor);
|
||||
|
10
src/main.cpp
10
src/main.cpp
@ -1206,7 +1206,15 @@ int main(int argc, char *argv[] )
|
||||
// Get into menu mode initially.
|
||||
input_manager->setMode(InputManager::MENU);
|
||||
main_loop = new MainLoop();
|
||||
material_manager -> loadMaterial ();
|
||||
material_manager->loadMaterial();
|
||||
|
||||
// Load the font textures
|
||||
file_manager->pushTextureSearchPath(
|
||||
file_manager->getAsset(FileManager::FONT,""));
|
||||
material_manager->addSharedMaterial(
|
||||
file_manager->getAsset(FileManager::FONT,"materials.xml"));
|
||||
file_manager->popTextureSearchPath();
|
||||
|
||||
GUIEngine::addLoadingIcon( irr_driver->getTexture(FileManager::GUI,
|
||||
"options_video.png"));
|
||||
kart_properties_manager -> loadAllKarts ();
|
||||
|
@ -1234,7 +1234,7 @@ void World::escapePressed()
|
||||
|
||||
bool World::isFogEnabled() const
|
||||
{
|
||||
return m_track != NULL && m_track->isFogEnabled();
|
||||
return !m_force_disable_fog && (m_track != NULL && m_track->isFogEnabled());
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
@ -92,6 +92,7 @@ protected:
|
||||
RandomGenerator m_random;
|
||||
|
||||
Physics* m_physics;
|
||||
bool m_force_disable_fog;
|
||||
AbstractKart* m_fastest_kart;
|
||||
/** Number of eliminated karts. */
|
||||
int m_eliminated_karts;
|
||||
@ -333,6 +334,8 @@ public:
|
||||
{
|
||||
m_clear_color = color;
|
||||
}
|
||||
/** Override track fog value to force disabled */
|
||||
void forceFogDisabled(bool v) { m_force_disable_fog = v; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Override if you want to know when a kart presses fire */
|
||||
virtual void onFirePressed(Controller* who) {}
|
||||
|
@ -234,8 +234,13 @@ btScalar btKart::rayCast(unsigned int index)
|
||||
|
||||
btScalar depth = -1;
|
||||
|
||||
btScalar raylen = wheel.getSuspensionRestLength()+wheel.m_wheelsRadius
|
||||
+ wheel.m_maxSuspensionTravelCm*0.01f;
|
||||
btScalar max_susp_len = wheel.getSuspensionRestLength()+wheel.m_wheelsRadius
|
||||
+ wheel.m_maxSuspensionTravelCm*0.01f;
|
||||
|
||||
// Do a slightly longer raycast to see if the kart might soon hit the
|
||||
// ground and some 'cushioning' is needed to avoid that the chassis
|
||||
// hits the ground.
|
||||
btScalar raylen = max_susp_len + 0.5f;
|
||||
|
||||
btVector3 rayvector = wheel.m_raycastInfo.m_wheelDirectionWS * (raylen);
|
||||
const btVector3& source = wheel.m_raycastInfo.m_hardPointWS;
|
||||
@ -252,21 +257,18 @@ btScalar btKart::rayCast(unsigned int index)
|
||||
|
||||
wheel.m_raycastInfo.m_groundObject = 0;
|
||||
|
||||
if (object)
|
||||
depth = raylen * rayResults.m_distFraction;
|
||||
if (object && depth < max_susp_len)
|
||||
{
|
||||
param = rayResults.m_distFraction;
|
||||
depth = raylen * rayResults.m_distFraction;
|
||||
wheel.m_raycastInfo.m_contactNormalWS = rayResults.m_hitNormalInWorld;
|
||||
wheel.m_raycastInfo.m_contactNormalWS.normalize();
|
||||
wheel.m_raycastInfo.m_isInContact = true;
|
||||
///@todo for driving on dynamic/movable objects!;
|
||||
wheel.m_raycastInfo.m_groundObject = &getFixedBody();
|
||||
|
||||
btScalar hitDistance = param*raylen;
|
||||
wheel.m_raycastInfo.m_suspensionLength =
|
||||
hitDistance - wheel.m_wheelsRadius;
|
||||
//clamp on max suspension travel
|
||||
wheel.m_raycastInfo.m_suspensionLength = depth - wheel.m_wheelsRadius;
|
||||
|
||||
//clamp on max suspension travel
|
||||
btScalar minSuspensionLength = wheel.getSuspensionRestLength()
|
||||
- wheel.m_maxSuspensionTravelCm*btScalar(0.01);
|
||||
btScalar maxSuspensionLength = wheel.getSuspensionRestLength()
|
||||
@ -309,6 +311,7 @@ btScalar btKart::rayCast(unsigned int index)
|
||||
|
||||
} else
|
||||
{
|
||||
depth = btScalar(-1.0);
|
||||
//put wheel info as in rest position
|
||||
wheel.m_raycastInfo.m_suspensionLength = wheel.getSuspensionRestLength();
|
||||
wheel.m_suspensionRelativeVelocity = btScalar(0.0);
|
||||
@ -387,7 +390,54 @@ void btKart::updateVehicle( btScalar step )
|
||||
m_num_wheels_on_ground++;
|
||||
}
|
||||
|
||||
// Test if the kart is falling so fast
|
||||
// that the chassis might hit the track
|
||||
// ------------------------------------
|
||||
bool needs_cushioning_test = false;
|
||||
for(int i=0; i<m_wheelInfo.size(); i++)
|
||||
{
|
||||
btWheelInfo &wheel = m_wheelInfo[i];
|
||||
if(!wheel.m_was_on_ground && wheel.m_raycastInfo.m_isInContact)
|
||||
{
|
||||
needs_cushioning_test = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(needs_cushioning_test)
|
||||
{
|
||||
const btVector3 &v = m_chassisBody->getLinearVelocity();
|
||||
btVector3 down(0, 1, 0);
|
||||
btVector3 v_down = (v * down) * down;
|
||||
// Estimate what kind of downward speed can be compensated by the
|
||||
// suspension. Atm the parameters are set that the suspension is
|
||||
// actually capped at max suspension force, so the maximum
|
||||
// speed that can be caught by the suspension without the chassis
|
||||
// hitting the ground can be based on that. Note that there are
|
||||
// 4 suspensions, all adding together.
|
||||
btScalar max_compensate_speed = m_wheelInfo[0].m_maxSuspensionForce
|
||||
* m_chassisBody->getInvMass()
|
||||
* step * 4;
|
||||
// If the downward speed is too fast to be caught by the suspension,
|
||||
// slow down the falling speed by applying an appropriately impulse:
|
||||
if(-v_down.getY() > max_compensate_speed)
|
||||
{
|
||||
btVector3 impulse = down * (-v_down.getY() - max_compensate_speed)
|
||||
/ m_chassisBody->getInvMass();
|
||||
//float v_old = m_chassisBody->getLinearVelocity().getY();
|
||||
//float x = m_wheelInfo[0].m_raycastInfo.m_isInContact ? m_wheelInfo[0].m_raycastInfo.m_contactPointWS.getY() : -100;
|
||||
m_chassisBody->applyCentralImpulse(impulse);
|
||||
//Log::verbose("physics", "Cushioning %f from %f m/s to %f m/s wheel %f kart %f", impulse.getY(),
|
||||
// v_old, m_chassisBody->getLinearVelocity().getY(), x,
|
||||
// m_chassisBody->getWorldTransform().getOrigin().getY()
|
||||
// );
|
||||
}
|
||||
}
|
||||
for(int i=0; i<m_wheelInfo.size(); i++)
|
||||
m_wheelInfo[i].m_was_on_ground = m_wheelInfo[i].m_raycastInfo.m_isInContact;
|
||||
|
||||
|
||||
// If the kart is flying, try to keep it parallel to the ground.
|
||||
// -------------------------------------------------------------
|
||||
if(m_num_wheels_on_ground==0)
|
||||
{
|
||||
btVector3 kart_up = getChassisWorldTransform().getBasis().getColumn(1);
|
||||
@ -396,11 +446,12 @@ void btKart::updateVehicle( btScalar step )
|
||||
// Give a nicely balanced feeling for rebalancing the kart
|
||||
m_chassisBody->applyTorqueImpulse(axis * m_kart->getKartProperties()->getSmoothFlyingImpulse());
|
||||
}
|
||||
|
||||
|
||||
// Work around: make sure that either both wheels on one axis
|
||||
// are on ground, or none of them. This avoids the problem of
|
||||
// the kart suddenly getting additional angular velocity because
|
||||
// e.g. only one rear wheel is on the ground.
|
||||
// e.g. only one rear wheel is on the ground and then the kart
|
||||
// rotates very abruptly.
|
||||
for(int i=0; i<m_wheelInfo.size(); i+=2)
|
||||
{
|
||||
if( m_wheelInfo[i ].m_raycastInfo.m_isInContact !=
|
||||
@ -422,8 +473,10 @@ void btKart::updateVehicle( btScalar step )
|
||||
}
|
||||
} // for i=0; i<m_wheelInfo.size(); i+=2
|
||||
|
||||
updateSuspension(step);
|
||||
|
||||
// Apply suspension forcen (i.e. upwards force)
|
||||
// --------------------------------------------
|
||||
updateSuspension(step);
|
||||
|
||||
for (int i=0;i<m_wheelInfo.size();i++)
|
||||
{
|
||||
@ -445,9 +498,10 @@ void btKart::updateVehicle( btScalar step )
|
||||
|
||||
}
|
||||
|
||||
// Update friction (i.e. forward force)
|
||||
// ------------------------------------
|
||||
updateFriction( step);
|
||||
|
||||
|
||||
for (int i=0;i<m_wheelInfo.size();i++)
|
||||
{
|
||||
btWheelInfo& wheel = m_wheelInfo[i];
|
||||
@ -481,13 +535,20 @@ void btKart::updateVehicle( btScalar step )
|
||||
wheel.m_deltaRotation *= btScalar(0.99);
|
||||
|
||||
}
|
||||
float f = -m_kart->getSpeed()
|
||||
* m_kart->getKartProperties()->getDownwardImpulseFactor();
|
||||
btVector3 downwards_impulse = m_chassisBody->getWorldTransform().getBasis()
|
||||
* btVector3(0, f, 0);
|
||||
|
||||
m_chassisBody->applyCentralImpulse(downwards_impulse);
|
||||
// If configured, add a force to keep karts on the track
|
||||
// -----------------------------------------------------
|
||||
float dif = m_kart->getKartProperties()->getDownwardImpulseFactor();
|
||||
if(dif!=0 && m_num_wheels_on_ground==4)
|
||||
{
|
||||
float f = -fabsf(m_kart->getSpeed()) * dif;
|
||||
btVector3 downwards_impulse = m_chassisBody->getWorldTransform().getBasis()
|
||||
* btVector3(0, f, 0);
|
||||
m_chassisBody->applyCentralImpulse(downwards_impulse);
|
||||
}
|
||||
|
||||
// Apply additional impulse set by supertuxkart
|
||||
// --------------------------------------------
|
||||
if(m_time_additional_impulse>0)
|
||||
{
|
||||
float dt = step > m_time_additional_impulse
|
||||
@ -497,6 +558,8 @@ void btKart::updateVehicle( btScalar step )
|
||||
m_time_additional_impulse -= dt;
|
||||
}
|
||||
|
||||
// Apply additional rotation set by supertuxkart
|
||||
// ---------------------------------------------
|
||||
if(m_time_additional_rotation>0)
|
||||
{
|
||||
btTransform &t = m_chassisBody->getWorldTransform();
|
||||
|
@ -21,8 +21,8 @@
|
||||
#include "guiengine/dialog_queue.hpp"
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "online/online_profile.hpp"
|
||||
#include "states_screens/online_profile_achievements.hpp"
|
||||
#include "states_screens/online_profile_friends.hpp"
|
||||
#include "states_screens/online_profile_overview.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
@ -481,7 +481,7 @@ void UserInfoDialog::onUpdate(float dt)
|
||||
{
|
||||
ModalDialog::dismiss();
|
||||
if (m_enter_profile)
|
||||
StateManager::get()->replaceTopMostScreen(OnlineProfileOverview::getInstance());
|
||||
StateManager::get()->replaceTopMostScreen(OnlineProfileAchievements::getInstance());
|
||||
return;
|
||||
}
|
||||
} // onUpdate
|
||||
|
@ -81,6 +81,8 @@ void GPInfoScreen::loadedFromFile()
|
||||
// Only init the number of tracks here, this way the previously selected
|
||||
// number of tracks will be the default.
|
||||
m_num_tracks_spinner->setValue(1);
|
||||
|
||||
m_ai_kart_spinner = getWidget<SpinnerWidget>("ai-spinner");
|
||||
} // loadedFromFile
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -213,6 +215,32 @@ void GPInfoScreen::init()
|
||||
getWidget<LabelWidget>("name")->setText(m_gp.getName(), false);
|
||||
m_gp.checkConsistency();
|
||||
}
|
||||
|
||||
// Number of AIs
|
||||
// -------------
|
||||
const bool has_AI = race_manager->hasAI();
|
||||
m_ai_kart_spinner->setVisible(has_AI);
|
||||
getWidget<LabelWidget>("ai-text")->setVisible(has_AI);
|
||||
if (has_AI)
|
||||
{
|
||||
m_ai_kart_spinner->setActivated();
|
||||
|
||||
// Avoid negative numbers (which can happen if e.g. the number of karts
|
||||
// in a previous race was lower than the number of players now.
|
||||
int num_ai = UserConfigParams::m_num_karts - race_manager->getNumLocalPlayers();
|
||||
if (num_ai < 0) num_ai = 0;
|
||||
m_ai_kart_spinner->setValue(num_ai);
|
||||
race_manager->setNumKarts(num_ai + race_manager->getNumLocalPlayers());
|
||||
m_ai_kart_spinner->setMax(stk_config->m_max_karts - race_manager->getNumLocalPlayers());
|
||||
// A ftl reace needs at least three karts to make any sense
|
||||
if(race_manager->getMinorMode()==RaceManager::MINOR_MODE_FOLLOW_LEADER)
|
||||
{
|
||||
m_ai_kart_spinner->setMin(3-race_manager->getNumLocalPlayers());
|
||||
}
|
||||
else
|
||||
m_ai_kart_spinner->setMin(0);
|
||||
|
||||
} // has_AI
|
||||
|
||||
addTracks();
|
||||
addScreenshot();
|
||||
@ -293,14 +321,11 @@ void GPInfoScreen::eventCallback(Widget *, const std::string &name,
|
||||
/*new tracks*/ true );
|
||||
addTracks();
|
||||
}
|
||||
else if (button == "start" || button=="continue")
|
||||
else if (button == "start" || button == "continue")
|
||||
{
|
||||
// Normal GP: start/continue a saved GP
|
||||
int n = getWidget<SpinnerWidget>("ai-spinner")->getValue();
|
||||
|
||||
m_gp.changeReverse(getReverse());
|
||||
race_manager->setNumKarts(race_manager->getNumLocalPlayers() + n);
|
||||
race_manager->startGP(m_gp, false, (name == "continue"));
|
||||
race_manager->startGP(m_gp, false, (button == "continue"));
|
||||
}
|
||||
} // name=="buttons"
|
||||
else if (name=="group-spinner")
|
||||
@ -329,6 +354,17 @@ void GPInfoScreen::eventCallback(Widget *, const std::string &name,
|
||||
m_gp.changeTrackNumber(m_num_tracks_spinner->getValue(), m_group_name);
|
||||
addTracks();
|
||||
}
|
||||
else if (name=="ai-spinner")
|
||||
{
|
||||
const int num_ai = m_ai_kart_spinner->getValue();
|
||||
race_manager->setNumKarts( race_manager->getNumLocalPlayers() + num_ai );
|
||||
UserConfigParams::m_num_karts = race_manager->getNumLocalPlayers() + num_ai;
|
||||
|
||||
//Redraw scene because available buttons depend on current settings
|
||||
getWidget<RibbonWidget>("buttons")->setSelection(0, PLAYER_ID_GAME_MASTER);
|
||||
reshowCurrentScreen();
|
||||
m_ai_kart_spinner->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
|
||||
}
|
||||
else if(name=="back")
|
||||
{
|
||||
StateManager::get()->escapePressed();
|
||||
|
@ -47,6 +47,9 @@ private:
|
||||
|
||||
/** Spinner for number of tracks (in case of random GP). */
|
||||
GUIEngine::SpinnerWidget *m_num_tracks_spinner;
|
||||
|
||||
/** Spinner for number of AI karts. */
|
||||
GUIEngine::SpinnerWidget* m_ai_kart_spinner;
|
||||
|
||||
/** The currently selected group name. */
|
||||
std::string m_group_name;
|
||||
|
@ -42,7 +42,7 @@
|
||||
#include "states_screens/grand_prix_editor_screen.hpp"
|
||||
#include "states_screens/help_screen_1.hpp"
|
||||
#include "states_screens/offline_kart_selection.hpp"
|
||||
#include "states_screens/online_profile_overview.hpp"
|
||||
#include "states_screens/online_profile_achievements.hpp"
|
||||
#include "states_screens/online_screen.hpp"
|
||||
#include "states_screens/options_screen_video.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
@ -442,10 +442,10 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
}
|
||||
if (PlayerManager::getCurrentOnlineId())
|
||||
{
|
||||
// For 0.8.2 disable the server menu, instead go to online profile
|
||||
// For 0.8.2 disable the server menu, instead go to online profile
|
||||
//OnlineScreen::getInstance()->push();
|
||||
ProfileManager::get()->setVisiting(PlayerManager::getCurrentOnlineId());
|
||||
OnlineProfileOverview::getInstance()->push();
|
||||
ProfileManager::get()->setVisiting(PlayerManager::getCurrentOnlineId());
|
||||
OnlineProfileAchievements::getInstance()->push();
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "online/online_profile.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
#include "states_screens/online_profile_overview.hpp"
|
||||
#include "states_screens/online_profile_friends.hpp"
|
||||
#include "states_screens/online_profile_achievements.hpp"
|
||||
#include "states_screens/online_profile_settings.hpp"
|
||||
@ -52,9 +51,6 @@ void OnlineProfileBase::loadedFromFile()
|
||||
m_header = getWidget<LabelWidget>("title");
|
||||
assert(m_header != NULL);
|
||||
|
||||
m_overview_tab =
|
||||
(IconButtonWidget *)m_profile_tabs->findWidgetNamed("tab_overview");
|
||||
assert(m_overview_tab != NULL);
|
||||
m_friends_tab =
|
||||
(IconButtonWidget *) m_profile_tabs->findWidgetNamed("tab_friends");
|
||||
assert(m_friends_tab != NULL);
|
||||
@ -91,7 +87,6 @@ void OnlineProfileBase::init()
|
||||
{
|
||||
Screen::init();
|
||||
|
||||
m_overview_tab->setTooltip( _("Overview") );
|
||||
m_friends_tab->setTooltip( _("Friends") );
|
||||
m_achievements_tab->setTooltip( _("Achievements") );
|
||||
m_settings_tab->setTooltip( _("Account Settings") );
|
||||
@ -119,9 +114,7 @@ void OnlineProfileBase::eventCallback(Widget* widget, const std::string& name,
|
||||
std::string selection =
|
||||
((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER);
|
||||
StateManager *sm = StateManager::get();
|
||||
if (selection == m_overview_tab->m_properties[PROP_ID])
|
||||
sm->replaceTopMostScreen(OnlineProfileOverview::getInstance());
|
||||
else if (selection == m_friends_tab->m_properties[PROP_ID])
|
||||
if (selection == m_friends_tab->m_properties[PROP_ID])
|
||||
sm->replaceTopMostScreen(OnlineProfileFriends::getInstance());
|
||||
else if (selection == m_achievements_tab->m_properties[PROP_ID])
|
||||
sm->replaceTopMostScreen(OnlineProfileAchievements::getInstance());
|
||||
|
@ -30,7 +30,7 @@ namespace GUIEngine { class Widget; }
|
||||
|
||||
|
||||
/** Online profile base screen. Used for displaying friends, achievements,
|
||||
* overview, and settings. It handles the tabs which are common to each
|
||||
* and settings. It handles the tabs which are common to each
|
||||
* of those screens, and keeps track of the profile to display.
|
||||
* \ingroup states_screens
|
||||
*/
|
||||
@ -42,7 +42,6 @@ protected:
|
||||
/** Pointer to the various widgets on the screen. */
|
||||
GUIEngine::LabelWidget * m_header;
|
||||
GUIEngine::RibbonWidget* m_profile_tabs;
|
||||
GUIEngine::IconButtonWidget * m_overview_tab;
|
||||
GUIEngine::IconButtonWidget * m_friends_tab;
|
||||
GUIEngine::IconButtonWidget * m_achievements_tab;
|
||||
GUIEngine::IconButtonWidget * m_settings_tab;
|
||||
|
@ -1,67 +0,0 @@
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2010 Glenn De Jonghe
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "states_screens/online_profile_overview.hpp"
|
||||
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "guiengine/scalable_font.hpp"
|
||||
#include "guiengine/screen.hpp"
|
||||
#include "guiengine/widget.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
#include <IGUIButton.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
using namespace GUIEngine;
|
||||
using namespace irr::core;
|
||||
using namespace irr::gui;
|
||||
using namespace Online;
|
||||
|
||||
DEFINE_SCREEN_SINGLETON( OnlineProfileOverview );
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
OnlineProfileOverview::OnlineProfileOverview() : OnlineProfileBase("online/profile_overview.stkgui")
|
||||
{
|
||||
} // OnlineProfileOverview
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void OnlineProfileOverview::loadedFromFile()
|
||||
{
|
||||
OnlineProfileBase::loadedFromFile();
|
||||
|
||||
} // loadedFromFile
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void OnlineProfileOverview::init()
|
||||
{
|
||||
OnlineProfileBase::init();
|
||||
m_profile_tabs->select( m_overview_tab->m_properties[PROP_ID], PLAYER_ID_GAME_MASTER );
|
||||
} // init
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void OnlineProfileOverview::eventCallback(Widget* widget, const std::string& name, const int playerID)
|
||||
{
|
||||
OnlineProfileBase::eventCallback( widget, name, playerID);
|
||||
} // eventCallback
|
||||
|
@ -1,55 +0,0 @@
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2013 Glenn De Jonghe
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
#ifndef __HEADER_ONLINE_PROFILE_OVERVIEW_HPP__
|
||||
#define __HEADER_ONLINE_PROFILE_OVERVIEW_HPP__
|
||||
|
||||
#include <string>
|
||||
#include <irrString.h>
|
||||
|
||||
#include "guiengine/screen.hpp"
|
||||
#include "guiengine/widgets.hpp"
|
||||
#include "states_screens/online_profile_base.hpp"
|
||||
|
||||
namespace GUIEngine { class Widget; }
|
||||
|
||||
|
||||
/**
|
||||
* \brief Online profiel overview screen
|
||||
* \ingroup states_screens
|
||||
*/
|
||||
class OnlineProfileOverview : public OnlineProfileBase, public GUIEngine::ScreenSingleton<OnlineProfileOverview>
|
||||
{
|
||||
protected:
|
||||
OnlineProfileOverview();
|
||||
|
||||
public:
|
||||
friend class GUIEngine::ScreenSingleton<OnlineProfileOverview>;
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void loadedFromFile() OVERRIDE;
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name,
|
||||
const int playerID) OVERRIDE;
|
||||
|
||||
/** \brief implement callback from parent class GUIEngine::Screen */
|
||||
virtual void init() OVERRIDE;
|
||||
};
|
||||
|
||||
#endif
|
@ -40,7 +40,7 @@
|
||||
#include "states_screens/networking_lobby.hpp"
|
||||
#include "states_screens/server_selection.hpp"
|
||||
#include "states_screens/create_server_screen.hpp"
|
||||
#include "states_screens/online_profile_overview.hpp"
|
||||
#include "states_screens/online_profile_achievements.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
@ -233,7 +233,7 @@ void OnlineScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
else if (selection == m_profile_widget->m_properties[PROP_ID])
|
||||
{
|
||||
ProfileManager::get()->setVisiting(PlayerManager::getCurrentOnlineId());
|
||||
OnlineProfileOverview::getInstance()->push();
|
||||
OnlineProfileAchievements::getInstance()->push();
|
||||
}
|
||||
else if (selection == m_find_server_widget->m_properties[PROP_ID])
|
||||
{
|
||||
|
@ -524,6 +524,8 @@ void QuadGraph::createMesh(bool show_invisible,
|
||||
m_mesh_buffer->recalculateBoundingBox();
|
||||
m_mesh->setBoundingBox(m_mesh_buffer->getBoundingBox());
|
||||
|
||||
m_mesh_buffer->getMaterial().setTexture(0, irr_driver->getTexture("unlit.png"));
|
||||
|
||||
delete[] ind;
|
||||
delete[] new_v;
|
||||
} // createMesh
|
||||
@ -981,6 +983,7 @@ void QuadGraph::makeMiniMap(const core::dimension2du &dimension,
|
||||
{
|
||||
const SColor oldClearColor = World::getWorld()->getClearColor();
|
||||
World::getWorld()->setClearbackBufferColor(SColor(0, 255, 255, 255));
|
||||
World::getWorld()->forceFogDisabled(true);
|
||||
*oldRttMinimap = NULL;
|
||||
*newRttMinimap = NULL;
|
||||
|
||||
@ -1100,6 +1103,7 @@ void QuadGraph::makeMiniMap(const core::dimension2du &dimension,
|
||||
*oldRttMinimap = texture;
|
||||
*newRttMinimap = frame_buffer;
|
||||
World::getWorld()->setClearbackBufferColor(oldClearColor);
|
||||
World::getWorld()->forceFogDisabled(false);
|
||||
} // makeMiniMap
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -17,12 +17,13 @@
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "debug.hpp"
|
||||
|
||||
#include "config/user_config.hpp"
|
||||
#include "karts/controller/controller.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "items/powerup_manager.hpp"
|
||||
#include "items/attachment.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/controller/controller.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "physics/irr_debug_drawer.hpp"
|
||||
#include "physics/physics.hpp"
|
||||
@ -30,8 +31,10 @@
|
||||
#include "main_loop.hpp"
|
||||
#include "replay/replay_recorder.hpp"
|
||||
#include "states_screens/dialogs/debug_slider.hpp"
|
||||
#include "utils/constants.hpp"
|
||||
#include "utils/log.hpp"
|
||||
#include "utils/profiler.hpp"
|
||||
|
||||
#include <IGUIEnvironment.h>
|
||||
#include <IGUIContextMenu.h>
|
||||
|
||||
@ -40,8 +43,9 @@ using namespace gui;
|
||||
|
||||
namespace Debug {
|
||||
|
||||
/** This is to let mouse input events go through when the debug menu is visible, otherwise
|
||||
GUI events would be blocked while in a race... */
|
||||
/** This is to let mouse input events go through when the debug menu is
|
||||
* visible, otherwise GUI events would be blocked while in a race...
|
||||
*/
|
||||
static bool g_debug_menu_visible = false;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -85,52 +89,52 @@ enum DebugMenuCommand
|
||||
DEBUG_HIDE_KARTS,
|
||||
DEBUG_THROTTLE_FPS,
|
||||
DEBUG_VISUAL_VALUES,
|
||||
};
|
||||
DEBUG_PRINT_START_POS,
|
||||
}; // DebugMenuCommand
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Add powerup selected from debug menu for all player karts
|
||||
void addPowerup(PowerupManager::PowerupType powerup)
|
||||
{
|
||||
World* world = World::getWorld();
|
||||
if (world == NULL) return;
|
||||
if (!world) return;
|
||||
for(unsigned int i = 0; i < race_manager->getNumLocalPlayers(); i++)
|
||||
{
|
||||
AbstractKart* kart = world->getLocalPlayerKart(i);
|
||||
kart->setPowerup(powerup, 10000);
|
||||
}
|
||||
}
|
||||
|
||||
} // addPowerup
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void addAttachment(Attachment::AttachmentType type)
|
||||
{
|
||||
World* world = World::getWorld();
|
||||
if (world == NULL) return;
|
||||
for(unsigned int i = 0; i < world->getNumKarts(); i++)
|
||||
{
|
||||
if (world == NULL) return;
|
||||
for (unsigned int i = 0; i < world->getNumKarts(); i++)
|
||||
{
|
||||
AbstractKart *kart = world->getKart(i);
|
||||
if (kart->getController()->isPlayerController()) {
|
||||
if (type == Attachment::ATTACH_ANVIL)
|
||||
{
|
||||
kart->getAttachment()
|
||||
->set(type, stk_config->m_anvil_time);
|
||||
kart->adjustSpeed(stk_config->m_anvil_speed_factor);
|
||||
kart->updateWeight();
|
||||
}
|
||||
else if (type == Attachment::ATTACH_PARACHUTE)
|
||||
{
|
||||
kart->getAttachment()
|
||||
->set(type, stk_config->m_parachute_time);
|
||||
}
|
||||
else if (type == Attachment::ATTACH_BOMB)
|
||||
{
|
||||
kart->getAttachment()
|
||||
->set(type, stk_config->m_bomb_time);
|
||||
}
|
||||
if (!kart->getController()->isPlayerController())
|
||||
continue;
|
||||
if (type == Attachment::ATTACH_ANVIL)
|
||||
{
|
||||
kart->getAttachment()
|
||||
->set(type, stk_config->m_anvil_time);
|
||||
kart->adjustSpeed(stk_config->m_anvil_speed_factor);
|
||||
kart->updateWeight();
|
||||
}
|
||||
else if (type == Attachment::ATTACH_PARACHUTE)
|
||||
{
|
||||
kart->getAttachment()
|
||||
->set(type, stk_config->m_parachute_time);
|
||||
}
|
||||
else if (type == Attachment::ATTACH_BOMB)
|
||||
{
|
||||
kart->getAttachment()
|
||||
->set(type, stk_config->m_bomb_time);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // addAttachment
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Debug menu handling
|
||||
@ -143,19 +147,20 @@ bool onEvent(const SEvent &event)
|
||||
if(event.EventType == EET_MOUSE_INPUT_EVENT)
|
||||
{
|
||||
// Create the menu (only one menu at a time)
|
||||
if(event.MouseInput.Event == EMIE_RMOUSE_PRESSED_DOWN && !g_debug_menu_visible)
|
||||
if(event.MouseInput.Event == EMIE_RMOUSE_PRESSED_DOWN &&
|
||||
!g_debug_menu_visible)
|
||||
{
|
||||
// root menu
|
||||
gui::IGUIEnvironment* guienv = irr_driver->getGUI();
|
||||
IGUIContextMenu* mnu = guienv->addContextMenu(
|
||||
core::rect<s32>(event.MouseInput.X, event.MouseInput.Y, event.MouseInput.Y+100, event.MouseInput.Y+100),NULL);
|
||||
core::rect<s32> r(event.MouseInput.X, event.MouseInput.Y,
|
||||
event.MouseInput.Y+100, event.MouseInput.Y+100);
|
||||
IGUIContextMenu* mnu = guienv->addContextMenu(r, NULL);
|
||||
int graphicsMenuIndex = mnu->addItem(L"Graphics >",-1,true,true);
|
||||
|
||||
// graphics menu
|
||||
IGUIContextMenu* sub = mnu->getSubMenu(graphicsMenuIndex);
|
||||
|
||||
sub->addItem(L"Reload shaders", DEBUG_GRAPHICS_RELOAD_SHADERS );
|
||||
sub->addItem(L"Reset debug views", DEBUG_GRAPHICS_RESET );
|
||||
sub->addItem(L"Wireframe", DEBUG_GRAPHICS_WIREFRAME );
|
||||
sub->addItem(L"Mipmap viz", DEBUG_GRAPHICS_MIPMAP_VIZ );
|
||||
sub->addItem(L"Normals viz", DEBUG_GRAPHICS_NORMALS_VIZ );
|
||||
@ -168,6 +173,7 @@ bool onEvent(const SEvent &event)
|
||||
sub->addItem(L"Distort viz", DEBUG_GRAPHICS_DISTORT_VIZ );
|
||||
sub->addItem(L"Physics debug", DEBUG_GRAPHICS_BULLET_1);
|
||||
sub->addItem(L"Physics debug (no kart)", DEBUG_GRAPHICS_BULLET_2);
|
||||
sub->addItem(L"Reset debug views", DEBUG_GRAPHICS_RESET );
|
||||
|
||||
mnu->addItem(L"Items >",-1,true,true);
|
||||
sub = mnu->getSubMenu(1);
|
||||
@ -192,27 +198,30 @@ bool onEvent(const SEvent &event)
|
||||
|
||||
mnu->addItem(L"Profiler",DEBUG_PROFILER);
|
||||
if (UserConfigParams::m_profiler_enabled)
|
||||
mnu->addItem(L"Toggle capture profiler report", DEBUG_PROFILER_GENERATE_REPORT);
|
||||
mnu->addItem(L"Toggle capture profiler report",
|
||||
DEBUG_PROFILER_GENERATE_REPORT);
|
||||
mnu->addItem(L"Do not limit FPS", DEBUG_THROTTLE_FPS);
|
||||
mnu->addItem(L"FPS",DEBUG_FPS);
|
||||
mnu->addItem(L"Save replay", DEBUG_SAVE_REPLAY);
|
||||
mnu->addItem(L"Save history", DEBUG_SAVE_HISTORY);
|
||||
mnu->addItem(L"Toggle GUI", DEBUG_TOGGLE_GUI);
|
||||
mnu->addItem(L"Hide karts", DEBUG_HIDE_KARTS);
|
||||
|
||||
mnu->addItem(L"Print position", DEBUG_PRINT_START_POS);
|
||||
|
||||
g_debug_menu_visible = true;
|
||||
irr_driver->showPointer();
|
||||
}
|
||||
|
||||
// Let Irrlicht handle the event while the menu is visible - otherwise in a race the GUI events won't be generated
|
||||
// Let Irrlicht handle the event while the menu is visible.
|
||||
// Otherwise in a race the GUI events won't be generated
|
||||
if(g_debug_menu_visible)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (event.EventType == EET_GUI_EVENT)
|
||||
{
|
||||
if (event.GUIEvent.Caller != NULL && event.GUIEvent.Caller->getType() == EGUIET_CONTEXT_MENU )
|
||||
if (event.GUIEvent.Caller != NULL &&
|
||||
event.GUIEvent.Caller->getType() == EGUIET_CONTEXT_MENU )
|
||||
{
|
||||
IGUIContextMenu *menu = (IGUIContextMenu*)event.GUIEvent.Caller;
|
||||
s32 cmdID = menu->getItemCommandId(menu->getSelectedItem());
|
||||
@ -224,6 +233,8 @@ bool onEvent(const SEvent &event)
|
||||
|
||||
if (event.GUIEvent.EventType == gui::EGET_MENU_ITEM_SELECTED)
|
||||
{
|
||||
World *world = World::getWorld();
|
||||
Physics *physics = world ? world->getPhysics() : NULL;
|
||||
if(cmdID == DEBUG_GRAPHICS_RELOAD_SHADERS)
|
||||
{
|
||||
Log::info("Debug", "Reloading shaders...");
|
||||
@ -231,87 +242,87 @@ bool onEvent(const SEvent &event)
|
||||
}
|
||||
else if (cmdID == DEBUG_GRAPHICS_RESET)
|
||||
{
|
||||
World* world = World::getWorld();
|
||||
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
|
||||
irr_driver->resetDebugModes();
|
||||
}
|
||||
else if (cmdID == DEBUG_GRAPHICS_WIREFRAME)
|
||||
{
|
||||
World* world = World::getWorld();
|
||||
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
|
||||
irr_driver->resetDebugModes();
|
||||
irr_driver->toggleWireframe();
|
||||
}
|
||||
else if (cmdID == DEBUG_GRAPHICS_MIPMAP_VIZ)
|
||||
{
|
||||
World* world = World::getWorld();
|
||||
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
|
||||
irr_driver->resetDebugModes();
|
||||
irr_driver->toggleMipVisualization();
|
||||
}
|
||||
else if (cmdID == DEBUG_GRAPHICS_NORMALS_VIZ)
|
||||
{
|
||||
World* world = World::getWorld();
|
||||
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
|
||||
irr_driver->resetDebugModes();
|
||||
irr_driver->toggleNormals();
|
||||
}
|
||||
else if (cmdID == DEBUG_GRAPHICS_SSAO_VIZ)
|
||||
{
|
||||
World* world = World::getWorld();
|
||||
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
|
||||
irr_driver->resetDebugModes();
|
||||
irr_driver->toggleSSAOViz();
|
||||
}
|
||||
else if (cmdID == DEBUG_GRAPHICS_RSM_VIZ)
|
||||
{
|
||||
World* world = World::getWorld();
|
||||
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
|
||||
irr_driver->resetDebugModes();
|
||||
irr_driver->toggleRSM();
|
||||
}
|
||||
else if (cmdID == DEBUG_GRAPHICS_RH_VIZ)
|
||||
{
|
||||
World* world = World::getWorld();
|
||||
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
|
||||
irr_driver->resetDebugModes();
|
||||
irr_driver->toggleRH();
|
||||
}
|
||||
else if (cmdID == DEBUG_GRAPHICS_GI_VIZ)
|
||||
{
|
||||
World* world = World::getWorld();
|
||||
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
|
||||
irr_driver->resetDebugModes();
|
||||
irr_driver->toggleGI();
|
||||
}
|
||||
else if (cmdID == DEBUG_GRAPHICS_SHADOW_VIZ)
|
||||
{
|
||||
World* world = World::getWorld();
|
||||
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
|
||||
irr_driver->resetDebugModes();
|
||||
irr_driver->toggleShadowViz();
|
||||
}
|
||||
else if (cmdID == DEBUG_GRAPHICS_LIGHT_VIZ)
|
||||
{
|
||||
World* world = World::getWorld();
|
||||
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
|
||||
irr_driver->resetDebugModes();
|
||||
irr_driver->toggleLightViz();
|
||||
}
|
||||
else if (cmdID == DEBUG_GRAPHICS_DISTORT_VIZ)
|
||||
{
|
||||
World* world = World::getWorld();
|
||||
if (world != NULL) world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
if (physics)
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NONE);
|
||||
|
||||
irr_driver->resetDebugModes();
|
||||
irr_driver->toggleDistortViz();
|
||||
@ -320,17 +331,16 @@ bool onEvent(const SEvent &event)
|
||||
{
|
||||
irr_driver->resetDebugModes();
|
||||
|
||||
World* world = World::getWorld();
|
||||
if (world == NULL) return false;
|
||||
world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_KARTS_PHYSICS);
|
||||
if (!world) return false;
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_KARTS_PHYSICS);
|
||||
}
|
||||
else if (cmdID == DEBUG_GRAPHICS_BULLET_2)
|
||||
{
|
||||
irr_driver->resetDebugModes();
|
||||
|
||||
World* world = World::getWorld();
|
||||
if (world == NULL) return false;
|
||||
world->getPhysics()->setDebugMode(IrrDebugDrawer::DM_NO_KARTS_GRAPHICS);
|
||||
if (!world) return false;
|
||||
Physics *physics = world->getPhysics();
|
||||
physics->setDebugMode(IrrDebugDrawer::DM_NO_KARTS_GRAPHICS);
|
||||
}
|
||||
else if (cmdID == DEBUG_PROFILER)
|
||||
{
|
||||
@ -396,9 +406,10 @@ bool onEvent(const SEvent &event)
|
||||
}
|
||||
else if (cmdID == DEBUG_POWERUP_NITRO)
|
||||
{
|
||||
World* world = World::getWorld();
|
||||
if (world == NULL) return false;
|
||||
for(unsigned int i = 0; i < race_manager->getNumLocalPlayers(); i++)
|
||||
if (!world) return false;
|
||||
const unsigned int num_local_players =
|
||||
race_manager->getNumLocalPlayers();
|
||||
for(unsigned int i = 0; i < num_local_players; i++)
|
||||
{
|
||||
AbstractKart* kart = world->getLocalPlayerKart(i);
|
||||
kart->setEnergy(100.0f);
|
||||
@ -418,52 +429,68 @@ bool onEvent(const SEvent &event)
|
||||
}
|
||||
else if (cmdID == DEBUG_TOGGLE_GUI)
|
||||
{
|
||||
World* world = World::getWorld();
|
||||
if (world == NULL) return false;
|
||||
if (!world) return false;
|
||||
RaceGUIBase* gui = world->getRaceGUI();
|
||||
if (gui != NULL) gui->m_enabled = !gui->m_enabled;
|
||||
}
|
||||
else if (cmdID == DEBUG_HIDE_KARTS)
|
||||
{
|
||||
World* world = World::getWorld();
|
||||
if (world == NULL) return false;
|
||||
const int count = World::getWorld()->getNumKarts();
|
||||
for (int n = 0; n<count; n++)
|
||||
if (!world) return false;
|
||||
for (int n = 0; n<world->getNumKarts(); n++)
|
||||
{
|
||||
AbstractKart* kart = world->getKart(n);
|
||||
if (kart->getController()->isPlayerController())
|
||||
kart->getNode()->setVisible(false);
|
||||
}
|
||||
}
|
||||
else if (cmdID == DEBUG_PRINT_START_POS)
|
||||
{
|
||||
if(!world) return false;
|
||||
for(unsigned int i=0; i<world->getNumKarts(); i++)
|
||||
{
|
||||
AbstractKart *kart = world->getKart(i);
|
||||
Log::warn(kart->getIdent().c_str(),
|
||||
"<start position=\"%d\" x=\"%f\" y=\"%f\" z=\"%f\" h=\"%f\"/>",
|
||||
i, kart->getXYZ().getX(), kart->getXYZ().getY(),
|
||||
kart->getXYZ().getZ(),kart->getHeading()*RAD_TO_DEGREE
|
||||
);
|
||||
}
|
||||
}
|
||||
else if (cmdID == DEBUG_VISUAL_VALUES)
|
||||
{
|
||||
#if !defined(__APPLE__)
|
||||
DebugSliderDialog *dsd = new DebugSliderDialog();
|
||||
dsd->setSliderHook( "red_slider", 0, 255, [](){ return int(irr_driver->getAmbientLight().r * 255.f); },
|
||||
dsd->setSliderHook( "red_slider", 0, 255,
|
||||
[](){ return int(irr_driver->getAmbientLight().r * 255.f); },
|
||||
[](int v){
|
||||
video::SColorf ambient = irr_driver->getAmbientLight();
|
||||
ambient.setColorComponentValue(0, v / 255.f);
|
||||
irr_driver->setAmbientLight(ambient); }
|
||||
);
|
||||
dsd->setSliderHook("green_slider", 0, 255, [](){ return int(irr_driver->getAmbientLight().g * 255.f); },
|
||||
dsd->setSliderHook("green_slider", 0, 255,
|
||||
[](){ return int(irr_driver->getAmbientLight().g * 255.f); },
|
||||
[](int v){
|
||||
video::SColorf ambient = irr_driver->getAmbientLight();
|
||||
ambient.setColorComponentValue(1, v / 255.f);
|
||||
irr_driver->setAmbientLight(ambient); }
|
||||
);
|
||||
dsd->setSliderHook("blue_slider", 0, 255, [](){ return int(irr_driver->getAmbientLight().b * 255.f); },
|
||||
dsd->setSliderHook("blue_slider", 0, 255,
|
||||
[](){ return int(irr_driver->getAmbientLight().b * 255.f); },
|
||||
[](int v){
|
||||
video::SColorf ambient = irr_driver->getAmbientLight();
|
||||
ambient.setColorComponentValue(2, v / 255.f);
|
||||
irr_driver->setAmbientLight(ambient); }
|
||||
);
|
||||
dsd->setSliderHook("ssao_radius", 0, 100, [](){ return int(irr_driver->getSSAORadius() * 10.f); },
|
||||
dsd->setSliderHook("ssao_radius", 0, 100,
|
||||
[](){ return int(irr_driver->getSSAORadius() * 10.f); },
|
||||
[](int v){irr_driver->setSSAORadius(v / 10.f); }
|
||||
);
|
||||
dsd->setSliderHook("ssao_k", 0, 100, [](){ return int(irr_driver->getSSAOK() * 10.f); },
|
||||
dsd->setSliderHook("ssao_k", 0, 100,
|
||||
[](){ return int(irr_driver->getSSAOK() * 10.f); },
|
||||
[](int v){irr_driver->setSSAOK(v / 10.f); }
|
||||
);
|
||||
dsd->setSliderHook("ssao_sigma", 0, 100, [](){ return int(irr_driver->getSSAOSigma() * 10.f); },
|
||||
dsd->setSliderHook("ssao_sigma", 0, 100,
|
||||
[](){ return int(irr_driver->getSSAOSigma() * 10.f); },
|
||||
[](int v){irr_driver->setSSAOSigma(v / 10.f); }
|
||||
);
|
||||
#endif
|
||||
@ -474,10 +501,14 @@ bool onEvent(const SEvent &event)
|
||||
}
|
||||
}
|
||||
return true; // continue event handling
|
||||
}
|
||||
} // onEvent
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Returns if the debug menu is visible.
|
||||
*/
|
||||
bool isOpen()
|
||||
{
|
||||
return g_debug_menu_visible;
|
||||
}
|
||||
}
|
||||
} // isOpen
|
||||
|
||||
} // namespace Debug
|
||||
|
@ -31,8 +31,11 @@
|
||||
|
||||
static const char* GPU_Phase[Q_LAST] =
|
||||
{
|
||||
"Shadows Cascade 0",
|
||||
"Shadows Cascade 1",
|
||||
"Shadows Cascade 2",
|
||||
"Shadows Cascade 3",
|
||||
"Solid Pass 1",
|
||||
"Shadows",
|
||||
"RSM",
|
||||
"RH",
|
||||
"GI",
|
||||
|
@ -28,6 +28,34 @@
|
||||
#include <iostream>
|
||||
|
||||
|
||||
enum QueryPerf
|
||||
{
|
||||
Q_SHADOWS_CASCADE0,
|
||||
Q_SHADOWS_CASCADE1,
|
||||
Q_SHADOWS_CASCADE2,
|
||||
Q_SHADOWS_CASCADE3,
|
||||
Q_SOLID_PASS1,
|
||||
Q_RSM,
|
||||
Q_RH,
|
||||
Q_GI,
|
||||
Q_ENVMAP,
|
||||
Q_SUN,
|
||||
Q_POINTLIGHTS,
|
||||
Q_SSAO,
|
||||
Q_SOLID_PASS2,
|
||||
Q_TRANSPARENT,
|
||||
Q_PARTICLES,
|
||||
Q_DISPLACEMENT,
|
||||
Q_DOF,
|
||||
Q_GODRAYS,
|
||||
Q_BLOOM,
|
||||
Q_TONEMAP,
|
||||
Q_MOTIONBLUR,
|
||||
Q_MLAA,
|
||||
Q_GUI,
|
||||
Q_LAST
|
||||
};
|
||||
|
||||
class Profiler;
|
||||
extern Profiler profiler;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user