fixed: compile issue
[opensg.git] / Tools / osgBench / test1.py
blobd584489b524b6f24ccf306881c6c75feaa7a7aad
1 # Simple OpenSG benchmark
2 from osgbench import *
4 # Define the Window's parameters
5 win=TestWindow()
6 win.setSize(300,300)
7 win.open()
9 # Create the scene
10 scene=Group()
12 nc=12
14 for i in range(-nc,nc):
15 for j in range(-nc,nc):
16 for k in range(-nc,nc):
17 trans=Transform()
18 scene.addChild(trans)
19 trans.setTranslation(i*2, j*2, k*2)
20 geo=makeBox(1,1,1, 1,1,1)
21 trans.addChild(geo)
23 scene.addChild(makeBox(1,1,1, 1,1,1))
25 # Define the Test(s)
26 test=Test()
27 test.setWindow(win)
28 test.setNFrames(100)
29 test.setScene(scene)
31 test.addFov(90)
32 test.makeOrbit(0,1,0)
34 test.run()
36 print "%d transformed cubes took %f seconds: %f fps" % ((nc*2)*(nc*2)*(nc*2), test.getTime(), test.getFPS())
38 # Second test scene
40 scene=Group()
42 for i in range(-nc,nc):
43 for j in range(-nc,nc):
44 for k in range(-nc,nc):
45 geo=makeBox(1,1,1, 1,1,1)
46 geo.translate(i*2, j*2, k*2)
47 scene.addChild(geo)
49 scene.addChild(makeBox(1,1,1, 1,1,1))
51 test.setScene(scene)
52 test.run()
54 print "%d cubes took %f seconds: %f fps" % ((nc*2)*(nc*2)*(nc*2), test.getTime(), test.getFPS())
56 # Third test scene
58 scene=makeBox(1,1,1, 1,1,1)
60 for i in range(-nc,nc):
61 for j in range(-nc,nc):
62 for k in range(-nc,nc):
63 geo=makeBox(1,1,1, 1,1,1)
64 geo.translate(i*2, j*2, k*2)
65 scene.merge(geo)
67 test.setScene(scene)
68 test.run()
70 print "%d merged cubes took %f seconds: %f fps" % ((nc*2)*(nc*2)*(nc*2), test.getTime(), test.getFPS())