extract method rotateVertices
xxx extract method
This commit is contained in:
parent
5e2b792591
commit
c39f2c19ee
@ -245,7 +245,20 @@ class BlockModels(object):
|
||||
if variantYrot:
|
||||
cullface = rotateFace(cullface, 1, variantYrot)
|
||||
|
||||
self.rotateVertices(rotation, variantXrot, variantYrot, variantZrot, xyzuvc)
|
||||
|
||||
if shade:
|
||||
xyzuvc.view('uint8')[:, 20:] = faceShades[face]
|
||||
else:
|
||||
xyzuvc.view('uint8')[:, 20:] = 0xff
|
||||
|
||||
cookedQuads.append((face, xyzuvc, cullface))
|
||||
|
||||
cookedModels[nameAndState] = cookedQuads
|
||||
|
||||
self.cookedModels = cookedModels
|
||||
|
||||
def rotateVertices(self, rotation, variantXrot, variantYrot, variantZrot, xyzuvc):
|
||||
if rotation is not None:
|
||||
origin = rotation["origin"]
|
||||
axis = rotation["axis"]
|
||||
@ -259,7 +272,6 @@ class BlockModels(object):
|
||||
xyz = xyzuvc[:, :3].transpose()
|
||||
xyzuvc[:, :3] = (matrix[:3, :3] * xyz).transpose()
|
||||
xyzuvc[:, :3] += origin
|
||||
|
||||
rotate = variantXrot or variantYrot or variantZrot
|
||||
if rotate:
|
||||
matrix = numpy.matrix(numpy.identity(4))
|
||||
@ -274,19 +286,6 @@ class BlockModels(object):
|
||||
xyzuvc[:, :3] = (matrix[:3, :3] * xyz).transpose()
|
||||
xyzuvc[:, :3] += 0.5, 0.5, 0.5
|
||||
|
||||
if shade:
|
||||
xyzuvc.view('uint8')[:, 20:] = faceShades[face]
|
||||
else:
|
||||
xyzuvc.view('uint8')[:, 20:] = 0xff
|
||||
|
||||
|
||||
|
||||
cookedQuads.append((face, xyzuvc, cullface))
|
||||
|
||||
cookedModels[nameAndState] = cookedQuads
|
||||
|
||||
self.cookedModels = cookedModels
|
||||
|
||||
faceRotations = (
|
||||
(
|
||||
faces.FaceYIncreasing,
|
||||
|
Reference in New Issue
Block a user