コード例 #1
0
    /// <summary>
    /// Trys to load submesh from file.. if cant will scan the terrain
    /// </summary>
    /// <param name="inPolyDiv">how many div ex 5x5 a real poly will have</param>
    /// <param name="polyX">real polys in X will cover in each scan pass</param>
    /// <param name="polyZ">real polys in Z will cover in each scan pass</param>
    void LoadMeshFromFile(int inPolyDiv, int polyX, int polyZ)
    {
        iniTerr.InitializeLotStepVal(ref nextStart, subDivide, wholeMalla, Vertices, ref lotStepX, ref lotStepZ,
                                     inPolyDiv, polyX, polyZ);

        subMesh = XMLSerie.ReadXMLMesh();
        if (subMesh == null)
        {
            print("error loading .XML: ");
            IsLoading       = true;
            isTerraScanning = true;
            subMesh         = new SubMeshData();
            return;
        }
        //print(subMesh.amountOfSubVertices + " subMesh.amountOfSubVertices");
        float dist = 0.001f;

        Malla.Lots = subMesh.AllSubMeshedLots;

        for (int i = 0; i < Malla.Lots.Count; i++)
        {
            for (int j = 0; j < Malla.Lots[i].LotVertices.Count; j++)
            {
                AllVertexs.Add(Malla.Lots[i].LotVertices[j]);
            }
        }
        //print(AllVertexs.Count + ".AllVertexs.count. in mshContrl");
    }