|
|
@ -48,15 +48,15 @@ public class RenderingComponents |
|
|
|
public static TextureCoords4 FromIntCoords(Size textureSize, Point origin, Size size) |
|
|
|
public static TextureCoords4 FromIntCoords(Size textureSize, Point origin, Size size) |
|
|
|
=> FromIntCoords(textureSize, origin.X, origin.Y, size.Width, size.Height); |
|
|
|
=> FromIntCoords(textureSize, origin.X, origin.Y, size.Width, size.Height); |
|
|
|
public static TextureCoords4 FromIntCoords(Size textureSize, int x, int y, int width, int height) => new( |
|
|
|
public static TextureCoords4 FromIntCoords(Size textureSize, int x, int y, int width, int height) => new( |
|
|
|
x / (float)textureSize.Width + 0.001F, |
|
|
|
x / (float)textureSize.Width + 0.001f, |
|
|
|
y / (float)textureSize.Height + 0.001F, |
|
|
|
y / (float)textureSize.Height + 0.001f, |
|
|
|
(x + width) / (float)textureSize.Width - 0.001F, |
|
|
|
(x + width) / (float)textureSize.Width - 0.001f, |
|
|
|
(y + height) / (float)textureSize.Height - 0.001F); |
|
|
|
(y + height) / (float)textureSize.Height - 0.001f); |
|
|
|
|
|
|
|
|
|
|
|
public static TextureCoords4 FromGrid(int numCellsX, int numCellsY, int cellX, int cellY) => new( |
|
|
|
public static TextureCoords4 FromGrid(int numCellsX, int numCellsY, int cellX, int cellY) => new( |
|
|
|
cellX / (float)numCellsX + 0.001F, |
|
|
|
cellX / (float)numCellsX + 0.001f, |
|
|
|
cellY / (float)numCellsY + 0.001F, |
|
|
|
cellY / (float)numCellsY + 0.001f, |
|
|
|
(cellX + 1) / (float)numCellsX - 0.001F, |
|
|
|
(cellX + 1) / (float)numCellsX - 0.001f, |
|
|
|
(cellY + 1) / (float)numCellsY - 0.001F); |
|
|
|
(cellY + 1) / (float)numCellsY - 0.001f); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|