diff options
| author | yum <yum.food.vr@gmail.com> | 2025-10-20 19:21:20 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2025-10-20 19:21:20 -0700 |
| commit | 4e0e5607e24358eeccca89c4b1979f0bc671b710 (patch) | |
| tree | 21f51bd52ba30239445486c76dbd1ea506772532 /Scripts/DataDecoder.cs | |
| parent | 87fdfafc4fad113f1333fc6a8767971058495607 (diff) | |
support multiple columns
Diffstat (limited to 'Scripts/DataDecoder.cs')
| -rw-r--r-- | Scripts/DataDecoder.cs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Scripts/DataDecoder.cs b/Scripts/DataDecoder.cs index b71f963..ddef18c 100644 --- a/Scripts/DataDecoder.cs +++ b/Scripts/DataDecoder.cs @@ -171,12 +171,23 @@ public class DataDecoder : UdonSharpBehaviour private Color32 GetTileRGB(int tileIdx) { - int tileY = tileIdx * tileSize; + // Calculate which column and position within column this tile is in + int tilesPerColumn = readHeight / tileSize; + int column = tileIdx / tilesPerColumn; + int tileInColumn = tileIdx % tilesPerColumn; + + // Calculate Y position (vertical position within column) + int tileY = tileInColumn * tileSize; int centerY = tileY + tileSize / 2; + // Calculate X position (horizontal position based on column) + int tileX = column * tileSize; + int centerX = tileX + tileSize / 2; + if (centerY >= readHeight) return new Color32(); + if (centerX >= readWidth) return new Color32(); - int localX = tileSize / 2; + int localX = centerX; int localY = readHeight - 1 - centerY; int index = localY * readWidth + localX; |
