Exemplo n.º 1
0
    /// <summary>
    /// Updates a Mesh and overwrites its informations
    /// </summary>
    public void UpdateMesh(BroadCastMesh broadcast)
    {
        GameObject go     = GeometryStorage.Instance.GetGeometry(broadcast.meshNr, GeometryStorage.GeoType.Mesh);
        MeshFilter filter = go.GetComponent <MeshFilter>();

        Mesh mesh = filter.mesh;

        mesh.Clear();
        mesh.SetVertices(GeoUtils.GetVector3List(broadcast.vertices));
        mesh.SetTriangles(broadcast.triangles, 0);
        mesh.SetNormals(GeoUtils.GetVector3List(broadcast.normals));

        Color c        = GeoUtils.GetUColor(broadcast.color);
        var   renderer = go.GetComponent <Renderer>();

        renderer.GetPropertyBlock(propBlock);
        propBlock.SetColor("_Color", c);
        renderer.SetPropertyBlock(propBlock);
    }
Exemplo n.º 2
0
 /// <summary>
 /// UpdateMesh is overwritten from its derived class: GeoClient,
 /// everytime geometry data is send, it is stacked in a special "list",
 /// which is later processed in the unity update circle
 /// </summary>
 /// <param name="data">The network class for Meshes</param>
 protected override void UpdateMesh(BroadCastMesh data)
 {
     lock (geometryChanged)
         geometryChanged.Enqueue(data);
 }