# HG changeset patch # User Sam # Date 1704105589 -25200 # Node ID 46c036b795bba3730a997a68aca0c4d76efbe638 # Parent 6406a5af430d04dd5a3e3651004ee0a23598f266 fix: grid-generation not correct diff -r 6406a5af430d -r 46c036b795bb semicongine/mesh.nim --- a/semicongine/mesh.nim Sat Dec 30 00:17:04 2023 +0700 +++ b/semicongine/mesh.nim Mon Jan 01 17:39:49 2024 +0700 @@ -518,21 +518,26 @@ center_offset_x = -(float32(columns) * cellSize) / 2'f32 center_offset_y = -(float32(rows) * cellSize) / 2'f32 var - pos = @[newVec3f(center_offset_x, center_offset_y)] - col = @[color, color] + pos: seq[Vec3f] + col: seq[Vec4f] i = 0'u16 for h in 0'u16 .. rows: for w in 0'u16 .. columns: pos.add newVec3f(center_offset_x + float32(w) * cellSize, center_offset_y + float32(h) * cellSize) col.add color if w > 0 and h > 0: - result[].smallIndices.add [i, i - 1, i - w - 1] - result[].smallIndices.add [i, i - w - 1, i - w] + result[].smallIndices.add [i, i - 1, i - rows - 2] + result[].smallIndices.add [i, i - rows - 2, i - rows - 1] i.inc result[].initVertexAttribute(DEFAULT_POSITION_ATTRIBUTE, pos) result[].initVertexAttribute("color", col) + echo pos + echo result[].smallIndices + echo result + + # MESH TREES ============================================================================= type