Simplified Stars constructor, removed unnecessary #include from kart.cpp.

This commit is contained in:
hiker 2016-06-28 17:29:32 +10:00
parent 3c66a02337
commit f6a37b5e99
3 changed files with 17 additions and 15 deletions

View File

@ -18,36 +18,42 @@
#include "graphics/stars.hpp"
#include <cmath>
#include "graphics/irr_driver.hpp"
#include "graphics/material.hpp"
#include "graphics/material_manager.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/kart_model.hpp"
#include "utils/constants.hpp"
#include <ISceneNode.h>
#include <IBillboardSceneNode.h>
#include <cmath>
const int STAR_AMOUNT = 7;
const float RADIUS = 0.7f;
const float STAR_SIZE = 0.4f;
Stars::Stars(scene::ISceneNode* parentKart, core::vector3df center)
Stars::Stars(AbstractKart *kart)
{
m_parent_kart_node = parentKart;
m_parent_kart_node = kart->getNode();
m_enabled = false;
video::ITexture* texture = irr_driver->getTexture("starparticle.png");
Material* star_material =
material_manager->getMaterial("starparticle.png");
m_center = center;
m_center = core::vector3df(0.0f,
kart->getKartModel()->getModel()
->getBoundingBox().MaxEdge.Y,
0.0f );
for (int n=0; n<STAR_AMOUNT; n++)
{
scene::ISceneNode* billboard =
irr_driver->addBillboard(core::dimension2df(STAR_SIZE, STAR_SIZE),
texture, parentKart);
texture, kart->getNode());
#ifdef DEBUG
billboard->setName("star");
#endif

View File

@ -21,9 +21,12 @@
#include "utils/no_copy.hpp"
#include "vector3d.h"
#include <vector>
#include <vector3d.h>
class AbstractKart;
namespace irr
{
namespace scene { class ISceneNode; }
@ -54,7 +57,7 @@ private:
float m_remaining_time;
public:
Stars (scene::ISceneNode* parentKart, core::vector3df center);
Stars (AbstractKart *kart);
~Stars ();
void showFor(float time);
void reset();

View File

@ -38,8 +38,6 @@
#include "graphics/stk_text_billboard.hpp"
#include "graphics/stars.hpp"
#include "guiengine/scalable_font.hpp"
#include "karts/abstract_characteristic.hpp"
#include "karts/cached_characteristic.hpp"
#include "karts/explosion_animation.hpp"
#include "karts/kart_gfx.hpp"
#include "karts/rescue_animation.hpp"
@ -215,12 +213,7 @@ void Kart::init(RaceManager::KartType type)
m_kart_gfx = new KartGFX(this);
m_skidding = new Skidding(this);
// Create the stars effect
m_stars_effect =
new Stars(getNode(),
core::vector3df(0.0f,
getKartModel()->getModel()
->getBoundingBox().MaxEdge.Y,
0.0f) );
m_stars_effect = new Stars(this);
reset();
} // init