Esempio n. 1
0
def camera_demo(transparent = 0):
	import soya.cube
	window = soya.gui.Window(root, u"Camera demo")
	scene = soya.World()
	if transparent: scene.atmosphere = soya.NoBackgroundAtmosphere()
	light = soya.Light(scene)
	light.set_xyz(0.5, 0.0, 2.0)
	camera = soya.Camera(scene)
	camera.z = 2.0
	camera.partial = 1
	cube = soya.cube.Cube(scene, red)
	cube.advance_time = lambda proportion: cube.rotate_lateral(proportion)
	soya.gui.CameraViewport(window, camera)
	soya.MAIN_LOOP.scenes.append(scene)
Esempio n. 2
0
soya.path.append(os.path.join(os.path.dirname(sys.argv[0]), "data"))

soya.init(width = 640, height = 480)


red = soya.Material()
red.diffuse = (1.0, 0.0, 0.0, 1.0)

root  = soya.gui.RootLayer(None)
import soya.cube
scene = soya.World()
light = soya.Light(scene)
light.set_xyz(0.5, 0.0, 2.0)
camera = soya.Camera(scene)
camera.z = 2.0
camera.partial = 1
cube = soya.cube.Cube(scene, red)
cube.advance_time = lambda proportion: cube.rotate_lateral(proportion)
soya.gui.CameraViewport(root, camera)

window = soya.gui.Window(root, u"Soya GUI demo: window over camera", closable = 0)
table = soya.gui.VTable(window)
soya.gui.CancelButton(table, u"Quit", on_clicked = sys.exit)

print root.widgets

soya.set_root_widget(root)
soya.MainLoop(scene).main_loop()