fixed: auto_ptr -> unique_ptr
[opensg.git] / Tools / osgBench / test_occ.py
blob7ea90e6fa33950b9cbbcbc6e3f620d0e0f536d3c
1 # Simple OpenSG Benchmark
2 from osgbench import *
3 from sys import argv, exit, stdout
4 import getopt
5 from string import atof, atoi
7 # options
9 ups="0,0,1"
10 frames=100
12 # command line handling
13 try:
14 opts, args = getopt.getopt(argv[1:], "u:f:h", ["up=", "frames=", "help"])
15 except getopt.GetoptError:
16 exit(2)
18 for opt, arg in opts:
19 if opt in ("-h", "--help"):
20 print "Usage: test_occ up=0,1,0 frames=100 <model file>"
21 sys.exit()
22 elif opt == '-u':
23 ups=arg
24 print "Up set to ", ups
25 elif opt == '-f':
26 frames=atoi(arg)
27 print "Frames set to ", frames
30 # Load the scene
31 scene=Group()
33 for i in args:
34 print "Loading %s..." % i,
35 stdout.flush()
36 scene.addChild(loadScene(i))
37 print "done"
40 # Define the Window's parameters
41 win=TestWindow()
42 win.setSize(900, 900)
43 win.open()
45 # Define the Test(s)
46 test=Test()
47 test.setWindow(win)
48 test.setScene(scene)
49 test.setNFrames(frames)
51 test.clear()
52 test.addFov(60)
53 up=ups.split(',')
54 test.makeOrbit(atof(up[0]),atof(up[1]),atof(up[2]))
55 #test.setIgnoreGeometry(True)
56 test.useRenderTraversal(True)
58 test.setStatistics(1)
60 test.run()
61 print "Path took %f seconds: %f fps" % (test.getTime(), test.getFPS())
63 culled = 0
64 culltested = 0
66 for i in range(0,test.getNRenderedFrames()):
67 culltested += test.getStatValue("OC-Tests", i)
68 culled += test.getStatValue("OC-Invisible", i)
70 print "%d nodes oc-tested, %d nodes invisible.\n" % (culltested, culled)
72 win.close()