コード例 #1
0
    // Use this for initialization
    void Start()
    {
//		meshX = new MeshXT2(1, MeshXT2.generators.MT19937,
//		                    MeshXT2.distributions.Bernoili,
//		                    new Dictionary<string, double>(){{"alpha",1.0}});
        //chi, ALF
//		meshX = new MeshXT2(1, gen, dist,
//		                    new Dictionary<string, double>(){{"alpha",5},{"beta", 0.1},{"gamma", 0.2}});
        meshX = new MeshXT2(1, gen, dist,
                            new Dictionary <string, double>()
        {
            { "alpha", alpha }, { "beta", beta }
            , { "gamma", gamma }, { "mu", mu }, { "theta", theta }, { "lambda", lambda }, { "nu", nu },
            { "sigma", sigma }
        });
        meshX.mesh = mesh;
        if (mesh == null)
        {
            Debug.Log("mesh input is null");
        }
#if UNITY_EDITOR
        Debug.Log("editor directive works starting commit");
#endif
        timer.Start();
        //meshX.useTexture = false;
        meshX.CommitToTempFinished += step0;
        meshX.CommitToTemp();
    }
コード例 #2
0
    /// <summary>
    /// returns a Deep copy of the current MeshXT2
    /// mesh, generators and distribution are not set
    /// mesh copying could be done but would make this
    /// much slower as that would have to be done on the main thread
    /// </summary>
    /// <returns>The copy.</returns>
    public MeshXT2 DeepCopy()
    {
        var temp = new MeshXT2();

        temp.vertices = new Vector3[vertices.Length];
        for (int i = 0; i < vertices.Length; i++)
        {
            temp.vertices[i] = new Vector3(vertices[i].x, vertices[i].y, vertices[i].z);
        }
        temp.triangles = new int[triangles.Length];
        for (int i = 0; i < triangles.Length; i++)
        {
            temp.triangles[i] = triangles[i];
        }
        temp.normals = new Vector3[normals.Length];
        for (int i = 0; i < normals.Length; i++)
        {
            temp.normals[i] = new Vector3(normals[i].x, normals[i].y, normals[i].z);
        }
        temp.name = new string(name.ToCharArray());
        temp.uv   = new Vector2[uv.Length];
        for (int i = 0; i < uv.Length; i++)
        {
            temp.uv[i] = new Vector2(uv[i].x, uv[i].y);
        }
//		try
//		{
//			temp.mesh = mesh;
//		}
//		catch
//		{}
        return(temp);
    }