Пример #1
0
    public IEnumerator loadTransect(string transect)
    {
        string url       = "http://localhost/ReefTransects/" + transect;
        WWW    wwwImage  = new WWW(url + ".jpg");
        WWW    wwwCoords = new WWW(url + ".txt");

        yield return(wwwImage);

        yield return(wwwCoords);

        Texture2D texture = new Texture2D(10, 10);

        wwwImage.LoadImageIntoTexture(texture);
        TransectSelection.transectTextures.Add(transect, texture);
        string[] coords = wwwCoords.text.ToString().Split(',');
        float    xPos   = CoordConversion.calcX(float.Parse(coords[1]));
        float    zPos   = CoordConversion.calcZ(float.Parse(coords[0]));

        GameObject sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);

        sphere.name = transect;
        Vector3 worldPos = new Vector3(xPos, 0, zPos);

        sphere.transform.position = new Vector3(xPos, RandomTerrainGenerator.terrain.SampleHeight(worldPos) - 6f, zPos);
        sphere.GetComponent <Renderer>().material.mainTexture = texture;
        sphere.AddComponent <Rigidbody>().isKinematic         = true;
        sphere.GetComponent <Rigidbody>().useGravity          = false;
        sphere.tag = "transect";
    }
Пример #2
0
    public void loadDummyMesh(string reefSection)
    {
        string path = @"C:\dummyserver\" + reefSection;

        string[] coords = System.IO.File.ReadAllText(path + ".txt").Split(',');
        print(coords[0] + "   " + coords[1]);
        float xPos = CoordConversion.calcX(float.Parse(coords[1]));
        float zPos = CoordConversion.calcZ(float.Parse(coords[0]));

        GetComponent <PLYImporter>().ReadBinaryFile(path + ".ply", xPos, 0f, zPos);
    }
Пример #3
0
    // Loads the mesh "reefSection".ply at the coordinate position desiganted in the txt file "reefSection".txt
    // which are saved on the localhost at "http://localhost/ReefMeshes/"
    public IEnumerator loadMesh(string reefSection)
    {
        string url       = "http://localhost/ReefMeshes/" + reefSection;
        string path      = @"C:\ReefData\" + reefSection;
        WWW    wwwScript = new WWW(url + ".ply");
        WWW    wwwMeta   = new WWW(url + ".txt"); // real server stuff

        yield return(wwwScript);

        yield return(wwwMeta);


        File.WriteAllBytes(path + ".ply", wwwScript.bytes);

        string[] coords = wwwMeta.text.ToString().Split(',');

        float xPos = CoordConversion.calcX(float.Parse(coords[1]));
        float zPos = CoordConversion.calcZ(float.Parse(coords[0]));

        CoordConversion.resetOrigin(xPos, zPos);          // resets origin and puts mesh in origin position- easily changed
        GetComponent <PLYImporter>().ReadBinaryFile(path + ".ply", 0, 0f, 0);
    }