00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #pragma once
00018
00019 #include "object.h"
00020 #include "GraphicsConstants.h"
00021
00022
00023
00024 #define SHAPEOBJPBLOCK 0 // ShapeObject's parameter block
00025
00026 #pragma warning(push)
00027 #pragma warning(disable:4239 4100)
00028
00069 class SimpleShape: public ShapeObject
00070 {
00071 public:
00072 IParamBlock* pblock;
00073
00074 static IObjParam* ip;
00075 static HWND hGenParams;
00076 static BOOL dlgRenderable;
00077 static float dlgThickness;
00078 static int dlgSides;
00079 static float dlgAngle;
00080 static BOOL dlgGenUVs;
00081 static ISpinnerControl *thickSpin;
00082
00083
00084 PolyShape shape;
00085 Interval ivalid;
00086
00087
00088 BOOL suspendSnap;
00089
00090 CoreExport void UpdateShape(TimeValue t);
00091
00092 static SimpleShape* editOb;
00093
00095 CoreExport SimpleShape();
00098 CoreExport ~SimpleShape();
00099
00100 void ShapeInvalid() { ivalid.SetEmpty(); }
00101
00102
00103
00104
00105 CoreExport int HitTest(TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt);
00106 CoreExport void Snap(TimeValue t, INode* inode, SnapInfo *snap, IPoint2 *p, ViewExp *vpt);
00107 CoreExport int Display(TimeValue t, INode* inode, ViewExp *vpt, int flags);
00108 CoreExport virtual void BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev);
00109 CoreExport virtual void EndEditParams( IObjParam *ip, ULONG flags,Animatable *next);
00110
00111 IParamArray* GetParamBlock() {return (IParamArray*)pblock;}
00112 CoreExport int GetParamBlockIndex(int id);
00113
00114
00115 CoreExport ObjectState Eval(TimeValue time);
00116 CoreExport Interval ObjectValidity(TimeValue t);
00117 CoreExport int CanConvertToType(Class_ID obtype);
00118 CoreExport Object* ConvertToType(TimeValue t, Class_ID obtype);
00119 CoreExport void BuildMesh(TimeValue t, Mesh &mesh);
00120
00121
00122 CoreExport ObjectHandle CreateTriObjRep(TimeValue t);
00123 CoreExport void GetWorldBoundBox(TimeValue t, INode* inode, ViewExp* vpt, Box3& box );
00124 CoreExport void GetLocalBoundBox(TimeValue t, INode* inode, ViewExp* vxt, Box3& box );
00125 CoreExport void GetDeformBBox(TimeValue t, Box3& box, Matrix3 *tm, BOOL useSel );
00126 CoreExport int NumberOfVertices(TimeValue t, int curve);
00127 CoreExport int NumberOfCurves();
00128 CoreExport BOOL CurveClosed(TimeValue t, int curve);
00129 CoreExport ShapeHierarchy &OrganizeCurves(TimeValue t, ShapeHierarchy *hier=NULL);
00130 CoreExport void MakePolyShape(TimeValue t, PolyShape &shape, int steps = PSHAPE_BUILTIN_STEPS, BOOL optimize = FALSE);
00131 CoreExport int MakeCap(TimeValue t, MeshCapInfo &capInfo, int capType);
00132 CoreExport int MakeCap(TimeValue t, PatchCapInfo &capInfo);
00133
00134 int NumRefs() { return 1 + ShapeObject::NumRefs(); }
00135 CoreExport RefTargetHandle GetReference(int i);
00136 protected:
00137 CoreExport virtual void SetReference(int i, RefTargetHandle rtarg);
00138 public:
00139 CoreExport RefResult NotifyRefChanged(Interval changeInt,RefTargetHandle hTarget,
00140 PartID& partID, RefMessage message);
00141
00150 CoreExport void ReadyGeneralParameters();
00162 CoreExport void SimpleShapeClone( SimpleShape *sshpSource );
00163
00164 int NumSubs() { return 1 + ShapeObject::NumSubs(); }
00165 CoreExport Animatable* SubAnim(int i);
00166 CoreExport MSTR SubAnimName(int i);
00167
00168
00169 CoreExport void DeleteThis();
00170 CoreExport void FreeCaches();
00171
00172
00173 CoreExport IOResult Save(ISave *isave);
00174 CoreExport IOResult Load(ILoad *iload);
00175
00176 CoreExport void SetGenUVs(BOOL sw);
00177 CoreExport void SetRenderable(BOOL sw);
00178 LRESULT CALLBACK TrackViewWinProc( HWND hwnd, UINT message,
00179 WPARAM wParam, LPARAM lParam ){return(0);}
00180
00181 void GetClassName(MSTR& s) {s = GetObjectName();}
00182 void InitNodeName(MSTR& s) {s = GetObjectName();}
00183
00184
00185
00186 virtual Class_ID ClassID() = 0;
00194 virtual void BuildShape(TimeValue t,PolyShape& ashape) = 0;
00195
00196 virtual RefTargetHandle Clone(RemapDir& remap) = 0;
00197
00198 virtual CreateMouseCallBack* GetCreateMouseCallBack() = 0;
00208 virtual BOOL ValidForDisplay(TimeValue t) = 0;
00234 virtual void InvalidateUI() {}
00244 virtual ParamDimension *GetParameterDim(int pbIndex) {return defaultDim;}
00252 virtual MSTR GetParameterName(int pbIndex) {return MSTR(_M("Parameter"));}
00253
00254
00255
00270 virtual Point3 InterpCurve3D(TimeValue t, int curve, float param, int ptype=PARAM_SIMPLE) = 0;
00285 virtual Point3 TangentCurve3D(TimeValue t, int curve, float param, int ptype=PARAM_SIMPLE) = 0;
00292 virtual float LengthOfCurve(TimeValue t, int curve) = 0;
00293
00294
00295
00296
00305 virtual int NumberOfPieces(TimeValue t, int curve) { return 1; }
00325 virtual Point3 InterpPiece3D(TimeValue t, int curve, int piece, float param, int ptype=PARAM_SIMPLE) { return InterpCurve3D(t, curve, param, ptype); }
00345 virtual Point3 TangentPiece3D(TimeValue t, int curve, int piece, float param, int ptype=PARAM_SIMPLE) { return TangentCurve3D(t, curve, param, ptype); }
00357 CoreExport virtual MtlID GetMatID(TimeValue t, int curve, int piece);
00358 };
00359
00360 #pragma warning(pop)