Friday, April 20, 2007

another Pyramid demo

I've been working to get .soy file loading up using a new Python API, will likely have it in by Sunday. Once it's finished we'll be able to use media exported from Blender and GIMP.

In the meantime please enjoy this quick but beautiful demo using the test Pyramid class (works on r34):

import soy
from time import sleep
from random import random

def rand(x) :
  return (random() * x * 2) - x

def hone(p) :
  v = [rand(5), rand(5), rand(5)]
  for i in range(3) :
    if p[i]*v[i] > 0 :
      v[i] = v[i]*-1
  return v

win = soy.Window('Pyramid Space', size=(800,600))
sce = soy.Scene()
cam = soy.bodies.Camera(sce)
pro = soy.widgets.Projector(win, size=win.size, camera=cam)
pys = []
for i in range(1000) :
  pys[-1].position = (rand(50), rand(50), rand(50))
  pys[-1].rotation = (rand(3), rand(3), rand(3))
while True :
  cam.rotation = (rand(.5), rand(.5), rand(.5))
  cam.velocity = hone(cam.position)

No comments: