Merge branch 'master' of https://github.com/supertuxkart/stk-code
This commit is contained in:
commit
94346ae64d
@ -50,14 +50,28 @@ STKTextBillboard::STKTextBillboard(core::stringw text, FontWithFace* font,
|
||||
|
||||
void STKTextBillboard::updateAbsolutePosition()
|
||||
{
|
||||
// Make billboard always face the camera
|
||||
scene::ICameraSceneNode* curr_cam =
|
||||
irr_driver->getSceneManager()->getActiveCamera();
|
||||
if (!curr_cam) return;
|
||||
core::quaternion q(curr_cam->getViewMatrix());
|
||||
q.W = -q.W;
|
||||
|
||||
if (Parent)
|
||||
{
|
||||
// Override to not use the parent's rotation
|
||||
AbsoluteTransformation = getRelativeTransformation();
|
||||
AbsoluteTransformation.setTranslation(AbsoluteTransformation.getTranslation() + Parent->getAbsolutePosition());
|
||||
core::vector3df wc = RelativeTranslation;
|
||||
Parent->getAbsoluteTransformation().transformVect(wc);
|
||||
AbsoluteTransformation.setTranslation(wc);
|
||||
q.getMatrix(AbsoluteTransformation, wc);
|
||||
}
|
||||
else
|
||||
AbsoluteTransformation = getRelativeTransformation();
|
||||
{
|
||||
q.getMatrix(AbsoluteTransformation, RelativeTranslation);
|
||||
}
|
||||
core::matrix4 m;
|
||||
m.setScale(RelativeScale);
|
||||
AbsoluteTransformation *= m;
|
||||
}
|
||||
|
||||
scene::IMesh* STKTextBillboard::getTextMesh(core::stringw text, FontWithFace* font)
|
||||
@ -171,18 +185,6 @@ scene::IMesh* STKTextBillboard::getTextMesh(core::stringw text, FontWithFace* fo
|
||||
return Mesh;
|
||||
}
|
||||
|
||||
void STKTextBillboard::updateNoGL()
|
||||
{
|
||||
scene::ICameraSceneNode* curr_cam = irr_driver->getSceneManager()->getActiveCamera();
|
||||
core::vector3df cam_pos = curr_cam->getPosition();
|
||||
core::vector3df text_pos = this->getAbsolutePosition();
|
||||
float angle = atan2(text_pos.X - cam_pos.X, text_pos.Z - cam_pos.Z);
|
||||
this->setRotation(core::vector3df(0.0f, angle * 180.0f / M_PI, 0.0f));
|
||||
updateAbsolutePosition();
|
||||
|
||||
STKMeshSceneNode::updateNoGL();
|
||||
}
|
||||
|
||||
void STKTextBillboard::collectChar(video::ITexture* texture,
|
||||
const core::rect<float>& destRect,
|
||||
const core::rect<s32>& sourceRect,
|
||||
|
@ -74,8 +74,6 @@ public:
|
||||
const irr::core::vector3df& position,
|
||||
const irr::core::vector3df& size);
|
||||
|
||||
virtual void updateNoGL() OVERRIDE;
|
||||
|
||||
virtual scene::ESCENE_NODE_TYPE getType() const OVERRIDE
|
||||
{
|
||||
return scene::ESNT_TEXT;
|
||||
|
@ -105,6 +105,7 @@ namespace Scripting
|
||||
core::vector3df(1.5f, 1.5f, 1.5f));
|
||||
|
||||
World::getWorld()->getTrack()->addNode(tb);
|
||||
tb->drop();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -182,7 +182,7 @@ void RaceGUI::renderGlobal(float dt)
|
||||
//stop displaying timer as soon as race is over
|
||||
if (world->getPhase()<WorldStatus::DELAY_FINISH_PHASE)
|
||||
drawGlobalTimer();
|
||||
|
||||
|
||||
if(world->getPhase() == WorldStatus::GO_PHASE ||
|
||||
world->getPhase() == WorldStatus::MUSIC_PHASE)
|
||||
{
|
||||
@ -210,7 +210,7 @@ void RaceGUI::renderPlayerView(const Camera *camera, float dt)
|
||||
core::vector2df scaling = camera->getScaling();
|
||||
const AbstractKart *kart = camera->getKart();
|
||||
if(!kart) return;
|
||||
|
||||
|
||||
drawPlungerInFace(camera, dt);
|
||||
|
||||
scaling *= viewport.getWidth()/800.0f; // scale race GUI along screen size
|
||||
@ -453,7 +453,8 @@ void RaceGUI::drawEnergyMeter(int x, int y, const AbstractKart *kart,
|
||||
(int)offset.Y-gauge_height,
|
||||
(int)offset.X + gauge_width,
|
||||
(int)offset.Y) /* dest rect */,
|
||||
core::rect<s32>(0, 0, 256, 256) /* source rect */,
|
||||
core::rect<s32>(core::position2d<s32>(0,0),
|
||||
m_gauge_empty->getSize()) /* source rect */,
|
||||
NULL /* clip rect */, NULL /* colors */,
|
||||
true /* alpha */);
|
||||
|
||||
@ -845,7 +846,7 @@ void RaceGUI::drawLap(const AbstractKart* kart,
|
||||
{
|
||||
// Don't display laps or ranks if the kart has already finished the race.
|
||||
if (kart->hasFinishedRace()) return;
|
||||
|
||||
|
||||
World *world = World::getWorld();
|
||||
if (!world->raceHasLaps()) return;
|
||||
const int lap = world->getKartLaps(kart->getWorldKartId());
|
||||
|
Loading…
x
Reference in New Issue
Block a user