Exemplo n.º 1
0
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)

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
Exemplo n.º 2
0
# 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")
target.blend = True
sniper = texs.loadTexture("textures/snipermode.png")
sniper.blend = True  #Enable true blending
smaps=200
smph=smaps*.5


# Load tank parts
Exemplo n.º 3
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
ssphere = pi3d.createSphere(10,16,16)
Exemplo n.º 4
0
# 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
redplanet = texs.loadTexture("textures/mars_colour.png")
mymap = pi3d.createElevationMapFromTexture("textures/mars_height.png",mapwidth,mapdepth,mapheight,64,64) 

#Load Corridors sections

x,z = 0,0
y = mymap.calcHeight(-x,-z)
corridor_win = pi3d.loadModel("models/MarsStation/corridor_win_lowpoly.egg",texs,"", x,y,z, -90,0,0, .1,.1,.1)
corridor = pi3d.loadModel("models/MarsStation/corridor_lowpoly.egg",texs,"", x,y,z, -90,0,0, .1,.1,.1)
corridor_bend = pi3d.loadModel("models/MarsStation/bend_lowpoly.egg",texs,"", x,y,z, -90,0,0, .1,.1,.1)
#LOD models
room_hipoly = pi3d.loadModel("models/MarsStation/cross_room.egg",texs,"", x,y,z, -90,0,0, .1,.1,.1)
room_lopoly = pi3d.loadModel("models/MarsStation/cross_room_doors.egg",texs,"", x,y,z, -90,0,0, .1,.1,.1)

#position vars
mouserot=0.0
tilt=0.0
Exemplo n.º 5
0
# 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()

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

treemodel2 = pi3d.createMergeShape("bushytree")
Exemplo n.º 6
0
monstimg = texs.loadTexture("textures/pong3.png")
# environment cube
ectex = texs.loadTexture("textures/ecubes/skybox_stormydays.jpg")
myecube = pi3d.createEnvironmentCube(900.0,"CROSS")
#ball
radius = 1
ball = pi3d.createSphere(radius,12,12,0.0,"sphere",-4,2,-7)
#monster
monster = pi3d.createPlane(5.0, 5.0, "monster", 0,0,0, 0,0,0)
# Create elevation map
mapwidth=50.0                              
mapdepth=50.0
maphalf=23.0
mapheight=20.0
#set smooth to give proper normals
mymap = pi3d.createElevationMapFromTexture("textures/pong.jpg",mapwidth,mapdepth,mapheight,64,64,2,"sub",0,0,0, smooth=True)
# lighting. The default light is a point light but I have made the position method capable of creating
# a directional light and this is what I do inside the loop. If you want a torch you don't need to move it about
light = pi3d.createLight(0, 2, 2, 1, "", 1,2,3, 0.1,0.1,0.2) #yellowish 'torch' or 'sun' with low level blueish ambient
light.position(1,2,3,0) # set to directional light by settin position with 0 fourth parameter
light.on()

#avatar camera
rot=0.0
tilt=0.0
avhgt = 2.0
xm=0.0
zm=0.0
ym=mapheight
lastX0=0.0
lastZ0=0.0
Exemplo n.º 7
0
texs=pi3d.textures()
# Setting 2nd param to True renders 'True' Blending
# (this can be changed later to 'False' with 'rockimg2.blend = False')
rockimg1 = texs.loadTexture("textures/techy1.jpg")
rockimg2 = texs.loadTexture("textures/rock1.png", True)
tree2img = texs.loadTexture("textures/tree2.png")
raspimg = texs.loadTexture("textures/Raspi256x256.png")
# environment cube
ectex = texs.loadTexture("textures/ecubes/skybox_stormydays.jpg")
myecube = pi3d.createEnvironmentCube(900.0,"CROSS")

# Create elevation map
mapwidth=1000.0                              
mapdepth=1000.0
mapheight=110.0
mymap = pi3d.createElevationMapFromTexture("textures/maze1.jpg",mapwidth,mapdepth,mapheight,128,128,1,"sub",0,0,0, smooth=False)
mymap2 = pi3d.createElevationMapFromTexture("textures/maze1.jpg",mapwidth,mapdepth,mapheight+0.1,128,128 ,64,"detail",0.0, 0.01, 0.0, smooth=True) 

myfog = pi3d.fog(0.02, (0.1,0.1,0.1,1.0)) 

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

shed = pi3d.loadModel("models/shed1.obj",texs,"shed",0,3,0, 0,0,0, 2,2,2)

#Scatter them on map using Merge shape's cluster function
mytrees1 = pi3d.createMergeShape("trees1")
Exemplo n.º 8
0
# 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()

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

treemodel2 = pi3d.createMergeShape("bushytree")