diff --git a/include/osgUtil/SceneView b/include/osgUtil/SceneView index e0e3a604c..20cb18a57 100644 --- a/include/osgUtil/SceneView +++ b/include/osgUtil/SceneView @@ -37,7 +37,7 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced /** Set the data which to view. The data will typically be * an osg::Scene but can be any osg::Node type. */ - void setSceneData(osg::Node* node) { _sceneData = node; _need_compile = true;} + void setSceneData(osg::Node* node) { _sceneData = node; } /** Get the scene data which to view. The data will typically be * an osg::Scene but can be any osg::Node type. */ @@ -291,12 +291,8 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced osg::ref_ptr _rendergraphRight; osg::ref_ptr _renderStageRight; - osg::ref_ptr _frameStamp; - bool _need_compile; - - osg::Vec4 _backgroundColor; CullVisitor::ComputeNearFarMode _computeNearFar; diff --git a/src/Demos/osgcube/osgcube.cpp b/src/Demos/osgcube/osgcube.cpp index c50511508..b7e608acd 100644 --- a/src/Demos/osgcube/osgcube.cpp +++ b/src/Demos/osgcube/osgcube.cpp @@ -73,25 +73,25 @@ class MyTransformCallback : public osg::NodeCallback{ osg::Geode* createGeometryCube() { - osg::Geode* geode = new osg::Geode(); + osg::Geode* geode = osgNew osg::Geode(); // ------------------------------------------- // Set up a new Geometry which will be our cube // ------------------------------------------- - osg::Geometry* cube = new osg::Geometry(); + osg::Geometry* cube = osgNew osg::Geometry(); // set up the primitives - cube->addPrimitive(new osg::DrawArrays(osg::Primitive::POLYGON,0,4)); - cube->addPrimitive(new osg::DrawArrays(osg::Primitive::POLYGON,4,4)); - cube->addPrimitive(new osg::DrawArrays(osg::Primitive::POLYGON,8,4)); - cube->addPrimitive(new osg::DrawArrays(osg::Primitive::POLYGON,12,4)); - cube->addPrimitive(new osg::DrawArrays(osg::Primitive::POLYGON,16,4)); - cube->addPrimitive(new osg::DrawArrays(osg::Primitive::POLYGON,20,4)); + cube->addPrimitive(osgNew osg::DrawArrays(osg::Primitive::POLYGON,0,4)); + cube->addPrimitive(osgNew osg::DrawArrays(osg::Primitive::POLYGON,4,4)); + cube->addPrimitive(osgNew osg::DrawArrays(osg::Primitive::POLYGON,8,4)); + cube->addPrimitive(osgNew osg::DrawArrays(osg::Primitive::POLYGON,12,4)); + cube->addPrimitive(osgNew osg::DrawArrays(osg::Primitive::POLYGON,16,4)); + cube->addPrimitive(osgNew osg::DrawArrays(osg::Primitive::POLYGON,20,4)); // set up coords. - osg::Vec3Array* coords = new osg::Vec3Array; + osg::Vec3Array* coords = osgNew 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 = new osg::Vec3Array; + osg::Vec3Array* cubeNormals = osgNew 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 = new osg::StateSet(); - osg::Material* redMaterial = new osg::Material(); + osg::StateSet* cubeState = osgNew osg::StateSet(); + osg::Material* redMaterial = osgNew osg::Material(); osg::Vec4 red( 1.0f, 0.0f, 0.0f, 1.0f ); redMaterial->setDiffuse( osg::Material::FRONT_AND_BACK, red ); cubeState->setAttribute( redMaterial ); @@ -168,7 +168,7 @@ int main( int argc, char **argv ) for(int i=1;iaddChild( createGeometryCube() ); // move node in a circle at 90 degrees a sec. - myTransform->setAppCallback(new MyTransformCallback(myTransform,osg::inDegrees(90.0f))); + myTransform->setAppCallback(osgNew MyTransformCallback(myTransform,osg::inDegrees(90.0f))); // add model to viewer. viewer.addViewport( myTransform ); // register trackball maniupulators. - viewer.registerCameraManipulator(new osgGA::TrackballManipulator); + viewer.registerCameraManipulator(osgNew osgGA::TrackballManipulator); viewer.open(); diff --git a/src/osg/CullStack.cpp b/src/osg/CullStack.cpp index e4c465f2c..efdb0038f 100644 --- a/src/osg/CullStack.cpp +++ b/src/osg/CullStack.cpp @@ -9,7 +9,8 @@ CullStack::CullStack() _LODBias = 1.0f; _smallFeatureCullingPixelSize = 2.0f; _frustumVolume=-1.0f; - + _bbCornerNear = 0; + _bbCornerFar = 7; } diff --git a/src/osg/GeoSet.cpp b/src/osg/GeoSet.cpp index 0dc965f6f..7b53cc5e4 100644 --- a/src/osg/GeoSet.cpp +++ b/src/osg/GeoSet.cpp @@ -42,6 +42,9 @@ GeoSet::GeoSet() _primLengths = (int *)0; _numcoords = 0; + _numnormals = 0; + _numcolors = 0; + _numtcoords = 0; _normal_binding = BIND_OFF; _color_binding = BIND_OFF; @@ -49,6 +52,9 @@ GeoSet::GeoSet() _fast_path = 1; + _primlength = 0; + _flat_shaded_skip = 0; + } diff --git a/src/osg/ImpostorSprite.cpp b/src/osg/ImpostorSprite.cpp index 63e32c603..755aab09a 100644 --- a/src/osg/ImpostorSprite.cpp +++ b/src/osg/ImpostorSprite.cpp @@ -133,16 +133,15 @@ void ImpostorSprite::accept(PrimitiveFunctor& functor) // Helper class for managing the reuse of ImpostorSprite resources. /////////////////////////////////////////////////////////////////////////// -ImpostorSpriteManager::ImpostorSpriteManager() +ImpostorSpriteManager::ImpostorSpriteManager(): + _first(NULL), + _last(NULL) { _texenv = osgNew TexEnv; _texenv->setMode(TexEnv::REPLACE); _alphafunc = osgNew osg::AlphaFunc; _alphafunc->setFunction( AlphaFunc::GREATER, 0.000f ); - - _first = NULL; - _last = NULL; } diff --git a/src/osg/LightSource.cpp b/src/osg/LightSource.cpp index 5e9aeb8bb..51846ad3d 100644 --- a/src/osg/LightSource.cpp +++ b/src/osg/LightSource.cpp @@ -2,12 +2,12 @@ using namespace osg; -LightSource::LightSource() +LightSource::LightSource(): + _value(StateAttribute::ON) { // switch off culling of light source nodes by default. setCullingActive(false); _dstate = osgNew StateSet; - _value = StateAttribute::ON; _light = osgNew Light; } diff --git a/src/osg/MatrixTransform.cpp b/src/osg/MatrixTransform.cpp index cb2f6fb9e..8b542f89a 100644 --- a/src/osg/MatrixTransform.cpp +++ b/src/osg/MatrixTransform.cpp @@ -2,11 +2,11 @@ using namespace osg; -MatrixTransform::MatrixTransform() +MatrixTransform::MatrixTransform(): + _inverseDirty(false) { _matrix = osgNew Matrix; _inverse = osgNew Matrix; - _inverseDirty = false; } MatrixTransform::MatrixTransform(const MatrixTransform& transform,const CopyOp& copyop): diff --git a/src/osg/MemoryManager.cpp b/src/osg/MemoryManager.cpp index 1c4bb053a..9b6153a9f 100644 --- a/src/osg/MemoryManager.cpp +++ b/src/osg/MemoryManager.cpp @@ -505,8 +505,8 @@ sMStats m_getMemoryStatistics() if (numMatching>0 && !allocUnit->printedOutUnintializedInfo) { // possible unitialized data? - std::cout<<"possible uninitilized memory numMatching="<sourceFile<<"' sourceLine="<sourceLine<allocationNumber,allocUnit->sourceFile,allocUnit->sourceLine); allocUnit->printedOutUnintializedInfo=true; diff --git a/src/osg/Texture.cpp b/src/osg/Texture.cpp index 962368992..82e417ff3 100644 --- a/src/osg/Texture.cpp +++ b/src/osg/Texture.cpp @@ -18,33 +18,28 @@ using namespace osg; Texture::DeletedTextureObjectCache Texture::s_deletedTextureObjectCache; -Texture::Texture() +Texture::Texture(): + _target(GL_TEXTURE_2D), + _wrap_s(CLAMP), + _wrap_t(CLAMP), + _wrap_r(CLAMP), + _min_filter(LINEAR_MIPMAP_LINEAR), // trilinear + _mag_filter(LINEAR), + _texParamtersDirty(true), + _internalFormatMode(USE_IMAGE_DATA_FORMAT), + _internalFormatValue(0), + _borderColor(0.0, 0.0, 0.0, 0.0), + _textureWidth(0), + _textureHeight(0), + _subloadMode(OFF), + _subloadOffsX(0), + _subloadOffsY(0), + _subloadWidth(0), + _subloadHeight(0) { _handleList.resize(DisplaySettings::instance()->getMaxNumberOfGraphicsContexts(),0); _modifiedTag.resize(DisplaySettings::instance()->getMaxNumberOfGraphicsContexts(),0); - _target = GL_TEXTURE_2D; - - _wrap_s = CLAMP; - _wrap_t = CLAMP; - _wrap_r = CLAMP; - _min_filter = LINEAR_MIPMAP_LINEAR; // trilinear - //_min_filter = LINEAR_MIPMAP_NEAREST; // bilinear - //_min_filter = NEAREST_MIPMAP_LINEAR; // OpenGL default - _mag_filter = LINEAR; - - _internalFormatMode = USE_IMAGE_DATA_FORMAT; - _internalFormatValue = 0; - - _textureWidth = _textureHeight = 0; - - _subloadMode = OFF; - _subloadOffsX = _subloadOffsY = 0; - _subloadWidth = _subloadHeight = 0; - - _borderColor.set(0.0, 0.0, 0.0, 0.0);//OpenGL default - - _texParamtersDirty = true; } diff --git a/src/osg/TextureCubeMap.cpp b/src/osg/TextureCubeMap.cpp index 320751678..9e59ccce7 100644 --- a/src/osg/TextureCubeMap.cpp +++ b/src/osg/TextureCubeMap.cpp @@ -79,7 +79,7 @@ static GLenum faceTarget[6] = #endif -TextureCubeMap::TextureCubeMap() +TextureCubeMap::TextureCubeMap():Texture() { _target = GL_TEXTURE_CUBE_MAP; // default to ARB extension } diff --git a/src/osg/Transform.cpp b/src/osg/Transform.cpp index 87e1b392e..7563faad4 100644 --- a/src/osg/Transform.cpp +++ b/src/osg/Transform.cpp @@ -3,13 +3,15 @@ using namespace osg; Transform::Transform() +#ifdef USE_DEPRECATED_API + :_deprecated_inverseDirty(false) +#endif { _referenceFrame = RELATIVE_TO_PARENTS; #ifdef USE_DEPRECATED_API _deprecated_matrix = osgNew Matrix; _deprecated_inverse = osgNew Matrix; - _deprecated_inverseDirty = false; #endif } diff --git a/src/osgDB/Field.cpp b/src/osgDB/Field.cpp index 23651207e..f9137e457 100644 --- a/src/osgDB/Field.cpp +++ b/src/osgDB/Field.cpp @@ -147,6 +147,7 @@ void Field::addChar(char c) { if (_fieldCacheCapacity=_fieldCacheCapacity-1) @@ -155,6 +156,7 @@ void Field::addChar(char c) while (_fieldCacheSize>=_fieldCacheCapacity-1) _fieldCacheCapacity *= 2; char* tmp_str = _fieldCache; _fieldCache = osgNew char[_fieldCacheCapacity]; + memset(_fieldCache,0,_fieldCacheCapacity); strncpy(_fieldCache,tmp_str,_fieldCacheSize); osgDelete [] tmp_str; diff --git a/src/osgUtil/CullVisitor.cpp b/src/osgUtil/CullVisitor.cpp index dafb2eb12..a4809c402 100644 --- a/src/osgUtil/CullVisitor.cpp +++ b/src/osgUtil/CullVisitor.cpp @@ -74,29 +74,21 @@ class PrintVisitor : public NodeVisitor int _step; }; -CullVisitor::CullVisitor() +CullVisitor::CullVisitor(): + NodeVisitor(NodeVisitor::TRAVERSE_ACTIVE_CHILDREN), + _currentRenderGraph(NULL), + _currentRenderBin(NULL), + _computeNearFar(COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES), + _computed_znear(FLT_MAX), + _computed_zfar(-FLT_MAX), + _tsm(OBJECT_EYE_POINT_DISTANCE), + _impostorActive(true), + _depthSortImpostorSprites(false), + _impostorPixelErrorThreshold(4.0f), + _numFramesToKeepImpostorSprites(10), + _currentReuseRenderLeafIndex(0) { - // overide the default node visitor mode. - setTraversalMode(NodeVisitor::TRAVERSE_ACTIVE_CHILDREN); - - //_tsm = LOOK_VECTOR_DISTANCE; - _tsm = OBJECT_EYE_POINT_DISTANCE; - - _computeNearFar = COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES; - _computed_znear = FLT_MAX; - _computed_zfar = -FLT_MAX; - - _impostorActive = true; - _depthSortImpostorSprites = false; - _impostorPixelErrorThreshold = 4.0f; - _numFramesToKeepImpostorSprites = 10; _impostorSpriteManager = osgNew ImpostorSpriteManager; - - _currentRenderGraph = NULL; - _currentRenderBin = NULL; - - _currentReuseRenderLeafIndex=0; - }