Drought.World.HeightMap.getPositionAt C# (CSharp) Method

getPositionAt() public method

public getPositionAt ( float x, float y ) : Vector3
x float
y float
return Vector3
        public Vector3 getPositionAt(float x, float y)
        {
            return new Vector3(x, y, getHeight(x, y));
        }

Usage Example

コード例 #1
0
ファイル: NormalMap.cs プロジェクト: kiniry-teaching/UCD
        private void initialise(HeightMap heightMap)
        {
            width = heightMap.getMapWidth();
            height = heightMap.getMapHeight();
            normals = new Vector3[width, height, 2];

            for (int x = 0; x < width; x++)
                for (int y = 0; y < height; y++)
                {
                    Vector3 p0 = heightMap.getPositionAt(x, y);
                    Vector3 p1 = heightMap.getPositionAt(x + 1, y);
                    Vector3 p2 = heightMap.getPositionAt(x, y + 1);
                    Vector3 p3 = heightMap.getPositionAt(x + 1, y + 1);

                    Vector3 v0 = p2 - p0;
                    Vector3 v1 = p3 - p2;
                    Vector3 v2 = p3 - p1;
                    Vector3 v3 = p1 - p0;

                    normals[x, y, 0] = Vector3.Cross(v1, v0);
                    normals[x, y, 1] = Vector3.Cross(v3, v2);
                }
        }