| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- $#include "AnimationController.h"
- $#include "AnimatedModel.h"
- $#include "Camera.h"
- $#include "CollisionShape.h"
- $#include "Constraint.h"
- $#include "DebugRenderer.h"
- $#include "DecalSet.h"
- $#include "Drawable.h"
- $#include "Light.h"
- $#include "Navigable.h"
- $#include "NavigationMesh.h"
- $#include "NetworkPriority.h"
- $#include "Node.h"
- $#include "Octree.h"
- $#include "OffMeshConnection.h"
- $#include "PhysicsWorld.h"
- $#include "RigidBody.h"
- $#include "SmoothedTransform.h"
- $#include "SoundListener.h"
- $#include "SoundSource.h"
- $#include "StaticModel.h"
- $#include "Terrain.h"
- $#include "Zone.h"
- enum CreateMode
- {
- REPLICATED = 0,
- LOCAL = 1
- };
- class Node : public Serializable
- {
- Node(Context* context);
- virtual ~Node();
- bool SaveXML(Serializer& dest) const;
- void SetName(const String& name);
- void SetPosition(const Vector3& position);
- void SetRotation(const Quaternion& rotation);
- void SetDirection(const Vector3& direction);
- void SetScale(float scale);
- void SetScale(const Vector3& scale);
- void SetTransform(const Vector3& position, const Quaternion& rotation);
- void SetTransform(const Vector3& position, const Quaternion& rotation, float scale);
- void SetTransform(const Vector3& position, const Quaternion& rotation, const Vector3& scale);
- void SetWorldPosition(const Vector3& position);
- void SetWorldRotation(const Quaternion& rotation);
- void SetWorldDirection(const Vector3& direction);
- void SetWorldScale(float scale);
- void SetWorldScale(const Vector3& scale);
- void SetWorldTransform(const Vector3& position, const Quaternion& rotation);
- void SetWorldTransform(const Vector3& position, const Quaternion& rotation, float scale);
- void SetWorldTransform(const Vector3& position, const Quaternion& rotation, const Vector3& scale);
- void Translate(const Vector3& delta);
- void TranslateRelative(const Vector3& delta);
-
- void Rotate(const Quaternion& delta, bool fixedAxis = false);
- void Pitch(float angle, bool fixedAxis = false);
- void Yaw(float angle, bool fixedAxis = false);
- void Roll(float angle, bool fixedAxis = false);
- void LookAt(const Vector3& target, const Vector3& upAxis = Vector3::UP);
-
- void Scale(float scale);
- void Scale(const Vector3& scale);
- void SetEnabled(bool enable);
- void SetEnabled(bool enable, bool recursive);
- void SetOwner(Connection* owner);
- void MarkDirty();
-
- Node* CreateChild(const String& name = String::EMPTY, CreateMode mode = REPLICATED, unsigned id = 0);
-
- void AddChild(Node* node);
- void RemoveChild(Node* node);
- void RemoveAllChildren();
- void RemoveComponent(Component* component);
- void RemoveComponent(ShortStringHash type);
- void RemoveComponent(const char* type);
-
- void RemoveAllComponents();
-
- Node* Clone(CreateMode mode = REPLICATED);
-
- void Remove();
- void SetParent(Node* parent);
- void SetVar(ShortStringHash key, const Variant& value);
- void AddListener(Component* component);
- void RemoveListener(Component* component);
-
- // template <class T> T* CreateComponent(CreateMode mode = REPLICATED, unsigned id = 0);
- AnimationController* CreateComponent<AnimationController> @ CreateAnimationController(CreateMode mode = REPLICATED, unsigned id = 0);
- AnimatedModel* CreateComponent<AnimatedModel> @ CreateAnimatedModel(CreateMode mode = REPLICATED, unsigned id = 0);
- Camera* CreateComponent<Camera> @ CreateCamera(CreateMode mode = REPLICATED, unsigned id = 0);
- CollisionShape* CreateComponent<CollisionShape> @ CreateCollisionShape(CreateMode mode = REPLICATED, unsigned id = 0);
- Constraint* CreateComponent<Constraint> @ CreateConstraint(CreateMode mode = REPLICATED, unsigned id = 0);
- DebugRenderer* CreateComponent<DebugRenderer> @ CreateDebugRenderer(CreateMode mode = REPLICATED, unsigned id = 0);
- DecalSet* CreateComponent<DecalSet> @ CreateDecalSet(CreateMode mode = REPLICATED, unsigned id = 0);
- Drawable* CreateComponent<Drawable> @ CreateDrawable(CreateMode mode = REPLICATED, unsigned id = 0);
- Light* CreateComponent<Light> @ CreateLight(CreateMode mode = REPLICATED, unsigned id = 0);
- Navigable* CreateComponent<Navigable> @ CreateNavigable(CreateMode mode = REPLICATED, unsigned id = 0);
- NavigationMesh* CreateComponent<NavigationMesh> @ CreateNavigationMesh(CreateMode mode = REPLICATED, unsigned id = 0);
- NetworkPriority* CreateComponent<NetworkPriority> @ CreateNetworkPriority(CreateMode mode = REPLICATED, unsigned id = 0);
- Octree* CreateComponent<Octree> @ CreateOctree(CreateMode mode = REPLICATED, unsigned id = 0);
- OffMeshConnection* CreateComponent<OffMeshConnection> @ CreateOffMeshConnection(CreateMode mode = REPLICATED, unsigned id = 0);
- PhysicsWorld* CreateComponent<PhysicsWorld> @ CreatePhysicsWorld(CreateMode mode = REPLICATED, unsigned id = 0);
- RigidBody* CreateComponent<RigidBody> @ CreateRigidBody(CreateMode mode = REPLICATED, unsigned id = 0);
- SmoothedTransform* CreateComponent<SmoothedTransform> @ CreateSmoothedTransform(CreateMode mode = REPLICATED, unsigned id = 0);
- SoundListener* CreateComponent<SoundListener> @ CreateSoundListener(CreateMode mode = REPLICATED, unsigned id = 0);
- SoundSource* CreateComponent<SoundSource> @ CreateSoundSource(CreateMode mode = REPLICATED, unsigned id = 0);
- StaticModel* CreateComponent<StaticModel> @ CreateStaticModel(CreateMode mode = REPLICATED, unsigned id = 0);
- Terrain* CreateComponent<Terrain> @ CreateTerrain(CreateMode mode = REPLICATED, unsigned id = 0);
- Zone* CreateComponent<Zone> @ CreateZone(CreateMode mode = REPLICATED, unsigned id = 0);
- unsigned GetID() const;
- const String& GetName() const;
- StringHash GetNameHash() const;
- Node* GetParent() const;
- Scene* GetScene() const;
- bool IsEnabled() const;
- Connection* GetOwner() const;
- const Vector3& GetPosition() const;
- const Quaternion& GetRotation() const;
- Vector3 GetDirection() const;
- const Vector3& GetScale() const;
- Matrix3x4 GetTransform() const;
- Vector3 GetWorldPosition() const;
- Quaternion GetWorldRotation() const;
- Vector3 GetWorldDirection() const;
- Vector3 GetWorldScale() const;
- const Matrix3x4& GetWorldTransform() const;
- Vector3 LocalToWorld(const Vector3& position) const;
- Vector3 LocalToWorld(const Vector4& vector) const;
- Vector3 WorldToLocal(const Vector3& position) const;
- Vector3 WorldToLocal(const Vector4& vector) const;
- bool IsDirty() const;
-
- unsigned GetNumChildren(bool recursive = false) const;
- Node* GetChild(unsigned index) const;
- Node* GetChild(const String& name, bool recursive = false) const;
- Node* GetChild(const char* name, bool recursive = false) const;
- Node* GetChild(StringHash nameHash, bool recursive = false) const;
-
- unsigned GetNumComponents() const;
- unsigned GetNumNetworkComponents() const;
-
- bool HasComponent(ShortStringHash type) const;
- bool HasComponent(const char* type) const;
-
- const Variant& GetVar(ShortStringHash key) const;
- const VariantMap& GetVars() const;
- // template <class T> T* GetComponent() const;
- AnimationController* GetComponent<AnimationController> @ GetAnimationController() const;
- AnimatedModel* GetComponent<AnimatedModel> @ GetAnimatedModel() const;
- Camera* GetComponent<Camera> @ GetCamera() const;
- CollisionShape* GetComponent<CollisionShape> @ GetCollisionShape() const;
- Constraint* GetComponent<Constraint> @ GetConstraint() const;
- DebugRenderer* GetComponent<DebugRenderer> @ GetDebugRenderer() const;
- DecalSet* GetComponent<DecalSet> @ GetDecalSet() const;
- Drawable* GetComponent<Drawable> @ GetDrawable() const;
- Light* GetComponent<Light> @ GetLight() const;
- Navigable* GetComponent<Navigable> @ GetNavigable() const;
- NavigationMesh* GetComponent<NavigationMesh> @ GetNavigationMesh() const;
- NetworkPriority* GetComponent<NetworkPriority> @ GetNetworkPriority() const;
- Octree* GetComponent<Octree> @ GetOctree() const;
- OffMeshConnection* GetComponent<OffMeshConnection> @ GetOffMeshConnection() const;
- PhysicsWorld* GetComponent<PhysicsWorld> @ GetPhysicsWorld() const;
- RigidBody* GetComponent<RigidBody> @ GetRigidBody() const;
- SmoothedTransform* GetComponent<SmoothedTransform> @ GetSmoothedTransform() const;
- SoundListener* GetComponent<SoundListener> @ GetSoundListener() const;
- SoundSource* GetComponent<SoundSource> @ GetSoundSource() const;
- StaticModel* GetComponent<StaticModel> @ GetStaticModel() const;
- Terrain* GetComponent<Terrain> @ GetTerrain() const;
- Zone* GetComponent<Zone> @ GetZone() const;
-
- void SetID(unsigned id);
- void SetScene(Scene* scene);
- void ResetScene();
-
- bool Load(Deserializer& source, SceneResolver& resolver, bool loadChildren = true, bool rewriteIDs = false, CreateMode mode = REPLICATED);
- bool LoadXML(const XMLElement& source, SceneResolver& resolver, bool loadChildren = true, bool rewriteIDs = false, CreateMode mode = REPLICATED);
- Node* CreateChild(unsigned id, CreateMode mode);
- void AddComponent(Component* component, unsigned id, CreateMode mode);
-
- tolua_property__get_set unsigned ID;
- tolua_property__get_set String& name;
- tolua_readonly tolua_property__get_set StringHash nameHash;
- tolua_property__get_set Node* parent;
- tolua_property__get_set Scene* scene;
- tolua_property__is_set bool enabled;
- tolua_property__get_set Connection* owner;
- tolua_property__get_set Vector3& position;
- tolua_property__get_set Quaternion& rotation;
- tolua_property__get_set Vector3 direction;
- tolua_property__get_set Vector3& scale;
- tolua_readonly tolua_property__get_set Matrix3x4 transform;
- tolua_property__get_set Vector3 worldPosition;
- tolua_property__get_set Quaternion worldRotation;
- tolua_property__get_set Vector3 worldDirection;
- tolua_property__get_set Vector3 worldScale;
- tolua_readonly tolua_property__get_set Matrix3x4& worldTransform;
- tolua_readonly tolua_property__is_set bool dirty;
- tolua_readonly tolua_property__get_set unsigned numComponents;
- tolua_readonly tolua_property__get_set unsigned numNetworkComponents;
- };
|