linshape.h

Go to the documentation of this file.
00001 //**************************************************************************/
00002 // Copyright (c) 1998-2006 Autodesk, Inc.
00003 // All rights reserved.
00004 // 
00005 // These coded instructions, statements, and computer programs contain
00006 // unpublished proprietary information written by Autodesk, Inc., and are
00007 // protected by Federal copyright law. They may not be disclosed to third
00008 // parties or copied or duplicated in any form, in whole or in part, without
00009 // the prior written consent of Autodesk, Inc.
00010 //**************************************************************************/
00011 // FILE:        linshape.h
00012 // DESCRIPTION: Defines a Linear Shape Object Class
00013 // AUTHOR:      Tom Hudson
00014 // HISTORY:     created 31 October 1995
00015 //**************************************************************************/
00016 
00017 #pragma once
00018 
00019 #include "object.h"
00020 
00021 extern CoreExport Class_ID  linearShapeClassID; 
00022 
00023 #pragma warning(push)
00024 #pragma warning(disable:4239)
00025 
00036 class LinearShape : public ShapeObject {               
00037     private:
00038         Interval geomValid;
00039         Interval topoValid;
00040         Interval selectValid;
00041         ChannelMask validBits; // for the remaining constant channels
00042         void CopyValidity(LinearShape *fromOb, ChannelMask channels);
00043 
00044     protected:
00045         //  inherited virtual methods for Reference-management
00046         RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message );
00047 
00048     public:
00049         PolyShape       shape;
00050 
00052         CoreExport LinearShape();
00054         CoreExport ~LinearShape();
00055 
00056         CoreExport LinearShape &operator=(LinearShape &from);
00057         
00058         //  inherited virtual methods:
00059 
00060         // From BaseObject
00061         CoreExport int HitTest(TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt);
00062         CoreExport void Snap(TimeValue t, INode* inode, SnapInfo *snap, IPoint2 *p, ViewExp *vpt);
00063         CoreExport int Display(TimeValue t, INode* inode, ViewExp *vpt, int flags);
00064         CoreExport CreateMouseCallBack* GetCreateMouseCallBack();
00065         CoreExport RefTargetHandle Clone(RemapDir& remap);
00066         // From Object           
00067         CoreExport ObjectState Eval(TimeValue time);
00068         CoreExport Interval ObjectValidity(TimeValue t);
00069 
00070         // The validity interval of channels necessary to do a convert to type
00071         CoreExport Interval ConvertValidity(TimeValue t);
00072 
00073         // get and set the validity interval for the nth channel
00074         CoreExport Interval ChannelValidity(TimeValue t, int nchan);
00075         CoreExport void SetChannelValidity(int i, Interval v);
00076         CoreExport void InvalidateChannels(ChannelMask channels);
00077 
00078         // Deformable object procs  
00079         int IsDeformable() { return 1; }  
00080         CoreExport int NumPoints();
00081         CoreExport Point3 GetPoint(int i);
00082         CoreExport void SetPoint(int i, const Point3& p);
00083         CoreExport BOOL IsPointSelected (int i);
00084         
00085         CoreExport void PointsWereChanged();
00086         CoreExport void GetDeformBBox(TimeValue t, Box3& box, Matrix3 *tm=NULL,BOOL useSel=FALSE );
00087         CoreExport void Deform(Deformer *defProc, int useSel);
00088 
00089         CoreExport int CanConvertToType(Class_ID obtype);
00090         CoreExport Object* ConvertToType(TimeValue t, Class_ID obtype);
00091         CoreExport void FreeChannels(ChannelMask chan);
00092         CoreExport Object *MakeShallowCopy(ChannelMask channels);
00093         CoreExport void ShallowCopy(Object* fromOb, ChannelMask channels);
00094         CoreExport void NewAndCopyChannels(ChannelMask channels);
00095 
00096         CoreExport DWORD GetSubselState();
00097 
00098         // From ShapeObject
00099         CoreExport ObjectHandle CreateTriObjRep(TimeValue t);  // for rendering, also for deformation       
00100         CoreExport void GetWorldBoundBox(TimeValue t, INode *inode, ViewExp* vpt, Box3& box );
00101         CoreExport void GetLocalBoundBox(TimeValue t, INode *inode, ViewExp* vpt, Box3& box );
00102         CoreExport int NumberOfVertices(TimeValue t, int curve);
00103         CoreExport int NumberOfCurves();
00104         CoreExport BOOL CurveClosed(TimeValue t, int curve);
00105         CoreExport Point3 InterpCurve3D(TimeValue t, int curve, float param, int ptype=PARAM_SIMPLE);
00106         CoreExport Point3 TangentCurve3D(TimeValue t, int curve, float param, int ptype=PARAM_SIMPLE);
00107         CoreExport float LengthOfCurve(TimeValue t, int curve);
00108         CoreExport int NumberOfPieces(TimeValue t, int curve);
00109         CoreExport Point3 InterpPiece3D(TimeValue t, int curve, int piece, float param, int ptype=PARAM_SIMPLE);
00110         CoreExport Point3 TangentPiece3D(TimeValue t, int curve, int piece, float param, int ptype=PARAM_SIMPLE);
00126         CoreExport MtlID GetMatID(TimeValue t, int curve, int piece);
00127         BOOL CanMakeBezier() { return TRUE; }
00128         CoreExport void MakeBezier(TimeValue t, BezierShape &shape);
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 
00135         PolyShape& GetShape() { return shape; }
00136 
00137         // This does the job of setting all points in the PolyShape to "POLYPT_KNOT"
00138         // types, and removing the "POLYPT_INTERPOLATED" flag.  This is because the
00139         // LinearShape knows nothing about its origin
00144         CoreExport void SetPointFlags();
00145 
00146         // Animatable methods
00147 
00148         CoreExport void DeleteThis();
00149         void FreeCaches() { shape.InvalidateGeomCache(FALSE); }
00150         Class_ID ClassID() { return linearShapeClassID; }
00151         CoreExport void GetClassName(MSTR& s);
00152         void NotifyMe(Animatable* subAnim, int message) { UNUSED_PARAM(subAnim); UNUSED_PARAM(message);}
00153         int IsKeyable() { return 0;}
00154         int Update(TimeValue t) { UNUSED_PARAM(t); return 0; }
00155         BOOL BypassTreeView() { return TRUE; }
00156         // This is the name that will appear in the history browser.
00157         CoreExport MCHAR *GetObjectName();
00158 
00159         // IO
00160         CoreExport IOResult Save(ISave *isave);
00161         CoreExport IOResult Load(ILoad *iload);
00162 
00163         // RefMaker methods
00164         CoreExport void RescaleWorldUnits(float f);
00165 
00166         // Flush all caches
00167         CoreExport void InvalidateGeomCache();
00168     };              
00169 
00170 #pragma warning(pop)
00171 
00172 CoreExport ClassDesc* GetLinearShapeDescriptor();
00173