コード例 #1
0
        public static Vector2 GetTextureCoordFromCube(int gridHeight, int gridWidth, int cubeX, int cubeY, Obj obj)
        {
            int xRatio = obj.FaceMatrix.GetLength(0) / gridWidth;
            int yRatio = obj.FaceMatrix.GetLength(1) / gridHeight;

            return(new Vector2((int)Math.Floor(cubeX / (double)xRatio), (int)Math.Floor(cubeY / (double)yRatio)));
        }
コード例 #2
0
        public static IEnumerable <Vector3> GetCubeListFromTextureTile(int gridHeight, int gridWidth, int tileX, int tileY, Obj obj)
        {
            int xRatio = obj.FaceMatrix.GetLength(0) / gridWidth;
            int yRatio = obj.FaceMatrix.GetLength(1) / gridHeight;

            int maxZ = obj.FaceMatrix.GetLength(2);

            return(from x in Enumerable.Range(tileX * xRatio, xRatio)
                   from y in Enumerable.Range(tileY * yRatio, yRatio)
                   from z in Enumerable.Range(0, maxZ)
                   select new Vector3(x, y, z));
        }
コード例 #3
0
 public Texture(Obj obj, string texturePath)
 {
     TargetObj = obj;
     source    = Image.FromFile(texturePath);
 }
コード例 #4
0
 public static IEnumerable <Face> GetFaceListFromTextureTile(int gridHeight, int gridWidth, int tileX, int tileY, Obj obj)
 {
     return(GetCubeListFromTextureTile(gridHeight, gridWidth, tileX, tileY, obj).AsParallel().SelectMany(v => obj.FaceMatrix[v.X, v.Y, v.Z]));
 }
コード例 #5
0
 public Texture(Obj obj)
 {
     TargetObj = obj;
 }