From 7d5c81bf5e045e70cc9a70f35e84d21c6913984e Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 20 Feb 2006 21:05:23 +0000 Subject: [PATCH] From Ulrich Hertlein, spelling corrections and a few Doxgen comments. --- examples/osganimate/osganimate.cpp | 2 +- .../osgmultiplecameras/osgmultiplecameras.cpp | 2 +- include/osg/CameraNode | 11 ++++++-- include/osgSim/OverlayNode | 10 +++---- include/osgSim/VisibilityGroup | 28 +++++++++++++++---- include/osgUtil/SceneView | 6 ++-- src/osg/CameraNode.cpp | 6 ++-- src/osgPlugins/osg/CameraNode.cpp | 11 +++++--- src/osgPlugins/pfb/ReaderWriterPFB.cpp | 13 +++++++++ src/osgSim/OverlayNode.cpp | 6 ++-- src/osgUtil/CullVisitor.cpp | 4 +-- src/osgUtil/IntersectVisitor.cpp | 4 +-- 12 files changed, 72 insertions(+), 31 deletions(-) diff --git a/examples/osganimate/osganimate.cpp b/examples/osganimate/osganimate.cpp index c6d9f5fae..2af381168 100644 --- a/examples/osganimate/osganimate.cpp +++ b/examples/osganimate/osganimate.cpp @@ -187,7 +187,7 @@ osg::Node* createModel(bool overlay) if (overlay) { osgSim::OverlayNode* overlayNode = new osgSim::OverlayNode; - overlayNode->setContinousUpdate(true); + overlayNode->setContinuousUpdate(true); overlayNode->setOverlaySubgraph(movingModel); overlayNode->addChild(baseModel); root->addChild(overlayNode); diff --git a/examples/osgmultiplecameras/osgmultiplecameras.cpp b/examples/osgmultiplecameras/osgmultiplecameras.cpp index 6599ee48c..3a72e000c 100644 --- a/examples/osgmultiplecameras/osgmultiplecameras.cpp +++ b/examples/osgmultiplecameras/osgmultiplecameras.cpp @@ -38,7 +38,7 @@ osg::Node* createRearView(osg::Node* subgraph, const osg::Vec4& clearColour) // set the view matrix camera->setCullingActive(false); camera->setReferenceFrame(osg::Transform::RELATIVE_RF); - camera->setTransformOrder(osg::CameraNode::POST_MULTIPLE); + camera->setTransformOrder(osg::CameraNode::POST_MULTIPLY); camera->setProjectionMatrix(osg::Matrixd::scale(-1.0f,1.0f,1.0f)); camera->setViewMatrix(osg::Matrixd::rotate(osg::inDegrees(180.0f),0.0f,1.0f,0.0f)); diff --git a/include/osg/CameraNode b/include/osg/CameraNode index 8c8903019..cfd40daf5 100644 --- a/include/osg/CameraNode +++ b/include/osg/CameraNode @@ -85,11 +85,14 @@ class OSG_EXPORT CameraNode : public Transform, public CullSettings enum TransformOrder { - PRE_MULTIPLE, - POST_MULTIPLE + PRE_MULTIPLY, + POST_MULTIPLY }; + /** Set the transformation order for world-to-local and local-to-world transformation.*/ void setTransformOrder(TransformOrder order) { _transformOrder = order; } + + /** Get the transformation order.*/ TransformOrder getTransformOrder() const { return _transformOrder; } @@ -195,12 +198,16 @@ class OSG_EXPORT CameraNode : public Transform, public CullSettings SEPERATE_WINDOW }; + /** Set the render target.*/ void setRenderTargetImplementation(RenderTargetImplementation impl); + /** Set the render target and fall-back that's used if the former isn't available.*/ void setRenderTargetImplementation(RenderTargetImplementation impl, RenderTargetImplementation fallback); + /** Get the render target.*/ RenderTargetImplementation getRenderTargetImplementation() const { return _renderTargetImplementation; } + /** Get the render target fallback.*/ RenderTargetImplementation getRenderTargetFallback() const { return _renderTargetFallback; } diff --git a/include/osgSim/OverlayNode b/include/osgSim/OverlayNode index c6c1fab8b..a437e0d6e 100644 --- a/include/osgSim/OverlayNode +++ b/include/osgSim/OverlayNode @@ -50,10 +50,10 @@ class OSGSIM_EXPORT OverlayNode : public osg::Group void dirtyOverlayTexture(); /** Set whether the OverlayNode should update the overlay texture on every frame.*/ - void setContinousUpdate(bool update) { _continousUpdate = update; } + void setContinuousUpdate(bool update) { _continuousUpdate = update; } /** Get whether the OverlayNode should update the overlay texture on every frame.*/ - bool getContinousUpdate() const { return _continousUpdate; } + bool getContinuousUpdate() const { return _continuousUpdate; } /** Set the clear color to use when rendering the overlay subgraph.*/ @@ -66,7 +66,7 @@ class OSGSIM_EXPORT OverlayNode : public osg::Group void setTexEnvMode(GLenum mode); /** Get the TexEnv mode used to combine the overlay texture with the base color/texture of the OverlayNode's decorate subgraph.*/ - GLenum getTexEnvMode() { return _texEnvMode; } + GLenum getTexEnvMode() const { return _texEnvMode; } /** Set the texture unit that the texture should be assigned to.*/ void setOverlayTextureUnit(unsigned int unit); @@ -101,7 +101,7 @@ class OSGSIM_EXPORT OverlayNode : public osg::Group osg::ref_ptr _camera; - // overaly subgraph is render to a texture + // overlay subgraph is render to a texture osg::ref_ptr _overlaySubgraph; // texgen node to generate the tex coordinates for us @@ -116,7 +116,7 @@ class OSGSIM_EXPORT OverlayNode : public osg::Group unsigned int _textureSizeHint; osg::ref_ptr _texture; - bool _continousUpdate; + bool _continuousUpdate; osg::Polytope _textureFrustum; }; diff --git a/include/osgSim/VisibilityGroup b/include/osgSim/VisibilityGroup index 9daea36ee..2453f3d5d 100644 --- a/include/osgSim/VisibilityGroup +++ b/include/osgSim/VisibilityGroup @@ -22,6 +22,11 @@ namespace osgSim { +/** VisibilityGroup renders (traverses) it's children only when the camera is inside a specified visibility volume. + * The visibility volume is intersected with a line segment that extends from + * the current camera's eye-point along the view vector for a given segment length. + * If an intersection is detected then the node's children are traversed. + */ class OSGSIM_EXPORT VisibilityGroup : public osg::Group { public : @@ -34,19 +39,32 @@ class OSGSIM_EXPORT VisibilityGroup : public osg::Group META_Node(osgSim, VisibilityGroup); virtual void traverse(osg::NodeVisitor& nv); - + + /** Set the subgraph that is intersected for the visibility determination.*/ void setVisibilityVolume(osg::Node* node) { _visibilityVolume = node; } + + /** Get the subgraph that is intersected for the visibility determination.*/ osg::Node* getVisibilityVolume() { return _visibilityVolume.get(); } + + /** Get the const subgraph that is intersected for the visibility determination.*/ const osg::Node* getVisibilityVolume() const { return _visibilityVolume.get(); } - + + /** Set the traversal mask for the intersection testing.*/ void setVolumeIntersectionMask(osg::Node::NodeMask mask) { _volumeIntersectionMask = mask; } + + /** Get the traversal mask for the intersection testing.*/ osg::Node::NodeMask getVolumeIntersectionMask() const { return _volumeIntersectionMask; } - + + /** Set the length of the intersection segment. + * The segments extends this many database units from the camera eye-point along the look vector. + * If this is left at zero then the diameter of the bounding sphere of the visibility volume is used.*/ void setSegmentLength(float length) { _segmentLength = length; } + + /** Get the length of the intersection segment.*/ float getSegmentLength() const { return _segmentLength; } - + protected : - + virtual ~VisibilityGroup() {} osg::ref_ptr _visibilityVolume; diff --git a/include/osgUtil/SceneView b/include/osgUtil/SceneView index ef20b7d12..10114886c 100644 --- a/include/osgUtil/SceneView +++ b/include/osgUtil/SceneView @@ -28,7 +28,7 @@ namespace osgUtil { /** - * SceneView is literally a view of a scene, encapsulating the 'camera' + * SceneView is literaly a view of a scene, encapsulating the 'camera' * (not to be confused with Producer::Camera) (modelview+projection matrices), * global state, lights and the scene itself. Provides * methods for setting up the view and rendering it. @@ -122,7 +122,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting const osg::Vec4& getClearColor() const { return _camera->getClearColor(); } - /** Mannually set the redraw interlaced stereo stencil mask request flag to control whether to redraw the stencil buffer on the next frame.*/ + /** Manually set the redraw interlaced stereo stencil mask request flag to control whether to redraw the stencil buffer on the next frame.*/ void setRedrawInterlacedStereoStencilMask(bool flag) { _redrawInterlacedStereoStencilMask = flag; } /** Get the redraw interlaced stereo stencil mask request flag.*/ @@ -207,7 +207,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced, public osg::CullSetting /** Get the const projection matrix.*/ const osg::Matrixd& getProjectionMatrix() const { return _camera->getProjectionMatrix(); } - /** Get the othographic settings of the orthographic projection matrix. + /** Get the orthographic settings of the orthographic projection matrix. * Returns false if matrix is not an orthographic matrix, where parameter values are undefined.*/ bool getProjectionMatrixAsOrtho(double& left, double& right, double& bottom, double& top, diff --git a/src/osg/CameraNode.cpp b/src/osg/CameraNode.cpp index e69dbb147..5dc8a2411 100644 --- a/src/osg/CameraNode.cpp +++ b/src/osg/CameraNode.cpp @@ -18,7 +18,7 @@ using namespace osg; CameraNode::CameraNode(): _clearColor(osg::Vec4(0.0f,0.0f,0.0f,1.0f)), _clearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT), - _transformOrder(PRE_MULTIPLE), + _transformOrder(PRE_MULTIPLY), _renderOrder(POST_RENDER), _drawBuffer(GL_NONE), _readBuffer(GL_NONE), @@ -236,7 +236,7 @@ bool CameraNode::computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const { if (_referenceFrame==RELATIVE_RF) { - if (_transformOrder==PRE_MULTIPLE) + if (_transformOrder==PRE_MULTIPLY) { matrix.preMult(_viewMatrix); } @@ -258,7 +258,7 @@ bool CameraNode::computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const if (_referenceFrame==RELATIVE_RF) { - if (_transformOrder==PRE_MULTIPLE) + if (_transformOrder==PRE_MULTIPLY) { // note doing inverse so pre becomes post. matrix.postMult(inverse); diff --git a/src/osgPlugins/osg/CameraNode.cpp b/src/osgPlugins/osg/CameraNode.cpp index 41ac04107..b0dcc7eb6 100644 --- a/src/osgPlugins/osg/CameraNode.cpp +++ b/src/osgPlugins/osg/CameraNode.cpp @@ -71,8 +71,11 @@ bool CameraNode_readLocalData(Object& obj, Input& fr) if (fr.matchSequence("transformOrder %w")) { - if (fr[1].matchWord("PRE_MULTIPLE")) camera.setTransformOrder(osg::CameraNode::PRE_MULTIPLE); - else if (fr[1].matchWord("POST_MULTIPLE")) camera.setTransformOrder(osg::CameraNode::POST_MULTIPLE); + if (fr[1].matchWord("PRE_MULTIPLY")) camera.setTransformOrder(osg::CameraNode::PRE_MULTIPLY); + else if (fr[1].matchWord("POST_MULTIPLY")) camera.setTransformOrder(osg::CameraNode::POST_MULTIPLY); + // the following are for backwards compatibility. + else if (fr[1].matchWord("PRE_MULTIPLE")) camera.setTransformOrder(osg::CameraNode::PRE_MULTIPLY); + else if (fr[1].matchWord("POST_MULTIPLE")) camera.setTransformOrder(osg::CameraNode::POST_MULTIPLY); fr += 2; iteratorAdvanced = true; @@ -235,8 +238,8 @@ bool CameraNode_writeLocalData(const Object& obj, Output& fw) fw.indent()<<"transformOrder "; switch(camera.getTransformOrder()) { - case(osg::CameraNode::PRE_MULTIPLE): fw <<"PRE_MULTIPLE"< #include +#include #include #include @@ -223,6 +224,18 @@ void ReaderWriterPFB::initPerformer() // } pfdInitConverter(".pfb"); + /* + * Tell Performer to look in OSG search path + */ + const osgDB::FilePathList& filePath = osgDB::Registry::instance()->getDataFilePathList(); + std::string path = ""; + for (unsigned int i = 0; i < filePath.size(); i++) { + if (i != 0) + path += ":"; + path += filePath[i]; + } + pfFilePath(path.c_str()); + pfConfig(); } diff --git a/src/osgSim/OverlayNode.cpp b/src/osgSim/OverlayNode.cpp index 39cdf2d9b..932092769 100644 --- a/src/osgSim/OverlayNode.cpp +++ b/src/osgSim/OverlayNode.cpp @@ -26,7 +26,7 @@ OverlayNode::OverlayNode(): _texEnvMode(GL_DECAL), _textureUnit(1), _textureSizeHint(1024), - _continousUpdate(false) + _continuousUpdate(false) { init(); } @@ -37,7 +37,7 @@ OverlayNode::OverlayNode(const OverlayNode& copy, const osg::CopyOp& copyop): _texEnvMode(copy._texEnvMode), _textureUnit(copy._textureUnit), _textureSizeHint(copy._textureSizeHint), - _continousUpdate(copy._continousUpdate) + _continuousUpdate(copy._continuousUpdate) { init(); } @@ -109,7 +109,7 @@ void OverlayNode::traverse(osg::NodeVisitor& nv) unsigned int contextID = cv->getState()!=0 ? cv->getState()->getContextID() : 0; // if we need to redraw then do cull traversal on camera. - if (!_textureObjectValidList[contextID] || _continousUpdate) + if (!_textureObjectValidList[contextID] || _continuousUpdate) { // now compute the camera's view and projection matrix to point at the shadower (the camera's children) diff --git a/src/osgUtil/CullVisitor.cpp b/src/osgUtil/CullVisitor.cpp index 2dfe3dd35..69614387b 100644 --- a/src/osgUtil/CullVisitor.cpp +++ b/src/osgUtil/CullVisitor.cpp @@ -1081,12 +1081,12 @@ void CullVisitor::apply(osg::CameraNode& camera) pushProjectionMatrix(createOrReuseMatrix(camera.getProjectionMatrix())); pushModelViewMatrix(createOrReuseMatrix(camera.getViewMatrix())); } - else if (camera.getTransformOrder()==osg::CameraNode::POST_MULTIPLE) + else if (camera.getTransformOrder()==osg::CameraNode::POST_MULTIPLY) { pushProjectionMatrix(createOrReuseMatrix(getProjectionMatrix()*camera.getProjectionMatrix())); pushModelViewMatrix(createOrReuseMatrix(getModelViewMatrix()*camera.getViewMatrix())); } - else // pre multiple + else // pre multiply { pushProjectionMatrix(createOrReuseMatrix(camera.getProjectionMatrix()*getProjectionMatrix())); pushModelViewMatrix(createOrReuseMatrix(camera.getViewMatrix()*getModelViewMatrix())); diff --git a/src/osgUtil/IntersectVisitor.cpp b/src/osgUtil/IntersectVisitor.cpp index 56e409809..99346e9c2 100644 --- a/src/osgUtil/IntersectVisitor.cpp +++ b/src/osgUtil/IntersectVisitor.cpp @@ -812,7 +812,7 @@ void PickVisitor::apply(osg::CameraNode& camera) camera.getViewMatrix(), _mx, _my ); } - else if (camera.getTransformOrder()==osg::CameraNode::POST_MULTIPLE) + else if (camera.getTransformOrder()==osg::CameraNode::POST_MULTIPLY) { runNestedPickVisitor( camera, camera.getViewport() ? camera.getViewport() : _lastViewport.get(), @@ -820,7 +820,7 @@ void PickVisitor::apply(osg::CameraNode& camera) _lastViewMatrix * camera.getViewMatrix(), _mx, _my ); } - else // PRE_MULTIPLE + else // PRE_MULTIPLY { runNestedPickVisitor( camera, camera.getViewport() ? camera.getViewport() : _lastViewport.get(),