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

@ -162,7 +162,7 @@ ifeq ($(OS),IRIX)
-DEBUG:woff=1682 -DEBUG:woff=3303\
-MDupdate $(MAKEDEPEND)
OPTF = -O2
DBGF = -g -DOSG_COMPILE_UNIT_TESTS -DOSG_USE_MEMORY_MANAGER
DBGF = -g -DOSG_COMPILE_UNIT_TESTS
SHARED = -shared
ARCH = 32
PFLIBS = \
@ -212,7 +212,7 @@ endif
INC +=
DEF += -W -Wall
OPTF = -O2
DBGF = -g -DOSG_COMPILE_UNIT_TESTS -DOSG_USE_MEMORY_MANAGER
DBGF = -g -DOSG_COMPILE_UNIT_TESTS
SHARED = -shared
ARCHARGS =
LINKARGS = -L/usr/X11R6/lib

View File

@ -103,8 +103,8 @@ class TemplateArray : public Array, public std::vector<T>
Array(ARRAYTYPE,DataSize,DataType),
std::vector<T>(first,last) {}
virtual Object* cloneType() const { return osgNew TemplateArray(); }
virtual Object* clone(const CopyOp& copyop) const { return osgNew TemplateArray(*this,copyop); }
virtual Object* cloneType() const { return new TemplateArray(); }
virtual Object* clone(const CopyOp& copyop) const { return new TemplateArray(*this,copyop); }
virtual void accept(ArrayVisitor& av) { av.apply(*this); }
virtual void accept(ConstArrayVisitor& av) const { av.apply(*this); }
@ -164,8 +164,8 @@ class TemplateIndexArray : public IndexArray, public std::vector<T>
IndexArray(ARRAYTYPE,DataSize,DataType),
std::vector<T>(first,last) {}
virtual Object* cloneType() const { return osgNew TemplateIndexArray(); }
virtual Object* clone(const CopyOp& copyop) const { return osgNew TemplateIndexArray(*this,copyop); }
virtual Object* cloneType() const { return new TemplateIndexArray(); }
virtual Object* clone(const CopyOp& copyop) const { return new TemplateIndexArray(*this,copyop); }
virtual void accept(ArrayVisitor& av) { av.apply(*this); }
virtual void accept(ConstArrayVisitor& av) const { av.apply(*this); }

View File

@ -22,7 +22,7 @@ class SG_EXPORT CollectOccludersVisitor : public osg::NodeVisitor, public osg::C
CollectOccludersVisitor();
virtual ~CollectOccludersVisitor();
virtual CollectOccludersVisitor* cloneType() const { return osgNew CollectOccludersVisitor(); }
virtual CollectOccludersVisitor* cloneType() const { return new CollectOccludersVisitor(); }
virtual void reset();

View File

@ -290,7 +290,7 @@ inline Matrix* CullStack::createOrReuseMatrix(const osg::Matrix& value)
}
// otherwise need to create new matrix.
osg::Matrix* matrix = osgNew Matrix(value);
osg::Matrix* matrix = new Matrix(value);
_reuseMatrixList.push_back(matrix);
++_currentReuseMatrixIndex;
return matrix;

View File

@ -22,9 +22,9 @@ class SG_EXPORT DrawPixels : public Drawable
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
DrawPixels(const DrawPixels& drawimage,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
virtual Object* cloneType() const { return osgNew DrawPixels(); }
virtual Object* cloneType() const { return new DrawPixels(); }
virtual Object* clone(const CopyOp& copyop) const { return osgNew DrawPixels(*this,copyop); }
virtual Object* clone(const CopyOp& copyop) const { return new DrawPixels(*this,copyop); }
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawPixels*>(obj)!=NULL; }

View File

@ -39,19 +39,20 @@
/* Define NULL pointer value */
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
//#include <osg/MemoryManager>
//#include <new>
//#include <stdlib.h>
#define osgNew new
#define osgDelete delete
#define osgFree free
#define osgMalloc malloc
#ifdef USE_DEPRECATED_API
#define osgNew new
#define osgDelete delete
#define osgFree free
#define osgMalloc malloc
#endif
#endif

View File

@ -159,9 +159,9 @@ class SG_EXPORT GeoSet : public Drawable
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
GeoSet(const GeoSet& geoset,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
virtual Object* cloneType() const { return osgNew GeoSet(); }
virtual Object* cloneType() const { return new GeoSet(); }
virtual Object* clone(const CopyOp& copyop) const { return osgNew GeoSet(*this,copyop); }
virtual Object* clone(const CopyOp& copyop) const { return new GeoSet(*this,copyop); }
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const GeoSet*>(obj)!=NULL; }

View File

@ -24,8 +24,8 @@ class SG_EXPORT Geometry : public Drawable
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
Geometry(const Geometry& geometry,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
virtual Object* cloneType() const { return osgNew Geometry(); }
virtual Object* clone(const CopyOp& copyop) const { return osgNew Geometry(*this,copyop); }
virtual Object* cloneType() const { return new Geometry(); }
virtual Object* clone(const CopyOp& copyop) const { return new Geometry(*this,copyop); }
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const Geometry*>(obj)!=NULL; }
virtual const char* libraryName() const { return "osg"; }
virtual const char* className() const { return "Geometry"; }

View File

@ -44,8 +44,8 @@ class SG_EXPORT Image : public Object
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
Image(const Image& image,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
virtual Object* cloneType() const { return osgNew Image(); }
virtual Object* clone(const CopyOp& copyop) const { return osgNew Image(*this,copyop); }
virtual Object* cloneType() const { return new Image(); }
virtual Object* clone(const CopyOp& copyop) const { return new Image(*this,copyop); }
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const Image*>(obj)!=0; }
virtual const char* libraryName() const { return "osg"; }
virtual const char* className() const { return "Image"; }

View File

@ -31,11 +31,11 @@ class SG_EXPORT ImpostorSprite : public Drawable
ImpostorSprite();
/** Clone an object of the same type as an ImpostorSprite.*/
virtual Object* cloneType() const { return osgNew ImpostorSprite(); }
virtual Object* cloneType() const { return new ImpostorSprite(); }
/** Clone on ImpostorSprite just returns a clone of type,
* since it is not appropriate to share data of an ImpostorSprite.*/
virtual Object* clone(const CopyOp&) const { return osgNew ImpostorSprite(); }
virtual Object* clone(const CopyOp&) const { return new ImpostorSprite(); }
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const ImpostorSprite*>(obj)!=NULL; }
virtual const char* libraryName() const { return "osg"; }
virtual const char* className() const { return "ImpostorSprite"; }

View File

@ -31,8 +31,8 @@ class SG_EXPORT Matrix : public Object
float a20, float a21, float a22, float a23,
float a30, float a31, float a32, float a33);
virtual Object* cloneType() const { return osgNew Matrix(); } \
virtual Object* clone(const CopyOp&) const { return osgNew Matrix(*this); } \
virtual Object* cloneType() const { return new Matrix(); } \
virtual Object* clone(const CopyOp&) const { return new Matrix(*this); } \
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const Matrix*>(obj)!=NULL; } \
virtual const char* libraryName() const { return "osg"; }
virtual const char* className() const { return "Matrix"; }

View File

@ -129,8 +129,8 @@ extern SG_EXPORT sMStats m_getMemoryStatistics();
// ---------------------------------------------------------------------------------------------------------------------------------
#define osgNew (m_setOwner (__FILE__,__LINE__),false) ? NULL : new
#define osgDelete (m_setOwner (__FILE__,__LINE__),false) ? m_setOwner("",0) : delete
#define new (m_setOwner (__FILE__,__LINE__),false) ? NULL : new
#define delete (m_setOwner (__FILE__,__LINE__),false) ? m_setOwner("",0) : delete
#define osgMalloc(sz) m_allocator (__FILE__,__LINE__,m_alloc_malloc,sz)
#define osgCalloc(sz) m_allocator (__FILE__,__LINE__,m_alloc_calloc,sz)
#define osgRealloc(ptr,sz) m_reallocator(__FILE__,__LINE__,m_alloc_realloc,sz,ptr)
@ -138,8 +138,8 @@ extern SG_EXPORT sMStats m_getMemoryStatistics();
#else // OSG_USE_MEMORY_MANAGER
#define osgNew new
#define osgDelete delete
#define new new
#define delete delete
#define osgMalloc(sz) malloc(sz)
#define osgCalloc(sz) calloc(sz)
#define osgRealloc(ptr,sz) realloc(ptr,sz)

View File

@ -1,6 +1,17 @@
//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
//Distributed under the terms of the GNU Library General Public License (LGPL)
//as published by the Free Software Foundation.
//C++ header - OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
//
// This file may be distributed and/or modified under the terms of the
// GNU Lesser General Public License (LGPL) version 2.1 as published
// by the Free Software Foundation appearing in the file COPYING included in
// this distribution.
//
// Licensees holding valid OpenSceneGraph Professional Licenses (OSGPL) may use
// this file in accordance with the OpenSceneGraph Professional License
// Agreement provided to you by OpenSceneGraph Professional Services.
//
// See http::/www.openscenegraph.org/licensing.html for details on and pricing
// of the OpenSceneGraph Professional license.
#ifndef OSG_NODE
#define OSG_NODE 1
@ -23,8 +34,8 @@ class Transform;
* and accept methods. Use when subclassing from Node to make it
* more convinient to define the required pure virtual methods.*/
#define META_Node(library,name) \
virtual osg::Object* cloneType() const { return osgNew name (); } \
virtual osg::Object* clone(const osg::CopyOp& copyop) const { return osgNew name (*this,copyop); } \
virtual osg::Object* cloneType() const { return new name (); } \
virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new name (*this,copyop); } \
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const name *>(obj)!=NULL; } \
virtual const char* className() const { return #name; } \
virtual const char* libraryName() const { return #library; } \
@ -47,10 +58,10 @@ class SG_EXPORT Node : public Object
Node(const Node&,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
/** clone the an object of the same type as the node.*/
virtual Object* cloneType() const { return osgNew Node(); }
virtual Object* cloneType() const { return new Node(); }
/** return a clone of a node, with Object* return type.*/
virtual Object* clone(const CopyOp& copyop) const { return osgNew Node(*this,copyop); }
virtual Object* clone(const CopyOp& copyop) const { return new Node(*this,copyop); }
/** return true if this and obj are of the same kind of object.*/
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const Node*>(obj)!=NULL; }

View File

@ -17,7 +17,7 @@ namespace osg {
* which are required for all Object subclasses.*/
#define META_Object(library,name) \
virtual osg::Object* cloneType() const { return new name (); } \
virtual osg::Object* clone(const osg::CopyOp& copyop) const { return osgNew name (*this,copyop); } \
virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new name (*this,copyop); } \
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const name *>(obj)!=NULL; } \
virtual const char* libraryName() const { return #library; }\
virtual const char* className() const { return #name; }

View File

@ -172,8 +172,8 @@ class SG_EXPORT DrawArrays : public PrimitiveSet
_first(da._first),
_count(da._count) {}
virtual Object* cloneType() const { return osgNew DrawArrays(); }
virtual Object* clone(const CopyOp& copyop) const { return osgNew DrawArrays(*this,copyop); }
virtual Object* cloneType() const { return new DrawArrays(); }
virtual Object* clone(const CopyOp& copyop) const { return new DrawArrays(*this,copyop); }
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawArrays*>(obj)!=NULL; }
virtual const char* libraryName() const { return "osg"; }
virtual const char* className() const { return "DrawArrays"; }
@ -235,8 +235,8 @@ class SG_EXPORT DrawArrayLengths : public PrimitiveSet, public VectorSizei
VectorSizei(firstItr,lastItr),
_first(first) {}
virtual Object* cloneType() const { return osgNew DrawArrayLengths(); }
virtual Object* clone(const CopyOp& copyop) const { return osgNew DrawArrayLengths(*this,copyop); }
virtual Object* cloneType() const { return new DrawArrayLengths(); }
virtual Object* clone(const CopyOp& copyop) const { return new DrawArrayLengths(*this,copyop); }
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawArrayLengths*>(obj)!=NULL; }
virtual const char* libraryName() const { return "osg"; }
virtual const char* className() const { return "DrawArrayLengths"; }
@ -300,8 +300,8 @@ class SG_EXPORT DrawElementsUByte : public PrimitiveSet, public VectorUByte
PrimitiveSet(DrawElementsUBytePrimitiveType,mode),
VectorUByte(first,last) {}
virtual Object* cloneType() const { return osgNew DrawElementsUByte(); }
virtual Object* clone(const CopyOp& copyop) const { return osgNew DrawElementsUByte(*this,copyop); }
virtual Object* cloneType() const { return new DrawElementsUByte(); }
virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUByte(*this,copyop); }
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawElementsUByte*>(obj)!=NULL; }
virtual const char* libraryName() const { return "osg"; }
virtual const char* className() const { return "DrawElementsUByte"; }
@ -340,8 +340,8 @@ class SG_EXPORT DrawElementsUShort : public PrimitiveSet, public VectorUShort
PrimitiveSet(DrawElementsUShortPrimitiveType,mode),
VectorUShort(first,last) {}
virtual Object* cloneType() const { return osgNew DrawElementsUShort(); }
virtual Object* clone(const CopyOp& copyop) const { return osgNew DrawElementsUShort(*this,copyop); }
virtual Object* cloneType() const { return new DrawElementsUShort(); }
virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUShort(*this,copyop); }
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawElementsUShort*>(obj)!=NULL; }
virtual const char* libraryName() const { return "osg"; }
virtual const char* className() const { return "DrawElementsUShort"; }
@ -379,8 +379,8 @@ class SG_EXPORT DrawElementsUInt : public PrimitiveSet, public VectorUInt
PrimitiveSet(DrawElementsUIntPrimitiveType,mode),
VectorUInt(first,last) {}
virtual Object* cloneType() const { return osgNew DrawElementsUInt(); }
virtual Object* clone(const CopyOp& copyop) const { return osgNew DrawElementsUInt(*this,copyop); }
virtual Object* cloneType() const { return new DrawElementsUInt(); }
virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUInt(*this,copyop); }
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawElementsUInt*>(obj)!=NULL; }
virtual const char* libraryName() const { return "osg"; }
virtual const char* className() const { return "DrawElementsUInt"; }

View File

@ -24,8 +24,8 @@ class ConstShapeVisitor;
* the standard pure virtual methods which are required for all Object
* subclasses.*/
#define META_Shape(library,name) \
virtual osg::Object* cloneType() const { return osgNew name(); } \
virtual osg::Object* clone(const osg::CopyOp& copyop) const { return osgNew name (*this,copyop); } \
virtual osg::Object* cloneType() const { return new name(); } \
virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new name (*this,copyop); } \
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const name *>(obj)!=NULL; } \
virtual const char* libraryName() const { return #library; } \
virtual const char* className() const { return #name; } \

View File

@ -108,8 +108,8 @@ class SG_EXPORT ShapeDrawable : public Drawable
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
ShapeDrawable(const ShapeDrawable& pg,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
virtual Object* cloneType() const { return osgNew ShapeDrawable(); }
virtual Object* clone(const CopyOp& copyop) const { return osgNew ShapeDrawable(*this,copyop); }
virtual Object* cloneType() const { return new ShapeDrawable(); }
virtual Object* clone(const CopyOp& copyop) const { return new ShapeDrawable(*this,copyop); }
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const ShapeDrawable*>(obj)!=NULL; }
virtual const char* libraryName() const { return "osg"; }
virtual const char* className() const { return "ShapeDrawable"; }

View File

@ -24,8 +24,8 @@ class StateSet;
* the standard pure virtual methods which are required for all Object
* subclasses.*/
#define META_StateAttribute(library,name,type) \
virtual osg::Object* cloneType() const { return osgNew name(); } \
virtual osg::Object* clone(const osg::CopyOp& copyop) const { return osgNew name (*this,copyop); } \
virtual osg::Object* cloneType() const { return new name(); } \
virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new name (*this,copyop); } \
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const name *>(obj)!=NULL; } \
virtual const char* libraryName() const { return #library; } \
virtual const char* className() const { return #name; } \

View File

@ -30,8 +30,8 @@ class SG_EXPORT StateSet : public Object
StateSet();
StateSet(const StateSet&,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
virtual Object* cloneType() const { return osgNew StateSet(); }
virtual Object* clone(const CopyOp& copyop) const { return osgNew StateSet(*this,copyop); }
virtual Object* cloneType() const { return new StateSet(); }
virtual Object* clone(const CopyOp& copyop) const { return new StateSet(*this,copyop); }
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const StateSet*>(obj)!=NULL; }
virtual const char* libraryName() const { return "osg"; }
virtual const char* className() const { return "StateSet"; }

View File

@ -459,7 +459,7 @@ Starts a TestSuite singleton function
{ \
static osg::ref_ptr<osgUtx::TestSuite> s_suite = 0; \
if ( s_suite == 0 ) { \
s_suite = osgNew osgUtx::TestSuite( #tsuite );
s_suite = new osgUtx::TestSuite( #tsuite );
@ -468,7 +468,7 @@ Adds a test case to a suite object being created in a TestSuite singleton functi
@see OSGUTX_BEGIN_TESTSUITE, OSGUTX_END_TESTSUITE
*/
#define OSGUTX_ADD_TESTCASE( tfixture, tmethod ) \
s_suite->add( osgNew osgUtx::TestCase_<tfixture>( \
s_suite->add( new osgUtx::TestCase_<tfixture>( \
#tmethod, &tfixture::tmethod ) );
/**

View File

@ -22,13 +22,6 @@
# endif /* OSGDBSG_LIBRARY */
#else
# define OSGDB_EXPORT
#endif
//#include <osg/MemoryManager>
#define osgNew new
#define osgDelete delete
#define osgFree free
#define osgMalloc malloc
#endif
#endif

View File

@ -209,7 +209,7 @@ class RegisterDotOsgWrapperProxy
{
if (Registry::instance())
{
_wrapper = osgNew DotOsgWrapper(proto,name,associates,readFunc,writeFunc,readWriteMode);
_wrapper = new DotOsgWrapper(proto,name,associates,readFunc,writeFunc,readWriteMode);
Registry::instance()->addDotOsgWrapper(_wrapper.get());
}
}
@ -235,7 +235,7 @@ class RegisterReaderWriterProxy
{
if (Registry::instance())
{
_rw = osgNew T;
_rw = new T;
Registry::instance()->addReaderWriter(_rw.get());
}
}

View File

@ -44,7 +44,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac
CullVisitor();
virtual ~CullVisitor();
virtual CullVisitor* cloneType() const { return osgNew CullVisitor(); }
virtual CullVisitor* cloneType() const { return new CullVisitor(); }
virtual void reset();
@ -312,7 +312,7 @@ inline RenderLeaf* CullVisitor::createOrReuseRenderLeaf(osg::Drawable* drawable,
}
// otherwise need to create new renderleaf.
RenderLeaf* renderleaf = osgNew RenderLeaf(drawable,projection,matrix,depth);
RenderLeaf* renderleaf = new RenderLeaf(drawable,projection,matrix,depth);
_reuseRenderLeafList.push_back(renderleaf);
++_currentReuseRenderLeafIndex;
return renderleaf;

View File

@ -48,8 +48,8 @@ class OSGUTIL_EXPORT RenderBin : public osg::Object
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
RenderBin(const RenderBin& rhs,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
virtual osg::Object* cloneType() const { return osgNew RenderBin(); }
virtual osg::Object* clone(const osg::CopyOp& copyop) const { return osgNew RenderBin(*this,copyop); } // note only implements a clone of type.
virtual osg::Object* cloneType() const { return new RenderBin(); }
virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new RenderBin(*this,copyop); } // note only implements a clone of type.
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const RenderBin*>(obj)!=0L; }
virtual const char* libraryName() const { return "osgUtil"; }
virtual const char* className() const { return "RenderBin"; }

View File

@ -71,7 +71,7 @@ class OSGUTIL_EXPORT RenderGraph : public osg::Referenced
~RenderGraph() {}
RenderGraph* cloneType() const { return osgNew RenderGraph; }
RenderGraph* cloneType() const { return new RenderGraph; }
void setUserData(osg::Referenced* obj) { _userData = obj; }
osg::Referenced* getUserData() { return _userData.get(); }
@ -149,7 +149,7 @@ class OSGUTIL_EXPORT RenderGraph : public osg::Referenced
// create a state group and insert it into the children list
// then return the state group.
RenderGraph* sg = osgNew RenderGraph(this,stateset);
RenderGraph* sg = new RenderGraph(this,stateset);
_children[stateset] = sg;
return sg;
}

View File

@ -31,8 +31,8 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
RenderStage(const RenderStage& rhs,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
virtual osg::Object* cloneType() const { return osgNew RenderStage(); }
virtual osg::Object* clone(const osg::CopyOp& copyop) const { return osgNew RenderStage(*this,copyop); } // note only implements a clone of type.
virtual osg::Object* cloneType() const { return new RenderStage(); }
virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new RenderStage(*this,copyop); } // note only implements a clone of type.
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const RenderStage*>(obj)!=0L; }
virtual const char* className() const { return "RenderStage"; }
@ -99,7 +99,7 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
RenderStageLighting* getRenderStageLighting() const
{
if (!_renderStageLighting.valid()) _renderStageLighting = osgNew RenderStageLighting;
if (!_renderStageLighting.valid()) _renderStageLighting = new RenderStageLighting;
return _renderStageLighting.get();
}

View File

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

View File

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

View File

@ -55,7 +55,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced
else
{
// ensure that _viewport is always valid.
_viewport = osgNew osg::Viewport;
_viewport = new osg::Viewport;
}
}

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° 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;

View File

@ -369,7 +369,7 @@ void Camera::attachTransform(TransformMode mode, Matrix* matrix)
if (_eyeToModelTransform.valid())
{
_attachedTransformMode = mode;
if (!_modelToEyeTransform.valid()) _modelToEyeTransform = osgNew Matrix;
if (!_modelToEyeTransform.valid()) _modelToEyeTransform = new Matrix;
if (!_modelToEyeTransform->invert(*_eyeToModelTransform))
{
notify(WARN)<<"Warning: Camera::attachTransform() failed to invert _modelToEyeTransform"<<std::endl;
@ -388,7 +388,7 @@ void Camera::attachTransform(TransformMode mode, Matrix* matrix)
if (_modelToEyeTransform.valid())
{
_attachedTransformMode = mode;
if (!_eyeToModelTransform.valid()) _eyeToModelTransform = osgNew Matrix;
if (!_eyeToModelTransform.valid()) _eyeToModelTransform = new Matrix;
if (!_eyeToModelTransform->invert(*_modelToEyeTransform))
{
notify(WARN)<<"Warning: Camera::attachTransform() failed to invert _modelToEyeTransform"<<std::endl;

View File

@ -11,7 +11,7 @@ ClearNode::ClearNode():
_requiresClear(true),
_clearColor(0.0f,0.0f,0.0f,1.0f)
{
StateSet* stateset = osgNew StateSet;
StateSet* stateset = new StateSet;
stateset->setRenderBinDetails(-1,"RenderBin");
setStateSet(stateset);
}

View File

@ -5,7 +5,7 @@ using namespace osg;
ClipNode::ClipNode()
{
_value = StateAttribute::ON;
_stateset = osgNew StateSet;
_stateset = new StateSet;
}
ClipNode::ClipNode(const ClipNode& cn, const CopyOp& copyop):Group(cn,copyop)
@ -28,14 +28,14 @@ void ClipNode::createClipBox(const BoundingBox& bb,unsigned int clipPlaneNumberB
{
_planes.clear();
_planes.push_back(osgNew ClipPlane(clipPlaneNumberBase ,1.0,0.0,0.0,-bb.xMin()));
_planes.push_back(osgNew ClipPlane(clipPlaneNumberBase+1,-1.0,0.0,0.0,bb.xMax()));
_planes.push_back(new ClipPlane(clipPlaneNumberBase ,1.0,0.0,0.0,-bb.xMin()));
_planes.push_back(new ClipPlane(clipPlaneNumberBase+1,-1.0,0.0,0.0,bb.xMax()));
_planes.push_back(osgNew ClipPlane(clipPlaneNumberBase+2,0.0,1.0,0.0,-bb.yMin()));
_planes.push_back(osgNew ClipPlane(clipPlaneNumberBase+3,0.0,-1.0,0.0,bb.yMax()));
_planes.push_back(new ClipPlane(clipPlaneNumberBase+2,0.0,1.0,0.0,-bb.yMin()));
_planes.push_back(new ClipPlane(clipPlaneNumberBase+3,0.0,-1.0,0.0,bb.yMax()));
_planes.push_back(osgNew ClipPlane(clipPlaneNumberBase+4,0.0,0.0,1.0,-bb.zMin()));
_planes.push_back(osgNew ClipPlane(clipPlaneNumberBase+5,0.0,0.0,-1.0,bb.zMax()));
_planes.push_back(new ClipPlane(clipPlaneNumberBase+4,0.0,0.0,1.0,-bb.zMin()));
_planes.push_back(new ClipPlane(clipPlaneNumberBase+5,0.0,0.0,-1.0,bb.zMax()));
setLocalStateSetModes(_value);
}
@ -108,7 +108,7 @@ void ClipNode::setStateSetModes(StateSet& stateset,const StateAttribute::GLModeV
void ClipNode::setLocalStateSetModes(const StateAttribute::GLModeValue value)
{
if (!_stateset) _stateset = osgNew StateSet;
if (!_stateset) _stateset = new StateSet;
_stateset->setAllToInherit();
setStateSetModes(*_stateset,value);
}

View File

@ -91,7 +91,7 @@ void CullStack::pushCullingSet()
pixelSizeVector *= scaleRatio;
_modelviewCullingStack.push_back(osgNew osg::CullingSet(*_projectionCullingStack.back(),*_modelviewStack.back(),pixelSizeVector));
_modelviewCullingStack.push_back(new osg::CullingSet(*_projectionCullingStack.back(),*_modelviewStack.back(),pixelSizeVector));
}
@ -130,7 +130,7 @@ void CullStack::pushProjectionMatrix(Matrix* matrix)
{
_projectionStack.push_back(matrix);
osg::CullingSet* cullingSet = osgNew osg::CullingSet();
osg::CullingSet* cullingSet = new osg::CullingSet();
// set up view frustum.
cullingSet->getFrustum().setToUnitFrustum(((_cullingMode&NEAR_PLANE_CULLING)!=0),((_cullingMode&FAR_PLANE_CULLING)!=0));

View File

@ -11,7 +11,7 @@ class DisplaySettingsPtr
DisplaySettingsPtr() : _ptr(0L) {}
DisplaySettingsPtr(DisplaySettings* t): _ptr(t) {}
DisplaySettingsPtr(const DisplaySettingsPtr& rp):_ptr(rp._ptr) { }
~DisplaySettingsPtr() { if (_ptr) osgDelete _ptr; _ptr=0L; }
~DisplaySettingsPtr() { if (_ptr) delete _ptr; _ptr=0L; }
inline DisplaySettings* get() { return _ptr; }
@ -20,7 +20,7 @@ class DisplaySettingsPtr
DisplaySettings* DisplaySettings::instance()
{
static DisplaySettingsPtr s_displaySettings = osgNew DisplaySettings;
static DisplaySettingsPtr s_displaySettings = new DisplaySettings;
return s_displaySettings.get();
}

View File

@ -64,7 +64,7 @@ void Drawable::removeParent(osg::Node* node)
osg::StateSet* Drawable::getOrCreateStateSet()
{
if (!_stateset) _stateset = osgNew StateSet;
if (!_stateset) _stateset = new StateSet;
return _stateset.get();
}

View File

@ -17,10 +17,10 @@ using namespace osg;
GeoSet::GeoSet()
{
// we will use the a default osgDelete functor which
// we will use the a default delete functor which
// assumes that users have allocated arrays with new only
// and that now sharing of attributes exists between GeoSet's.
_adf = osgNew AttributeDeleteFunctor;
_adf = new AttributeDeleteFunctor;
_coords = (Vec3 *)0;
@ -74,7 +74,7 @@ GeoSet::GeoSet(const GeoSet& geoset,const CopyOp& copyop):
_flat_shaded_skip = geoset._flat_shaded_skip;
if (geoset._primLengths)
{
_primLengths = osgNew int [_numprims];
_primLengths = new int [_numprims];
memcpy(_primLengths,geoset._primLengths,_numprims*sizeof(int));
}
else
@ -86,7 +86,7 @@ GeoSet::GeoSet(const GeoSet& geoset,const CopyOp& copyop):
_cindex = geoset._cindex;
if (geoset._coords)
{
_coords = osgNew Vec3 [_numcoords];
_coords = new Vec3 [_numcoords];
memcpy(_coords,geoset._coords,_numcoords*sizeof(Vec3));
}
else
@ -99,7 +99,7 @@ GeoSet::GeoSet(const GeoSet& geoset,const CopyOp& copyop):
_nindex = geoset._nindex;
if (geoset._normals)
{
_normals = osgNew Vec3 [_numnormals];
_normals = new Vec3 [_numnormals];
memcpy(_normals,geoset._normals,_numnormals*sizeof(Vec3));
}
else
@ -112,7 +112,7 @@ GeoSet::GeoSet(const GeoSet& geoset,const CopyOp& copyop):
_colindex = geoset._colindex;
if (geoset._colors)
{
_colors = osgNew Vec4 [_numcolors];
_colors = new Vec4 [_numcolors];
memcpy(_colors,geoset._colors,_numcolors*sizeof(Vec4));
}
else
@ -125,7 +125,7 @@ GeoSet::GeoSet(const GeoSet& geoset,const CopyOp& copyop):
_tindex = geoset._tindex;
if (geoset._tcoords)
{
_tcoords = osgNew Vec2 [_numtcoords];
_tcoords = new Vec2 [_numtcoords];
memcpy(_tcoords,geoset._tcoords,_numtcoords*sizeof(Vec2));
}
else
@ -152,19 +152,19 @@ GeoSet::GeoSet(const GeoSet& geoset,const CopyOp& copyop):
void GeoSet::AttributeDeleteFunctor::operator() (GeoSet* gset)
{
// note, osgDelete checks for NULL so want osgDelete NULL pointers.
osgDelete [] gset->getPrimLengths();
osgDelete [] gset->getCoords();
osgDelete [] gset->getNormals();
osgDelete [] gset->getColors();
osgDelete [] gset->getTextureCoords();
// can't osgDelete a void* right now... interleaved arrays needs to be reimplemented with a proper pointer..
// osgDelete [] gset->getInterleavedArray();
// note, delete checks for NULL so want delete NULL pointers.
delete [] gset->getPrimLengths();
delete [] gset->getCoords();
delete [] gset->getNormals();
delete [] gset->getColors();
delete [] gset->getTextureCoords();
// can't delete a void* right now... interleaved arrays needs to be reimplemented with a proper pointer..
// delete [] gset->getInterleavedArray();
// coord indicies may be shared so we have to go through the long winded
// step of creating unique pointer sets which we then delete. This
// ensures that arrays aren't osgDelete twice. Robert.
// ensures that arrays aren't delete twice. Robert.
std::set<GLushort*> ushortList;
std::set<GLuint*> uintList;
@ -178,14 +178,14 @@ void GeoSet::AttributeDeleteFunctor::operator() (GeoSet* gset)
sitr!=ushortList.end();
++sitr)
{
osgDelete [] *sitr;
delete [] *sitr;
}
for(std::set<GLuint*>::iterator iitr=uintList.begin();
iitr!=uintList.end();
++iitr)
{
osgDelete [] *iitr;
delete [] *iitr;
}
}
@ -961,7 +961,7 @@ Geometry* GeoSet::convertToGeometry()
set_fast_path();
computeNumVerts();
ref_ptr<Geometry> geom = osgNew Geometry;
ref_ptr<Geometry> geom = new Geometry;
geom->setStateSet(getStateSet());
if (_flat_shaded_skip)
@ -972,7 +972,7 @@ Geometry* GeoSet::convertToGeometry()
ShadeModel* shademodel = dynamic_cast<ShadeModel*>(stateset->getAttribute(StateAttribute::SHADEMODEL));
if (!shademodel)
{
shademodel = osgNew osg::ShadeModel;
shademodel = new osg::ShadeModel;
stateset->setAttribute(shademodel);
}
shademodel->setMode( ShadeModel::FLAT );
@ -1018,11 +1018,11 @@ Geometry* GeoSet::convertToGeometry()
if (_coords)
{
geom->setVertexArray(osgNew Vec3Array(_numcoords,_coords));
geom->setVertexArray(new Vec3Array(_numcoords,_coords));
if (_cindex.valid())
{
if (_cindex._is_ushort) geom->setVertexIndices(osgNew UShortArray(_cindex._size,_cindex._ptr._ushort));
else /* _nindex._is_uint*/ geom->setVertexIndices(osgNew UIntArray(_cindex._size,_cindex._ptr._uint));
if (_cindex._is_ushort) geom->setVertexIndices(new UShortArray(_cindex._size,_cindex._ptr._ushort));
else /* _nindex._is_uint*/ geom->setVertexIndices(new UIntArray(_cindex._size,_cindex._ptr._uint));
}
}
@ -1032,10 +1032,10 @@ Geometry* GeoSet::convertToGeometry()
{
if (_nindex.valid())
{
geom->setNormalArray(osgNew Vec3Array(_numnormals,_normals));
geom->setNormalArray(new Vec3Array(_numnormals,_normals));
if (_nindex._is_ushort)
{
UShortArray* indices = osgNew UShortArray;
UShortArray* indices = new UShortArray;
int index=0;
for(int primNo = 0; primNo<_numprims; ++primNo)
{
@ -1049,7 +1049,7 @@ Geometry* GeoSet::convertToGeometry()
}
else
{
UIntArray* indices = osgNew UIntArray;
UIntArray* indices = new UIntArray;
int index=0;
for(int primNo = 0; primNo<_numprims; ++primNo)
{
@ -1064,7 +1064,7 @@ Geometry* GeoSet::convertToGeometry()
}
else
{
Vec3Array* normals = osgNew Vec3Array;
Vec3Array* normals = new Vec3Array;
int index=0;
for(int primNo = 0; primNo<_numprims; ++primNo)
{
@ -1080,12 +1080,12 @@ Geometry* GeoSet::convertToGeometry()
else
{
// usual path.
geom->setNormalArray(osgNew Vec3Array(_numnormals,_normals));
geom->setNormalArray(new Vec3Array(_numnormals,_normals));
if (_nindex.valid())
{
if (_nindex==_cindex) geom->setNormalIndices(geom->getVertexIndices());
else if (_nindex._is_ushort) geom->setNormalIndices(osgNew UShortArray(_nindex._size,_nindex._ptr._ushort));
else /* _nindex._is_uint*/ geom->setNormalIndices(osgNew UIntArray(_nindex._size,_nindex._ptr._uint));
else if (_nindex._is_ushort) geom->setNormalIndices(new UShortArray(_nindex._size,_nindex._ptr._ushort));
else /* _nindex._is_uint*/ geom->setNormalIndices(new UIntArray(_nindex._size,_nindex._ptr._uint));
}
}
}
@ -1096,14 +1096,14 @@ Geometry* GeoSet::convertToGeometry()
{
if (_colindex.valid())
{
geom->setColorArray(osgNew Vec4Array(_numcolors,_colors));
geom->setColorArray(new Vec4Array(_numcolors,_colors));
if (_colindex==_nindex && _normal_binding==BIND_PERVERTEX)
{
geom->setColorIndices(geom->getNormalIndices());
}
else if (_colindex._is_ushort)
{
UShortArray* indices = osgNew UShortArray;
UShortArray* indices = new UShortArray;
int index=0;
for(int primNo = 0; primNo<_numprims; ++primNo)
{
@ -1117,7 +1117,7 @@ Geometry* GeoSet::convertToGeometry()
}
else
{
UIntArray* indices = osgNew UIntArray;
UIntArray* indices = new UIntArray;
int index=0;
for(int primNo = 0; primNo<_numprims; ++primNo)
{
@ -1132,7 +1132,7 @@ Geometry* GeoSet::convertToGeometry()
}
else
{
Vec4Array* colors = osgNew Vec4Array;
Vec4Array* colors = new Vec4Array;
int index=0;
for(int primNo = 0; primNo<_numprims; ++primNo)
{
@ -1149,38 +1149,38 @@ Geometry* GeoSet::convertToGeometry()
else
{
// usual path.
geom->setColorArray(osgNew Vec4Array(_numcolors,_colors));
geom->setColorArray(new Vec4Array(_numcolors,_colors));
if (_colindex.valid())
{
if (_colindex==_cindex) geom->setColorIndices(geom->getVertexIndices());
else if (_colindex==_nindex) geom->setColorIndices(geom->getNormalIndices());
else if (_colindex._is_ushort) geom->setColorIndices(osgNew UShortArray(_colindex._size,_colindex._ptr._ushort));
else /* _colindex._is_uint*/ geom->setColorIndices(osgNew UIntArray(_colindex._size,_colindex._ptr._uint));
else if (_colindex._is_ushort) geom->setColorIndices(new UShortArray(_colindex._size,_colindex._ptr._ushort));
else /* _colindex._is_uint*/ geom->setColorIndices(new UIntArray(_colindex._size,_colindex._ptr._uint));
}
}
}
if (_tcoords)
{
geom->setTexCoordArray(0,osgNew Vec2Array(_numtcoords,_tcoords));
geom->setTexCoordArray(0,new Vec2Array(_numtcoords,_tcoords));
if (_tindex.valid())
{
if (_tindex==_cindex) geom->setTexCoordIndices(0,geom->getVertexIndices());
else if (_tindex==_nindex) geom->setTexCoordIndices(0,geom->getNormalIndices());
else if (_tindex==_colindex) geom->setTexCoordIndices(0,geom->getColorIndices());
else if (_tindex._is_ushort) geom->setTexCoordIndices(0,osgNew UShortArray(_tindex._size,_tindex._ptr._ushort));
else /* _tindex._is_uint*/ geom->setTexCoordIndices(0,osgNew UIntArray(_tindex._size,_tindex._ptr._uint));
else if (_tindex._is_ushort) geom->setTexCoordIndices(0,new UShortArray(_tindex._size,_tindex._ptr._ushort));
else /* _tindex._is_uint*/ geom->setTexCoordIndices(0,new UIntArray(_tindex._size,_tindex._ptr._uint));
}
}
if (_needprimlen)
{
geom->addPrimitiveSet(osgNew DrawArrayLengths((GLenum)_oglprimtype,0, _primLengths, _primLengths+_numprims ));
geom->addPrimitiveSet(new DrawArrayLengths((GLenum)_oglprimtype,0, _primLengths, _primLengths+_numprims ));
}
else
{
geom->addPrimitiveSet(osgNew DrawArrays((GLenum)_oglprimtype,0, _numcoords));
geom->addPrimitiveSet(new DrawArrays((GLenum)_oglprimtype,0, _numcoords));
}
return geom.take();

View File

@ -435,7 +435,7 @@ void Image::flipVertical(int image)
unsigned char* imageData = _data+image*imageSizeInBytes;
// make temp. buffer for one image
unsigned char *tmpData = (unsigned char*) osgMalloc(imageSizeInBytes);
unsigned char *tmpData = (unsigned char*) malloc(imageSizeInBytes);
for (int t=0; t<_t; ++t)
{
@ -447,7 +447,7 @@ void Image::flipVertical(int image)
// insert fliped image
memcpy(imageData, tmpData, imageSizeInBytes);
osgFree(tmpData);
free(tmpData);
++_modifiedTag;
}
@ -547,42 +547,42 @@ Geode* osg::createGeodeForImage(osg::Image* image,float s,float t)
float x = y*(s/t);
// set up the texture.
osg::Texture2D* texture = osgNew osg::Texture2D;
osg::Texture2D* texture = new osg::Texture2D;
texture->setImage(image);
// set up the drawstate.
osg::StateSet* dstate = osgNew osg::StateSet;
osg::StateSet* dstate = new osg::StateSet;
dstate->setMode(GL_CULL_FACE,osg::StateAttribute::OFF);
dstate->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
dstate->setTextureAttributeAndModes(0, texture,osg::StateAttribute::ON);
// set up the geoset.
Geometry* geom = osgNew Geometry;
Geometry* geom = new Geometry;
geom->setStateSet(dstate);
Vec3Array* coords = osgNew Vec3Array(4);
Vec3Array* coords = new Vec3Array(4);
(*coords)[0].set(-x,0.0f,y);
(*coords)[1].set(-x,0.0f,-y);
(*coords)[2].set(x,0.0f,-y);
(*coords)[3].set(x,0.0f,y);
geom->setVertexArray(coords);
Vec2Array* tcoords = osgNew Vec2Array(4);
Vec2Array* tcoords = new Vec2Array(4);
(*tcoords)[0].set(0.0f,1.0f);
(*tcoords)[1].set(0.0f,0.0f);
(*tcoords)[2].set(1.0f,0.0f);
(*tcoords)[3].set(1.0f,1.0f);
geom->setTexCoordArray(0,tcoords);
osg::Vec4Array* colours = osgNew osg::Vec4Array(1);
osg::Vec4Array* colours = new osg::Vec4Array(1);
(*colours)[0].set(1.0f,1.0f,1.0,1.0f);
geom->setColorArray(colours);
geom->setColorBinding(Geometry::BIND_OVERALL);
geom->addPrimitiveSet(osgNew DrawArrays(PrimitiveSet::QUADS,0,4));
geom->addPrimitiveSet(new DrawArrays(PrimitiveSet::QUADS,0,4));
// set up the geode.
osg::Geode* geode = osgNew osg::Geode;
osg::Geode* geode = new osg::Geode;
geode->addDrawable(geom);
return geode;

View File

@ -143,10 +143,10 @@ ImpostorSpriteManager::ImpostorSpriteManager():
_first(NULL),
_last(NULL)
{
_texenv = osgNew TexEnv;
_texenv = new TexEnv;
_texenv->setMode(TexEnv::REPLACE);
_alphafunc = osgNew osg::AlphaFunc;
_alphafunc = new osg::AlphaFunc;
_alphafunc->setFunction( AlphaFunc::GREATER, 0.000f );
}
@ -250,7 +250,7 @@ ImpostorSprite* ImpostorSpriteManager::createOrReuseImpostorSprite(int s,int t,i
// creating new impostor sprite.
StateSet* stateset = osgNew StateSet;
StateSet* stateset = new StateSet;
stateset->setMode(GL_CULL_FACE,osg::StateAttribute::OFF);
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
@ -259,7 +259,7 @@ ImpostorSprite* ImpostorSpriteManager::createOrReuseImpostorSprite(int s,int t,i
stateset->setAttributeAndModes( _alphafunc.get(), StateAttribute::ON );
Texture2D* texture = osgNew Texture2D;
Texture2D* texture = new Texture2D;
texture->setFilter(Texture2D::MIN_FILTER,Texture2D::LINEAR);
texture->setFilter(Texture2D::MAG_FILTER,Texture2D::LINEAR);
@ -267,11 +267,11 @@ ImpostorSprite* ImpostorSpriteManager::createOrReuseImpostorSprite(int s,int t,i
stateset->setTextureAttribute(0,_texenv.get());
/*
TexEnv* texenv = osgNew TexEnv;
TexEnv* texenv = new TexEnv;
texenv->setMode(TexEnv::REPLACE);
stateset->setAttribute(texenv);
AlphaFunc* alphafunc = osgNew osg::AlphaFunc;
AlphaFunc* alphafunc = new osg::AlphaFunc;
alphafunc->setFunction( AlphaFunc::GREATER, 0.000f );
stateset->setAttributeAndModes( alphafunc, StateAttribute::ON );
*/
@ -279,7 +279,7 @@ ImpostorSprite* ImpostorSpriteManager::createOrReuseImpostorSprite(int s,int t,i
// stateset->setMode( GL_ALPHA_TEST, StateAttribute::OFF );
ImpostorSprite* is = osgNew ImpostorSprite;
ImpostorSprite* is = new ImpostorSprite;
is->setStateSet(stateset);
is->setTexture(texture,s,t);

View File

@ -7,8 +7,8 @@ LightSource::LightSource():
{
// switch off culling of light source nodes by default.
setCullingActive(false);
_stateset = osgNew StateSet;
_light = osgNew Light;
_stateset = new StateSet;
_light = new Light;
}
@ -35,7 +35,7 @@ void LightSource::setStateSetModes(StateSet& stateset,StateAttribute::GLModeValu
void LightSource::setLocalStateSetModes(StateAttribute::GLModeValue value)
{
if (!_stateset) _stateset = osgNew StateSet;
if (!_stateset) _stateset = new StateSet;
_stateset->setAllToInherit();
setStateSetModes(*_stateset,value);
}

View File

@ -72,7 +72,7 @@ void Node::ascend(NodeVisitor& nv)
osg::StateSet* Node::getOrCreateStateSet()
{
if (!_stateset) _stateset = osgNew StateSet;
if (!_stateset) _stateset = new StateSet;
return _stateset.get();
}

View File

@ -4,18 +4,18 @@ using namespace osg;
Projection::Projection()
{
_matrix = osgNew Matrix;
_matrix = new Matrix;
}
Projection::Projection(const Projection& projection,const CopyOp& copyop):
Group(projection,copyop),
_matrix(osgNew Matrix(*projection._matrix))
_matrix(new Matrix(*projection._matrix))
{
}
Projection::Projection(const Matrix& mat )
{
_matrix = osgNew Matrix(mat);
_matrix = new Matrix(mat);
}

View File

@ -345,10 +345,10 @@ void StateSet::setGlobalDefaults()
setMode(GL_DEPTH_TEST,StateAttribute::ON);
setAttributeAndModes(osgNew AlphaFunc,StateAttribute::OFF);
setAttributeAndModes(osgNew BlendFunc,StateAttribute::OFF);
setAttributeAndModes(new AlphaFunc,StateAttribute::OFF);
setAttributeAndModes(new BlendFunc,StateAttribute::OFF);
Material *material = osgNew Material;
Material *material = new Material;
material->setColorMode(Material::AMBIENT_AND_DIFFUSE);
setAttributeAndModes(material,StateAttribute::ON);
}

View File

@ -141,7 +141,7 @@ TestSuite* TestGraph::suite(
if(createIfNecessary){
TestSuite* childSuite = osgNew TestSuite(*it);
TestSuite* childSuite = new TestSuite(*it);
tsuite->add(childSuite);
return suite(it, end, childSuite, createIfNecessary);
}
@ -149,7 +149,7 @@ TestSuite* TestGraph::suite(
return 0;
}
TestGraph::TestGraph(): root_(osgNew TestSuite("root"))
TestGraph::TestGraph(): root_(new TestSuite("root"))
{
}

View File

@ -55,7 +55,7 @@ DynamicLibrary* DynamicLibrary::loadLibrary(const std::string& libraryName)
#if defined(WIN32) && !defined(__CYGWIN__)
HANDLE handle = LoadLibrary( fullLibraryName.c_str() );
if (handle) return osgNew DynamicLibrary(libraryName,handle);
if (handle) return new DynamicLibrary(libraryName,handle);
notify(WARN) << "DynamicLibrary::failed loading "<<fullLibraryName<<std::endl;
#elif defined(__DARWIN_OSX__)
NSObjectFileImage image;
@ -64,19 +64,19 @@ DynamicLibrary* DynamicLibrary::loadLibrary(const std::string& libraryName)
// os_handle = NSLinkModule(image, fullLibraryName.c_str(), TRUE);
HANDLE handle = NSLinkModule(image, fullLibraryName.c_str(), TRUE);
NSDestroyObjectFileImage(image);
if (handle) return osgNew DynamicLibrary(libraryName,handle);
if (handle) return new DynamicLibrary(libraryName,handle);
}
// if (os_handle) return osgNew DynamicLibrary(libraryName,os_handle);
// if (os_handle) return new DynamicLibrary(libraryName,os_handle);
notify(WARN) << "DynamicLibrary::failed loading "<<fullLibraryName<<std::endl;
#elif defined(__hpux__)
// BIND_FIRST is neccessary for some reason
HANDLE handle = shl_load ( fullLibraryName.c_str(), BIND_DEFERRED|BIND_FIRST|BIND_VERBOSE, 0);
if (handle) return osgNew DynamicLibrary(libraryName,handle);
if (handle) return new DynamicLibrary(libraryName,handle);
notify(WARN) << "DynamicLibrary::failed loading "<<fullLibraryName<<std::endl;
notify(WARN) << "DynamicLibrary::error "<<strerror(errno)<<std::endl;
#else // other unix
HANDLE handle = dlopen( fullLibraryName.c_str(), RTLD_LAZY );
if (handle) return osgNew DynamicLibrary(libraryName,handle);
if (handle) return new DynamicLibrary(libraryName,handle);
notify(WARN) << "DynamicLibrary::failed loading "<<fullLibraryName<<std::endl;
notify(WARN) << "DynamicLibrary::error "<<dlerror()<<std::endl;
#endif

View File

@ -33,7 +33,7 @@ Field& Field::operator = (const Field& ic)
void Field::_free()
{
// free all data
if (_fieldCache) osgDelete [] _fieldCache;
if (_fieldCache) delete [] _fieldCache;
_init();
@ -64,7 +64,7 @@ void Field::_copy(const Field& ic)
{
_fieldCacheCapacity = ic._fieldCacheCapacity;
_fieldCacheSize = ic._fieldCacheSize;
_fieldCache = osgNew char [_fieldCacheCapacity];
_fieldCache = new char [_fieldCacheCapacity];
strncpy(_fieldCache,ic._fieldCache,_fieldCacheCapacity);
}
else
@ -146,7 +146,7 @@ void Field::addChar(char c)
if (_fieldCache==NULL)
{
if (_fieldCacheCapacity<MIN_CACHE_SIZE) _fieldCacheCapacity=MIN_CACHE_SIZE;
_fieldCache = osgNew char[_fieldCacheCapacity];
_fieldCache = new char[_fieldCacheCapacity];
memset(_fieldCache,0,_fieldCacheCapacity);
_fieldCacheSize = 0;
}
@ -155,10 +155,10 @@ void Field::addChar(char c)
if (_fieldCacheCapacity<MIN_CACHE_SIZE) _fieldCacheCapacity=MIN_CACHE_SIZE;
while (_fieldCacheSize>=_fieldCacheCapacity-1) _fieldCacheCapacity *= 2;
char* tmp_str = _fieldCache;
_fieldCache = osgNew char[_fieldCacheCapacity];
_fieldCache = new char[_fieldCacheCapacity];
memset(_fieldCache,0,_fieldCacheCapacity);
strncpy(_fieldCache,tmp_str,_fieldCacheSize);
osgDelete [] tmp_str;
delete [] tmp_str;
}
_fieldCache[_fieldCacheSize++] = c;

View File

@ -34,16 +34,16 @@ void FieldReaderIterator::_free()
// free all data
if (_previousField)
{
osgDelete _previousField;
delete _previousField;
}
if (_fieldQueue)
{
for(int i=0;i<_fieldQueueCapacity;++i)
{
if (_fieldQueue[i]) osgDelete _fieldQueue[i];
if (_fieldQueue[i]) delete _fieldQueue[i];
_fieldQueue[i] = NULL;
}
osgDelete [] _fieldQueue;
delete [] _fieldQueue;
}
_init();
@ -66,17 +66,17 @@ void FieldReaderIterator::_copy(const FieldReaderIterator& ic)
if (ic._previousField)
{
_previousField = osgNew Field(*ic._previousField);
_previousField = new Field(*ic._previousField);
}
if (ic._fieldQueue && ic._fieldQueueCapacity>0)
{
_fieldQueue = osgNew Field* [ic._fieldQueueCapacity];
_fieldQueue = new Field* [ic._fieldQueueCapacity];
for(int i=0;i<ic._fieldQueueCapacity;++i)
{
if (ic._fieldQueue[i])
{
_fieldQueue[i] = osgNew Field(*ic._fieldQueue[i]);
_fieldQueue[i] = new Field(*ic._fieldQueue[i]);
}
else
{
@ -128,7 +128,7 @@ void FieldReaderIterator::insert(int pos,Field* field)
int newCapacity = _fieldQueueCapacity*2;
if (newCapacity<MINIMUM_FIELD_READER_QUEUE_SIZE) newCapacity = MINIMUM_FIELD_READER_QUEUE_SIZE;
while(_fieldQueueSize>=newCapacity) newCapacity*=2;
Field** newFieldStack = osgNew Field* [newCapacity];
Field** newFieldStack = new Field* [newCapacity];
for(i=0;i<_fieldQueueCapacity;++i)
{
newFieldStack[i] = _fieldQueue[i];
@ -139,7 +139,7 @@ void FieldReaderIterator::insert(int pos,Field* field)
}
// free the old memory.
osgDelete [] _fieldQueue;
delete [] _fieldQueue;
_fieldQueue = newFieldStack;
_fieldQueueCapacity = newCapacity;
@ -158,7 +158,7 @@ void FieldReaderIterator::insert(int pos,const char* str)
{
if (str)
{
Field* field = osgNew Field;
Field* field = new Field;
while(*str!=0)
{
field->addChar(*str);
@ -194,7 +194,7 @@ Field& FieldReaderIterator::field (int pos)
int newCapacity = _fieldQueueCapacity*2;
if (newCapacity<MINIMUM_FIELD_READER_QUEUE_SIZE) newCapacity = MINIMUM_FIELD_READER_QUEUE_SIZE;
while(_fieldQueueSize>=newCapacity) newCapacity*=2;
Field** newFieldStack = osgNew Field* [newCapacity];
Field** newFieldStack = new Field* [newCapacity];
int i;
for(i=0;i<_fieldQueueCapacity;++i)
{
@ -205,14 +205,14 @@ Field& FieldReaderIterator::field (int pos)
newFieldStack[i] = NULL;
}
// free the old memory.
osgDelete [] _fieldQueue;
delete [] _fieldQueue;
_fieldQueue = newFieldStack;
_fieldQueueCapacity = newCapacity;
}
while(!_reader.eof() && pos>=_fieldQueueSize)
{
if (_fieldQueue[_fieldQueueSize]==NULL) _fieldQueue[_fieldQueueSize] = osgNew Field;
if (_fieldQueue[_fieldQueueSize]==NULL) _fieldQueue[_fieldQueueSize] = new Field;
if (_reader.readField(*_fieldQueue[_fieldQueueSize]))
{
++_fieldQueueSize;
@ -250,7 +250,7 @@ FieldReaderIterator& FieldReaderIterator::operator += (int no)
}
else if (no>0)
{
Field** tmpFields = osgNew Field* [no];
Field** tmpFields = new Field* [no];
int i;
for(i=0;i<no;++i)
{
@ -265,7 +265,7 @@ FieldReaderIterator& FieldReaderIterator::operator += (int no)
{
_fieldQueue[_fieldQueueSize+i] = tmpFields[i];
}
osgDelete [] tmpFields;
delete [] tmpFields;
}
return *this;
}

View File

@ -72,7 +72,7 @@ Node* osgDB::readNodeFiles(std::vector<std::string>& commandLine)
}
else // size >1
{
osg::Group* group = osgNew osg::Group;
osg::Group* group = new osg::Group;
for(NodeList::iterator itr=nodeList.begin();
itr!=nodeList.end();
++itr)

View File

@ -34,7 +34,7 @@ class RegistryPtr
RegistryPtr() : _ptr(0L) {}
RegistryPtr(Registry* t): _ptr(t) {}
RegistryPtr(const RegistryPtr& rp):_ptr(rp._ptr) { }
~RegistryPtr() { if (_ptr) osgDelete _ptr; _ptr=0L; }
~RegistryPtr() { if (_ptr) delete _ptr; _ptr=0L; }
inline Registry* get() { return _ptr; }
@ -43,7 +43,7 @@ class RegistryPtr
Registry* Registry::instance()
{
static RegistryPtr s_nodeFactory = osgNew Registry;
static RegistryPtr s_nodeFactory = new Registry;
return s_nodeFactory.get();
}

View File

@ -12,7 +12,7 @@ AnimationPathManipulator::AnimationPathManipulator(osg::AnimationPath* animation
AnimationPathManipulator::AnimationPathManipulator( const std::string& filename )
{
_animationPath = osgNew osg::AnimationPath;
_animationPath = new osg::AnimationPath;
_animationPath->setLoopMode(osg::AnimationPath::LOOP);
_timeOffset = 0.0f;
_timeScale = 1.0f;

View File

@ -67,7 +67,7 @@ void DriveManipulator::home(const GUIEventAdapter& ea,GUIActionAdapter& us)
bool cameraSet = false;
osg::ref_ptr<osg::LineSegment> segDown = osgNew osg::LineSegment;
osg::ref_ptr<osg::LineSegment> segDown = new osg::LineSegment;
segDown->set(ep,bp);
iv.addLineSegment(segDown.get());
@ -106,7 +106,7 @@ void DriveManipulator::home(const GUIEventAdapter& ea,GUIActionAdapter& us)
bp = ep;
bp.z() += _modelScale;
osg::ref_ptr<osg::LineSegment> segUp = osgNew osg::LineSegment;
osg::ref_ptr<osg::LineSegment> segUp = new osg::LineSegment;
segUp->set(ep,bp);
iv.addLineSegment(segUp.get());
@ -183,7 +183,7 @@ void DriveManipulator::init(const GUIEventAdapter& ea,GUIActionAdapter& us)
bool cameraSet = false;
osg::ref_ptr<osg::LineSegment> segDown = osgNew osg::LineSegment;
osg::ref_ptr<osg::LineSegment> segDown = new osg::LineSegment;
segDown->set(ep,bp);
iv.addLineSegment(segDown.get());
@ -222,7 +222,7 @@ void DriveManipulator::init(const GUIEventAdapter& ea,GUIActionAdapter& us)
bp = ep;
bp.z() += _modelScale;
osg::ref_ptr<osg::LineSegment> segUp = osgNew osg::LineSegment;
osg::ref_ptr<osg::LineSegment> segUp = new osg::LineSegment;
segUp->set(ep,bp);
iv.addLineSegment(segUp.get());
@ -507,7 +507,7 @@ bool DriveManipulator::calcMovement()
// check to see if any obstruction in front.
osgUtil::IntersectVisitor iv;
osg::ref_ptr<osg::LineSegment> segForward = osgNew osg::LineSegment;
osg::ref_ptr<osg::LineSegment> segForward = new osg::LineSegment;
segForward->set(_eye,_eye+lv*(signedBuffer+distanceToMove));
iv.addLineSegment(segForward.get());
@ -532,7 +532,7 @@ bool DriveManipulator::calcMovement()
iv.reset();
osg::ref_ptr<osg::LineSegment> segNormal = osgNew osg::LineSegment;
osg::ref_ptr<osg::LineSegment> segNormal = new osg::LineSegment;
segNormal->set(fp,lfp);
iv.addLineSegment(segNormal.get());
@ -568,7 +568,7 @@ bool DriveManipulator::calcMovement()
iv.reset();
osg::ref_ptr<osg::LineSegment> segFall = osgNew osg::LineSegment;
osg::ref_ptr<osg::LineSegment> segFall = new osg::LineSegment;
segFall->set(lfp,dp);
iv.addLineSegment(segFall.get());

View File

@ -100,7 +100,7 @@ Viewer::Viewer()
_printStats = 0; // gwm change from bool was : false;
#ifdef SGV_USE_RTFS
fs = osgNew RTfs( RTFS_MODE_RTC_SPIN );
fs = new RTfs( RTFS_MODE_RTC_SPIN );
frame_rate = 16;
fs->setUpdateRate( frame_rate );
#endif
@ -125,9 +125,9 @@ Viewer::Viewer()
_focusedViewport = 0; // The viewport with mouse/keyboard focus
_frameStamp = osgNew osg::FrameStamp;
_frameStamp = new osg::FrameStamp;
_displaySettings = osgNew osg::DisplaySettings;
_displaySettings = new osg::DisplaySettings;
_recordingAnimationPath = false;
@ -230,7 +230,7 @@ bool Viewer::open()
sceneView->setViewport(view[0], view[1], view[2], view[3]);
osg::ref_ptr<GLUTEventAdapter> ea = osgNew GLUTEventAdapter;
osg::ref_ptr<GLUTEventAdapter> ea = new GLUTEventAdapter;
ea->adaptResize(clockSeconds(),
view[0], view[1],
view[0]+view[2], view[1]+view[3]);
@ -356,7 +356,7 @@ void Viewer::selectCameraManipulator(unsigned int pos, unsigned int viewport)
viewp._cameraManipulator->setCamera(sceneView->getCamera());
viewp._cameraManipulator->setNode(sceneView->getSceneData());
osg::ref_ptr<GLUTEventAdapter> ea = osgNew GLUTEventAdapter;
osg::ref_ptr<GLUTEventAdapter> ea = new GLUTEventAdapter;
viewp._cameraManipulator->init(*ea,*this);
}
@ -378,7 +378,7 @@ float Viewer::app(unsigned int viewport)
// update the camera manipulator.
osg::ref_ptr<GLUTEventAdapter> ea = osgNew GLUTEventAdapter;
osg::ref_ptr<GLUTEventAdapter> ea = new GLUTEventAdapter;
ea->adaptFrame(_frameStamp->getReferenceTime());
for (EventHandlerList::iterator eh = _viewportList[viewport]._eventHandlerList.begin();
@ -628,7 +628,7 @@ void Viewer::showStats(const unsigned int /*viewport*/)
//osg::notify(osg::INFO) << "ntop "<< ntop<< std::endl;
}
maxbins=(primStats[0].getBins()>maxbins)?primStats[0].getBins():maxbins;
osgDelete [] primStats; // free up
delete [] primStats; // free up
}
if (_printStats==Statistics::STAT_DC) { // yet more stats - read the depth complexity
int wid=_ww, ht=_wh; // temporary local screen size - must change during this section
@ -668,9 +668,9 @@ void Viewer::showStats(const unsigned int /*viewport*/)
displaytext(0,(int)(0.86f*vh),ctext);
glEnable(GL_STENCIL_TEST); // re-enable stencil buffer counting
osgDelete [] buffer;
delete [] buffer;
}
osgDelete [] clin;
delete [] clin;
}
}
@ -756,7 +756,7 @@ void Viewer::reshape(GLint w, GLint h)
sceneView->setViewport(view[0], view[1], view[2], view[3]);
osg::ref_ptr<GLUTEventAdapter> ea = osgNew GLUTEventAdapter;
osg::ref_ptr<GLUTEventAdapter> ea = new GLUTEventAdapter;
ea->adaptResize(clockSeconds(),
view[0], view[1],
view[0]+view[2], view[1]+view[3]);
@ -780,7 +780,7 @@ void Viewer::reshape(GLint w, GLint h)
void Viewer::mouseMotion(int x, int y)
{
osg::ref_ptr<GLUTEventAdapter> ea = osgNew GLUTEventAdapter;
osg::ref_ptr<GLUTEventAdapter> ea = new GLUTEventAdapter;
ea->adaptMouseMotion(clockSeconds(),x,y);
bool handled = false;
@ -810,7 +810,7 @@ void Viewer::mouseMotion(int x, int y)
void Viewer::mousePassiveMotion(int x, int y)
{
osg::ref_ptr<GLUTEventAdapter> ea = osgNew GLUTEventAdapter;
osg::ref_ptr<GLUTEventAdapter> ea = new GLUTEventAdapter;
ea->adaptMousePassiveMotion(clockSeconds(),x,y);
// Switch viewport focus if no buttons are pressed
@ -844,7 +844,7 @@ void Viewer::mousePassiveMotion(int x, int y)
void Viewer::mouse(int button, int state, int x, int y)
{
osg::ref_ptr<GLUTEventAdapter> ea = osgNew GLUTEventAdapter;
osg::ref_ptr<GLUTEventAdapter> ea = new GLUTEventAdapter;
ea->adaptMouse(clockSeconds(),button,state,x,y);
// Switch viewport focus if button is pressed, and it is the only one
@ -884,7 +884,7 @@ void Viewer::mouse(int button, int state, int x, int y)
void Viewer::keyboard(unsigned char key, int x, int y)
{
osg::ref_ptr<GLUTEventAdapter> ea = osgNew GLUTEventAdapter;
osg::ref_ptr<GLUTEventAdapter> ea = new GLUTEventAdapter;
ea->adaptKeyboard(clockSeconds(),key,x,y);
for ( EventHandlerList::iterator eh =
@ -912,7 +912,7 @@ void Viewer::keyboard(unsigned char key, int x, int y)
osg::StateSet* globalStateSet = sceneView->getGlobalStateSet();
if (!globalStateSet)
{
globalStateSet = osgNew osg::StateSet;
globalStateSet = new osg::StateSet;
sceneView->setGlobalStateSet(globalStateSet);
}
@ -1022,7 +1022,7 @@ void Viewer::keyboard(unsigned char key, int x, int y)
osg::ShadeModel* shademodel = dynamic_cast<osg::ShadeModel*>(stateset->getAttribute(osg::StateAttribute::SHADEMODEL));
if (!shademodel)
{
shademodel = osgNew osg::ShadeModel;
shademodel = new osg::ShadeModel;
stateset->setAttribute(shademodel,osg::StateAttribute::OVERRIDE);
}
@ -1096,7 +1096,7 @@ void Viewer::keyboard(unsigned char key, int x, int y)
// 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|osg::StateAttribute::OFF);
// static osg::ref_ptr<osg::Texture> blank_texture = osgNew osg::Texture2D;
// static osg::ref_ptr<osg::Texture> blank_texture = new osg::Texture2D;
// globalStateSet->setTextureAttribute(0,blank_texture.get());
}
break;
@ -1106,7 +1106,7 @@ void Viewer::keyboard(unsigned char key, int x, int y)
osg::LightModel* lightmodel = dynamic_cast<LightModel*>(globalStateSet->getAttribute(osg::StateAttribute::LIGHTMODEL));
if (lightmodel)
{
lightmodel = osgNew osg::LightModel;
lightmodel = new osg::LightModel;
globalStateSet->setAttribute(lightmodel);
}
lightmodel->setTwoSided(!lightmodel->getTwoSided());
@ -1116,7 +1116,7 @@ void Viewer::keyboard(unsigned char key, int x, int y)
case 'w' :
{
polymode = (polymode+1)%3;
osg::PolygonMode* polyModeObj = osgNew osg::PolygonMode;
osg::PolygonMode* polyModeObj = new osg::PolygonMode;
polyModeObj->setMode(osg::PolygonMode::FRONT_AND_BACK,polymodes[polymode]);
globalStateSet->setAttribute(polyModeObj);
}
@ -1183,12 +1183,12 @@ void Viewer::keyboard(unsigned char key, int x, int y)
case 'O' :
{
osg::ref_ptr<osg::Viewport> viewport = osgNew osg::Viewport;
osg::ref_ptr<osg::Viewport> viewport = new osg::Viewport;
viewport->setViewport(_wx,_wy,_ww,_wh);
std::string filename("screenshot.bmp");
glReadBuffer(GL_FRONT);
osg::ref_ptr<Image> image = osgNew osg::Image;
osg::ref_ptr<Image> image = new osg::Image;
image->readPixels(viewport->x(),viewport->y(),viewport->width(),viewport->height(),
GL_RGB,GL_UNSIGNED_BYTE);
@ -1207,12 +1207,12 @@ void Viewer::keyboard(unsigned char key, int x, int y)
cov.pushViewport(sceneView->getViewport());
if (sceneView->getProjectionMatrix()) cov.pushProjectionMatrix(sceneView->getProjectionMatrix());
else if (sceneView->getCamera()) cov.pushProjectionMatrix(osgNew Matrix(sceneView->getCamera()->getProjectionMatrix()));
else cov.pushProjectionMatrix(osgNew Matrix());
else if (sceneView->getCamera()) cov.pushProjectionMatrix(new Matrix(sceneView->getCamera()->getProjectionMatrix()));
else cov.pushProjectionMatrix(new Matrix());
if (sceneView->getModelViewMatrix()) cov.pushModelViewMatrix(sceneView->getModelViewMatrix());
else if (sceneView->getCamera()) cov.pushModelViewMatrix(osgNew Matrix(sceneView->getCamera()->getModelViewMatrix()));
else cov.pushModelViewMatrix(osgNew Matrix());
else if (sceneView->getCamera()) cov.pushModelViewMatrix(new Matrix(sceneView->getCamera()->getModelViewMatrix()));
else cov.pushModelViewMatrix(new Matrix());
sceneView->getSceneData()->accept(cov);
@ -1236,7 +1236,7 @@ void Viewer::keyboard(unsigned char key, int x, int y)
return;
}
osg::ref_ptr<osg::LineSegment> lineSegment = osgNew osg::LineSegment;
osg::ref_ptr<osg::LineSegment> lineSegment = new osg::LineSegment;
lineSegment->set(near_point,far_point);
osg::notify(osg::NOTICE) << "start("<<lineSegment->start()<<") end("<<lineSegment->end()<<")"<< std::endl;
@ -1455,7 +1455,7 @@ void Viewer::help(std::ostream& fout)
<<" current mouse x and mouse y position."<< std::endl
<< std::endl
<<"r Calculate and report the intersections with the scene under the"<< std::endl
<<" current mouse x and mouse y position and osgDelete the nearest"<< std::endl
<<" current mouse x and mouse y position and delete the nearest"<< std::endl
<<" interesected geoset."<< std::endl
<< std::endl
<<"7 Set the background color to black."<< std::endl
@ -1507,7 +1507,7 @@ bool Viewer::run()
{
// Reset the views of all of SceneViews
osg::ref_ptr<GLUTEventAdapter> ea = osgNew GLUTEventAdapter;
osg::ref_ptr<GLUTEventAdapter> ea = new GLUTEventAdapter;
for(ViewportList::iterator itr=_viewportList.begin();
itr!=_viewportList.end();
@ -1554,7 +1554,7 @@ unsigned int Viewer::addViewport(osgUtil::SceneView* sv,
unsigned int Viewer::addViewport(osg::Node* rootnode,
float x, float y, float width, float height)
{
osgUtil::SceneView *sceneView = osgNew osgUtil::SceneView(_displaySettings.get());
osgUtil::SceneView *sceneView = new osgUtil::SceneView(_displaySettings.get());
sceneView->setDefaults();
sceneView->setSceneData(rootnode);

View File

@ -3,9 +3,9 @@
osgParticle::ModularEmitter::ModularEmitter()
: Emitter(),
counter_(osgNew RandomRateCounter),
placer_(osgNew PointPlacer),
shooter_(osgNew RadialShooter)
counter_(new RandomRateCounter),
placer_(new PointPlacer),
shooter_(new RadialShooter)
{
}

View File

@ -24,9 +24,9 @@ osgParticle::Particle::Particle()
sr_(0.2f, 0.2f),
ar_(1, 0),
cr_(osg::Vec4(1, 1, 1, 1), osg::Vec4(1, 1, 1, 1)),
si_(osgNew LinearInterpolator),
ai_(osgNew LinearInterpolator),
ci_(osgNew LinearInterpolator),
si_(new LinearInterpolator),
ai_(new LinearInterpolator),
ci_(new LinearInterpolator),
alive_(true),
mustdie_(false),
lifetime_(2),

View File

@ -125,30 +125,30 @@ void osgParticle::ParticleSystem::drawImplementation(osg::State &state) const
void osgParticle::ParticleSystem::setDefaultAttributes(const std::string &texturefile, bool emissive_particles, bool lighting, int texture_unit)
{
osg::StateSet *stateset = osgNew osg::StateSet;
osg::StateSet *stateset = new osg::StateSet;
stateset->setMode(GL_LIGHTING, lighting? osg::StateAttribute::ON: osg::StateAttribute::OFF);
stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
osg::Material *material = osgNew osg::Material;
osg::Material *material = new osg::Material;
material->setSpecular(osg::Material::FRONT, osg::Vec4(0, 0, 0, 1));
material->setEmission(osg::Material::FRONT, osg::Vec4(0, 0, 0, 1));
material->setColorMode(lighting? osg::Material::AMBIENT_AND_DIFFUSE : osg::Material::OFF);
stateset->setAttributeAndModes(material, osg::StateAttribute::ON);
if (!texturefile.empty()) {
osg::Texture2D *texture = osgNew osg::Texture2D;
osg::Texture2D *texture = new osg::Texture2D;
texture->setImage(osgDB::readImageFile(texturefile));
texture->setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR);
texture->setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR);
stateset->setTextureAttributeAndModes(texture_unit, texture, osg::StateAttribute::ON);
osg::TexEnv *texenv = osgNew osg::TexEnv;
osg::TexEnv *texenv = new osg::TexEnv;
texenv->setMode(osg::TexEnv::MODULATE);
stateset->setTextureAttribute(texture_unit, texenv);
}
osg::BlendFunc *blend = osgNew osg::BlendFunc;
osg::BlendFunc *blend = new osg::BlendFunc;
if (emissive_particles) {
blend->setFunction(osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::ONE);
} else {

View File

@ -409,7 +409,7 @@ class ReaderWriterGEO : public ReaderWriter
}
else
{
Group* group = osgNew Group;
Group* group = new Group;
group->setName("import group");
for(NodeList::iterator itr=nodeList.begin();
itr!=nodeList.end();
@ -698,10 +698,10 @@ class ReaderWriterGEO : public ReaderWriter
osg::MatrixTransform *makeText(georecord *gr) { // make transform, geode & text
std::string ttfPath("fonts/times.ttf");
int gFontSize1=2;
osgText::PolygonFont* polygonFont= osgNew osgText::PolygonFont(ttfPath,
osgText::PolygonFont* polygonFont= new osgText::PolygonFont(ttfPath,
gFontSize1,
3);
osgText::Text *text= osgNew osgText::Text(polygonFont);
osgText::Text *text= new osgText::Text(polygonFont);
const geoField *gfd=gr->getField(GEO_DB_TEXT_NAME);
//const char *name=gfd ? gfd->getChar() : "a text";
gfd=gr->getField(GEO_DB_TEXT_STRING);
@ -735,7 +735,7 @@ class ReaderWriterGEO : public ReaderWriter
}
}
osg::Geode *geod=new osg::Geode;
osg::StateSet *textState = osgNew osg::StateSet();
osg::StateSet *textState = new osg::StateSet();
textState->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
geod->setStateSet( textState );
osg::MatrixTransform *numt=new osg::MatrixTransform;

View File

@ -264,7 +264,7 @@ Lwo2::_read_layer(unsigned long size)
unsigned short number = _read_short();
size -= 2;
Lwo2Layer* layer = osgNew Lwo2Layer();
Lwo2Layer* layer = new Lwo2Layer();
_layers[number] = layer;
_current_layer = layer;
layer->_number = number;
@ -540,7 +540,7 @@ Lwo2::_read_image_definition(unsigned long size)
void
Lwo2::_read_surface(unsigned long size)
{
Lwo2Surface* surface = osgNew Lwo2Surface();
Lwo2Surface* surface = new Lwo2Surface();
surface->image_index = -1;
surface->state_set = NULL;
@ -658,7 +658,7 @@ Lwo2::GenerateGroup( Group& group )
// itr++;
// itr++;
{
osg::Geode* geode = osgNew osg::Geode();
osg::Geode* geode = new osg::Geode();
notify(DEBUG_INFO) << "Generate geode for layer " << (*itr).first << std::endl;
DrawableToTagMapping tag_mapping;
@ -684,7 +684,7 @@ Lwo2::_generate_statesets_from_surfaces()
for (IteratorSurfaces itr_surf = _surfaces.begin(); itr_surf != _surfaces.end(); itr_surf++)
{
Lwo2Surface* surface = (*itr_surf).second;
StateSet* state_set = osgNew osg::StateSet;
StateSet* state_set = new osg::StateSet;
notify(DEBUG_INFO) << "\tcreating surface " << (*itr_surf).first << std::endl;
@ -696,14 +696,14 @@ Lwo2::_generate_statesets_from_surfaces()
notify(DEBUG_INFO) << "\tresult - " << image << std::endl;
if (image)
{
Texture2D* texture = osgNew osg::Texture2D;
Texture2D* texture = new osg::Texture2D;
texture->setImage(image);
state_set->setTextureAttributeAndModes(0, texture, StateAttribute::ON);
}
}
// set color
Material* material = osgNew Material();
Material* material = new Material();
Vec4 color(surface->color[0],
surface->color[1],
surface->color[2],
@ -712,7 +712,7 @@ Lwo2::_generate_statesets_from_surfaces()
state_set->setAttribute(material);
// setup culling
CullFace* cull = osgNew CullFace();
CullFace* cull = new CullFace();
cull->setMode(CullFace::BACK);
state_set->setAttribute(cull);
state_set->setMode(GL_CULL_FACE, StateAttribute::ON);

View File

@ -95,13 +95,13 @@ Lwo2Layer::GenerateGeode( Geode& geode, short tags_count, DrawableToTagMapping&
have_texture_coords = false;
// new geometry
ref_ptr<Geometry> geometry = osgNew Geometry;
ref_ptr<Geometry> geometry = new Geometry;
// create coords array
ref_ptr<Vec3Array> coords = osgNew Vec3Array;
ref_ptr<Vec3Array> coords = new Vec3Array;
// create texture array
ref_ptr<Vec2Array> texcoords = osgNew Vec2Array;
ref_ptr<Vec2Array> texcoords = new Vec2Array;
// selecting polygons for current layer only
int polygon_index = 0;
@ -159,15 +159,15 @@ Lwo2Layer::GenerateGeode( Geode& geode, short tags_count, DrawableToTagMapping&
unsigned int points_count = (*polygon_iterator).size();
if (points_count == 3)
{
geometry->addPrimitiveSet(osgNew DrawArrays(PrimitiveSet::TRIANGLES, points_start, points_count));
geometry->addPrimitiveSet(new DrawArrays(PrimitiveSet::TRIANGLES, points_start, points_count));
}
else if (points_count == 4)
{
geometry->addPrimitiveSet(osgNew DrawArrays(PrimitiveSet::QUADS, points_start, points_count));
geometry->addPrimitiveSet(new DrawArrays(PrimitiveSet::QUADS, points_start, points_count));
}
else
{
geometry->addPrimitiveSet(osgNew DrawArrays(PrimitiveSet::POLYGON, points_start, points_count));
geometry->addPrimitiveSet(new DrawArrays(PrimitiveSet::POLYGON, points_start, points_count));
}
}
}
@ -194,7 +194,7 @@ Lwo2Layer::GenerateGeode( Geode& geode, short tags_count, DrawableToTagMapping&
unsigned int points_start = (*coords).size() - (*polygon_iterator).size();
unsigned int points_count = (*polygon_iterator).size();
geometry->addPrimitiveSet(osgNew DrawArrays(PrimitiveSet::TRIANGLE_FAN, points_start, points_count));
geometry->addPrimitiveSet(new DrawArrays(PrimitiveSet::TRIANGLE_FAN, points_start, points_count));
}
// triangle strips of current layer
@ -219,7 +219,7 @@ Lwo2Layer::GenerateGeode( Geode& geode, short tags_count, DrawableToTagMapping&
unsigned int points_start = (*coords).size() - (*polygon_iterator).size();
unsigned int points_count = (*polygon_iterator).size();
geometry->addPrimitiveSet(osgNew DrawArrays(PrimitiveSet::TRIANGLE_STRIP, points_start, points_count));
geometry->addPrimitiveSet(new DrawArrays(PrimitiveSet::TRIANGLE_STRIP, points_start, points_count));
}
// add geometry if it contains any points

View File

@ -70,10 +70,10 @@ osgDB::RegisterReaderWriterProxy<ReaderWriterLWO> g_lwoReaderWriterProxy;
osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO2(const std::string& fileName, const osgDB::ReaderWriter::Options*)
{
std::auto_ptr<Lwo2> lwo2(osgNew Lwo2());
std::auto_ptr<Lwo2> lwo2(new Lwo2());
if (lwo2->ReadFile(fileName))
{
osg::ref_ptr<Group> group = osgNew osg::Group();
osg::ref_ptr<Group> group = new osg::Group();
if (lwo2->GenerateGroup(*group)) return group.take();
}
return ReadResult::FILE_NOT_HANDLED;
@ -145,14 +145,14 @@ osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO1(const std::string
{
lwMaterial& lw_material = lw->material[itr->first];
gc._geom = osgNew osg::Geometry;
gc._geom = new osg::Geometry;
osg::Vec3Array* vertArray = osgNew osg::Vec3Array(gc._numPoints);
osg::Vec3Array* vertArray = new osg::Vec3Array(gc._numPoints);
gc._vertices = vertArray->begin();
gc._geom->setVertexArray(vertArray);
// set up color.
osg::Vec4Array* colors = osgNew osg::Vec4Array(1);
osg::Vec4Array* colors = new osg::Vec4Array(1);
(*colors)[0].set(lw_material.r,
lw_material.g,
lw_material.b,
@ -171,10 +171,10 @@ osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO1(const std::string
if (image)
{
// create state
osg::StateSet* stateset = osgNew osg::StateSet;
osg::StateSet* stateset = new osg::StateSet;
// create texture
osg::Texture2D* texture = osgNew osg::Texture2D;
osg::Texture2D* texture = new osg::Texture2D;
texture->setImage(image);
// texture wrap mode
@ -194,7 +194,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO1(const std::string
gc._geom->setStateSet(stateset);
osg::Vec2Array* texcoordArray = osgNew osg::Vec2Array(gc._numPoints);
osg::Vec2Array* texcoordArray = new osg::Vec2Array(gc._numPoints);
gc._texcoords = texcoordArray->begin();
gc._geom->setTexCoordArray(0,texcoordArray);
}
@ -234,7 +234,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO1(const std::string
break;
}
gc._geom->addPrimitiveSet(osgNew osg::DrawArrays(mode,gc._coordCount,face.index_cnt));
gc._geom->addPrimitiveSet(new osg::DrawArrays(mode,gc._coordCount,face.index_cnt));
gc._coordCount += face.index_cnt;
// From the spec_low.lxt :
@ -261,7 +261,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO1(const std::string
}
}
osg::Geode* geode = osgNew osg::Geode;
osg::Geode* geode = new osg::Geode;
osgUtil::Tesselator tesselator;

View File

@ -16,7 +16,7 @@ const char* AlphaFunc_getFuncStr(AlphaFunc::ComparisonFunction func);
// register the read and write functions with the osgDB::Registry.
RegisterDotOsgWrapperProxy g_AlphaFuncProxy
(
osgNew osg::AlphaFunc,
new osg::AlphaFunc,
"AlphaFunc",
"Object StateAttribute AlphaFunc",
&AlphaFunc_readLocalData,

View File

@ -18,7 +18,7 @@ bool AnimationPath_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
// register the read and write functions with the osgDB::Registry.
osgDB::RegisterDotOsgWrapperProxy AnimationPath_Proxy
(
osgNew osg::AnimationPath,
new osg::AnimationPath,
"AnimationPath",
"Object AnimationPath",
AnimationPath_readLocalData,

View File

@ -14,7 +14,7 @@ bool Billboard_writeLocalData(const Object& obj, Output& fw);
// register the read and write functions with the osgDB::Registry.
RegisterDotOsgWrapperProxy g_BillboardProxy
(
osgNew osg::Billboard,
new osg::Billboard,
"Billboard",
"Object Node Geode Billboard",
&Billboard_readLocalData,

View File

@ -18,7 +18,7 @@ const char* BlendFunc_getModeStr(int value);
RegisterDotOsgWrapperProxy g_TransparencyProxy
(
osgNew osg::BlendFunc,
new osg::BlendFunc,
"Transparency",
"Object StateAttribute Transparency",
&BlendFunc_readLocalData,
@ -27,7 +27,7 @@ RegisterDotOsgWrapperProxy g_TransparencyProxy
RegisterDotOsgWrapperProxy g_BlendFuncProxy
(
osgNew osg::BlendFunc,
new osg::BlendFunc,
"BlendFunc",
"Object StateAttribute BlendFunc",
&BlendFunc_readLocalData,

View File

@ -15,7 +15,7 @@ bool ClearNode_writeLocalData(const Object& obj, Output& fw);
RegisterDotOsgWrapperProxy g_EarthSkyProxy
(
osgNew osg::ClearNode,
new osg::ClearNode,
"EarthSky",
"Object Node EarthSky Group",
&ClearNode_readLocalData,
@ -24,7 +24,7 @@ RegisterDotOsgWrapperProxy g_EarthSkyProxy
RegisterDotOsgWrapperProxy g_ClearNodeProxy
(
osgNew osg::ClearNode,
new osg::ClearNode,
"ClearNode",
"Object Node ClearNode Group",
&ClearNode_readLocalData,

View File

@ -18,7 +18,7 @@ bool ClipPlane_writeLocalData(const Object& obj, Output& fw);
// register the read and write functions with the osgDB::Registry.
RegisterDotOsgWrapperProxy g_ClipPlaneProxy
(
osgNew osg::ClipPlane,
new osg::ClipPlane,
"ClipPlane",
"Object StateAttribute ClipPlane",
&ClipPlane_readLocalData,

View File

@ -16,7 +16,7 @@ const char* ColorMask_getModeStr(bool mode);
// register the read and write functions with the osgDB::Registry.
RegisterDotOsgWrapperProxy g_ColorMaskProxy
(
osgNew osg::ColorMask,
new osg::ColorMask,
"ColorMask",
"Object StateAttribute ColorMask",
&ColorMask_readLocalData,

View File

@ -14,7 +14,7 @@ bool ColorMatrix_writeLocalData(const Object& obj, Output& fw);
// register the read and write functions with the osgDB::Registry.
RegisterDotOsgWrapperProxy g_ColorMatrixProxy
(
osgNew osg::ColorMatrix,
new osg::ColorMatrix,
"ColorMatrix",
"Object StateAttribute ColorMatrix",
&ColorMatrix_readLocalData,

View File

@ -20,7 +20,7 @@ bool ConvexPlanarOccluder_writeLocalData(const Object& obj, Output& fw);
// register the read and write functions with the osgDB::Registry.
RegisterDotOsgWrapperProxy g_ConvexPlanarOccluderFuncProxy
(
osgNew osg::ConvexPlanarOccluder,
new osg::ConvexPlanarOccluder,
"ConvexPlanarOccluder",
"Object ConvexPlanarOccluder",
&ConvexPlanarOccluder_readLocalData,

View File

@ -14,7 +14,7 @@ bool CullFace_writeLocalData(const Object& obj, Output& fw);
// register the read and write functions with the osgDB::Registry.
RegisterDotOsgWrapperProxy g_CullFaceFuncProxy
(
osgNew osg::CullFace,
new osg::CullFace,
"CullFace",
"Object StateAttribute CullFace",
&CullFace_readLocalData,

View File

@ -15,7 +15,7 @@ bool DOFTransform_writeLocalData(const Object& obj, Output& fw);
// register the read and write functions with the osgDB::Registry.
RegisterDotOsgWrapperProxy g_DOFTransformProxy
(
osgNew osg::DOFTransform,
new osg::DOFTransform,
"DOFTransform",
"Object Node Transform DOFTransform Group",
&DOFTransform_readLocalData,

View File

@ -18,7 +18,7 @@ const char* Depth_getFuncStr(Depth::Function func);
// register the read and write functions with the osgDB::Registry.
RegisterDotOsgWrapperProxy g_DepthProxy
(
osgNew osg::Depth,
new osg::Depth,
"Depth",
"Object StateAttribute Depth",
&Depth_readLocalData,

View File

@ -27,7 +27,7 @@ bool Drawable_readLocalData(Object& obj, Input& fr)
Drawable& drawable = static_cast<Drawable&>(obj);
static ref_ptr<StateSet> s_drawstate = osgNew osg::StateSet;
static ref_ptr<StateSet> s_drawstate = new osg::StateSet;
if (StateSet* readState = static_cast<StateSet*>(fr.readObjectOfType(*s_drawstate)))
{
drawable.setStateSet(readState);

View File

@ -20,7 +20,7 @@ const char* Fog_getModeStr(Fog::Mode mode);
// register the read and write functions with the osgDB::Registry.
RegisterDotOsgWrapperProxy g_FogProxy
(
osgNew osg::Fog,
new osg::Fog,
"Fog",
"Object StateAttribute Fog",
&Fog_readLocalData,

View File

@ -14,7 +14,7 @@ bool FrontFace_writeLocalData(const Object& obj, Output& fw);
// register the read and write functions with the osgDB::Registry.
RegisterDotOsgWrapperProxy g_FrontFaceProxy
(
osgNew osg::FrontFace,
new osg::FrontFace,
"FrontFace",
"Object StateAttribute FrontFace",
&FrontFace_readLocalData,

View File

@ -27,7 +27,7 @@ int GeoSet_getInterleavedRowLength(GeoSet::InterleaveArrayType at);
// register the read and write functions with the osgDB::Registry.
RegisterDotOsgWrapperProxy g_GeoSetFuncProxy
(
osgNew osg::GeoSet,
new osg::GeoSet,
"GeoSet",
"Object Drawable GeoSet",
&GeoSet_readLocalData,
@ -38,7 +38,7 @@ RegisterDotOsgWrapperProxy g_GeoSetFuncProxy
// register the old style 'Geoset' keyword read and write functions with the osgDB::Registry.
RegisterDotOsgWrapperProxy g_GeosetFuncProxy
(
osgNew osg::GeoSet,
new osg::GeoSet,
"Geoset",
"Object Drawable Geoset",
&GeoSet_readLocalData,
@ -136,7 +136,7 @@ bool GeoSet_readLocalData(Object& obj, Input& fr)
int capacity;
if (!fr[1].getInt(capacity)) capacity=100;
int size = 0;
int* list = osgNew int [capacity];
int* list = new int [capacity];
memset(list,0,capacity*sizeof(int));
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
{
@ -150,13 +150,13 @@ bool GeoSet_readLocalData(Object& obj, Input& fr)
int oldCapacity = capacity;
while(capacity<=size) capacity *= 2;
int* oldList = list;
list = osgNew int[capacity];
list = new int[capacity];
memset(list,0,capacity*sizeof(int));
for(int i=0;i<oldCapacity;++i)
{
list[i] = oldList[i];
}
osgDelete [] oldList;
delete [] oldList;
}
list[size] = primLength;
++size;
@ -227,7 +227,7 @@ bool GeoSet_readLocalData(Object& obj, Input& fr)
}
int size = 0;
coordList = osgNew Vec3[capacity];
coordList = new Vec3[capacity];
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
{
@ -241,14 +241,14 @@ bool GeoSet_readLocalData(Object& obj, Input& fr)
int oldCapacity = capacity;
while(capacity<=size) capacity *= 2;
Vec3* oldList = coordList;
coordList = osgNew Vec3[capacity];
coordList = new Vec3[capacity];
for(int i=0;i<oldCapacity;++i)
{
coordList[i][0] = oldList[i][0];
coordList[i][1] = oldList[i][1];
coordList[i][2] = oldList[i][2];
}
osgDelete [] oldList;
delete [] oldList;
}
coordList[size][0] = x;
coordList[size][1] = y;
@ -297,7 +297,7 @@ bool GeoSet_readLocalData(Object& obj, Input& fr)
}
int size = 0;
normalList = osgNew Vec3[capacity];
normalList = new Vec3[capacity];
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
{
@ -311,14 +311,14 @@ bool GeoSet_readLocalData(Object& obj, Input& fr)
int oldCapacity = capacity;
while(capacity<=size) capacity *= 2;
Vec3* oldList = normalList;
normalList = osgNew Vec3[capacity];
normalList = new Vec3[capacity];
for(int i=0;i<oldCapacity;++i)
{
normalList[i][0] = oldList[i][0];
normalList[i][1] = oldList[i][1];
normalList[i][2] = oldList[i][2];
}
osgDelete [] oldList;
delete [] oldList;
}
normalList[size][0] = x;
normalList[size][1] = y;
@ -366,7 +366,7 @@ bool GeoSet_readLocalData(Object& obj, Input& fr)
}
int size = 0;
colorList = osgNew Vec4[capacity];
colorList = new Vec4[capacity];
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
{
@ -381,7 +381,7 @@ bool GeoSet_readLocalData(Object& obj, Input& fr)
int oldCapacity = capacity;
while(capacity<=size) capacity *= 2;
Vec4* oldList = colorList;
colorList = osgNew Vec4[capacity];
colorList = new Vec4[capacity];
for(int i=0;i<oldCapacity;++i)
{
colorList[i][0] = oldList[i][0];
@ -389,7 +389,7 @@ bool GeoSet_readLocalData(Object& obj, Input& fr)
colorList[i][2] = oldList[i][2];
colorList[i][3] = oldList[i][3];
}
osgDelete [] oldList;
delete [] oldList;
}
colorList[size][0] = r;
@ -440,7 +440,7 @@ bool GeoSet_readLocalData(Object& obj, Input& fr)
}
int size = 0;
textureList = osgNew Vec2[capacity];
textureList = new Vec2[capacity];
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
{
@ -453,13 +453,13 @@ bool GeoSet_readLocalData(Object& obj, Input& fr)
int oldCapacity = capacity;
while(capacity<=size) capacity *= 2;
Vec2* oldList = textureList;
textureList = osgNew Vec2[capacity];
textureList = new Vec2[capacity];
for(int i=0;i<oldCapacity;++i)
{
textureList[i][0] = oldList[i][0];
textureList[i][1] = oldList[i][1];
}
osgDelete [] oldList;
delete [] oldList;
}
textureList[size][0] = r;
textureList[size][1] = s;
@ -534,9 +534,9 @@ bool GeoSet_readLocalData(Object& obj, Input& fr)
int rowLength = GeoSet_getInterleavedRowLength(iaType);
int size = 0;
unsigned char* dataList = osgNew unsigned char[capacity*rowLength];
unsigned char* dataList = new unsigned char[capacity*rowLength];
unsigned char* rowData = osgNew unsigned char [rowLength];
unsigned char* rowData = new unsigned char [rowLength];
float floatData;
int intData;
@ -571,9 +571,9 @@ bool GeoSet_readLocalData(Object& obj, Input& fr)
int oldCapacity = capacity;
while(capacity<=size) capacity *= 2;
unsigned char* oldList = dataList;
dataList = osgNew unsigned char[capacity*rowLength];
dataList = new unsigned char[capacity*rowLength];
memcpy(dataList,oldList,oldCapacity*rowLength);
osgDelete [] oldList;
delete [] oldList;
}
memcpy(dataList+size*rowLength,rowData,rowLength);
++size;
@ -585,7 +585,7 @@ bool GeoSet_readLocalData(Object& obj, Input& fr)
}
}
osgDelete [] rowData;
delete [] rowData;
interleavedArray = (float*)dataList;
}
@ -928,7 +928,7 @@ bool GeoSet_readIndexData(Input& fr, const char* IndexName, GeoSet::IndexPointer
if (is_ushort)
{
// read ushorts...
GLushort* coordIndexList = osgNew GLushort[capacity];
GLushort* coordIndexList = new GLushort[capacity];
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
{
@ -941,12 +941,12 @@ bool GeoSet_readIndexData(Input& fr, const char* IndexName, GeoSet::IndexPointer
int oldCapacity = capacity;
while(capacity<=size) capacity *= 2;
GLushort* oldList = coordIndexList;
coordIndexList = osgNew GLushort[capacity];
coordIndexList = new GLushort[capacity];
for(int i=0;i<oldCapacity;++i)
{
coordIndexList[i] = oldList[i];
}
osgDelete [] oldList;
delete [] oldList;
}
coordIndexList[size] = index;
++size;
@ -964,7 +964,7 @@ bool GeoSet_readIndexData(Input& fr, const char* IndexName, GeoSet::IndexPointer
else
{
// read uints...
GLuint* coordIndexList = osgNew GLuint[capacity];
GLuint* coordIndexList = new GLuint[capacity];
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
{
@ -977,12 +977,12 @@ bool GeoSet_readIndexData(Input& fr, const char* IndexName, GeoSet::IndexPointer
int oldCapacity = capacity;
while(capacity<=size) capacity *= 2;
GLuint* oldList = coordIndexList;
coordIndexList = osgNew GLuint[capacity];
coordIndexList = new GLuint[capacity];
for(int i=0;i<oldCapacity;++i)
{
coordIndexList[i] = oldList[i];
}
osgDelete [] oldList;
delete [] oldList;
}
coordIndexList[size] = index;
++size;

View File

@ -14,7 +14,7 @@ bool Geode_writeLocalData(const Object& obj, Output& fw);
// register the read and write functions with the osgDB::Registry.
RegisterDotOsgWrapperProxy g_GeodeProxy
(
osgNew osg::Geode,
new osg::Geode,
"Geode",
"Object Node Geode",
&Geode_readLocalData,

Some files were not shown because too many files have changed in this diff Show More