Mercurial > games > semicongine
comparison semiconginev2/contrib/algorithms/texture_packing.nim @ 1247:c15770761865
add: gltf loading test, gltf loading for materials
author | sam <sam@basx.dev> |
---|---|
date | Wed, 24 Jul 2024 23:26:34 +0700 |
parents | 841e12f33c47 |
children |
comparison
equal
deleted
inserted
replaced
1246:356089365076 | 1247:c15770761865 |
---|---|
72 for rect in assignedAreas: | 72 for rect in assignedAreas: |
73 for y in 0 ..< rect.h: | 73 for y in 0 ..< rect.h: |
74 for x in 0 ..< rect.w: | 74 for x in 0 ..< rect.w: |
75 when T is Gray: | 75 when T is Gray: |
76 assert result.atlas[rect.x + x, rect.y + y] == [0'u8], "Atlas texture packing encountered an overlap error" | 76 assert result.atlas[rect.x + x, rect.y + y] == [0'u8], "Atlas texture packing encountered an overlap error" |
77 elif T is RGBA: | 77 elif T is BGRA: |
78 assert result.atlas[rect.x + x, rect.y + y] == [0'u8, 0'u8, 0'u8, 0'u8], "Atlas texture packing encountered an overlap error" | 78 assert result.atlas[rect.x + x, rect.y + y] == [0'u8, 0'u8, 0'u8, 0'u8], "Atlas texture packing encountered an overlap error" |
79 else: | 79 else: |
80 {.error: "Unsupported type for texture packing".} | 80 {.error: "Unsupported type for texture packing".} |
81 result.atlas[rect.x + x, rect.y + y] = images[rect.i][x, y] | 81 result.atlas[rect.x + x, rect.y + y] = images[rect.i][x, y] |
82 result.coords[rect.i] = (x: rect.x, y: rect.y) | 82 result.coords[rect.i] = (x: rect.x, y: rect.y) |