3rd Eye Scene C#
3rd Eye Scene C# documentation
|
Defines the interface for a TES connection. More...
Public Member Functions | |
void | Close () |
Closes the connection. | |
int | UpdateFrame (float dt, bool flush=true) |
Sends a message marking the end of the current frame (and start of a new frame). | |
int | Create (Shape shape) |
Sends a create message for shape . | |
int | Destroy (Shape shape) |
Sends a destroy message for shape . | |
int | Update (Shape shape) |
Sends an update message for shape . | |
bool | SendServerInfo (ServerInfoMessage info) |
Sends the ServerInfoMessage structure to the connected client. | |
int | Send (byte[] data, int offset, int length) |
Sends data on the client connection. | |
uint | GetReferenceCount (Resource resource) |
Queries the reference count of the given resource. | |
uint | AddResource (Resource resource) |
Add a shared resource to the connection. | |
uint | RemoveResource (Resource resource) |
Removes a shared resource. | |
Properties | |
string | Address [get] |
The connection end point address. | |
int | Port [get] |
The connection port. | |
bool | Connected [get] |
Reflects the connected state. |
Defines the interface for a TES connection.
uint Tes::Net::IConnection::AddResource | ( | Resource | resource | ) |
Add a shared resource to the connection.
resource | The resource object to add. Increments the reference count if already present. |
Shape objects may have shared resources which must persist so long as any shape is referring to them. A prime example is MeshSet instances, each of which has at least one MeshResource. These parts may be referenced and shared by multiple MeshSet objects and are considered shared resources. Each part must persist so long as at least one shape is referencing it.
The concept is generalised to the Resource interface. Each call to AddResource(Resource) increases the reference counting of that resource and enables creation messages for that resource. Each call to RemoveResource(Resource) reduces the reference count. A destruction message is sent when a resource reaches a zero reference count.
Adding a shared resource adds it to the resource transfer queue. Data transfer may be amortised over the next series of updates and combined with the transfer of other shared resources.
Note: in order to differentiate shared resources, it is critical that each resource has an unique ID. This ID is used to identify the resource, not the object reference.
Implemented in Tes::IO::CollatedPacketEncoder, Tes::Server::TcpConnection, and Tes::Util::CollatedPacketEncoder.
int Tes::Net::IConnection::Create | ( | Shape | shape | ) |
Sends a create message for shape .
shape | The shape to create. |
Implemented in Tes::IO::CollatedPacketEncoder, Tes::Server::TcpConnection, and Tes::Util::CollatedPacketEncoder.
int Tes::Net::IConnection::Destroy | ( | Shape | shape | ) |
Sends a destroy message for shape .
shape | The shape to destroy. |
Implemented in Tes::IO::CollatedPacketEncoder, Tes::Server::TcpConnection, and Tes::Util::CollatedPacketEncoder.
uint Tes::Net::IConnection::GetReferenceCount | ( | Resource | resource | ) |
Queries the reference count of the given resource.
resource |
Implemented in Tes::IO::CollatedPacketEncoder, Tes::Server::TcpConnection, and Tes::Util::CollatedPacketEncoder.
uint Tes::Net::IConnection::RemoveResource | ( | Resource | resource | ) |
Removes a shared resource.
resource |
The resource has its reference count decremented and is removed from the transfer queue. The destruction message is send to complete the removal, though there may be a delay before sending this message.
Implemented in Tes::IO::CollatedPacketEncoder, Tes::Server::TcpConnection, and Tes::Util::CollatedPacketEncoder.
int Tes::Net::IConnection::Send | ( | byte[] | data, |
int | offset, | ||
int | length | ||
) |
Sends data on the client connection.
data | The data buffer to send. |
offset | An offset into data at which to start sending. |
length | The number of bytes to transfer. |
Implemented in Tes::IO::CollatedPacketEncoder, Tes::Server::TcpConnection, and Tes::Util::CollatedPacketEncoder.
bool Tes::Net::IConnection::SendServerInfo | ( | ServerInfoMessage | info | ) |
Sends the ServerInfoMessage structure to the connected client.
info | The info message to send. |
Implemented in Tes::IO::CollatedPacketEncoder, Tes::Server::TcpConnection, and Tes::Util::CollatedPacketEncoder.
int Tes::Net::IConnection::Update | ( | Shape | shape | ) |
Sends an update message for shape .
shape | The shape to update. |
Implemented in Tes::IO::CollatedPacketEncoder, Tes::Server::TcpConnection, and Tes::Util::CollatedPacketEncoder.
int Tes::Net::IConnection::UpdateFrame | ( | float | dt, |
bool | flush = true |
||
) |
Sends a message marking the end of the current frame (and start of a new frame).
dt | Indicates the time passed since over this frame (seconds). |
flush | True to allow clients to flush transient options, false to clients preserver such objects. |
Implemented in Tes::IO::CollatedPacketEncoder, Tes::Server::TcpConnection, and Tes::Util::CollatedPacketEncoder.