comparison examples/E02_squares.nim @ 1136:71315636ba82

did: refactor naming in tons of places
author sam <sam@basx.dev>
date Tue, 04 Jun 2024 16:51:50 +0700
parents d6c27f0ed3e4
children 114f395b9144
comparison
equal deleted inserted replaced
1135:74957cbf589b 1136:71315636ba82
21 for row in 0 ..< ROWS: 21 for row in 0 ..< ROWS:
22 for col in 0 ..< COLUMNS: 22 for col in 0 ..< COLUMNS:
23 let 23 let
24 y: float32 = (row * 2 / COLUMNS) - 1 24 y: float32 = (row * 2 / COLUMNS) - 1
25 x: float32 = (col * 2 / ROWS) - 1 25 x: float32 = (col * 2 / ROWS) - 1
26 color = newVec4f((x + 1) / 2, (y + 1) / 2, 0, 1) 26 color = NewVec4f((x + 1) / 2, (y + 1) / 2, 0, 1)
27 squareIndex = row * COLUMNS + col 27 squareIndex = row * COLUMNS + col
28 vertIndex = squareIndex * 4 28 vertIndex = squareIndex * 4
29 vertices[vertIndex + 0] = newVec3f(x, y) 29 vertices[vertIndex + 0] = NewVec3f(x, y)
30 vertices[vertIndex + 1] = newVec3f(x + WIDTH, y) 30 vertices[vertIndex + 1] = NewVec3f(x + WIDTH, y)
31 vertices[vertIndex + 2] = newVec3f(x + WIDTH, y + HEIGHT) 31 vertices[vertIndex + 2] = NewVec3f(x + WIDTH, y + HEIGHT)
32 vertices[vertIndex + 3] = newVec3f(x, y + HEIGHT) 32 vertices[vertIndex + 3] = NewVec3f(x, y + HEIGHT)
33 colors[vertIndex + 0] = color 33 colors[vertIndex + 0] = color
34 colors[vertIndex + 1] = color 34 colors[vertIndex + 1] = color
35 colors[vertIndex + 2] = color 35 colors[vertIndex + 2] = color
36 colors[vertIndex + 3] = color 36 colors[vertIndex + 3] = color
37 iValues[vertIndex + 0] = uint32(squareIndex) 37 iValues[vertIndex + 0] = uint32(squareIndex)