|
Revision 213, 0.8 kB
(checked in by dirk, 2 years ago)
|
Added simple benchmarking toolkit. Not for permanent use, just for now.
|
- Property svn:executable set to
*
|
| Line | |
|---|
| 1 |
from osgbench import * |
|---|
| 2 |
t=TestWindow() |
|---|
| 3 |
t.setSize(300,300) |
|---|
| 4 |
t.open() |
|---|
| 5 |
|
|---|
| 6 |
test=Test() |
|---|
| 7 |
test.setWindow(t) |
|---|
| 8 |
test.setHeadlight(1) |
|---|
| 9 |
test.setNFrames(100) |
|---|
| 10 |
|
|---|
| 11 |
nc=1 |
|---|
| 12 |
|
|---|
| 13 |
images = [] |
|---|
| 14 |
|
|---|
| 15 |
for res in (1,2,4,8,16): |
|---|
| 16 |
scene=Group() |
|---|
| 17 |
for i in range(-nc,nc): |
|---|
| 18 |
for j in range(-nc,nc): |
|---|
| 19 |
geo=makeBox(.8,.8,.8,res,res,res) |
|---|
| 20 |
geo.setDlistCache(0) |
|---|
| 21 |
geo.translate(i*2, j*2, 0) |
|---|
| 22 |
scene.addChild(geo) |
|---|
| 23 |
addRef(scene) |
|---|
| 24 |
|
|---|
| 25 |
test=Test() |
|---|
| 26 |
test.setWindow(t) |
|---|
| 27 |
test.setScene(scene) |
|---|
| 28 |
test.setHeadlight(1) |
|---|
| 29 |
test.setNFrames(100) |
|---|
| 30 |
|
|---|
| 31 |
test.clear() |
|---|
| 32 |
test.addFov(90) |
|---|
| 33 |
test.makeOrbit(0,1,0) |
|---|
| 34 |
|
|---|
| 35 |
print "%d res" % res |
|---|
| 36 |
test.run() |
|---|
| 37 |
|
|---|
| 38 |
images = images + [test.snapshot(25+res)] |
|---|
| 39 |
|
|---|
| 40 |
diff = images[0].clone() |
|---|
| 41 |
diff.diff(images[3]) |
|---|
| 42 |
diff.write("difftest.png") |
|---|
| 43 |
images[0].write("difftest2.png") |
|---|