Leviathan  0.8.0.0
Leviathan game engine
Components.h
Go to the documentation of this file.
1 // Leviathan Game Engine
2 // Copyright (c) 2012-2018 Henri Hyyryläinen
3 #pragma once
4 
6 #include "Define.h"
7 // ------------------------------------ //
8 #include "Common/SFMLPackets.h"
9 #include "Common/Types.h"
10 #include "Physics/PhysicsBody.h"
11 #include "Physics/PhysicsShape.h"
12 
13 #include "Component.h"
14 #include "ComponentState.h"
15 
16 #include <OgrePlane.h>
17 
18 #include <functional>
19 
20 // This is not optimal to be here but SimpleAnimation would have to
21 // rehash a string each frame
22 #include "OgreIdString.h"
23 
24 namespace Leviathan {
25 
26 class PhysicalWorld;
27 
28 namespace Test {
29 class TestComponentCreation;
30 }
31 
32 class PositionState;
33 
38 class Position : public ComponentWithStates<PositionState>, public PhysicsPositionProvider {
39 public:
40  struct Data {
41 
42  Data(const Float3& position, const Float4& orientation) :
43  _Position(position), _Orientation(orientation)
44  {}
45 
48  };
49 
50 public:
52  inline Position(const Data& data) : ComponentWithStates(TYPE), Members(data) {}
53 
55  const Float3*& position, const Float4*& orientation) const override
56  {
57  position = &Members._Position;
58  orientation = &Members._Orientation;
59  }
60 
61  void SetPositionDataFromPhysics(const Float3& position, const Float4& orientation) override
62  {
63  Members._Position = position;
64  Members._Orientation = orientation;
65  Marked = true;
66  }
67 
70  DLLEXPORT void ApplyState(const PositionState& state);
71 
73 
75 
76  static constexpr auto TYPE = COMPONENT_TYPE::Position;
77  using StateT = PositionState;
78 };
79 
83 class RenderNode : public Component {
84 public:
85  DLLEXPORT RenderNode(Ogre::SceneManager* scene);
86 
88  DLLEXPORT RenderNode(const Test::TestComponentCreation& test);
89 
91  DLLEXPORT void Release(Ogre::SceneManager* worldsscene);
92 
94 
95  Ogre::SceneNode* Node = nullptr;
96 
98  bool Hidden = false;
99 
101  Float3 Scale = Float3(1, 1, 1);
102 
103  static constexpr auto TYPE = COMPONENT_TYPE::RenderNode;
104 };
105 
112 class Sendable : public Component {
113 public:
119  public:
120  inline ActiveConnection(const std::shared_ptr<Connection>& connection) :
121  CorrespondingConnection(connection)
122  {}
123 
127 
129  inline void AddSentPacket(int tick, const std::shared_ptr<EntityState>& state,
130  std::shared_ptr<SentNetworkThing> packet)
131  {
132  SentPackets.emplace_back(tick, state, packet);
133  }
134 
135  std::shared_ptr<Connection> CorrespondingConnection;
136 
140  std::shared_ptr<EntityState> LastConfirmedData;
141 
144  // LastConfirmedData will be replaced.
146 
148  std::vector<
149  std::tuple<int, std::shared_ptr<EntityState>, std::shared_ptr<SentNetworkThing>>>
151  };
152 
153 public:
154  inline Sendable() : Component(TYPE) {}
155 
157 
159  std::vector<ActiveConnection> UpdateReceivers;
160 
161  static constexpr auto TYPE = COMPONENT_TYPE::Sendable;
162 };
163 
167 class Received : public Component {
168 public:
169  // //! \brief Storage class for ObjectDeltaStateData
170  // //! \todo Possibly add move constructors
171  // class StoredState {
172  // public:
173  // inline StoredState(std::shared_ptr<ComponentState> safedata, int tick, void* data) :
174  // DeltaData(safedata), Tick(tick), DirectData(data)
175  // {}
176 
177  // std::shared_ptr<ComponentState> DeltaData;
178 
179  // //! Tick number, should be retrieved from DeltaData
180  // int Tick;
181 
182  // //! This avoids using dynamic_cast
183  // void* DirectData;
184  // };
185 
186 public:
187  inline Received() :
188  Component(TYPE) //, ClientStateBuffer(BASESENDABLE_STORED_RECEIVED_STATES)
189  {}
190 
191  // DLLEXPORT void GetServerSentStates(StoredState const** first, StoredState const**
192  // second,
193  // int tick, float& progress) const;
194 
196 
197  // //! Client side buffer of past states
198  // boost::circular_buffer<StoredState> ClientStateBuffer;
199 
201  bool LocallyControlled = false;
202 
203  static constexpr auto TYPE = COMPONENT_TYPE::Received;
204 };
205 
206 
208 class BoxGeometry : public Component {
209 public:
210  inline BoxGeometry(const Float3& size, const std::string& material) :
211  Component(TYPE), Sizes(size), Material(material)
212  {}
213 
215 
218 
220  std::string Material;
221 
223  Ogre::Item* GraphicalObject = nullptr;
224 
225  static constexpr auto TYPE = COMPONENT_TYPE::BoxGeometry;
226 };
227 
229 class Model : public Component {
230 public:
232  Ogre::SceneManager* scene, Ogre::SceneNode* parent, const std::string& meshname);
233 
235  DLLEXPORT void Release(Ogre::SceneManager* scene);
236 
238 
240  Ogre::Item* GraphicalObject = nullptr;
241 
243  std::string MeshName;
244 
245  static constexpr auto TYPE = COMPONENT_TYPE::Model;
246 };
247 
250 
251  DLLEXPORT inline SimpleAnimation(const std::string& name) : Name(name), ReadableName(name)
252  {}
253 
255  Name(std::move(other.Name)), ReadableName(std::move(other.ReadableName))
256  {
257  Loop = other.Loop;
258  SpeedFactor = other.SpeedFactor;
259  Paused = other.Paused;
260  }
261 
263  Name(other.Name), ReadableName(other.ReadableName)
264  {
265  Loop = other.Loop;
266  SpeedFactor = other.SpeedFactor;
267  Paused = other.Paused;
268  }
269 
270  const Ogre::IdString Name;
271 
273  const std::string ReadableName;
274 
276  bool Loop = false;
278  float SpeedFactor = 1;
280  bool Paused = false;
281 };
282 
284 class Animated : public Component {
285 public:
286  DLLEXPORT Animated(Ogre::Item* item) : Component(TYPE), GraphicalObject(item) {}
287 
289 
291  Ogre::Item* GraphicalObject = nullptr;
292 
296  std::vector<SimpleAnimation> Animations;
297 
298  static constexpr auto TYPE = COMPONENT_TYPE::Animated;
299 };
300 
304 class Plane : public Component {
305 public:
306  DLLEXPORT Plane(Ogre::SceneManager* scene, Ogre::SceneNode* parent,
307  const std::string& material, const Ogre::Plane& plane, const Float2& size,
308  const Ogre::Vector3& uvupvector = Ogre::Vector3::UNIT_Y);
309 
311  DLLEXPORT void Release(Ogre::SceneManager* scene);
312 
314 
316  Ogre::Item* GraphicalObject = nullptr;
317 
318  const std::string GeneratedMeshName;
319 
320  // Changing any of these does nothing
321  std::string Material;
325 
326  static constexpr auto TYPE = COMPONENT_TYPE::Plane;
327 };
328 
329 
333 class Physics : public Component {
334 public:
337  public:
340  ApplyForceInfo(bool addmass,
341  std::function<Float3(ApplyForceInfo* instance, Physics& object)> getforce,
342  std::unique_ptr<std::string> name = nullptr) :
343  OptionalName(move(name)),
344  MultiplyByMass(addmass), Callback(getforce)
345  {}
346 
349  {
350  if(other.OptionalName)
351  OptionalName = std::make_unique<std::string>(*other.OptionalName);
352  }
353 
355  OptionalName(move(other.OptionalName)),
356  MultiplyByMass(std::move(other.MultiplyByMass)), Callback(move(other.Callback))
357  {}
358 
360  {
361 
362  if(other.OptionalName)
363  OptionalName = std::make_unique<std::string>(*other.OptionalName);
364 
366  Callback = other.Callback;
367 
368  return *this;
369  }
370 
372  std::unique_ptr<std::string> OptionalName;
373 
377 
380  std::function<Float3(ApplyForceInfo* instance, Physics& object)> Callback;
381  };
382 
384 
387  };
388 
389  struct Data {
390 
395  };
396 
397 public:
398  inline Physics(const Data& args) :
399  Component(TYPE), ThisEntity(args.id), _Position(args.updatepos)
400  {}
401 
403 
405  DLLEXPORT void Release(PhysicalWorld* world);
406 
414  DLLEXPORT PhysicsBody::pointer CreatePhysicsBody(PhysicalWorld* world,
415  const PhysicsShape::pointer& shape, float mass, int physicsmaterialid = -1);
416 
419  DLLEXPORT bool ChangeShape(PhysicalWorld* world, const PhysicsShape::pointer& shape);
420 
425  DLLEXPORT void JumpTo(Position& target);
426 
428  DLLEXPORT void ApplyPhysicalState(const BasePhysicsData& data);
429 
431  Float3 _GatherApplyForces(const float& mass);
432 
433  DLLEXPORT float GetMass() const;
434 
435  inline PhysicsBody* GetBody() const
436  {
437  return Body.get();
438  }
439 
440  //
441  // Script wrappers
442  //
443 
444  inline PhysicsBody* GetBodyWrapper() const
445  {
446  if(Body)
447  Body->AddRef();
448  return Body.get();
449  }
450 
451  inline bool ChangeShapeWrapper(PhysicalWorld* world, PhysicsShape* shape)
452  {
453  return ChangeShape(world, ReferenceCounted::WrapPtr(shape));
454  }
455 
457  PhysicalWorld* world, PhysicsShape* shape, float mass, int physicsmaterialid)
458  {
459  auto body = CreatePhysicsBody(
460  world, ReferenceCounted::WrapPtr(shape), mass, physicsmaterialid);
461 
462  if(body)
463  body->AddRef();
464  return body.get();
465  }
466 
468 
469 private:
470  PhysicsBody::pointer Body;
471 
472 public:
475 
476  // //! Used to access gravity data
477  // GameWorld* World = nullptr;
478 
481 
482  static constexpr auto TYPE = COMPONENT_TYPE::Physics;
483 };
484 
485 class ManualObject : public Component {
486 public:
487  DLLEXPORT ManualObject(Ogre::SceneManager* scene);
488 
489  DLLEXPORT void Release(Ogre::SceneManager* scene);
490 
492 
494 
499  std::string CreatedMesh;
500 
501  static constexpr auto TYPE = COMPONENT_TYPE::ManualObject;
502 };
503 
504 
505 // class Parent : public Component{
506 // public:
507 
508 // struct Data{
509 
510 // std::vector<ObjectID> EntityIDs;
511 // };
512 
513 // public:
514 // DLLEXPORT Parent();
515 
516 // DLLEXPORT Parent(const Data &data, GameWorld* world, Lock &worldlock);
517 
518 // //! \brief Removes child object without notifying it
519 // DLLEXPORT void RemoveChildNoNotify(Parentable* which);
520 
521 // //! \brief Removes all children notifying them
522 // DLLEXPORT void RemoveChildren();
523 
524 // DLLEXPORT void AddDataToPacket(sf::Packet &packet) const;
525 
526 // //! \note The packet needs to be checked that it is still valid after this call
527 // DLLEXPORT static Data LoadDataFromPacket(sf::Packet &packet);
528 
529 // //! \brief Does everything necessary to attach a child
530 // DLLEXPORT void AddChild(ObjectID childid, Parentable &child);
531 
532 // //! Attached children which can be moved at certain times
533 // //! \todo Make improvements to component lookup performance through this
534 // std::vector<std::tuple<ObjectID, Parentable*>> Children;
535 // };
536 
537 
538 
539 // class Constraintable : public Component{
540 // public:
541 // //! \param world Used to allow created constraints to access world data (including
542 // physics) DLLEXPORT Constraintable(ObjectID id, GameWorld* world);
543 
544 // //! \brief Destroys all constraints attached to this
545 // DLLEXPORT ~Constraintable();
546 
547 // //! Creates a constraint between this and another object
548 // //! \warning DO NOT store the returned value (since that reference isn't counted)
549 // //! \note Before the constraint is actually finished, you need to
550 // //! call ->SetParameters() on the returned ptr
551 // //! and then ->Init() and then let go of the ptr
552 // //! \note If you do not want to allow constraints where child is NULL you have to
553 // //! check if child is NULL before calling this function
554 // template<class ConstraintClass, typename... Args>
555 // std::shared_ptr<ConstraintClass> CreateConstraintWith(Constraintable &other,
556 // Args&&... args)
557 // {
558 // auto tmpconstraint = std::make_shared<ConstraintClass>(World, *this, other,
559 // args...);
560 
561 // if(tmpconstraint)
562 // _NotifyCreate(tmpconstraint, other);
563 
564 // return tmpconstraint;
565 // }
566 
567 // DLLEXPORT void RemoveConstraint(BaseConstraint* removed);
568 
569 // DLLEXPORT void AddConstraint(std::shared_ptr<BaseConstraint> added);
570 
571 // protected:
572 
573 // //! \brief Notifies the other object and the GameWorld of the new constraint
574 // DLLEXPORT void _NotifyCreate(std::shared_ptr<BaseConstraint> newconstraint,
575 // Constraintable &other);
576 
577 // public:
578 
579 
580 // std::vector<std::shared_ptr<BaseConstraint>> PartInConstraints;
581 
582 // GameWorld* World;
583 
584 // //! ID for other component lookup
585 // ObjectID PartOfEntity;
586 // };
587 
588 // class Trail : public Component{
589 // public:
590 
591 // struct ElementProperties{
592 // ElementProperties(const Float4 &initialcolour,
593 // const Float4 &colourchange, const float &initialsize, const float &sizechange) :
594 // InitialColour(initialcolour), ColourChange(colourchange),
595 // InitialSize(initialsize), SizeChange(sizechange)
596 // {
597 
598 // }
599 
600 // ElementProperties(const Float4 &initialcolour,
601 // const float &initialsize) :
602 // InitialColour(initialcolour), ColourChange(0), InitialSize(initialsize),
603 // SizeChange(0)
604 // {
605 
606 // }
607 
608 // ElementProperties() :
609 // InitialColour(1), ColourChange(0), InitialSize(1), SizeChange(0)
610 // {
611 
612 // }
613 
614 // Float4 InitialColour;
615 // Float4 ColourChange;
616 // float InitialSize;
617 // float SizeChange;
618 // };
619 
620 // struct Properties{
621 // public:
622 // Properties(size_t maxelements, float lenght, float maxdistance,
623 // bool castshadows = false) :
624 // TrailLenght(lenght), MaxDistance(maxdistance),
625 // MaxChainElements(maxelements), CastShadows(castshadows), Elements(1)
626 // {
627 // }
628 
629 // float TrailLenght;
630 // float MaxDistance;
631 // size_t MaxChainElements;
632 // bool CastShadows;
633 
634 // std::vector<ElementProperties> Elements;
635 // };
636 
637 
638 // public:
639 
640 // DLLEXPORT Trail(RenderNode* node, const std::string &materialname,
641 // const Properties &variables);
642 
643 // //! \brief Sets properties on the trail object
644 // //! \pre Ogre objects have been created
645 // //! \param force If set to true all settings will be applied
646 // DLLEXPORT bool SetTrailProperties(const Properties &variables, bool force = false);
647 
648 // //! \brief Destroys the TrailEntity
649 // DLLEXPORT void Release(Ogre::SceneManager* scene);
650 
651 // //! The trail entity which is attached at the root scene node and follows our RenderNode
652 // //! component around
653 // Ogre::RibbonTrail* TrailEntity = nullptr;
654 
655 // //! For ease of use direct access to ogre node is required
656 // //! Not valid in non-gui mode
657 // RenderNode* _RenderNode = nullptr;
658 
659 // //! The used trail material
660 // std::string Material;
661 
662 // //! Current settings, when updating settings only changed ones are applied
663 // Properties CurrentSettings;
664 // };
665 
666 // //! \todo Add the Markers to the actual world for sending over the network individually
667 // class PositionMarkerOwner : public Component{
668 // public:
669 
670 // struct Data{
671 
672 // std::vector<std::tuple<ObjectID, Float3, Float4>> EntityPositions;
673 // };
674 
675 // public:
676 // DLLEXPORT PositionMarkerOwner();
677 
678 // //! \brief Create with automatically created positions
679 // DLLEXPORT PositionMarkerOwner(const Data &positions, GameWorld* world,
680 // Lock &worldlock);
681 
682 // //! \brief Queues destruction and clears the list of Markers
683 // DLLEXPORT void Release(GameWorld* world, Lock &worldlock);
684 
685 // //! Adds a node
686 // //! \todo Allow not deleting entities on release
687 // DLLEXPORT void Add(ObjectID entity, Position& pos);
688 
689 // DLLEXPORT void AddDataToPacket(sf::Packet &packet) const;
690 
691 // //! \note The packet needs to be checked that it is valid after this call
692 // DLLEXPORT static Data LoadDataFromPacket(sf::Packet &packet);
693 
694 // std::vector<std::tuple<ObjectID, Position*>> Markers;
695 // };
696 
697 
699 class Camera : public Component {
700 public:
702  inline Camera(uint8_t fovy = 60, bool soundperceiver = true) :
703  Component(TYPE), FOVY(fovy), SoundPerceiver(soundperceiver)
704  {}
705 
707 
715  // TODO: orthographic
716  // bool Orthographic;
717 
718  static constexpr auto TYPE = COMPONENT_TYPE::Camera;
719 };
720 
721 } // namespace Leviathan
722 
723 #ifdef LEAK_INTO_GLOBAL
724 using ApplyForceInfo = Leviathan::Physics::ApplyForceInfo;
725 #endif
REFERENCE_HANDLE_UNCOUNTED_TYPE(Model)
std::vector< ActiveConnection > UpdateReceivers
Clients we have already sent a state to.
Definition: Components.h:159
PhysicsBody * GetBody() const
Definition: Components.h:435
std::string Material
Definition: Components.h:321
DLLEXPORT void CheckReceivedPackets()
Checks has any packet been successfully received and updates last confirmed.
Definition: Components.cpp:252
REFERENCE_HANDLE_UNCOUNTED_TYPE(Physics)
Plane component.
Definition: Components.h:304
ObjectID ThisEntity
For passing to PhysicsBody::SetOwningEntity.
Definition: Components.h:474
Entity is received from a server.
Definition: Components.h:167
PositionState StateT
Definition: Components.h:77
int32_t ObjectID
Definition: EntityCommon.h:11
DLLEXPORT void Release(Ogre::SceneManager *scene)
Destroys GraphicalObject.
Definition: Components.cpp:309
Float3 Scale
Sets the scale of the node.
Definition: Components.h:101
static constexpr auto TYPE
Definition: Components.h:225
std::function< Float3(ApplyForceInfo *instance, Physics &object)> Callback
Definition: Components.h:380
This acts as a bridge between Leviathan positions and physics engine positions.
Definition: PhysicsBody.h:24
REFERENCE_HANDLE_UNCOUNTED_TYPE(ManualObject)
Ogre::Plane PlaneDefinition
Definition: Components.h:322
std::shared_ptr< Connection > CorrespondingConnection
Definition: Components.h:135
REFERENCE_HANDLE_UNCOUNTED_TYPE(Model)
STL namespace.
DLLEXPORT SimpleAnimation(SimpleAnimation &&other)
Definition: Components.h:254
REFERENCE_HANDLE_UNCOUNTED_TYPE(RenderNode)
A physical shape that can be used to create PhysicsBody objects.
Definition: PhysicsShape.h:17
REFERENCE_HANDLE_UNCOUNTED_TYPE(Position)
ApplyForceInfo & operator=(const ApplyForceInfo &other)
Definition: Components.h:359
std::string MeshName
Definition: Components.h:243
REFERENCE_HANDLE_UNCOUNTED_TYPE(Received)
DLLEXPORT Model(Ogre::SceneManager *scene, Ogre::SceneNode *parent, const std::string &meshname)
Definition: Components.cpp:295
static constexpr auto TYPE
Definition: Components.h:326
REFERENCE_HANDLE_UNCOUNTED_TYPE(BoxGeometry)
Ogre::Item * GraphicalObject
Entity created from a box mesh.
Definition: Components.h:223
ActiveConnection(const std::shared_ptr< Connection > &connection)
Definition: Components.h:120
Camera(uint8_t fovy=60, bool soundperceiver=true)
Creates at specific position.
Definition: Components.h:702
DLLEXPORT void ApplyState(const PositionState &state)
Applies the state and marks this as changed. Doesn&#39;t check if the state is actually different...
Definition: Components.cpp:25
Alternative base class for Component that creates distinct state objects.
Position(const Data &data)
Creates at specific position.
Definition: Components.h:52
ApplyForceInfo(ApplyForceInfo &&other)
Definition: Components.h:354
Contains an nimation for Animated component.
Definition: Components.h:249
std::vector< std::tuple< int, std::shared_ptr< EntityState >, std::shared_ptr< SentNetworkThing > > > SentPackets
Holds packets sent to this connection that haven&#39;t failed or been received yet.
Definition: Components.h:150
bool Loop
If true the animation will automatically loop.
Definition: Components.h:276
void AddSentPacket(int tick, const std::shared_ptr< EntityState > &state, std::shared_ptr< SentNetworkThing > packet)
Adds a package to be checked for finalization in CheckReceivedPackages.
Definition: Components.h:129
static constexpr auto TYPE
Definition: Components.h:76
static constexpr auto TYPE
Definition: Components.h:482
bool LocallyControlled
If true this uses local control and will send updates to the server.
Definition: Components.h:201
DLLEXPORT bool ChangeShape(PhysicalWorld *world, const PhysicsShape::pointer &shape)
Updates the shape. This can be the same pointer as before. BUT if the shape is modified this MUST be ...
Definition: Components.cpp:144
bool Paused
If true then the animation isn&#39;t updated.
Definition: Components.h:280
This is an instance of a collision body.
Definition: PhysicsBody.h:74
unsigned char uint8_t
Definition: core.h:38
bool Hidden
Sets objects attached to the node to be hidden or visible.
Definition: Components.h:98
Ogre::Item * GraphicalObject
The entity that has this model&#39;s mesh loaded.
Definition: Components.h:240
Holder for information regarding a single force.
Definition: Components.h:336
DLLEXPORT SimpleAnimation(const std::string &name)
Definition: Components.h:251
DLLEXPORT Animated(Ogre::Item *item)
Definition: Components.h:286
DLLEXPORT Plane(Ogre::SceneManager *scene, Ogre::SceneNode *parent, const std::string &material, const Ogre::Plane &plane, const Float2 &size, const Ogre::Vector3 &uvupvector=Ogre::Vector3::UNIT_Y)
Definition: Components.cpp:63
Float3 Sizes
Size along the axises.
Definition: Components.h:217
std::shared_ptr< EntityState > LastConfirmedData
Definition: Components.h:140
ApplyForceInfo(const ApplyForceInfo &other)
Definition: Components.h:347
Entity has a box for geometry/model, possibly also physics.
Definition: Components.h:208
bool ChangeShapeWrapper(PhysicalWorld *world, PhysicsShape *shape)
Definition: Components.h:451
PhysicsBody * CreatePhysicsBodyWrapper(PhysicalWorld *world, PhysicsShape *shape, float mass, int physicsmaterialid)
Definition: Components.h:456
Entity has position and direction it is looking at.
Definition: Components.h:38
Entity has an Ogre scene node.
Definition: Components.h:83
DLLEXPORT ~Physics()
Definition: Components.cpp:101
DLLEXPORT SimpleAnimation(const SimpleAnimation &other)
Definition: Components.h:262
static constexpr auto TYPE
Definition: Components.h:298
Ogre::SceneNode * Node
Definition: Components.h:95
Float3 _GatherApplyForces(const float &mass)
Adds all applied forces together.
ApplyForceInfo(bool addmass, std::function< Float3(ApplyForceInfo *instance, Physics &object)> getforce, std::unique_ptr< std::string > name=nullptr)
Definition: Components.h:340
BoxGeometry(const Float3 &size, const std::string &material)
Definition: Components.h:210
Ogre::Item * GraphicalObject
The entity that is played animations on.
Definition: Components.h:291
static constexpr auto TYPE
Definition: Components.h:501
static constexpr auto TYPE
Definition: Components.h:161
Physics(const Data &args)
Definition: Components.h:398
Ogre::Item * GraphicalObject
The plane that this component creates.
Definition: Components.h:316
DLLEXPORT PhysicsBody::pointer CreatePhysicsBody(PhysicalWorld *world, const PhysicsShape::pointer &shape, float mass, int physicsmaterialid=-1)
Use this to create a body for this component once Collision is set.
Definition: Components.cpp:124
Entity has a physical component.
Definition: Components.h:333
const Ogre::IdString Name
Definition: Components.h:270
const std::string GeneratedMeshName
Definition: Components.h:318
DLLEXPORT void Release(PhysicalWorld *world)
Destroys the physical body.
Definition: Components.cpp:108
Entity has a model.
Definition: Components.h:229
static constexpr auto TYPE
Definition: Components.h:103
std::unique_ptr< std::string > OptionalName
Set a name when you don&#39;t want other non-named forces to override this.
Definition: Components.h:372
REFERENCE_HANDLE_UNCOUNTED_TYPE(Plane)
static constexpr auto TYPE
Definition: Components.h:718
REFERENCE_HANDLE_UNCOUNTED_TYPE(Sendable)
DLLEXPORT void JumpTo(Position &target)
Syncs this physics body to a changed position.
Definition: Components.cpp:118
Properties that a camera entity has (will also need a Position component)
Definition: Components.h:699
static constexpr auto TYPE
Definition: Components.h:245
std::string Material
Rendering surface material name.
Definition: Components.h:220
REFERENCE_HANDLE_UNCOUNTED_TYPE(Camera)
#define DLLEXPORT
Definition: Include.h:115
static constexpr auto TYPE
Definition: Components.h:203
Entity plays animations on an Ogre::Item.
Definition: Components.h:284
Base class for all components.
Definition: Component.h:52
Position & _Position
Physics object requires a position.
Definition: Components.h:480
The access mask controls which registered functions and classes a script sees.
Definition: GameModule.h:12
DLLEXPORT void Release(Ogre::SceneManager *worldsscene)
Gracefully releases while world is still valid.
Definition: Components.cpp:48
Entity is sendable to clients.
Definition: Components.h:112
DLLEXPORT float GetMass() const
DLLEXPORT void ApplyPhysicalState(const BasePhysicsData &data)
Applies physical state from holder object.
float SpeedFactor
Controls how fast the animation plays.
Definition: Components.h:278
void SetPositionDataFromPhysics(const Float3 &position, const Float4 &orientation) override
Definition: Components.h:61
void GetPositionDataForPhysics(const Float3 *&position, const Float4 *&orientation) const override
Definition: Components.h:54
static boost::intrusive_ptr< ActualType > WrapPtr(ActualType *ptr)
Creates an intrusive_ptr from raw pointer.
std::string CreatedMesh
Definition: Components.h:499
DLLEXPORT RenderNode(Ogre::SceneManager *scene)
Definition: Components.cpp:33
Data(const Float3 &position, const Float4 &orientation)
Definition: Components.h:42
Ogre::ManualObject * Object
Definition: Components.h:493
DLLEXPORT void Release(Ogre::SceneManager *scene)
Definition: Components.cpp:322
const std::string ReadableName
Readable version of Name as it is hashed.
Definition: Components.h:273
Represents a world that contains entities.
Definition: GameWorld.h:99
DLLEXPORT void Release(Ogre::SceneManager *scene)
Destroys GraphicalObject.
Definition: Components.cpp:94
DLLEXPORT ManualObject(Ogre::SceneManager *scene)
Definition: Components.cpp:316
std::vector< SimpleAnimation > Animations
Definition: Components.h:296
PhysicsBody * GetBodyWrapper() const
Definition: Components.h:444