|
Revision 13041, 1.5 kB
(checked in by robert, 15 months ago)
|
|
Ran script to remove trailing spaces and tabs
|
-
Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | #include <osgPresentation/CompileSlideCallback> |
|---|
| 14 | |
|---|
| 15 | #include <osgUtil/GLObjectsVisitor> |
|---|
| 16 | |
|---|
| 17 | using namespace osgPresentation; |
|---|
| 18 | |
|---|
| 19 | void CompileSlideCallback::operator()(const osg::Camera & camera) const |
|---|
| 20 | { |
|---|
| 21 | osg::GraphicsContext* context = const_cast<osg::GraphicsContext*>(camera.getGraphicsContext()); |
|---|
| 22 | if (!context) return; |
|---|
| 23 | |
|---|
| 24 | osg::State* state = context->getState(); |
|---|
| 25 | if (!state) return; |
|---|
| 26 | |
|---|
| 27 | const osg::FrameStamp* fs = state->getFrameStamp(); |
|---|
| 28 | if (!fs) return; |
|---|
| 29 | |
|---|
| 30 | if (_needCompile) |
|---|
| 31 | { |
|---|
| 32 | _frameNumber = fs->getFrameNumber(); |
|---|
| 33 | _needCompile = false; |
|---|
| 34 | } |
|---|
| 35 | |
|---|
| 36 | if (_frameNumber!=fs->getFrameNumber()) return; |
|---|
| 37 | |
|---|
| 38 | osgUtil::GLObjectsVisitor globjVisitor(osgUtil::GLObjectsVisitor::COMPILE_DISPLAY_LISTS| |
|---|
| 39 | osgUtil::GLObjectsVisitor::COMPILE_STATE_ATTRIBUTES); |
|---|
| 40 | |
|---|
| 41 | globjVisitor.setTraversalMode(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN); |
|---|
| 42 | |
|---|
| 43 | globjVisitor.setNodeMaskOverride(0xffffffff); |
|---|
| 44 | |
|---|
| 45 | globjVisitor.setState(state); |
|---|
| 46 | |
|---|
| 47 | _sceneToCompile->accept(globjVisitor); |
|---|
| 48 | } |
|---|