Change lights to be TrackObjects, so that they can be animated. Exporter part not yet committed
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14818 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -1581,27 +1581,7 @@ void Track::loadTrackModel(bool reverse_track, unsigned int mode_id)
|
||||
}
|
||||
else if(name=="light")
|
||||
{
|
||||
core::vector3df pos;
|
||||
node->get("xyz", &pos);
|
||||
|
||||
video::SColor color;
|
||||
node->get("color", &color);
|
||||
const video::SColorf colorf(color);
|
||||
|
||||
float distance = 25.0f;
|
||||
node->get("distance", &distance);
|
||||
float energy = 1.;
|
||||
node->get("energy", &energy);
|
||||
|
||||
if (irr_driver->isGLSL())
|
||||
{
|
||||
irr_driver->addLight(pos, distance, energy, colorf.r, colorf.g, colorf.b);
|
||||
} else
|
||||
{
|
||||
scene::ILightSceneNode* node = irr_driver->getSceneManager()->addLightSceneNode(NULL, pos, color, distance);
|
||||
node->setLightType(video::ELT_POINT);
|
||||
node->enableCastShadow(true);
|
||||
}
|
||||
m_track_object_manager->add(*node);
|
||||
}
|
||||
else if(name=="weather")
|
||||
{
|
||||
|
||||
@@ -116,6 +116,11 @@ void TrackObject::init(const XMLNode &xml_node, LODNode* lod_node)
|
||||
m_type = "particle-emitter";
|
||||
m_presentation = new TrackObjectPresentationParticles(xml_node);
|
||||
}
|
||||
else if (xml_node.getName() == "light")
|
||||
{
|
||||
m_type = "light";
|
||||
m_presentation = new TrackObjectPresentationLight(xml_node);
|
||||
}
|
||||
else if (type == "sfx-emitter")
|
||||
{
|
||||
// FIXME: at this time sound emitters are just disabled in multiplayer
|
||||
@@ -181,7 +186,7 @@ void TrackObject::init(const XMLNode &xml_node, LODNode* lod_node)
|
||||
b = glow.getBlue() / 255.0f;
|
||||
|
||||
irr_driver->addGlowingNode(glownode, r, g, b);
|
||||
}
|
||||
}
|
||||
|
||||
bool forcedbloom = false;
|
||||
if (xml_node.get("forcedbloom", &forcedbloom) && forcedbloom && glownode)
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <ICameraSceneNode.h>
|
||||
#include <IBillboardSceneNode.h>
|
||||
#include <IParticleSystemSceneNode.h>
|
||||
#include <ILightSceneNode.h>
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@@ -499,7 +500,6 @@ TrackObjectPresentationBillboard::~TrackObjectPresentationBillboard()
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
TrackObjectPresentationParticles::TrackObjectPresentationParticles(const XMLNode& xml_node) :
|
||||
TrackObjectPresentationSceneNode(xml_node)
|
||||
{
|
||||
@@ -587,6 +587,43 @@ void TrackObjectPresentationParticles::triggerParticles()
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
TrackObjectPresentationLight::TrackObjectPresentationLight(const XMLNode& xml_node) :
|
||||
TrackObjectPresentationSceneNode(xml_node)
|
||||
{
|
||||
xml_node.get("color", &m_color);
|
||||
const video::SColorf colorf(m_color);
|
||||
|
||||
m_distance = 25.0f;
|
||||
xml_node.get("distance", &m_distance);
|
||||
|
||||
m_energy = 1.0f;
|
||||
xml_node.get("energy", &m_energy);
|
||||
|
||||
if (irr_driver->isGLSL())
|
||||
{
|
||||
m_node = irr_driver->addLight(m_init_xyz, m_distance, m_energy, colorf.r, colorf.g, colorf.b);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_node = NULL; // lights require shaders to work
|
||||
//scene::ILightSceneNode* node = irr_driver->getSceneManager()->addLightSceneNode(NULL, m_init_xyz, m_color, m_distance);
|
||||
//node->setLightType(video::ELT_POINT);
|
||||
//node->enableCastShadow(true);
|
||||
//m_node = node;
|
||||
}
|
||||
}
|
||||
|
||||
TrackObjectPresentationLight::~TrackObjectPresentationLight()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void TrackObjectPresentationLight::update(float dt)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
TrackObjectPresentationActionTrigger::TrackObjectPresentationActionTrigger(const XMLNode& xml_node) :
|
||||
TrackObjectPresentation(xml_node)
|
||||
|
||||
@@ -263,6 +263,25 @@ public:
|
||||
void triggerParticles();
|
||||
};
|
||||
|
||||
/**
|
||||
* \ingroup tracks
|
||||
* A track object representation that consists of a light emitter
|
||||
*/
|
||||
class TrackObjectPresentationLight : public TrackObjectPresentationSceneNode
|
||||
{
|
||||
private:
|
||||
video::SColor m_color;
|
||||
float m_distance;
|
||||
float m_energy;
|
||||
|
||||
public:
|
||||
TrackObjectPresentationLight(const XMLNode& xml_node);
|
||||
virtual ~TrackObjectPresentationLight();
|
||||
|
||||
virtual void update(float dt) OVERRIDE;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \ingroup tracks
|
||||
* A track object representation that consists of an action trigger
|
||||
|
||||
Reference in New Issue
Block a user