Example #1
0
File: Water.py Project: Arexxk/pi3d
  for j in range(num[1]):
    myshape.add(asphere, -num[0]*0.9 + 1.8*i, -num[1]*0.9 +1.8*j, 0.0)

myshape.position(0.0, 0.0, 5)
myshape.set_draw_details(shader, [shapeimg, shapebump, shapeshine], 1.0, 0.1)
myshape.set_material((1.0, 0.5, 0.2, 0.5))

mywater = Plane(w=130.0, h=130.0)
mywater.set_draw_details(matsh, [waterbump[0], shapeshine], 12.0, 0.6)
mywater.set_material((0.0, 0.05, 0.1))
mywater.set_fog((0.4, 0.6, 0.8, 0.0),150)
mywater.rotateToX(90.001)
mywater.position(0.0, -2.0, 0.0)

arialFont = Ttffont("fonts/FreeMonoBoldOblique.ttf", "#dd00aa")   #load ttf font and set the font colour to 'raspberry'
mystring = String(font=arialFont, string="Now the Raspberry Pi really does rock")
mystring.translate(0.0, 0.0, 1)
mystring.set_shader(flatsh)

tick = 0
av_fps = 0
i_n=0
spf = 0.1 # seconds per frame, i.e. water image change
next_time = time.time() + spf
dx = 0.02
offset = 0.0 # uv offset
do = -0.001 # uv increment

# Fetch key presses.
mykeys = Keyboard()
fr = 0
Example #2
0
File: Blur.py Project: Arexxk/pi3d
myshape = MergeShape(camera=persp_cam) #specify perspective view
asphere = Sphere(sides=16, slices=16)
myshape.radialCopy(asphere, step=72)
myshape.position(0.0, 0.0, 5.0)
myshape.set_draw_details(shader, [shapeimg, shapebump, shapeshine], 8.0, 0.1)

mysprite = Sprite(w=10.0, h=10.0, camera=persp_cam)
mysprite.position(0.0, 0.0, 15.0)
mysprite.set_draw_details(flatsh, [shapebump])

tick=0
next_time = time.time()+2.0

#load ttf font and set the font colour to 'raspberry'
arialFont = Ttffont("fonts/FreeMonoBoldOblique.ttf", "#dd00aa")
mystring = String(font=arialFont, string="blurring with distance!",
                  camera=ortho_cam, z=1.0, is_3d=False) # orthographic view
mystring.set_shader(flatsh)

# Fetch key presses.
mykeys = Keyboard()

# Display scene and rotate shape
while DISPLAY.loop_running():

  defocus.start_blur()
  # 1. drawing objects now renders to an offscreen texture ####################
  mysprite.draw()
  myshape.draw()
  defocus.end_blur()
  # 2. drawing now back to screen. The texture can now be used by defocus.blur()
Example #3
0
                              0.0)

#avatar camera
avhgt = 2.0
xm = 0.0
zm = 0.0
ym = 0.0
lastX0 = 0.0
lastZ0 = 0.0
camera.position((xm, 2 + ym, -maphalf - 2.5))

arialFont = Font(
    "AR_CENA",
    "#dd00aa")  #load AR_CENA font and set the font colour to 'raspberry'
score = [0, 0]
score0 = String(camera, light, arialFont, str(score[0]), 0, 12, 0, 0.05, 0.05)
score0.set_shader(flatsh)
score1 = String(camera, light, arialFont, str(score[1]), 0, 12, 0, 0.05, 0.05)
score1.set_shader(flatsh)

#sphere loc and speed
sx, sy, sz = 0, 5, 0
dsx, dsy, dsz = 0.2, 0.0, -0.1
gravity = 0.02
#monster loc and speed
rx, ry, rz = 0, 0, -maphalf
drx, dry, drz = 0, 0, 0
max_speed = 0.2

# Fetch key presses
mykeys = Keyboard()
Example #4
0
myshape.position(0.0, 0.0, 5)
myshape.set_draw_details(shader, [shapeimg, shapebump, shapeshine], 1.0, 0.1)
myshape.set_material((1.0, 0.5, 0.2, 0.5))

mywater = Plane(w=130.0, h=130.0)
mywater.set_draw_details(matsh, [waterbump[0], shapeshine], 12.0, 0.6)
mywater.set_material((0.0, 0.05, 0.1))
mywater.set_fog((0.4, 0.6, 0.8, 0.0), 150)
mywater.rotateToX(90.001)
mywater.position(0.0, -2.0, 0.0)

arialFont = Ttffont(
    "fonts/FreeMonoBoldOblique.ttf",
    "#dd00aa")  #load ttf font and set the font colour to 'raspberry'
mystring = String(font=arialFont,
                  string="Now the Raspberry Pi really does rock")
mystring.translate(0.0, 0.0, 1)
mystring.set_shader(flatsh)

tick = 0
av_fps = 0
i_n = 0
spf = 0.1  # seconds per frame, i.e. water image change
next_time = time.time() + spf
dx = 0.02
offset = 0.0  # uv offset
do = -0.001  # uv increment

# Fetch key presses.
mykeys = Keyboard()
fr = 0
Example #5
0
myshape.radialCopy(asphere, step=72)
myshape.position(0.0, 0.0, 5.0)
myshape.set_draw_details(shader, [shapeimg, shapebump, shapeshine], 8.0, 0.1)

mysprite = Sprite(w=10.0, h=10.0, camera=persp_cam)
mysprite.position(0.0, 0.0, 15.0)
mysprite.set_draw_details(flatsh, [shapebump])

tick = 0
next_time = time.time() + 2.0

#load ttf font and set the font colour to 'raspberry'
arialFont = Ttffont("fonts/FreeMonoBoldOblique.ttf", "#dd00aa")
mystring = String(font=arialFont,
                  string="blurring with distance!",
                  camera=ortho_cam,
                  z=1.0,
                  is_3d=False)  # orthographic view
mystring.set_shader(flatsh)

# Fetch key presses.
mykeys = Keyboard()

# Display scene and rotate shape
while DISPLAY.loop_running():

    defocus.start_blur()
    # 1. drawing objects now renders to an offscreen texture ####################
    mysprite.draw()
    myshape.draw()
    defocus.end_blur()
Example #6
0
File: Pong.py Project: Arexxk/pi3d
                     width=mapwidth, depth=mapdepth, height=mapheight,
                     divx=32, divy=32, ntiles=4, name="sub")
mymap.buf[0].set_draw_details(shader, [groundimg, groundimg, ballimg], 1.0, 0.0)

#avatar camera
avhgt = 2.0
xm = 0.0
zm = 0.0
ym = 0.0
lastX0 = 0.0
lastZ0 = 0.0
camera.position((xm, 2 + ym, -maphalf - 2.5))

arialFont = Font("AR_CENA","#dd00aa")   #load AR_CENA font and set the font colour to 'raspberry'
score = [0,0]
score0 = String(camera, light,  arialFont, str(score[0]), 0, 12, 0, 0.05, 0.05)
score0.set_shader(flatsh)
score1 = String(camera, light,  arialFont, str(score[1]), 0, 12, 0, 0.05, 0.05)
score1.set_shader(flatsh)

#sphere loc and speed
sx, sy, sz = 0, 5, 0
dsx, dsy, dsz = 0.2, 0.0, -0.1
gravity = 0.02
#monster loc and speed
rx, ry, rz = 0, 0, -maphalf
drx, dry, drz = 0, 0, 0
max_speed = 0.2

# Fetch key presses
mykeys = Keyboard()