diff --git a/VisualStudio/osgPlugins/osg/dot_osg.dsp b/VisualStudio/osgPlugins/osg/dot_osg.dsp index 63e4df4e1..7ccb953da 100755 --- a/VisualStudio/osgPlugins/osg/dot_osg.dsp +++ b/VisualStudio/osgPlugins/osg/dot_osg.dsp @@ -130,6 +130,10 @@ SOURCE=..\..\..\src\osgPlugins\osg\Drawable.cpp # End Source File # Begin Source File +SOURCE=..\..\..\src\osgPlugins\osg\DOFTransforms.cpp +# End Source File +# Begin Source File + SOURCE=..\..\..\src\osgPlugins\osg\EarthSky.cpp # End Source File # Begin Source File @@ -222,6 +226,10 @@ SOURCE=..\..\..\src\osgPlugins\osg\PolygonOffset.cpp # End Source File # Begin Source File +SOURCE=..\..\..\src\osgPlugins\osg\PositionAttitudeTransform.cpp +# End Source File +# Begin Source File + SOURCE=..\..\..\src\osgPlugins\osg\Projection.cpp # End Source File # Begin Source File diff --git a/include/osg/DOFTransform b/include/osg/DOFTransform index 97338f0c5..ca3cd2276 100644 --- a/include/osg/DOFTransform +++ b/include/osg/DOFTransform @@ -11,7 +11,7 @@ namespace osg{ /** DOFTransform - encapsulates Multigen DOF behavior*/ -class SG_EXPORT DOFTransform : public MatrixTransform +class SG_EXPORT DOFTransform : public Transform { public: /** constructor*/ @@ -19,7 +19,7 @@ class SG_EXPORT DOFTransform : public MatrixTransform /**copy constructor*/ DOFTransform(const DOFTransform& dof, const CopyOp& copyop=CopyOp::SHALLOW_COPY): - MatrixTransform(dof, copyop), + Transform(dof, copyop), _minHPR(dof._minHPR), _maxHPR(dof._maxHPR), _currentHPR(dof._currentHPR), diff --git a/src/Demos/osgclip/osgclip.cpp b/src/Demos/osgclip/osgclip.cpp index d31bf0e06..4a1215c35 100644 --- a/src/Demos/osgclip/osgclip.cpp +++ b/src/Demos/osgclip/osgclip.cpp @@ -65,7 +65,7 @@ osg::Node* decorate_with_clip_node(osg::Node* subgraph) //osg::Material* material = new osg::Material; osg::PolygonMode* polymode = new osg::PolygonMode; polymode->setMode(osg::PolygonMode::FRONT_AND_BACK,osg::PolygonMode::LINE); - stateset->setAttributeAndModes(polymode,osg::StateAttribute::OVERRIDE_ON); + stateset->setAttributeAndModes(polymode,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON); osg::Group* wireframe_subgraph = osgNew osg::Group; wireframe_subgraph->setStateSet(stateset); diff --git a/src/Demos/osgreflect/osgreflect.cpp b/src/Demos/osgreflect/osgreflect.cpp index 4147e4385..a243b0ddc 100644 --- a/src/Demos/osgreflect/osgreflect.cpp +++ b/src/Demos/osgreflect/osgreflect.cpp @@ -315,7 +315,7 @@ int main( int argc, char **argv ) osg::StateSet* dstate = new osg::StateSet; dstate->setRenderBinDetails(4,"RenderBin"); - dstate->setMode(GL_CULL_FACE,osg::StateAttribute::OVERRIDE_OFF); + dstate->setMode(GL_CULL_FACE,osg::StateAttribute::OVERRIDE|osg::StateAttribute::OFF); dstate->setAttributeAndModes(stencil,osg::StateAttribute::ON); dstate->setAttributeAndModes(clipplane,osg::StateAttribute::ON); diff --git a/src/Demos/osgscribe/osgscribe.cpp b/src/Demos/osgscribe/osgscribe.cpp index 78cf6cc8b..04b158198 100644 --- a/src/Demos/osgscribe/osgscribe.cpp +++ b/src/Demos/osgscribe/osgscribe.cpp @@ -114,11 +114,11 @@ int main( int argc, char **argv ) polyoffset->setUnits(-1.0f); osg::PolygonMode* polymode = new osg::PolygonMode; polymode->setMode(osg::PolygonMode::FRONT_AND_BACK,osg::PolygonMode::LINE); - stateset->setAttributeAndModes(material,osg::StateAttribute::OVERRIDE_ON); - stateset->setAttributeAndModes(polyoffset,osg::StateAttribute::OVERRIDE_ON); - stateset->setAttributeAndModes(polymode,osg::StateAttribute::OVERRIDE_ON); - stateset->setMode(GL_LIGHTING,osg::StateAttribute::OVERRIDE_OFF); - stateset->setTextureMode(0,GL_TEXTURE_2D,osg::StateAttribute::OVERRIDE_OFF); + stateset->setAttributeAndModes(material,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON); + stateset->setAttributeAndModes(polyoffset,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON); + stateset->setAttributeAndModes(polymode,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON); + stateset->setMode(GL_LIGHTING,osg::StateAttribute::OVERRIDE|osg::StateAttribute::OFF); + stateset->setTextureMode(0,GL_TEXTURE_2D,osg::StateAttribute::OVERRIDE|osg::StateAttribute::OFF); // osg::LineStipple* linestipple = new osg::LineStipple; // linestipple->setFactor(1); diff --git a/src/Demos/osgsequence/osgsequence.cpp b/src/Demos/osgsequence/osgsequence.cpp index d56dc316e..972e805e1 100644 --- a/src/Demos/osgsequence/osgsequence.cpp +++ b/src/Demos/osgsequence/osgsequence.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include @@ -173,7 +173,7 @@ int main( int argc, char **argv ) osg::Matrix matrix; matrix.makeTranslate(x, 0.0, 0.0); - osg::Transform* xform = osgNew osg::Transform; + osg::MatrixTransform* xform = osgNew osg::MatrixTransform; xform->setMatrix(matrix); xform->addChild(seqNode); diff --git a/src/osgGA/StateSetManipulator.cpp b/src/osgGA/StateSetManipulator.cpp index d745c2088..1c73684bb 100644 --- a/src/osgGA/StateSetManipulator.cpp +++ b/src/osgGA/StateSetManipulator.cpp @@ -15,9 +15,9 @@ void StateSetManipulator::setStateSet(StateSet *drawState) { _drawState=drawState; if(!_drawState.valid()) return; - _backface = (_drawState->getMode(GL_CULL_FACE)==osg::StateAttribute::ON); - _lighting =(_drawState->getMode(GL_LIGHTING)==osg::StateAttribute::ON); - _texture =(_drawState->getMode(GL_TEXTURE_2D)==osg::StateAttribute::ON); + _backface = (_drawState->getMode(GL_CULL_FACE)&osg::StateAttribute::ON); + _lighting =(_drawState->getMode(GL_LIGHTING)&osg::StateAttribute::ON); + _texture =(_drawState->getTextureMode(0,GL_TEXTURE_2D)&osg::StateAttribute::ON); } StateSet *StateSetManipulator::getStateSet() @@ -41,7 +41,7 @@ bool StateSetManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& aa) case 'b' : _backface = !_backface; if( _backface ) _drawState->setMode(GL_CULL_FACE,osg::StateAttribute::ON); - else _drawState->setMode(GL_CULL_FACE,osg::StateAttribute::OVERRIDE_OFF); + else _drawState->setMode(GL_CULL_FACE,osg::StateAttribute::OVERRIDE|osg::StateAttribute::OFF); aa.requestRedraw(); return true; break; @@ -49,15 +49,15 @@ bool StateSetManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& aa) case 'l' : _lighting = !_lighting ; if( _lighting ) _drawState->setMode(GL_LIGHTING,osg::StateAttribute::ON); - else _drawState->setMode(GL_LIGHTING,osg::StateAttribute::OVERRIDE_OFF); + else _drawState->setMode(GL_LIGHTING,osg::StateAttribute::OVERRIDE|osg::StateAttribute::OFF); aa.requestRedraw(); return true; break; case 't' : _texture = !_texture; - if (_texture) _drawState->setMode(GL_TEXTURE_2D,osg::StateAttribute::INHERIT); - else _drawState->setMode(GL_TEXTURE_2D,osg::StateAttribute::OVERRIDE_OFF); + if (_texture) _drawState->setTextureMode(0,GL_TEXTURE_2D,osg::StateAttribute::INHERIT); + else _drawState->setTextureMode(0,GL_TEXTURE_2D,osg::StateAttribute::OVERRIDE|osg::StateAttribute::OFF); aa.requestRedraw(); return true; break; diff --git a/src/osgGLUT/Viewer.cpp b/src/osgGLUT/Viewer.cpp index 2b930db58..f22360012 100644 --- a/src/osgGLUT/Viewer.cpp +++ b/src/osgGLUT/Viewer.cpp @@ -988,16 +988,16 @@ void Viewer::keyboard(unsigned char key, int x, int y) if( backface ) globalStateSet->setMode(GL_CULL_FACE,osg::StateAttribute::ON); else - globalStateSet->setMode(GL_CULL_FACE,osg::StateAttribute::OVERRIDE_OFF); + globalStateSet->setMode(GL_CULL_FACE,osg::StateAttribute::OVERRIDE|osg::StateAttribute::OFF); break; case 'l' : lighting = 1 - lighting ; if( lighting ) - globalStateSet->setMode(GL_LIGHTING,osg::StateAttribute::OVERRIDE_ON); + globalStateSet->setMode(GL_LIGHTING,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON); else - globalStateSet->setMode(GL_LIGHTING,osg::StateAttribute::OVERRIDE_OFF); + globalStateSet->setMode(GL_LIGHTING,osg::StateAttribute::OVERRIDE|osg::StateAttribute::OFF); break; case 'L' : @@ -1024,7 +1024,7 @@ void Viewer::keyboard(unsigned char key, int x, int y) // use blank texture to override all local texture in scene graph. // thus causing them to all use the same texture attribute, hence // preventing a state attribute change due to unused textures. - globalStateSet->setTextureMode(0,GL_TEXTURE_2D,osg::StateAttribute::OVERRIDE_OFF); + globalStateSet->setTextureMode(0,GL_TEXTURE_2D,osg::StateAttribute::OVERRIDE|osg::StateAttribute::OFF); // static osg::ref_ptr blank_texture = osgNew osg::Texture; // globalStateSet->setTextureAttribute(0,blank_texture.get()); } diff --git a/src/osgPlugins/iv/osgvisitor.cpp b/src/osgPlugins/iv/osgvisitor.cpp index 7c7a0777b..d2559468e 100644 --- a/src/osgPlugins/iv/osgvisitor.cpp +++ b/src/osgPlugins/iv/osgvisitor.cpp @@ -36,8 +36,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include @@ -107,7 +107,7 @@ ObjectCache::MaterialMap ObjectCache::materials; ObjectCache::TextureMap ObjectCache::textures; ObjectCache::NodeMap ObjectCache::nodos; -static void makeTransform(MatrixTransform *matriz_active, osg::Transform *nodo) { +static void makeTransform(MatrixTransform *matriz_active, osg::MatrixTransform *nodo) { // Original osg::Matrix m(matriz_active->getElem(0),matriz_active->getElem(1),matriz_active->getElem(2),matriz_active->getElem(3), matriz_active->getElem(4),matriz_active->getElem(5),matriz_active->getElem(6),matriz_active->getElem(7), @@ -140,12 +140,14 @@ void OSGVisitor::applyCoordinate3(Coordinate3 *coord) { coord3_active=coord; } -void OSGVisitor::applyMatrixTransform(MatrixTransform *tr) { +void OSGVisitor::applyMatrixTransform(MatrixTransform *tr) +{ makeTransform(tr,parent); } -void OSGVisitor::applySeparator(Separator *sep) { - osg::Transform *group=new osg::Transform(); +void OSGVisitor::applySeparator(Separator *sep) +{ + osg::MatrixTransform *group=new osg::MatrixTransform(); if (root==0) { root=group; } @@ -228,7 +230,7 @@ void OSGVisitor::makeGeode(osg::Geode *geode, osg::Geometry *geometry, bool twoS } else { //osg::notify(osg::INFO) << "Deactivating culling for this object" << std::endl; state->setAttributeAndModes(cull,osg::StateAttribute::OFF); - osg::Transparency *transp=new osg::Transparency(); + osg::BlendFunc *transp=new osg::BlendFunc(); transp->setFunction(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); state->setAttribute(transp); state->setMode(GL_BLEND,osg::StateAttribute::ON); diff --git a/src/osgPlugins/iv/osgvisitor.h b/src/osgPlugins/iv/osgvisitor.h index 87390c015..e6ee54774 100644 --- a/src/osgPlugins/iv/osgvisitor.h +++ b/src/osgPlugins/iv/osgvisitor.h @@ -22,11 +22,12 @@ #include "mynodevisitor.h" #include +#include #include class OSGVisitor: public MyNodeVisitor { osg::Node *root; - osg::Transform *parent; + osg::MatrixTransform *parent; Coordinate3 *coord3_active; TextureCoordinate *tcoord_active; Texture2 *texture_active; diff --git a/src/osgPlugins/osg/DOFTransform.cpp b/src/osgPlugins/osg/DOFTransform.cpp new file mode 100644 index 000000000..cf59c42f7 --- /dev/null +++ b/src/osgPlugins/osg/DOFTransform.cpp @@ -0,0 +1,41 @@ +#include "osg/DOFTransform" + +#include "osgDB/Registry" +#include "osgDB/Input" +#include "osgDB/Output" + +using namespace osg; +using namespace osgDB; + +// forward declare functions to use later. +bool DOFTransform_readLocalData(Object& obj, Input& fr); +bool DOFTransform_writeLocalData(const Object& obj, Output& fw); + +// register the read and write functions with the osgDB::Registry. +RegisterDotOsgWrapperProxy g_DOFTransformProxy +( + osgNew osg::DOFTransform, + "DOFTransform", + "Object Node Transform DOFTransform Group", + &DOFTransform_readLocalData, + &DOFTransform_writeLocalData, + DotOsgWrapper::READ_AND_WRITE +); + +bool DOFTransform_readLocalData(Object& obj, Input& fr) +{ + bool iteratorAdvanced = false; + + DOFTransform& transform = static_cast(obj); + + + return iteratorAdvanced; +} + + +bool DOFTransform_writeLocalData(const Object& obj, Output& fw) +{ + const DOFTransform& transform = static_cast(obj); + + return true; +} diff --git a/src/osgPlugins/osg/Makefile b/src/osgPlugins/osg/Makefile index 477239938..ac2988cee 100644 --- a/src/osgPlugins/osg/Makefile +++ b/src/osgPlugins/osg/Makefile @@ -10,6 +10,7 @@ CXXFILES =\ ConvexPlanerOccluder.cpp\ CullFace.cpp\ Depth.cpp\ + DOFTransform.cpp\ Drawable.cpp\ EarthSky.cpp\ Fog.cpp\ @@ -35,6 +36,7 @@ CXXFILES =\ Point.cpp\ PolygonMode.cpp\ PolygonOffset.cpp\ + PositionAttitudeTransform.cpp\ Projection.cpp\ ReaderWriterOSG.cpp\ ShadeModel.cpp\ diff --git a/src/osgPlugins/osg/PositionAttitudeTransform.cpp b/src/osgPlugins/osg/PositionAttitudeTransform.cpp new file mode 100644 index 000000000..bbc42b846 --- /dev/null +++ b/src/osgPlugins/osg/PositionAttitudeTransform.cpp @@ -0,0 +1,40 @@ +#include "osg/PositionAttitudeTransform" + +#include "osgDB/Registry" +#include "osgDB/Input" +#include "osgDB/Output" + +using namespace osg; +using namespace osgDB; + +// forward declare functions to use later. +bool PositionAttitudeTransform_readLocalData(Object& obj, Input& fr); +bool PositionAttitudeTransform_writeLocalData(const Object& obj, Output& fw); + +// register the read and write functions with the osgDB::Registry. +RegisterDotOsgWrapperProxy g_PositionAttitudeTransformProxy +( + osgNew osg::PositionAttitudeTransform, + "PositionAttitudeTransform", + "Object Node Transform PositionAttitudeTransform Group", + &PositionAttitudeTransform_readLocalData, + &PositionAttitudeTransform_writeLocalData, + DotOsgWrapper::READ_AND_WRITE +); + +bool PositionAttitudeTransform_readLocalData(Object& obj, Input& fr) +{ + bool iteratorAdvanced = false; + + PositionAttitudeTransform& transform = static_cast(obj); + + return iteratorAdvanced; +} + + +bool PositionAttitudeTransform_writeLocalData(const Object& obj, Output& fw) +{ + const PositionAttitudeTransform& transform = static_cast(obj); + + return true; +} diff --git a/src/osgPlugins/osg/StateSet.cpp b/src/osgPlugins/osg/StateSet.cpp index 65139dc19..e9798c4a2 100644 --- a/src/osgPlugins/osg/StateSet.cpp +++ b/src/osgPlugins/osg/StateSet.cpp @@ -141,7 +141,7 @@ bool GeoState_readLocalData(Object& obj, Input& fr) StateAttribute::GLModeValue mode; if (fr[0].matchWord("transparency") && StateSet_matchModeStr(fr[1].getStr(),mode)) { - if (mode==StateAttribute::ON || mode==StateAttribute::OVERRIDE_ON) + if (mode&StateAttribute::ON) { statset.setRenderingHint(StateSet::TRANSPARENT_BIN); } @@ -585,8 +585,8 @@ bool StateSet_matchModeStr(const char* str,StateAttribute::GLModeValue& mode) if (strcmp(str,"INHERIT")==0) mode = StateAttribute::INHERIT; else if (strcmp(str,"ON")==0) mode = StateAttribute::ON; else if (strcmp(str,"OFF")==0) mode = StateAttribute::OFF; - else if (strcmp(str,"OVERRIDE_ON")==0) mode = StateAttribute::OVERRIDE_ON; - else if (strcmp(str,"OVERRIDE_OFF")==0) mode = StateAttribute::OVERRIDE_OFF; + else if (strcmp(str,"OVERRIDE_ON")==0) mode = StateAttribute::OVERRIDE|StateAttribute::ON; + else if (strcmp(str,"OVERRIDE_OFF")==0) mode = StateAttribute::OVERRIDE|StateAttribute::OFF; else if (strcmp(str,"OVERRIDE|ON")==0) mode = StateAttribute::OVERRIDE|StateAttribute::ON; else if (strcmp(str,"OVERRIDE|OFF")==0) mode = StateAttribute::OVERRIDE|StateAttribute::OFF; else if (strcmp(str,"PROTECTED|ON")==0) mode = StateAttribute::PROTECTED|StateAttribute::ON; diff --git a/src/osgUtil/Optimizer.cpp b/src/osgUtil/Optimizer.cpp index 5be364c21..4673b4acf 100644 --- a/src/osgUtil/Optimizer.cpp +++ b/src/osgUtil/Optimizer.cpp @@ -21,6 +21,9 @@ using namespace osgUtil; void Optimizer::optimize(osg::Node* node, unsigned int options) { + + return; + if (options & COMBINE_ADJACENT_LODS) { CombineLODsVisitor clv;