osg::DVRClipGeometry Class Reference

*put brief class description here*

#include <OSGDVRClipGeometry.h>

Inheritance diagram for osg::DVRClipGeometry:

osg::DVRClipGeometryBase osg::FieldContainer

List of all members.

Clipping



class FieldContainer
class DVRClipGeometryBase
void buildContours (Real32 dist2RefPlane, bool positiveWinding, const Vec3f &sliceNormal)
 Identifies all contours and links them.
void linkContour (DVRTriangle *startTriangle, Real32 dist2RefPlane, const Vec3f &viewDir, bool positiveWinding)
 Identifies and links a contour starting with the given triangle.
void updateActiveTriangles (Real32 dist2RefPlane, const Vec3f &sliceNormal)
 updates the active triangle list
void addActiveTriangle (DVRTriangle *tri)
void addNewActiveTriangles (DVRVertex *vertex, Real32 dist2RefPlane)
Pnt3f interpolate (DVRTriangle *tri, Int32 v1, Int32 v2, Real32 dist2RefPlane)
static void initMethod (void)
void operator= (const DVRClipGeometry &source)

Public Types

enum  { GeometryNodeFieldId = Inherited::NextFieldId, BeaconFieldId = GeometryNodeFieldId + 1, NextFieldId = BeaconFieldId + 1 }
typedef DVRClipGeometryPtr Ptr
enum  { NextFieldId = 1 }

Public Member Functions

Sync


virtual void changed (BitVector whichField, UInt32 origin)
Output


virtual void dump (UInt32 uiIndent=0, const BitVector bvFlags=0) const
Clipping


void initialize (const Matrix &volumeToWorld)
void resetLocalData (void)
 Reset local data of vertices and triangles.
void setReferencePlane (const Plane &referencePlane)
 Set the reference plane used in the clipping algorithm.
bool setNumAddPerVertexAttr (UInt32 additionalPerVertexAttributes)
 set the number of additional per vertex attributes
void computeSeedVertices (void)
 Compute the seed vertex set.
const DVRTriangleListgetContours (float dist2RefPlane, bool positiveWinding, const Vec3f &sliceNormal)
 find contour made up by triangles which are cut by the current slice
FieldContainer Get


virtual FieldContainerTypegetType (void)
virtual const FieldContainerTypegetType (void) const
virtual UInt32 getContainerSize (void) const
Field Get


SFNodePtrgetSFGeometryNode (void)
 Get the DVRClipGeometry::_sfGeometryNode field.
SFNodePtrgetSFBeacon (void)
 Get the DVRClipGeometry::_sfBeacon field.
NodePtrgetGeometryNode (void)
 Get the value of the DVRClipGeometry::_sfGeometryNode field.
const NodePtrgetGeometryNode (void) const
 Get the value of the DVRClipGeometry::_sfGeometryNode field.
NodePtrgetBeacon (void)
 Get the value of the DVRClipGeometry::_sfBeacon field.
const NodePtrgetBeacon (void) const
 Get the value of the DVRClipGeometry::_sfBeacon field.
Field Set


void setGeometryNode (const NodePtr &value)
 Set the value of the DVRClipGeometry::_sfGeometryNode field.
void setBeacon (const NodePtr &value)
 Set the value of the DVRClipGeometry::_sfBeacon field.
Binary Access
virtual UInt32 getBinSize (const BitVector &whichField)
virtual void copyToBin (BinaryDataHandler &pMem, const BitVector &whichField)
virtual void copyFromBin (BinaryDataHandler &pMem, const BitVector &whichField)
Copy


virtual FieldContainerPtr shallowCopy (void) const
Get Instance Type Information


UInt32 getTypeId (void) const
UInt16 getGroupId (void) const
const Char8getTypeName (void) const


FieldgetField (UInt32 fieldId)
FieldgetField (const Char8 *fieldName)

Static Public Member Functions

Class Get


static FieldContainerTypegetClassType (void)
 access the type of the class
static UInt32 getClassTypeId (void)
 access the numerical type of the class
Construction


static DVRClipGeometryPtr create (void)
 create a new instance of the class
static DVRClipGeometryPtr createEmpty (void)
 create an empty new instance of the class, do not copy the prototype
Get Class Type Information


static UInt16 getClassGroupId (void)

Static Public Attributes

static const osg::BitVector GeometryNodeFieldMask
static const osg::BitVector BeaconFieldMask
static const osg::BitVector MTInfluenceMask
static const BitVector NextFieldMask
CoredNodePtr helper


static const bool isNodeCore = false

Protected Member Functions

Constructors


 DVRClipGeometry (void)
 DVRClipGeometry (const DVRClipGeometry &source)
Destructors


virtual ~DVRClipGeometry (void)
Vertices


Int32 insertVertex (Int32 idx)
 Insert a vertex in the vertex list.
bool isLocalMinimum (DVRVertex &vertex)
Triangles


bool isCut (DVRTriangle *tri, Real32 dist2RefPlane, DVRVertex *switchedVertices[3])
bool isBehindPlane (DVRTriangle &tri, Real32 dist2RefPlane)
void renderTriangle (const DVRTriangle &tri) const
 Use OpenGL to render the triangle.
Triangle Geometry Setup


bool buildTriangledGeometry (void)
 create the triangled geometry data structure
Sync


void executeSyncImpl (DVRClipGeometryBase *pOther, const BitVector &whichField)
virtual void executeSync (FieldContainer &other, const BitVector &whichField)
Sync


void executeSyncImpl (FieldContainer *pOther, const BitVector &whichField)
MT Edit


template<class FieldTypeT>
void beginEditX (const BitVector &whichField, FieldTypeT &field)
template<class FieldTypeT>
void endEditX (const BitVector &whichField, FieldTypeT &field)
MT Construction


void onCreate (const FieldContainer *source=NULL)
void onCreateAspect (const FieldContainer *aspect0, const FieldContainer *source=NULL)
MT Destruction


virtual void onDestroy (void)

Static Protected Member Functions

Create Fieldcontainer


template<class ObjectPtrT>
static void newPtr (ObjectPtrT &result, const typename ObjectPtrT::StoredObjectType *prototypeP)
template<class ObjectPtrT>
static void newPtr (ObjectPtrT &result)

Protected Attributes

Locals


bool initialized
 is the clip geometry initialized?
GeometryPtr geometry
 the core of the geometry node
std::vector< DVRVertex_mfVertices
 list of vertices in the triangulated clip geometry
std::vector< DVRTriangle_mfTriangles
 list of triangles in the triangulated clip geometry
Matrix toVolumeSpace
DVRTriangle ** activeTriangles
 the triangles which are cut by the current slice
UInt32 activeTrianglesCount
 is the clip geometry initialized?
UInt32 maxActiveTrianglesCount
 is the clip geometry initialized?
DVRVertex ** seedVertices
 the vertices which are closest to the reference plane
UInt32 seedVerticesCount
 is the clip geometry initialized?
UInt32 maxSeedVerticesCount
 is the clip geometry initialized?
DVRTriangleList contours
Fields


SFNodePtr _sfGeometryNode
SFNodePtr _sfBeacon
Member


UInt32 _shares

Private Types

typedef DVRClipGeometryBase Inherited


Detailed Description

Definition at line 58 of file OSGDVRClipGeometry.h.


Member Typedef Documentation

Reimplemented from osg::DVRClipGeometryBase.

Definition at line 62 of file OSGDVRClipGeometry.h.

Definition at line 91 of file OSGDVRClipGeometryBase.h.


Member Enumeration Documentation

anonymous enum [inherited]

Enumerator:
GeometryNodeFieldId 
BeaconFieldId 
NextFieldId 

Definition at line 93 of file OSGDVRClipGeometryBase.h.

00094     {
00095         GeometryNodeFieldId = Inherited::NextFieldId,
00096         BeaconFieldId       = GeometryNodeFieldId + 1,
00097         NextFieldId         = BeaconFieldId       + 1
00098     };

anonymous enum [inherited]

Enumerator:
NextFieldId 

Definition at line 73 of file OSGFieldContainerImpl.h.

00073 { NextFieldId = 1 };


Constructor & Destructor Documentation

DVRClipGeometry::DVRClipGeometry ( void   )  [protected]

Definition at line 65 of file OSGDVRClipGeometry.cpp.

References activeTriangles, activeTrianglesCount, initialized, maxActiveTrianglesCount, maxSeedVerticesCount, seedVertices, and seedVerticesCount.

00065                                      :
00066     Inherited()
00067 {
00068     initialized             = false;
00069     maxActiveTrianglesCount = 4;
00070     activeTrianglesCount    = 0;
00071     maxSeedVerticesCount    = 4;
00072     seedVerticesCount       = 0;
00073 
00074     activeTriangles         =  
00075         (DVRTriangle **) malloc(maxActiveTrianglesCount * 
00076                                 sizeof(DVRTriangle *)   );
00077 
00078     seedVertices = 
00079         (DVRVertex   **) malloc(maxSeedVerticesCount    *
00080                                 sizeof(DVRVertex *)     );
00081 }

DVRClipGeometry::DVRClipGeometry ( const DVRClipGeometry source  )  [protected]

Definition at line 84 of file OSGDVRClipGeometry.cpp.

References activeTriangles, activeTrianglesCount, initialized, maxActiveTrianglesCount, maxSeedVerticesCount, seedVertices, and seedVerticesCount.

00084                                                               :
00085     Inherited(source)
00086 {
00087     initialized             = false;
00088     maxActiveTrianglesCount = 4;
00089     activeTrianglesCount    = 0;
00090     maxSeedVerticesCount    = 4;
00091     seedVerticesCount       = 0;
00092 
00093     activeTriangles =  
00094         (DVRTriangle **) malloc(maxActiveTrianglesCount * 
00095                                 sizeof(DVRTriangle *)   );
00096 
00097     seedVertices = 
00098         (DVRVertex   **) malloc(maxSeedVerticesCount    * 
00099                                 sizeof(DVRVertex   *)   );
00100 }

DVRClipGeometry::~DVRClipGeometry ( void   )  [protected, virtual]

Definition at line 103 of file OSGDVRClipGeometry.cpp.

References activeTriangles, and seedVertices.

00104 {
00105     if(activeTriangles)
00106         free(activeTriangles); // allocation with malloc/realloc!!
00107 
00108     if(seedVertices)
00109         free(seedVertices); // allocation with malloc/realloc!!
00110 }


Member Function Documentation

void DVRClipGeometry::changed ( BitVector  whichField,
UInt32  origin 
) [virtual]

Reimplemented from osg::FieldContainer.

Definition at line 120 of file OSGDVRClipGeometry.cpp.

References osg::FieldContainer::changed(), osg::DVRClipGeometryBase::GeometryNodeFieldMask, and initialized.

00121 {
00122     Inherited::changed(whichField, origin);
00123 
00124     if ((whichField & GeometryNodeFieldMask))
00125     {
00126         initialized = false;
00127     }
00128 }

void DVRClipGeometry::dump ( UInt32  uiIndent = 0,
const BitVector  bvFlags = 0 
) const [virtual]

Implements osg::FieldContainer.

Definition at line 131 of file OSGDVRClipGeometry.cpp.

References SLOG.

00133 {
00134     //    _sfGeometry.dump();
00135     //    _sfBeacon.dump();
00136     SLOG << "Dump DVRClipGeometry NI" << std::endl;
00137 }

void DVRClipGeometry::initialize ( const Matrix volumeToWorld  ) 

Prepare the object for clipping a volume's slices (transform it to volume's space)

Definition at line 314 of file OSGDVRClipGeometry.cpp.

References _mfTriangles, _mfVertices, buildTriangledGeometry(), osg::AttachmentContainerPtr::dcast(), geometry, osg::DVRClipGeometryBase::getBeacon(), osg::DVRClipGeometryBase::getGeometryNode(), initialized, osg::TransformationMatrix< ValueTypeT >::inverse(), osg::TransformationMatrix< ValueTypeT >::invert(), osg::TransformationMatrix< ValueTypeT >::mult(), osg::TransformationMatrix< ValueTypeT >::multMatrixPnt(), osg::TransformationMatrix< ValueTypeT >::multMatrixVec(), osg::NullFC, toVolumeSpace, and osg::TransformationMatrix< ValueTypeT >::transpose().

00315 {
00316     if(!initialized)
00317     {
00318         _mfVertices.clear ();
00319         _mfTriangles.clear();
00320 
00321         if(getGeometryNode() != NullFC)
00322         {
00323             if(getGeometryNode()->getCore() != NullFC)
00324             {                
00325                 geometry = GeometryPtr::dcast(getGeometryNode()->getCore());
00326 
00327                 if(geometry != NullFC)
00328                     initialized = buildTriangledGeometry();
00329             }
00330         }
00331     }
00332 
00333     if(!initialized) 
00334         return;
00335 
00336     Matrix old    = toVolumeSpace;
00337 
00338     toVolumeSpace = volumeToWorld;
00339     toVolumeSpace.invert();
00340 
00341     NodePtr beacon =  getBeacon();
00342 
00343     if(beacon != NullFC)
00344     {
00345         toVolumeSpace.mult(beacon->getToWorld());
00346     }
00347     else if(getGeometryNode() != NullFC)
00348     {    
00349         toVolumeSpace.mult(getGeometryNode()->getToWorld());
00350     }
00351 
00352     Matrix toVolumeSpaceInvT;
00353 
00354     toVolumeSpace    .inverse(toVolumeSpaceInvT);
00355     toVolumeSpaceInvT.transpose();
00356 
00357     UInt32 numVertices = _mfVertices.size();
00358 
00359     // transform vertices to volume's space
00360     for(UInt32 i = 0; i < numVertices; i++)
00361     {
00362         toVolumeSpace.multMatrixPnt(_mfVertices[i].pos, 
00363                                     _mfVertices[i].transformedPos);
00364     }
00365 
00366     UInt32 numTriangles = _mfTriangles.size();
00367 
00368     // transform triangle normals to volume's space
00369     for(UInt32 i = 0; i < numTriangles; i++)
00370     {
00371         toVolumeSpaceInvT.multMatrixVec(_mfTriangles[i].normal, 
00372                                         _mfTriangles[i].transformedNormal);
00373 
00374         _mfTriangles[i].transformedNormal.normalize();
00375     }
00376 }

void DVRClipGeometry::resetLocalData ( void   ) 

Definition at line 379 of file OSGDVRClipGeometry.cpp.

References _mfTriangles, _mfVertices, and osg::DVRVertex::behindPlane.

00380 {
00381     UInt32 numVertices = _mfVertices.size();
00382 
00383     for(UInt32 i = 0; i < numVertices; i++)
00384     {
00385         DVRVertex &vertex  = _mfVertices[i];
00386 
00387         vertex.behindPlane = false;
00388     }
00389 
00390     UInt32 numTriangles = _mfTriangles.size();
00391 
00392     // initialize the triangles local data
00393     for(UInt32 i = 0; i < numTriangles; i++)
00394     {
00395         _mfTriangles[i].visited   = false;
00396         _mfTriangles[i].inContour = false;
00397 
00398         for (UInt32 j = 0; j < 3; j++)
00399             _mfTriangles[i].edgeCut[j] = false;
00400     }
00401 }

void DVRClipGeometry::setReferencePlane ( const Plane referencePlane  ) 

Definition at line 403 of file OSGDVRClipGeometry.cpp.

References _mfVertices.

00404 {
00405     UInt32 numVertices = _mfVertices.size();
00406     
00407     for(UInt32 i = 0; i < numVertices; i++)
00408         _mfVertices[i].calculatePlaneDistanceTransformed(referencePlane);
00409 }

bool DVRClipGeometry::setNumAddPerVertexAttr ( UInt32  additionalPerVertexAttributes  ) 

basically there are two attributes available, the vertex position and a 3D texture coordinate. If one needs additional attributes, e.g. color, texture coordinates,.., the number of (double) values needed has to be set with this function.

Definition at line 776 of file OSGDVRClipGeometry.cpp.

References _mfTriangles.

00778 {
00779     UInt32 numTriangles = _mfTriangles.size();
00780 
00781     // update triangles
00782     for(UInt32 i = 0; i < numTriangles; i++)
00783     {
00784         if(!_mfTriangles[i].setNumAddPerVertexAttr(
00785                additionalPerVertexAttributes))
00786         {
00787             return false;
00788         }
00789     }
00790 
00791     return true;
00792 }

void DVRClipGeometry::computeSeedVertices ( void   ) 

Definition at line 411 of file OSGDVRClipGeometry.cpp.

References _mfVertices, activeTrianglesCount, initialized, isLocalMinimum(), maxSeedVerticesCount, seedVertices, and seedVerticesCount.

00412 {
00413     if(!initialized) 
00414         return;
00415 
00416     // clear seed vertex list and active triangle list
00417     seedVerticesCount    = 0;
00418     activeTrianglesCount = 0;
00419 
00420     UInt32 numVertices = _mfVertices.size();
00421   
00422     // compute initial seed vertex set
00423     for(UInt32 i = 0; i < numVertices; i++)
00424     {
00425         if(isLocalMinimum(_mfVertices[i]))
00426         {
00427             if(maxSeedVerticesCount <= seedVerticesCount)
00428             {
00429                 maxSeedVerticesCount *= 2;
00430 
00431                 seedVertices = 
00432                     (DVRVertex **)realloc(seedVertices,
00433                                           maxSeedVerticesCount *
00434                                           sizeof(DVRVertex *)  );
00435             }
00436 
00437             seedVertices[seedVerticesCount++] = &_mfVertices[i];
00438         }
00439     } 
00440 }

const DVRTriangleList & DVRClipGeometry::getContours ( float  dist2RefPlane,
bool  positiveWinding,
const Vec3f sliceNormal 
)

Definition at line 637 of file OSGDVRClipGeometry.cpp.

References buildContours(), contours, initialized, and updateActiveTriangles().

00641 {  
00642     if(!initialized) 
00643         return contours;
00644 
00645     // compute new active triangle set and for this slice 
00646     // and update seed vertex set
00647     updateActiveTriangles(dist2RefPlane, sliceNormal);
00648 
00649     // build contours from active triangle set
00650     buildContours(dist2RefPlane, positiveWinding, sliceNormal);
00651 
00652     return contours;
00653 }

Int32 DVRClipGeometry::insertVertex ( Int32  idx  )  [protected]

if there already exists a vertex at the position of the new vertex they get unified, i.e. the index of the already existent vertex is returned, else a new one is inserted

Definition at line 140 of file OSGDVRClipGeometry.cpp.

References _mfVertices, geometry, and osg::DVRVertex::pos.

Referenced by buildTriangledGeometry().

00141 {
00142     for(UInt32 i = 0; i < _mfVertices.size(); i++)
00143     {
00144         if(_mfVertices[i].pos == geometry->getPositions()->getValue(idx))
00145             return i;
00146     }
00147 
00148     DVRVertex newVertex;
00149 
00150     newVertex.pos = geometry->getPositions()->getValue(idx);
00151 
00152     _mfVertices.push_back(newVertex);
00153 
00154     return _mfVertices.size() - 1;
00155 }

bool osg::DVRClipGeometry::isLocalMinimum ( DVRVertex vertex  )  [inline, protected]

returns true, iff this vertex is a local minimum with respect to refPlaneDistance.

Definition at line 48 of file OSGDVRClipGeometry.inl.

References _mfTriangles, _mfVertices, osg::DVRVertex::adjacentTriangles, and osg::DVRVertex::refPlaneDistance.

Referenced by computeSeedVertices().

00049 {  
00050     for(MFInt32::const_iterator triIdx  = vertex.adjacentTriangles.begin(); 
00051                                 triIdx != vertex.adjacentTriangles.end  (); 
00052                                 triIdx++)
00053     {
00054         const Int32 *vertIndices = _mfTriangles[*triIdx].vertices;
00055 
00056         for(unsigned int j = 0; j < 3; j++)
00057         {
00058             if (&_mfVertices[vertIndices[j]] != &vertex)
00059             {
00060                 if(_mfVertices[vertIndices[j]].isCloser(
00061                        vertex.refPlaneDistance))
00062                 {
00063                     return false;
00064                 }
00065             }
00066         }
00067     }
00068 
00069     return true;
00070 }

bool DVRClipGeometry::isCut ( DVRTriangle tri,
Real32  dist2RefPlane,
DVRVertex switchedVertices[3] 
) [protected]

returns true, iff the plane with distance dist2RefPlane to the ref plane cuts the triangle.

Definition at line 262 of file OSGDVRClipGeometry.cpp.

References _mfVertices, osg::DVRTriangle::edgeCut, and osg::DVRTriangle::vertices.

Referenced by addNewActiveTriangles(), and updateActiveTriangles().

00265 {
00266     bool v[3] = {false, false, false};
00267 
00268     bool vertexSwitched;
00269     int  countSwitchedVertices = 0;
00270 
00271     switchedVertices[0] = NULL;
00272     switchedVertices[1] = NULL;
00273     switchedVertices[2] = NULL;
00274 
00275     // for every vertex, check if it is in front of or behind the current 
00276     // reference plane and if it has moved behind the plane
00277 
00278     for(UInt32 i = 0; i < 3; i++)
00279     {
00280         v[i] = _mfVertices[tri->vertices[i]].isBehindPlane(dist2RefPlane, 
00281                                                            vertexSwitched);
00282         if(vertexSwitched)
00283         {
00284             vertexSwitched = false;
00285 
00286             switchedVertices[countSwitchedVertices] = 
00287                 &_mfVertices[tri->vertices[i]];
00288 
00289             countSwitchedVertices++;
00290         }
00291     }
00292 
00293     bool cut = false;
00294 
00295     // remember the cut edges for faster (and correct ;-) contour tracing...
00296     for(UInt32 i = 0; i < 3; i++)
00297     {
00298         if(v[i] ^ v[(i + 1) % 3])
00299         {
00300             tri->edgeCut[i] = true;
00301             cut             = true;
00302         }
00303         else
00304         {
00305             tri->edgeCut[i] = false;
00306         }
00307     }
00308   
00309     return cut;
00310 }

bool osg::DVRClipGeometry::isBehindPlane ( DVRTriangle tri,
Real32  dist2RefPlane 
) [inline, protected]

returns true, iff dist2RefPlane is bigger than the distance to the reference plane of all vertices within the triangle.

Definition at line 85 of file OSGDVRClipGeometry.inl.

References _mfVertices, and osg::DVRTriangle::vertices.

00087 {
00088     bool switched;
00089     bool v[3];
00090 
00091     for(unsigned int i = 0; i < 3; i++)
00092     {
00093         v[i] = 
00094             _mfVertices[tri.vertices[i]].isBehindPlane(dist2RefPlane,switched);
00095     }
00096 
00097     return (v[0] && v[1] && v[2]);
00098 }

void osg::DVRClipGeometry::renderTriangle ( const DVRTriangle tri  )  const [inline, protected]

Definition at line 73 of file OSGDVRClipGeometry.inl.

References _mfVertices, and osg::DVRTriangle::vertices.

00074 {
00075     glBegin(GL_TRIANGLES);
00076     {
00077         for(unsigned int i = 0; i < 3; i++)
00078             glVertex3fv(
00079                 _mfVertices[tri.vertices[i]].transformedPos.getValues());
00080     }
00081     glEnd();
00082 }

bool DVRClipGeometry::buildTriangledGeometry ( void   )  [protected]

Definition at line 158 of file OSGDVRClipGeometry.cpp.

References _mfTriangles, _mfVertices, osg::DVRVertex::adjacentTriangles, osg::DVRTriangle::cutPnt, osg::DVRTriangle::cutPoint, osg::VectorInterface< ValueTypeT, StorageInterfaceT >::dot(), geometry, insertVertex(), osg::PointInterface< ValueTypeT, StorageInterfaceT >::negate(), osg::DVRTriangle::normal, osg::VectorInterface< ValueTypeT, StorageInterfaceT >::normalize(), SLOG, and osg::DVRTriangle::vertices.

Referenced by initialize().

00159 {
00160     // create triangles 
00161     for(TriangleIterator triangleIt  = geometry->beginTriangles(); 
00162                          triangleIt != geometry->endTriangles  ();
00163                        ++triangleIt)
00164     {
00165         DVRTriangle newTriangle;
00166         
00167         for(UInt32 i = 0; i < 3; i++)
00168         {
00169             Int32 vertexIndex = triangleIt.getPositionIndex(i);
00170             
00171             vertexIndex = insertVertex(vertexIndex);
00172 
00173             newTriangle.vertices[i] = vertexIndex;
00174             
00175             _mfVertices[vertexIndex].adjacentTriangles.push_back(
00176                 _mfTriangles.size());
00177 
00178             newTriangle.cutPnt  [i] = 0.0;
00179             newTriangle.cutPoint[i] = 0.0;
00180         }
00181         
00182         // compute normal and check orientation
00183         newTriangle.normal = 
00184             (_mfVertices[newTriangle.vertices[0]].pos -
00185              _mfVertices[newTriangle.vertices[1]].pos).cross(
00186                  _mfVertices[newTriangle.vertices[0]].pos -
00187                  _mfVertices[newTriangle.vertices[2]].pos);
00188 
00189         newTriangle.normal.normalize();
00190     
00191         if(newTriangle.normal.dot(triangleIt.getNormal(0)) < 0.0)
00192             newTriangle.normal.negate();      
00193     
00194         _mfTriangles.push_back(newTriangle);
00195     }
00196 
00197     // find neighbouring triangles
00198     for(UInt32 i = 0; i < _mfTriangles.size(); i++)
00199     {
00200         Int32 *vertices = _mfTriangles[i].vertices;   
00201 
00202         for(UInt32 l = 0; l < 3; l++)
00203         {
00204             const DVRVertex &v0 = _mfVertices[vertices[l]];
00205             const DVRVertex &v1 = _mfVertices[vertices[(l + 1) % 3]];
00206             
00207             for(UInt32 j = 0; j < v0.adjacentTriangles.size(); j++)
00208             {
00209                 for(UInt32 k = 0; k < v1.adjacentTriangles.size(); k++)
00210                 {
00211                     if(v0.adjacentTriangles[j] == v1.adjacentTriangles[k] &&
00212                        v0.adjacentTriangles[j] != i                       && 
00213                        v1.adjacentTriangles[k] != i                         )
00214                     {     
00215                         if(_mfTriangles[i].neighbours[l] != -1)
00216                         {
00217                             SLOG << "Error: Could not build clip geometry"
00218                                  << std::endl
00219                                  << "        one triangle edge shared by more "
00220                                  << "than two triangles" 
00221                                  << std::endl;
00222 
00223                             return false;
00224                         }
00225                         
00226                         _mfTriangles[i].neighbours[l] = 
00227                             v1.adjacentTriangles[k];
00228                     }
00229                 }
00230             }
00231         }
00232     }
00233     
00234     // check for non-closed geometry
00235     UInt32 checkCount = 0; 
00236 
00237     for(UInt32 i = 0; i < _mfTriangles.size(); i++)
00238     {
00239         for(UInt32 j = 0; j < 3; j++)
00240         {
00241             if(_mfTriangles[i].neighbours[j] == -1)
00242             {
00243                 checkCount++;
00244             }
00245         }
00246     }
00247 
00248     if(checkCount > 0)
00249     {
00250         SLOG << "Error: Could not build clip geometry" 
00251              << std::endl
00252              << checkCount
00253              << "open edges found!"
00254              << std::endl;
00255 
00256         return false;
00257     }
00258     
00259     return true;
00260 }

void DVRClipGeometry::buildContours ( Real32  dist2RefPlane,
bool  positiveWinding,
const Vec3f sliceNormal 
) [protected]

Definition at line 614 of file OSGDVRClipGeometry.cpp.

References activeTriangles, activeTrianglesCount, contours, osg::DVRTriangle::inContour, and linkContour().

Referenced by getContours().

00617 {
00618     contours.clear();
00619 
00620     for(UInt32 i = 0; i < activeTrianglesCount; i++)
00621     { 
00622         DVRTriangle* currentTriangle = activeTriangles[i];
00623 
00624         // if the triangle is already in a contour we can skip it    
00625         if(!currentTriangle->inContour)
00626         {
00627             contours.push_back(currentTriangle);
00628             
00629             linkContour(currentTriangle, 
00630                         dist2RefPlane, 
00631                         sliceNormal, 
00632                         positiveWinding);
00633         }
00634     }
00635 }

void DVRClipGeometry::linkContour ( DVRTriangle startTriangle,
Real32  dist2RefPlane,
const Vec3f viewDir,
bool  positiveWinding 
) [protected]

Definition at line 442 of file OSGDVRClipGeometry.cpp.

References _mfTriangles, osg::DVRTriangle::contourNeighbour, osg::VectorInterface< ValueTypeT, StorageInterfaceT >::cross(), osg::DVRTriangle::cutPnt, osg::DVRTriangle::cutPoint, osg::VectorInterface< ValueTypeT, StorageInterfaceT >::dot(), osg::DVRTriangle::edgeCut, FDEBUG, osg::DVRTriangle::inContour, interpolate(), osg::DVRTriangle::neighbours, and osg::DVRTriangle::transformedNormal.

Referenced by buildContours().

00446 {
00447     FDEBUG(("DVRClipGeometry - linkcontour dist = %f\n", dist2RefPlane));
00448   
00449     bool closed = false;
00450 
00451     // first, we have to check for the correct winding direction.
00452 
00453     Pnt3f vertex[2];
00454     bool firstEdge;
00455     int  first = 0, second = 0;
00456 
00457     if(startTriangle->edgeCut[0] && startTriangle->edgeCut[1])
00458     {
00459         vertex[0] = interpolate(startTriangle, 1, 0, dist2RefPlane); 
00460         vertex[1] = interpolate(startTriangle, 1, 2, dist2RefPlane);
00461 
00462         first = 0; second = 1;
00463     }
00464     else if (startTriangle->edgeCut[1] && startTriangle->edgeCut[2])
00465     {
00466         vertex[0] = interpolate(startTriangle, 2, 1, dist2RefPlane);
00467         vertex[1] = interpolate(startTriangle, 2, 0, dist2RefPlane);
00468 
00469         first = 1; second = 2;
00470     }
00471     else if (startTriangle->edgeCut[0] && startTriangle->edgeCut[2])
00472     {
00473         vertex[0] = interpolate(startTriangle, 0, 1, dist2RefPlane);
00474         vertex[1] = interpolate(startTriangle, 0, 2, dist2RefPlane);
00475 
00476         first = 0; second = 2;
00477     }
00478 
00479     // Now we should have both cut points on our edges.
00480 
00481     // If the cross product of the normal of this triangle with the 
00482     // vector between the two cut points (cutPoint[1] - cutPoint[0]) 
00483     // has a positive dot product with the viewing direction, then 
00484     // the edge with cutPoint[0] on it is the right direction, otherwise
00485     // we would have to choose the other direction.
00486 
00487     Vec3f tmp = vertex[1] - vertex[0];
00488 
00489     tmp = tmp.cross(startTriangle->transformedNormal);
00490 
00491     if(tmp.dot(viewDir) <= 0.0)
00492     {
00493         firstEdge = false;
00494     }else
00495     {
00496         firstEdge = true;
00497     }
00498 
00499     if(!positiveWinding)
00500         firstEdge = !firstEdge;
00501 
00502     DVRTriangle *current = startTriangle;
00503 
00504     current->inContour = true;
00505 
00506     if(firstEdge)
00507     {
00508         current->cutPnt      = vertex[0];
00509         current->cutPoint[0] = vertex[0][0];
00510         current->cutPoint[1] = vertex[0][1];
00511         current->cutPoint[2] = vertex[0][2];
00512 
00513         current->contourNeighbour = &_mfTriangles[current->neighbours[first]];
00514 
00515         //      // debugging -> remove
00516         //      if(!current->contourNeighbour){
00517         //        std::cerr<<"contour neighbour is NULL\n";
00518         //        exit(0);
00519         //      }
00520 
00521         current = current->contourNeighbour;
00522     }
00523     else
00524     {
00525         current->cutPnt      = vertex[1];
00526         current->cutPoint[0] = vertex[1][0];
00527         current->cutPoint[1] = vertex[1][1];
00528         current->cutPoint[2] = vertex[1][2];    
00529 
00530         current->contourNeighbour = &_mfTriangles[current->neighbours[second]];
00531         //      // debugging -> remove
00532         //      if(!current->contourNeighbour){
00533         //        std::cerr<<"contour neighbour is NULL\n";
00534         //        exit(0);
00535         //      }
00536 
00537         current = current->contourNeighbour;    
00538     }
00539 
00540     //check neighbours
00541     while(!closed)
00542     {
00543         closed             = true;
00544         current->inContour = true;
00545 
00546         for(UInt32 i = 0; i < 3; i++)
00547         {
00548             // if a neighbour triangle is in the active triangle list and 
00549             // not yet in a contour it is our new contour neighbour.
00550             if( current->edgeCut[i] && 
00551                !_mfTriangles[current->neighbours[i]].inContour)
00552             {
00553                 // calculate cut point  
00554                 current->cutPnt = interpolate(current, 
00555                                               i, 
00556                                               (i + 1) % 3, 
00557                                               dist2RefPlane);
00558 
00559                 current->cutPoint[0] = current->cutPnt[0];
00560                 current->cutPoint[1] = current->cutPnt[1];
00561                 current->cutPoint[2] = current->cutPnt[2];
00562 
00563                 current->contourNeighbour = 
00564                     &_mfTriangles[current->neighbours[i]];
00565 
00566                 //      // debugging -> remove
00567                 //      if(!current->contourNeighbour){
00568                 //        std::cerr<<"contour neighbour is NULL\n";
00569                 //        exit(0);
00570                 //      }
00571 
00572                 current = current->contourNeighbour;
00573                 closed  = false;
00574 
00575                 break;
00576             }// !inContour
00577         } // end for neighbours
00578     } // end while !closed
00579 
00580     for(UInt32 i = 0; i < 3; i++)
00581     {
00582         if(&_mfTriangles[current->neighbours[i]] == startTriangle)
00583         {
00584             current->cutPnt = interpolate(current, 
00585                                           i, 
00586                                           (i + 1) % 3, 
00587                                           dist2RefPlane);
00588 
00589             current->cutPoint[0] = current->cutPnt[0];
00590             current->cutPoint[1] = current->cutPnt[1];
00591             current->cutPoint[2] = current->cutPnt[2];
00592 
00593             // now the ring is closed.
00594 
00595             current->contourNeighbour = startTriangle;
00596             //        // debugging -> remove
00597             //        if(!current->contourNeighbour){
00598             //      std::cerr<<"contour neighbour is NULL\n";
00599             //      exit(0);
00600             //        }
00601             break;
00602         }
00603     } // end for neighbours
00604 
00605     //    // debugging -> remove
00606     //    if(!current->contourNeighbour){
00607     //      std::cerr <<"contour could not closed\n";
00608     //      std::cerr <<current->edgeCut[0]<<current->edgeCut[1]
00609     //                <<current->edgeCut[2]<<std::endl;
00610     //      exit(0);
00611     //    }
00612 }

void DVRClipGeometry::updateActiveTriangles ( Real32  dist2RefPlane,
const Vec3f sliceNormal 
) [protected]

Definition at line 701 of file OSGDVRClipGeometry.cpp.

References activeTriangles, activeTrianglesCount, addNewActiveTriangles(), osg::DVRTriangle::contourNeighbour, osg::DVRTriangle::inContour, osg::DVRVertex::isBehindPlane(), isCut(), seedVertices, and seedVerticesCount.

Referenced by getContours().

00703 {
00704     // first, we check the active triangles.
00705 
00706     DVRVertex *switchedVertices[3];
00707   
00708     for(Int32 triIt = activeTrianglesCount-1; triIt >= 0; triIt--)
00709     {
00710         DVRTriangle *tri = activeTriangles[triIt];
00711 
00712         tri->inContour        = false;
00713         tri->contourNeighbour = NULL;
00714 
00715         // if an active triangle is cut by the plane it simply stays in 
00716         // the list.otherwise we have to remove it and check the neighbour
00717         // triangles.
00718 
00719         if(!(isCut(tri,dist2RefPlane, switchedVertices)))
00720         {
00721             //remove triangle
00722             activeTrianglesCount--;
00723             activeTriangles[triIt] = activeTriangles[activeTrianglesCount];
00724         }
00725         
00726         // check triangles adjacent to the vertices that moved behind 
00727         // the active slice
00728 
00729         for(UInt32 i = 0; i < 3; i++)
00730         {
00731             if(switchedVertices[i])
00732                 addNewActiveTriangles(switchedVertices[i], dist2RefPlane);
00733         }
00734     }
00735 
00736     // now we have to check our seed set, if new triangles have to be added.
00737   
00738     // run over our seed set
00739     for(Int32 vertIt = seedVerticesCount-1; vertIt >= 0; vertIt--)
00740     {
00741         DVRVertex *sv = seedVertices[vertIt];
00742 
00743         // check if seed vertex has been hit by the plane
00744         if (sv->isBehindPlane(dist2RefPlane))
00745         {
00746             // add triangles to active triangle list      
00747             addNewActiveTriangles(sv,dist2RefPlane);
00748             
00749             // we will never need this seed vertex again, we can erase it 
00750             // from the list.
00751             seedVertices[vertIt] = seedVertices[--seedVerticesCount];
00752         }    
00753     }
00754 }

void DVRClipGeometry::addActiveTriangle ( DVRTriangle tri  )  [protected]

Definition at line 757 of file OSGDVRClipGeometry.cpp.

References activeTriangles, activeTrianglesCount, FDEBUG, and maxActiveTrianglesCount.

Referenced by addNewActiveTriangles().

00758 {
00759     if(maxActiveTrianglesCount <= activeTrianglesCount)
00760     {
00761         FDEBUG(("realloc active tri list\n"));
00762         // allocate additional mem (TODO: better prediction for needed mem)
00763 
00764         maxActiveTrianglesCount *= 2;
00765         activeTriangles          = 
00766             (DVRTriangle **) realloc(activeTriangles, 
00767                                      sizeof(DVRTriangle *) * 
00768                                      maxActiveTrianglesCount);
00769     }
00770     
00771     activeTriangles[activeTrianglesCount] = tri;    
00772 
00773     activeTrianglesCount++;
00774 }

void DVRClipGeometry::addNewActiveTriangles ( DVRVertex vertex,
Real32  dist2RefPlane 
) [protected]

Definition at line 655 of file OSGDVRClipGeometry.cpp.

References _mfTriangles, addActiveTriangle(), osg::DVRVertex::adjacentTriangles, osg::DVRTriangle::inContour, isCut(), and osg::DVRTriangle::visited.

Referenced by updateActiveTriangles().

00657 {
00658     // iterate over triangles
00659     DVRVertex *switchedVertices[3];
00660   
00661     std::vector<Int32> &adjacentTriangles = vertex->adjacentTriangles; 
00662 
00663     UInt32 numAdjacenTriangles =  adjacentTriangles.size();
00664 
00665     for(UInt32 j = 0; j < numAdjacenTriangles; j++)
00666     {
00667         DVRTriangle *triangle = &_mfTriangles[adjacentTriangles[j]];
00668 
00669         if(!triangle->visited)
00670         {
00671             // insert triangle if it is cut and it was not visited so far...
00672             if(isCut(triangle,dist2RefPlane, switchedVertices)) 
00673             {
00674                 triangle->visited   = true;
00675                 triangle->inContour = false;
00676 
00677                 addActiveTriangle(triangle);
00678             }
00679             else
00680             { 
00681                 // neighbour triangle is not visited and not cut -> 
00682                 // check neighbours
00683 
00684                 triangle->visited   = true;
00685                 triangle->inContour = false;
00686             } 
00687       
00688             // check neighbours
00689             for(UInt32 i = 0; i < 3; i++)
00690             {
00691                 if(switchedVertices[i])
00692                 {
00693                     addNewActiveTriangles(switchedVertices[i],
00694                                           dist2RefPlane      );
00695                 }
00696             }       
00697         }
00698     }
00699 }

Pnt3f osg::DVRClipGeometry::interpolate ( DVRTriangle tri,
Int32  v1,
Int32  v2,
Real32  dist2RefPlane 
) [inline, protected]

Definition at line 101 of file OSGDVRClipGeometry.inl.

References _mfVertices, osg::PointInterface< ValueTypeT, StorageInterfaceT >::subZero(), and osg::DVRTriangle::vertices.

Referenced by linkContour().

00105 {
00106     float weight = 
00107 
00108         ((_mfVertices[tri->vertices[v2]].refPlaneDistance - 
00109           dist2RefPlane                                    ) /
00110          (_mfVertices[tri->vertices[v2]].refPlaneDistance - 
00111           _mfVertices[tri->vertices[v1]].refPlaneDistance  ));
00112     
00113   if(weight == 1.0)
00114   {
00115       // sorry, but without this we will have some really bad flickering...
00116       weight += 0.000001;
00117   }
00118   
00119   return 
00120       (_mfVertices[tri->vertices[v1]].transformedPos * weight) +  
00121       (_mfVertices[tri->vertices[v2]].transformedPos * (1.0f - 
00122                                                         weight)).subZero();
00123 }

void DVRClipGeometry::initMethod ( void   )  [static, private]

Definition at line 115 of file OSGDVRClipGeometry.cpp.

00116 {
00117 }

void osg::DVRClipGeometry::operator= ( const DVRClipGeometry source  )  [private]

osg::FieldContainerType & osg::DVRClipGeometryBase::getClassType ( void   )  [inline, static, inherited]

Reimplemented from osg::FieldContainer.

Definition at line 58 of file OSGDVRClipGeometryBase.inl.

References osg::DVRClipGeometryBase::_type.

Referenced by osg::DVRClipGeometryBase::create().

00059 {
00060     return _type; 
00061 } 

osg::UInt32 osg::DVRClipGeometryBase::getClassTypeId ( void   )  [inline, static, inherited]

Reimplemented from osg::FieldContainer.

Definition at line 65 of file OSGDVRClipGeometryBase.inl.

References osg::DVRClipGeometryBase::_type, and osg::TypeBase::getId().

00066 {
00067     return _type.getId(); 
00068 } 

FieldContainerType & DVRClipGeometryBase::getType ( void   )  [virtual, inherited]

Reimplemented from osg::FieldContainer.

Definition at line 117 of file OSGDVRClipGeometryBase.cpp.

References osg::DVRClipGeometryBase::_type.

00118 {
00119     return _type; 
00120 } 

const FieldContainerType & DVRClipGeometryBase::getType ( void   )  const [virtual, inherited]

Reimplemented from osg::FieldContainer.

Definition at line 122 of file OSGDVRClipGeometryBase.cpp.

References osg::DVRClipGeometryBase::_type.

00123 {
00124     return _type;
00125 } 

UInt32 DVRClipGeometryBase::getContainerSize ( void   )  const [virtual, inherited]

Implements osg::FieldContainer.

Definition at line 137 of file OSGDVRClipGeometryBase.cpp.

00138 { 
00139     return sizeof(DVRClipGeometry); 
00140 }

SFNodePtr * osg::DVRClipGeometryBase::getSFGeometryNode ( void   )  [inline, inherited]

Definition at line 101 of file OSGDVRClipGeometryBase.inl.

References osg::DVRClipGeometryBase::_sfGeometryNode.

00102 {
00103     return &_sfGeometryNode;
00104 }

SFNodePtr * osg::DVRClipGeometryBase::getSFBeacon ( void   )  [inline, inherited]

Definition at line 108 of file OSGDVRClipGeometryBase.inl.

References osg::DVRClipGeometryBase::_sfBeacon.

00109 {
00110     return &_sfBeacon;
00111 }

NodePtr & osg::DVRClipGeometryBase::getGeometryNode ( void   )  [inline, inherited]

Definition at line 116 of file OSGDVRClipGeometryBase.inl.

References osg::DVRClipGeometryBase::_sfGeometryNode, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

Referenced by initialize().

00117 {
00118     return _sfGeometryNode.getValue();
00119 }

const NodePtr & osg::DVRClipGeometryBase::getGeometryNode ( void   )  const [inline, inherited]

Definition at line 123 of file OSGDVRClipGeometryBase.inl.

References osg::DVRClipGeometryBase::_sfGeometryNode, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00124 {
00125     return _sfGeometryNode.getValue();
00126 }

NodePtr & osg::DVRClipGeometryBase::getBeacon ( void   )  [inline, inherited]

Definition at line 137 of file OSGDVRClipGeometryBase.inl.

References osg::DVRClipGeometryBase::_sfBeacon, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

Referenced by initialize().

00138 {
00139     return _sfBeacon.getValue();
00140 }

const NodePtr & osg::DVRClipGeometryBase::getBeacon ( void   )  const [inline, inherited]

Definition at line 144 of file OSGDVRClipGeometryBase.inl.

References osg::DVRClipGeometryBase::_sfBeacon, and osg::SField< FieldTypeT, fieldNameSpace >::getValue().

00145 {
00146     return _sfBeacon.getValue();
00147 }

void osg::DVRClipGeometryBase::setGeometryNode ( const NodePtr value  )  [inline, inherited]

void osg::DVRClipGeometryBase::setBeacon ( const NodePtr value  )  [inline, inherited]

UInt32 DVRClipGeometryBase::getBinSize ( const BitVector whichField  )  [virtual, inherited]

Reimplemented from osg::FieldContainer.

Definition at line 201 of file OSGDVRClipGeometryBase.cpp.

References osg::DVRClipGeometryBase::_sfBeacon, osg::DVRClipGeometryBase::_sfGeometryNode, osg::DVRClipGeometryBase::BeaconFieldMask, osg::DVRClipGeometryBase::GeometryNodeFieldMask, osg::SField< FieldTypeT, fieldNameSpace >::getBinSize(), osg::FieldContainer::getBinSize(), and osg::FieldBits::NoField.

00202 {
00203     UInt32 returnValue = Inherited::getBinSize(whichField);
00204 
00205     if(FieldBits::NoField != (GeometryNodeFieldMask & whichField))
00206     {
00207         returnValue += _sfGeometryNode.getBinSize();
00208     }
00209 
00210     if(FieldBits::NoField != (BeaconFieldMask & whichField))
00211     {
00212         returnValue += _sfBeacon.getBinSize();
00213     }
00214 
00215 
00216     return returnValue;
00217 }

void DVRClipGeometryBase::copyToBin ( BinaryDataHandler pMem,
const BitVector whichField 
) [virtual, inherited]

void DVRClipGeometryBase::copyFromBin ( BinaryDataHandler pMem,
const BitVector whichField 
) [virtual, inherited]

DVRClipGeometryPtr osg::DVRClipGeometryBase::create ( void   )  [inline, static, inherited]

Definition at line 72 of file OSGDVRClipGeometryBase.inl.

References osg::DVRClipGeometryBase::getClassType(), osg::NullFC, and osg::DVRClipGeometryBase::shallowCopy().

00073 {
00074     DVRClipGeometryPtr fc; 
00075 
00076     if(getClassType().getPrototype() != OSG::NullFC) 
00077     {
00078         fc = DVRClipGeometryPtr::dcast(
00079             getClassType().getPrototype()-> shallowCopy()); 
00080     }
00081     
00082     return fc; 
00083 }

DVRClipGeometryPtr osg::DVRClipGeometryBase::createEmpty ( void   )  [inline, static, inherited]

Definition at line 87 of file OSGDVRClipGeometryBase.inl.

References osg::FieldContainer::newPtr().

00088 { 
00089     DVRClipGeometryPtr returnValue; 
00090     
00091     newPtr(returnValue); 
00092 
00093     return returnValue; 
00094 }

FieldContainerPtr DVRClipGeometryBase::shallowCopy ( void   )  const [virtual, inherited]

Implements osg::FieldContainer.

Definition at line 128 of file OSGDVRClipGeometryBase.cpp.

References osg::FieldContainer::newPtr().

Referenced by osg::DVRClipGeometryBase::create().

00129 { 
00130     DVRClipGeometryPtr returnValue; 
00131 
00132     newPtr(returnValue, dynamic_cast<const DVRClipGeometry *>(this)); 
00133 
00134     return returnValue; 
00135 }

void DVRClipGeometryBase::executeSyncImpl ( DVRClipGeometryBase pOther,
const BitVector whichField 
) [protected, inherited]

void osg::FieldContainer::executeSyncImpl ( FieldContainer pOther,
const BitVector whichField 
) [inline, protected, inherited]

void DVRClipGeometryBase::executeSync ( FieldContainer other,
const BitVector whichField 
) [protected, virtual, inherited]

Implements osg::FieldContainer.

Definition at line 144 of file OSGDVRClipGeometryBase.cpp.

References osg::DVRClipGeometryBase::executeSyncImpl().

00146 {
00147     this->executeSyncImpl((DVRClipGeometryBase *) &other, whichField);
00148 }

UInt16 osg::FieldContainer::getClassGroupId ( void   )  [inline, static, inherited]

Definition at line 71 of file OSGFieldContainerImpl.inl.

References osg::FieldContainer::_type, and osg::FieldContainerType::getGroupId().

00072 {
00073     return _type.getGroupId();
00074 }

UInt32 osg::FieldContainer::getTypeId ( void   )  const [inline, inherited]

Definition at line 77 of file OSGFieldContainerImpl.inl.

References osg::TypeBase::getId(), and osg::FieldContainer::getType().

Referenced by osg::TextureChunk::changeFrom(), and osg::CubeTextureChunk::changeFrom().

00078 {
00079     return getType().getId();
00080 }

UInt16 osg::FieldContainer::getGroupId ( void   )  const [inline, inherited]

const Char8 * osg::FieldContainer::getTypeName ( void   )  const [inline, inherited]

Definition at line 89 of file OSGFieldContainerImpl.inl.

References osg::TypeBase::getCName(), and osg::FieldContainer::getType().

00090 {
00091     return getType().getCName();
00092 }

Field * osg::FieldContainer::getField ( UInt32  fieldId  )  [inline, inherited]

Generic Field Access

Definition at line 95 of file OSGFieldContainerImpl.inl.

References osg::FieldDescription::getField(), osg::FieldContainerType::getFieldDescription(), and osg::FieldContainer::getType().

Referenced by osg::QFCItem::expand(), osg::VRMLShapeDesc::getFieldAndDesc(), osg::QFieldViewBase::getFieldPtr(), osg::QFieldEditorBase::getFieldPtr(), osg::getParentsField(), and osg::QFCItem::setup().

00096 {
00097     const FieldDescription *desc = getType().getFieldDescription(fieldId);
00098 
00099     return desc ? desc->getField(*this) : NULL;
00100 }

Field * osg::FieldContainer::getField ( const Char8 fieldName  )  [inline, inherited]

Generic Field Access

Definition at line 103 of file OSGFieldContainerImpl.inl.

References osg::FieldContainerType::findFieldDescription(), osg::FieldDescription::getField(), and osg::FieldContainer::getType().

00104 {
00105     const FieldDescription *desc =getType().findFieldDescription(fieldName);
00106 
00107     return desc ? desc->getField(*this) : NULL;
00108 }

template<class ObjectPtrT>
void osg::FieldContainer::newPtr ( ObjectPtrT &  result,
const typename ObjectPtrT::StoredObjectType *  prototypeP 
) [inline, static, protected, inherited]

Definition at line 138 of file OSGFieldContainerImpl.inl.

References osg::ChangeList::addCreated(), osg::PThreadBase::getAspect(), osg::PThreadBase::getCurrentChangeList(), osg::ThreadManager::getNumAspects(), osg::FieldContainerFactory::registerFieldContainer(), and osg::FieldContainerFactory::the().

Referenced by osg::XWindowBase::createEmpty(), osg::WIN32WindowBase::createEmpty(), osg::ViewportBase::createEmpty(), osg::VertexProgramChunkBase::createEmpty(), osg::TwoSidedLightingChunkBase::createEmpty(), osg::TransformChunkBase::createEmpty(), osg::TransformBase::createEmpty(), osg::TileCameraDecoratorBase::createEmpty(), osg::TextureTransformChunkBase::createEmpty(), osg::TextureGrabForegroundBase::createEmpty(), osg::TextureGrabBackgroundBase::createEmpty(), osg::TextureChunkBase::createEmpty(), osg::TextureBackgroundBase::createEmpty(), osg::TexGenChunkBase::createEmpty(), osg::SwitchMaterialBase::createEmpty(), osg::SwitchBase::createEmpty(), osg::SurfaceBase::createEmpty(), osg::StringAttributeMapBase::createEmpty(), osg::StereoBufferViewportBase::createEmpty(), osg::StencilChunkBase::createEmpty(), osg::StateSortingGroupBase::createEmpty(), osg::StateBase::createEmpty(), osg::SpotLightBase::createEmpty(), osg::SortFirstWindowBase::createEmpty(), osg::SolidBackgroundBase::createEmpty(), osg::SlicesBase::createEmpty(), osg::SkyBackgroundBase::createEmpty(), osg::SimpleTexturedMaterialBase::createEmpty(), osg::SimpleStatisticsForegroundBase::createEmpty(), osg::SimpleMaterialBase::createEmpty(), osg::SHLParameterChunkBase::createEmpty(), osg::SHLChunkBase::createEmpty(), osg::ShearedStereoCameraDecoratorBase::createEmpty(), osg::ShaderParameterVec4fBase::createEmpty(), osg::ShaderParameterVec3fBase::createEmpty(), osg::ShaderParameterVec2fBase::createEmpty(), osg::ShaderParameterStringBase::createEmpty(), osg::ShaderParameterRealBase::createEmpty(), osg::ShaderParameterMVec4fBase::createEmpty(), osg::ShaderParameterMVec3fBase::createEmpty(), osg::ShaderParameterMVec2fBase::createEmpty(), osg::ShaderParameterMRealBase::createEmpty(), osg::ShaderParameterMMatrixBase::createEmpty(), osg::ShaderParameterMIntBase::createEmpty(), osg::ShaderParameterMatrixBase::createEmpty(), osg::ShaderParameterIntBase::createEmpty(), osg::ShaderParameterBoolBase::createEmpty(), osg::ScreenGroupBase::createEmpty(), osg::SClipPlaneChunkBase::createEmpty(), osg::ResolutionDisplayFilterBase::createEmpty(), osg::RenderOptionsBase::createEmpty(), osg::RegisterCombinersChunkBase::createEmpty(), osg::QTWindowBase::createEmpty(), osg::ProxyGroupBase::createEmpty(), osg::ProjectionCameraDecoratorBase::createEmpty(), osg::PolygonForegroundBase::createEmpty(), osg::PolygonChunkBase::createEmpty(), osg::PolygonBackgroundBase::createEmpty(), osg::PointLightBase::createEmpty(), osg::PointChunkBase::createEmpty(), osg::PhongMaterialBase::createEmpty(), osg::PerspectiveCameraBase::createEmpty(), osg::PassiveWindowBase::createEmpty(), osg::PassiveViewportBase::createEmpty(), osg::PassiveBackgroundBase::createEmpty(), osg::ParticlesBase::createEmpty(), osg::OrthographicCameraBase::createEmpty(), osg::OffCenterPerspectiveCameraBase::createEmpty(), osg::MultiPassMaterialBase::createEmpty(), osg::MultiDisplayWindowBase::createEmpty(), osg::MatrixCameraDecoratorBase::createEmpty(), osg::MatrixCameraBase::createEmpty(), osg::MaterialPoolBase::createEmpty(), osg::MaterialGroupBase::createEmpty(), osg::MaterialChunkBase::createEmpty(), osg::LogicOpChunkBase::createEmpty(), osg::LineChunkBase::createEmpty(), osg::LightModelChunkBase::createEmpty(), osg::LightEnvBase::createEmpty(), osg::LightChunkBase::createEmpty(), osg::InverseTransformBase::createEmpty(), osg::InlineBase::createEmpty(), osg::ImageForegroundBase::createEmpty(), osg::ImageBase::createEmpty(), osg::ImageBackgroundBase::createEmpty(), osg::GroupBase::createEmpty(), osg::GraphicStatisticsForegroundBase::createEmpty(), osg::GradientBackgroundBase::createEmpty(), osg::GrabForegroundBase::createEmpty(), osg::GLUTWindowBase::createEmpty(), osg::GeometryBase::createEmpty(), osg::FresnelMaterialBase::createEmpty(), osg::FragmentProgramChunkBase::createEmpty(), osg::FileGrabForegroundBase::createEmpty(), osg::FCPtrAttributeMapBase::createEmpty(), osg::FBOViewportBase::createEmpty(), osg::FatBorderChunkBase::createEmpty(), osg::DVRVolumeTextureBase::createEmpty(), osg::DVRVolumeBase::createEmpty(), osg::DVRSimpleShaderBase::createEmpty(), osg::DVRSimpleLUTShaderBase::createEmpty(), osg::DVRMtexLUTShaderBase::createEmpty(), osg::DVRLookupTableBase::createEmpty(), osg::DVRIsoSurfaceBase::createEmpty(), osg::DVRIsoShaderBase::createEmpty(), osg::DVRGeometryBase::createEmpty(), osg::DVRClipObjectsBase::createEmpty(), osg::DVRClipGeometryBase::createEmpty(), osg::DVRAppearanceBase::createEmpty(), osg::DistortionDisplayFilterBase::createEmpty(), osg::DistanceLODBase::createEmpty(), osg::DisplayFilterForegroundBase::createEmpty(), osg::DisplayCalibrationBase::createEmpty(), osg::DirectionalLightBase::createEmpty(), osg::DepthClearBackgroundBase::createEmpty(), osg::DepthChunkBase::createEmpty(), osg::CubeTextureChunkBase::createEmpty(), osg::ComponentTransformBase::createEmpty(), osg::ColorMaskChunkBase::createEmpty(), osg::ColorDisplayFilterBase::createEmpty(), osg::ColorBufferViewportBase::createEmpty(), osg::ClusterWindowBase::createEmpty(), osg::ClipPlaneChunkBase::createEmpty(), osg::ClipPlaneBase::createEmpty(), osg::ChunkMaterialBase::createEmpty(), osg::BlendChunkBase::createEmpty(), osg::BillboardBase::createEmpty(), osg::XWindowBase::shallowCopy(), osg::WIN32WindowBase::shallowCopy(), osg::ViewportBase::shallowCopy(), osg::VertexProgramChunkBase::shallowCopy(), osg::TwoSidedLightingChunkBase::shallowCopy(), osg::TransformChunkBase::shallowCopy(), osg::TransformBase::shallowCopy(), osg::TileCameraDecoratorBase::shallowCopy(), osg::TextureTransformChunkBase::shallowCopy(), osg::TextureGrabForegroundBase::shallowCopy(), osg::TextureGrabBackgroundBase::shallowCopy(), osg::TextureChunkBase::shallowCopy(), osg::TextureBackgroundBase::shallowCopy(), osg::TexGenChunkBase::shallowCopy(), osg::SwitchMaterialBase::shallowCopy(), osg::SwitchBase::shallowCopy(), osg::SurfaceBase::shallowCopy(), osg::StringAttributeMapBase::shallowCopy(), osg::StereoBufferViewportBase::shallowCopy(), osg::StencilChunkBase::shallowCopy(), osg::StateSortingGroupBase::shallowCopy(), osg::StateBase::shallowCopy(), osg::SpotLightBase::shallowCopy(), osg::SortFirstWindowBase::shallowCopy(), osg::SolidBackgroundBase::shallowCopy(), osg::SlicesBase::shallowCopy(), osg::SkyBackgroundBase::shallowCopy(), osg::SimpleTexturedMaterialBase::shallowCopy(), osg::SimpleStatisticsForegroundBase::shallowCopy(), osg::SimpleMaterialBase::shallowCopy(), osg::SHLParameterChunkBase::shallowCopy(), osg::SHLChunkBase::shallowCopy(), osg::ShearedStereoCameraDecoratorBase::shallowCopy(), osg::ShaderParameterVec4fBase::shallowCopy(), osg::ShaderParameterVec3fBase::shallowCopy(), osg::ShaderParameterVec2fBase::shallowCopy(), osg::ShaderParameterStringBase::shallowCopy(), osg::ShaderParameterRealBase::shallowCopy(), osg::ShaderParameterMVec4fBase::shallowCopy(), osg::ShaderParameterMVec3fBase::shallowCopy(), osg::ShaderParameterMVec2fBase::shallowCopy(), osg::ShaderParameterMRealBase::shallowCopy(), osg::ShaderParameterMMatrixBase::shallowCopy(), osg::ShaderParameterMIntBase::shallowCopy(), osg::ShaderParameterMatrixBase::shallowCopy(), osg::ShaderParameterIntBase::shallowCopy(), osg::ShaderParameterBoolBase::shallowCopy(), osg::ScreenGroupBase::shallowCopy(), osg::SClipPlaneChunkBase::shallowCopy(), osg::ResolutionDisplayFilterBase::shallowCopy(), osg::RenderOptionsBase::shallowCopy(), osg::RegisterCombinersChunkBase::shallowCopy(), osg::QTWindowBase::shallowCopy(), osg::ProxyGroupBase::shallowCopy(), osg::ProjectionCameraDecoratorBase::shallowCopy(), osg::PolygonForegroundBase::shallowCopy(), osg::PolygonChunkBase::shallowCopy(), osg::PolygonBackgroundBase::shallowCopy(), osg::PointLightBase::shallowCopy(), osg::PointChunkBase::shallowCopy(), osg::PhongMaterialBase::shallowCopy(), osg::PerspectiveCameraBase::shallowCopy(), osg::PassiveWindowBase::shallowCopy(), osg::PassiveViewportBase::shallowCopy(), osg::PassiveBackgroundBase::shallowCopy(), osg::ParticlesBase::shallowCopy(), osg::OrthographicCameraBase::shallowCopy(), osg::OffCenterPerspectiveCameraBase::shallowCopy(), osg::MultiPassMaterialBase::shallowCopy(), osg::MultiDisplayWindowBase::shallowCopy(), osg::MatrixCameraDecoratorBase::shallowCopy(), osg::MatrixCameraBase::shallowCopy(), osg::MaterialPoolBase::shallowCopy(), osg::MaterialGroupBase::shallowCopy(), osg::MaterialChunkBase::shallowCopy(), osg::LogicOpChunkBase::shallowCopy(), osg::LineChunkBase::shallowCopy(), osg::LightModelChunkBase::shallowCopy(), osg::LightEnvBase::shallowCopy(), osg::LightChunkBase::shallowCopy(), osg::InverseTransformBase::shallowCopy(), osg::InlineBase::shallowCopy(), osg::ImageForegroundBase::shallowCopy(), osg::ImageBase::shallowCopy(), osg::ImageBackgroundBase::shallowCopy(), osg::GroupBase::shallowCopy(), osg::GraphicStatisticsForegroundBase::shallowCopy(), osg::GradientBackgroundBase::shallowCopy(), osg::GrabForegroundBase::shallowCopy(), osg::GLUTWindowBase::shallowCopy(), osg::GeometryBase::shallowCopy(), osg::FresnelMaterialBase::shallowCopy(), osg::FragmentProgramChunkBase::shallowCopy(), osg::FileGrabForegroundBase::shallowCopy(), osg::FCPtrAttributeMapBase::shallowCopy(), osg::FBOViewportBase::shallowCopy(), osg::FatBorderChunkBase::shallowCopy(), osg::DVRVolumeTextureBase::shallowCopy(), osg::DVRVolumeBase::shallowCopy(), osg::DVRSimpleShaderBase::shallowCopy(), osg::DVRSimpleLUTShaderBase::shallowCopy(), osg::DVRMtexLUTShaderBase::shallowCopy(), osg::DVRLookupTableBase::shallowCopy(), osg::DVRIsoSurfaceBase::shallowCopy(), osg::DVRIsoShaderBase::shallowCopy(), osg::DVRGeometryBase::shallowCopy(), osg::DVRClipObjectsBase::shallowCopy(), osg::DVRClipGeometryBase::shallowCopy(), osg::DVRAppearanceBase::shallowCopy(), osg::DistortionDisplayFilterBase::shallowCopy(), osg::DistanceLODBase::shallowCopy(), osg::DisplayFilterForegroundBase::shallowCopy(), osg::DisplayCalibrationBase::shallowCopy(), osg::DirectionalLightBase::shallowCopy(), osg::DepthClearBackgroundBase::shallowCopy(), osg::DepthChunkBase::shallowCopy(), osg::CubeTextureChunkBase::shallowCopy(), osg::ComponentTransformBase::shallowCopy(), osg::ColorMaskChunkBase::shallowCopy(), osg::ColorDisplayFilterBase::shallowCopy(), osg::ColorBufferViewportBase::shallowCopy(), osg::ClusterWindowBase::shallowCopy(), osg::ClipPlaneChunkBase::shallowCopy(), osg::ClipPlaneBase::shallowCopy(), osg::ChunkMaterialBase::shallowCopy(), osg::BlendChunkBase::shallowCopy(), and osg::BillboardBase::shallowCopy().

00141 {
00142     typedef typename ObjectPtrT::StoredObjectType ObjectType;
00143     
00144     UInt8 *pTmp;
00145     
00146     result._containerSize = sizeof(ObjectType);
00147     
00148     pTmp        = 
00149         static_cast<UInt8 *>(operator new(
00150             sizeof(Int32)      + // ReferenceCount
00151             sizeof(UInt32)     + // ContainerId
00152             sizeof(ObjectType) * ThreadManager::getNumAspects()));
00153     
00154     *(reinterpret_cast<Int32 *>(pTmp)) = 0;
00155     
00156     pTmp += sizeof(Int32);
00157     
00158     result._storeP = (pTmp + sizeof(UInt32));
00159 
00160 #ifdef OSG_DEBUG_FCPTR
00161     result._typedStoreP = reinterpret_cast<FieldContainer *>(result._storeP);
00162 #endif
00163 
00164     *(reinterpret_cast<UInt32 *>(pTmp)) = 
00165         FieldContainerFactory::the()->registerFieldContainer(result);
00166     
00167     Thread::getCurrentChangeList()->addCreated(
00168         *(reinterpret_cast<UInt32 *>(pTmp)));
00169     
00170     pTmp += sizeof(UInt32);
00171     
00172     ObjectType *aObject = reinterpret_cast<ObjectType *>(pTmp);
00173 
00174     for(UInt32 i = 0; i < ThreadManager::getNumAspects(); i++)
00175     {
00176         pTmp = 
00177             reinterpret_cast<UInt8 *>(new (pTmp) ObjectType(*prototypeP));
00178         
00179         pTmp += sizeof(ObjectType);
00180     }
00181     
00182     result->onCreate(prototypeP);
00183 
00184     for(UInt32 i = 0; i < ThreadManager::getNumAspects(); i++)
00185     {
00186         aObject[i].onCreateAspect(aObject, prototypeP);
00187     }
00188 
00189 #if defined(OSG_GV_BETA) && defined(OSG_DBG_MEM)
00190 
00191     fprintf(stderr, "GV_MEM_FC_DBG : (%u) cc (%p|%u)\n", 
00192             Thread::getAspect(),
00193             result._storeP,
00194 //            ObjectType::getClassType().getCName(),
00195             ObjectType::getClassType().getId());
00196 #endif
00197 
00198 #ifdef OSG_DEBUG_TYPED_FCPTR
00199     result.updateTypedStore();
00200 #endif
00201 }

template<class ObjectPtrT>
void osg::FieldContainer::newPtr ( ObjectPtrT &  result  )  [inline, static, protected, inherited]

Definition at line 204 of file OSGFieldContainerImpl.inl.

References osg::ChangeList::addCreated(), osg::PThreadBase::getAspect(), osg::PThreadBase::getCurrentChangeList(), osg::ThreadManager::getNumAspects(), osg::FieldContainerFactory::registerFieldContainer(), and osg::FieldContainerFactory::the().

00205 {
00206     typedef typename ObjectPtrT::StoredObjectType ObjectType;
00207     
00208     UInt8 *pTmp;
00209     
00210     result._containerSize = sizeof(ObjectType);
00211     
00212     pTmp        =             
00213         static_cast<UInt8 *>(operator new(
00214             sizeof(Int32)      + // ReferenceCount
00215             sizeof(UInt32)     + // ContainerId
00216             sizeof(ObjectType) * ThreadManager::getNumAspects()));
00217     
00218     *(reinterpret_cast<Int32 *>(pTmp)) = 0;
00219     
00220     pTmp  += sizeof(Int32);
00221     
00222     result._storeP = (pTmp + sizeof(UInt32));
00223     
00224 #ifdef OSG_DEBUG_FCPTR
00225     result._typedStoreP = reinterpret_cast<FieldContainer *>(result._storeP);
00226 #endif
00227 
00228     *(reinterpret_cast<UInt32 *>(pTmp)) = 
00229         FieldContainerFactory::the()->registerFieldContainer(result);
00230     
00231     Thread::getCurrentChangeList()->addCreated(
00232         *(reinterpret_cast<UInt32 *>(pTmp)));
00233     
00234     pTmp += sizeof(UInt32);
00235     
00236     ObjectType *aObject = reinterpret_cast<ObjectType *>(pTmp);
00237 
00238     for(UInt32 i = 0; i < ThreadManager::getNumAspects(); i++)
00239     {
00240         pTmp = reinterpret_cast<UInt8 *>(new (pTmp) ObjectType());
00241         
00242         pTmp += sizeof(ObjectType);
00243     }
00244     
00245     result->onCreate();
00246     
00247     for(UInt32 i = 0; i < ThreadManager::getNumAspects(); i++)
00248     {
00249         aObject[i].onCreateAspect(aObject);
00250     }
00251 
00252 #if defined(OSG_GV_BETA) && defined(OSG_DBG_MEM)
00253     fprintf(stderr, "GV_MEM_FC_DBG : (%u) c (%p|%u)\n", 
00254             Thread::getAspect(),
00255             result._storeP,
00256 //            ObjectType::getClassType().getCName(),
00257             ObjectType::getClassType().getId());
00258 #endif
00259     
00260 #ifdef OSG_DEBUG_TYPED_FCPTR
00261     result.updateTypedStore();
00262 #endif
00263 }

template<class FieldTypeT>
void osg::FieldContainer::beginEditX ( const BitVector whichField,
FieldTypeT &  field 
) [inline, protected, inherited]

Definition at line 285 of file OSGFieldContainerImpl.inl.

00286 {
00287 //    fieldR.beginEdit();
00288 }

template<class FieldTypeT>
void osg::FieldContainer::endEditX ( const BitVector whichField,
FieldTypeT &  field 
) [inline, protected, inherited]

Definition at line 291 of file OSGFieldContainerImpl.inl.

References osg::endEditCP().

00292 {
00293     FieldContainerPtr tmpPtr(this);
00294     endEditCP(tmpPtr, whichField);
00295 }

void osg::FieldContainer::onCreate ( const FieldContainer source = NULL  )  [inline, protected, inherited]

Definition at line 318 of file OSGFieldContainerImpl.inl.

Referenced by osg::ShaderParameterChunk::onCreate().

00319 {
00320 }

void osg::FieldContainer::onCreateAspect ( const FieldContainer aspect0,
const FieldContainer source = NULL 
) [inline, protected, inherited]

Definition at line 323 of file OSGFieldContainerImpl.inl.

00325 {
00326 }

void FieldContainer::onDestroy ( void   )  [protected, virtual, inherited]


Friends And Related Function Documentation

friend class FieldContainer [friend]

Reimplemented from osg::DVRClipGeometryBase.

Definition at line 250 of file OSGDVRClipGeometry.h.

friend class DVRClipGeometryBase [friend]

Definition at line 251 of file OSGDVRClipGeometry.h.


Member Data Documentation

Definition at line 129 of file OSGDVRClipGeometry.h.

Referenced by buildTriangledGeometry(), initialize(), and insertVertex().

std::vector<DVRVertex> osg::DVRClipGeometry::_mfVertices [protected]

The transformation matrix needed to transform the clip geoemtry to the volume's space.

Definition at line 139 of file OSGDVRClipGeometry.h.

Referenced by initialize().

Definition at line 144 of file OSGDVRClipGeometry.h.

Referenced by addActiveTriangle(), and DVRClipGeometry().

Definition at line 149 of file OSGDVRClipGeometry.h.

Referenced by computeSeedVertices(), and DVRClipGeometry().

the start triangles of all contours made up by intersections with the current slice

Definition at line 153 of file OSGDVRClipGeometry.h.

Referenced by buildContours(), and getContours().

Initial value:

 
    (Inherited::MTInfluenceMask) | 
    (static_cast<BitVector>(0x0) << Inherited::NextFieldId)

Reimplemented from osg::FieldContainer.

Definition at line 104 of file OSGDVRClipGeometryBase.h.

NodePtr DVRClipGeometryBase::_sfBeacon [protected, inherited]

const BitVector osg::FieldContainer::NextFieldMask [static, inherited]

Initial value:

 
                    (TypeTraits<BitVector>::One << NextFieldId)

Definition at line 75 of file OSGFieldContainerImpl.h.

const bool osg::FieldContainer::isNodeCore = false [static, inherited]

Reimplemented in osg::NodeCore.

Definition at line 181 of file OSGFieldContainerImpl.h.

UInt32 osg::FieldContainer::_shares [protected, inherited]

Definition at line 199 of file OSGFieldContainerImpl.h.


The documentation for this class was generated from the following files:

Generated on Mon Mar 17 12:07:41 2008 for OpenSG by  doxygen 1.5.5