3rd Eye Scene C#
3rd Eye Scene C# documentation
Tes::Handlers::MeshCache Class Reference

Implements handling of RoutingID.Mesh messages, maintaining the appropriate mesh objects. More...

Inheritance diagram for Tes::Handlers::MeshCache:
Tes::Runtime::MessageHandler

List of all members.

Classes

class  MeshDetails
 Mesh details. More...
class  MeshSerialiser
 Wraps a MeshDetails object to expose it as a MeshResource for the purposes of serialisation.

Public Member Functions

delegate void MeshNotificationDelegate (MeshDetails mesh)
 Delegate for various mesh events.
 MeshCache ()
 Constructor.
override void Initialise (GameObject root, GameObject serverRoot, MaterialLibrary materials)
 Initialise, caching the required materials from materials .
override void Reset ()
 Reset the cache.
MeshDetails GetEntry (uint meshId)
 Query details of mesh resource using meshId .
override Error ReadMessage (PacketBuffer packet, BinaryReader reader)
 Message handler.
override Error Serialise (BinaryWriter writer, ref SerialiseInfo info)
 Serialise messages required to restore the current state.
override void OnCategoryChange (ushort categoryId, bool active)
 Empty.

Static Public Member Functions

static MeshTopology DrawTypeToTopology (MeshDrawType drawType)
 Converts drawType to the equivalent Unity Topology.
static int TopologyIndexStep (MeshTopology topology)
 Query the number of indices per element for topology .

Public Attributes

const int IndexCountLimit = 65000
 Limit on the number of indices per Mesh part.

Protected Member Functions

Error Serialise (MeshDetails mesh, PacketBuffer packet, BinaryWriter writer)
 Serialise messages to generate mesh .
void WriteMeshComponent (uint meshID, MeshMessageType type, Vector3[] data, PacketBuffer packet, BinaryWriter writer, uint blockSize)
 Write a MeshComponentMessage to serialise Vector3 data.
Error DestroyMesh (PacketBuffer packet, BinaryReader reader)
 Handles MeshDestroyMessage
Error CreateMesh (PacketBuffer packet, BinaryReader reader)
 Handles MeshCreateMessage
Error AddVertices (PacketBuffer packet, BinaryReader reader)
 Handles MeshComponentMessage of type MeshMessageType.Vertex.
Error AddVertexColours (PacketBuffer packet, BinaryReader reader)
 Handles MeshComponentMessage of type MeshMessageType.VertexColour.
Error AddIndices (PacketBuffer packet, BinaryReader reader)
 Handles MeshComponentMessage of type MeshMessageType.Index.
Error AddNormals (PacketBuffer packet, BinaryReader reader)
 Handles MeshComponentMessage of type MeshMessageType.Normal.
Error AddUVs (PacketBuffer packet, BinaryReader reader)
 Handles MeshComponentMessage of type MeshMessageType.UV.
Error RedefineMesh (PacketBuffer packet, BinaryReader reader)
 Handles MeshRedefineMessage
Error FinaliseMesh (PacketBuffer packet, BinaryReader reader)
 Handles MeshFinaliseMessage.
void NotifyMeshAdded (MeshDetails meshDetails)
 Invoke OnMeshAdded
void NotifyMeshRemoved (MeshDetails meshDetails)
 Invoke OnMeshRemoved
void NotifyMeshFinalised (MeshDetails meshDetails)
 Invoke OnMeshFinalised

Properties

override string Name [get]
 Handler name.
override ushort RoutingID [get]
 Net.RoutingID.Mesh
Material LitMaterial [get, set]
 Material for rendering lit polygons.
Material UnlitMaterial [get, set]
 Material for rendering unlit polygons.
Material PointsLitMaterial [get, set]
 Material for rendering lit points.
Material PointsUnlitMaterial [get, set]
 Material for rendering unlit points.
Material VoxelsMaterial [get, set]
 Material for rendering geometry shader based voxels.

Events

MeshNotificationDelegate OnMeshAdded
 Invoked on a new mesh resource being added.
MeshNotificationDelegate OnMeshRemoved
 Invoked on a new mesh being removed/destroyed.
MeshNotificationDelegate OnMeshFinalised
 Invoked on first finalisation or re-finalisation of a mesh.

Detailed Description

Implements handling of RoutingID.Mesh messages, maintaining the appropriate mesh objects.

Handles the messages specified in MeshMessageType


Member Function Documentation

Error Tes::Handlers::MeshCache::AddIndices ( PacketBuffer  packet,
BinaryReader  reader 
) [inline, protected]

Handles MeshComponentMessage of type MeshMessageType.Index.

Parameters:
packet
reader
Returns:
Error Tes::Handlers::MeshCache::AddNormals ( PacketBuffer  packet,
BinaryReader  reader 
) [inline, protected]

Handles MeshComponentMessage of type MeshMessageType.Normal.

Parameters:
packet
reader
Returns:
Error Tes::Handlers::MeshCache::AddUVs ( PacketBuffer  packet,
BinaryReader  reader 
) [inline, protected]

Handles MeshComponentMessage of type MeshMessageType.UV.

Parameters:
packet
reader
Returns:
Error Tes::Handlers::MeshCache::AddVertexColours ( PacketBuffer  packet,
BinaryReader  reader 
) [inline, protected]

Handles MeshComponentMessage of type MeshMessageType.VertexColour.

Parameters:
packet
reader
Returns:
Error Tes::Handlers::MeshCache::AddVertices ( PacketBuffer  packet,
BinaryReader  reader 
) [inline, protected]

Handles MeshComponentMessage of type MeshMessageType.Vertex.

Parameters:
packet
reader
Returns:
Error Tes::Handlers::MeshCache::CreateMesh ( PacketBuffer  packet,
BinaryReader  reader 
) [inline, protected]

Handles MeshCreateMessage

Parameters:
packet
reader
Returns:

Emits OnMeshAdded.

Error Tes::Handlers::MeshCache::DestroyMesh ( PacketBuffer  packet,
BinaryReader  reader 
) [inline, protected]

Handles MeshDestroyMessage

Parameters:
packet
reader
Returns:

Emits OnMeshRemoved.

static MeshTopology Tes::Handlers::MeshCache::DrawTypeToTopology ( MeshDrawType  drawType) [inline, static]

Converts drawType to the equivalent Unity Topology.

Parameters:
drawTypeThe Tes topology.
Returns:
The equivalent Unity Topology
Exceptions:
NotImplementedExceptionThrown when drawType is not supported by the Unity implementation.
Error Tes::Handlers::MeshCache::FinaliseMesh ( PacketBuffer  packet,
BinaryReader  reader 
) [inline, protected]

Handles MeshFinaliseMessage.

Parameters:
packet
reader
Returns:

This creates the required Unity Mesh objects and emits OnMeshFinalised.

MeshDetails Tes::Handlers::MeshCache::GetEntry ( uint  meshId) [inline]

Query details of mesh resource using meshId .

Parameters:
meshIdID of the resource of interest.
Returns:
The mesh details, or null when meshId is unknown.
override void Tes::Handlers::MeshCache::Initialise ( GameObject  root,
GameObject  serverRoot,
MaterialLibrary  materials 
) [inline, virtual]

Initialise, caching the required materials from materials .

Parameters:
root
serverRoot
materials

Reimplemented from Tes::Runtime::MessageHandler.

delegate void Tes::Handlers::MeshCache::MeshNotificationDelegate ( MeshDetails  mesh)

Delegate for various mesh events.

Parameters:
meshThe mesh changing state.
void Tes::Handlers::MeshCache::NotifyMeshAdded ( MeshDetails  meshDetails) [inline, protected]

Invoke OnMeshAdded

Parameters:
meshDetails
void Tes::Handlers::MeshCache::NotifyMeshFinalised ( MeshDetails  meshDetails) [inline, protected]

Invoke OnMeshFinalised

Parameters:
meshDetails
void Tes::Handlers::MeshCache::NotifyMeshRemoved ( MeshDetails  meshDetails) [inline, protected]

Invoke OnMeshRemoved

Parameters:
meshDetails
override void Tes::Handlers::MeshCache::OnCategoryChange ( ushort  categoryId,
bool  active 
) [inline, virtual]

Empty.

Parameters:
categoryId
active

Implements Tes::Runtime::MessageHandler.

override Error Tes::Handlers::MeshCache::ReadMessage ( PacketBuffer  packet,
BinaryReader  reader 
) [inline, virtual]

Message handler.

Parameters:
packet
reader
Returns:

Handles messages IDs from MeshMessageType

Implements Tes::Runtime::MessageHandler.

Error Tes::Handlers::MeshCache::RedefineMesh ( PacketBuffer  packet,
BinaryReader  reader 
) [inline, protected]

Handles MeshRedefineMessage

Parameters:
packet
reader
Returns:

The associated mesh is invalidated until another MeshFinaliseMessage arrives.

override void Tes::Handlers::MeshCache::Reset ( ) [inline, virtual]

Reset the cache.

Does not invoke OnMeshRemoved events.

Reimplemented from Tes::Runtime::MessageHandler.

Error Tes::Handlers::MeshCache::Serialise ( MeshDetails  mesh,
PacketBuffer  packet,
BinaryWriter  writer 
) [inline, protected]

Serialise messages to generate mesh .

Parameters:
meshThe mesh of interest.
packetPacket buffer to compose messages in
writerWriter to export completed message packets to.
Returns:

Writes:

  • MeshCreateMessage
  • MeshComponentMessage for each component type from MeshMessageType
  • MeshFinaliseMessage only when mesh is already finalised.
override Error Tes::Handlers::MeshCache::Serialise ( BinaryWriter  writer,
ref SerialiseInfo  info 
) [inline, virtual]

Serialise messages required to restore the current state.

Parameters:
writer
infoStatistics
Returns:
An error code on failure.

Implements Tes::Runtime::MessageHandler.

static int Tes::Handlers::MeshCache::TopologyIndexStep ( MeshTopology  topology) [inline, static]

Query the number of indices per element for topology .

Parameters:
topologyThe mesh topology
Returns:
The number of indices per primitive.
TypeIndex Count
MeshTopology.Points1
MeshTopology.LineStrip1 (not supported).
MeshTopology.Lines2
MeshTopology.Triangles3
MeshTopology.Quads4
Else1
void Tes::Handlers::MeshCache::WriteMeshComponent ( uint  meshID,
MeshMessageType  type,
Vector3[]  data,
PacketBuffer  packet,
BinaryWriter  writer,
uint  blockSize 
) [inline, protected]

Write a MeshComponentMessage to serialise Vector3 data.

Parameters:
meshIDMesh resource ID we are serialising for.
typeThe mesh component type; e.g., MeshMessageType.Vertex.
dataThe Vector3 data array.
packetPacket buffer to compose messages in
writerWriter to export completed message packets to.
blockSizeThe maximum number of elements per message.

Writes multiple messages to writer as required to ensure all data are written.


Property Documentation

override ushort Tes::Handlers::MeshCache::RoutingID [get]

Net.RoutingID.Mesh

Reimplemented from Tes::Runtime::MessageHandler.

Material Tes::Handlers::MeshCache::VoxelsMaterial [get, set]

Material for rendering geometry shader based voxels.

Vertices mark the centre, normals the half extents.


Event Documentation

MeshNotificationDelegate Tes::Handlers::MeshCache::OnMeshAdded

Invoked on a new mesh resource being added.

The mesh is not finalised.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Enumerations Properties Events