mymodel = pi3d.loadModel("models/Triceratops/Triceratops.egg",texs,"Triceratops", 0,-1,0, -90,0,0, .005,.005,.005) # Fetch key presses mykeys = pi3d.key() # mastrix and rotate variables rot=0 #create a light mylight = pi3d.createLight(0,1,1,1,"",10,10,0) mylight.on() while 1: display.clear() pi3d.identity() pi3d.position(0,0,-40) pi3d.rotate(0,rot,0) rot += 3 mymodel.draw() k = mykeys.read() if k >-1: if k==112: display.screenshot("Triceratops.jpg") elif k==27: mykeys.close() texs.deleteAll() display.destroy() break else:
# (this can be changed later to 'False' with 'cloudimg.blend = False') myplane = pi3d.createPlane(300, 300, 'box', 100, 100, 0) starsimg = pi3d.loadTexture("textures/stars2.jpg") arialFont = pi3d.font("MicrosoftSansSerif","#dd00aa") #load AR_CENA font and set the font colour to 'raspberry' destineFont = pi3d.font("Tahoma", "#0055ff") # Fetch key presses mykeys = pi3d.key() rot=0.0 # Display scene while 1: display.clear() rot=rot+0.2 pi3d.identity() # pi3d.sprite(starsimg, 0,0,-20, 20,20,rot) # pi3d.rectangle(starsimg, 0,0,-20, 20,20,rot) # myplane.draw(starsimg) # x oof, y off, z off, angle, x scale, y scale pi3d.drawString(arialFont, "`Test arial font!" , math.sin(rot/100), math.cos(rot/100), -2.2, rot, 0.003, 0.003) # pi3d.drawString(destineFont, ".Test destine font!", math.cos(rot/100), math.sin(rot/100) - 0.3, -2.2, -rot, 0.001, 0.001) display.swapBuffers()
def set_view(self): '''Set up camera transformation before drawing''' pi3d.identity() pi3d.rotate(self.tilt, 0, 0) pi3d.rotate(0, self.rot, 0) pi3d.position(self.x, self.y, self.z)