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))); }
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)); }
public Texture(Obj obj, string texturePath) { TargetObj = obj; source = Image.FromFile(texturePath); }
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])); }
public Texture(Obj obj) { TargetObj = obj; }