Exemplo n.º 1
0
from miru import camera
from miru import utils
from miru import input
from miru import graphics
from miru import core
from miru.ext import geom

import os
P = os.path.join


# initialize the window
w = TestWindow(680, 400)
w.set_vsync(False)

utils.addFpsDisplay()

context.window = w
context.control = input.SimpleMouseControl()
context.camera.pos += (0,1,2)
context.camera.angle = (10,0,0)

#context.handle.accessible = True

o = graphics.load_wobj(P('docs','demo','alien.obj'))
o.pos += (0,0.95,-0.6)
context.add_object(o)

# Play around with the spot light
context.camera.lights = camera.LightGroup([
    camera.DirectionalLight(diffuse=(0.1,0.1,0.1,1)),
Exemplo n.º 2
0
    projections = itertools.cycle([camera.OrthographicProjection(),
        camera.PerspectiveProjection()])

    def on_key_press(self, symbol, modifiers):
        super(ProjectionWindow, self).on_key_press(symbol, modifiers)
        if symbol == key.P:
            proj = self.projections.next()
            print ' > changing projection to', proj
            context.camera.projection = proj


w = ProjectionWindow(680, 400)
w.set_vsync(False)

utils.addFpsDisplay(context)

context.window = w
for pos in ((1,1,-4),):
    o = w._load_object()
    o.pos = pos
context.control = input.SimpleMouseControl()

while not w.has_exit:
    clock.tick()
    w.clear()
    w.dispatch_events()
    context.render()
    w.flip()
w.close()