00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef _OSGDVRCLIPGEOMETRY_H_
00040 #define _OSGDVRCLIPGEOMETRY_H_
00041 #ifdef __sgi
00042 #pragma once
00043 #endif
00044
00045 #include <OSGConfig.h>
00046 #include <OSGGeometry.h>
00047 #include <OSGPlane.h>
00048
00049 #include <OSGDVRClipGeometryBase.h>
00050 #include <OSGDVRVertex.h>
00051 #include <OSGDVRTriangle.h>
00052
00053 OSG_BEGIN_NAMESPACE
00054
00058 class OSG_SYSTEMLIB_DLLMAPPING DVRClipGeometry : public DVRClipGeometryBase
00059 {
00060 private:
00061
00062 typedef DVRClipGeometryBase Inherited;
00063
00064
00065
00066 public:
00067
00068
00072 virtual void changed(BitVector whichField,
00073 UInt32 origin );
00074
00076
00080 virtual void dump( UInt32 uiIndent = 0,
00081 const BitVector bvFlags = 0) const;
00082
00084
00088
00089
00090 void initialize (const Matrix &volumeToWorld );
00091
00093 void resetLocalData ( void );
00094
00096 void setReferencePlane (const Plane &referencePlane );
00097
00099
00105 bool setNumAddPerVertexAttr( UInt32 additionalPerVertexAttributes);
00106
00108 void computeSeedVertices ( void );
00109
00111 const DVRTriangleList &getContours( float dist2RefPlane,
00112 bool positiveWinding,
00113 const Vec3f &sliceNormal);
00114
00116
00117
00118 protected:
00119
00121
00125
00126 bool initialized;
00127
00129 GeometryPtr geometry;
00130
00132 std::vector<DVRVertex> _mfVertices;
00133
00135 std::vector<DVRTriangle> _mfTriangles;
00136
00139 Matrix toVolumeSpace;
00140
00142 DVRTriangle **activeTriangles;
00143 UInt32 activeTrianglesCount;
00144 UInt32 maxActiveTrianglesCount;
00145
00147 DVRVertex **seedVertices;
00148 UInt32 seedVerticesCount;
00149 UInt32 maxSeedVerticesCount;
00150
00153 DVRTriangleList contours;
00154
00155
00159 DVRClipGeometry(void);
00160 DVRClipGeometry(const DVRClipGeometry &source);
00161
00163
00167 virtual ~DVRClipGeometry(void);
00168
00170
00174
00175
00180 Int32 insertVertex (Int32 idx );
00181
00184 bool isLocalMinimum(DVRVertex &vertex);
00185
00187
00191
00192
00193 bool isCut ( DVRTriangle *tri,
00194 Real32 dist2RefPlane,
00195 DVRVertex *switchedVertices[3]);
00196
00199 bool isBehindPlane ( DVRTriangle &tri,
00200 Real32 dist2RefPlane );
00201
00203 void renderTriangle(const DVRTriangle &tri ) const;
00204
00206
00210
00211 bool buildTriangledGeometry(void);
00212
00214
00218
00219 void buildContours ( Real32 dist2RefPlane,
00220 bool positiveWinding,
00221 const Vec3f &sliceNormal );
00222
00224 void linkContour ( DVRTriangle *startTriangle,
00225 Real32 dist2RefPlane,
00226 const Vec3f &viewDir,
00227 bool positiveWinding);
00228
00230 void updateActiveTriangles( Real32 dist2RefPlane,
00231 const Vec3f &sliceNormal );
00232
00234 void addActiveTriangle ( DVRTriangle *tri );
00235
00237 void addNewActiveTriangles( DVRVertex *vertex,
00238 Real32 dist2RefPlane );
00239
00241 Pnt3f interpolate ( DVRTriangle *tri,
00242 Int32 v1,
00243 Int32 v2,
00244 Real32 dist2RefPlane );
00245
00246
00247
00248 private:
00249
00250 friend class FieldContainer;
00251 friend class DVRClipGeometryBase;
00252
00253 static void initMethod(void);
00254
00255
00256 void operator =(const DVRClipGeometry &source);
00257 };
00258
00259 typedef DVRClipGeometry *DVRClipGeometryP;
00260
00261 OSG_END_NAMESPACE
00262
00263 #include <OSGDVRClipGeometryBase.inl>
00264 #include <OSGDVRClipGeometry.inl>
00265
00266 #define OSGDVRCLIPGEOMETRY_HEADER_CVSID "@(#)$Id: $"
00267
00268 #endif