00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __GU_IsoMeta__
00024 #define __GU_IsoMeta__
00025 #include "GU_API.h"
00026 #endif
00027
00028 #include "GU_Iso.h"
00029 #include <UT/UT_BoundingBox.h>
00030 #include <UT/UT_IntArray.h>
00031 #include <GEO/GEO_AttributeHandle.h>
00032 #include <GEO/GEO_AttributeHandleList.h>
00033
00034 class GB_PrimitiveGroup;
00035 class GEO_Primitive;
00036 class GEO_MetaPrim;
00037 class TS_MetaExpression;
00038
00039 class gu_MetaCorner;
00040
00041 class GU_API GU_IsoMeta : public GU_IsoSurface {
00042 public:
00043 GU_IsoMeta(GU_Detail *dest, GU_Detail *src,
00044 GB_PrimitiveGroup *grp = 0);
00045 GU_IsoMeta(GU_Detail *dest, GU_Detail *src,
00046 GEO_MetaExpression *expr);
00047 virtual ~GU_IsoMeta();
00048
00049 void initData();
00050 const UT_BoundingBox getBounds() const { return myBox; }
00051
00052
00053
00054
00055 virtual float evalCorner(const ISO_Corner &corner);
00056 virtual float evalEdge(const UT_Vector3 &pt);
00057 virtual float evalFace(const UT_Vector3 &pt);
00058
00059 private:
00060 void clearAndDestroy(int fulldestroy = 1);
00061
00062 virtual void resetPass(const UT_BoundingBox &box);
00063 virtual void prepEvalFunc(ISO_Corner *c0, ISO_Corner *c1, int dir);
00064 virtual void prepFaceFunc(ISO_Corner *c0[8]);
00065 virtual void prepInsideOut(int xdivs, int ydivs, float z,
00066 ISO_Corner *array);
00067 virtual void cleanCorners(int xdivs, int ydivs, ISO_Corner *array);
00068 virtual void fillPointVertexAttributes(GEO_Vertex &vtx);
00069 virtual void fillPrimitiveAttributes(GU_PrimPoly *poly);
00070 unsigned bumpSerial() { mySerial++; return mySerial; }
00071
00072
00073
00074
00075
00076 void pruneRecursive(float zmin, float zmax, int xrow1, int xrow2,
00077 int yrow1, int yrow2, TS_MetaExpression *expr,
00078 ISO_Corner *array, int xdivs, int ydivs,
00079 int max_corners = 30);
00080 private:
00081 void construct(GU_Detail *dest, GU_Detail *src,
00082 GB_PrimitiveGroup *grp,
00083 GEO_MetaExpression *geoexpr);
00084
00085
00086 gu_MetaCorner *allocCorner();
00087 void freeCorner(gu_MetaCorner *node);
00088
00089 UT_BoundingBox myBox;
00090 unsigned mySerial;
00091
00092 GEO_AttributeHandleList myVertexHandles;
00093 GEO_AttributeHandleList myPrimitiveHandles;
00094 GEO_AttributeHandle myN;
00095 TS_MetaExpression *myExpr;
00096 TS_MetaExpression *myActiveExpr;
00097 TS_MetaExpression *myPrunedExpr;
00098 ISO_Corner *myActiveCorner[8];
00099
00100
00101
00102 gu_MetaCorner *myCornerHead;
00103 gu_MetaCorner *myCornerTail;
00104 };