From 4e0e5607e24358eeccca89c4b1979f0bc671b710 Mon Sep 17 00:00:00 2001 From: yum Date: Mon, 20 Oct 2025 19:21:20 -0700 Subject: support multiple columns --- Scripts/DataDecoder.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'Scripts/DataDecoder.cs') 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; -- cgit v1.2.3