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

@@ -9,7 +9,7 @@ CubeMapGenerator::CubeMapGenerator(int texture_size)
{
for (int i=0; i<6; ++i)
{
osg::ref_ptr<osg::Image> image = osgNew osg::Image;
osg::ref_ptr<osg::Image> image = new osg::Image;
unsigned char* data = (static_cast<unsigned char *>(malloc(texture_size*texture_size*4)));
image->setImage(texture_size, texture_size, 1, 4, GL_RGBA, GL_UNSIGNED_BYTE, data);
images_.push_back(image);

View File

@@ -87,7 +87,7 @@ CullVisitor::CullVisitor():
_numFramesToKeepImpostorSprites(10),
_currentReuseRenderLeafIndex(0)
{
_impostorSpriteManager = osgNew ImpostorSpriteManager;
_impostorSpriteManager = new ImpostorSpriteManager;
}
@@ -669,7 +669,7 @@ ImpostorSprite* CullVisitor::createImpostorSprite(Impostor& node)
// one for use.
// create the render to texture stage.
ref_ptr<RenderToTextureStage> rtts = osgNew RenderToTextureStage;
ref_ptr<RenderToTextureStage> rtts = new RenderToTextureStage;
// set up lighting.
// currently ignore lights in the scene graph itself..
@@ -748,7 +748,7 @@ ImpostorSprite* CullVisitor::createImpostorSprite(Impostor& node)
zfar *= 1.1f;
// set up projection.
osg::Matrix* projection = osgNew osg::Matrix;
osg::Matrix* projection = new osg::Matrix;
if (isPerspectiveProjection)
{
// deal with projection issue move the top and right points
@@ -768,7 +768,7 @@ ImpostorSprite* CullVisitor::createImpostorSprite(Impostor& node)
Vec3 rotate_from = bs.center()-eye_local;
Vec3 rotate_to = getLookVectorLocal();
osg::Matrix* rotate_matrix = osgNew osg::Matrix(
osg::Matrix* rotate_matrix = new osg::Matrix(
osg::Matrix::translate(-eye_local)*
osg::Matrix::rotate(rotate_from,rotate_to)*
osg::Matrix::translate(eye_local)*
@@ -778,7 +778,7 @@ ImpostorSprite* CullVisitor::createImpostorSprite(Impostor& node)
// into account the new camera orientation.
pushModelViewMatrix(rotate_matrix);
ref_ptr<StateSet> dummyState = osgNew StateSet;
ref_ptr<StateSet> dummyState = new StateSet;
pushStateSet(dummyState.get());
@@ -860,7 +860,7 @@ ImpostorSprite* CullVisitor::createImpostorSprite(Impostor& node)
int center_x = viewport.x()+viewport.width()/2;
int center_y = viewport.y()+viewport.height()/2;
Viewport* new_viewport = osgNew Viewport;
Viewport* new_viewport = new Viewport;
new_viewport->setViewport(center_x-new_s/2,center_y-new_t/2,new_s,new_t);
rtts->setViewport(new_viewport);

View File

@@ -18,7 +18,7 @@ DisplayRequirementsVisitor::DisplayRequirementsVisitor()
void DisplayRequirementsVisitor::applyStateSet(StateSet& stateset)
{
if (!_ds) _ds = osgNew osg::DisplaySettings;
if (!_ds) _ds = new osg::DisplaySettings;
unsigned int min = 0; // assume stencil not needed by this stateset.
@@ -61,7 +61,7 @@ void DisplayRequirementsVisitor::apply(Geode& geode)
void DisplayRequirementsVisitor::apply(Impostor& impostor)
{
if (!_ds) _ds = osgNew osg::DisplaySettings;
if (!_ds) _ds = new osg::DisplaySettings;
unsigned int min = 1; // number alpha bits we need at least.
if (min>_ds->getMinimumNumAlphaBits())

View File

@@ -92,7 +92,7 @@ void InsertImpostorsVisitor::insertImpostors()
// to an impostor.
Node::ParentList parentList = group->getParents();
Impostor* impostor = osgNew Impostor;
Impostor* impostor = new Impostor;
// standard LOD settings
impostor->addChild(group);
@@ -139,7 +139,7 @@ void InsertImpostorsVisitor::insertImpostors()
// to an impostor.
Node::ParentList parentList = lod->getParents();
osg::Impostor* impostor = osgNew Impostor;
osg::Impostor* impostor = new Impostor;
// standard LOD settings
for(unsigned int ci=0;ci<lod->getNumChildren();++ci)

View File

@@ -155,7 +155,7 @@ void IntersectVisitor::reset()
_intersectStateStack.clear();
// create a empty IntersectState on the the intersectStateStack.
_intersectStateStack.push_back(osgNew IntersectState);
_intersectStateStack.push_back(new IntersectState);
_nodePath.clear();
_segHitList.clear();
@@ -196,7 +196,7 @@ void IntersectVisitor::addLineSegment(LineSegment* seg)
// create a new segment transformed to local coordintes.
IntersectState* cis = _intersectStateStack.back().get();
LineSegment* ns = osgNew LineSegment;
LineSegment* ns = new LineSegment;
if (cis->_inverse.valid()) ns->mult(*seg,*(cis->_inverse));
else *ns = *seg;
@@ -208,21 +208,21 @@ void IntersectVisitor::addLineSegment(LineSegment* seg)
void IntersectVisitor::pushMatrix(const Matrix& matrix)
{
IntersectState* nis = osgNew IntersectState;
IntersectState* nis = new IntersectState;
IntersectState* cis = _intersectStateStack.back().get();
if (cis->_matrix.valid())
{
nis->_matrix = osgNew Matrix;
nis->_matrix = new Matrix;
nis->_matrix->mult(matrix,*(cis->_matrix));
}
else
{
nis->_matrix = osgNew Matrix(matrix);
nis->_matrix = new Matrix(matrix);
}
Matrix* inverse_world = osgNew Matrix;
Matrix* inverse_world = new Matrix;
inverse_world->invert(*(nis->_matrix));
nis->_inverse = inverse_world;
@@ -234,7 +234,7 @@ void IntersectVisitor::pushMatrix(const Matrix& matrix)
{
if ((segMaskIn & mask))
{
LineSegment* seg = osgNew LineSegment;
LineSegment* seg = new LineSegment;
seg->mult(*(sitr->first),*inverse_world);
nis->addLineSegmentPair(sitr->first.get(),seg);
}
@@ -526,7 +526,7 @@ void IntersectVisitor::apply(Transform& node)
{
if (!enterNode(node)) return;
osg::ref_ptr<Matrix> matrix = osgNew Matrix;
osg::ref_ptr<Matrix> matrix = new Matrix;
node.getLocalToWorldMatrix(*matrix,this);
pushMatrix(*matrix);

View File

@@ -21,7 +21,7 @@ VertexCache::VertexCache(int size)
{
numEntries = size;
entries = osgNew int[numEntries];
entries = new int[numEntries];
for(int i = 0; i < numEntries; i++)
entries[i] = -1;
@@ -30,7 +30,7 @@ VertexCache::VertexCache(int size)
VertexCache::~VertexCache()
{
osgDelete [] entries;
delete [] entries;
}
@@ -169,7 +169,7 @@ void NvStripifier::BuildStripifyInfo(NvFaceInfoVec &faceInfos, NvEdgeInfoVec &ed
// create the face info and add it to the list of faces, but only if this exact face doesn't already
// exist in the list
NvFaceInfo *faceInfo = osgNew NvFaceInfo(v0, v1, v2);
NvFaceInfo *faceInfo = new NvFaceInfo(v0, v1, v2);
if(!AlreadyExists(faceInfo, faceInfos))
{
faceInfos.push_back(faceInfo);
@@ -180,7 +180,7 @@ void NvStripifier::BuildStripifyInfo(NvFaceInfoVec &faceInfos, NvEdgeInfoVec &ed
{
// create the info
edgeInfo01 = osgNew NvEdgeInfo(v0, v1);
edgeInfo01 = new NvEdgeInfo(v0, v1);
// update the linked list on both
edgeInfo01->m_nextV0 = edgeInfos[v0];
@@ -205,7 +205,7 @@ void NvStripifier::BuildStripifyInfo(NvFaceInfoVec &faceInfos, NvEdgeInfoVec &ed
{
// create the info
edgeInfo12 = osgNew NvEdgeInfo(v1, v2);
edgeInfo12 = new NvEdgeInfo(v1, v2);
// update the linked list on both
edgeInfo12->m_nextV0 = edgeInfos[v1];
@@ -230,7 +230,7 @@ void NvStripifier::BuildStripifyInfo(NvFaceInfoVec &faceInfos, NvEdgeInfoVec &ed
{
// create the info
edgeInfo20 = osgNew NvEdgeInfo(v2, v0);
edgeInfo20 = new NvEdgeInfo(v2, v0);
// update the linked list on both
edgeInfo20->m_nextV0 = edgeInfos[v2];
@@ -789,7 +789,7 @@ void NvStripifier::RemoveSmallStrips(NvStripInfoVec& allStrips, NvStripInfoVec&
tempFaceList.push_back(allStrips[i]->m_faces[j]);
//and free memory
osgDelete allStrips[i];
delete allStrips[i];
}
else
{
@@ -797,10 +797,10 @@ void NvStripifier::RemoveSmallStrips(NvStripInfoVec& allStrips, NvStripInfoVec&
}
}
bool *bVisitedList = osgNew bool[tempFaceList.size()];
bool *bVisitedList = new bool[tempFaceList.size()];
memset(bVisitedList, 0, tempFaceList.size()*sizeof(bool));
VertexCache* vcache = osgNew VertexCache(cacheSize);
VertexCache* vcache = new VertexCache(cacheSize);
int bestNumHits = -1;
int numHits;
@@ -831,8 +831,8 @@ void NvStripifier::RemoveSmallStrips(NvStripInfoVec& allStrips, NvStripInfoVec&
faceList.push_back(tempFaceList[bestIndex]);
}
osgDelete vcache;
osgDelete [] bVisitedList;
delete vcache;
delete [] bVisitedList;
}
@@ -875,7 +875,7 @@ void NvStripifier::Stripify(const WordVec &in_indices, const int in_numVertices,
int i;
for(i = 0; i < (int)allStrips.size(); i++)
{
osgDelete allStrips[i];
delete allStrips[i];
}
for (i = 0; i < (int)allEdgeInfos.size(); i++)
@@ -921,7 +921,7 @@ NvEdgeInfoVec& edgeInfos, NvFaceInfoVec& outFaceList)
int j;
for(j = 0; j < numTimes; j++)
{
currentStrip = osgNew NvStripInfo(startInfo, 0, -1);
currentStrip = new NvStripInfo(startInfo, 0, -1);
for(int faceCtr = j*threshold; faceCtr < threshold+(j*threshold); faceCtr++)
{
@@ -935,7 +935,7 @@ NvEdgeInfoVec& edgeInfos, NvFaceInfoVec& outFaceList)
if(numLeftover != 0)
{
currentStrip = osgNew NvStripInfo(startInfo, 0, -1);
currentStrip = new NvStripInfo(startInfo, 0, -1);
for(int k = 0; k < numLeftover; k++)
{
@@ -948,8 +948,8 @@ NvEdgeInfoVec& edgeInfos, NvFaceInfoVec& outFaceList)
else
{
//we're not just doing a tempStrips.push_back(allBigStrips[i]) because
// this way we can osgDelete allBigStrips later to free the memory
currentStrip = osgNew NvStripInfo(startInfo, 0, -1);
// this way we can delete allBigStrips later to free the memory
currentStrip = new NvStripInfo(startInfo, 0, -1);
for(unsigned int j = 0; j < allStrips[i]->m_faces.size(); j++)
currentStrip->m_faces.push_back(allStrips[i]->m_faces[j]);
@@ -966,7 +966,7 @@ NvEdgeInfoVec& edgeInfos, NvFaceInfoVec& outFaceList)
if(tempStrips2.size() != 0)
{
//Optimize for the vertex cache
VertexCache* vcache = osgNew VertexCache(cacheSize);
VertexCache* vcache = new VertexCache(cacheSize);
float bestNumHits = -1.0f;
float numHits;
@@ -1025,7 +1025,7 @@ NvEdgeInfoVec& edgeInfos, NvFaceInfoVec& outFaceList)
outStrips.push_back(tempStrips2[bestIndex]);
}
osgDelete vcache;
delete vcache;
}
}
@@ -1195,7 +1195,7 @@ int numSamples)
//
// PHASE 1: Set up numSamples * numEdges experiments
//
NvStripInfoVec *experiments = osgNew NvStripInfoVec [numSamples * 6];
NvStripInfoVec *experiments = new NvStripInfoVec [numSamples * 6];
int experimentIndex = 0;
std::set <NvFaceInfo*> resetPoints;
int i;
@@ -1226,32 +1226,32 @@ int numSamples)
// build the strip off of this face's 0-1 edge
NvEdgeInfo *edge01 = FindEdgeInfo(allEdgeInfos, nextFace->m_v0, nextFace->m_v1);
NvStripInfo *strip01 = osgNew NvStripInfo(NvStripStartInfo(nextFace, edge01, true), stripId++, experimentId++);
NvStripInfo *strip01 = new NvStripInfo(NvStripStartInfo(nextFace, edge01, true), stripId++, experimentId++);
experiments[experimentIndex++].push_back(strip01);
// build the strip off of this face's 1-0 edge
NvEdgeInfo *edge10 = FindEdgeInfo(allEdgeInfos, nextFace->m_v0, nextFace->m_v1);
NvStripInfo *strip10 = osgNew NvStripInfo(NvStripStartInfo(nextFace, edge10, false), stripId++, experimentId++);
NvStripInfo *strip10 = new NvStripInfo(NvStripStartInfo(nextFace, edge10, false), stripId++, experimentId++);
experiments[experimentIndex++].push_back(strip10);
// build the strip off of this face's 1-2 edge
NvEdgeInfo *edge12 = FindEdgeInfo(allEdgeInfos, nextFace->m_v1, nextFace->m_v2);
NvStripInfo *strip12 = osgNew NvStripInfo(NvStripStartInfo(nextFace, edge12, true), stripId++, experimentId++);
NvStripInfo *strip12 = new NvStripInfo(NvStripStartInfo(nextFace, edge12, true), stripId++, experimentId++);
experiments[experimentIndex++].push_back(strip12);
// build the strip off of this face's 2-1 edge
NvEdgeInfo *edge21 = FindEdgeInfo(allEdgeInfos, nextFace->m_v1, nextFace->m_v2);
NvStripInfo *strip21 = osgNew NvStripInfo(NvStripStartInfo(nextFace, edge21, false), stripId++, experimentId++);
NvStripInfo *strip21 = new NvStripInfo(NvStripStartInfo(nextFace, edge21, false), stripId++, experimentId++);
experiments[experimentIndex++].push_back(strip21);
// build the strip off of this face's 2-0 edge
NvEdgeInfo *edge20 = FindEdgeInfo(allEdgeInfos, nextFace->m_v2, nextFace->m_v0);
NvStripInfo *strip20 = osgNew NvStripInfo(NvStripStartInfo(nextFace, edge20, true), stripId++, experimentId++);
NvStripInfo *strip20 = new NvStripInfo(NvStripStartInfo(nextFace, edge20, true), stripId++, experimentId++);
experiments[experimentIndex++].push_back(strip20);
// build the strip off of this face's 0-2 edge
NvEdgeInfo *edge02 = FindEdgeInfo(allEdgeInfos, nextFace->m_v2, nextFace->m_v0);
NvStripInfo *strip02 = osgNew NvStripInfo(NvStripStartInfo(nextFace, edge02, false), stripId++, experimentId++);
NvStripInfo *strip02 = new NvStripInfo(NvStripStartInfo(nextFace, edge02, false), stripId++, experimentId++);
experiments[experimentIndex++].push_back(strip02);
}
@@ -1276,7 +1276,7 @@ int numSamples)
{
// create the new strip info
stripIter = osgNew NvStripInfo(startInfo, stripId++, experimentId);
stripIter = new NvStripInfo(startInfo, stripId++, experimentId);
// build the next strip
stripIter->Build(allEdgeInfos, allFaceInfos);
@@ -1319,13 +1319,13 @@ int numSamples)
int numStrips = experiments[i].size();
for (int j = 0; j < numStrips; j++)
{
osgDelete experiments[i][j];
delete experiments[i][j];
}
}
}
// osgDelete the array that we used for all experiments
osgDelete [] experiments;
// delete the array that we used for all experiments
delete [] experiments;
}
}
@@ -1525,7 +1525,7 @@ MyVertexVec& optimizedVerts)
//caches oldIndex --> newIndex conversion
int *indexCache;
indexCache = osgNew int[vertices.size()];
indexCache = new int[vertices.size()];
memset(indexCache, -1, sizeof(int)*vertices.size());
@@ -1634,7 +1634,7 @@ MyVertexVec& optimizedVerts)
}
}
osgDelete [] indexCache;
delete [] indexCache;
assert(optimizedVerts.size() == vertices.size());
}

View File

@@ -6,8 +6,6 @@
#include <vector>
#include <list>
#include <osg/MemoryManager>
/////////////////////////////////////////////////////////////////////////////////
//
// Types defined for stripification
@@ -135,7 +133,7 @@ class NvEdgeInfo
}
// ref and unref
void Unref () { if (--m_refCount == 0) osgDelete this; }
void Unref () { if (--m_refCount == 0) delete this; }
// data members are left public
UINT m_refCount;

View File

@@ -709,7 +709,7 @@ bool CollectLowestTransformsVisitor::removeTransforms()
transformRemoved = true;
osg::ref_ptr<osg::Transform> transform = titr->first;
osg::ref_ptr<osg::Group> group = osgNew osg::Group;
osg::ref_ptr<osg::Group> group = new osg::Group;
group->setDataVariance(osg::Object::STATIC);
for(unsigned int i=0;i<transform->getNumChildren();++i)
{
@@ -1012,7 +1012,7 @@ void Optimizer::CombineLODsVisitor::combineLODs()
}
// create new LOD containing all other LOD's children.
osg::LOD* newLOD = osgNew osg::LOD;
osg::LOD* newLOD = new osg::LOD;
newLOD->setName("newLOD");
newLOD->setCenter(bb.center());

View File

@@ -10,8 +10,8 @@ using namespace osg;
using namespace osgUtil;
// register a RenderStage prototype with the RenderBin prototype list.
RegisterRenderBinProxy s_registerRenderBinProxy("RenderBin",osgNew RenderBin(RenderBin::SORT_BY_STATE));
RegisterRenderBinProxy s_registerDepthSortedBinProxy("DepthSortedBin",osgNew RenderBin(RenderBin::SORT_BACK_TO_FRONT));
RegisterRenderBinProxy s_registerRenderBinProxy("RenderBin",new RenderBin(RenderBin::SORT_BY_STATE));
RegisterRenderBinProxy s_registerDepthSortedBinProxy("DepthSortedBin",new RenderBin(RenderBin::SORT_BACK_TO_FRONT));
typedef std::map< std::string, osg::ref_ptr<RenderBin> > RenderBinPrototypeList;

View File

@@ -34,7 +34,7 @@ SceneView::SceneView(DisplaySettings* ds)
_prioritizeTextures = false;
_viewport = osgNew Viewport;
_viewport = new Viewport;
_initCalled = false;
@@ -52,21 +52,21 @@ SceneView::~SceneView()
void SceneView::setDefaults()
{
_globalState = osgNew osg::StateSet;
_globalState = new osg::StateSet;
_lightingMode=HEADLIGHT;
_light = osgNew osg::Light;
_light = new osg::Light;
_light->setLightNum(0);
_light->setAmbient(Vec4(0.00f,0.0f,0.00f,1.0f));
_light->setDiffuse(Vec4(0.8f,0.8f,0.8f,1.0f));
_light->setSpecular(Vec4(1.0f,1.0f,1.0f,1.0f));
_state = osgNew State;
_state = new State;
_camera = osgNew Camera(_displaySettings.get());
_camera = new Camera(_displaySettings.get());
_rendergraph = osgNew RenderGraph;
_renderStage = osgNew RenderStage;
_rendergraph = new RenderGraph;
_renderStage = new RenderStage;
#ifndef __sgi
@@ -74,15 +74,15 @@ void SceneView::setDefaults()
// lighting state with the display list, and the display list visitor doesn't currently apply
// state before creating display lists. So will disable the init visitor default, this won't
// affect functionality since the display lists will be created as and when needed.
DisplayListVisitor* dlv = osgNew DisplayListVisitor();
DisplayListVisitor* dlv = new DisplayListVisitor();
dlv->setState(_state.get());
dlv->setNodeMaskOverride(0xffffffff);
_initVisitor = dlv;
#endif
_appVisitor = osgNew AppVisitor;
_appVisitor = new AppVisitor;
_cullVisitor = osgNew CullVisitor;
_cullVisitor = new CullVisitor;
_cullVisitor->setRenderGraph(_rendergraph.get());
_cullVisitor->setRenderStage(_renderStage.get());
@@ -97,16 +97,16 @@ void SceneView::setDefaults()
_globalState->setMode(GL_DEPTH_TEST, osg::StateAttribute::ON);
// set up an alphafunc by default to speed up blending operations.
osg::AlphaFunc* alphafunc = osgNew osg::AlphaFunc;
osg::AlphaFunc* alphafunc = new osg::AlphaFunc;
alphafunc->setFunction(osg::AlphaFunc::GREATER,0.0f);
_globalState->setAttributeAndModes(alphafunc, osg::StateAttribute::ON);
// set up an texture environment by default to speed up blending operations.
osg::TexEnv* texenv = osgNew osg::TexEnv;
osg::TexEnv* texenv = new osg::TexEnv;
texenv->setMode(osg::TexEnv::MODULATE);
_globalState->setTextureAttributeAndModes(0,texenv, osg::StateAttribute::ON);
osg::LightModel* lightmodel = osgNew osg::LightModel;
osg::LightModel* lightmodel = new osg::LightModel;
lightmodel->setAmbientIntensity(osg::Vec4(0.1f,0.1f,0.1f,1.0f));
_globalState->setAttributeAndModes(lightmodel, osg::StateAttribute::ON);
@@ -188,14 +188,14 @@ void SceneView::cull()
// note the constructor for osg::State will set ContextID to 0 which will be fine to single context graphics
// applications which is ok for most apps, but not multiple context/pipe applications.
_state = osgNew osg::State;
_state = new osg::State;
}
if (!_globalState)
{
osg::notify(osg::INFO) << "Warning: no valid osgUtil::SceneView::_globalState attached, creating a default global stateset automatically."<< std::endl;
_globalState = osgNew osg::StateSet;
_globalState = new osg::StateSet;
_globalState->setGlobalDefaults();
}
@@ -235,30 +235,30 @@ void SceneView::cull()
if (_displaySettings.valid())
_camera->setScreenDistance(_displaySettings->getScreenDistance());
if (!projection) projection = osgNew osg::Matrix(_camera->getProjectionMatrix());
if (!modelview) modelview = osgNew osg::Matrix(_camera->getModelViewMatrix());
if (!projection) projection = new osg::Matrix(_camera->getProjectionMatrix());
if (!modelview) modelview = new osg::Matrix(_camera->getModelViewMatrix());
//cout <<"fovx="<<_camera->calc_fovx()<<endl;
}
if (!projection) projection = osgNew osg::Matrix();
if (!modelview) modelview = osgNew osg::Matrix();
if (!projection) projection = new osg::Matrix();
if (!modelview) modelview = new osg::Matrix();
if (!_cullVisitor)
{
osg::notify(osg::INFO) << "Warning: no valid osgUtil::SceneView:: attached, creating a default CullVisitor automatically."<< std::endl;
_cullVisitor = osgNew CullVisitor;
_cullVisitor = new CullVisitor;
}
if (!_rendergraph)
{
osg::notify(osg::INFO) << "Warning: no valid osgUtil::SceneView:: attached, creating a global default RenderGraph automatically."<< std::endl;
_rendergraph = osgNew RenderGraph;
_rendergraph = new RenderGraph;
}
if (!_renderStage)
{
osg::notify(osg::INFO) << "Warning: no valid osgUtil::SceneView::_renderStage attached, creating a default RenderStage automatically."<< std::endl;
_renderStage = osgNew RenderStage;
_renderStage = new RenderStage;
}
if (_displaySettings.valid() && _displaySettings->getStereo())
@@ -288,14 +288,14 @@ void SceneView::cull()
if (_displaySettings->getStereoMode()==osg::DisplaySettings::LEFT_EYE)
{
// set up the left eye.
osg::ref_ptr<osg::Matrix> projectionLeft = osgNew osg::Matrix(osg::Matrix(1.0f,0.0f,0.0f,0.0f,
osg::ref_ptr<osg::Matrix> projectionLeft = new osg::Matrix(osg::Matrix(1.0f,0.0f,0.0f,0.0f,
0.0f,1.0f,0.0f,0.0f,
iod/(2.0f*sd),0.0f,1.0f,0.0f,
0.0f,0.0f,0.0f,1.0f)*
(*projection));
osg::ref_ptr<osg::Matrix> modelviewLeft = osgNew osg::Matrix( (*modelview) *
osg::ref_ptr<osg::Matrix> modelviewLeft = new osg::Matrix( (*modelview) *
osg::Matrix(1.0f,0.0f,0.0f,0.0f,
0.0f,1.0f,0.0f,0.0f,
0.0f,0.0f,1.0f,0.0f,
@@ -313,13 +313,13 @@ void SceneView::cull()
else if (_displaySettings->getStereoMode()==osg::DisplaySettings::RIGHT_EYE)
{
// set up the right eye.
osg::ref_ptr<osg::Matrix> projectionRight = osgNew osg::Matrix(osg::Matrix(1.0f,0.0f,0.0f,0.0f,
osg::ref_ptr<osg::Matrix> projectionRight = new osg::Matrix(osg::Matrix(1.0f,0.0f,0.0f,0.0f,
0.0f,1.0f,0.0f,0.0f,
-iod/(2.0f*sd),0.0f,1.0f,0.0f,
0.0f,0.0f,0.0f,1.0f)*
(*projection));
osg::ref_ptr<osg::Matrix> modelviewRight = osgNew osg::Matrix( (*modelview) *
osg::ref_ptr<osg::Matrix> modelviewRight = new osg::Matrix( (*modelview) *
osg::Matrix(1.0f,0.0f,0.0f,0.0f,
0.0f,1.0f,0.0f,0.0f,
0.0f,0.0f,1.0f,0.0f,
@@ -348,14 +348,14 @@ void SceneView::cull()
// set up the left eye.
osg::ref_ptr<osg::Matrix> projectionLeft = osgNew osg::Matrix(osg::Matrix(1.0f,0.0f,0.0f,0.0f,
osg::ref_ptr<osg::Matrix> projectionLeft = new osg::Matrix(osg::Matrix(1.0f,0.0f,0.0f,0.0f,
0.0f,1.0f,0.0f,0.0f,
iod/(2.0f*sd),0.0f,1.0f,0.0f,
0.0f,0.0f,0.0f,1.0f)*
(*projection));
osg::ref_ptr<osg::Matrix> modelviewLeft = osgNew osg::Matrix( (*modelview) *
osg::ref_ptr<osg::Matrix> modelviewLeft = new osg::Matrix( (*modelview) *
osg::Matrix(1.0f,0.0f,0.0f,0.0f,
0.0f,1.0f,0.0f,0.0f,
0.0f,0.0f,1.0f,0.0f,
@@ -366,13 +366,13 @@ void SceneView::cull()
// set up the right eye.
osg::ref_ptr<osg::Matrix> projectionRight = osgNew osg::Matrix(osg::Matrix(1.0f,0.0f,0.0f,0.0f,
osg::ref_ptr<osg::Matrix> projectionRight = new osg::Matrix(osg::Matrix(1.0f,0.0f,0.0f,0.0f,
0.0f,1.0f,0.0f,0.0f,
-iod/(2.0f*sd),0.0f,1.0f,0.0f,
0.0f,0.0f,0.0f,1.0f)*
(*projection));
osg::ref_ptr<osg::Matrix> modelviewRight = osgNew osg::Matrix( (*modelview) *
osg::ref_ptr<osg::Matrix> modelviewRight = new osg::Matrix( (*modelview) *
osg::Matrix(1.0f,0.0f,0.0f,0.0f,
0.0f,1.0f,0.0f,0.0f,
0.0f,0.0f,1.0f,0.0f,
@@ -594,14 +594,14 @@ void SceneView::draw()
_renderStageRight->drawPreRenderStages(*_state,previous);
// draw left eye.
osg::ref_ptr<osg::ColorMask> red = osgNew osg::ColorMask;
osg::ref_ptr<osg::ColorMask> red = new osg::ColorMask;
red->setMask(true,false,false,true);
_globalState->setAttribute(red.get());
_renderStageLeft->setColorMask(red.get());
_renderStageLeft->draw(*_state,previous);
// draw right eye.
osg::ref_ptr<osg::ColorMask> green = osgNew osg::ColorMask;
osg::ref_ptr<osg::ColorMask> green = new osg::ColorMask;
green->setMask(false,true,true,true);
_globalState->setAttribute(green.get());
_renderStageRight->setColorMask(green.get());
@@ -620,10 +620,10 @@ void SceneView::draw()
int right_half_begin = (_viewport->width()+separation)/2;
int right_half_width = _viewport->width()-right_half_begin;
osg::ref_ptr<osg::Viewport> viewportLeft = osgNew osg::Viewport;
osg::ref_ptr<osg::Viewport> viewportLeft = new osg::Viewport;
viewportLeft->setViewport(_viewport->x(),_viewport->y(),left_half_width,_viewport->height());
osg::ref_ptr<osg::Viewport> viewportRight = osgNew osg::Viewport;
osg::ref_ptr<osg::Viewport> viewportRight = new osg::Viewport;
viewportRight->setViewport(_viewport->x()+right_half_begin,_viewport->y(),right_half_width,_viewport->height());
@@ -664,10 +664,10 @@ void SceneView::draw()
int top_half_begin = (_viewport->height()+separation)/2;
int top_half_height = _viewport->height()-top_half_begin;
osg::ref_ptr<osg::Viewport> viewportTop = osgNew osg::Viewport;
osg::ref_ptr<osg::Viewport> viewportTop = new osg::Viewport;
viewportTop->setViewport(_viewport->x(),_viewport->y()+top_half_begin,_viewport->width(),top_half_height);
osg::ref_ptr<osg::Viewport> viewportBottom = osgNew osg::Viewport;
osg::ref_ptr<osg::Viewport> viewportBottom = new osg::Viewport;
viewportBottom->setViewport(_viewport->x(),_viewport->y(),_viewport->width(),bottom_half_height);
clearArea(_viewport->x(),_viewport->y()+bottom_half_height,_viewport->width(),separation,_renderStageLeft->getClearColor());
@@ -712,7 +712,7 @@ void SceneView::draw()
else
{
_globalState->setAttribute(_viewport.get());
osg::ref_ptr<osg::ColorMask> cmask = osgNew osg::ColorMask;
osg::ref_ptr<osg::ColorMask> cmask = new osg::ColorMask;
cmask->setMask(true,true,true,true);
_globalState->setAttribute(cmask.get());
@@ -794,7 +794,7 @@ const osg::Matrix SceneView::computeMVPW() const
void SceneView::clearArea(int x,int y,int width,int height,const osg::Vec4& color)
{
osg::ref_ptr<osg::Viewport> viewport = osgNew osg::Viewport;
osg::ref_ptr<osg::Viewport> viewport = new osg::Viewport;
viewport->setViewport(x,y,width,height);
_state->applyAttribute(viewport.get());

View File

@@ -98,7 +98,7 @@ void SmoothingVisitor::smooth(osg::Geometry& geom)
osg::Vec3Array *coords = geom.getVertexArray();
if (!coords || !coords->size()) return;
osg::Vec3Array *normals = osgNew osg::Vec3Array(coords->size());
osg::Vec3Array *normals = new osg::Vec3Array(coords->size());
osg::Vec3Array::iterator nitr;
for(nitr = normals->begin();

View File

@@ -124,7 +124,7 @@ void TriStripVisitor::stripify(Geometry& geom)
NvStripInfo *strip = strips[i];
int nStripFaceCount = strip->m_faces.size();
osg::DrawElementsUShort* elements = osgNew osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLE_STRIP);
osg::DrawElementsUShort* elements = new osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLE_STRIP);
elements->reserve(nStripFaceCount+2);
new_primitives.push_back(elements);
@@ -187,7 +187,7 @@ void TriStripVisitor::stripify(Geometry& geom)
if (leftoverFaces.size())
{
osg::DrawElementsUShort* triangles = osgNew osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLES);
osg::DrawElementsUShort* triangles = new osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLES);
triangles->reserve(leftoverFaces.size()*3);
new_primitives.push_back(triangles);