Exemplo n.º 1
0
    public void SatelliteImageCorrectlySlicedAndFlippedToForBottomRightSlice()
    {
        MapDisplayData dispData = new MapDisplayData();

        data.SetX(5);
        data.SetY(5);
        dispData.SetMapData(data);

        SatelliteImage image = new SatelliteImage();

        Color[]   textureMap = new Color[20 * 20];
        Texture2D texture    = new Texture2D(20, 20);

        texture.SetPixels(textureMap);
        image.texture = texture;
        image.width   = 10;
        image.height  = 10;

        texture.SetPixel(10, 9, Color.red);
        texture.SetPixel(19, 0, Color.blue);

        SatelliteImageService.satelliteImage    = image;
        SatelliteImageService.useSatelliteImage = true;

        //Color[] colorMap = dispData.GenerateTexture();
        Texture2D textureSlice = dispData.GenerateTexture(0);

        Assert.True(textureSlice.GetPixel(0, 0) == Color.red);
        Assert.True(textureSlice.GetPixel(9, 9) == Color.blue);

        //Assert.True (colorMap [0] == Color.red);
        //Assert.True (colorMap [99] == Color.blue);
    }
Exemplo n.º 2
0
    public void UpdateMapTexture(int lod = lowTextureLod)
    {
        Texture2D texture = displayData.GenerateTexture(lod);

        displayData.texture = texture;
        Material material = new Material(meshRenderer.sharedMaterial);

        material.mainTexture        = texture;
        meshRenderer.sharedMaterial = material;
    }