Fixed 3 Coverity reported issues. CID 11622 is a bit of false positive as for valid settings no leak would happen.
CID 11810: Uninitialized scalar field (UNINIT_CTOR) Non-static class member _setMaxFarDistance is not initialized in this constructor nor in any functions that it calls. CID 11811: Uninitialized pointer field (UNINIT_CTOR) Non-static class member _displayTexturesGroupingNode is not initialized in this constructor nor in any functions that it calls. CID 11622: Resource leak (RESOURCE_LEAK) Calling allocation function "operator new(unsigned long long)". Variable "<storage from new>" is not freed or pointed-to in function "osg::StateSet::StateSet()". [show details] Assigning: "sharedStateSet" = storage returned from "new osg::StateSet". 282 osg::StateSet* sharedStateSet = new osg::StateSet; Variable "sharedStateSet" is not freed or pointed-to in function "osg::Object::setDataVariance(osg::Object::DataVariance)". [show details]
This commit is contained in:
parent
63ee77a63d
commit
d20d2202a4
@ -233,6 +233,7 @@ ParallelSplitShadowMap::ParallelSplitShadowMap(osg::Geode** gr, int icountplanes
|
||||
_debug_color_in_GLSL(false),
|
||||
_user_polgyonOffset_set(false),
|
||||
_resolution(TEXTURE_RESOLUTION),
|
||||
_setMaxFarDistance(1000.0),
|
||||
_isSetMaxFarDistance(false),
|
||||
_split_min_near_dist(ZNEAR_MIN_FROM_LIGHT_SOURCE),
|
||||
_move_vcam_behind_rcam_factor(MOVE_VIRTUAL_CAMERA_BEHIND_REAL_CAMERA_FACTOR),
|
||||
@ -251,6 +252,7 @@ ParallelSplitShadowMap::ParallelSplitShadowMap(osg::Geode** gr, int icountplanes
|
||||
|
||||
ParallelSplitShadowMap::ParallelSplitShadowMap(const ParallelSplitShadowMap& copy, const osg::CopyOp& copyop):
|
||||
ShadowTechnique(copy,copyop),
|
||||
_displayTexturesGroupingNode(0),
|
||||
_textureUnitOffset(copy._textureUnitOffset),
|
||||
_number_of_splits(copy._number_of_splits),
|
||||
_debug_color_in_GLSL(copy._debug_color_in_GLSL),
|
||||
@ -276,10 +278,11 @@ void ParallelSplitShadowMap::setAmbientBias(const osg::Vec2& ambientBias)
|
||||
if (_ambientBiasUniform ) _ambientBiasUniform->set(osg::Vec2f(_ambientBias.x(), _ambientBias.y()));
|
||||
}
|
||||
|
||||
void ParallelSplitShadowMap::init(){
|
||||
void ParallelSplitShadowMap::init()
|
||||
{
|
||||
if (!_shadowedScene) return;
|
||||
|
||||
osg::StateSet* sharedStateSet = new osg::StateSet;
|
||||
osg::ref_ptr<osg::StateSet> sharedStateSet = new osg::StateSet;
|
||||
sharedStateSet->setDataVariance(osg::Object::DYNAMIC);
|
||||
|
||||
unsigned int iCamerasMax=_number_of_splits;
|
||||
@ -390,7 +393,7 @@ void ParallelSplitShadowMap::init(){
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// set up stateset and append texture, texGen ,...
|
||||
{
|
||||
pssmShadowSplitTexture._stateset = sharedStateSet;//new osg::StateSet;
|
||||
pssmShadowSplitTexture._stateset = sharedStateSet.get();//new osg::StateSet;
|
||||
pssmShadowSplitTexture._stateset->setTextureAttributeAndModes(pssmShadowSplitTexture._textureUnit,pssmShadowSplitTexture._texture.get(),osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE);
|
||||
pssmShadowSplitTexture._stateset->setTextureMode(pssmShadowSplitTexture._textureUnit,GL_TEXTURE_GEN_S,osg::StateAttribute::ON);
|
||||
pssmShadowSplitTexture._stateset->setTextureMode(pssmShadowSplitTexture._textureUnit,GL_TEXTURE_GEN_T,osg::StateAttribute::ON);
|
||||
|
Loading…
Reference in New Issue
Block a user