Exemple #1
0
Light((5, -10, -20), (0.6, 0.6, 0.5), (0.3, 0.3, 0.4))

# 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()
Exemple #2
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)
Exemple #3
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

#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()
mymouse = Mouse()
mymouse.start()
mtrx = Matrix()

omx = mymouse.x
Exemple #4
0
from pi3d.shape.Sphere import Sphere

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)
Exemple #5
0
# 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

# Fetch key presses
mykeys = Keyboard()
mymouse = Mouse(restrict=False)
mymouse.start()
Exemple #6
0
# 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

# Fetch key presses
mykeys = Keyboard()
mymouse = Mouse(restrict=False)
mymouse.start()
Exemple #7
0
# 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)