20 #ifndef HEADER_TRACK_OBJECT_PRESENTATION_HPP
21 #define HEADER_TRACK_OBJECT_PRESENTATION_HPP
23 #include "graphics/lod_node.hpp"
24 #include "utils/cpp2011.hpp"
25 #include "utils/no_copy.hpp"
26 #include "utils/log.hpp"
27 #include "utils/leak_check.hpp"
28 #include "utils/time.hpp"
29 #include "utils/vec3.hpp"
41 namespace GE {
class GERenderInfo; }
42 class STKInstancedSceneNode;
52 namespace scene {
class IAnimatedMesh;
class IMesh;
class IMeshSceneNode;
class ISceneNode; }
77 const core::vector3df& hpr = core::vector3df(0,0,0),
78 const core::vector3df& scale = core::vector3df(0,0,0))
89 virtual void reset() {}
90 virtual void setEnable(
bool enabled)
92 Log::warn(
"TrackObjectPresentation",
"setEnable unimplemented for this presentation type");
94 virtual void updateGraphics(
float dt) {}
95 virtual void update(
float dt) {}
96 virtual void move(
const core::vector3df& xyz,
const core::vector3df& hpr,
97 const core::vector3df& scale,
bool isAbsoluteCoord) {}
101 virtual const core::vector3df&
getPosition()
const {
return m_init_xyz; }
110 virtual const core::vector3df getAbsoluteCenterPosition()
const
116 virtual const core::vector3df&
getRotation()
const {
return m_init_hpr; }
119 virtual const core::vector3df&
getScale()
const {
return m_init_scale; }
135 bool m_force_always_hidden;
143 m_force_always_hidden =
false;
148 const core::vector3df& hpr,
149 const core::vector3df& scale,
150 scene::ISceneNode* node = NULL) :
154 m_force_always_hidden =
false;
158 virtual const core::vector3df& getPosition() const OVERRIDE;
159 virtual const core::vector3df getAbsolutePosition() const OVERRIDE;
160 virtual const core::vector3df getAbsoluteCenterPosition() const OVERRIDE;
161 virtual const core::vector3df& getRotation() const OVERRIDE;
162 virtual const core::vector3df& getScale() const OVERRIDE;
163 virtual
void move(const core::vector3df& xyz, const core::vector3df& hpr,
164 const core::vector3df& scale,
bool isAbsoluteCoord) OVERRIDE;
165 virtual
void setEnable(
bool enabled) OVERRIDE;
166 virtual
void reset() OVERRIDE;
170 scene::ISceneNode* getNode() {
return m_node; }
173 const scene::ISceneNode*
getNode()
const {
return m_node; }
175 bool isAlwaysHidden()
const {
return m_force_always_hidden; }
197 using TrackObjectPresentationSceneNode::move;
199 bool m_start_executed, m_reset_executed;
205 virtual void update(
float dt) OVERRIDE;
206 virtual void reset() OVERRIDE
208 m_reset_executed =
false;
209 TrackObjectPresentationSceneNode::reset();
211 virtual void move(
const core::vector3df& xyz,
const core::vector3df& hpr,
212 const core::vector3df& scale,
bool isAbsoluteCoord) OVERRIDE;
224 scene::ISceneNode* parent,
226 std::shared_ptr<GE::GERenderInfo> ri);
228 virtual void reset() OVERRIDE;
248 std::string m_model_file;
250 std::shared_ptr<GE::GERenderInfo> m_render_info;
252 void init(
const XMLNode* xml_node, scene::ISceneNode* parent,
bool enabled);
256 scene::ISceneNode* parent,
257 std::shared_ptr<GE::GERenderInfo> render_info);
260 const core::vector3df& xyz,
261 const core::vector3df& hpr,
262 const core::vector3df& scale);
264 const core::vector3df& xyz,
265 const core::vector3df& hpr,
266 const core::vector3df& scale);
268 virtual void reset() OVERRIDE;
271 const std::
string& getModelFile()
const {
return m_model_file; }
289 core::vector3df m_xyz;
296 scene::ISceneNode* parent,
297 bool disable_for_multiplayer);
299 void onTriggerItemApproached(
int kart_id);
300 virtual void updateGraphics(
float dt) OVERRIDE;
301 virtual void move(
const core::vector3df& xyz,
const core::vector3df& hpr,
302 const core::vector3df& scale,
bool isAbsoluteCoord) OVERRIDE;
303 void triggerSound(
bool loop);
306 virtual void setEnable(
bool enabled) OVERRIDE;
324 float m_fade_out_start;
325 float m_fade_out_end;
328 scene::ISceneNode* parent);
330 virtual void updateGraphics(
float dt) OVERRIDE;
345 std::string m_trigger_condition;
347 double m_delayed_stop_time;
351 scene::ISceneNode* parent);
354 virtual void updateGraphics(
float dt) OVERRIDE;
355 void triggerParticles();
357 void stopIn(
double delay);
358 void setRate(
float rate);
371 video::SColor m_color;
376 scene::ISceneNode* parent);
378 float getEnergy()
const {
return m_energy; }
379 virtual void setEnable(
bool enabled) OVERRIDE;
380 void setEnergy(
float energy);
385 enum ActionTriggerType
387 TRIGGER_TYPE_POINT = 0,
388 TRIGGER_TYPE_CYLINDER = 1
398 std::string
m_action, m_library_id, m_triggered_object, m_library_name;
400 float m_xml_reenable_timeout;
402 uint64_t m_reenable_timeout;
404 ActionTriggerType m_type;
410 const std::string& scriptname,
415 void onTriggerItemApproached(
int kart_id);
426 std::numeric_limits<uint64_t>::max();
429 void setReenableTimeout(
float time)
manages level-of-detail
Definition: lod_node.hpp:50
Utility class to load level-of-detail nodes and library nodes.
Definition: model_definition_loader.hpp:81
manages smoke particle effects
Definition: particle_emitter.hpp:44
Definition: physical_object.hpp:40
The base class for sound effects.
Definition: sfx_base.hpp:43
static uint64_t getMonoTimeMs()
Returns a time based since the starting of stk (monotonic clock).
Definition: time.hpp:113
A virtual base class for all animations.
Definition: three_d_animation.hpp:45
A track object representation that consists of an action trigger.
Definition: track_object_presentation.hpp:395
virtual void setEnable(bool status) OVERRIDE
Sets the trigger to be enabled or disabled.
Definition: track_object_presentation.hpp:423
virtual void reset() OVERRIDE
Reset the trigger (i.e.
Definition: track_object_presentation.hpp:418
std::string m_action
For action trigger objects.
Definition: track_object_presentation.hpp:398
A track object representation that consists of a billboard scene node.
Definition: track_object_presentation.hpp:318
bool m_fade_out_when_close
To make the billboard disappear when close to the camera.
Definition: track_object_presentation.hpp:323
A track object representation that is invisible and only consists of a location, rotation and scale.
Definition: track_object_presentation.hpp:184
A track object representation that consists of a level-of-detail scene node.
Definition: track_object_presentation.hpp:220
A track object representation that is a library node.
Definition: track_object_presentation.hpp:195
A track object representation that consists of a light emitter.
Definition: track_object_presentation.hpp:369
A track object representation that consists of a mesh scene node.
Definition: track_object_presentation.hpp:236
bool m_is_in_skybox
True if the object is in the skybox.
Definition: track_object_presentation.hpp:246
scene::IMesh * m_mesh
The mesh used here.
Definition: track_object_presentation.hpp:240
bool m_is_looped
True if it is a looped animation.
Definition: track_object_presentation.hpp:243
A track object representation that consists of a particle emitter.
Definition: track_object_presentation.hpp:339
std::string & getTriggerCondition()
Returns the trigger condition for this object.
Definition: track_object_presentation.hpp:361
Base class for all track object presentation classes using a scene node as presentation.
Definition: track_object_presentation.hpp:130
TrackObjectPresentationSceneNode(const XMLNode &xml_node)
Constructor based on data from xml.
Definition: track_object_presentation.hpp:139
TrackObjectPresentationSceneNode(const core::vector3df &xyz, const core::vector3df &hpr, const core::vector3df &scale, scene::ISceneNode *node=NULL)
Constructor based on a transform.
Definition: track_object_presentation.hpp:147
const scene::ISceneNode * getNode() const
Returns a pointer to the scene node, const version.
Definition: track_object_presentation.hpp:173
scene::ISceneNode * m_node
A pointer to the scene node of this object.
Definition: track_object_presentation.hpp:133
A track object representation that consists of a sound emitter.
Definition: track_object_presentation.hpp:279
SFXBase * m_sound
If a sound is attached to this object and/or this is a sound emitter object.
Definition: track_object_presentation.hpp:284
const std::string & getTriggerCondition() const
Currently used for sound effects only, in cutscenes only atm.
Definition: track_object_presentation.hpp:310
std::string m_trigger_condition
Currently used for sound effects only, in cutscenes only atm.
Definition: track_object_presentation.hpp:287
Base class for all track object presentation classes.
Definition: track_object_presentation.hpp:60
core::vector3df m_init_xyz
The initial XYZ position of the object.
Definition: track_object_presentation.hpp:63
core::vector3df m_init_hpr
The initial hpr of the object.
Definition: track_object_presentation.hpp:66
virtual const core::vector3df & getRotation() const
Returns the initial rotation.
Definition: track_object_presentation.hpp:116
core::vector3df m_init_scale
The initial scale of the object.
Definition: track_object_presentation.hpp:69
virtual const core::vector3df getAbsolutePosition() const
Returns a copy of the initial position.
Definition: track_object_presentation.hpp:105
virtual const core::vector3df & getPosition() const
Returns the position of this TrackObjectPresentation.
Definition: track_object_presentation.hpp:101
virtual const core::vector3df & getScale() const
Returns the initial scale.
Definition: track_object_presentation.hpp:119
This is a base object for any separate object on the track, which might also have a skeletal animatio...
Definition: track_object.hpp:56
utility class used to parse XML files
Definition: xml_node.hpp:48
void stopIn(float delay,)
Stop particle emission.
Definition: script_track.cpp:492
void stop()
Stop a sound.
Definition: script_track.cpp:456
void update(float dt)
Updates all widgets that need to be updated.
Definition: engine.cpp:872