Replaced ref_ptr<>:take with ref_ptr<>:release, and added handling of removeal

of ref_ptr<> operator >.
This commit is contained in:
Robert Osfield
2006-06-26 20:45:51 +00:00
parent 5b89ddab01
commit 240fc9ebee
12 changed files with 18 additions and 22 deletions

View File

@@ -7,7 +7,6 @@
#include <osg/Geode>
#include <osg/ShapeDrawable>
#include <osg/PolygonOffset>
#include <osg/CullFace>
#include <osg/Texture2D>
#include <osg/MatrixTransform>
#include <osg/Light>

View File

@@ -95,7 +95,7 @@ osg::Geometry *Frame::build_quad(const Rect &rect, const osg::Vec4 &color, bool
geo->addPrimitiveSet(new osg::DrawArrays(GL_QUADS, 0, shadow? 12: 4));
return geo.take();
return geo.release();
}
}

View File

@@ -243,7 +243,7 @@ osg::Group* build_hud_base(osg::Group* root)
osg::ref_ptr<osg::BlendFunc> bf = new osg::BlendFunc;
ss->setAttributeAndModes(bf.get());
return xform.take();
return xform.release();
}
EffectPanel* build_gui(osg::Group* root)
@@ -256,7 +256,7 @@ EffectPanel* build_gui(osg::Group* root)
hud->addChild(effect_panel.get());
return effect_panel.take();
return effect_panel.release();
}
void build_world(osg::Group* root, osg::Node* scene, osgProducer::Viewer& viewer)

View File

@@ -50,7 +50,7 @@ class OSGUTIL_EXPORT Hit
bool operator < (const Hit& hit) const
{
if (_originalLineSegment<hit._originalLineSegment) return true;
if (_originalLineSegment>hit._originalLineSegment) return false;
if (hit._originalLineSegment<_originalLineSegment) return false;
return _ratio<hit._ratio;
}

View File

@@ -105,7 +105,7 @@ namespace
*(image->data(j, i)+2) = static_cast<unsigned char>(blue * 255);
}
}
return image.take();
return image.release();
}
}

View File

@@ -108,7 +108,7 @@ namespace
tc->push_back(uv * scale);
}
return tc.take();
return tc.release();
}
private:

View File

@@ -33,7 +33,7 @@ namespace
*(image->data(i, 0)+2) = static_cast<unsigned char>(c*255);
*(image->data(i, 0)+3) = 255;
}
return image.take();
return image.release();
}
}

View File

@@ -130,7 +130,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO2(const std::string
lwosg::Converter converter(conv_options, options);
osg::ref_ptr<osg::Node> node = converter.convert(fileName);
if (node.valid()) {
return node.take();
return node.release();
}
return ReadResult::FILE_NOT_HANDLED;
@@ -143,7 +143,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_old_LWO2(const std::st
if (lwo2->ReadFile(fileName))
{
osg::ref_ptr<Group> group = new osg::Group();
if (lwo2->GenerateGroup(*group)) return group.take();
if (lwo2->GenerateGroup(*group)) return group.release();
}
return ReadResult::FILE_NOT_HANDLED;
}

View File

@@ -340,7 +340,7 @@ osg::Group *Surface::apply(osg::Geometry *geo, const VertexMap_map *texture_maps
material->setSpecular(osg::Material::FRONT_AND_BACK, osg::Vec4(0, 0, 0, 0));
material->setShininess(osg::Material::FRONT_AND_BACK, 0);
}
return sh.take();
return sh.release();
}
}

View File

@@ -23,7 +23,7 @@ osg::Vec4Array *VertexMap::asVec4Array(int num_vertices, const osg::Vec4 &defaul
value.w() *= modulator.w();
array->at(i->first) = value;
}
return array.take();
return array.release();
}
osg::Vec2Array *VertexMap::asVec2Array(int num_vertices, const osg::Vec2 &default_value, const osg::Vec2 &modulator) const
@@ -36,7 +36,7 @@ osg::Vec2Array *VertexMap::asVec2Array(int num_vertices, const osg::Vec2 &defaul
value.y() *= modulator.y();
array->at(i->first) = osg::Vec2(value.x(), value.y());
}
return array.take();
return array.release();
}
osg::Vec3Array *VertexMap::asVec3Array(int num_vertices, const osg::Vec3 &default_value, const osg::Vec3 &modulator) const
@@ -50,7 +50,7 @@ osg::Vec3Array *VertexMap::asVec3Array(int num_vertices, const osg::Vec3 &defaul
value.z() *= modulator.z();
array->at(i->first) = osg::Vec3(value.x(), value.y(), value.z());
}
return array.take();
return array.release();
}
VertexMap *VertexMap::remap(const std::vector<int> &remapping) const
@@ -68,7 +68,7 @@ VertexMap *VertexMap::remap(const std::vector<int> &remapping) const
}
}
return result.take();
return result.release();
}
VertexMap_map *VertexMap_map::remap(const std::vector<int> &remapping) const
@@ -77,5 +77,5 @@ VertexMap_map *VertexMap_map::remap(const std::vector<int> &remapping) const
for (VertexMap_map::const_iterator i=begin(); i!=end(); ++i) {
(*result.get())[i->first] = i->second->remap(remapping);
}
return result.take();
return result.release();
}

View File

@@ -48,7 +48,7 @@ public:
lwosg::SceneLoader scene_loader(conv_options);
osg::ref_ptr<osg::Node> node = scene_loader.load(fileName, local_opt.get());
if (node.valid()) {
return node.take();
return node.release();
}
return ReadResult::FILE_NOT_HANDLED;

View File

@@ -740,12 +740,9 @@ public:
if (edge->_p1==pOriginal) edge->_p1=pNew;
if (edge->_p2==pOriginal) edge->_p2=pNew;
if (edge->_p2 > edge->_p1)
if (edge->_p2 < edge->_p1)
{
// swap to ensure that lowest ptr value of p1, p2 pair is first.
osg::ref_ptr<Point> tmp = edge->_p1;
edge->_p1 = edge->_p2;
edge->_p2 = tmp;
edge->_p1.swap(edge->_p2);
}
itr = _edgeSet.find(edge);