|
Revision 446, 1.5 kB
(checked in by dirk, 2 years ago)
|
Added RenderAction? RednerTraversal? comparison.
Added Window access
|
- Property svn:eol-style set to
native
- Property svn:executable set to
*
- Property svn:keywords set to
Id
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
from osgbench import * |
|---|
| 3 |
from sys import argv, exit, stdout |
|---|
| 4 |
import getopt |
|---|
| 5 |
from string import atof, atoi |
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
ups="0,0,1" |
|---|
| 10 |
frames=100 |
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
try: |
|---|
| 14 |
opts, args = getopt.getopt(argv[1:], "u:f:h", ["up=", "frames=", "help"]) |
|---|
| 15 |
except getopt.GetoptError: |
|---|
| 16 |
exit(2) |
|---|
| 17 |
|
|---|
| 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 |
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
scene=Group() |
|---|
| 32 |
|
|---|
| 33 |
for i in args: |
|---|
| 34 |
print "Loading %s..." % i, |
|---|
| 35 |
stdout.flush() |
|---|
| 36 |
scene.addChild(loadScene(i)) |
|---|
| 37 |
print "done" |
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
win=TestWindow() |
|---|
| 42 |
win.setSize(900, 900) |
|---|
| 43 |
win.open() |
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
test=Test() |
|---|
| 47 |
test.setWindow(win) |
|---|
| 48 |
test.setScene(scene) |
|---|
| 49 |
test.setNFrames(frames) |
|---|
| 50 |
|
|---|
| 51 |
test.clear() |
|---|
| 52 |
test.addFov(60) |
|---|
| 53 |
up=ups.split(',') |
|---|
| 54 |
test.makeOrbit(atof(up[0]),atof(up[1]),atof(up[2])) |
|---|
| 55 |
|
|---|
| 56 |
test.useRenderTraversal(True) |
|---|
| 57 |
|
|---|
| 58 |
test.setStatistics(1) |
|---|
| 59 |
|
|---|
| 60 |
test.run() |
|---|
| 61 |
print "Path took %f seconds: %f fps" % (test.getTime(), test.getFPS()) |
|---|
| 62 |
|
|---|
| 63 |
culled = 0 |
|---|
| 64 |
culltested = 0 |
|---|
| 65 |
|
|---|
| 66 |
for i in range(0,test.getNRenderedFrames()): |
|---|
| 67 |
culltested += test.getStatValue("OC-Tests", i) |
|---|
| 68 |
culled += test.getStatValue("OC-Invisible", i) |
|---|
| 69 |
|
|---|
| 70 |
print "%d nodes oc-tested, %d nodes invisible.\n" % (culltested, culled) |
|---|
| 71 |
|
|---|
| 72 |
win.close() |
|---|
| 73 |
|
|---|