Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        Application.runInBackground = true;
#if UNITY_EDITOR
        //SceneView.FocusWindowIfItsOpen( typeof( SceneView ) );
#endif
        model     = new ParticleModel(this);
        meshModel = new TriangularModelMesh(model, this);
        simpleVis = new ParticleVisualisation(model, this);
        gInst     = this;
    }
Exemplo n.º 2
0
        private static Mesh MeshFromData(TriangularMesh v)
        {
            if (v?.Points == null || v.Points.Length == 0)
            {
                return(null);
            }
            var mesh = new Mesh();

            var vertices = new List <Vector3>();

            for (var i = 0; i < v.Points.Length; i += 3)
            {
                vertices.Add(new Vector3((float)v.Points[i], (float)v.Points[i + 1], (float)v.Points[i + 2]));
            }
            mesh.vertices  = vertices.ToArray();
            mesh.triangles = v.Indices;

            mesh.RecalculateNormals();
            mesh.RecalculateBounds();
            return(mesh);
        }