Пример #1
0
# Setup display and initialise pi3d
display = Display()
display.create3D(100,100,800,600, 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 = 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")

#myecube = EnvironmentCube(900.0,"HALFCROSS")

ectex=loadECfiles("textures/ecubes","sbox",texs)
myecube = EnvironmentCube(900.0,"FACES")

light = Light(0, 10,10,10, "", 0,100,0)
light.on()

# Create elevation map
mapwidth=1000.0
mapdepth=1000.0
mapheight=60.0
mountimg1 = texs.loadTexture("textures/mountains3_512.jpg")
mymap = ElevationMap("textures/mountainsHgt.jpg",mapwidth,mapdepth,mapheight,64,64) #testislands.jpg

#Create tree models
treeplane = Plane(4.0,5.0)

treemodel1 = MergeShape("baretree")
Пример #2
0
# load shader
shader = Shader("shaders/uv_light")
flatsh = Shader("shaders/uv_flat")

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 = loadECfiles("textures/ecubes","sbox")
myecube = EnvironmentCube(size=900.0, maptype="FACES",
                          name="bfa", y=50.0)
myecube.set_draw_details(flatsh, ectex)

# load model_loadmodel
mymodel = Model(file_string="models/Buckfast Abbey/BuckfastAbbey.egg",
                name="Abbey",
                rx=90, sx=0.03, sy=0.03, sz=0.03)
mymodel.set_shader(shader)

# Create keyboard and mouse event objects
mykeys = Keyboard()
mymouse = Mouse(restrict = False)
mymouse.start()

#screenshot number
scshots = 1
Пример #3
0
shader = Shader("shaders/uv_reflect")
flatsh = Shader("shaders/uv_flat")
#========================================

# load Textures
rockimg1 = Texture("textures/techy1.jpg")
rockimg2 = Texture("textures/rocktile2.jpg")
tree2img = Texture("textures/tree2.png")
raspimg = Texture("textures/Raspi256x256.png")
monstimg = Texture("textures/pong2.jpg")
monsttex = Texture("textures/floor_nm.jpg")
shineimg = Texture("textures/stars.jpg")

# environment cube
ectex = Texture("textures/ecubes/skybox_stormydays.jpg")
myecube = EnvironmentCube(size=900.0, maptype="CROSS")
myecube.set_draw_details(flatsh, ectex)

# Create elevation map
mapwidth = 1000.0
mapdepth = 1000.0
mapheight = 100.0
mymap = ElevationMap("textures/maze1.jpg",
                     width=mapwidth,
                     depth=mapdepth,
                     height=mapheight,
                     divx=128,
                     divy=128,
                     name="sub")
mymap.set_draw_details(shader, [rockimg1, rockimg2, shineimg], 128.0, 0.05)
Пример #4
0
from pi3d.shape.EnvironmentCube import EnvironmentCube
from pi3d.shape.EnvironmentCube import loadECfiles

from pi3d.util.Matrix import Matrix
from pi3d.util import Utility

# Setup display and initialise pi3d
display = Display()
display.create3D(50,50,display.max_width-100,display.max_height-100, 0.5, 800.0, 60.0)   	# x,y,width,height,near,far,aspect

#select the environment cube with 'box'...
box=3
texs=Textures()
if box==0:
  ectex = texs.loadTexture("textures/ecubes/skybox_interstellar.jpg")
  myecube = EnvironmentCube(900.0,"CROSS")
elif box==1:
  ectex = texs.loadTexture("textures/ecubes/SkyBox.jpg")
  myecube = EnvironmentCube(900.0,"HALFCROSS")
elif box==2:
  ectex=loadECfiles("textures/ecubes","sbox_interstellar",texs)
  myecube = EnvironmentCube(900.0,"FACES")
else:
  ectex=loadECfiles("textures/ecubes","skybox_hall",texs)
  myecube = EnvironmentCube(900.0,"FACES")

rot=0.0
tilt=0.0

# Fetch key presses
mykeys = Keyboard()
Пример #5
0
light = Light((10, -10, 20))
# load shader
shader = Shader("shaders/uv_reflect")
flatsh = Shader("shaders/uv_flat")
defocus = Defocus()
#========================================

# Setting 2nd param to True renders 'True' Blending
# (this can be changed later to 'False' with 'rockimg2.blend = False')
groundimg = Texture("textures/stripwood.jpg")
monstimg = Texture("textures/pong3.png")
ballimg = Texture("textures/pong2.jpg")

# environment cube
ectex = Texture("textures/ecubes/skybox_stormydays.jpg")
myecube = EnvironmentCube(camera, light, 900.0, "CROSS")
myecube.set_draw_details(flatsh, [ectex])

#ball
maxdsz = 0.3
radius = 1.0
ball = Sphere(camera, light, radius, 12, 12, 0.0, "sphere", -4, 8, -7)
# Shape.set_draw_details is a wrapper for calling the method on each item in buf
# as is done explicitly here for no reason than to show that it can be done!
ball.buf[0].set_draw_details(shader, [ballimg], 0.0, 0.0)

#monster
monster = Plane(camera, light, 5.0, 5.0, "monster", 0, 0, 0, 0, 0, 0)
monster.buf[0].set_draw_details(flatsh, [monstimg])

# Create elevation map
Пример #6
0
# Setup display and initialise pi3d
display = Display()
display.create3D(50,50,display.max_width-100,display.max_height-100, 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 = 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 = loadECfiles("textures/ecubes","sbox_interstellar",texs)
myecube = EnvironmentCube(900.0,"FACES")

# Create elevation map
mapwidth=1000.0
mapdepth=1000.0
mapheight=60.0
mountimg1 = texs.loadTexture("textures/mars_colour.png")
mymap = ElevationMap("textures/mars_height.png",mapwidth,mapdepth,mapheight,128,128) #testislands.jpg

#create robot
metalimg = texs.loadTexture("textures/metalhull.jpg")
robot_head= Sphere(2.0,12,12,0.5,"",0,3,0)
robot_body = Cylinder(2.0,4,12,"",0,1,0)
robot_leg = Cuboid(0.7,4.0,1.0,"",0,0.8,0)

robot = MergeShape()
Пример #7
0
shader = Shader("shaders/uv_reflect")
flatsh = Shader("shaders/uv_flat")
#========================================

# load Textures
rockimg1 = Texture("textures/techy1.jpg")
rockimg2 = Texture("textures/rocktile2.jpg")
tree2img = Texture("textures/tree2.png")
raspimg = Texture("textures/Raspi256x256.png")
monstimg = Texture("textures/pong2.jpg")
monsttex = Texture("textures/floor_nm.jpg")
shineimg = Texture("textures/stars.jpg")

# environment cube
ectex = Texture("textures/ecubes/skybox_stormydays.jpg")
myecube = EnvironmentCube(size=900.0, maptype="CROSS")
myecube.set_draw_details(flatsh, ectex)

# Create elevation map
mapwidth = 1000.0
mapdepth = 1000.0
mapheight = 100.0
mymap = ElevationMap("textures/maze1.jpg",
                     width=mapwidth, depth=mapdepth, height=mapheight,
                     divx=128, divy=128, name="sub")
mymap.set_draw_details(shader, [rockimg1, rockimg2, shineimg], 128.0, 0.05)

# Create fog for more realistic fade in distance. This can be turned on and off between drawing different object (i.e backgound not foggy)
mymap.set_fog((0.1,0.1,0.1,1.0), 200.0)

#Create tree models
Пример #8
0
from pi3d.util.Screenshot import screenshot

# Setup display and initialise pi3d
DISPLAY = Display.create(x=50, y=50, w=-100, h=-100,
                         background=(0.4, 0.8, 0.8, 1))
shader = Shader("shaders/uv_reflect")
flatsh = Shader("shaders/uv_flat")
#############################

# Load textures
reflcn = Texture("textures/stars.jpg")

#load environment cube
ectex = loadECfiles("textures/ecubes","sbox_interstellar")
myecube = EnvironmentCube(size=900.0, maptype="FACES")
myecube.set_draw_details(flatsh, ectex)

# Create elevation map
mapwidth=1000.0
mapdepth=1000.0
mapheight=60.0
mountimg1 = Texture("textures/mars_colour.png")
bumpimg = Texture("textures/mudnormal.jpg")
mymap = ElevationMap(mapfile="textures/mars_height.png",
                     width=mapwidth, depth=mapdepth, height=mapheight,
                     divx=128, divy=128)
mymap.set_draw_details(shader,[mountimg1, bumpimg],128.0, 0.0)
mymap.set_fog((0.3,0.15,0.1,0.1), 300.0)

Пример #9
0
from pi3d.shape.EnvironmentCube import loadECfiles

from pi3d.util.Screenshot import screenshot
from pi3d.util import Utility

# Setup display and initialise pi3d
DISPLAY = Display.create(x=50, y=50)

shader = Shader('shaders/uv_flat')
#========================================

#select the environment cube with 'box'...
box = 3
if box == 0:
    ectex = [Texture('textures/ecubes/skybox_interstellar.jpg')]
    myecube = EnvironmentCube(size=900.0, maptype='CROSS')
elif box == 1:
    ectex = [Texture('textures/ecubes/SkyBox.jpg')]
    myecube = EnvironmentCube(size=900.0, maptype='HALFCROSS')
elif box == 2:
    ectex = loadECfiles('textures/ecubes', 'sbox_interstellar', nobottom=True)
    myecube = EnvironmentCube(size=900.0, maptype='FACES', nobottom=True)
else:
    ectex = loadECfiles('textures/ecubes', 'skybox_hall')
    myecube = EnvironmentCube(size=900.0, maptype='FACES')

myecube.set_draw_details(shader, ectex)

rot = 0.0
tilt = 0.0
Пример #10
0
from pi3d.shape.EnvironmentCube import loadECfiles

from pi3d.util.Screenshot import screenshot
from pi3d.util import Utility

# Setup display and initialise pi3d
DISPLAY = Display.create(x=50, y=50)

shader = Shader('shaders/uv_flat')
#========================================

#select the environment cube with 'box'...
box = 3
if box == 0:
  ectex = [Texture('textures/ecubes/skybox_interstellar.jpg')]
  myecube = EnvironmentCube(size=900.0, maptype='CROSS')
elif box == 1:
  ectex = [Texture('textures/ecubes/SkyBox.jpg')]
  myecube = EnvironmentCube(size=900.0, maptype='HALFCROSS')
elif box == 2:
  ectex = loadECfiles('textures/ecubes','sbox_interstellar', nobottom=True)
  myecube = EnvironmentCube(size=900.0, maptype='FACES', nobottom=True)
else:
  ectex = loadECfiles('textures/ecubes','skybox_hall')
  myecube = EnvironmentCube(size=900.0, maptype='FACES')

myecube.set_draw_details(shader, ectex)

rot = 0.0
tilt = 0.0
Пример #11
0
light = Light((10, -10, 20))
# load shader
shader = Shader("shaders/uv_reflect")
flatsh = Shader("shaders/uv_flat")
defocus = Defocus()
#========================================

# Setting 2nd param to True renders 'True' Blending
# (this can be changed later to 'False' with 'rockimg2.blend = False')
groundimg = Texture("textures/stripwood.jpg")
monstimg = Texture("textures/pong3.png")
ballimg = Texture("textures/pong2.jpg")

# environment cube
ectex = Texture("textures/ecubes/skybox_stormydays.jpg")
myecube = EnvironmentCube(camera, light, 900.0,"CROSS")
myecube.set_draw_details(flatsh, [ectex])

#ball
maxdsz = 0.3
radius = 1.0
ball = Sphere(camera, light, radius,12,12,0.0,"sphere",-4,8,-7)
# Shape.set_draw_details is a wrapper for calling the method on each item in buf
# as is done explicitly here for no reason than to show that it can be done!
ball.buf[0].set_draw_details(shader,[ballimg], 0.0, 0.0)

#monster
monster = Plane(camera, light, 5.0, 5.0, "monster", 0,0,0, 0,0,0)
monster.buf[0].set_draw_details(flatsh, [monstimg])

# Create elevation map
Пример #12
0
from pi3d.event.Event import InputEvents

# Setup display and initialise pi3d
DISPLAY = Display.create(x=150, y=150, background=(0.4, 0.8, 0.8, 1))
shader = Shader("shaders/uv_reflect")
flatsh = Shader("shaders/uv_flat")
#############################

# Load textures
blockimg = Texture("textures/squareblocks4.png")
roofedgeimg = Texture("textures/roofedging.png")
roofimg = Texture("textures/Roof.png")
greenimg = Texture("textures/squareblocks4green.png")
ectex = loadECfiles("textures/ecubes", "sbox", "jpg")
myecube = EnvironmentCube(size=900.0, maptype="FACES")
myecube.set_draw_details(flatsh, ectex)

# Create elevation map
mapwidth=1000.0
mapdepth=1000.0
mapheight=60.0
floorimg = Texture("textures/dunes3_512.jpg")
bumpimg = Texture("textures/mudnormal.jpg")
mymap = ElevationMap(mapfile="textures/mountainsHgt2.png",
                     width=mapwidth, depth=mapdepth, height=mapheight,
                     divx=64, divy=64)
mymap.set_draw_details(shader,[floorimg, bumpimg],128.0, 0.0)
mymap.set_fog((0.3,0.25,0.1,0.2), 500.0)

#Create some random block models elsewhere on the map!