Fixes to Doxygen files from Neil.

Removed unused set/getReportMode() methods and member variables from IntersectVisitor.

Added deep copy construction of Geometry objects.
This commit is contained in:
Robert Osfield
2002-07-25 21:50:08 +00:00
parent 7a4c43c06e
commit 95bdcfc3f6
7 changed files with 43 additions and 21 deletions

View File

@@ -323,7 +323,6 @@ INPUT = $(OSGHOME)/include/osg \
$(OSGHOME)/include/osgParticle \
$(OSGHOME)/include/osgText \
$(OSGHOME)/include/osgUtil \
$(OSGHOME)/include/osgUtx \
$(OSGHOME)/doc/Doxyfiles/auto_Mainpage
# If the value of the INPUT tag contains directories, you can use the

View File

@@ -323,7 +323,6 @@ INPUT = $(OSGHOME)/include/osg \
$(OSGHOME)/include/osgParticle \
$(OSGHOME)/include/osgText \
$(OSGHOME)/include/osgUtil \
$(OSGHOME)/include/osgUtx \
$(OSGHOME)/doc/Doxyfiles/auto_Mainpage
# If the value of the INPUT tag contains directories, you can use the

View File

@@ -17,6 +17,8 @@ class StateSet;
class StateAttribute;
class Node;
class Drawable;
class Array;
class Primitive;
/** Copy Op(erator) used to control the whether shallow or deep copy is used
* during copy construction and clone operation.*/
@@ -35,6 +37,8 @@ class SG_EXPORT CopyOp
DEEP_COPY_STATEATTRIBUTES = 16,
DEEP_COPY_TEXTURES = 32,
DEEP_COPY_IMAGES = 64,
DEEP_COPY_ARRAYS = 128,
DEEP_COPY_PRIMITIVES = 256,
DEEP_COPY_ALL = 0xffffffff
};
@@ -51,6 +55,8 @@ class SG_EXPORT CopyOp
virtual StateAttribute* operator() (const StateAttribute* attr) const;
virtual Texture* operator() (const Texture* text) const;
virtual Image* operator() (const Image* image) const;
virtual Array* operator() (const Array* image) const;
virtual Primitive* operator() (const Primitive* image) const;
protected:

View File

@@ -76,17 +76,6 @@ class OSGUTIL_EXPORT IntersectVisitor : public osg::NodeVisitor
/** Add a line segment to use for intersection testing during scene traversal.*/
void addLineSegment(osg::LineSegment* seg);
/** Modes to control how IntersectVisitor reports hits. */
enum HitReportingMode {
ONLY_NEAREST_HIT,
ALL_HITS
};
/** Set the mode of how hits should reported back from a traversal.*/
void setHitReportingMode(HitReportingMode hrm) { _hitReportingMode = hrm; }
/** Get the mode of how hits should reported back from a traversal.*/
HitReportingMode getHitReportingMode() { return _hitReportingMode; }
//typedef std::multiset<Hit> HitList;
typedef std::vector<Hit> HitList;
typedef std::map<osg::LineSegment*,HitList > LineSegmentHitListMap;
@@ -151,8 +140,6 @@ class OSGUTIL_EXPORT IntersectVisitor : public osg::NodeVisitor
IntersectStateStack _intersectStateStack;
osg::NodePath _nodePath;
HitReportingMode _hitReportingMode;
LineSegmentHitListMap _segHitList;
};

View File

@@ -3,6 +3,8 @@
#include <osg/StateSet>
#include <osg/Texture>
#include <osg/Drawable>
#include <osg/Array>
#include <osg/Primitive>
using namespace osg;
@@ -72,3 +74,19 @@ Image* CopyOp::operator() (const Image* image) const
return dynamic_cast<Image*>(image->clone(*this));
else return const_cast<Image*>(image);
}
Array* CopyOp::operator() (const Array* array) const
{
if (array && _flags&DEEP_COPY_ARRAYS)
return dynamic_cast<Array*>(array->clone(*this));
else
return const_cast<Array*>(array);
}
Primitive* CopyOp::operator() (const Primitive* primitive) const
{
if (primitive && _flags&DEEP_COPY_PRIMITIVES)
return dynamic_cast<Primitive*>(primitive->clone(*this));
else
return const_cast<Primitive*>(primitive);
}

View File

@@ -11,14 +11,26 @@ Geometry::Geometry()
Geometry::Geometry(const Geometry& geometry,const CopyOp& copyop):
Drawable(geometry,copyop),
_primitives(geometry._primitives),
_vertexArray(geometry._vertexArray),
_vertexArray(dynamic_cast<Vec3Array*>(copyop(geometry._vertexArray.get()))),
_normalBinding(geometry._normalBinding),
_normalArray(geometry._normalArray),
_normalArray(dynamic_cast<Vec3Array*>(copyop(geometry._normalArray.get()))),
_colorBinding(geometry._colorBinding),
_colorArray(geometry._colorArray),
_texCoordList(geometry._texCoordList)
_colorArray(copyop(geometry._colorArray.get()))
{
for(PrimitiveList::const_iterator pitr=geometry._primitives.begin();
pitr!=geometry._primitives.end();
++pitr)
{
Primitive* primitive = copyop(pitr->get());
if (primitive) _primitives.push_back(primitive);
}
for(TexCoordArrayList::const_iterator titr=geometry._texCoordList.begin();
titr!=geometry._texCoordList.end();
++titr)
{
_texCoordList.push_back(copyop(titr->get()));
}
}
Geometry::~Geometry()

View File

@@ -140,13 +140,13 @@ IntersectVisitor::IntersectVisitor()
{
// overide the default node visitor mode.
setTraversalMode(NodeVisitor::TRAVERSE_ACTIVE_CHILDREN);
reset();
}
IntersectVisitor::~IntersectVisitor()
{
_hitReportingMode = ONLY_NEAREST_HIT;
}
@@ -476,6 +476,7 @@ bool IntersectVisitor::intersect(Drawable& drawable)
hit._intersectNormal = thitr->second.second;
_segHitList[sitr->first.get()].push_back(hit);
std::sort(_segHitList[sitr->first.get()].begin(),_segHitList[sitr->first.get()].end());
hitFlag = true;