コード例 #1
0
ファイル: RobotWalkabout.py プロジェクト: frankier/pi3d
#load environment cube
ectex = pi3d.loadECfiles("textures/ecubes","sbox_interstellar")
myecube = pi3d.createEnvironmentCube(900.0,"FACES")

# Create elevation map
mapwidth=1000.0
mapdepth=1000.0
mapheight=60.0
mountimg1 = pi3d.loadTexture("textures/mars_colour.png")
mymap = pi3d.createElevationMapFromTexture("textures/mars_height.png",mapwidth,mapdepth,mapheight,128,128) #testislands.jpg

#create robot 
metalimg = pi3d.loadTextureAlpha("textures/metalhull.jpg")
robot_head= pi3d.createSphere(2.0,12,12,0.5,"",0,3,0)
robot_body = pi3d.createCylinder(2.0,4,12,"",0,1,0)
robot_leg = pi3d.createCuboid(0.7,4.0,1.0,"",0,0.8,0)

robot = pi3d.createMergeShape()
robot.add(robot_head)
robot.add(robot_body)
robot.add(robot_leg, -2.1,0,0)
robot.add(robot_leg, 2.1,0,0)

#create space station
ssphere = pi3d.createSphere(10,16,16)
scorrid = pi3d.createCylinder(4,22,12)

station = pi3d.createMergeShape("",0,mymap.calcHeight(0,0),0, 0,0,0, 4,4,4)
station.add(ssphere, -20,0,-20)
station.add(ssphere, 20,0,-20)
コード例 #2
0
ファイル: RobotWalkabout.py プロジェクト: toxibunny/pi3d
ectex = pi3d.loadECfiles("textures/ecubes", "sbox_interstellar", texs)
myecube = pi3d.createEnvironmentCube(900.0, "FACES")

# Create elevation map
mapwidth = 1000.0
mapdepth = 1000.0
mapheight = 60.0
mountimg1 = texs.loadTexture("textures/mars_colour.png")
mymap = pi3d.createElevationMapFromTexture("textures/mars_height.png",
                                           mapwidth, mapdepth, mapheight, 128,
                                           128)  #testislands.jpg

#create robot
metalimg = texs.loadTexture("textures/metalhull.jpg")
robot_head = pi3d.createSphere(2.0, 12, 12, 0.5, "", 0, 3, 0)
robot_body = pi3d.createCylinder(2.0, 4, 12, "", 0, 1, 0)
robot_leg = pi3d.createCuboid(0.7, 4.0, 1.0, "", 0, 0.8, 0)

robot = pi3d.createMergeShape()
robot.add(robot_head)
robot.add(robot_body)
robot.add(robot_leg, -2.1, 0, 0)
robot.add(robot_leg, 2.1, 0, 0)

#create space station
ssphere = pi3d.createSphere(10, 16, 16)
scorrid = pi3d.createCylinder(4, 22, 12)

station = pi3d.createMergeShape("", 0, mymap.calcHeight(0, 0), 0, 0, 0, 0, 4,
                                4, 4)
station.add(ssphere, -20, 0, -20)
コード例 #3
0
ファイル: Shapes.py プロジェクト: pabloav/pi3d
display.create3D(100,100,1200,900)   	# x,y,width,height
display.setBackColour(0,0,0,1)    	# r,g,b,alpha

# Load textures
patimg = pi3d.loadTexture("textures/PATRN.PNG")   
coffimg = pi3d.loadTexture("textures/COFFEE.PNG")

#Create inbuilt shapes
mysphere = pi3d.createSphere(1,24,24,0.0,"sphere",-4,2,-7)
mytcone = pi3d.createTCone(0.8,0.6,1,24,"TCone", -2,2,-7)
myspiral = pi3d.createSpiral(0.4,0.1,12,24,1.5,3.0,"spiral", 0,2,-7)
mytube = pi3d.createTube(0.4,0.1,1.5,24,"tube",2,2,-7, 30,0,0)
myextrude = pi3d.createExtrude( ((-0.5, 1),(0.5,0),(0.5,-0.2),(-0.5,-0.3)), 0.05,"Extrude",4,2,-7)

mycone = pi3d.createCone(1,2,24,"Cone",-4,-1,-7)
mycylinder = pi3d.createCylinder(.7,1.5,24,"Cyli",-2,-1,-7)
myhemisphere = pi3d.createSphere(1,24,24,0.5,"hsphere",0,-1,-7)
mytorus = pi3d.createTorus(1,0.3,12,24,"Torus", 2,-1,-7)
mylathe = pi3d.createLathe( ((1,0),(0.1,0.2),(0.08,0.21),(0.08,1),(0.7,1.2),(0.9, 1.4), (1.1,1.7)), 24,"Cup",4,-1,-7, 0,0,0, 0.8,0.8,0.8)

arialFont = pi3d.font("AR_CENA","#dd00aa")   #load AR_CENA font and set the font colour to 'raspberry'
destineFont = pi3d.font("AR_Destine", "#0055ff")


# Fetch key presses
mykeys = pi3d.key()


#create a light
mylight = pi3d.createLight(0,1,1,1,"",10,10,10)
mylight.on()