Converted the instance of osgNew and osgDelete back to new and delete as part

of depecating the include/osg/MemoryManager
This commit is contained in:
Robert Osfield
2002-12-16 13:40:58 +00:00
parent de9b0b336a
commit 00cc3a1833
186 changed files with 812 additions and 809 deletions

View File

@@ -60,7 +60,7 @@ osg::Node* createBase(const osg::Vec3& center,float radius)
osg::Vec3 dy(osg::Vec3(0.0f,height/((float)numTilesY),0.0f));
// fill in vertices for grid, note numTilesX+1 * numTilesY+1...
osg::Vec3Array* coords = osgNew osg::Vec3Array;
osg::Vec3Array* coords = new osg::Vec3Array;
int iy;
for(iy=0;iy<=numTilesY;++iy)
{
@@ -71,15 +71,15 @@ osg::Node* createBase(const osg::Vec3& center,float radius)
}
//Just two colours - black and white.
osg::Vec4Array* colors = osgNew osg::Vec4Array;
osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); // white
colors->push_back(osg::Vec4(0.0f,0.0f,0.0f,1.0f)); // black
int numColors=colors->size();
int numIndicesPerRow=numTilesX+1;
osg::UByteArray* coordIndices = osgNew osg::UByteArray; // assumes we are using less than 256 points...
osg::UByteArray* colorIndices = osgNew osg::UByteArray;
osg::UByteArray* coordIndices = new osg::UByteArray; // assumes we are using less than 256 points...
osg::UByteArray* colorIndices = new osg::UByteArray;
for(iy=0;iy<numTilesY;++iy)
{
for(int ix=0;ix<numTilesX;++ix)
@@ -97,11 +97,11 @@ osg::Node* createBase(const osg::Vec3& center,float radius)
// set up a single normal
osg::Vec3Array* normals = osgNew osg::Vec3Array;
osg::Vec3Array* normals = new osg::Vec3Array;
normals->push_back(osg::Vec3(0.0f,0.0f,1.0f));
osg::Geometry* geom = osgNew osg::Geometry;
osg::Geometry* geom = new osg::Geometry;
geom->setVertexArray(coords);
geom->setVertexIndices(coordIndices);
@@ -112,9 +112,9 @@ osg::Node* createBase(const osg::Vec3& center,float radius)
geom->setNormalArray(normals);
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
geom->addPrimitiveSet(osgNew osg::DrawArrays(osg::PrimitiveSet::QUADS,0,coordIndices->size()));
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,coordIndices->size()));
osg::Geode* geode = osgNew osg::Geode;
osg::Geode* geode = new osg::Geode;
geode->addDrawable(geom);
return geode;
@@ -134,7 +134,7 @@ osg::Node* createMovingModel(const osg::Vec3& center, float radius)
const osg::BoundingSphere& bs = glider->getBound();
float size = radius/bs.radius()*0.3f;
osg::MatrixTransform* positioned = osgNew osg::MatrixTransform;
osg::MatrixTransform* positioned = new osg::MatrixTransform;
positioned->setDataVariance(osg::Object::STATIC);
positioned->setMatrix(osg::Matrix::translate(-bs.center())*
osg::Matrix::scale(size,size,size)*
@@ -142,7 +142,7 @@ osg::Node* createMovingModel(const osg::Vec3& center, float radius)
positioned->addChild(glider);
osg::PositionAttitudeTransform* xform = osgNew osg::PositionAttitudeTransform;
osg::PositionAttitudeTransform* xform = new osg::PositionAttitudeTransform;
xform->setAppCallback(new osg::PositionAttitudeTransform::AnimationPathCallback(animationPath,0.0,1.0));
xform->addChild(positioned);
@@ -155,7 +155,7 @@ osg::Node* createMovingModel(const osg::Vec3& center, float radius)
const osg::BoundingSphere& bs = cessna->getBound();
float size = radius/bs.radius()*0.3f;
osg::MatrixTransform* positioned = osgNew osg::MatrixTransform;
osg::MatrixTransform* positioned = new osg::MatrixTransform;
positioned->setDataVariance(osg::Object::STATIC);
positioned->setMatrix(osg::Matrix::translate(-bs.center())*
osg::Matrix::scale(size,size,size)*
@@ -163,7 +163,7 @@ osg::Node* createMovingModel(const osg::Vec3& center, float radius)
positioned->addChild(cessna);
osg::MatrixTransform* xform = osgNew osg::MatrixTransform;
osg::MatrixTransform* xform = new osg::MatrixTransform;
xform->setAppCallback(new osg::MatrixTransform::AnimationPathCallback(animationPath,0.0f,2.0));
xform->addChild(positioned);
@@ -178,7 +178,7 @@ osg::Node* createModel()
osg::Vec3 center(0.0f,0.0f,0.0f);
float radius = 100.0f;
osg::Group* root = osgNew osg::Group;
osg::Group* root = new osg::Group;
root->addChild(createMovingModel(center,radius*0.8f));

View File

@@ -54,7 +54,7 @@ osg::Drawable* createSquare(const osg::Vec3& corner,const osg::Vec3& width,const
(*tcoords)[3].set(0.0f,1.0f);
geom->setTexCoordArray(0,tcoords);
geom->addPrimitiveSet(osgNew osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));
if (image)
{
@@ -98,7 +98,7 @@ osg::Drawable* createAxis(const osg::Vec3& corner,const osg::Vec3& xdir,const os
geom->setColorArray(color);
geom->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
geom->addPrimitiveSet(osgNew osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));
osg::StateSet* stateset = new osg::StateSet;
osg::LineWidth* linewidth = new osg::LineWidth();
@@ -114,17 +114,17 @@ osg::Node* createModel()
{
// create the root node which will hold the model.
osg::Group* root = osgNew osg::Group();
osg::Group* root = new osg::Group();
// add the drawable into a single goede to be shared...
osg::Billboard* center = osgNew osg::Billboard();
osg::Billboard* center = new osg::Billboard();
center->setMode(osg::Billboard::POINT_ROT_EYE);
center->addDrawable(
createSquare(osg::Vec3(-0.5f,0.0f,-0.5f),osg::Vec3(1.0f,0.0f,0.0f),osg::Vec3(0.0f,0.0f,1.0f),osgDB::readImageFile("Images/reflect.rgb")),
osg::Vec3(0.0f,0.0f,0.0f));
osg::Billboard* x_arrow = osgNew osg::Billboard();
osg::Billboard* x_arrow = new osg::Billboard();
x_arrow->setMode(osg::Billboard::AXIAL_ROT);
x_arrow->setAxis(osg::Vec3(1.0f,0.0f,0.0f));
x_arrow->setNormal(osg::Vec3(0.0f,-1.0f,0.0f));
@@ -133,7 +133,7 @@ createSquare(osg::Vec3(-0.5f,0.0f,-0.5f),osg::Vec3(1.0f,0.0f,0.0f),osg::Vec3(0.0
createSquare(osg::Vec3(-0.5f,0.0f,-0.5f),osg::Vec3(1.0f,0.0f,0.0f),osg::Vec3(0.0f,0.0f,1.0f),osgDB::readImageFile("Images/osg_posx.png")),
osg::Vec3(5.0f,0.0f,0.0f));
osg::Billboard* y_arrow = osgNew osg::Billboard();
osg::Billboard* y_arrow = new osg::Billboard();
y_arrow->setMode(osg::Billboard::AXIAL_ROT);
y_arrow->setAxis(osg::Vec3(0.0f,1.0f,0.0f));
y_arrow->setNormal(osg::Vec3(1.0f,0.0f,0.0f));
@@ -141,7 +141,7 @@ createSquare(osg::Vec3(-0.5f,0.0f,-0.5f),osg::Vec3(1.0f,0.0f,0.0f),osg::Vec3(0.0
createSquare(osg::Vec3(0.0f,-0.5f,-0.5f),osg::Vec3(0.0f,1.0f,0.0f),osg::Vec3(0.0f,0.0f,1.0f),osgDB::readImageFile("Images/osg_posy.png")),
osg::Vec3(0.0f,5.0f,0.0f));
osg::Billboard* z_arrow = osgNew osg::Billboard();
osg::Billboard* z_arrow = new osg::Billboard();
z_arrow->setMode(osg::Billboard::AXIAL_ROT);
z_arrow->setAxis(osg::Vec3(0.0f,0.0f,1.0f));
z_arrow->setNormal(osg::Vec3(0.0f,-1.0f,0.0f));
@@ -194,9 +194,9 @@ int main( int argc, char **argv )
viewer.addViewport( rootNode );
// register trackball, flight and drive.
viewer.registerCameraManipulator(osgNew osgGA::TrackballManipulator);
viewer.registerCameraManipulator(osgNew osgGA::FlightManipulator);
viewer.registerCameraManipulator(osgNew osgGA::DriveManipulator);
viewer.registerCameraManipulator(new osgGA::TrackballManipulator);
viewer.registerCameraManipulator(new osgGA::FlightManipulator);
viewer.registerCameraManipulator(new osgGA::DriveManipulator);
viewer.open();

View File

@@ -56,7 +56,7 @@ void write_usage(std::ostream& out,const std::string& name)
osg::Node* decorate_with_clip_node(osg::Node* subgraph)
{
osg::Group* rootnode = osgNew osg::Group;
osg::Group* rootnode = new osg::Group;
// create wireframe view of the model so the user can see
@@ -67,7 +67,7 @@ osg::Node* decorate_with_clip_node(osg::Node* subgraph)
polymode->setMode(osg::PolygonMode::FRONT_AND_BACK,osg::PolygonMode::LINE);
stateset->setAttributeAndModes(polymode,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
osg::Group* wireframe_subgraph = osgNew osg::Group;
osg::Group* wireframe_subgraph = new osg::Group;
wireframe_subgraph->setStateSet(stateset);
wireframe_subgraph->addChild(subgraph);
rootnode->addChild(wireframe_subgraph);
@@ -76,7 +76,7 @@ osg::Node* decorate_with_clip_node(osg::Node* subgraph)
// simple approach to adding a clipnode above a subrgaph.
// create clipped part.
osg::ClipNode* clipped_subgraph = osgNew osg::ClipNode;
osg::ClipNode* clipped_subgraph = new osg::ClipNode;
osg::BoundingSphere bs = subgraph->getBound();
bs.radius()*= 0.4f;
@@ -95,12 +95,12 @@ osg::Node* decorate_with_clip_node(osg::Node* subgraph)
// ClipNode node to be transformed independantly from the subgraph
// that it is clipping.
osg::MatrixTransform* transform= osgNew osg::MatrixTransform;
osg::MatrixTransform* transform= new 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);
osg::ClipNode* clipnode = osgNew osg::ClipNode;
osg::ClipNode* clipnode = new osg::ClipNode;
osg::BoundingSphere bs = subgraph->getBound();
bs.radius()*= 0.4f;
@@ -115,7 +115,7 @@ osg::Node* decorate_with_clip_node(osg::Node* subgraph)
// create clipped part.
osg::Group* clipped_subgraph = osgNew osg::Group;
osg::Group* clipped_subgraph = new osg::Group;
clipped_subgraph->setStateSet(clipnode->getStateSet());
clipped_subgraph->addChild(subgraph);

View File

@@ -73,25 +73,25 @@ class MyTransformCallback : public osg::NodeCallback{
osg::Geode* createGeometryCube()
{
osg::Geode* geode = osgNew osg::Geode();
osg::Geode* geode = new osg::Geode();
// -------------------------------------------
// Set up a new Geometry which will be our cube
// -------------------------------------------
osg::Geometry* cube = osgNew osg::Geometry();
osg::Geometry* cube = new osg::Geometry();
// set up the primitives
cube->addPrimitiveSet(osgNew osg::DrawArrays(osg::PrimitiveSet::POLYGON,0,4));
cube->addPrimitiveSet(osgNew osg::DrawArrays(osg::PrimitiveSet::POLYGON,4,4));
cube->addPrimitiveSet(osgNew osg::DrawArrays(osg::PrimitiveSet::POLYGON,8,4));
cube->addPrimitiveSet(osgNew osg::DrawArrays(osg::PrimitiveSet::POLYGON,12,4));
cube->addPrimitiveSet(osgNew osg::DrawArrays(osg::PrimitiveSet::POLYGON,16,4));
cube->addPrimitiveSet(osgNew osg::DrawArrays(osg::PrimitiveSet::POLYGON,20,4));
cube->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POLYGON,0,4));
cube->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POLYGON,4,4));
cube->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POLYGON,8,4));
cube->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POLYGON,12,4));
cube->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POLYGON,16,4));
cube->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POLYGON,20,4));
// set up coords.
osg::Vec3Array* coords = osgNew osg::Vec3Array;
osg::Vec3Array* coords = new osg::Vec3Array;
coords->resize(24);
(*coords)[0].set( -1.0000f, 1.0000f, -1.000f );
@@ -129,7 +129,7 @@ osg::Geode* createGeometryCube()
// set up the normals.
osg::Vec3Array* cubeNormals = osgNew osg::Vec3Array;
osg::Vec3Array* cubeNormals = new osg::Vec3Array;
cubeNormals->resize(6);
(*cubeNormals)[0].set(0.0f,0.0f,-1.0f);
@@ -145,8 +145,8 @@ osg::Geode* createGeometryCube()
// ---------------------------------------
// Set up a StateSet to make the cube red
// ---------------------------------------
osg::StateSet* cubeState = osgNew osg::StateSet();
osg::Material* redMaterial = osgNew osg::Material();
osg::StateSet* cubeState = new osg::StateSet();
osg::Material* redMaterial = new osg::Material();
osg::Vec4 red( 1.0f, 0.0f, 0.0f, 1.0f );
redMaterial->setDiffuse( osg::Material::FRONT_AND_BACK, red );
cubeState->setAttribute( redMaterial );
@@ -177,17 +177,17 @@ int main( int argc, char **argv )
// parameters that have been matched.
viewer.readCommandLine(commandLine);
osg::MatrixTransform* myTransform = osgNew osg::MatrixTransform();
osg::MatrixTransform* myTransform = new osg::MatrixTransform();
myTransform->addChild( createGeometryCube() );
// move node in a circle at 90 degrees a sec.
myTransform->setAppCallback(osgNew MyTransformCallback(myTransform,osg::inDegrees(90.0f)));
myTransform->setAppCallback(new MyTransformCallback(myTransform,osg::inDegrees(90.0f)));
// add model to viewer.
viewer.addViewport( myTransform );
// register trackball maniupulators.
viewer.registerCameraManipulator(osgNew osgGA::TrackballManipulator);
viewer.registerCameraManipulator(new osgGA::TrackballManipulator);
viewer.open();

View File

@@ -60,7 +60,7 @@ void create_specular_highlights(osg::Node *node)
osg::StateSet *ss = node->getOrCreateStateSet();
// create and setup the texture object
osg::TextureCubeMap *tcm = osgNew osg::TextureCubeMap;
osg::TextureCubeMap *tcm = new osg::TextureCubeMap;
tcm->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP);
tcm->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP);
tcm->setWrap(osg::Texture::WRAP_R, osg::Texture::CLAMP);
@@ -68,7 +68,7 @@ void create_specular_highlights(osg::Node *node)
tcm->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);
// generate the six highlight map images (light direction = [1, 1, -1])
osgUtil::HighlightMapGenerator *mapgen = osgNew osgUtil::HighlightMapGenerator(
osgUtil::HighlightMapGenerator *mapgen = new osgUtil::HighlightMapGenerator(
osg::Vec3(1, 1, -1), // light direction
osg::Vec4(1, 0.9f, 0.8f, 1), // light color
8); // specular exponent
@@ -87,12 +87,12 @@ void create_specular_highlights(osg::Node *node)
ss->setTextureAttributeAndModes(0, tcm, osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON);
// texture coordinate generation
osg::TexGen *tg = osgNew osg::TexGen;
osg::TexGen *tg = new osg::TexGen;
tg->setMode(osg::TexGen::REFLECTION_MAP);
ss->setTextureAttributeAndModes(0, tg, osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON);
// use TexEnvCombine to add the highlights to the original lighting
osg::TexEnvCombine *te = osgNew osg::TexEnvCombine;
osg::TexEnvCombine *te = new osg::TexEnvCombine;
te->setCombine_RGB(osg::TexEnvCombine::ADD);
te->setSource0_RGB(osg::TexEnvCombine::TEXTURE);
te->setOperand0_RGB(osg::TexEnvCombine::SRC_COLOR);

View File

@@ -86,11 +86,11 @@ int main( int argc, char **argv )
// osg::Depth, and setting their bin numbers to less than 0,
// to force them to draw before the rest of the scene.
osg::ClearNode* clearNode = osgNew osg::ClearNode;
osg::ClearNode* clearNode = new osg::ClearNode;
clearNode->setRequiresClear(false); // we've got base and sky to do it.
// use a transform to make the sky and base around with the eye point.
osg::Transform* transform = osgNew osg::Transform;
osg::Transform* transform = new osg::Transform;
// transform's value isn't knowm until in the cull traversal so its bounding
// volume is can't be determined, therefore culling will be invalid,
@@ -101,7 +101,7 @@ int main( int argc, char **argv )
// set the compute transform callback to do all the work of
// determining the transform according to the current eye point.
transform->setComputeTransformCallback(osgNew MoveEarthySkyWithEyePointCallback);
transform->setComputeTransformCallback(new MoveEarthySkyWithEyePointCallback);
// add the sky and base layer.
transform->addChild(makeSky()); // bin number -2 so drawn first.

View File

@@ -90,9 +90,9 @@ void set2dScene(osg::Group* rootNode)
///////////////////////////////////////////////////////////////////////////
// BitmapFont
osgText::BitmapFont* bitmapFont= osgNew osgText::BitmapFont(ttfPath,
osgText::BitmapFont* bitmapFont= new osgText::BitmapFont(ttfPath,
gFontSize1);
text= osgNew osgText::Text(bitmapFont);
text= new osgText::Text(bitmapFont);
gTextList.push_back(text);
text->setText(std::string("2d ")+std::string(TEXT_BITMAP));
text->setPosition(osg::Vec3(xOffset,yOffset,0));
@@ -100,14 +100,14 @@ void set2dScene(osg::Group* rootNode)
osgText::Text::BOUNDINGBOX |
osgText::Text::ALIGNMENT );
text->setAlignment(gAlignment);
geode = osgNew osg::Geode();
geode = new osg::Geode();
geode->setName("BitmapFont");
geode->addDrawable( text );
textMaterial = osgNew osg::Material();
textMaterial = new osg::Material();
textMaterial->setColorMode( osg::Material::AMBIENT_AND_DIFFUSE);
textMaterial->setDiffuse( osg::Material::FRONT_AND_BACK, TEXT_COL_2D);
textState = osgNew osg::StateSet();
textState = new osg::StateSet();
textState->setAttribute(textMaterial );
geode->setStateSet( textState );
@@ -118,9 +118,9 @@ void set2dScene(osg::Group* rootNode)
///////////////////////////////////////////////////////////////////////////
// PixmapFont
osgText::PixmapFont* pixmapFont= osgNew osgText::PixmapFont(ttfPath,
osgText::PixmapFont* pixmapFont= new osgText::PixmapFont(ttfPath,
gFontSize1);
text= osgNew osgText::Text(pixmapFont);
text= new osgText::Text(pixmapFont);
gTextList.push_back(text);
text->setText(std::string("2d ")+std::string(TEXT_PIXMAP));
text->setPosition(osg::Vec3(xOffset,yOffset,0));
@@ -128,21 +128,21 @@ void set2dScene(osg::Group* rootNode)
osgText::Text::BOUNDINGBOX |
osgText::Text::ALIGNMENT );
text->setAlignment(gAlignment);
geode = osgNew osg::Geode();
geode = new osg::Geode();
geode->setName("PixmapFont");
geode->addDrawable( text );
textMaterial = osgNew osg::Material();
textMaterial = new osg::Material();
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::BlendFunc *transp= osgNew osg::BlendFunc();
osg::BlendFunc *transp= new osg::BlendFunc();
transp->setFunction(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
textState = osgNew osg::StateSet();
textState = new osg::StateSet();
textState->setAttribute(textMaterial );
textState->setAttribute(transp);
textState->setMode(GL_BLEND,osg::StateAttribute::ON);
@@ -158,9 +158,9 @@ void set2dScene(osg::Group* rootNode)
///////////////////////////////////////////////////////////////////////////
// TextureFont
osgText::TextureFont* textureFont= osgNew osgText::TextureFont(ttfPath1,
osgText::TextureFont* textureFont= new osgText::TextureFont(ttfPath1,
gFontSize1);
text= osgNew osgText::Text(textureFont);
text= new osgText::Text(textureFont);
gTextList.push_back(text);
text->setText(std::string("2d ")+std::string(TEXT_TEXTURE));
text->setPosition(osg::Vec3(xOffset,yOffset,0));
@@ -168,18 +168,18 @@ void set2dScene(osg::Group* rootNode)
osgText::Text::BOUNDINGBOX |
osgText::Text::ALIGNMENT );
text->setAlignment(gAlignment);
geode = osgNew osg::Geode();
geode = new osg::Geode();
geode->setName("TextureFont");
geode->addDrawable( text );
textMaterial = osgNew osg::Material();
textMaterial = new osg::Material();
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::BlendFunc();
transp= new osg::BlendFunc();
transp->setFunction(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
textState = osgNew osg::StateSet();
textState = new osg::StateSet();
textState->setAttribute(textMaterial );
textState->setAttribute(transp);
@@ -194,10 +194,10 @@ void set2dScene(osg::Group* rootNode)
///////////////////////////////////////////////////////////////////////////
// PolygonFont
osgText::PolygonFont* polygonFont= osgNew osgText::PolygonFont(ttfPath,
osgText::PolygonFont* polygonFont= new osgText::PolygonFont(ttfPath,
gFontSize1,
3);
text= osgNew osgText::Text(polygonFont);
text= new osgText::Text(polygonFont);
gTextList.push_back(text);
text->setText(std::string("2d ")+std::string("TEXT_POLYGON"));
text->setPosition(osg::Vec3(xOffset,yOffset,0));
@@ -205,14 +205,14 @@ void set2dScene(osg::Group* rootNode)
osgText::Text::BOUNDINGBOX |
osgText::Text::ALIGNMENT );
text->setAlignment(gAlignment);
geode = osgNew osg::Geode();
geode = new osg::Geode();
geode->setName("PolygonFont");
geode->addDrawable( text );
textMaterial = osgNew osg::Material();
textMaterial = new osg::Material();
textMaterial->setColorMode( osg::Material::AMBIENT_AND_DIFFUSE);
textMaterial->setDiffuse( osg::Material::FRONT_AND_BACK, TEXT_COL_2D);
textState = osgNew osg::StateSet();
textState = new osg::StateSet();
textState->setAttribute(textMaterial );
geode->setStateSet( textState );
@@ -223,11 +223,11 @@ void set2dScene(osg::Group* rootNode)
///////////////////////////////////////////////////////////////////////////
// OutlineFont
osgText::OutlineFont* outlineFont= osgNew osgText::OutlineFont(ttfPath,
osgText::OutlineFont* outlineFont= new osgText::OutlineFont(ttfPath,
gFontSize1,
3);
text= osgNew osgText::Text(outlineFont);
text= new osgText::Text(outlineFont);
gTextList.push_back(text);
text->setText(std::string("2d ")+std::string(TEXT_OUTLINE));
text->setPosition(osg::Vec3(xOffset,yOffset,0));
@@ -235,14 +235,14 @@ void set2dScene(osg::Group* rootNode)
osgText::Text::BOUNDINGBOX |
osgText::Text::ALIGNMENT );
text->setAlignment(gAlignment);
geode = osgNew osg::Geode();
geode = new osg::Geode();
geode->setName("OutlineFont");
geode->addDrawable( text );
textMaterial = osgNew osg::Material();
textMaterial = new osg::Material();
textMaterial->setColorMode( osg::Material::AMBIENT_AND_DIFFUSE);
textMaterial->setDiffuse( osg::Material::FRONT_AND_BACK, TEXT_COL_2D);
textState = osgNew osg::StateSet();
textState = new osg::StateSet();
textState->setAttribute(textMaterial );
geode->setStateSet( textState );
@@ -250,10 +250,10 @@ void set2dScene(osg::Group* rootNode)
// now add a depth attribute to the scene to force it to draw on top.
osg::Depth* depth = osgNew osg::Depth;
osg::Depth* depth = new osg::Depth;
depth->setRange(0.0,0.0);
osg::StateSet* rootState = osgNew osg::StateSet();
osg::StateSet* rootState = new osg::StateSet();
rootState->setAttribute(depth);
rootState->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
@@ -323,16 +323,16 @@ int main( int argc, char **argv )
osg::Group* group = dynamic_cast<osg::Group*>(rootnode);
if (!group)
{
group = osgNew osg::Group;
group = new osg::Group;
group->addChild(rootnode);
rootnode = group;
}
// create the hud.
osg::Projection* projection = osgNew osg::Projection;
osg::Projection* projection = new osg::Projection;
projection->setMatrix(osg::Matrix::ortho2D(0,1024,0,768));
osg::MatrixTransform* modelview_abs = osgNew osg::MatrixTransform;
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
modelview_abs->setReferenceFrame(osg::Transform::RELATIVE_TO_ABSOLUTE);
modelview_abs->setMatrix(osg::Matrix::identity());
@@ -340,8 +340,8 @@ int main( int argc, char **argv )
set2dScene(modelview_abs);
projection->addChild(modelview_abs);
// projection->setAppCallback(osgNew MyCallback("App callback"));
// projection->setCullCallback(osgNew MyCallback("Cull callback"));
// projection->setAppCallback(new MyCallback("App callback"));
// projection->setCullCallback(new MyCallback("Cull callback"));
group->addChild(projection);

View File

@@ -156,14 +156,14 @@ osg::Geometry* createWall(const osg::Vec3& v1,const osg::Vec3& v2,const osg::Vec
{
// create a drawable for occluder.
osg::Geometry* geom = osgNew osg::Geometry;
osg::Geometry* geom = new osg::Geometry;
geom->setStateSet(stateset);
unsigned int noXSteps = 100;
unsigned int noYSteps = 100;
osg::Vec3Array* coords = osgNew osg::Vec3Array;
osg::Vec3Array* coords = new osg::Vec3Array;
coords->reserve(noXSteps*noYSteps);
@@ -185,7 +185,7 @@ osg::Geometry* createWall(const osg::Vec3& v1,const osg::Vec3& v2,const osg::Vec
geom->setVertexArray(coords);
osg::Vec4Array* colors = osgNew osg::Vec4Array(1);
osg::Vec4Array* colors = new osg::Vec4Array(1);
(*colors)[0].set(1.0f,1.0f,1.0f,1.0f);
geom->setColorArray(colors);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);

View File

@@ -96,7 +96,7 @@ osg::Node* createLightPointsDatabase()
end._position.set(1000.0f,0.0f,0.0f);
end._color.set(1.0f,1.0f,1.0f,1.0f);
osg::Transform* transform = osgNew osg::Transform;
osg::Transform* transform = new osg::Transform;
osg::Vec3 start_delta(0.0f,10.0f,0.0f);
osg::Vec3 end_delta(0.0f,10.0f,1.0f);
@@ -104,7 +104,7 @@ osg::Node* createLightPointsDatabase()
int noStepsX = 100;
int noStepsY = 100;
// osgSim::BlinkSequence* bs = osgNew osgSim::BlinkSequence;
// osgSim::BlinkSequence* bs = new osgSim::BlinkSequence;
// bs->addPulse(1.0,osg::Vec4(1.0f,0.0f,0.0f,1.0f));
// bs->addPulse(0.5,osg::Vec4(0.0f,0.0f,0.0f,0.0f)); // off
// bs->addPulse(1.5,osg::Vec4(1.0f,1.0f,0.0f,1.0f));
@@ -113,23 +113,23 @@ osg::Node* createLightPointsDatabase()
// bs->addPulse(0.5,osg::Vec4(0.0f,0.0f,0.0f,0.0f)); // off
// osgSim::Sector* sector = osgNew osgSim::ConeSector(osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0),osg::inDegrees(45.0));
// osgSim::Sector* sector = osgNew osgSim::ElevationSector(-osg::inDegrees(45.0),osg::inDegrees(45.0),osg::inDegrees(45.0));
// osgSim::Sector* sector = osgNew osgSim::AzimSector(-osg::inDegrees(45.0),osg::inDegrees(45.0),osg::inDegrees(90.0));
// osgSim::Sector* sector = osgNew osgSim::AzimElevationSector(osg::inDegrees(180),osg::inDegrees(90), // azim range
// osgSim::Sector* sector = new osgSim::ConeSector(osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0),osg::inDegrees(45.0));
// osgSim::Sector* sector = new osgSim::ElevationSector(-osg::inDegrees(45.0),osg::inDegrees(45.0),osg::inDegrees(45.0));
// osgSim::Sector* sector = new osgSim::AzimSector(-osg::inDegrees(45.0),osg::inDegrees(45.0),osg::inDegrees(90.0));
// osgSim::Sector* sector = new osgSim::AzimElevationSector(osg::inDegrees(180),osg::inDegrees(90), // azim range
// osg::inDegrees(0.0),osg::inDegrees(90.0), // elevation range
// osg::inDegrees(5.0));
for(int i=0;i<noStepsY;++i)
{
// osgSim::BlinkSequence* local_bs = osgNew osgSim::BlinkSequence(*bs);
// local_bs->setSequenceGroup(osgNew osgSim::BlinkSequence::SequenceGroup((double)i*0.1));
// osgSim::BlinkSequence* local_bs = new osgSim::BlinkSequence(*bs);
// local_bs->setSequenceGroup(new osgSim::BlinkSequence::SequenceGroup((double)i*0.1));
// start._blinkSequence = local_bs;
// start._sector = sector;
osgSim::LightPointNode* lpn = osgNew osgSim::LightPointNode;
osgSim::LightPointNode* lpn = new osgSim::LightPointNode;
addToLightPointNode(*lpn,start,end,noStepsX);
start._position += start_delta;
@@ -138,7 +138,7 @@ osg::Node* createLightPointsDatabase()
transform->addChild(lpn);
}
osg::Group* group = osgNew osg::Group;
osg::Group* group = new osg::Group;
group->addChild(transform);
@@ -169,7 +169,7 @@ int main( int argc, char **argv )
// eat any parameters that have been matched.
osgDB::readCommandLine(commandLine);
osg::Group* rootnode = osgNew osg::Group;
osg::Group* rootnode = new osg::Group;
// load the nodes from the commandline arguments.
rootnode->addChild(osgDB::readNodeFiles(commandLine));

View File

@@ -71,10 +71,10 @@ osg::Geometry* createWing(const osg::Vec3& left, const osg::Vec3& nose, const os
osg:: Node* createTextBelow(const osg::BoundingBox& bb)
{
osg::Geode* geode = osgNew osg::Geode();
osg::Geode* geode = new osg::Geode();
osgText::PolygonFont* polygonFont= osgNew osgText::PolygonFont("fonts/times.ttf",20, 3);
osgText::Text* text = osgNew osgText::Text(polygonFont);
osgText::PolygonFont* polygonFont= new osgText::PolygonFont("fonts/times.ttf",20, 3);
osgText::Text* text = new osgText::Text(polygonFont);
text->setText("OpenSceneGraph");
text->setAlignment(osgText::Text::CENTER_CENTER);
@@ -91,13 +91,13 @@ osg:: Node* createTextBelow(const osg::BoundingBox& bb)
osg:: Node* createTextLeft(const osg::BoundingBox& bb)
{
osg::Geode* geode = osgNew osg::Geode();
osg::Geode* geode = new osg::Geode();
//std::string font("fonts/times.ttf");
std::string font("fonts/arial.ttf");
//osgText::Text* text = osgNew osgText::Text(osgNew osgText::PolygonFont(font,80, 3));
osgText::Text* text = osgNew osgText::Text(osgNew osgText::TextureFont(font,85));
//osgText::Text* text = new osgText::Text(new osgText::PolygonFont(font,80, 3));
osgText::Text* text = new osgText::Text(new osgText::TextureFont(font,85));
text->setText("OpenSceneGraph");
text->setAlignment(osgText::Text::RIGHT_CENTER);
@@ -110,7 +110,7 @@ osg:: Node* createTextLeft(const osg::BoundingBox& bb)
osg::StateSet* stateset = text->getOrCreateStateSet();
osg::BlendFunc *transp= osgNew osg::BlendFunc();
osg::BlendFunc *transp= new osg::BlendFunc();
transp->setFunction(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
@@ -125,14 +125,14 @@ osg:: Node* createTextLeft(const osg::BoundingBox& bb)
osg:: Node* createGlobe(const osg::BoundingBox& bb,float ratio)
{
osg::Geode* geode = osgNew osg::Geode();
osg::Geode* geode = new osg::Geode();
osg::StateSet* stateset = osgNew osg::StateSet();
osg::StateSet* stateset = new osg::StateSet();
osg::Image* image = osgDB::readImageFile("land_shallow_topo_2048.jpg");
if (image)
{
osg::Texture2D* texture = osgNew osg::Texture2D;
osg::Texture2D* texture = new osg::Texture2D;
texture->setImage(image);
texture->setMaxAnisotropy(8);
stateset->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON);
@@ -141,7 +141,7 @@ osg:: Node* createGlobe(const osg::BoundingBox& bb,float ratio)
geode->setStateSet( stateset );
// the globe
geode->addDrawable(new osg::ShapeDrawable(osgNew osg::Sphere(bb.center(),bb.radius()*ratio)));
geode->addDrawable(new osg::ShapeDrawable(new osg::Sphere(bb.center(),bb.radius()*ratio)));
osg::MatrixTransform* xform = new osg::MatrixTransform;
@@ -153,7 +153,7 @@ osg:: Node* createGlobe(const osg::BoundingBox& bb,float ratio)
osg:: Node* createBox(const osg::BoundingBox& bb,float chordRatio)
{
osg::Geode* geode = osgNew osg::Geode();
osg::Geode* geode = new osg::Geode();
osg::Vec4 white(1.0f,1.0f,1.0f,1.0f);
@@ -182,7 +182,7 @@ osg:: Node* createBox(const osg::BoundingBox& bb,float chordRatio)
osg:: Node* createBoxNo5(const osg::BoundingBox& bb,float chordRatio)
{
osg::Geode* geode = osgNew osg::Geode();
osg::Geode* geode = new osg::Geode();
osg::Vec4 white(1.0f,1.0f,1.0f,1.0f);
@@ -208,7 +208,7 @@ osg:: Node* createBoxNo5(const osg::BoundingBox& bb,float chordRatio)
osg:: Node* createBoxNo5No2(const osg::BoundingBox& bb,float chordRatio)
{
osg::Geode* geode = osgNew osg::Geode();
osg::Geode* geode = new osg::Geode();
osg::Vec4 red(1.0f,0.0f,0.0f,1.0f);
osg::Vec4 green(0.0f,1.0f,0.0f,1.0f);
@@ -249,7 +249,7 @@ osg:: Node* createBackdrop(const osg::Vec3& corner,const osg::Vec3& top,const os
geom->addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,vertices->getNumElements()));
osg::Geode* geode = osgNew osg::Geode();
osg::Geode* geode = new osg::Geode();
geode->addDrawable(geom);
return geode;
@@ -335,7 +335,7 @@ int main( int argc, char **argv )
viewer.addViewport( node );
// register trackball maniupulators.
viewer.registerCameraManipulator(osgNew osgGA::TrackballManipulator);
viewer.registerCameraManipulator(new osgGA::TrackballManipulator);
viewer.open();

View File

@@ -105,7 +105,7 @@ bool OccluderEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAct
return true;
}
osg::ref_ptr<osg::LineSegment> lineSegment = osgNew osg::LineSegment;
osg::ref_ptr<osg::LineSegment> lineSegment = new osg::LineSegment;
lineSegment->set(near_point,far_point);
osgUtil::IntersectVisitor iv;
@@ -171,7 +171,7 @@ void OccluderEventHandler::endOccluder()
{
if (_convexPlanarOccluder->getOccluder().getVertexList().size()>=3)
{
osg::OccluderNode* occluderNode = osgNew osg::OccluderNode;
osg::OccluderNode* occluderNode = new osg::OccluderNode;
occluderNode->setOccluder(_convexPlanarOccluder.get());
if (!_occluders.valid())
@@ -201,10 +201,10 @@ void OccluderEventHandler::endOccluder()
osg::Node* createOccluder(const osg::Vec3& v1,const osg::Vec3& v2,const osg::Vec3& v3,const osg::Vec3& v4,float holeRatio=-1.0f)
{
// create and occluder which will site along side the loadmodel model.
osg::OccluderNode* occluderNode = osgNew osg::OccluderNode;
osg::OccluderNode* occluderNode = new osg::OccluderNode;
// create the convex planer occluder
osg::ConvexPlanarOccluder* cpo = osgNew osg::ConvexPlanarOccluder;
osg::ConvexPlanarOccluder* cpo = new osg::ConvexPlanarOccluder;
// attach it to the occluder node.
occluderNode->setOccluder(cpo);
@@ -240,22 +240,22 @@ osg::Node* createOccluder(const osg::Vec3& v1,const osg::Vec3& v2,const osg::Vec
// create a drawable for occluder.
osg::Geometry* geom = osgNew osg::Geometry;
osg::Geometry* geom = new osg::Geometry;
osg::Vec3Array* coords = osgNew osg::Vec3Array(occluder.getVertexList().begin(),occluder.getVertexList().end());
osg::Vec3Array* coords = new osg::Vec3Array(occluder.getVertexList().begin(),occluder.getVertexList().end());
geom->setVertexArray(coords);
osg::Vec4Array* colors = osgNew osg::Vec4Array(1);
osg::Vec4Array* colors = new osg::Vec4Array(1);
(*colors)[0].set(1.0f,1.0f,1.0f,0.5f);
geom->setColorArray(colors);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->addPrimitiveSet(osgNew osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));
osg::Geode* geode = osgNew osg::Geode;
osg::Geode* geode = new osg::Geode;
geode->addDrawable(geom);
osg::StateSet* stateset = osgNew osg::StateSet;
osg::StateSet* stateset = new osg::StateSet;
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
stateset->setMode(GL_BLEND,osg::StateAttribute::ON);
stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
@@ -273,7 +273,7 @@ osg::Node* createOccluder(const osg::Vec3& v1,const osg::Vec3& v2,const osg::Vec
osg::Group* createOccludersAroundModel(osg::Node* model)
{
osg::Group* scene = osgNew osg::Group;
osg::Group* scene = new osg::Group;
scene->setName("rootgroup");

View File

@@ -109,7 +109,7 @@ osgParticle::ParticleSystem *create_simple_particle_system(osg::Group *root)
// our particles and expose the interface for managing them; this object
// is a Drawable, so we'll have to add it to a Geode later.
osgParticle::ParticleSystem *ps = osgNew osgParticle::ParticleSystem;
osgParticle::ParticleSystem *ps = new osgParticle::ParticleSystem;
// As for other Drawable classes, the aspect of graphical elements of
// ParticleSystem (the particles) depends on the StateAttribute's we
@@ -137,7 +137,7 @@ osgParticle::ParticleSystem *create_simple_particle_system(osg::Group *root)
// these default objects there, but we'll modify the counter so that it
// counts faster (more particles are emitted at each frame).
osgParticle::ModularEmitter *emitter = osgNew osgParticle::ModularEmitter;
osgParticle::ModularEmitter *emitter = new osgParticle::ModularEmitter;
// the first thing you *MUST* do after creating an emitter is to set the
// destination particle system, otherwise it won't know where to create
@@ -169,7 +169,7 @@ osgParticle::ParticleSystem *create_simple_particle_system(osg::Group *root)
// to create a Geode and add the particle system to it, so it can be
// displayed.
osg::Geode *geode = osgNew osg::Geode;
osg::Geode *geode = new osg::Geode;
geode->addDrawable(ps);
// add the geode to the scene graph
@@ -221,7 +221,7 @@ osgParticle::ParticleSystem *create_complex_particle_system(osg::Group *root)
// "smoke.rgb", you can find it in the data distribution of OSG.
// We turn off the additive blending, because smoke has no self-
// illumination.
osgParticle::ParticleSystem *ps = osgNew osgParticle::ParticleSystem;
osgParticle::ParticleSystem *ps = new osgParticle::ParticleSystem;
ps->setDefaultAttributes("Images/smoke.rgb", false, false);
// assign the particle template to the system.
@@ -230,17 +230,17 @@ osgParticle::ParticleSystem *create_complex_particle_system(osg::Group *root)
// now we have to create an emitter; this will be a ModularEmitter, for which
// we define a RandomRateCounter as counter, a SectorPlacer as placer, and
// a RadialShooter as shooter.
osgParticle::ModularEmitter *emitter = osgNew osgParticle::ModularEmitter;
osgParticle::ModularEmitter *emitter = new osgParticle::ModularEmitter;
emitter->setParticleSystem(ps);
// setup the counter
osgParticle::RandomRateCounter *counter = osgNew osgParticle::RandomRateCounter;
osgParticle::RandomRateCounter *counter = new osgParticle::RandomRateCounter;
counter->setRateRange(60, 60);
emitter->setCounter(counter);
// setup the placer; it will be a circle of radius 5 (the particles will
// be placed inside this circle).
osgParticle::SectorPlacer *placer = osgNew osgParticle::SectorPlacer;
osgParticle::SectorPlacer *placer = new osgParticle::SectorPlacer;
placer->setCenter(8, 0, 10);
placer->setRadiusRange(2.5, 5);
placer->setPhiRange(0, 2 * osg::PI); // 360<36> angle to make a circle
@@ -250,7 +250,7 @@ osgParticle::ParticleSystem *create_complex_particle_system(osg::Group *root)
// initial speed to zero, because we want the particles to fall down
// only under the effect of the gravity force. Since we se the speed
// to zero, there is no need to setup the shooting angles.
osgParticle::RadialShooter *shooter = osgNew osgParticle::RadialShooter;
osgParticle::RadialShooter *shooter = new osgParticle::RadialShooter;
shooter->setInitialSpeedRange(0, 0);
emitter->setShooter(shooter);
@@ -272,22 +272,22 @@ osgParticle::ParticleSystem *create_complex_particle_system(osg::Group *root)
// Program (and its descendants) should be placed *after* the instances
// of Emitter objects in the scene graph.
osgParticle::ModularProgram *program = osgNew osgParticle::ModularProgram;
osgParticle::ModularProgram *program = new osgParticle::ModularProgram;
program->setParticleSystem(ps);
// create an operator that simulates the gravity acceleration.
osgParticle::AccelOperator *op1 = osgNew osgParticle::AccelOperator;
osgParticle::AccelOperator *op1 = new osgParticle::AccelOperator;
op1->setToGravity();
program->addOperator(op1);
// now create a custom operator, we have defined it before (see
// class VortexOperator).
VortexOperator *op2 = osgNew VortexOperator;
VortexOperator *op2 = new VortexOperator;
op2->setCenter(osg::Vec3(8, 0, 0));
program->addOperator(op2);
// let's add a fluid operator to simulate air friction.
osgParticle::FluidFrictionOperator *op3 = osgNew osgParticle::FluidFrictionOperator;
osgParticle::FluidFrictionOperator *op3 = new osgParticle::FluidFrictionOperator;
op3->setFluidToAir();
program->addOperator(op3);
@@ -295,7 +295,7 @@ osgParticle::ParticleSystem *create_complex_particle_system(osg::Group *root)
root->addChild(program);
// create a Geode to contain our particle system.
osg::Geode *geode = osgNew osg::Geode;
osg::Geode *geode = new osg::Geode;
geode->addDrawable(ps);
// add the geode to the scene graph.
@@ -328,7 +328,7 @@ void build_world(osg::Group *root)
// created, we have to add an "updater" node to the scene graph. This node
// will react to cull traversal by updating the specified particles system.
osgParticle::ParticleSystemUpdater *psu = osgNew osgParticle::ParticleSystemUpdater;
osgParticle::ParticleSystemUpdater *psu = new osgParticle::ParticleSystemUpdater;
psu->addParticleSystem(ps1);
psu->addParticleSystem(ps2);
@@ -353,7 +353,7 @@ int main(int argc, char **argv)
osgGLUT::Viewer viewer;
//viewer.setWindowTitle(argv[0]);
osg::Group *root = osgNew osg::Group;
osg::Group *root = new osg::Group;
build_world(root);
// add a viewport to the viewer and attach the scene graph.

View File

@@ -24,8 +24,8 @@ class /*OSGUTIL_EXPORT*/ MyRenderToTextureStage : public osgUtil::RenderStage
MyRenderToTextureStage();
virtual osg::Object* cloneType() const { return osgNew MyRenderToTextureStage(); }
virtual osg::Object* clone(const osg::CopyOp&) const { return osgNew MyRenderToTextureStage(); } // note only implements a clone of type.
virtual osg::Object* cloneType() const { return new MyRenderToTextureStage(); }
virtual osg::Object* clone(const osg::CopyOp&) const { return new MyRenderToTextureStage(); } // note only implements a clone of type.
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const MyRenderToTextureStage*>(obj)!=0L; }
virtual const char* libraryName() const { return ""; }
virtual const char* className() const { return "MyRenderToTextureStage"; }

View File

@@ -89,7 +89,7 @@ void MyCullCallback::doPreRender(osg::Node&, osgUtil::CullVisitor& cv)
}
// create the render to texture stage.
osg::ref_ptr<MyRenderToTextureStage> rtts = osgNew MyRenderToTextureStage;
osg::ref_ptr<MyRenderToTextureStage> rtts = new MyRenderToTextureStage;
rtts->setPBuffer(g_pPixelBuffer);
// set up lighting.
@@ -123,7 +123,7 @@ void MyCullCallback::doPreRender(osg::Node&, osgUtil::CullVisitor& cv)
zfar *= 1.1f;
// set up projection.
osg::Matrix* projection = osgNew osg::Matrix;
osg::Matrix* projection = new osg::Matrix;
projection->makeFrustum(-right,right,-top,top,znear,zfar);
cv.pushProjectionMatrix(projection);
@@ -133,7 +133,7 @@ void MyCullCallback::doPreRender(osg::Node&, osgUtil::CullVisitor& cv)
cv.pushModelViewMatrix(matrix);
osg::ref_ptr<osg::StateSet> dummyState = osgNew osg::StateSet;
osg::ref_ptr<osg::StateSet> dummyState = new osg::StateSet;
cv.pushStateSet(dummyState.get());
@@ -541,7 +541,7 @@ texture->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP);
polyGeom->setAppCallback(new MyGeometryCallback(origin,xAxis,yAxis,zAxis,1.0,1.0/width,0.2f));
osg::Geode* geode = osgNew osg::Geode();
osg::Geode* geode = new osg::Geode();
geode->addDrawable(polyGeom);
osg::Group* parent = new osg::Group;

View File

@@ -94,7 +94,7 @@ void MyCullCallback::doPreRender(osg::Node&, osgUtil::CullVisitor& cv)
// create the render to texture stage.
osg::ref_ptr<osgUtil::RenderToTextureStage> rtts = osgNew osgUtil::RenderToTextureStage;
osg::ref_ptr<osgUtil::RenderToTextureStage> rtts = new osgUtil::RenderToTextureStage;
// set up lighting.
// currently ignore lights in the scene graph itself..
@@ -128,7 +128,7 @@ void MyCullCallback::doPreRender(osg::Node&, osgUtil::CullVisitor& cv)
zfar *= 1.1f;
// set up projection.
osg::Matrix* projection = osgNew osg::Matrix;
osg::Matrix* projection = new osg::Matrix;
projection->makeFrustum(-right,right,-top,top,znear,zfar);
cv.pushProjectionMatrix(projection);
@@ -138,7 +138,7 @@ void MyCullCallback::doPreRender(osg::Node&, osgUtil::CullVisitor& cv)
cv.pushModelViewMatrix(matrix);
osg::ref_ptr<osg::StateSet> dummyState = osgNew osg::StateSet;
osg::ref_ptr<osg::StateSet> dummyState = new osg::StateSet;
cv.pushStateSet(dummyState.get());
@@ -540,7 +540,7 @@ osg::Node* createPreRenderSubGraph(osg::Node* subgraph)
polyGeom->setAppCallback(new MyGeometryCallback(origin,xAxis,yAxis,zAxis,1.0,1.0/width,0.2f));
osg::Geode* geode = osgNew osg::Geode();
osg::Geode* geode = new osg::Geode();
geode->addDrawable(polyGeom);
osg::Group* parent = new osg::Group;

View File

@@ -92,7 +92,7 @@ osg::Drawable* createMirrorSurface(float xMin,float xMax,float yMin,float yMax,f
geom->setColorArray(colours);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->addPrimitiveSet(osgNew osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));
return geom;
}

View File

@@ -92,7 +92,7 @@ osg::Sequence* generateSeq(osg::Sequence::LoopMode mode,
float speed, int nreps,
std::vector<osg::Node*>& model)
{
osg::Sequence* seqNode = osgNew osg::Sequence;
osg::Sequence* seqNode = new osg::Sequence;
// add children, show each child for 1.0 seconds
for (unsigned int i = 0; i < model.size(); i++) {
@@ -151,7 +151,7 @@ int main( int argc, char **argv )
}
// root
osg::Group* rootNode = osgNew osg::Group;
osg::Group* rootNode = new osg::Group;
// create sequences
std::vector<osg::Sequence*> seq;
@@ -174,7 +174,7 @@ int main( int argc, char **argv )
osg::Matrix matrix;
matrix.makeTranslate(x, 0.0, 0.0);
osg::MatrixTransform* xform = osgNew osg::MatrixTransform;
osg::MatrixTransform* xform = new osg::MatrixTransform;
xform->setMatrix(matrix);
xform->addChild(seqNode);
@@ -187,7 +187,7 @@ int main( int argc, char **argv )
viewer.addViewport(rootNode);
// register additional event handler
viewer.prependEventHandler(osgNew MyEventHandler(&seq), 0);
viewer.prependEventHandler(new MyEventHandler(&seq), 0);
// register trackball, flight and drive.
viewer.registerCameraManipulator(new osgGA::TrackballManipulator);

View File

@@ -89,7 +89,7 @@ void CreateShadowTextureCullCallback::doPreRender(osg::Node& node, osgUtil::Cull
// create the render to texture stage.
osg::ref_ptr<osgUtil::RenderToTextureStage> rtts = osgNew osgUtil::RenderToTextureStage;
osg::ref_ptr<osgUtil::RenderToTextureStage> rtts = new osgUtil::RenderToTextureStage;
// set up lighting.
// currently ignore lights in the scene graph itself..
@@ -125,7 +125,7 @@ void CreateShadowTextureCullCallback::doPreRender(osg::Node& node, osgUtil::Cull
float right = top;
// set up projection.
osg::Matrix* projection = osgNew osg::Matrix;
osg::Matrix* projection = new osg::Matrix;
projection->makeFrustum(-right,right,-top,top,znear,zfar);
cv.pushProjectionMatrix(projection);
@@ -146,7 +146,7 @@ void CreateShadowTextureCullCallback::doPreRender(osg::Node& node, osgUtil::Cull
cv.pushModelViewMatrix(matrix);
osg::ref_ptr<osg::StateSet> shadowState = osgNew osg::StateSet;
osg::ref_ptr<osg::StateSet> shadowState = new osg::StateSet;
// make the material black for a shadow.
osg::Material* material = new osg::Material;

View File

@@ -58,14 +58,14 @@ osg::AnimationPath* createAnimationPath(const osg::Vec3& center,float radius,dou
osg::Node* createBase(const osg::Vec3& center,float radius)
{
osg::Geode* geode = osgNew osg::Geode;
osg::Geode* geode = new osg::Geode;
// set up the texture of the base.
osg::StateSet* stateset = osgNew osg::StateSet();
osg::StateSet* stateset = new osg::StateSet();
osg::Image* image = osgDB::readImageFile("Images/lz.rgb");
if (image)
{
osg::Texture2D* texture = osgNew osg::Texture2D;
osg::Texture2D* texture = new osg::Texture2D;
texture->setImage(image);
stateset->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON);
}
@@ -108,7 +108,7 @@ osg::Node* createBase(const osg::Vec3& center,float radius)
geode->addDrawable(new osg::ShapeDrawable(grid));
osg::Group* group = osgNew osg::Group;
osg::Group* group = new osg::Group;
group->addChild(geode);
return group;
@@ -129,7 +129,7 @@ osg::Node* createMovingModel(const osg::Vec3& center, float radius)
const osg::BoundingSphere& bs = cessna->getBound();
float size = radius/bs.radius()*0.3f;
osg::MatrixTransform* positioned = osgNew osg::MatrixTransform;
osg::MatrixTransform* positioned = new osg::MatrixTransform;
positioned->setDataVariance(osg::Object::STATIC);
positioned->setMatrix(osg::Matrix::translate(-bs.center())*
osg::Matrix::scale(size,size,size)*
@@ -137,7 +137,7 @@ osg::Node* createMovingModel(const osg::Vec3& center, float radius)
positioned->addChild(cessna);
osg::MatrixTransform* xform = osgNew osg::MatrixTransform;
osg::MatrixTransform* xform = new osg::MatrixTransform;
xform->setAppCallback(new osg::MatrixTransform::AnimationPathCallback(animationPath,0.0f,2.0));
xform->addChild(positioned);

View File

@@ -17,17 +17,17 @@
osg::Geode* createShapes()
{
osg::Geode* geode = osgNew osg::Geode();
osg::Geode* geode = new osg::Geode();
// ---------------------------------------
// Set up a StateSet to texture the objects
// ---------------------------------------
osg::StateSet* stateset = osgNew osg::StateSet();
osg::StateSet* stateset = new osg::StateSet();
osg::Image* image = osgDB::readImageFile("Images/lz.rgb");
if (image)
{
osg::Texture2D* texture = osgNew osg::Texture2D;
osg::Texture2D* texture = new osg::Texture2D;
texture->setImage(image);
stateset->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON);
}
@@ -37,10 +37,10 @@ osg::Geode* createShapes()
float radius = 0.8f;
float height = 1.0f;
geode->addDrawable(new osg::ShapeDrawable(osgNew osg::Sphere(osg::Vec3(0.0f,0.0f,0.0f),radius)));
geode->addDrawable(new osg::ShapeDrawable(osgNew osg::Box(osg::Vec3(2.0f,0.0f,0.0f),2*radius)));
geode->addDrawable(new osg::ShapeDrawable(osgNew osg::Cone(osg::Vec3(4.0f,0.0f,0.0f),radius,height)));
geode->addDrawable(new osg::ShapeDrawable(osgNew osg::Cylinder(osg::Vec3(6.0f,0.0f,0.0f),radius,height)));
geode->addDrawable(new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(0.0f,0.0f,0.0f),radius)));
geode->addDrawable(new osg::ShapeDrawable(new osg::Box(osg::Vec3(2.0f,0.0f,0.0f),2*radius)));
geode->addDrawable(new osg::ShapeDrawable(new osg::Cone(osg::Vec3(4.0f,0.0f,0.0f),radius,height)));
geode->addDrawable(new osg::ShapeDrawable(new osg::Cylinder(osg::Vec3(6.0f,0.0f,0.0f),radius,height)));
osg::Grid* grid = new osg::Grid;
grid->allocateGrid(38,39);
@@ -107,7 +107,7 @@ int main( int argc, char **argv )
viewer.addViewport( node );
// register trackball maniupulators.
viewer.registerCameraManipulator(osgNew osgGA::TrackballManipulator);
viewer.registerCameraManipulator(new osgGA::TrackballManipulator);
viewer.open();

View File

@@ -290,7 +290,7 @@ class Teapot : public osg::Drawable
osg::Geode* createTeapot()
{
osg::Geode* geode = osgNew osg::Geode();
osg::Geode* geode = new osg::Geode();
// add the teapot to the geode.
geode->addDrawable( new Teapot );
@@ -339,7 +339,7 @@ int main( int argc, char **argv )
viewer.addViewport( createTeapot() );
// register trackball maniupulators.
viewer.registerCameraManipulator(osgNew osgGA::TrackballManipulator);
viewer.registerCameraManipulator(new osgGA::TrackballManipulator);
viewer.open();

View File

@@ -66,9 +66,9 @@ void set2dScene(osg::Group* rootNode)
///////////////////////////////////////////////////////////////////////////
// BitmapFont
osgText::BitmapFont* bitmapFont= osgNew osgText::BitmapFont(ttfPath,
osgText::BitmapFont* bitmapFont= new osgText::BitmapFont(ttfPath,
gFontSize1);
text= osgNew osgText::Text(bitmapFont);
text= new osgText::Text(bitmapFont);
gTextList.push_back(text);
text->setText(std::string("2d ")+std::string(TEXT_BITMAP));
text->setPosition(osg::Vec3(xOffset,yOffset,0));
@@ -77,7 +77,7 @@ void set2dScene(osg::Group* rootNode)
osgText::Text::ALIGNMENT );
text->setAlignment(gAlignment);
text->setColor(TEXT_COL_2D);
geode = osgNew osg::Geode();
geode = new osg::Geode();
geode->setName("BitmapFont");
geode->addDrawable( text );
@@ -88,9 +88,9 @@ void set2dScene(osg::Group* rootNode)
///////////////////////////////////////////////////////////////////////////
// PixmapFont
osgText::PixmapFont* pixmapFont= osgNew osgText::PixmapFont(ttfPath,
osgText::PixmapFont* pixmapFont= new osgText::PixmapFont(ttfPath,
gFontSize1);
text= osgNew osgText::Text(pixmapFont);
text= new osgText::Text(pixmapFont);
gTextList.push_back(text);
text->setText(std::string("2d ")+std::string(TEXT_PIXMAP));
text->setPosition(osg::Vec3(xOffset,yOffset,0));
@@ -99,15 +99,15 @@ void set2dScene(osg::Group* rootNode)
osgText::Text::ALIGNMENT );
text->setAlignment(gAlignment);
text->setColor(TEXT_COL_2D);
geode = osgNew osg::Geode();
geode = new osg::Geode();
geode->setName("PixmapFont");
geode->addDrawable( text );
// to get antiaA pixmapFonts we have to draw them with blending
osg::BlendFunc *transp= osgNew osg::BlendFunc();
osg::BlendFunc *transp= new osg::BlendFunc();
transp->setFunction(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
textState = osgNew osg::StateSet();
textState = new osg::StateSet();
textState->setAttributeAndModes(transp,osg::StateAttribute::ON);
textState->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
@@ -121,9 +121,9 @@ void set2dScene(osg::Group* rootNode)
///////////////////////////////////////////////////////////////////////////
// TextureFont
osgText::TextureFont* textureFont= osgNew osgText::TextureFont(ttfPath1,
osgText::TextureFont* textureFont= new osgText::TextureFont(ttfPath1,
gFontSize1);
text= osgNew osgText::Text(textureFont);
text= new osgText::Text(textureFont);
gTextList.push_back(text);
text->setText(std::string("2d ")+std::string(TEXT_TEXTURE));
text->setPosition(osg::Vec3(xOffset,yOffset,0));
@@ -132,15 +132,15 @@ void set2dScene(osg::Group* rootNode)
osgText::Text::ALIGNMENT );
text->setAlignment(gAlignment);
text->setColor(TEXT_COL_2D);
geode = osgNew osg::Geode();
geode = new osg::Geode();
geode->setName("TextureFont");
geode->addDrawable( text );
// to get antiaA pixmapFonts we have to draw them with blending
transp= osgNew osg::BlendFunc();
transp= new osg::BlendFunc();
transp->setFunction(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
textState = osgNew osg::StateSet();
textState = new osg::StateSet();
textState->setAttributeAndModes(transp,osg::StateAttribute::ON);
textState->setTextureMode(0,GL_TEXTURE_2D,osg::StateAttribute::ON);
@@ -154,10 +154,10 @@ void set2dScene(osg::Group* rootNode)
///////////////////////////////////////////////////////////////////////////
// PolygonFont
osgText::PolygonFont* polygonFont= osgNew osgText::PolygonFont(ttfPath,
osgText::PolygonFont* polygonFont= new osgText::PolygonFont(ttfPath,
gFontSize1,
3);
text= osgNew osgText::Text(polygonFont);
text= new osgText::Text(polygonFont);
gTextList.push_back(text);
text->setText(std::string("2d ")+std::string("TEXT_POLYGON"));
text->setPosition(osg::Vec3(xOffset,yOffset,0));
@@ -166,7 +166,7 @@ void set2dScene(osg::Group* rootNode)
osgText::Text::ALIGNMENT );
text->setAlignment(gAlignment);
text->setColor(TEXT_COL_2D);
geode = osgNew osg::Geode();
geode = new osg::Geode();
geode->setName("PolygonFont");
geode->addDrawable( text );
@@ -177,11 +177,11 @@ void set2dScene(osg::Group* rootNode)
///////////////////////////////////////////////////////////////////////////
// OutlineFont
osgText::OutlineFont* outlineFont= osgNew osgText::OutlineFont(ttfPath,
osgText::OutlineFont* outlineFont= new osgText::OutlineFont(ttfPath,
gFontSize1,
3);
text= osgNew osgText::Text(outlineFont);
text= new osgText::Text(outlineFont);
gTextList.push_back(text);
text->setText(std::string("2d ")+std::string(TEXT_OUTLINE));
text->setPosition(osg::Vec3(xOffset,yOffset,0));
@@ -190,7 +190,7 @@ void set2dScene(osg::Group* rootNode)
osgText::Text::ALIGNMENT );
text->setAlignment(gAlignment);
text->setColor(TEXT_COL_2D);
geode = osgNew osg::Geode();
geode = new osg::Geode();
geode->setName("OutlineFont");
geode->addDrawable( text );
@@ -198,10 +198,10 @@ void set2dScene(osg::Group* rootNode)
// now add a depth attribute to the scene to force it to draw on top.
osg::Depth* depth = osgNew osg::Depth;
osg::Depth* depth = new osg::Depth;
depth->setRange(0.0,0.0);
osg::StateSet* rootState = osgNew osg::StateSet();
osg::StateSet* rootState = new osg::StateSet();
rootState->setAttribute(depth);
rootNode->setStateSet(rootState);
@@ -220,9 +220,9 @@ void setScene(osg::Group* rootNode)
// setup the texts
///////////////////////////////////////////////////////////////////////////
// BitmapFont
osgText::BitmapFont* bitmapFont= osgNew osgText::BitmapFont(ttfPath,
osgText::BitmapFont* bitmapFont= new osgText::BitmapFont(ttfPath,
gFontSize);
text= osgNew osgText::Text(bitmapFont);
text= new osgText::Text(bitmapFont);
gTextList.push_back(text);
text->setText(std::string(TEXT_BITMAP));
text->setPosition(osg::Vec3(xOffset,yOffset,0));
@@ -231,14 +231,14 @@ void setScene(osg::Group* rootNode)
osgText::Text::ALIGNMENT );
text->setAlignment(gAlignment);
text->setColor(TEXT_COL_3D);
geode = osgNew osg::Geode();
geode = new osg::Geode();
geode->setName("BitmapFont");
geode->addDrawable( text );
// textMaterial = osgNew osg::Material();
// textMaterial = new osg::Material();
// textMaterial->setColorMode( osg::Material::AMBIENT_AND_DIFFUSE);
// textMaterial->setDiffuse( osg::Material::FRONT_AND_BACK,TEXT_COL_3D);
// textState = osgNew osg::StateSet();
// textState = new osg::StateSet();
// textState->setAttribute(textMaterial );
// geode->setStateSet( textState );
@@ -248,9 +248,9 @@ void setScene(osg::Group* rootNode)
///////////////////////////////////////////////////////////////////////////
// PixmapFont
osgText::PixmapFont* pixmapFont= osgNew osgText::PixmapFont(ttfPath,
osgText::PixmapFont* pixmapFont= new osgText::PixmapFont(ttfPath,
gFontSize);
text= osgNew osgText::Text(pixmapFont);
text= new osgText::Text(pixmapFont);
gTextList.push_back(text);
text->setText(std::string(TEXT_PIXMAP));
text->setPosition(osg::Vec3(xOffset,yOffset,0));
@@ -259,18 +259,18 @@ void setScene(osg::Group* rootNode)
osgText::Text::ALIGNMENT );
text->setAlignment(gAlignment);
text->setColor(TEXT_COL_3D);
geode = osgNew osg::Geode();
geode = new osg::Geode();
geode->setName("PixmapFont");
geode->addDrawable( text );
// textMaterial = osgNew osg::Material();
// textMaterial = new osg::Material();
// 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::BlendFunc *transp= osgNew osg::BlendFunc();
osg::BlendFunc *transp= new osg::BlendFunc();
transp->setFunction(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
textState = osgNew osg::StateSet();
textState = new osg::StateSet();
// textState->setAttribute(textMaterial );
textState->setAttribute(transp);
textState->setMode(GL_BLEND,osg::StateAttribute::ON);
@@ -283,9 +283,9 @@ void setScene(osg::Group* rootNode)
///////////////////////////////////////////////////////////////////////////
// TextureFont
osgText::TextureFont* textureFont= osgNew osgText::TextureFont(ttfPath,
osgText::TextureFont* textureFont= new osgText::TextureFont(ttfPath,
gFontSize);
text= osgNew osgText::Text(textureFont);
text= new osgText::Text(textureFont);
gTextList.push_back(text);
text->setText(std::string(TEXT_TEXTURE));
text->setPosition(osg::Vec3(xOffset,yOffset,0));
@@ -294,18 +294,18 @@ void setScene(osg::Group* rootNode)
osgText::Text::ALIGNMENT );
text->setAlignment(gAlignment);
text->setColor(TEXT_COL_3D);
geode = osgNew osg::Geode();
geode = new osg::Geode();
geode->setName("TextureFont");
geode->addDrawable( text );
// textMaterial = osgNew osg::Material();
// textMaterial = new osg::Material();
// 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::BlendFunc();
transp= new osg::BlendFunc();
transp->setFunction(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
textState = osgNew osg::StateSet();
textState = new osg::StateSet();
// textState->setAttribute(textMaterial );
textState->setAttribute(transp);
@@ -320,10 +320,10 @@ void setScene(osg::Group* rootNode)
///////////////////////////////////////////////////////////////////////////
// PolygonFont
osgText::PolygonFont* polygonFont= osgNew osgText::PolygonFont(ttfPath,
osgText::PolygonFont* polygonFont= new osgText::PolygonFont(ttfPath,
gFontSize,
3);
text= osgNew osgText::Text(polygonFont);
text= new osgText::Text(polygonFont);
gTextList.push_back(text);
text->setText(std::string(TEXT_POLYGON));
text->setPosition(osg::Vec3(xOffset,yOffset,0));
@@ -332,14 +332,14 @@ void setScene(osg::Group* rootNode)
osgText::Text::ALIGNMENT );
text->setAlignment(gAlignment);
text->setColor(TEXT_COL_3D);
geode = osgNew osg::Geode();
geode = new osg::Geode();
geode->setName("PolygonFont");
geode->addDrawable( text );
// textMaterial = osgNew osg::Material();
// textMaterial = new osg::Material();
// textMaterial->setColorMode( osg::Material::AMBIENT_AND_DIFFUSE);
// textMaterial->setDiffuse( osg::Material::FRONT_AND_BACK,TEXT_COL_3D);
// textState = osgNew osg::StateSet();
// textState = new osg::StateSet();
// textState->setAttribute(textMaterial );
// geode->setStateSet( textState );
@@ -349,11 +349,11 @@ void setScene(osg::Group* rootNode)
///////////////////////////////////////////////////////////////////////////
// OutlineFont
osgText::OutlineFont* outlineFont= osgNew osgText::OutlineFont(ttfPath,
osgText::OutlineFont* outlineFont= new osgText::OutlineFont(ttfPath,
gFontSize,
3);
text= osgNew osgText::Text(outlineFont);
text= new osgText::Text(outlineFont);
gTextList.push_back(text);
text->setText(std::string(TEXT_OUTLINE));
text->setPosition(osg::Vec3(xOffset,yOffset,0));
@@ -362,14 +362,14 @@ void setScene(osg::Group* rootNode)
osgText::Text::ALIGNMENT );
text->setAlignment(gAlignment);
text->setColor(TEXT_COL_3D);
geode = osgNew osg::Geode();
geode = new osg::Geode();
geode->setName("OutlineFont");
geode->addDrawable( text );
// textMaterial = osgNew osg::Material();
// textMaterial = new osg::Material();
// textMaterial->setColorMode( osg::Material::AMBIENT_AND_DIFFUSE);
// textMaterial->setDiffuse( osg::Material::FRONT_AND_BACK,TEXT_COL_3D);
// textState = osgNew osg::StateSet();
// textState = new osg::StateSet();
// textState->setAttribute(textMaterial );
// geode->setStateSet( textState );
@@ -412,7 +412,7 @@ public:
void addHUD(osg::Node* rootnode)
{
_hudSceneView = osgNew osgUtil::SceneView;
_hudSceneView = new osgUtil::SceneView;
_hudSceneView->setDefaults();
_hudSceneView->setSceneData(rootnode);
@@ -440,7 +440,7 @@ public:
_hudSceneView->getCullVisitor()->setCullingMode(osgUtil::CullVisitor::NO_CULLING);
_hudSceneView->setComputeNearFarMode(osgUtil::CullVisitor::DO_NOT_COMPUTE_NEAR_FAR);
_hudCam = osgNew osg::Camera;
_hudCam = new osg::Camera;
// leftBottom
_hudSceneView->setCamera(_hudCam.get());
@@ -541,16 +541,16 @@ int main( int argc, char **argv )
gFontSize1=8;
}
osg::Group* rootNode = osgNew osg::Group;
osg::Group* scene2d = osgNew osg::Group;
osg::MatrixTransform* textGroup = osgNew osg::MatrixTransform;
osg::Group* rootNode = new osg::Group;
osg::Group* scene2d = new osg::Group;
osg::MatrixTransform* textGroup = new osg::MatrixTransform;
// set the name for the hole group
rootNode->setName("sceneGroup");
// turn off the culling
// turn off the light
osg::StateSet* gstate = osgNew osg::StateSet;
osg::StateSet* gstate = new osg::StateSet;
gstate->setMode(GL_CULL_FACE,osg::StateAttribute::OFF);
gstate->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
gstate->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
@@ -578,9 +578,9 @@ int main( int argc, char **argv )
viewer.addHUD(scene2d);
// register trackball, flight and drive.
viewer.registerCameraManipulator(osgNew osgGA::TrackballManipulator);
viewer.registerCameraManipulator(osgNew osgGA::FlightManipulator);
viewer.registerCameraManipulator(osgNew osgGA::DriveManipulator);
viewer.registerCameraManipulator(new osgGA::TrackballManipulator);
viewer.registerCameraManipulator(new osgGA::FlightManipulator);
viewer.registerCameraManipulator(new osgGA::DriveManipulator);
viewer.open();
viewer.run();

View File

@@ -126,7 +126,7 @@ osg::Drawable* createSquare(float textureCoordMax=1.0f)
(*tcoords)[3].set(textureCoordMax,textureCoordMax);
geom->setTexCoordArray(0,tcoords);
geom->addPrimitiveSet(osgNew osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));
return geom;
}
@@ -170,11 +170,11 @@ osg::Node* createLayer(const osg::Vec3& offset,osg::Image* image,osg::Node* geom
// // use DrawPixels drawable to draw a pixel image.
// {
//
// osg::DrawPixels* drawimage = osgNew osg::DrawPixels;
// osg::DrawPixels* drawimage = new osg::DrawPixels;
// drawimage->setPosition(local_offset);
// drawimage->setImage(image);
//
// osg::Geode* geode = osgNew osg::Geode;
// osg::Geode* geode = new osg::Geode;
// geode->addDrawable(drawimage);
//
// // add the transform node to root group node.

View File

@@ -166,7 +166,7 @@ osg::Drawable* createSquare(float textureCoordMax=1.0f)
(*tcoords)[3].set(textureCoordMax,textureCoordMax);
geom->setTexCoordArray(0,tcoords);
geom->addPrimitiveSet(osgNew osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));
return geom;
}

View File

@@ -103,7 +103,7 @@ float PagingViewer::app(unsigned int viewport)
osg::Timer_t beforeApp = _timer.tick();
// update the camera manipulator.
osg::ref_ptr<GLUTEventAdapter> ea = osgNew GLUTEventAdapter;
osg::ref_ptr<GLUTEventAdapter> ea = new GLUTEventAdapter;
ea->adaptFrame(_frameStamp->getReferenceTime());
bool handled = false;