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" 32 #include <IAnimatedMeshSceneNode.h> 44 class STKInstancedSceneNode;
50 namespace scene {
class IAnimatedMesh;
class IMeshSceneNode;
class ISceneNode; }
75 const core::vector3df& hpr = core::vector3df(0,0,0),
76 const core::vector3df& scale = core::vector3df(0,0,0))
87 virtual void reset() {}
88 virtual void setEnable(
bool enabled)
90 Log::warn(
"TrackObjectPresentation",
"setEnable unimplemented for this presentation type");
92 virtual void updateGraphics(
float dt) {}
93 virtual void update(
float dt) {}
94 virtual void move(
const core::vector3df& xyz,
const core::vector3df& hpr,
95 const core::vector3df& scale,
bool isAbsoluteCoord) {}
99 virtual const core::vector3df&
getPosition()
const {
return m_init_xyz; }
108 virtual const core::vector3df getAbsoluteCenterPosition()
const 114 virtual const core::vector3df&
getRotation()
const {
return m_init_hpr; }
117 virtual const core::vector3df&
getScale()
const {
return m_init_scale; }
133 bool m_force_always_hidden;
141 m_force_always_hidden =
false;
146 const core::vector3df& hpr,
147 const core::vector3df& scale,
148 scene::ISceneNode* node = NULL) :
152 m_force_always_hidden =
false;
156 virtual const core::vector3df& getPosition()
const OVERRIDE;
157 virtual const core::vector3df getAbsolutePosition()
const OVERRIDE;
158 virtual const core::vector3df getAbsoluteCenterPosition()
const OVERRIDE;
159 virtual const core::vector3df& getRotation()
const OVERRIDE;
160 virtual const core::vector3df& getScale()
const OVERRIDE;
161 virtual void move(
const core::vector3df& xyz,
const core::vector3df& hpr,
162 const core::vector3df& scale,
bool isAbsoluteCoord) OVERRIDE;
163 virtual void setEnable(
bool enabled) OVERRIDE;
164 virtual void reset() OVERRIDE;
168 scene::ISceneNode*
getNode() {
return m_node; }
171 const scene::ISceneNode*
getNode()
const {
return m_node; }
173 bool isAlwaysHidden()
const {
return m_force_always_hidden; }
195 using TrackObjectPresentationSceneNode::move;
197 bool m_start_executed, m_reset_executed;
203 virtual void update(
float dt) OVERRIDE;
204 virtual void reset() OVERRIDE
206 m_reset_executed =
false;
207 TrackObjectPresentationSceneNode::reset();
209 virtual void move(
const core::vector3df& xyz,
const core::vector3df& hpr,
210 const core::vector3df& scale,
bool isAbsoluteCoord) OVERRIDE;
222 scene::ISceneNode* parent,
224 std::shared_ptr<RenderInfo> ri);
226 virtual void reset() OVERRIDE;
246 std::string m_model_file;
248 std::shared_ptr<RenderInfo> m_render_info;
250 void init(
const XMLNode* xml_node, scene::ISceneNode* parent,
bool enabled);
254 scene::ISceneNode* parent,
255 std::shared_ptr<RenderInfo> render_info);
258 const core::vector3df& xyz,
259 const core::vector3df& hpr,
260 const core::vector3df& scale);
262 const core::vector3df& xyz,
263 const core::vector3df& hpr,
264 const core::vector3df& scale);
266 virtual void reset() OVERRIDE;
269 const
std::
string& getModelFile()
const {
return m_model_file; }
287 core::vector3df m_xyz;
294 scene::ISceneNode* parent,
295 bool disable_for_multiplayer);
297 void onTriggerItemApproached(
int kart_id);
298 virtual void updateGraphics(
float dt) OVERRIDE;
299 virtual void move(
const core::vector3df& xyz,
const core::vector3df& hpr,
300 const core::vector3df& scale,
bool isAbsoluteCoord) OVERRIDE;
301 void triggerSound(
bool loop);
304 virtual void setEnable(
bool enabled) OVERRIDE;
322 float m_fade_out_start;
323 float m_fade_out_end;
326 scene::ISceneNode* parent);
328 virtual void updateGraphics(
float dt) OVERRIDE;
341 std::string m_trigger_condition;
343 double m_delayed_stop_time;
347 scene::ISceneNode* parent);
350 virtual void updateGraphics(
float dt) OVERRIDE;
351 void triggerParticles();
353 void stopIn(
double delay);
354 void setRate(
float rate);
367 video::SColor m_color;
372 scene::ISceneNode* parent);
374 float getEnergy()
const {
return m_energy; }
375 virtual void setEnable(
bool enabled) OVERRIDE;
376 void setEnergy(
float energy);
381 enum ActionTriggerType
383 TRIGGER_TYPE_POINT = 0,
384 TRIGGER_TYPE_CYLINDER = 1
394 std::string
m_action, m_library_id, m_triggered_object, m_library_name;
396 float m_xml_reenable_timeout;
398 uint64_t m_reenable_timeout;
400 ActionTriggerType m_type;
406 const std::string& scriptname,
411 void onTriggerItemApproached(
int kart_id);
422 std::numeric_limits<uint64_t>::max();
425 void setReenableTimeout(
float time)
433 #endif // TRACKOBJECTPRESENTATION_HPP core::vector3df m_init_scale
The initial scale of the object.
Definition: track_object_presentation.hpp:67
Definition: script_track.cpp:471
A track object representation that is invisible and only consists of a location, rotation and scale...
Definition: track_object_presentation.hpp:181
std::string m_trigger_condition
Currently used for sound effects only, in cutscenes only atm.
Definition: track_object_presentation.hpp:285
A track object representation that consists of a billboard scene node.
Definition: track_object_presentation.hpp:315
scene::ISceneNode * m_node
A pointer to the scene node of this object.
Definition: track_object_presentation.hpp:131
virtual const core::vector3df getAbsolutePosition() const
Returns a copy of the initial position.
Definition: track_object_presentation.hpp:103
A track object representation that consists of a sound emitter.
Definition: track_object_presentation.hpp:276
virtual const core::vector3df & getScale() const
Returns the initial scale.
Definition: track_object_presentation.hpp:117
Definition: script_track.cpp:250
Definition: three_d_animation.hpp:32
scene::ISceneNode * getNode()
Returns a pointer to the scene node.
Definition: track_object_presentation.hpp:168
TrackObjectPresentationSceneNode(const XMLNode &xml_node)
Constructor based on data from xml.
Definition: track_object_presentation.hpp:137
static uint64_t getMonoTimeMs()
Returns a time based since the starting of stk (monotonic clock).
Definition: time.hpp:106
core::vector3df m_init_xyz
The initial XYZ position of the object.
Definition: track_object_presentation.hpp:61
void stop()
Stop a sound.
Definition: script_track.cpp:450
bool m_is_in_skybox
True if the object is in the skybox.
Definition: track_object_presentation.hpp:244
core::vector3df m_init_hpr
The initial hpr of the object.
Definition: track_object_presentation.hpp:64
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:145
Base class for all track object presentation classes.
Definition: track_object_presentation.hpp:57
Definition: physical_object.hpp:38
A track object representation that consists of a particle emitter.
Definition: track_object_presentation.hpp:336
std::string & getTriggerCondition()
Returns the trigger condition for this object.
Definition: track_object_presentation.hpp:357
Base class for all track object presentation classes using a scene node as presentation.
Definition: track_object_presentation.hpp:127
A track object representation that consists of a level-of-detail scene node.
Definition: track_object_presentation.hpp:217
A track object representation that consists of a light emitter.
Definition: track_object_presentation.hpp:364
const std::string & getTriggerCondition() const
Currently used for sound effects only, in cutscenes only atm.
Definition: track_object_presentation.hpp:308
manages level-of-detail
Definition: lod_node.hpp:48
const scene::ISceneNode * getNode() const
Returns a pointer to the scene node, const version.
Definition: track_object_presentation.hpp:171
A track object representation that consists of an action trigger.
Definition: track_object_presentation.hpp:390
virtual const core::vector3df & getRotation() const
Returns the initial rotation.
Definition: track_object_presentation.hpp:114
scene::IMesh * m_mesh
The mesh used here.
Definition: track_object_presentation.hpp:238
bool m_fade_out_when_close
To make the billboard disappear when close to the camera.
Definition: track_object_presentation.hpp:321
SFXBase * m_sound
If a sound is attached to this object and/or this is a sound emitter object.
Definition: track_object_presentation.hpp:282
utility class used to parse XML files
Definition: xml_node.hpp:47
virtual void reset() OVERRIDE
Reset the trigger (i.e.
Definition: track_object_presentation.hpp:414
void stopIn(float delay,)
Stop particle emission.
Definition: script_track.cpp:486
virtual void setEnable(bool status) OVERRIDE
Sets the trigger to be enabled or disabled.
Definition: track_object_presentation.hpp:419
A track object representation that consists of a mesh scene node.
Definition: track_object_presentation.hpp:233
A track object representation that is a library node.
Definition: track_object_presentation.hpp:192
Definition: render_info.hpp:27
virtual const core::vector3df & getPosition() const
Returns the position of this TrackObjectPresentation.
Definition: track_object_presentation.hpp:99
bool m_is_looped
True if it is a looped animation.
Definition: track_object_presentation.hpp:241
The base class for sound effects.
Definition: sfx_base.hpp:42
A virtual base class for all animations.
Definition: three_d_animation.hpp:44
Utility class to load level-of-detail nodes and library nodes.
Definition: model_definition_loader.hpp:81
std::string m_action
For action trigger objects.
Definition: track_object_presentation.hpp:394