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:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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"))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user