Example #1
0
        public void UpdateArea(UVBounds uvBounds)
        {
            float horizontalScale = Controller.RenderTextureAspectRatio;
            bool  reverseOrder    = (uvBounds.U1 < uvBounds.U2) ^ (uvBounds.V1 < uvBounds.V2);

            Vector3[] verts;

            if (reverseOrder)
            {
                verts = new Vector3[] {
                    new Vector3(horizontalScale * uvBounds.U2, uvBounds.V1),
                    new Vector3(horizontalScale * uvBounds.U2, uvBounds.V2),
                    new Vector3(horizontalScale * uvBounds.U1, uvBounds.V1),
                    new Vector3(horizontalScale * uvBounds.U1, uvBounds.V2)
                };
            }
            else
            {
                verts = new Vector3[] {
                    new Vector3(horizontalScale * uvBounds.U1, uvBounds.V1),
                    new Vector3(horizontalScale * uvBounds.U1, uvBounds.V2),
                    new Vector3(horizontalScale * uvBounds.U2, uvBounds.V1),
                    new Vector3(horizontalScale * uvBounds.U2, uvBounds.V2)
                };
            }

            _mesh.vertices = verts;

            if (gameObject.activeInHierarchy)
            {
                Controller.UpdateTexture();
            }
        }
Example #2
0
        public void UpdateArea(IBoundingBox bbox)
        {
            IBoundingBox currentBoundingBox = Controller.CurrentBoundingBox;

            if (currentBoundingBox == BoundingBox.Zero)
            {
                return;
            }
            UVBounds uvBounds = BoundingBoxUtils.CalculateUVBounds(currentBoundingBox, bbox);

            UpdateArea(uvBounds);
        }
        public static UVScaleOffset CalculateUVScaleOffset(UVBounds relativeUV)
        {
            if (relativeUV == UVBounds.Default)
            {
                return(UVScaleOffset.Default);
            }

            return(new UVScaleOffset()
            {
                Scale = new Vector2(
                    relativeUV.U2 - relativeUV.U1,
                    relativeUV.V2 - relativeUV.V1
                    ),
                Offset = new Vector2(
                    relativeUV.U1,
                    relativeUV.V1
                    )
            });
        }
Example #4
0
 public GenerateLocalTerrainMeshFromDigitalElevationModelTask(string[] demFilePaths, TerrainModelMeshMetadata metadata,
                                                              BoundingBox boundingBox, UVBounds uvBounds) : base(demFilePaths, metadata)
 {
     _boundingBox = boundingBox;
     _uvBounds    = uvBounds;
 }
Example #5
0
        public static Vector2 GenerateUVCoord(int x, int y, int lonVertCount, int latVertCount, UVBounds uvBounds)
        {
            Vector2 uvScale  = new Vector2(uvBounds.U2 - uvBounds.U1, uvBounds.V2 - uvBounds.V1);
            Vector2 uvOffset = new Vector2(-uvBounds.U1, -uvBounds.V1);

            return(MeshGenerationUtils.GenerateUVCoord(x, latVertCount - y - 1, lonVertCount, latVertCount, uvScale, uvOffset));
        }
 public GenerateBaseLocalTerrainMeshTask(TerrainModelMeshMetadata metadata,
                                         BoundingBox boundingBox, UVBounds uvBounds) : base(metadata)
 {
     _boundingBox = boundingBox;
     _uvBounds    = uvBounds;
 }