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)
# 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
tree2img = Texture("textures/tree2.png") tree1img = Texture("textures/tree1.png") hb2img = Texture("textures/hornbeam2.png") bumpimg = Texture("textures/grasstile_n.jpg") reflimg = Texture("textures/stars.jpg") rockimg = Texture("textures/rock1.jpg") clash = Clashtest() FOG = ((0.3, 0.3, 0.4, 0.5), 650.0) TFOG = ((0.1, 0.14, 0.12, 0.3), 150.0) #myecube = EnvironmentCube(900.0,"HALFCROSS") ectex = loadECfiles("textures/ecubes", "sbox") myecube = EnvironmentCube(size=900.0, maptype="FACES", name="cube") myecube.set_draw_details(flatsh, ectex) # Create elevation map mapwidth = 1000.0 mapdepth = 1000.0 mapheight = 60.0 mountimg1 = Texture("textures/mountains3_512.jpg") mymap = ElevationMap("textures/mountainsHgt.jpg", name="map", width=mapwidth, depth=mapdepth, height=mapheight, divx=32, divy=32) #testislands.jpg mymap.buf[0].set_draw_details(shader, [mountimg1, bumpimg, reflimg], 128.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
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