Classes¶
Network/Components
Brief descriptions¶
Structures |
|
Provides an interface for serializing and deserializing a scene object component. |
|
Provides an interface for scene and scene objects components tracking. |
|
Classes |
|
Provides common funtionality for IComponentNetSync derived components. |
|
Detailed information¶
IComponentNetSync¶
engine/core/modules/network/include/nau/network/components/net_component_api.h
-
struct IComponentNetSync¶
Provides an interface for serializing and deserializing a scene object component.
Subclassed by nau::NetSyncBaseComponent
Public Functions
-
virtual eastl::string_view getSceneName() = 0¶
Retrieves the scene name.
- Returns:
Scene name.
-
virtual eastl::string_view getComponentPath() = 0¶
Retrieves the absolute path to to the parent object in the scene.
- Returns:
Absolute path to to the parent object.
-
virtual void setIsReplicated(bool isReplicated) = 0¶
Changes whether the component is owned or replicated.
- Parameters:
isReplicated – [in] Indicates whether the component should be owned or replicated.
-
virtual bool isReplicated() const = 0¶
Checks whether the component is owned or replicated.
- Returns:
true
if the component is owned by the local peer,false
otherwise (i.e. if it is updated from the remote peer).
-
virtual void netWrite(BytesBuffer &buffer) = 0¶
Serializes the component into a binary buffer.
- Parameters:
buffer – [out] Buffer storing the serialized data.
-
virtual void netRead(const BytesBuffer &buffer) = 0¶
Deserializes the binary buffer into the scene component.
- Parameters:
buffer – [in] Buffer with serialized data.
-
virtual void netWrite(eastl::string &buffer) = 0¶
Serializes the component into a JSON text buffer.
- Parameters:
buffer – [out] Buffer storing the serialized data.
-
virtual void netRead(const eastl::string &buffer) = 0¶
Deserializes the JSON text buffer into the scene component.
- Parameters:
buffer – [in] Buffer with serialized data.
-
virtual eastl::string_view getSceneName() = 0¶
IComponentNetScene¶
engine/core/modules/network/include/nau/network/components/net_component_api.h
-
struct IComponentNetScene¶
Provides an interface for scene and scene objects components tracking.
Subclassed by nau::NetSceneComponent
Public Functions
-
virtual eastl::string_view getPeerId() = 0¶
Retrieves the peer ID.
- Returns:
Peer ID.
-
virtual eastl::string_view getSceneName() = 0¶
Retrieves the scene name.
- Returns:
Scene name.
-
virtual IComponentNetSync *getOrCreateComponent(eastl::string_view path, eastl::string_view type) = 0¶
Retrieves the network component, possibly creating it.
- Returns:
Pointer to the IComponentNetSync instance which is valid until scene deactivation.
-
virtual eastl::string_view getPeerId() = 0¶
NetSceneComponent¶
engine/core/modules/network/include/nau/network/components/net_scene_component.h
-
class NetSceneComponent : public nau::scene::Component, public nau::scene::IComponentEvents, public nau::scene::IComponentUpdate, public nau::IComponentNetScene¶
Track scene activation/deactivation and manages IComponentNetSync derived components.
Public Functions
-
inline NetSceneComponent()¶
-
inline ~NetSceneComponent()¶
-
inline void setSceneName(eastl::string_view name)¶
Scene name setter.
-
inline void setPeerId(eastl::string_view peerId)¶
Peer Id setter.
-
inline virtual eastl::string_view getPeerId() override¶
Peer Id getter.
-
inline virtual eastl::string_view getSceneName() override¶
Scene name getter.
-
inline virtual IComponentNetSync *getOrCreateComponent(eastl::string_view path, eastl::string_view type) override¶
Get existing or create new component by specific path and type.
- Parameters:
path – - full path to component
type – - RTTI TypeInfo for component
- Returns:
Pointer to IComponentNetSync, valid until scene deactivation
Private Functions
- Net Net Scene (description)")) ( 1(m_peerId
-
inline virtual void updateComponent(float dt)¶
Updates the component.
Warning
The update loop waits for all IComponentUpdate::updateComponent and IComponentAsyncUpdate::updateComponentAsync calls completion, until it can proceed to the next frame. Consequently, all lasting operations are to be avoided within these calls. Instead, address to IComponentAsyncListener::listenComponent.
- Parameters:
[int] – dt Elapsed time.
-
inline virtual void onComponentCreated() override¶
This function is called on component creation.
-
inline virtual void onComponentActivated() override¶
Register activated components in snapshots service.
-
inline scene::SceneObject *findObjectChild(scene::SceneObject *obj, const eastl::string_view childName)¶
Find child of specefied object by name.
- Returns:
Pointer to SceneObject, valid until scene was changes
-
inline scene::SceneObject *findObjectByPath(scene::SceneObject *root, const eastl::string_view path, const eastl::string_view delimiter)¶
Find child of specefied object by path.
- Returns:
Pointer to SceneObject, valid until scene was changes
-
inline NetSceneComponent()¶
NetSyncBaseComponent¶
engine/core/modules/network/include/nau/network/components/net_sync_base_component.h
-
class NetSyncBaseComponent : public nau::scene::Component, public nau::scene::IComponentEvents, public nau::scene::IComponentUpdate, public nau::IComponentNetSync¶
Provides common funtionality for IComponentNetSync derived components.
Subclassed by nau::NetSyncComponent, nau::NetSyncTransformComponent
Private Functions
- inline Net Sync Net Sync Base (description)")) protected
Changes whether the component is replicated from the remote peer or owned by the local peer.
Checks whether the component is replicated from the remote peer or owned by the local peer.
Noop, see IComponentNetSync::netWrite.
Noop, see IComponentNetSync::netRead.
Noop, see IComponentNetSync::netWrite.
Noop, see IComponentNetSync::netRead
- Parameters:
isReplicated – [in] Indicates whether the component is replicated from the remote peer or owned by the local peer.
buffer –
buffer –
buffer –
buffer – [in]
- Returns:
false
if the component is owned by the local peer,true
if it is replicated from the remote peer.
-
inline eastl::string getObjectPath(const eastl::string &delimiter)¶
Private Members
- true
- Net Sync Base
-
bool m_isReplicated = false¶
-
bool m_activated = false¶
-
INetSnapshots *m_snapshots = nullptr¶
-
IComponentNetScene *m_scene = nullptr¶
-
eastl::string m_path¶
NetSyncComponent¶
engine/core/modules/network/include/nau/network/components/net_sync_component.h
-
class NetSyncComponent : public nau::NetSyncBaseComponent¶
Provides an interface for IComponentNetSync instance serialization and deserialization.