def __init__(self): self.skytex = pi3d.loadTexture("textures/SkyBox.png") #self.greentex = pi3d.loadTexture("textures/green-grid.png") self.greentex = pi3d.loadTexture("textures/mountains3_256.jpg") self.walltex = pi3d.loadTexture('textures/grey-stripe.png') self.coffeetex = pi3d.loadTexture('textures/coffee.png') self.sky = pi3d.createEnvironmentCube(900.0,'CROSS') self.ground = pi3d.createCuboid(800,400,0.1,'ground',0,0,0) self.J1G = Box('J1G',125,80,15) self.J1U = Box('J1U',105,40,10, 20,20,self.J1G.height) self.J1L = Box('J1L',15,16,6, 30,32,self.J1G.height+self.J1U.height) self.J1_f1 = Box('', 4,44,18, 50,18,self.J1G.height) self.J1_f2 = Box('', 4,44,18, 64,18,self.J1G.height) #J1 = pi3d.createMergeShape('J1') #J1.add(J1G, 0,0,0) ##J1.add(J1U, 20,20,J1G.height) ##J1.add(J1L, 30,32,J1G.height+J1U.height) ##J1.add(J1_f, 50,18,J1G.height) #J1.add(J1_f, 64,18,J1G.height) #self.j1 = J1 #self.j1 = Box('J1', 10,4,2, -6, 15) #self.j1l = Box('J1L', 2,2,1, -5, 16, 2) self.torus = pi3d.createTorus(2, 0.6, 12, 24, "Torus", -4,2,-17) self.rasp = pi3d.createTube(0.4, 0.1, 1.5, 24, "tube", 4,3,-15, 30,0,0)
def __init__(self): self.skytex = pi3d.loadTexture("textures/SkyBox.png") #self.greentex = pi3d.loadTexture("textures/green-grid.png") self.greentex = pi3d.loadTexture("textures/mountains3_256.jpg") self.walltex = pi3d.loadTexture('textures/grey-stripe.png') self.coffeetex = pi3d.loadTexture('textures/coffee.png') self.sky = pi3d.createEnvironmentCube(900.0,'CROSS') self.ground = pi3d.createCuboid(800,400,0.1,'ground',0,0,0) self.j1 = Box('J1', 10,4,2, -6, 15) self.j1l = Box('J1L', 2,2,1, -5, 16, 2) self.torus = pi3d.createTorus(2, 0.6, 12, 24, "Torus", -4,2,-17) self.rasp = pi3d.createTube(0.4, 0.1, 1.5, 24, "tube", 4,3,-15, 30,0,0)
# Setup display and initialise pi3d display = pi3d.display() display.create3D(100, 100, 1600, 800, 0.5, 800.0, 60.0) # x,y,width,height,near,far,aspect display.setBackColour(0.4, 0.8, 0.8, 1) # r,g,b,alpha # Load textures texs = pi3d.textures() tree2img = texs.loadTexture("textures/tree2.png") tree1img = texs.loadTexture("textures/tree1.png") grassimg = texs.loadTexture("textures/grass.png") hb2img = texs.loadTexture("textures/hornbeam2.png") #load environment cube 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)
rads = 0.017453292512 # degrees to radians # Setup display and initialise pi3d display = pi3d.display() display.create3D(100,100,1600,800, 0.5, 800.0, 60.0) # x,y,width,height,near,far,aspect display.setBackColour(0.4,0.8,0.8,1) # r,g,b,alpha # Load textures tree2img = pi3d.loadTextureAlpha("textures/tree2.png") tree1img = pi3d.loadTextureAlpha("textures/tree1.png") grassimg = pi3d.loadTextureAlpha("textures/grass.png") hb2img = pi3d.loadTextureAlpha("textures/hornbeam2.png") #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()
import pi3d,math,random rads = 0.017453292512 # degrees to radians # Setup display and initialise pi3d display = pi3d.display() display.create3D(100,100,1600,800, 0.5, 800.0, 60.0) # x,y,width,height,near,far,aspect display.setBackColour(0.4,0.8,0.8,1) # r,g,b,alpha # Load textures tree2img = pi3d.loadTextureAlpha("textures/tree2.png") tree1img = pi3d.loadTextureAlpha("textures/tree1.png") hb2img = pi3d.loadTextureAlpha("textures/hornbeam2.png") ectex = pi3d.loadTexture("textures/ecubes/skybox_stormydays.jpg") myecube = pi3d.createEnvironmentCube(900.0,"CROSS") # Create elevation map mapwidth=1000.0 mapdepth=1000.0 mapheight=60.0 landimg = pi3d.loadTexture("textures/stonygrass.jpg") #surface1 = pi3d.loadTextureAlpha("textures/gravel3.png") mymap = pi3d.createElevationMapFromTexture("textures/mountainsHgt.jpg",mapwidth,mapdepth,mapheight,64,64,10.0) #testislands.jpg #mymap2 = pi3d.createElevationMapFromTexture("textures/mountainsHgt.jpg",mapwidth,mapdepth,mapheight,64,64, 128) myclip = pi3d.clipPlane() light = pi3d.createLight(0, 10,10,10, "", 0,100,0) light.on()
# # before running this example # import pi3d # Setup display and initialise pi3d display = pi3d.display() display.create3D(100,100,1700,800, 0.5, 800.0, 60.0) # x,y,width,height,near,far,aspect #select the environment cube with 'box'... box=3 texs=pi3d.textures() if box==0: ectex = texs.loadTexture("textures/ecubes/skybox_interstellar.jpg") myecube = pi3d.createEnvironmentCube(900.0,"CROSS") elif box==1: ectex = texs.loadTexture("textures/ecubes/SkyBox.jpg") myecube = pi3d.createEnvironmentCube(900.0,"HALFCROSS") elif box==2: ectex=pi3d.loadECfiles("textures/ecubes","sbox_interstellar",texs) myecube = pi3d.createEnvironmentCube(900.0,"FACES") else: ectex=pi3d.loadECfiles("textures/ecubes","skybox_hall",texs) myecube = pi3d.createEnvironmentCube(900.0,"FACES") rot=0.0 tilt=0.0 # Fetch key presses
# before running this example # import pi3d # Setup display and initialise pi3d display = pi3d.display() display.create3D(100, 100, 1700, 800, 0.5, 800.0, 60.0) # x,y,width,height,near,far,aspect #select the environment cube with 'box'... box = 3 texs = pi3d.textures() if box == 0: ectex = texs.loadTexture("textures/ecubes/skybox_interstellar.jpg") myecube = pi3d.createEnvironmentCube(900.0, "CROSS") elif box == 1: ectex = texs.loadTexture("textures/ecubes/SkyBox.jpg") myecube = pi3d.createEnvironmentCube(900.0, "HALFCROSS") elif box == 2: ectex = pi3d.loadECfiles("textures/ecubes", "sbox_interstellar", texs) myecube = pi3d.createEnvironmentCube(900.0, "FACES") else: ectex = pi3d.loadECfiles("textures/ecubes", "skybox_hall", texs) myecube = pi3d.createEnvironmentCube(900.0, "FACES") rot = 0.0 tilt = 0.0 # Fetch key presses mykeys = pi3d.key()
rads = 0.017453292512 # degrees to radians # Setup display and initialise pi3d display = pi3d.display() display.create3D(100,100,1600,800, 0.5, 800.0, 60.0) # x,y,width,height,near,far,aspect display.setBackColour(0.4,0.8,0.8,1) # r,g,b,alpha # Load textures texs = pi3d.textures() tree2img = texs.loadTexture("textures/tree2.png") tree1img = texs.loadTexture("textures/tree1.png") hb2img = texs.loadTexture("textures/hornbeam2.png") ectex = texs.loadTexture("textures/ecubes/skybox_stormydays.jpg") myecube = pi3d.createEnvironmentCube(900.0,"CROSS") # Create elevation map mapwidth=1000.0 mapdepth=1000.0 mapheight=60.0 landimg = texs.loadTexture("textures/stonygrass.jpg") #surface1 = pi3d.loadTextureAlpha("textures/gravel3.png") mymap = pi3d.createElevationMapFromTexture("textures/mountainsHgt.jpg",mapwidth,mapdepth,mapheight,64,64,10.0) #testislands.jpg #mymap2 = pi3d.createElevationMapFromTexture("textures/mountainsHgt.jpg",mapwidth,mapdepth,mapheight,64,64, 128) myclip = pi3d.clipPlane() light = pi3d.createLight(0, 10,10,10, "", 0,100,0) light.on()