From b6b9e4bc7edab0f68753ea72676b47be6a749a9b Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 4 Jul 2006 09:46:41 +0000 Subject: [PATCH] fixed warning and add a few extra tests --- examples/osgunittests/performance.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/examples/osgunittests/performance.cpp b/examples/osgunittests/performance.cpp index bdb77a91c..53697adf6 100644 --- a/examples/osgunittests/performance.cpp +++ b/examples/osgunittests/performance.cpp @@ -3,6 +3,11 @@ #include #include +#include +#include +#include +#include + struct Benchmark { @@ -139,6 +144,15 @@ struct CustomVisitor virtual ~CustomVisitor() {} }; +class CustomNodeVisitor : public osg::NodeVisitor +{ +public: + void apply(osg::Node&) { } + void apply(osg::Group&) { } + void apply(osg::Transform&) { } +}; + + void runPerformanceTests() { Benchmark benchmark; @@ -179,4 +193,13 @@ void runPerformanceTests() RUN(benchmark, (static_cast(vm4))->method(), iterations) RUN(benchmark, { VirtualMethod mm; mm.method(); }, iterations) RUN(benchmark, { VirtualMethod2 mm; mm.method(); }, iterations) + + + osg::ref_ptr group = new osg::Group; + osg::ref_ptr mt = new osg::MatrixTransform; + osg::Node* m = mt.get(); + CustomNodeVisitor cnv; + RUN(benchmark, { osg::MatrixTransform* mtl = dynamic_cast(m); if (mtl) cnv.apply(*mtl); }, 1000) + RUN(benchmark, { m->accept(cnv); }, 10000) + }