/********************************************************************** *< FILE: polyobj.h DESCRIPTION: Defines Polygon Mesh Object CREATED BY: Steve Anderson HISTORY: created June 1998 *> Copyright (c) 1998, All Rights Reserved. **********************************************************************/ #ifndef __POLYOBJ__ #define __POLYOBJ__ #include "meshlib.h" #include "mnmath.h" #include "snap.h" #ifdef POLY_LIB_EXPORTING #define PolyLibExport __declspec( dllexport ) #else #define PolyLibExport __declspec( dllimport ) #endif #define POLY_MULTI_PROCESSING TRUE extern PolyLibExport Class_ID polyObjectClassID; class PolyObject: public GeomObject { private: // Displacement approximation stuff: TessApprox mDispApprox; bool mSubDivideDisplacement; bool mDisableDisplacement; bool mSplitMesh; protected: Interval geomValid; Interval topoValid; Interval texmapValid; Interval selectValid; Interval vcolorValid; DWORD validBits; // for the remaining constant channels PolyLibExport void CopyValidity(PolyObject *fromOb, ChannelMask channels); // inherited virtual methods for Reference-management PolyLibExport RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message ); public: MNMesh mm; PolyLibExport PolyObject(); PolyLibExport ~PolyObject(); // inherited virtual methods: // From BaseObject PolyLibExport int HitTest(TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt); PolyLibExport int Display(TimeValue t, INode* inode, ViewExp *vpt, int flags); PolyLibExport void Snap(TimeValue t, INode* inode, SnapInfo *snap, IPoint2 *p, ViewExp *vpt); PolyLibExport CreateMouseCallBack* GetCreateMouseCallBack() { return NULL; } PolyLibExport RefTargetHandle Clone(RemapDir& remap = NoRemap()); // From Object PolyLibExport ObjectState Eval(TimeValue time); PolyLibExport Interval ObjectValidity(TimeValue t); PolyLibExport BOOL HasUVW(); PolyLibExport BOOL HasUVW(int mapChannel); PolyLibExport Object *CollapseObject(); // get and set the validity interval for the nth channel PolyLibExport Interval ChannelValidity (TimeValue t, int nchan); PolyLibExport Interval PartValidity (DWORD partIDs); PolyLibExport void SetChannelValidity (int i, Interval v); PolyLibExport void SetPartValidity (DWORD partIDs, Interval v); PolyLibExport void InvalidateChannels (ChannelMask channels); // Convert-to-type validity PolyLibExport Interval ConvertValidity(TimeValue t); // Deformable object procs int IsDeformable() { return 1; } PolyLibExport int NumPoints(); PolyLibExport Point3 GetPoint(int i); PolyLibExport void SetPoint(int i, const Point3& p); PolyLibExport void PointsWereChanged(); PolyLibExport void Deform (Deformer *defProc, int useSel=0); // The following members have been added // in 3ds max 4.2. If your plugin utilizes this new // mechanism, be sure that your clients are aware that they // must run your plugin with 3ds max version 4.2 or higher. BOOL IsPointSelected (int i) { if ((i<0) || (i>=mm.numv)) return false; return mm.v[i].FlagMatch (MN_DEAD|MN_SEL, MN_SEL); } float PointSelection (int i) { if ((i<0) || (i>=mm.numv)) return 0.0f; if (mm.v[i].GetFlag (MN_DEAD)) return 0.0f; if (mm.v[i].GetFlag (MN_SEL)) return 1.0f; float *vssel = mm.getVSelectionWeights(); if (vssel) return vssel[i]; else return 0.0f; } BOOL PolygonCount(TimeValue t, int& numFaces, int& numVerts) { numFaces = 0; numVerts = 0; for (int i=0; i