Ported distribution across to use the new osg::MatrixTransform and osg::BlendFunc

class instead of osg::Transform and osg::Transparancy respectively.
This commit is contained in:
Robert Osfield
2002-07-12 18:12:01 +00:00
parent 8128265e09
commit 6f392cdbfa
32 changed files with 93 additions and 97 deletions

View File

@@ -6,7 +6,7 @@
#include <osg/Geometry>
#include <osg/Texture>
#include <osg/TexEnv>
#include <osg/Transparency>
#include <osg/BlendFunc>
#include <osg/AlphaFunc>
#include <osgDB/ReadFile>
@@ -224,7 +224,7 @@ Node *makeTrees( void )
dstate->setTextureAttributeAndModes(0, tex, StateAttribute::ON );
dstate->setTextureAttribute(0, new TexEnv );
dstate->setAttributeAndModes( new Transparency, StateAttribute::ON );
dstate->setAttributeAndModes( new BlendFunc, StateAttribute::ON );
AlphaFunc* alphaFunc = new AlphaFunc;
alphaFunc->setFunction(AlphaFunc::GEQUAL,0.05f);

View File

@@ -1,7 +1,7 @@
#include <osg/Node>
#include <osg/Geometry>
#include <osg/Notify>
#include <osg/Transform>
#include <osg/MatrixTransform>
#include <osg/Texture>
#include <osg/Billboard>
@@ -92,7 +92,7 @@ osg::Node* createTexturedItem(const osg::Vec3& offset,osg::Texture* texture,osg:
// create a tranform node to position each square in appropriate
// place and also to add individual texture set to it, so that
// that state is inherited down to its children.
osg::Transform* local_transform = osgNew osg::Transform;
osg::MatrixTransform* local_transform = osgNew osg::MatrixTransform;
local_transform->postMult(osg::Matrix::translate(offset));
// create the StateSet to store the texture data
@@ -117,7 +117,7 @@ osg::Node* createLayer(const osg::Vec3& offset,osg::Image* image,osg::Node* geom
{
if (image==NULL) return NULL;
osg::Transform* top_transform = osgNew osg::Transform;
osg::MatrixTransform* top_transform = osgNew osg::MatrixTransform;
top_transform->postMult(osg::Matrix::translate(offset));
osg::Vec3 local_offset(0.0f,0.0f,0.0f);

View File

@@ -129,7 +129,7 @@ struct BillboardCallback : public osg::Billboard::ComputeBillboardCallback
struct DrawableCullCallback : public osg::Drawable::CullCallback
{
/** do customized cull code.*/
virtual bool cull(osg::NodeVisitor*, osg::Drawable* drawable, osg::State *state=NULL) const
virtual bool cull(osg::NodeVisitor*, osg::Drawable* drawable, osg::State *state) const
{
std::cout<<"Drawable cull callback "<<drawable<<std::endl;
return false;

View File

@@ -1,4 +1,4 @@
#include <osg/Transform>
#include <osg/MatrixTransform>
#include <osg/ClipNode>
#include <osg/Billboard>
#include <osg/Geode>
@@ -95,7 +95,7 @@ osg::Node* decorate_with_clip_node(osg::Node* subgraph)
// ClipNode node to be transformed independantly from the subgraph
// that it is clipping.
osg::Transform* transform= osgNew osg::Transform;
osg::MatrixTransform* transform= osgNew osg::MatrixTransform;
osg::NodeCallback* nc = new osgUtil::TransformCallback(subgraph->getBound().center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0f));
transform->setAppCallback(nc);

View File

@@ -1,6 +1,6 @@
#include <stdio.h>
#include <osg/Transform>
#include <osg/MatrixTransform>
#include <osgUtil/Optimizer>
#include "OrientationConverter.h"
@@ -48,7 +48,7 @@ Node* OrientationConverter::convert( Node *node )
T = Matrix::translate( bs.center() );
osg::Group* root = new osg::Group;
osg::Transform* transform = new osg::Transform;
osg::MatrixTransform* transform = new osg::MatrixTransform;
transform->setDataVariance(osg::Object::STATIC);
transform->setMatrix( C * R * S * T );

View File

@@ -1,4 +1,4 @@
#include <osg/Transform>
#include <osg/MatrixTransform>
#include <osg/Billboard>
#include <osg/Geode>
#include <osg/Group>

View File

@@ -2,7 +2,7 @@
#include <osg/Geometry>
#include <osg/Material>
#include <osg/Vec3>
#include <osg/Transform>
#include <osg/MatrixTransform>
#include <osgGA/TrackballManipulator>
@@ -20,7 +20,7 @@ class MyTransformCallback : public osg::NodeCallback{
public:
MyTransformCallback(osg::Transform* node,float angularVelocity)
MyTransformCallback(osg::MatrixTransform* node,float angularVelocity)
{
_nodeToOperateOn = node;
_angular_velocity = angularVelocity;
@@ -62,7 +62,7 @@ class MyTransformCallback : public osg::NodeCallback{
protected:
osg::Transform* _nodeToOperateOn;
osg::MatrixTransform* _nodeToOperateOn;
float _angular_velocity;
int _previousTraversalNumber;
@@ -175,7 +175,7 @@ int main( int argc, char **argv )
// parameters that have been matched.
viewer.readCommandLine(commandLine);
osg::Transform* myTransform = new osg::Transform();
osg::MatrixTransform* myTransform = new osg::MatrixTransform();
myTransform->addChild( createGeometryCube() );
// move node in a circle at 90 degrees a sec.

View File

@@ -2,7 +2,7 @@
#include <osg/Geometry>
#include <osg/Material>
#include <osg/Vec3>
#include <osg/Transform>
#include <osg/MatrixTransform>
#include <osg/Texture>
#include <osgDB/ReadFile>
@@ -513,7 +513,7 @@ class MyTransformCallback : public osg::NodeCallback
virtual void operator() (osg::Node* node, osg::NodeVisitor* nv)
{
osg::Transform* transform = dynamic_cast<osg::Transform*>(node);
osg::MatrixTransform* transform = dynamic_cast<osg::MatrixTransform*>(node);
if (nv && transform && nv->getFrameStamp())
{
double time = nv->getFrameStamp()->getReferenceTime();
@@ -623,7 +623,7 @@ osg::Node* createBackground()
// create a tranform to move the background back and forward with.
osg::Transform* transform = new osg::Transform();
osg::MatrixTransform* transform = new osg::MatrixTransform();
transform->setAppCallback(new MyTransformCallback(1.0f));
transform->addChild(geode);

View File

@@ -2,14 +2,14 @@
#include <osgGLUT/glut>
#include <osgGLUT/Viewer>
#include <osg/Transform>
#include <osg/MatrixTransform>
#include <osg/Projection>
#include <osg/Billboard>
#include <osg/Geode>
#include <osg/Group>
#include <osg/Notify>
#include <osg/Material>
#include <osg/Transparency>
#include <osg/BlendFunc>
#include <osg/Depth>
#include <osgDB/Registry>
@@ -136,7 +136,7 @@ void set2dScene(osg::Group* rootNode)
textMaterial->setColorMode( osg::Material::AMBIENT_AND_DIFFUSE);
textMaterial->setDiffuse( osg::Material::FRONT_AND_BACK,TEXT_COL_2D);
// to get antiaA pixmapFonts we have to draw them with blending
osg::Transparency *transp= osgNew osg::Transparency();
osg::BlendFunc *transp= osgNew osg::BlendFunc();
transp->setFunction(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
@@ -176,7 +176,7 @@ void set2dScene(osg::Group* rootNode)
textMaterial->setColorMode( osg::Material::AMBIENT_AND_DIFFUSE);
textMaterial->setDiffuse( osg::Material::FRONT_AND_BACK, TEXT_COL_2D);
// to get antiaA pixmapFonts we have to draw them with blending
transp= osgNew osg::Transparency();
transp= osgNew osg::BlendFunc();
transp->setFunction(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
textState = osgNew osg::StateSet();
@@ -332,7 +332,7 @@ int main( int argc, char **argv )
osg::Projection* projection = osgNew osg::Projection;
projection->setMatrix(osg::Matrix::ortho2D(0,1024,0,768));
osg::Transform* modelview_abs = osgNew osg::Transform;
osg::MatrixTransform* modelview_abs = osgNew osg::MatrixTransform;
modelview_abs->setReferenceFrame(osg::Transform::RELATIVE_TO_ABSOLUTE);
modelview_abs->setMatrix(osg::Matrix::identity());

View File

@@ -2,7 +2,7 @@
#include <osgGLUT/glut>
#include <osgGLUT/Viewer>
#include <osg/Transform>
#include <osg/MatrixTransform>
#include <osg/Billboard>
#include <osg/Geode>
#include <osg/Group>

View File

@@ -1,9 +1,8 @@
#include <osg/Node>
#include <osg/Geometry>
#include <osg/Notify>
#include <osg/Transform>
#include <osg/MatrixTransform>
#include <osg/Texture>
#include <osg/Transparency>
#include <osg/Stencil>
#include <osg/ColorMask>
#include <osg/Depth>
@@ -445,7 +444,7 @@ int main( int argc, char **argv )
}
// create a transform to spin the model.
osg::Transform* loadedModelTransform = new osg::Transform;
osg::MatrixTransform* loadedModelTransform = new osg::MatrixTransform;
loadedModelTransform->addChild(loadedModel);
osg::NodeCallback* nc = new osgUtil::TransformCallback(loadedModelTransform->getBound().center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0f));

View File

@@ -1,9 +1,9 @@
#include <osg/Node>
#include <osg/Geometry>
#include <osg/Notify>
#include <osg/Transform>
#include <osg/MatrixTransform>
#include <osg/Texture>
#include <osg/Transparency>
#include <osg/BlendFunc>
#include <osg/Stencil>
#include <osg/ColorMask>
#include <osg/Depth>
@@ -167,7 +167,7 @@ int main( int argc, char **argv )
return 1;
}
osg::Transform* loadedModelTransform = new osg::Transform;
osg::MatrixTransform* loadedModelTransform = new osg::MatrixTransform;
loadedModelTransform->addChild(loadedModel);
// calculate where to place the mirror according to the
@@ -318,7 +318,7 @@ int main( int argc, char **argv )
dstate->setAttributeAndModes(stencil,osg::StateAttribute::ON);
dstate->setAttributeAndModes(clipplane,osg::StateAttribute::ON);
osg::Transform* dcs = new osg::Transform;
osg::MatrixTransform* dcs = new osg::MatrixTransform;
dcs->setStateSet(dstate);
dcs->preMult(osg::Matrix::translate(0.0f,0.0f,-z)*
osg::Matrix::scale(1.0f,1.0f,-1.0f)*
@@ -343,8 +343,8 @@ int main( int argc, char **argv )
stencil->setOperation(osg::Stencil::KEEP, osg::Stencil::KEEP, osg::Stencil::ZERO);
// set up additive blending.
osg::Transparency* trans = new osg::Transparency;
trans->setFunction(osg::Transparency::ONE,osg::Transparency::ONE);
osg::BlendFunc* trans = new osg::BlendFunc;
trans->setFunction(osg::BlendFunc::ONE,osg::BlendFunc::ONE);
osg::StateSet* statesetBin5 = createMirrorTexturedState("Images/tank.rgb");

View File

@@ -1,5 +1,3 @@
#include <osg/Transform>
#include <osg/Billboard>
#include <osg/Geode>
#include <osg/Group>
#include <osg/Notify>

View File

@@ -1,6 +1,6 @@
#include <osg/Node>
#include <osg/Notify>
#include <osg/Transform>
#include <osg/MatrixTransform>
#include <osg/Texture>
#include <osgGA/TrackballManipulator>

View File

@@ -13,8 +13,8 @@
#include <osg/Node>
#include <osg/StateSet>
#include <osg/Material>
#include <osg/Transparency>
#include <osg/Transform>
#include <osg/BlendFunc>
#include <osg/MatrixTransform>
#include <osg/PolygonMode>
#include <osg/Depth>
#include <osg/Notify>
@@ -105,7 +105,7 @@ void set2dScene(osg::Group* rootNode)
geode->addDrawable( text );
// to get antiaA pixmapFonts we have to draw them with blending
osg::Transparency *transp= osgNew osg::Transparency();
osg::BlendFunc *transp= osgNew osg::BlendFunc();
transp->setFunction(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
textState = osgNew osg::StateSet();
@@ -138,7 +138,7 @@ void set2dScene(osg::Group* rootNode)
geode->addDrawable( text );
// to get antiaA pixmapFonts we have to draw them with blending
transp= osgNew osg::Transparency();
transp= osgNew osg::BlendFunc();
transp->setFunction(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
textState = osgNew osg::StateSet();
@@ -267,7 +267,7 @@ void setScene(osg::Group* rootNode)
textMaterial->setColorMode( osg::Material::AMBIENT_AND_DIFFUSE);
textMaterial->setDiffuse( osg::Material::FRONT_AND_BACK,TEXT_COL_3D);
// to get antiaA pixmapFonts we have to draw them with blending
osg::Transparency *transp= osgNew osg::Transparency();
osg::BlendFunc *transp= osgNew osg::BlendFunc();
transp->setFunction(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
textState = osgNew osg::StateSet();
@@ -301,7 +301,7 @@ void setScene(osg::Group* rootNode)
textMaterial->setColorMode( osg::Material::AMBIENT_AND_DIFFUSE);
textMaterial->setDiffuse( osg::Material::FRONT_AND_BACK,TEXT_COL_3D);
// to get antiaA pixmapFonts we have to draw them with blending
transp= osgNew osg::Transparency();
transp= osgNew osg::BlendFunc();
transp->setFunction(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
textState = osgNew osg::StateSet();
@@ -540,7 +540,7 @@ int main( int argc, char **argv )
osg::Group* rootNode = osgNew osg::Group;
osg::Group* scene2d = osgNew osg::Group;
osg::Transform* textGroup = osgNew osg::Transform;
osg::MatrixTransform* textGroup = osgNew osg::MatrixTransform;
// set the name for the hole group
rootNode->setName("sceneGroup");

View File

@@ -1,7 +1,7 @@
#include <osg/Node>
#include <osg/Geometry>
#include <osg/Notify>
#include <osg/Transform>
#include <osg/MatrixTransform>
#include <osg/Texture>
#include <osg/DrawPixels>
@@ -133,7 +133,7 @@ osg::Node* createTexturedItem(const osg::Vec3& offset,osg::Texture* texture,osg:
// create a tranform node to position each square in appropriate
// place and also to add individual texture set to it, so that
// that state is inherited down to its children.
osg::Transform* local_transform = new osg::Transform;
osg::MatrixTransform* local_transform = new osg::MatrixTransform;
local_transform->postMult(osg::Matrix::translate(offset));
// create the StateSet to store the texture data
@@ -158,7 +158,7 @@ osg::Node* createLayer(const osg::Vec3& offset,osg::Image* image,osg::Node* geom
{
if (image==NULL) return NULL;
osg::Transform* top_transform = new osg::Transform;
osg::MatrixTransform* top_transform = new osg::MatrixTransform;
top_transform->postMult(osg::Matrix::translate(offset));
osg::Vec3 local_offset(0.0f,0.0f,0.0f);

View File

@@ -2,10 +2,7 @@
#include <osgGLUT/glut>
#include <osgGLUT/Viewer>
#include <osg/Transform>
#include <osg/Billboard>
#include <osg/Geode>
#include <osg/Group>
#include <osg/Node>
#include <osg/Notify>
#include <osgDB/Registry>