Skip to content

Commit

Permalink
rotation and scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
arpruss committed Jul 14, 2015
1 parent 9648370 commit 8c5a53d
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions python2-scripts/mcpipy/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def scale(self, bottomCenter, matrix=None):
vertex = applyMatrix(matrix,v)
else:
vertex = v
self.vertices.append(v)
self.vertices.append(vertex)
for i in range(3):
if minimum[i] == None or vertex[i] < minimum[i]:
minimum[i] = vertex[i]
Expand Down Expand Up @@ -243,15 +243,36 @@ def render(self):
faceVertices = [self.vertices[vertex[0]] for vertex in face]
self.drawVertices(getFace(faceVertices), self.materials[faceCount])

def go(filename, options=[]):
def go(filename, args=[]):
mc = minecraft.Minecraft()

mc.postToChat("Preparing")
mesh = Mesh(mc, filename)
mc.postToChat("Reading")
mesh.read()
mc.postToChat("Scaling")
mesh.scale(mc.player.getPos())

opts = ""

if args and re.match(args[0], "[a-zA-Z]"):
opts = args.pop(0)

if args:
mesh.size = int(args.pop(0))

matrix = None

if args:
yaw = float(args.pop(0))
pitch = 0
roll = 0
if args:
pitch = float(args.pop(0))
if args:
roll = float(args.pop(0))
matrix = makeMatrix(yaw, pitch, roll)

mesh.scale(mc.player.getPos(), matrix)
mc.postToChat("Clearing")
mc.setBlocks(mesh.corner1,mesh.corner2,AIR)
mc.postToChat("Rendering")
Expand Down

0 comments on commit 8c5a53d

Please sign in to comment.