# Hello World example in a window using pi3d module # ================================================= # Copyright (c) 2012 - Tim Skillman # Version 0.01 - 08Dec12 # # This example does not reflect the finished pi3d module in any way whatsoever! # It merely aims to demonstrate a working concept in simplfying 3D programming on the Pi import pi3d #Create a Tkinter window winx,winy,winw,winh = 200,200,800,600 win = pi3d.tkwin("Hello world in a Window",winx,winy,winw,winh) win.update() #show window now (with default splash) # Setup display and initialise pi3d display = pi3d.display(winx,winy,winw,winh) display.setBackColour(0,0,0,1) # r,g,b,alpha # Load textures texs=pi3d.textures() cloudimg = texs.loadTexture("textures/earth_clouds.png",True) earthimg = texs.loadTexture("textures/world_map.jpg") # Create shapes mysphere = pi3d.createSphere(2,24,24,0.0,"earth",0,0,-6) mysphere2 = pi3d.createSphere(2.05,24,24,0.0,"clouds",0,0,-6) #create a light mylight = pi3d.createLight(0,1,1,1,"",10,10,50, .8,.8,.8) mylight.on()
# ======================== # Tim Skillman, copright (c) 2012 # Version 0.02 - 23Nov12 # # This example does not reflect the finished pi3d module in any way whatsoever! # It merely aims to demonstrate a working concept in simplfying 3D programming on the Pi import pi3d,math,random, time rads = 0.017453292512 # degrees to radians #Create a Tkinter window winx,winy,winw,winh = 360,150,1200,800 #64MB GPU memory setting #winx,winy,winw,winh = 0,0,1920,1080 #128MB GPU memory setting win = pi3d.tkwin("Mars Station in Pi3D",winx,winy,winw,winh) win.update() #requires a window update first so that window sizes can be retreived # Setup display and initialise pi3d viewport over the window display = pi3d.display(winx,winy,winw,winh,24,0.5,2200,60) display.setBackColour(0.4,0.8,0.8,1) # r,g,b,alpha #texture storage for loading textures texs = pi3d.textures() ectex=pi3d.loadECfiles("textures/ecubes/RedPlanet","redplanet_256","png",texs,True) myecube = pi3d.createEnvironmentCube(1800.0,"FACES") # Create elevation map mapwidth=2000.0 mapdepth=2000.0 mapheight=100.0
print "" print "Keys- W - Forward," print " A - Left S - Back D - right R - auto-drive" print "" print " Look up with mouse to enter sniper/zoom mode" print "" print " Move mouse to pan view. Press ESCAPE to exit" print "==============================================================" import pi3d,math,random rads = 0.017453292512 # degrees to radians # Create a Tkinter window winx,winy,winw,winh = 360,200,1200,800 #64MB GPU memory setting #winx,winy,winw,winh = 0,0,1920,1200 #128MB GPU memory setting win = pi3d.tkwin("Tiger Tank demo in Pi3D",winx,winy,winw,winh,"textures/tiger_splash.jpg") win.update() #display window now with splash # Setup display and initialise pi3d viewport over the window display = pi3d.display(winx,winy,winw,winh) display.setBackColour(0.7,0.8,0.8,1.0) # r,g,b,alpha # texture storage for loading textures texs = pi3d.textures() ectex = pi3d.loadECfiles("textures/ecubes/Miramar","miramar_256","png",texs,True) myecube = pi3d.createEnvironmentCube(1800.0,"FACES") # create a font arialFont = pi3d.font("MicrosoftSansSerif","#88ff88") # Create elevation map
# # PLEASE INSTALL PIL imaging with: # # $ sudo apt-get install python-imaging # # before running this example # import pi3d,math,random, time rads = 0.017453292512 # degrees to radians #Create a Tkinter window winx,winy,winw,winh = 100,100,1200,600 #64MB GPU memory setting #winw,winh,bord = 1920,1080,0 #128MB GPU memory setting win = pi3d.tkwin("Conference Hall using baked textures in Pi3D",winx,winy,winw,winh) # Setup display and initialise pi3d viewport over the window win.update() #requires a window update first so that window sizes can be retreived display = pi3d.display(winx,winy,winw,winh,24, 0.5, 2200.0, 60.0) display.setBackColour(0.4,0.8,0.8,1) # r,g,b,alpha #texture storage for loading textures texs = pi3d.textures() ectex=pi3d.loadECfiles("textures/ecubes/Miramar","miramar_256","png",texs,True) myecube = pi3d.createEnvironmentCube(1800.0,"FACES") x,y,z = 0,-7,0 hall = pi3d.loadModel("models/ConferenceHall/conferencehall.egg",texs,"Hall", x,y,z, -90.0,0.0,0.0, 0.1,0.1,0.1) #position vars