set xyzuvs coords by adding ndarray, not tuple

This commit is contained in:
David Vierra 2015-01-03 17:06:49 -10:00
parent a4c6ae6fff
commit 1eab1409a9
2 changed files with 7 additions and 2 deletions

View File

@ -262,6 +262,7 @@ class BlockModels(object):
xyzuvc.view('uint8')[:, 20:] = faceShades[face]
else:
xyzuvc.view('uint8')[:, 20:] = 0xff
xyzuvc.shape = 1, 4, 6 # add the first dimension to stack along in modelmesh.pyx
cookedQuads.append((xyzuvc, cullface))

View File

@ -52,10 +52,15 @@ class BlockModelMesh(object):
cdef unsigned short y, z, x, ID, meta
cdef short dx, dy, dz,
cdef unsigned short nx, ny, nz, nID
cdef numpy.ndarray verts
cdef numpy.ndarray[numpy.uint16_t, ndim=1] coords = numpy.zeros(3, dtype=numpy.uint16)
for y in range(1, 17):
coords[1] = y - 1 + (cy << 4)
for z in range(1, 17):
coords[2] = z - 1
for x in range(1, 17):
coords[0] = x - 1
ID = areaBlocks[y, z, x]
if ID == 0:
continue
@ -78,8 +83,7 @@ class BlockModelMesh(object):
continue
verts = numpy.array(xyzuvc)
verts.shape = 1, 4, 6
verts[..., :3] += (x - 1, y - 1 + (cy << 4), z - 1)
verts[..., :3] += coords
faceQuadVerts.append(verts)
# log.info("Block %s:\nVertices: %s", (x-1, y-1, z-1), verts)