Public Member Functions |
| Node (Context *context) |
| Construct.
|
virtual | ~Node () |
| Destruct. Any child nodes are detached.
|
virtual void | OnSetAttribute (const AttributeInfo &attr, const Variant &src) |
| Handle attribute write access.
|
virtual bool | Load (Deserializer &source) |
| Load from binary data. Return true if successful.
|
virtual bool | LoadXML (const XMLElement &source) |
| Load from XML data. Return true if successful.
|
virtual bool | Save (Serializer &dest) |
| Save as binary data. Return true if successful.
|
virtual bool | SaveXML (XMLElement &dest) |
| Save as XML data. Return true if successful.
|
virtual void | ApplyAttributes () |
| Apply attribute changes that can not be applied immediately recursively to child nodes and components.
|
virtual void | AddReplicationState (NodeReplicationState *state) |
| Add a replication state that is tracking this node.
|
bool | SaveXML (Serializer &dest) |
| Save to an XML file. Return true if successful.
|
void | SetName (const String &name) |
| Set name.
|
void | SetPosition (const Vector3 &position) |
| Set position relative to parent node.
|
void | SetRotation (const Quaternion &rotation) |
| Set rotation relative to parent node.
|
void | SetDirection (const Vector3 &direction) |
| Set direction relative to parent node. Positive Z equals identity.
|
void | SetScale (float scale) |
| Set uniform scale relative to parent node.
|
void | SetScale (const Vector3 &scale) |
| Set scale relative to parent node.
|
void | SetTransform (const Vector3 &position, const Quaternion &rotation) |
| Set transform relative to parent node.
|
void | SetTransform (const Vector3 &position, const Quaternion &rotation, float scale) |
| Set transform relative to parent node.
|
void | SetTransform (const Vector3 &position, const Quaternion &rotation, const Vector3 &scale) |
| Set transform relative to parent node.
|
void | SetWorldPosition (const Vector3 &position) |
| Set position relative to world space.
|
void | SetWorldRotation (const Quaternion &rotation) |
| Set rotation relative to world space.
|
void | SetWorldDirection (const Vector3 &direction) |
| Set direction relative to world space.
|
void | SetWorldScale (float scale) |
| Set uniform scale relative to world space.
|
void | SetWorldScale (const Vector3 &scale) |
| Set scale relative to world space.
|
void | SetWorldTransform (const Vector3 &position, const Quaternion &rotation) |
| Set transform relative to world space.
|
void | SetWorldTransform (const Vector3 &position, const Quaternion &rotation, float scale) |
| Set transform relative to world space.
|
void | SetWorldTransform (const Vector3 &position, const Quaternion &rotation, const Vector3 &scale) |
| Set transform relative to world space.
|
void | Translate (const Vector3 &delta) |
| Move the scene node.
|
void | TranslateRelative (const Vector3 &delta) |
| Move the scene node relative to its rotation.
|
void | Rotate (const Quaternion &delta, bool fixedAxis=false) |
| Rotate the scene node.
|
void | Pitch (float angle, bool fixedAxis=false) |
| Rotate around the X axis.
|
void | Yaw (float angle, bool fixedAxis=false) |
| Rotate around the Y axis.
|
void | Roll (float angle, bool fixedAxis=false) |
| Rotate around the Z axis.
|
void | LookAt (const Vector3 &target, const Vector3 &upAxis=Vector3::UP, bool worldSpace=false) |
| Look at a target position.
|
void | Scale (float scale) |
| Modify scale uniformly.
|
void | Scale (const Vector3 &scale) |
| Modify scale.
|
void | SetOwner (Connection *owner) |
| Set owner connection for networking.
|
void | MarkDirty () |
| Mark node and child nodes to need world transform recalculation. Notify listener components.
|
Node * | CreateChild (const String &name=String::EMPTY, CreateMode mode=REPLICATED) |
| Create a child scene node.
|
void | AddChild (Node *node) |
| Add a child scene node.
|
void | RemoveChild (Node *node) |
| Remove a child scene node.
|
void | RemoveAllChildren () |
| Remove all child scene nodes.
|
Component * | CreateComponent (ShortStringHash type, CreateMode mode=REPLICATED, unsigned id=0) |
| Create a component to this node (with specified ID if provided).
|
Component * | GetOrCreateComponent (ShortStringHash type, CreateMode mode=REPLICATED) |
| Create a component to this node if it does not exist already.
|
void | RemoveComponent (Component *component) |
| Remove a component from this node.
|
void | RemoveComponent (ShortStringHash type) |
| Remove the first component of specific type from this node.
|
void | RemoveAllComponents () |
| Remove all components from this node.
|
Node * | Clone (CreateMode mode=REPLICATED) |
| Clone scene node, components and child nodes. Return the clone.
|
void | Remove () |
| Remove from the parent node. If no other shared pointer references exist, causes immediate deletion.
|
void | SetParent (Node *parent) |
| Set parent scene node. Retains the world transform.
|
void | SetVar (ShortStringHash key, const Variant &value) |
| Set a user variable.
|
void | AddListener (Component *component) |
| Add listener component that is notified of node being dirtied. Can either be in the same node or another.
|
void | RemoveListener (Component *component) |
| Remove listener component.
|
template<class T > |
T * | CreateComponent (CreateMode mode=REPLICATED) |
| Template version of creating a component.
|
template<class T > |
T * | GetOrCreateComponent (CreateMode mode=REPLICATED) |
| Template version of getting or creating a component.
|
unsigned | GetID () const |
| Return ID.
|
const String & | GetName () const |
| Return name.
|
StringHash | GetNameHash () const |
| Return name hash.
|
Node * | GetParent () const |
| Return parent scene node.
|
Scene * | GetScene () const |
| Return scene.
|
Connection * | GetOwner () const |
| Return owner connection in networking.
|
const Vector3 & | GetPosition () const |
| Return position relative to parent node.
|
const Quaternion & | GetRotation () const |
| Return rotation relative to parent node.
|
Vector3 | GetDirection () const |
| Return direction relative to parent node. Identity rotation equals positive Z.
|
const Vector3 & | GetScale () const |
| Return scale relative to parent node.
|
Matrix3x4 | GetTransform () const |
| Return transform matrix relative to parent node.
|
Vector3 | GetWorldPosition () const |
| Return position in world space.
|
Quaternion | GetWorldRotation () const |
| Return rotation in world space.
|
Vector3 | GetWorldDirection () const |
| Return direction in world space.
|
Vector3 | GetWorldScale () const |
| Return scale in world space.
|
const Matrix3x4 & | GetWorldTransform () const |
| Return transform matrix in world space.
|
Vector3 | LocalToWorld (const Vector3 &position) const |
| Convert a local space position to world space.
|
Vector3 | LocalToWorld (const Vector4 &vector) const |
| Convert a local space position or rotation to world space.
|
Vector3 | WorldToLocal (const Vector3 &position) const |
| Convert a world space position to local space.
|
Vector3 | WorldToLocal (const Vector4 &vector) const |
| Convert a world space position or rotation to local space.
|
bool | IsDirty () const |
| Return whether transform has changed and world transform needs recalculation.
|
unsigned | GetNumChildren (bool recursive=false) const |
| Return number of child scene nodes.
|
const Vector< SharedPtr< Node > > & | GetChildren () const |
| Return immediate child scene nodes.
|
void | GetChildren (PODVector< Node * > &dest, bool recursive=false) const |
| Return child scene nodes, optionally recursive.
|
void | GetChildrenWithComponent (PODVector< Node * > &dest, ShortStringHash type, bool recursive=false) const |
| Return child scene nodes with a specific component.
|
Node * | GetChild (unsigned index) const |
| Return child scene node by index.
|
Node * | GetChild (const String &name, bool recursive=false) const |
| Return child scene node by name.
|
Node * | GetChild (StringHash nameHash, bool recursive=false) const |
| Return child scene node by name hash.
|
unsigned | GetNumComponents () const |
| Return number of components.
|
unsigned | GetNumNetworkComponents () const |
| Return number of non-local components.
|
const Vector< SharedPtr
< Component > > & | GetComponents () const |
| Return all components.
|
void | GetComponents (PODVector< Component * > &dest, ShortStringHash type) const |
| Return all components of type.
|
Component * | GetComponent (ShortStringHash type) const |
| Return component by type. If there are several, returns the first.
|
bool | HasComponent (ShortStringHash type) const |
| Return whether has a specific component.
|
const Vector< WeakPtr
< Component > > | GetListeners () const |
| Return listener components.
|
const Variant & | GetVar (ShortStringHash key) const |
| Return a user variable.
|
const VariantMap & | GetVars () const |
| Return all user variables.
|
template<class T > |
T * | GetDerivedComponent () const |
| Return first component derived from class.
|
template<class T > |
void | GetDerivedComponents (PODVector< T * > &dest) const |
| Return components derived from class.
|
template<class T > |
void | GetChildrenWithComponent (PODVector< Node * > &dest, bool recursive=false) const |
| Template version of returning child nodes with a specific component.
|
template<class T > |
T * | GetComponent () const |
| Template version of returning a component by type.
|
template<class T > |
void | GetComponents (PODVector< T * > &dest) const |
| Template version of returning all components of type.
|
template<class T > |
bool | HasComponent () const |
| Template version of checking whether has a specific component.
|
void | SetID (unsigned id) |
| Set ID. Called by Scene.
|
void | SetScene (Scene *scene) |
| Set scene. Called by Scene.
|
void | ResetScene () |
| Reset scene. Called by Scene.
|
void | SetNetPositionAttr (const Vector3 &value) |
| Set network position attribute.
|
void | SetNetRotationAttr (const PODVector< unsigned char > &value) |
| Set network rotation attribute.
|
void | SetNetParentAttr (const PODVector< unsigned char > &value) |
| Set network parent attribute.
|
const Vector3 & | GetNetPositionAttr () const |
| Return network position attribute.
|
const PODVector< unsigned char > & | GetNetRotationAttr () const |
| Return network rotation attribute.
|
const PODVector< unsigned char > & | GetNetParentAttr () const |
| Return network parent attribute.
|
bool | Load (Deserializer &source, SceneResolver &resolver, bool loadChildren=true, bool rewriteIDs=false, CreateMode mode=REPLICATED) |
| Load components and optionally load child nodes.
|
bool | LoadXML (const XMLElement &source, SceneResolver &resolver, bool loadChildren=true, bool rewriteIDs=false, CreateMode mode=REPLICATED) |
| Load components from XML data and optionally load child nodes.
|
const PODVector< Node * > & | GetDependencyNodes () const |
| Return the depended on nodes to order network updates.
|
void | PrepareNetworkUpdate () |
| Prepare network update by comparing attributes and marking replication states dirty as necessary.
|
void | CleanupConnection (Connection *connection) |
| Clean up all references to a network connection that is about to be removed.
|
void | MarkNetworkUpdate () |
| Mark for attribute check on the next network update.
|
void | MarkReplicationDirty () |
| Mark node dirty in scene replication states.
|
Node * | CreateChild (unsigned id, CreateMode mode) |
| Create a child node with specific ID.
|
void | AddComponent (Component *component, unsigned id, CreateMode mode) |
| Add a pre-created component.
|
| Serializable (Context *context) |
| Construct.
|
virtual | ~Serializable () |
| Destruct.
|
virtual void | OnGetAttribute (const AttributeInfo &attr, Variant &dest) |
| Handle attribute read access. Default implementation reads the variable at offset, or invokes the get accessor.
|
bool | SetAttribute (unsigned index, const Variant &value) |
| Set attribute by index. Return true if successfully set.
|
bool | SetAttribute (const String &name, const Variant &value) |
| Set attribute by name. Return true if successfully set.
|
void | AllocateNetworkState () |
| Allocate network attribute state.
|
void | WriteInitialDeltaUpdate (Serializer &dest) |
| Write initial delta network update.
|
void | WriteDeltaUpdate (Serializer &dest, const DirtyBits &attributeBits) |
| Write a delta network update according to dirty attribute bits.
|
void | WriteLatestDataUpdate (Serializer &dest) |
| Write a latest data network update.
|
void | ReadDeltaUpdate (Deserializer &source) |
| Read and apply a network delta update.
|
void | ReadLatestDataUpdate (Deserializer &source) |
| Read and apply a network latest data update.
|
Variant | GetAttribute (unsigned index) |
| Return attribute value by index. Return empty if illegal index.
|
Variant | GetAttribute (const String &name) |
| Return attribute value by name. Return empty if not found.
|
unsigned | GetNumAttributes () const |
| Return number of attributes.
|
unsigned | GetNumNetworkAttributes () const |
| Return number of network replication attributes.
|
const Vector< AttributeInfo > * | GetAttributes () const |
| Return attribute descriptions, or null if none defined.
|
const Vector< AttributeInfo > * | GetNetworkAttributes () const |
| Return network replication attribute descriptions, or null if none defined.
|
| Object (Context *context) |
| Construct.
|
virtual | ~Object () |
| Destruct. Clean up self from event sender & receiver structures.
|
virtual ShortStringHash | GetType () const =0 |
| Return type hash.
|
virtual const String & | GetTypeName () const =0 |
| Return type name.
|
virtual void | OnEvent (Object *sender, StringHash eventType, VariantMap &eventData) |
| Handle event.
|
void | SubscribeToEvent (StringHash eventType, EventHandler *handler) |
| Subscribe to an event that can be sent by any sender.
|
void | SubscribeToEvent (Object *sender, StringHash eventType, EventHandler *handler) |
| Subscribe to a specific sender's event.
|
void | UnsubscribeFromEvent (StringHash eventType) |
| Unsubscribe from an event.
|
void | UnsubscribeFromEvent (Object *sender, StringHash eventType) |
| Unsubscribe from a specific sender's event.
|
void | UnsubscribeFromEvents (Object *sender) |
| Unsubscribe from a specific sender's events.
|
void | UnsubscribeFromAllEvents () |
| Unsubscribe from all events.
|
void | UnsubscribeFromAllEventsExcept (const PODVector< StringHash > &exceptions, bool onlyUserData) |
| Unsubscribe from all events except those listed, and optionally only those with userdata (script registered events.)
|
void | SendEvent (StringHash eventType) |
| Send event to all subscribers.
|
void | SendEvent (StringHash eventType, VariantMap &eventData) |
| Send event with parameters to all subscribers.
|
Context * | GetContext () const |
| Return execution context.
|
Object * | GetSubsystem (ShortStringHash type) const |
| Return subsystem by type.
|
Object * | GetEventSender () const |
| Return active event sender. Null outside event handling.
|
EventHandler * | GetEventHandler () const |
| Return active event handler. Null outside event handling.
|
bool | HasSubscribedToEvent (StringHash eventType) const |
| Return whether has subscribed to an event without specific sender.
|
bool | HasSubscribedToEvent (Object *sender, StringHash eventType) const |
| Return whether has subscribed to a specific sender's event.
|
template<class T > |
T * | GetSubsystem () const |
| Template version of returning a subsystem.
|
| RefCounted () |
| Construct. Allocate the reference count structure and set an initial self weak reference.
|
virtual | ~RefCounted () |
| Destruct. Mark as expired and also delete the reference count structure if no outside weak references exist.
|
void | AddRef () |
| Increment reference count. Can also be called outside of a SharedPtr for traditional reference counting.
|
void | ReleaseRef () |
| Decrement reference count and delete self if no more references. Can also be called outside of a SharedPtr for traditional reference counting.
|
int | Refs () const |
| Return reference count.
|
int | WeakRefs () const |
| Return weak reference count.
|
RefCount * | RefCountPtr () |
| Return pointer to the reference count structure.
|