Exemple #1
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.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)
Exemple #2
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)
Exemple #3
0
# before running this example
#

import pi3d

# Setup display and initialise pi3d
display = pi3d.display()
display.create3D(100,100,1600,900)   	# 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')
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()
Exemple #4
0
# 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()
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
Exemple #5
0
import pi3d
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
    
Exemple #6
0
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()
Exemple #7
0
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")
grassimg = pi3d.loadTextureAlpha("textures/grass.png")
hb2img = pi3d.loadTextureAlpha("textures/hornbeam2.png")

ectex = pi3d.loadTexture("textures/SkyBox.png")
myecube = pi3d.createEnvironmentCube(900.0,"CROSS")

# Create elevation map
mapwidth=1000.0
mapdepth=1000.0
mapheight=60.0
mountimg1 = pi3d.loadTexture("textures/mountains3_512.jpg")
mymap = pi3d.createElevationMapFromTexture("textures/mountainsHgt.jpg",mapwidth,mapdepth,mapheight,64,64) #testislands.jpg
 
#Create tree models	
treeplane = pi3d.createPlane(4.0,5.0)

treemodel1 = pi3d.createMergeShape("baretree")
treemodel1.add(treeplane, 0,0,0)
treemodel1.add(treeplane, 0,0,0, 0,90,0)
Exemple #8
0
# PLEASE INSTALL PIL imaging with:
#
#      $ sudo apt-get install python-imaging
#
# before running this example
#

import pi3d

# Setup display and initialise pi3d
display = pi3d.display()
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)
Exemple #9
0
# Setup display and initialise pi3d
display = pi3d.display()
display.create3D(100,100,1600,900)   	# x,y,width,height
display.setBackColour(0.2,0.4,0.6,1)    	# r,g,b,alpha

print "=============================================================="
print "Instructions:"
print ""
print "Keys-             W - Forward,"
print "        A - Left   S - Back     D - right"
print ""
print "Move mouse to pan view.  Click mouse to exit or press ESCAPE"
print "=============================================================="

ectex = pi3d.loadTexture("textures/SkyBox.png")
myecube = pi3d.createEnvironmentCube(900.0,"CROSS")

# load model_loadmodel
mymodel = pi3d.loadModel("models/Buckfast Abbey/BuckfastAbbey.egg","Abbey",0,0,0, -90,160,0, 0.03,0.03,0.03)
	
# Create keyboard and mouse event objects
mykeys = pi3d.key()
mymouse = pi3d.mouse()
mymouse.start()

#screenshot number
scshots = 1  

#avatar camera
rot=0.0
Exemple #10
0
# before running this example
#

import pi3d

# Setup display and initialise pi3d
display = pi3d.display()
display.create3D(100, 100, 1200, 900)  # 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')
cloudimg = pi3d.loadTextureAlpha("textures/earth_clouds.png", True)
earthimg = pi3d.loadTexture("textures/world_map256x256.jpg")
starsimg = pi3d.loadTexture("textures/stars.jpg")

mysphere = pi3d.createSphere(2, 24, 24, 0.0, "earth", 0, 0, -7)
mysphere2 = pi3d.createSphere(2.05, 24, 24, 0.0, "clouds", 0, 0, -7)

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()

rot = 0.0

# Display scene
while 1:
Exemple #11
0
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)
    pi3d.rectangle(bbtitle,5,scny,256+5,32)
    pi3d.rectangle(coffee,200,600,400,400)
Exemple #12
0
bi=[]

# Setup ball positions, sizes, directions and colours
for b in range (0, maxballs):
    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))

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

# 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])
	
Exemple #13
0
#      $ sudo apt-get install python-imaging
#
# 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

if box==0:
	ectex = pi3d.loadTexture("textures/ecubes/skybox_interstellar.jpg")
	myecube = pi3d.createEnvironmentCube(900.0,"CROSS")
elif box==1:
	ectex = pi3d.loadTexture("textures/ecubes/SkyBox.jpg")
	myecube = pi3d.createEnvironmentCube(900.0,"HALFCROSS")
elif box==2:
	ectex=pi3d.loadECfiles("textures/ecubes","sbox_interstellar")
	myecube = pi3d.createEnvironmentCube(900.0,"FACES")
else:
	ectex=pi3d.loadECfiles("textures/ecubes","skybox_hall")
	myecube = pi3d.createEnvironmentCube(900.0,"FACES")


rot=0.0
tilt=0.0