Esempio n. 1
0
import math

# Setup display and initialise pi3d
display = pi3d.display()
display.create3D(1,1,1280,1024)   	# x,y,width,height
display.setBackColour(0,0,0,1)    	# r,g,b,alpha

# Load textures

# Setting 2nd param to True renders 'True' Blending
# (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()
Esempio n. 2
0
# Load textures

# Setting 2nd param to True renders 'True' Blending
# (this can be changed later to 'False' with 'cloudimg.blend = False')
cloudimg = pi3d.loadTextureAlpha("textures/earth_clouds.png",True)   
earthimg = pi3d.loadTexture("textures/world_map.jpg")
moonimg = pi3d.loadTexture("textures/moon.jpg")
starsimg = pi3d.loadTexture("textures/stars2.jpg")
watimg = pi3d.loadTexture("textures/water.jpg")
	
mysphere = pi3d.createSphere(2,24,24,0.0,"earth",0,0,0)
mysphere2 = pi3d.createSphere(2.05,24,24,0.0,"clouds",0,0,0)
mymoon = pi3d.createSphere(0.4,16,16,0.0,"moon",0,0,0)
mymoon2 = pi3d.createSphere(0.1,16,16,0.0,"moon2",0,0,0)

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

# Fetch key presses
mykeys = pi3d.key()

mtrx = pi3d.matrix()

rot=0.0
rot1=0.0
rot2=0.0

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

# Display scene
Esempio n. 3
0
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
mapwidth=2000.0
mapdepth=2000.0
mapheight=100.0
mountimg1 = texs.loadTexture("textures/mountains3_512.jpg")
#roadway = texs.loadTexture("textures/road5.png")
mymap = pi3d.createElevationMapFromTexture("textures/mountainsHgt2.png",mapwidth,mapdepth,mapheight,64,64) 

# map dots and settings
dotsize=8
doth=dotsize*.5
reddot = texs.loadTexture("textures/red_ball.png")
grndot = texs.loadTexture("textures/blu_ball.png")
target = texs.loadTexture("textures/target.png")
Esempio n. 4
0
texs = pi3d.textures()
# Setting 2nd param to True renders 'True' Blending
# (this can be changed later to 'False' with 'cloudimg.blend = False')
cloudimg = texs.loadTexture("textures/earth_clouds.png", True)
earthimg = texs.loadTexture("textures/world_map.jpg")
moonimg = texs.loadTexture("textures/moon.jpg")
starsimg = texs.loadTexture("textures/stars2.jpg")
watimg = texs.loadTexture("textures/water.jpg")

mysphere = pi3d.createSphere(2, 24, 24, 0.0, "earth", 0, 0, 0)
mysphere2 = pi3d.createSphere(2.05, 24, 24, 0.0, "clouds", 0, 0, 0)
mymoon = pi3d.createSphere(0.4, 16, 16, 0.0, "moon", 0, 0, 0)
mymoon2 = pi3d.createSphere(0.1, 16, 16, 0.0, "moon2", 0, 0, 0)

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

# Fetch key presses
mykeys = pi3d.key()

mtrx = pi3d.matrix()

rot = 0.0
rot1 = 0.0
rot2 = 0.0

#create a light
mylight = pi3d.createLight(0, 1, 1, 1, "", 10, 10, 50, .8, .8, .8)
Esempio n. 5
0
    bx.append(random.random() * scnx)
    by.append(random.random() * scny)
    dx.append((random.random() - 0.5) * maxspeed)
    dy.append((random.random() - 0.5) * maxspeed)
    bs.append(random.random() * maxballsize + minballsize)
    bi.append(int(random.random() * 3))

texs=pi3d.textures()
ball = []
ball.append(texs.loadTexture("textures/red_ball.png"))
ball.append(texs.loadTexture("textures/grn_ball.png"))
ball.append(texs.loadTexture("textures/blu_ball.png"))
bar = texs.loadTexture("textures/bar.png")
bbtitle = texs.loadTexture("textures/pi3dbbd.png",True)

arialFont = pi3d.font("AR_CENA","#ddff88")   #load AR_CENA font and set the font colour

# Fetch key presses
mykeys = pi3d.key()
scshots = 1

while True:
	
    display.clear()
	
    for b in range (0, maxballs):
			    
	# Draw ball (tex,x,y,z,width,height,rotation)
	pi3d.sprite(ball[bi[b]],bx[b],by[b],-2.0,bs[b],bs[b])
	
	# Increment ball positions
Esempio n. 6
0
# Load textures
texs=pi3d.textures()
# Setting 2nd param to True renders 'True' Blending
cloudimg = texs.loadTexture("textures/earth_clouds.png",True)   
earthimg = texs.loadTexture("textures/world_map.jpg")
moonimg = texs.loadTexture("textures/moon.jpg")
starsimg = texs.loadTexture("textures/stars2.jpg")
watimg = texs.loadTexture("textures/water.jpg")
	
mysphere = pi3d.createSphere(2,24,24,0.0,"earth",0,0,0)
mysphere2 = pi3d.createSphere(2.05,24,24,0.0,"clouds",0,0,0)
mymoon = pi3d.createSphere(0.4,16,16,0.0,"moon",0,0,0)
mymoon2 = pi3d.createSphere(0.1,16,16,0.0,"moon2",0,0,0)

arialFont = pi3d.font("AR_CENA","#aaffaa")   #load AR_CENA font and set the font colour to 'raspberry'

# Fetch key presses
mykeys = pi3d.key()

mtrx = pi3d.matrix()

rot=0.0
rot1=0.0
rot2=0.0

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

fps=pi3d.FPS()
Esempio n. 7
0
# which is more common for 2D.  Also demonstrates a mock title bar.

import pi3d, sys, random, array

# Setup display and initialise pi3d
scnx=1280
scny=1024
display = pi3d.display()
display.create2D(0,0,scnx,scny,0)

# Set last value (alpha) to zero for a transparent background!
display.setBackColour(0,0.2,0.6,0.8)    	
    
# Ball parameters

arialFont = pi3d.font("MicrosoftSansSerif","#ffffff")   #load AR_CENA font and set the font colour to 'raspberry'

bar = pi3d.loadTexture("textures/bar.png")
bbtitle = pi3d.loadTextureAlpha("textures/pi3dbbd.png",True)
coffee = pi3d.loadTexture("textures/COFFEE.PNG")

# Fetch key presses
mykeys = pi3d.key()
scshots = 1

while True:
	
    display.clear()
   
    #draw a bar at the top of the screen
    pi3d.rectangle(bar,0,scny,scnx,32)