Added shells for DOFTransform and PositionAttitudeTransform to the .osg
loader, still need to fill in the saving and loading of paramters. Went through the distribution remove old API usage.
This commit is contained in:
@@ -36,8 +36,8 @@
|
||||
#include <osg/StateSet>
|
||||
#include <osg/Material>
|
||||
#include <osg/Texture>
|
||||
#include <osg/Transform>
|
||||
#include <osg/Transparency>
|
||||
#include <osg/MatrixTransform>
|
||||
#include <osg/BlendFunc>
|
||||
#include <osg/CullFace>
|
||||
#include <osg/FrontFace>
|
||||
#include <osg/PolygonMode>
|
||||
@@ -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);
|
||||
|
||||
@@ -22,11 +22,12 @@
|
||||
|
||||
#include "mynodevisitor.h"
|
||||
#include <osg/Group>
|
||||
#include <osg/MatrixTransform>
|
||||
#include <osg/Geometry>
|
||||
|
||||
class OSGVisitor: public MyNodeVisitor {
|
||||
osg::Node *root;
|
||||
osg::Transform *parent;
|
||||
osg::MatrixTransform *parent;
|
||||
Coordinate3 *coord3_active;
|
||||
TextureCoordinate *tcoord_active;
|
||||
Texture2 *texture_active;
|
||||
|
||||
41
src/osgPlugins/osg/DOFTransform.cpp
Normal file
41
src/osgPlugins/osg/DOFTransform.cpp
Normal file
@@ -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<DOFTransform&>(obj);
|
||||
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
|
||||
bool DOFTransform_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const DOFTransform& transform = static_cast<const DOFTransform&>(obj);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -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\
|
||||
|
||||
40
src/osgPlugins/osg/PositionAttitudeTransform.cpp
Normal file
40
src/osgPlugins/osg/PositionAttitudeTransform.cpp
Normal file
@@ -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<PositionAttitudeTransform&>(obj);
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
|
||||
bool PositionAttitudeTransform_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const PositionAttitudeTransform& transform = static_cast<const PositionAttitudeTransform&>(obj);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user