object.h

Go to the documentation of this file.
00001 //
00002 // Copyright 2010 Autodesk, Inc.  All rights reserved.
00003 //
00004 // Use of this software is subject to the terms of the Autodesk license
00005 // agreement provided at the time of installation or download, or which
00006 // otherwise accompanies this software in either electronic or hard copy form.  
00007 //
00008 //
00009 
00010 #pragma once
00011 
00012 #include "maxheap.h"
00013 #include "inode.h"
00014 #include "maxapi.h"
00015 #include "plugapi.h"
00016 #include "snap.h"
00017 #include "genshape.h"
00018 #include "hitdata.h"
00019 #include "imtl.h"
00020 #include "channels.h"
00021 #include "LightTypeEnums.h"
00022 #include "mesh.h"
00023 #include "GraphicsTypes.h"
00024 #include "GraphicsWindow.h"
00025 #include "INodeTab.h"
00026 #include "UVWMapTypes.h"
00027 #include "AnimPropertyID.h"
00028 
00029 #include "Graphics/IObjectDisplay.h"
00030 #include "Graphics/RenderItemHandle.h"
00031 
00032 // forward declarations
00033 class SubObjAxisCallback;
00034 
00035 
00036 typedef short MtlIndex; 
00037 typedef short TextMapIndex;
00038 
00039 
00040 CoreExport void setHitType(int t);
00041 CoreExport int  getHitType(void);
00042 CoreExport BOOL doingXORDraw(void);
00043 
00045 
00046 
00047 #define HITTYPE_POINT   1
00048 
00050 #define HITTYPE_BOX     2
00051 
00053 #define HITTYPE_CIRCLE  3
00054 
00062 #define HITTYPE_SOLID   4
00063 
00065 #define HITTYPE_FENCE   5
00066 
00067 #define HITTYPE_LASSO   6
00068 
00069 #define HITTYPE_PAINT   7
00070 
00071 
00072 
00078 #define HIT_SELONLY             (1<<0)
00079 
00080 #define HIT_UNSELONLY           (1<<2)
00081 
00082 #define HIT_ABORTONHIT          (1<<3)
00083 
00086 #define HIT_SELSOLID            (1<<4)
00087 
00090 #define HIT_ANYSOLID            (1<<5)
00091 
00092 #define HIT_TRANSFORMGIZMO      (1<<6)
00093 
00100 #define HIT_SWITCH_GIZMO        (1<<7)
00101 
00102 #define HIT_MANIP_SUBHIT        (1<<8)
00103 
00104 
00106 #define HITFLTR_ALL             (1<<10)
00107 
00108 #define HITFLTR_OBJECTS         (1<<11)
00109 
00110 #define HITFLTR_CAMERAS         (1<<12)
00111 
00112 #define HITFLTR_LIGHTS          (1<<13)
00113 
00114 #define HITFLTR_HELPERS         (1<<14)
00115 
00116 #define HITFLTR_WSMOBJECTS      (1<<15)
00117 
00118 #define HITFLTR_SPLINES         (1<<16)
00119 
00120 #define HITFLTR_BONES           (1<<17)
00121 
00122 #define HIT_SCENEXREFS          (1<<18)
00123 
00124 #define HIT_MANAGER_HIDDEN_SCENEXREFS   (1<<19)
00125 
00126 #define HITFLAG_STARTUSERBIT    24     
00127 
00128 
00129 class Modifier;
00130 class Object;
00131 class NameTab; 
00132 class ExclList; 
00133 class Texmap;
00134 class ISubObjType;
00135 class MaxIcon;
00136 
00137 typedef Object* ObjectHandle;
00138 typedef Tab<TextMapIndex> TextMapIndexTab;
00139 typedef TextMapIndexTab TextTab;
00140 
00141 #define BASEOBJAPPDATACID Class_ID(0x48a057d2, 0x44f70d8a)
00142 #define BASEOBJAPPDATALASTSELCID Class_ID(0x1cef158c, 0x1da8486f)
00143 #define BASEOBJAPPDATACURSELCID Class_ID(0x5b3b25fc, 0x35af6260)
00144 #define BASEOBJAPPDATASCID USERDATATYPE_CLASS_ID
00145 
00146 
00151 class IdentityTM: public Matrix3 {
00152 public:
00158     IdentityTM() { IdentityMatrix(); }              
00159 };
00160 
00161 CoreExport extern IdentityTM idTM;
00162 
00163 
00164 //-------------------------------------------------------------
00165 // This is passed in to GetRenderMesh to allow objects to do
00166 // view dependent rendering.
00167 //
00168 
00169 
00172 
00173 
00177 #define RENDER_MESH_DISPLACEMENT_MAP  1
00178 
00179 
00203 #pragma warning(push)
00204 #pragma warning(disable:4100 4239)
00205 
00206 class View : public InterfaceServer{
00207 public: 
00209     float screenW; 
00210 
00212     float screenH;  
00213 
00215     Matrix3 worldToView;
00216 
00221     virtual Point2 ViewToScreen(Point3 p)=0;
00222 
00224     int projType;
00225 
00227     float fov;
00228 
00230     float pixelSize;
00231 
00233     Matrix3 affineTM;
00234 
00236     DWORD flags;
00237 
00247     virtual BOOL CheckForRenderAbort() { return FALSE; }
00248 
00250     virtual INT_PTR Execute(int cmd, ULONG_PTR arg1=0, ULONG_PTR arg2=0, ULONG_PTR arg3=0) { return 0; } 
00251 
00252     View() { projType = -1; flags = RENDER_MESH_DISPLACEMENT_MAP; } // projType not set, this is to deal with older renderers.
00253 };
00254 
00256 extern CoreExport Class_ID defObjectClassID;
00257 
00259 extern CoreExport Class_ID mapObjectClassID;
00260 
00262 CoreExport extern ChannelMask chMask[];
00263 
00264 class Object;
00265 
00266 
00273 class ObjectState: public MaxHeapOperators {
00274     ulong flags;
00275     Matrix3 *tm;
00276     Interval tmvi;   
00277     int mtl;
00278     Interval mtlvi;                         
00279     void AllocTM();
00280 public: 
00284     Object *obj;  
00285 
00287     CoreExport ObjectState();
00288 
00293     CoreExport ObjectState(Object *ob);
00294 
00297     CoreExport ObjectState(const ObjectState& os); 
00298 
00300     CoreExport ~ObjectState();
00301 
00304     void OSSetFlag(ulong f) { flags |= f; }
00305 
00308     void OSClearFlag(ulong f) { flags &= ~f; }
00309 
00313     ulong OSTestFlag(ulong f) const { return flags&f; }
00314 
00318     CoreExport void OSCopyFlag(ulong f, const ObjectState& fromos);
00319 
00323     CoreExport ObjectState& operator=(const ObjectState& os);
00324 
00327     Interval tmValid() const { return tmvi; }
00328 
00330     Interval mtlValid() const  { return mtlvi; }
00331 
00338     CoreExport Interval Validity(TimeValue t) const;
00339 
00342     CoreExport int TMIsIdentity() const;
00343 
00350     CoreExport void SetTM(Matrix3* mat, Interval iv);
00351 
00353     CoreExport Matrix3* GetTM() const;
00354 
00356     CoreExport void SetIdentityTM();
00357 
00363     CoreExport void ApplyTM(Matrix3* mat, Interval iv);
00364 
00368     CoreExport void CopyTM(const ObjectState &fromos);
00369 
00373     CoreExport void CopyMtl(const ObjectState &fromos);
00374 
00381     CoreExport void Invalidate(ChannelMask channels, BOOL checkLock=FALSE);
00382 
00388     CoreExport ChannelMask DeleteObj(BOOL checkLock=FALSE);
00389 };
00390 
00399 class LocalModData : public InterfaceServer {
00400 public:
00403     virtual ~LocalModData() {}
00404 
00409     virtual LocalModData *Clone()=0;
00410 
00411     using InterfaceServer::GetInterface;
00412     virtual void* GetInterface(ULONG id) { return NULL; }  // to access sub-obj selection interfaces, JBW 2/5/99
00413 }; 
00414 
00420 class ModContext : public BaseInterfaceServer {
00421 public:
00427     Matrix3                 *tm;
00428 
00436     Box3                    *box;
00437 
00441     LocalModData    *localData;
00442 
00444     CoreExport ~ModContext();
00445 
00448     CoreExport ModContext();
00449 
00453     CoreExport ModContext(const ModContext& mc);
00454 
00460     CoreExport ModContext(Matrix3 *tm, Box3 *box, LocalModData *localData);
00461 };
00462 
00468 class ModContextList : public Tab<ModContext*> {};
00469 
00470 
00471 class HitRecord;
00472 
00473 
00476 
00477 #define NEWSET_MERGE            1   //!< The sets should be merged.
00478 #define NEWSET_INTERSECTION     2   //!< The sets should be intersected -- that is the items common to both sets should appear in the new set.
00479 #define NEWSET_SUBTRACT         3   //!< The new set should be the result of subtracting the 1st thru nth set from the 0th set.
00480 
00481 
00483 
00484 
00486 #define USE_DAMAGE_RECT                 (1<<0)  
00487 
00490 #define DISP_SHOWSUBOBJECT              (1<<1)
00491 
00492 
00493 
00496 class IParamArray;
00497 
00515 class BaseObject : public ReferenceTarget {
00516 
00517     friend class ModifyTaskImp;
00518     int subObjLevel;
00519 
00520 private:
00521     MaxSDK::Graphics::IObjectDisplay* mpDisplayInterface;
00522 
00523 protected:
00524     MaxSDK::Graphics::RenderItemHandleArray mRenderItemHandles;
00525 
00526 public:
00527     CoreExport virtual bool RequiresSupportForLegacyDisplayMode() const;
00528     CoreExport virtual bool UpdateDisplay(
00529         unsigned long renderItemCategories, 
00530         const MaxSDK::Graphics::MaterialRequiredStreams& materialRequiredStreams, 
00531         TimeValue t);
00532     CoreExport virtual const MaxSDK::Graphics::RenderItemHandleArray& GetRenderItems() const;
00533 
00534     CoreExport virtual void* GetInterface(ULONG id);
00535     CoreExport virtual BaseInterface* GetInterface(Interface_ID id);
00536 
00537     CoreExport BaseObject();
00538     CoreExport virtual ~BaseObject();
00539 
00550     virtual int HitTest(TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt){return 0;};
00551     
00561     virtual void SetExtendedDisplay(int flags)      {}   
00562 
00573     virtual int Display(TimeValue t, INode* inode, ViewExp *vpt, int flags) { return 0; };   
00574 
00584     virtual void Snap(TimeValue t, INode* inode, SnapInfo *snap, IPoint2 *p, ViewExp *vpt) {}
00585 
00597     virtual void GetWorldBoundBox(TimeValue t, INode * inode, ViewExp* vp, Box3& box ){}; 
00598 
00606     virtual void GetLocalBoundBox(TimeValue t, INode* inode, ViewExp* vp,  Box3& box ){}; 
00607 
00615     virtual CreateMouseCallBack* GetCreateMouseCallBack()=0;
00616 
00618     virtual MCHAR *GetObjectName() { return _M("Object"); }
00619 
00628     CoreExport virtual BOOL OKToChangeTopology(MSTR &modName);
00629 
00630     // Return true if this object(or modifier) is cabable of changing 
00631     //topology when it's parameters are being edited.
00640     virtual BOOL ChangeTopology() {return TRUE;}
00641 
00643     virtual void ForceNotify(Interval& i)
00644     {
00645         NotifyDependents( i, (PartID)PART_ALL, REFMSG_CHANGE );
00646     }
00647 
00653     virtual IParamArray *GetParamBlock() {return NULL;}
00654 
00664     virtual int GetParamBlockIndex(int id) {return -1;}
00665     
00679     virtual void Move( TimeValue t, Matrix3& partm, Matrix3& tmAxis, Point3& val, BOOL localOrigin=FALSE ){}
00680 
00707     virtual void Rotate( TimeValue t, Matrix3& partm, Matrix3& tmAxis, Quat& val, BOOL localOrigin=FALSE ){}
00708 
00727     virtual void Scale( TimeValue t, Matrix3& partm, Matrix3& tmAxis, Point3& val, BOOL localOrigin=FALSE ){}
00728 
00732     virtual void TransformStart(TimeValue t) {}
00733 
00737     virtual void TransformHoldingStart(TimeValue t) {}
00738 
00743     virtual void TransformHoldingFinish(TimeValue t) {}             
00744 
00749     virtual void TransformFinish(TimeValue t) {}            
00750 
00754     virtual void TransformCancel(TimeValue t) {}            
00755 
00774     virtual int HitTest(TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt, ModContext* mc) { return 0; }
00789     virtual int Display(TimeValue t, INode* inode, ViewExp *vpt, int flags, ModContext* mc) { return 0; };   // quick render in viewport, using current TM.         
00790     
00798     virtual void GetWorldBoundBox(TimeValue t,INode* inode, ViewExp *vpt, Box3& box, ModContext *mc) {}
00799 
00810     virtual void CloneSelSubComponents(TimeValue t) {}
00811 
00815     virtual void AcceptCloneSelSubComponents(TimeValue t) {}
00816 
00829     virtual void SelectSubComponent(
00830         HitRecord *hitRec, BOOL selected, BOOL all, BOOL invert=FALSE) {}
00831 
00836     virtual void ClearSelection(int selLevel) {}
00837     
00842     virtual void SelectAll(int selLevel) {}
00843     
00849     virtual void InvertSelection(int selLevel) {}
00850 
00860     virtual int SubObjectIndex(HitRecord *hitRec) {return 0;}               
00861 
00894     virtual void ActivateSubobjSel(int level, XFormModes& modes ) {}
00895 
00904     virtual BOOL SupportsNamedSubSels() {return FALSE;}
00905 
00910     virtual void ActivateSubSelSet(MSTR &setName) {}
00911 
00916     virtual void NewSetFromCurSel(MSTR &setName) {}
00917 
00922     virtual void RemoveSubSelSet(MSTR &setName) {}
00923 
00930     virtual void SetupNamedSelDropDown() {}
00931 
00935     virtual int NumNamedSelSets() {return 0;}
00936 
00941     virtual MSTR GetNamedSelSetName(int i) {return _M("");}
00942 
00950     virtual void SetNamedSelSetName(int i,MSTR &newName) {}
00951 
00972     virtual void NewSetByOperator(MSTR &newName,Tab<int> &sets,int op) {}
00974 
00975 
00994     virtual void GetSubObjectCenters(SubObjAxisCallback *cb,TimeValue t,INode *node,ModContext *mc) {}
00995 
01007     virtual void GetSubObjectTMs(SubObjAxisCallback *cb,TimeValue t,INode *node,ModContext *mc) {}                          
01009 
01047     virtual BOOL HasUVW () { return 0; }
01054     virtual BOOL HasUVW (int mapChannel) { return (mapChannel==1) ? HasUVW() : FALSE; }
01059     virtual void SetGenUVW(BOOL sw) {  }
01060 
01068     virtual void SetGenUVW (int mapChannel, BOOL sw) { if (mapChannel==1) SetGenUVW (sw); }
01069 
01080     virtual void ShowEndResultChanged (BOOL showEndResult) { }
01081 
01083 
01084 
01091     virtual void NotifyPreCollapse(INode *node, IDerivedObject *derObj, int index){};
01092 
01101     virtual void NotifyPostCollapse(INode *node, Object *obj, IDerivedObject *derObj, int index){};
01102 
01114     virtual int NumSubObjTypes(){ return 0;}
01115 
01125     virtual ISubObjType *GetSubObjType(int i) { return NULL; }
01126 
01133     CoreExport virtual int GetSubObjectLevel();
01135     
01136     
01137 
01143     virtual BOOL HasViewDependentBoundingBox() { return false; }
01144 
01145     // Prevent accident copying / assignment.
01146     // It also prevents a compiler quirk/bug which will complain about
01147     // Animatable not having a copy constructor, in some derived classes
01148     // from this one.
01149 private:
01150     BaseObject(const BaseObject&);
01151     BaseObject& operator=(const BaseObject&);
01152 };
01153 
01154 
01158 class Deformer: public MaxHeapOperators {
01159 public:
01161     virtual ~Deformer() { }
01175     virtual Point3 Map(int i, Point3 p) = 0; 
01176     void ApplyToTM(Matrix3* tm);
01177 };
01178 
01179 /*------------------------------------------------------------------- 
01180 Object is the class of all objects that can be pointed to by a node:
01181 It INcludes Lights,Cameras, Geometric objects, derived objects,
01182 and deformation Objects (e.g. FFD lattices)
01183 It EXcludes Modifiers
01184 ---------------------------------------------------------------------*/
01185 enum { OBJECT_LOCKED = 0x08000000 };
01186 
01187 class ShapeObject;
01188 class XTCObject;
01189 
01193 class XTCContainer: public MaxHeapOperators {
01194 
01195 public: 
01196     XTCObject *obj; 
01197     int prio;       
01198     int branchID;   
01199 
01201     XTCContainer(){obj = NULL; prio = 0; branchID = -1;}
01202 
01203 };
01204 
01205 #define IXTCACCESS_INTERFACE_ID Interface_ID(0x60b033d7, 0x3e1d4d0d)
01206 
01210 class IXTCAccess : public BaseInterface
01211 {
01212 public:
01214     virtual Interface_ID    GetID() { return IXTCACCESS_INTERFACE_ID; }
01215 
01230     virtual LifetimeType    LifetimeControl() { return noRelease; }
01231 
01236     virtual void AddXTCObject(XTCObject *pObj, int priority = 0, int branchID = -1)=0;
01237 
01239     virtual int NumXTCObjects()=0;
01240 
01243     virtual XTCObject *GetXTCObject(int index)=0;
01244 
01247     virtual void RemoveXTCObject(int index)=0;
01248 
01252     virtual void SetXTCObjectPriority(int index,int priority)=0;
01253 
01257     virtual int GetXTCObjectPriority(int index)=0;
01258 
01263     virtual void SetXTCObjectBranchID(int index,int branchID)=0;
01264 
01267     virtual int GetXTCObjectBranchID(int index)=0;
01268 
01280     virtual void MergeAdditionalChannels(Object *from, int branchID)=0;
01281 
01289     virtual void BranchDeleted(int branchID, bool reorderChannels)=0;   
01290 
01297     virtual void CopyAdditionalChannels(Object *from, bool deleteOld = true, bool bShallowCopy = false)=0;
01298 
01300     virtual void DeleteAllAdditionalChannels()=0;
01301 };
01302 
01303 class XTCAccessImp;
01304 
01305 namespace MaxGraphics {
01306 
01307     class IDisplayInternal;
01308 
01309 }
01310 
01327 class Object : public BaseObject {
01328     ChannelMask locked;         
01329     Interval noEvalInterval;    
01330     Interval xtcValid;
01331 
01332     Tab<XTCContainer *> xObjs;
01333     XTCAccessImp *pXTCAccess;
01334 
01335     MaxGraphics::IDisplayInternal* mpDisplayInternal;
01336 
01337 public:
01338     CoreExport Object();
01339     CoreExport ~Object();
01340 
01344     virtual int IsRenderable()=0;  // is this a renderable object?
01345 
01346 
01349     virtual void InitNodeName(MSTR& s)=0;
01350 
01353     virtual int UsesWireColor() { return TRUE; }    // TRUE if the object color is used for display
01354 
01365     virtual int DoOwnSelectHilite() { return 0; }
01366 
01367     // This used to be in GeomObject but I realized that other types of objects may
01368     // want this (mainly to participate in normal align) such as grid helper objects.
01377     virtual int IntersectRay(TimeValue t, Ray& r, float& at, Point3& norm) {return FALSE;}
01378 
01379     // Objects that don't support IntersectRay() (like helpers) can implement this
01380     // method to provide a default vector for normal align.
01389     virtual BOOL NormalAlignVector(TimeValue t,Point3 &pt, Point3 &norm) {return FALSE;}
01391 
01406     // locking of object as whole. defaults to NOT modifiable.
01410     void LockObject() { locked |= OBJECT_LOCKED; }
01411 
01414     void UnlockObject() { locked &= ~OBJECT_LOCKED; }
01415 
01418     int  IsObjectLocked() { return (locked&OBJECT_LOCKED ? 1 : 0); }
01419 
01420     // the validity intervals are now in the object.
01437     virtual ObjectState Eval(TimeValue t)=0;
01438 
01439     // Access the lock flags for th specified channels
01443     void LockChannels(ChannelMask channels) { locked |= channels; } 
01444 
01448     void UnlockChannels(ChannelMask channels) { locked &= ~channels; }
01449 
01453     ChannelMask     GetChannelLocks() { return locked; }    
01454 
01458     void SetChannelLocks(ChannelMask channels) { locked = channels; }    
01459 
01464     ChannelMask GetChannelLocks(ChannelMask m) { return locked; }
01465 
01466                                
01467 
01468 
01469     // Can this object have channels cached?
01470     // Particle objects flow up the pipline without making shallow copies of themselves and therefore cannot be cached
01476     virtual BOOL CanCacheObject() {return TRUE;}
01477 
01478     // This is called by a node when the node's world space state has
01479     // become invalid. Normally an object does not (and should not) be
01480     // concerned with this, but in certain cases (particle systems) an
01481     // object is effectively a world space object an needs to be notified.
01486     virtual void WSStateInvalidate() {}
01487 
01488     // Identifies the object as a world space object. World space
01489     // objects (particles for example) can not be instanced because
01490     // they exist in world space not object space.
01495     virtual BOOL IsWorldSpaceObject() {return FALSE;}
01496 
01497     
01498 
01499     // This is only valid for world-space objects (they must return TRUE for
01500     // the IsWorldSpaceObject method).  It locates the node which contains the
01501     // object.  Non-world-space objects will return NULL for this!
01502     CoreExport INode *GetWorldSpaceObjectNode();
01503 
01504     // Is the derived class derived from ParticleObject?
01505     virtual BOOL IsParticleSystem() {return FALSE;}
01506 
01507     // copy specified flags from obj
01512     CoreExport void CopyChannelLocks(Object *obj, ChannelMask needChannels);
01513     // topology has been changed by a modifier -- update mesh strip/edge lists
01514     virtual void TopologyChanged() { }
01515 
01516 
01517     //
01518     // does this object implement the generic Deformable Object procs?
01519     //
01541     virtual int IsDeformable() { return 0; } 
01542 
01543     // DeformableObject procs: only need be implemented  
01544     // IsDeformable() returns TRUE.
01550     virtual int NumPoints(){ return 0;}
01551 
01562     virtual Point3 GetPoint(int i) { return Point3(0,0,0); }
01563 
01568     virtual void SetPoint(int i, const Point3& p) {}             
01569 
01570     // Completes the deformable object access with two methods to
01571     // query point selection. 
01572     // IsPointSelected returns a TRUE/FALSE value
01573     // PointSelection returns the weighted point selection, if supported.
01574     // Harry D, 11/98
01577     virtual BOOL IsPointSelected (int i) { return FALSE; }
01578 
01583     virtual float PointSelection (int i) {
01584         return IsPointSelected(i) ? 1.0f : 0.0f;
01585     }
01586 
01587 
01588     // These allow the NURBS Relational weights to be modified
01591     virtual BOOL HasWeights() { return FALSE; }
01592 
01595     virtual double GetWeight(int i) { return 1.0; }
01596 
01600     virtual void SetWeight(int i, const double w) {}
01601 
01602 
01603     // Get the count of faces and vertices for the polyginal mesh
01604     // of an object.  If it return FALSE, then this function
01605     // isn't supported.  Plug-ins should use GetPolygonCount(Object*, int&, int&)
01606     // to count the polys in an arbitrary object
01617     virtual BOOL PolygonCount(TimeValue t, int& numFaces, int& numVerts) { return FALSE; }
01618     // informs the object that its points have been deformed,
01619     // so it can invalidate its cache.
01627     virtual void PointsWereChanged(){}
01628 
01629     // deform the object with a deformer.
01697     CoreExport virtual void Deform(Deformer *defProc, int useSel=0);
01698 
01699     // box in objects local coords or optional space defined by tm
01700     // If useSel is true, the bounding box of selected sub-elements will be taken.
01711     CoreExport virtual void GetDeformBBox(TimeValue t, Box3& box, Matrix3 *tm=NULL, BOOL useSel=FALSE );
01712 
01713     //
01714     // does this object implement the generic Mappable Object procs?
01715     //
01720     virtual int IsMappable() { return 0; }
01721 
01725     virtual int NumMapChannels () { return IsMappable(); }  // returns number possible.
01726 
01731     virtual int NumMapsUsed () { return NumMapChannels(); } // at least 1+(highest channel in use).
01732 
01733     // This does the texture map application -- Only need to implement if
01734     // IsMappable returns TRUE
01757     virtual void ApplyUVWMap(int type,
01758         float utile, float vtile, float wtile,
01759         int uflip, int vflip, int wflip, int cap,
01760         const Matrix3 &tm,int channel=1) {}
01761 
01762     // Objects need to be able convert themselves 
01763     // to TriObjects. Most modifiers will ask for
01764     // Deformable Objects, and triobjects will suffice.
01765 
01777     CoreExport virtual int CanConvertToType(Class_ID obtype);
01778 
01779     // Developers have to make sure, that the channels, that the BaseObject implements 
01780     // (e.g. ExtensionChannels) are copied over to the new object as well. They can do this by simply
01781     // calling CopyXTCObjects(this,false); The validity will be automatically copied with it..
01907     CoreExport virtual Object* ConvertToType(TimeValue t, Class_ID obtype);
01908     // Indicate the types this object can collapse to
01916     virtual Class_ID PreferredCollapseType() {return Class_ID(0,0);}
01917 
01942     CoreExport virtual void GetCollapseTypes(Tab<Class_ID> &clist,Tab<MSTR*> &nlist);
01943 
01957     virtual Object *CollapseObject() { return this;}
01958 
01959     // return the current sub-selection state
01966     virtual DWORD GetSubselState() {return 0;} 
01967     virtual void SetSubSelState(DWORD s) {}
01968 
01969 
01970 
01971     // If the requested channels are locked, replace their data
01972     // with a copy/ and unlock them, otherwise leave them alone
01977     CoreExport void ReadyChannelsForMod(ChannelMask channels);
01978 
01979 
01980 
01981 
01982     // Virtual methods to be implemented by plug-in object:-----
01983 
01984     // NS: 12-14-99 Classes that derive from Object *have* to implement certain
01985     // things to support the new Extension Channel (XTCObject)
01986     // See examples in Triobj.cpp [START]
01987 
01988     // access the current validity interval for the nth channel
01989     // For this method, the derived class has to check if the channel is the 
01990     // Extension channel and return the base classes ChannelValidity :
01991     // case EXTENSION_CHAN_NUM: return Object::ChannelValidity(t,nchan); break;
02002     CoreExport virtual Interval ChannelValidity(TimeValue t, int nchan);
02003 
02004     // The derived class has to simply call the implementation of the baseclass.
02008     CoreExport virtual void SetChannelValidity(int nchan, Interval v);
02009 
02010     // invalidate the specified channels
02011     // The derived class has to simply call the implementation of the baseclass.
02015     CoreExport virtual void InvalidateChannels(ChannelMask channels);
02016 
02017     // validity interval of Object as a whole at current time
02018     // The derived class has incorporate the BaseClasses validity into the returned validity
02025     CoreExport virtual Interval ObjectValidity(TimeValue t);
02026 
02027 
02028 
02029     // Makes a copy of its "shell" and shallow copies only the
02030     // specified channels.  Also copies the validity intervals of
02031     // the copied channels, and sets Invalidates the other intervals.
02032     // The derived class has to call ShallowCopy on the BaseClass, so it can copy all its channels
02038     virtual Object *MakeShallowCopy(ChannelMask channels) { return NULL; }
02039 
02040     // Shallow-copies the specified channels from the fromOb to this.
02041     // Also copies the validity intervals. 
02042     // The derived class has to simply call the implementation of the baseclass.
02051     CoreExport virtual void ShallowCopy(Object* fromOb, ChannelMask channels);
02052 
02053 
02054 
02055     // Free the specified channels
02056     // The derived class has to simply call the implementation of the baseclass.
02060     CoreExport virtual void FreeChannels(ChannelMask channels);   
02061     
02062         // This replaces locked channels with newly allocated copies.
02063     // It will only be called if the channel is locked.
02064     // The derived class has to simply call the implementation of the baseclass.
02068     CoreExport virtual void NewAndCopyChannels(ChannelMask channels); 
02069     
02070     
02071 
02072     // Allow the object to enlarge its viewport rectangle, if it wants to.
02073     // The derived class has to simply call the implementation of the baseclass.
02104     CoreExport virtual void MaybeEnlargeViewportRect(GraphicsWindow *gw, Rect &rect);
02105 
02106 
02107     // quick render in viewport, using current TM.
02108     //CoreExport virtual Display(TimeValue t, INode* inode, ViewExp *vpt, int flags) { return 0; };   
02109 
02110     // NS: 12-14-99 Classes that derive from Object *have* o call the following methods
02111     // See examples in Triobj.cpp [END]
02112 
02113     CoreExport bool IsBaseClassOwnedChannel(int nchan) { return (nchan == EXTENSION_CHAN_NUM) ? true : false;}
02114   
02123     CoreExport void UpdateValidity(int nchan, Interval v);  // AND in interval v to channel validity
02124 
02126     Interval GetNoEvalInterval() { return noEvalInterval; }
02127     
02129     void SetNoEvalInterval(Interval iv) {noEvalInterval = iv; }
02130 
02131     // Give the object chance to reduce its caches, 
02132     // depending on the noEvalInterval.
02135     CoreExport virtual void ReduceCaches(TimeValue t);
02136 
02137 
02138                 // Is this object a construction object:
02141     virtual int IsConstObject() { return 0; }  
02142 
02143 
02144     // Retreives sub-object branches from an object that supports branching.
02145     // Certain objects combine a series of input objects (pipelines) into
02146     // a single object. These objects act as a multiplexor allowing the
02147     // user to decide which branch(s) they want to see the history for.
02148     //
02149     // It is up to the object how they want to let the user choose. The object
02150     // may use sub object selection to allow the user to pick a set of
02151     // objects for which the common history will be displayed.
02152     // 
02153     // When the history changes for any reason, the object should send
02154     // a notification (REFMSG_BRANCHED_HISTORY_CHANGED) via NotifyDependents.
02155 
02156     // The selected parameter is new in Rel. 4 and must be supported by all
02157     // compound objects.
02158     // In case the selected parameter is true the obejct should only return
02159     // the number of pipebranches, that are currently selected in the UI (this
02160     // is the way it worked in R3 and before.
02161     // In case this parameter is false, the object has to return the number of 
02162     // *all* branches, no matter if they are selected or not
02163 
02164 
02175     virtual int NumPipeBranches(bool selected = true) {return 0;}
02176 
02177     // The selected parameter is new in Rel. 4 and must be supported by all
02178     // compound objects.
02179     // In case the selected parameter is true the obejct should only consider
02180     // the branches, that are currently selected in the UI (this
02181     // is the way it worked in R3 and before.
02182     // In case this parameter is false, the object has to consider 
02183     // *all* branches, no matter if they are selected or not
02184 
02201     virtual Object *GetPipeBranch(int i, bool selected = true) {return NULL;}
02202 
02203     // When an object has sub-object branches, it is likely that the
02204     // sub-objects are transformed relative to the object. This method
02205     // gives the object a chance to modify the node's transformation so
02206     // that operations (like edit modifiers) will work correctly when 
02207     // editing the history of the sub object branch.
02208 
02209     // The selected parameter is new in Rel. 4 and must be supported by all
02210     // compound objects.
02211     // In case the selected parameter is true the obejct should only consider
02212     // the branches, that are currently selected in the UI (this
02213     // is the way it worked in R3 and before.
02214     // In case this parameter is false, the object has to consider 
02215     // *all* branches, no matter if they are selected or not
02216 
02234     virtual INode *GetBranchINode(TimeValue t,INode *node,int i, bool selected = true) {return node;}
02236 
02247     // Shape viewports can reference shapes contained within objects, so we
02248     // need to be able to access shapes within an object.  The following methods
02249     // provide this access
02254     virtual int NumberOfContainedShapes() { return -1; }    // NOT a container!
02255 
02260     virtual ShapeObject *GetContainedShape(TimeValue t, int index) { return NULL; }
02261 
02268     virtual void GetContainedShapeMatrix(TimeValue t, int index, Matrix3 &mat) {}
02269 
02274     virtual BitArray ContainedShapeSelectionArray() { return BitArray(); }
02275 
02276     // Return TRUE for ShapeObject class or GeomObjects that are Shapes too
02277     virtual BOOL IsShapeObject() { return FALSE; }
02278 
02279     // For debugging only. TriObject inplements this method by making sure
02280     // its face's vert indices are all valid.
02284     virtual BOOL CheckObjectIntegrity() {return TRUE;}              
02285 
02286     // Find out if the Object is generating UVW's
02287     virtual BOOL HasUVW() { return 0; }
02288     // or on any map channel:
02289     virtual BOOL HasUVW (int mapChannel) { return (mapChannel==1) ? HasUVW() : FALSE; }
02290 
02291     
02292     // This is overridden by DerivedObjects to search up the pipe for the base object
02299     virtual Object *FindBaseObject() { return this; }
02300 
02301     // Access a parametric position on the surface of the object
02312     virtual BOOL IsParamSurface() {return FALSE;}
02313 
02316     virtual int NumSurfaces(TimeValue t) {return 1;}
02317 
02318     // Single-surface version (surface 0)
02329     virtual Point3 GetSurfacePoint(TimeValue t, float u, float v,Interval &iv) {return Point3(0,0,0);}
02330 
02331     // Multiple-surface version (Implement if you override NumSurfaces)
02340     virtual Point3 GetSurfacePoint(TimeValue t, int surface, float u, float v,Interval &iv) {return Point3(0,0,0);}
02341 
02342     // Get information on whether a surface is closed (default is closed both ways)
02352     virtual void SurfaceClosed(TimeValue t, int surface, BOOL &uClosed, BOOL &vClosed) {uClosed = vClosed = TRUE;}
02353 
02354     
02355     // Allow an object to return extended Properties fields
02356     // Return TRUE if you take advantage of these, and fill in all strings
02373     virtual BOOL GetExtendedProperties(TimeValue t, MSTR &prop1Label, MSTR &prop1Data, MSTR &prop2Label, MSTR &prop2Data) {return FALSE;}
02374 
02375     // Animatable Overides...
02376 
02377     CoreExport SvGraphNodeReference SvTraverseAnimGraph(IGraphObjectManager *gom, Animatable *owner, int id, DWORD flags);
02378     CoreExport bool SvHandleDoubleClick(IGraphObjectManager *gom, IGraphNode *gNode);
02379     CoreExport MSTR SvGetName(IGraphObjectManager *gom, IGraphNode *gNode, bool isBeingEdited);
02380     CoreExport COLORREF SvHighlightColor(IGraphObjectManager *gom, IGraphNode *gNode);
02381     CoreExport bool SvIsSelected(IGraphObjectManager *gom, IGraphNode *gNode);
02382     CoreExport MultiSelectCallback* SvGetMultiSelectCallback(IGraphObjectManager *gom, IGraphNode *gNode);
02383     CoreExport bool SvCanSelect(IGraphObjectManager *gom, IGraphNode *gNode);
02384 
02385     // Adds an extension object into the pipeline. The methods (Display,
02386     // PreChanChangedNotify etc) of higher priority XTCObjects will becalled 
02387     // before those of lower priority XTCObjects
02395     CoreExport void AddXTCObject(XTCObject *pObj, int priority = 0, int branchID = -1);
02396 
02399     CoreExport int NumXTCObjects();
02400 
02404     CoreExport XTCObject *GetXTCObject(int index);
02405 
02409     CoreExport void RemoveXTCObject(int index);
02410 
02415     CoreExport void SetXTCObjectPriority(int index,int priority);
02416 
02421     CoreExport int GetXTCObjectPriority(int index);
02422 
02427     CoreExport void SetXTCObjectBranchID(int index,int branchID);
02428 
02433     CoreExport int GetXTCObjectBranchID(int index);
02434 
02435     // This method has to be called whenever the CompoundObject updates a branch 
02436     // (calling Eval on it). Object *from is the object returned from Eval 
02437     // (os.obj);branchID is an int, that specifies that branch. The extension 
02438     // channel will get a callback to RemoveXTCObjectOnMergeBranches and MergeXTCObject. 
02439     // By default it returns true to RemoveXTCObjectOnMergeBranches, which means,
02440     // that the existing XTCObjects with that branchID will be deleted. The method 
02441     // MergeXTCObject simply copies the XTCObjects from the incoming branch into the 
02442     // compound object.
02443 
02456     CoreExport void MergeAdditionalChannels(Object *from, int branchID);
02457 
02458     // This method has to be called on the CompoundObject, so it can delete the 
02459     // XTCObjects for the specific branch. The XTCObject will have again the final 
02460     // decision if the XTCObject gets really deleted or not in a callback to 
02461     // RemoveXTCObjectOnBranchDeleted(), which will return true, if the XTCOject 
02462     // should be removed.
02463 
02473     CoreExport void BranchDeleted(int branchID, bool reorderChannels);
02474 
02475     // This method copies all extension objects from the "from" objects into the 
02476     // current object. In case deleteOld is false, the objects will be appended. 
02477     // In case it is true, the old XTCObjects will be deleted.
02487     CoreExport void CopyAdditionalChannels(Object *from, bool deleteOld = true, bool bShallowCopy = false);
02488 
02491     CoreExport void DeleteAllAdditionalChannels();
02492 
02493 
02497     virtual BOOL UseSelectionBrackets() { return TRUE; }
02498 
02499     // returns TRUE for manipulator objcts and FALSE for all others
02500     virtual BOOL IsManipulator() { return FALSE; }
02501 
02502     CoreExport void* GetInterface(ULONG id);
02503     CoreExport BaseInterface* GetInterface(Interface_ID id);
02504 
02506 
02509     virtual void ReduceDisplayCaches() {  }
02510 
02517     virtual bool NeedGWCacheRebuilt(GraphicsWindow *gw, Material *ma, int numMat) { return false; }
02518 
02526     virtual void BuildGWCache(GraphicsWindow *gw, Material *ma, int numMat, BOOL threaded) {  }
02527 
02528 
02529 
02530 };
02531 
02532 
02533 // This function should be used to count polygons in an object.
02534 // It uses Object::PolygonCount() if it is supported, and converts to
02535 // a TriObject and counts faces and vertices otherwise.
02544 CoreExport void GetPolygonCount(TimeValue t, Object* pObj, int& numFaces, int& numVerts);
02545 
02550 CoreExport void GetTriMeshFaceCount(TimeValue t, Object* pObj, int& numFaces, int& numVerts);
02551 
02552 // mjm - begin - 07.17.00
02553 class  CameraObject;
02554 
02566 class IMultiPassCameraEffect : public ReferenceTarget
02567 {
02568 public:
02569     // allows effect to declare it's compatibility with the current camera object
02576     virtual bool IsCompatible(CameraObject *pCameraObject) = 0;
02577 
02578     // indicates that the renderer should display each pass as it is rendered (not used by viewport renderer)
02585     virtual bool DisplayPasses(TimeValue renderTime) = 0;
02586 
02587     // indicates the total number of passes to be rendered
02592     virtual int TotalPasses(TimeValue renderTime) = 0;
02593 
02594     // called for each render pass. the effect can alter the camera node, camera object, or override the render time
02613     virtual ViewParams *Apply(INode *pCameraNode, CameraObject *pCameraObject, int passNum, TimeValue &overrideRenderTime) = 0;
02614     
02615     // allows the effect to blend its own passes (not used by the viewport renderer)
02629     virtual void AccumulateBitmap(Bitmap *pDest, Bitmap *pSrc, int passNum, TimeValue renderTime) = 0;
02630     // convenience function, called after all passes have been rendered. can be ignored.
02636     virtual void PostRenderFrame() = 0;
02637 
02638     // from class ReferenceMaker
02654     virtual RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message) { return REF_SUCCEED; }
02655 
02656     // from class Animatable
02659     virtual SClass_ID SuperClassID() { return MPASS_CAM_EFFECT_CLASS_ID; }
02660     virtual void BeginEditParams(IObjParam *ip, ULONG flags, Animatable *prev=NULL) {}
02661     virtual void EndEditParams(IObjParam *ip, ULONG flags, Animatable *next=NULL) {}
02662 };
02663 // mjm - end
02664 
02665 
02666 // ------------
02667 // CameraObject  
02668 // ------------
02670 
02671 #define CAM_HITHER_CLIP         1   //!< The hither distance
02672 #define CAM_YON_CLIP            2   //!< The yon distance.
02673 
02674 
02676 
02677 #define ENV_NEAR_RANGE          0   //!< The near distance
02678 #define ENV_FAR_RANGE           1   //!< The far distance
02679 
02680 
02684 struct CameraState: public MaxHeapOperators {
02685     inline CameraState() {cbStruct = sizeof(CameraState);}
02686     DWORD cbStruct;
02688     BOOL isOrtho;   // true if cam is ortho, false for persp
02690     float fov;      // field-of-view for persp cams, width for ortho cams
02692     float tdist;    // target distance for free cameras
02694     BOOL horzLine;  // horizon line display state
02696     int manualClip;
02698     float hither;
02700     float yon;
02702     float nearRange;
02704     float farRange;
02705 };
02706 
02714 class CameraObject : public Object
02715 {
02716 public:
02717     SClass_ID SuperClassID() { return CAMERA_CLASS_ID; }
02718     int IsRenderable() { return(0);}
02719     virtual void InitNodeName(MSTR& s) { s = _M("Camera"); }
02720     virtual int UsesWireColor() { return FALSE; } // TRUE if the object color is used for display
02721 
02738     virtual RefResult EvalCameraState(TimeValue time, Interval& valid, CameraState* cs)=0;
02739 
02742     virtual void SetOrtho(BOOL b)=0;
02744     virtual BOOL IsOrtho()=0;
02748     virtual void SetFOV(TimeValue t, float f)=0; 
02755     virtual float GetFOV(TimeValue t, Interval& valid = Interval(0,0))=0;
02759     virtual void SetTDist(TimeValue t, float f)=0; 
02767     virtual float GetTDist(TimeValue t, Interval& valid = Interval(0,0))=0;
02771     virtual int GetManualClip()=0;
02776     virtual void SetManualClip(int onOff)=0;
02785     virtual float GetClipDist(TimeValue t, int which, Interval &valid=Interval(0,0))=0;
02790     virtual void SetClipDist(TimeValue t, int which, float val)=0;
02795     virtual void SetEnvRange(TimeValue time, int which, float f)=0; 
02804     virtual float GetEnvRange(TimeValue t, int which, Interval& valid = Interval(0,0))=0;
02811     virtual void SetEnvDisplay(BOOL b, int notify=TRUE)=0;
02814     virtual BOOL GetEnvDisplay(void)=0;
02818     virtual void RenderApertureChanged(TimeValue t)=0;
02824     virtual void UpdateTargDistance(TimeValue t, INode* inode) { }
02825     // mjm - begin - 07.17.00
02829     virtual void SetMultiPassEffectEnabled(TimeValue t, BOOL enabled) { }
02835     virtual BOOL GetMultiPassEffectEnabled(TimeValue t, Interval& valid) { return FALSE; }
02836     virtual void SetMPEffect_REffectPerPass(BOOL enabled) { }
02837     virtual BOOL GetMPEffect_REffectPerPass() { return FALSE; }
02841     virtual void SetIMultiPassCameraEffect(IMultiPassCameraEffect *pIMultiPassCameraEffect) { }
02844     virtual IMultiPassCameraEffect *GetIMultiPassCameraEffect() { return NULL; }
02845 };
02846 
02848 
02849 #define LIGHT_ATTEN_START       0   //!< The start range radius
02850 #define LIGHT_ATTEN_END         1   //!< The end range radius
02851 
02852 
02856 struct LightState: public MaxHeapOperators {
02863     LightType type;
02865     Matrix3 tm;
02867     Color color;
02869     float   intens;  // multiplier value
02871     float   hotsize; 
02873     float   fallsize;
02875     int     useNearAtten;
02877     float   nearAttenStart;
02879     float   nearAttenEnd;
02881     int     useAtten;
02883     float   attenStart;
02885     float   attenEnd;
02888     int     shape;
02890     float   aspect;
02892     BOOL    overshoot;
02894     BOOL    shadow;
02896     BOOL    on;      // light is on
02898     BOOL    affectDiffuse;
02900     BOOL    affectSpecular;
02901     BOOL    ambientOnly;  // affect only ambient component
02902     DWORD   extra;
02903 };
02904 
02905 class LightDesc;
02906 class RendContext;
02907 
02908 
02909 // This is a callback class that can be given to a ObjLightDesc
02910 // to have a ray traced through the light volume.
02944 class LightRayTraversal: public MaxHeapOperators {
02945 public:
02947     virtual ~LightRayTraversal() {;}
02948     // This is called for every step (return FALSE to halt the integration).
02949     // t0 and t1 define the segment in terms of the given ray.
02950     // illum is the light intensity over the entire segment. It can be
02951     // assumed that the light intensty is constant for the segment.
02968     virtual BOOL Step(float t0, float t1, Color illum, float distAtten)=0;
02969 };
02970 
02971 // Flags passed to TraverseVolume
02973 
02974 
02978 #define TRAVERSE_LOWFILTSHADOWS (1<<0)
02979 
02980 #define TRAVERSE_HIFILTSHADOWS  (1<<1)
02981 
02984 #define TRAVERSE_USESAMPLESIZE  (1<<2)
02985 
02986 
02988 // The following classes, IlluminateComponents & IlluminationComponents,
02989 // have been added in 3ds max 4.2.  If your plugin utilizes this new
02990 // mechanism, be sure that your clients are aware that they
02991 // must run your plugin with 3ds max version 4.2 or higher.
02992 
02993 
02999 class IlluminateComponents : public BaseInterfaceServer {
03000 public:
03002     Point3  L;              
03004     float   NL;             
03005 
03006     // these are the attenuations due to the light
03009     float   geometricAtten; // final constrast applied to N.L
03011     float   shapeAtten;     // due to cone(s) falloff
03013     float   distanceAtten;  // attenuation due to distance, falloff
03014 
03015     // this is the composite attenuation due to all shadowing objects
03016     // transparent bojects may supply some shadowAtten as well as filterAtten
03021     float   shadowAtten;     // 0 == all shadow, 1 == all light
03022 
03023     // these allow smooth control over how the light 
03024     // affects these basic shading components
03027     float   ambientAtten;   // 0 == no ambient, 1 = all ambient
03030     float   diffuseAtten;   // 0 == no diffuse, 1 = all diffuse
03033     float   specularAtten;  // 0 == no specular, 1 = all specular
03034 
03035     // The complete amount of light falling on the point sc.P() orientied
03036     // in the direction sc.N() is the filteredColor. if( rawColor!=filteredColor)
03037     // then it's filtered, else unfiltered
03038 
03039     // light color modulated by map value, 
03040     // unattenuated, w/ raw light if no map
03043     Color   rawColor;       
03044 
03045     // light color modulated by map value, 
03046     // then filtered by a transparent object,
03047     // raw color * filterAtten, otherwise unattenuated, 
03050     Color   filteredColor;
03051 
03052     // color due to user shadow color, modulated by a possible map,
03053     // attenuated by 1-shadowAtten
03055     Color   shadowColor;    
03056 
03057     // these are the combined light colors modulated by the ambientAtten'uators
03058     // they can be used by shaders to compute diffuse & specular shading
03059     // complete component color is e.g. lightDiffuseColor+shadowColor
03060 
03061     // NB: the geometric atten is to be applied by the shader, not the light
03062     // e.g. lightAmbientColor = 
03063     //          ambientAtten * (shapeAtten*distAtten*shadowAtten) 
03064     //              * filteredColor;
03066     Color   lightAmbientColor;  // ambient color due to light, attenuated, w/o shadow color
03068     Color   lightDiffuseColor;  // diffuse color due to light, attenuated, w/o shadow color
03070     Color   lightSpecularColor; // specular color due to light, attenuated, w/o shadow color
03071 
03072     // these are equivalent to 4.0 final illumination color, with & without shadows
03073     // finalColor = shadowColor + (shapeAtten * distAtten * shadowAtten) 
03074     //                                  *  filteredColor;
03076     Color   finalColor;     
03077 
03078     // Like final color but no shadow attenuation applied and no shadowColor
03079     // finalColorNS = (shapeAtten * distAtten) * filteredColor;
03082     Color   finalColorNS;   
03083 
03084     // user extensible component outputs, name matched
03086     int nUserIllumOut;      // one set of names for all illum params instances
03088     MCHAR** userIllumNames;  // we just keep ptr to shared name array, never destroyed
03090     Color* userIllumOut;    // the user illum color array, new'd and deleted with the class
03091 
03092     IlluminateComponents(): nUserIllumOut(0),userIllumOut(NULL),userIllumNames(NULL) {}
03093 
03094     CoreExport ~IlluminateComponents(); 
03095 
03096     // Returns number of user illum channels for this material
03100     int nUserIllumChannels(){ return nUserIllumOut; }
03101 
03102     // returns null if no name array specified
03106     MCHAR* GetUserIllumName( int n ) { 
03107         DbgAssert( n < nUserIllumOut );
03108         if( userIllumNames )
03109             return userIllumNames[n];
03110         return NULL;
03111     }
03112 
03113     // render elements, mtls & shaders can use this to find the index associated with a name
03114     // returns -1 if it can't find the name
03119     CoreExport int FindUserIllumName( MCHAR* name );
03120 
03121     // knowing the index, these set/get the user illum output color
03125     void SetUserIllumOutput( int n, Color& out ){
03126         DbgAssert( n < nUserIllumOut );
03127         userIllumOut[n] = out;
03128     }
03129 
03134     Color GetUserIllumOutput( int n ){
03135         DbgAssert( n < nUserIllumOut );
03136         return userIllumOut[n];
03137     }
03138 
03140     void Reset(){
03141         NL = geometricAtten = shapeAtten = distanceAtten = shadowAtten
03142             = ambientAtten = diffuseAtten = specularAtten = 0.0f;
03143         rawColor.Black();
03144         filteredColor.Black();
03145         lightAmbientColor.Black();
03146         lightDiffuseColor.Black();
03147         lightSpecularColor.Black();
03148         shadowColor.Black();
03149         finalColor.Black();
03150         finalColorNS.Black();
03151         L = Point3( 0,0,0 );
03152         if(nUserIllumOut>0 && userIllumOut){
03153             for(int i=0; i<nUserIllumOut; ++i )
03154                 userIllumOut[i].Black();
03155         }
03156     }
03157 
03158 }; // end, IlluminateComponents
03159 
03160 // must be greater than I_USERINTERFACE in AnimatableInterfaceIDs.h
03161 #define IID_IIlluminationComponents Interface_ID(0xdae00001, 0x0)
03162 
03166 class IIlluminationComponents : public BaseInterface {
03167 public:
03168     virtual BOOL Illuminate(ShadeContext& sc, Point3& normal, IlluminateComponents& illumComp )=0;
03169 
03170 };
03171 
03172 // End of IlluminateComponents & IlluminationComponent 3ds max 4.2 Extension
03173 
03174 
03175 
03176 // A light must be able to create one of these to give to the renderer.
03177 // The Illuminate() method (inherited from LightDesc) is called by the renderer
03178 // to illuminate a surface point.
03194 class ObjLightDesc : public LightDesc {
03195 public:         
03196     // This data will be set up by the default implementation of Update()
03197     LightState ls;          
03198     INode *inode;           
03199     BOOL uniformScale;      
03200     Point3 lightPos;        
03201     Matrix3 lightToWorld;   
03202     Matrix3 worldToLight;   
03203     Matrix3 lightToCam;     
03204 
03210     Matrix3 camToLight;   
03216     int renderNumber;
03217 
03220     CoreExport ObjLightDesc(INode *n);
03222     CoreExport virtual ~ObjLightDesc();
03223 
03226     virtual ExclList* GetExclList() { return NULL; }  
03227 
03228     // update light state that depends on position of objects&lights in world.
03270     CoreExport virtual int Update(TimeValue t, const RendContext &rc, RenderGlobalContext *rgc, BOOL shadows, BOOL shadowGeomChanged);
03271 
03272     // update light state that depends on global light level.
03275     CoreExport virtual void UpdateGlobalLightLevel(Color globLightLevel) {}
03276 
03277     // update light state that depends on view matrix.
03285     CoreExport virtual int UpdateViewDepParams(const Matrix3& worldToCam);
03286 
03287     // default implementation 
03290     CoreExport virtual Point3 LightPosition() { return lightPos; }
03291 
03292     // This function traverses a ray through the light volume.
03293     // 'ray' defines the parameter line that will be traversed.
03294     // 'minStep' is the smallest step size that caller requires, Note that
03295     // the callback may be called in smaller steps if they light needs to
03296     // take smaller steps to avoid under sampling the volume.
03297     // 'tStop' is the point at which the traversal will stop (ray.p+tStop*ray.dir).
03298     // Note that the traversal can terminate earlier if the callback returns FALSE.
03299     // 'proc' is the callback object.
03300     //
03301     // attenStart/End specify a percent of the light attenuation distances
03302     // that should be used for lighting durring the traversal.
03303     //
03304     // The shade context passed in should only be used for state (like are
03305     // shadows globaly disabled). The position, normal, etc. serve no purpose.
03356     virtual void TraverseVolume(
03357         ShadeContext& sc,       
03358         const Ray &ray, int samples, float tStop,
03359         float attenStart, float attenEnd,
03360         DWORD flags,
03361         LightRayTraversal *proc) {}
03362 };
03363 
03364 
03369 #define LIGHTSHADOW_NONE                0
03370 #define LIGHTSHADOW_MAPPED              1
03371 #define LIGHTSHADOW_RAYTRACED   2
03372 
03373 
03374 
03377 class LightObject : public Object {
03378 public:
03379     SClass_ID SuperClassID() { return LIGHT_CLASS_ID; }
03380     int IsRenderable() { return(0);}
03381     virtual void InitNodeName(MSTR& s) { s = _M("Light"); }
03382 
03383     // Used to query a LightObject interface from Animatable.
03384     CoreExport virtual void* GetInterface(ULONG id);
03385     CoreExport virtual BaseInterface* GetInterface(Interface_ID id);
03386 
03387     // Methods specific to Lights:
03399     virtual RefResult EvalLightState(TimeValue time, Interval& valid, LightState *ls)=0;
03407     virtual ObjLightDesc *CreateLightDesc(INode *n, BOOL forceShadowBuffer=FALSE) {return NULL;}
03408     //JH 06/03/03 new api to pass globalRenderContext
03409     virtual ObjLightDesc *CreateLightDesc(RenderGlobalContext *rgc, INode *inode, BOOL forceShadowBuf=FALSE ){return NULL;}
03412     virtual void SetUseLight(int onOff)=0;
03414     virtual BOOL GetUseLight(void)=0;
03418     virtual void SetHotspot(TimeValue time, float f)=0; 
03423     virtual float GetHotspot(TimeValue t, Interval& valid = Interval(0,0))=0;
03427     virtual void SetFallsize(TimeValue time, float f)=0; 
03433     virtual float GetFallsize(TimeValue t, Interval& valid = Interval(0,0))=0;
03440     virtual void SetAtten(TimeValue time, int which, float f)=0; 
03448     virtual float GetAtten(TimeValue t, int which, Interval& valid = Interval(0,0))=0;
03452     virtual void SetTDist(TimeValue time, float f)=0; 
03457     virtual float GetTDist(TimeValue t, Interval& valid = Interval(0,0))=0;
03464     virtual void SetConeDisplay(int s, int notify=TRUE)=0;
03469     virtual BOOL GetConeDisplay(void)=0;
03475     virtual int GetShadowMethod() {return LIGHTSHADOW_NONE;}
03479     virtual void SetRGBColor(TimeValue t, Point3& rgb) {}
03485     virtual Point3 GetRGBColor(TimeValue t, Interval &valid = Interval(0,0)) {return Point3(0,0,0);}        
03489     virtual void SetIntensity(TimeValue time, float f) {}
03496     virtual float GetIntensity(TimeValue t, Interval& valid = Interval(0,0)) {return 0.0f;}
03500     virtual void SetAspect(TimeValue t, float f) {}
03507     virtual float GetAspect(TimeValue t, Interval& valid = Interval(0,0)) {return 0.0f;}    
03510     virtual void SetUseAtten(int s) {}
03512     virtual BOOL GetUseAtten(void) {return FALSE;}
03515     virtual void SetAttenDisplay(int s) {}
03518     virtual BOOL GetAttenDisplay(void) {return FALSE;}      
03521     virtual void Enable(int enab) {}
03525     virtual void SetMapBias(TimeValue t, float f) {}
03531     virtual float GetMapBias(TimeValue t, Interval& valid = Interval(0,0)) {return 0.0f;}
03535     virtual void SetMapRange(TimeValue t, float f) {}
03542     virtual float GetMapRange(TimeValue t, Interval& valid = Interval(0,0)) {return 0.0f;}
03546     virtual void SetMapSize(TimeValue t, int f) {}
03553     virtual int GetMapSize(TimeValue t, Interval& valid = Interval(0,0)) {return 0;}
03557     virtual void SetRayBias(TimeValue t, float f) {}
03564     virtual float GetRayBias(TimeValue t, Interval& valid = Interval(0,0)) {return 0.0f;}
03566     virtual int GetUseGlobal() {return 0;}
03570     virtual void SetUseGlobal(int a) {}
03573     virtual int GetShadow() {return 0;}
03577     virtual void SetShadow(int a) {}
03584     virtual int GetShadowType() {return 0;}
03590     virtual void SetShadowType(int a) {}
03594     virtual int GetAbsMapBias() {return 0;}
03597     virtual void SetAbsMapBias(int a) {}
03600     virtual int GetOvershoot() {return 0;}
03603     virtual void SetOvershoot(int a) {}
03606     virtual int GetProjector() {return 0;}
03609     virtual void SetProjector(int a) {}
03612     virtual ExclList* GetExclList() {return NULL;}
03615     virtual BOOL Include() {return FALSE;}
03617     virtual Texmap* GetProjMap() {return NULL;}
03620     virtual void SetProjMap(Texmap* pmap) {}
03625     virtual void UpdateTargDistance(TimeValue t, INode* inode) {}
03626 };
03627 /*------------------------------------------------------------------- 
03628 HelperObject:
03629 ---------------------------------------------------------------------*/
03630 
03635 class HelperObject : public Object {
03636 public:
03639     SClass_ID SuperClassID() { return HELPER_CLASS_ID; }
03642     int IsRenderable() { return(0); }
03645     virtual void InitNodeName(MSTR& s) { s = _M("Helper"); }
03648     virtual int UsesWireColor() { return FALSE; }   // TRUE if the object color is used for display
03649     virtual BOOL NormalAlignVector(TimeValue t,Point3 &pt, Point3 &norm) {pt=Point3(0,0,0);norm=Point3(0,0,-1);return TRUE;}
03650 };
03651 
03652 
03654 
03655 #define GRID_PLANE_NONE     -1
03656 #define GRID_PLANE_TOP      0
03657 #define GRID_PLANE_LEFT     1
03658 #define GRID_PLANE_FRONT    2
03659 #define GRID_PLANE_BOTTOM   3
03660 #define GRID_PLANE_RIGHT    4
03661 #define GRID_PLANE_BACK     5
03662 
03663 
03669 class ConstObject : public HelperObject {
03670 private:
03671     bool m_transient;
03672     bool m_temporary;   // 030730  --prs.
03673 public:
03674     ConstObject() { m_transient = m_temporary = false; }
03675 
03676     // Override this function in HelperObject!
03679     int IsConstObject() { return 1; }
03680 
03681     // Methods specific to construction grids:
03689     virtual void GetConstructionTM( TimeValue t, INode* inode, ViewExp *vpt, Matrix3 &tm ) = 0;     // Get the transform for this view
03690     virtual void SetConstructionPlane(int which, int notify=TRUE) = 0;
03691     virtual int  GetConstructionPlane(void) = 0;
03700     virtual Point3 GetSnaps( TimeValue t ) = 0;    // Get snap values
03701     virtual void SetSnaps(TimeValue t, Point3 p) = 0;
03702 
03703     virtual BOOL NormalAlignVector(TimeValue t,Point3 &pt, Point3 &norm) {pt=Point3(0,0,0);norm=Point3(0,0,-1);return TRUE;}
03704 
03705     //JH 09/28/98 for design ver
03706     bool IsTransient()const {return m_transient;}
03707     void SetTransient(bool state = true) {m_transient = state;}
03708 
03709     // grid bug fix, 030730  --prs.
03710     bool IsTemporary() const { return m_temporary; }
03711     void SetTemporary(bool state = true) { m_temporary = state; }
03712 
03713     //JH 11/16/98
03714     virtual void SetExtents(TimeValue t, Point3 halfbox)=0;
03715     virtual Point3 GetExtents(TimeValue t)=0;
03716     //JH 09/28/98 for design ver
03717     //  bool IsImplicit()const {return m_implicit;}
03718     //  void SetImplicit(bool state = true) {m_implicit = state;}
03719 
03720 };
03721 
03722 /*------------------------------------------------------------------- 
03723 GeomObject: these are the Renderable objects.  
03724 ---------------------------------------------------------------------*/
03725 
03729 class GeomObject : public Object {
03730 public:         
03731     virtual void InitNodeName(MSTR& s) { s = _M("Object"); }
03732     SClass_ID SuperClassID() { return GEOMOBJECT_CLASS_ID; }
03733 
03734     virtual int IsRenderable() { return(1); }               
03735 
03736     // If an object creates different  meshes depending on the 
03737     // particular instance (view-dependent) it should return 1.
03740     virtual int IsInstanceDependent() { return 0; }
03741 
03742     // GetRenderMesh should be implemented by all renderable GeomObjects.
03743     // set needDelete to TRUE if the render should delete the mesh, FALSE otherwise
03744     // Primitives that already have a mesh cached can just return a pointer
03745     // to it (and set needDelete = FALSE).
03762     CoreExport virtual Mesh* GetRenderMesh(TimeValue t, INode *inode, View& view, BOOL& needDelete);
03763 
03764     // Objects may now supply multiple render meshes ( e.g. particle systems). If this function
03765     // returns a positive number, then GetMultipleRenderMesh and GetMultipleRenderMeshTM will be 
03766     // called for each mesh, instead of calling GetRenderMesh // DS 5/10/00
03773     virtual int NumberOfRenderMeshes() { return 0; } // 0 indicates multiple meshes not supported.
03774 
03775     // For multiple render meshes, this method must be implemented. 
03776     // set needDelete to TRUE if the render should delete the mesh, FALSE otherwise
03777     // meshNumber specifies which of the multiplie meshes is being asked for.// DS 5/10/00
03786     virtual Mesh* GetMultipleRenderMesh(TimeValue t, INode *inode, View& view, BOOL& needDelete, int meshNumber) { return NULL; }
03787 
03788     // For multiple render meshes, this method must be implemented. 
03789     // meshTM should be returned with the transform defining the offset of the particular mesh in object space.
03790     // meshTMValid should contain the validity interval of meshTM // DS 5/10/00
03799     virtual void GetMultipleRenderMeshTM(TimeValue t, INode *inode, View& view, int meshNumber, 
03800         Matrix3& meshTM, Interval& meshTMValid) { return;  }
03801 
03802     // If this returns NULL, then GetRenderMesh will be called
03811     CoreExport virtual PatchMesh* GetRenderPatchMesh(TimeValue t, INode *inode, View& view, BOOL& needDelete);
03812 
03813     CoreExport Class_ID PreferredCollapseType();
03814 
03816     virtual BOOL CanDoDisplacementMapping() { return 0; }
03817 
03818 private:
03819 };
03820 
03821 
03822 //-- Particle Systems ---------------------------------------------------
03823 
03824 // A force field can be applied to a particle system by a SpaceWarp.
03825 // The force field provides a function of position in space, velocity
03826 // and time that gives a force.
03827 // The force is then used to compute an acceleration on a particle
03828 // which modifies its velocity. Typically, particles are assumed to
03829 // to have a normalized uniform mass==1 so the acceleration is F/M = F.
03841 class ForceField : public InterfaceServer {
03842 public:
03851     virtual Point3 Force(TimeValue t,const Point3 &pos, const Point3 &vel, int index)=0;
03852     virtual void SetRandSeed(int seed) {}
03856     virtual void DeleteThis() {}
03857 };
03858 
03859 // A collision object can be applied to a particle system by a SpaceWarp.
03860 // The collision object checks a particle's position and velocity and
03861 // determines if the particle will colide with it in the next dt amount of
03862 // time. If so, it modifies the position and velocity.
03863 
03870 class CollisionObject : public InterfaceServer {
03871 public:
03872     // Check for collision. Return TRUE if there was a collision and the position and velocity have been modified.
03930     virtual BOOL CheckCollision(TimeValue t,Point3 &pos, Point3 &vel, float dt,int index, float *ct=NULL, BOOL UpdatePastCollide=TRUE)=0;
03935     virtual Object *GetSWObject()=0;
03936     virtual void SetRandSeed(int seed) {}
03937     virtual void DeleteThis() {}
03938 };
03939 
03943 #define PARTCENTER_HEAD     1  //!< Particle geometry lies behind the particle position
03944 #define PARTCENTER_CENTER   2  //!< Particle geometry is centered around particle position
03945 #define PARTCENTER_TAIL     3  //!< Particle geometry lies in front of the particle position
03946 
03947 
03948 // The particle system class derived from GeomObject and still has
03949 // GEOMOBJECT_CLASS_ID as its super class.
03950 //
03951 // Given an object, to determine if it is a ParticleObject, call
03952 // GetInterface() with the ID  I_PARTICLEOBJ or use the macro
03953 // GetParticleInterface(anim) which returns a ParticleObject* or NULL.
03954 
03971 class ParticleObject : public GeomObject {
03972 public:
03973     BOOL IsParticleSystem() {return TRUE;}
03974 
03985     virtual void ApplyForceField(ForceField *ff)=0;
03999     virtual BOOL ApplyCollisionObject(CollisionObject *co)=0; // a particle can choose no to support this and return FALSE
04000 
04001     // A particle object IS deformable, but does not let itself be
04002     // deformed using the usual GetPoint/SetPoint methods. Instead
04003     // a space warp must apply a force field to deform the particle system.
04009     int IsDeformable() {return TRUE;} 
04010 
04011     // Particle objects don't actually do a shallow copy and therefore 
04012     // cannot be cached.
04016     BOOL CanCacheObject() {return FALSE;}
04017 
04018 
04027     virtual BOOL NormalAlignVector(TimeValue t,Point3 &pt, Point3 &norm) {pt=Point3(0,0,0);norm=Point3(0,0,-1);return TRUE;}
04028 
04029 
04030     // These methods provide information about individual particles
04065     virtual Point3 ParticlePosition(TimeValue t,int i) {return Point3(0,0,0);}
04071     virtual Point3 ParticleVelocity(TimeValue t,int i) {return Point3(0,0,0);}
04078     virtual float ParticleSize(TimeValue t,int i) {return 0.0f;}
04095     virtual int ParticleCenter(TimeValue t,int i) {return PARTCENTER_CENTER;}
04102     virtual TimeValue ParticleAge(TimeValue t, int i) {return -1;}
04109     virtual TimeValue ParticleLife(TimeValue t, int i) {return -1;}
04110 
04111     // This tells the renderer if the ParticleObject's topology doesn't change over time
04112     // so it can do better motion blur.  This means the correspondence of vertex id to
04113     // geometrical vertex must be invariant.
04119     virtual BOOL HasConstantTopology() { return FALSE; }
04120 };
04121 
04122 //----------------------------------------------------------------------
04123 
04124 
04125 /*------------------------------------------------------------------- 
04126 ShapeObject: these are the open or closed hierarchical shape objects.  
04127 ---------------------------------------------------------------------*/
04128 
04129 class PolyShape;
04130 class BezierShape;
04131 class MeshCapInfo;
04132 class PatchCapInfo;
04133 class ShapeHierarchy;
04134 
04136 
04137 #define GENMESH_DEFAULT -1  //!< Use whatever is stored in the ShapeObject's UseViewport flag
04138 #define GENMESH_VIEWPORT 0
04139 #define GENMESH_RENDER 1
04140 
04141 
04148 #define SHAPE_OBJ_NUM_REFS 1
04149 #define SHAPE_OBJ_NUM_SUBS 1
04150 
04151 
04153 
04154 #define USERPBLOCK SHAPE_OBJ_NUM_REFS       //!< User's parameter block
04155 #define IPBLOCK (SHAPE_OBJ_NUM_REFS + 1)    //!< Interpolations parameter block
04156 
04157 
04158 class IParamBlock;
04159 class IParamMap;
04160 
04161 #define SHAPE_RECT_RENDERPARAMS_PROPID PROPID_USER+10
04162 
04170 class IShapeRectRenderParams : public AnimProperty
04171 {
04172 protected :
04173     ShapeObject *mShape;
04174 public: 
04177     IShapeRectRenderParams(ShapeObject *so) : mShape(so)
04178     {
04179     }
04180 
04184     CoreExport BOOL GetRectangular(TimeValue t) const;
04188     CoreExport void SetRectangular(TimeValue t, BOOL rectangular);
04189 
04193     CoreExport float GetWidth(TimeValue t) const;
04197     CoreExport void SetWidth(TimeValue t, float width);
04198 
04202     CoreExport float GetLength(TimeValue t) const;
04206     CoreExport void SetLength(TimeValue t, float length);
04207 
04211     CoreExport float GetAngle2(TimeValue t) const;
04215     CoreExport void SetAngle2(TimeValue t, float angle);
04216 
04220     CoreExport BOOL GetAspectLock(TimeValue t) const;
04224     CoreExport void SetAspectLock(TimeValue t, BOOL aspectLock);
04225 
04229     CoreExport BOOL GetVPTRectangular(TimeValue t) const;
04233     CoreExport void SetVPTRectangular(TimeValue t, BOOL rectangular);
04234 
04238     CoreExport float GetVPTWidth(TimeValue t) const;
04242     CoreExport void SetVPTWidth(TimeValue t, float width);
04243 
04247     CoreExport float GetVPTLength(TimeValue t) const;
04251     CoreExport void SetVPTLength(TimeValue t, float length);
04252 
04256     CoreExport float GetVPTAngle2(TimeValue t) const;
04260     CoreExport void SetVPTAngle2(TimeValue t, float angle);
04261 
04265     CoreExport BOOL GetVPTAspectLock(TimeValue t) const;
04269     CoreExport void SetVPTAspectLock(TimeValue t, BOOL aspectLock);
04270 
04274     CoreExport BOOL GetAutosmooth(TimeValue t) const;
04278     CoreExport void SetAutosmooth(TimeValue t, BOOL autosmooth);
04279 
04283     CoreExport float GetAutosmoothThreshold(TimeValue t) const;
04287     CoreExport void SetAutosmoothThreshold(TimeValue t, float threshold);
04288 
04291     DWORD ID() { return SHAPE_RECT_RENDERPARAMS_PROPID;}
04292 };
04293 
04342 class ShapeObject : public GeomObject
04343 {
04344     friend class SObjRenderingDlgProc;
04345     friend class ShapePostLoadCallback;
04346     friend class IShapeRectRenderParams;
04347     IObjParam *ip;
04348     IParamBlock *sopblock;  // New for r4, renderable version parameter block
04349     static IParamMap *pmap;
04350     int loadVersion;
04351     // Display mesh cache stuff
04352     Mesh meshCache;
04353     Interval cacheValid;
04354     int cacheType;
04355 
04356 public:
04357     CoreExport ShapeObject();
04358     CoreExport ~ShapeObject();  // Must call this on destruction
04359 
04360     // from InterfaceServer
04361     CoreExport virtual BaseInterface* GetInterface(Interface_ID iid);
04362 
04363     // from GeomObject
04364     CoreExport virtual void* GetInterface(ULONG id);
04365 
04366     // display functions from BaseObject
04367     CoreExport virtual bool RequiresSupportForLegacyDisplayMode() const;
04368     CoreExport virtual bool UpdateDisplay(
04369         unsigned long renderItemCategories, 
04370         const MaxSDK::Graphics::MaterialRequiredStreams& materialRequiredStreams, 
04371         TimeValue t);
04372 
04373     virtual BOOL IsShapeObject() { return TRUE; }
04374 
04384     virtual int IntersectRay(TimeValue t, Ray& ray, float& at, Point3& norm) {return FALSE;}
04385     virtual void InitNodeName(MSTR& s) { s = _M("Shape"); }
04386     SClass_ID SuperClassID() { return SHAPE_CLASS_ID; }
04387     CoreExport virtual int IsRenderable();
04394     CoreExport virtual void CopyBaseData(ShapeObject &from);
04395     // Access methods
04400     CoreExport float GetThickness(TimeValue t, Interval &ivalid);
04405     CoreExport int GetSides(TimeValue t, Interval &ivalid);
04410     CoreExport float GetAngle(TimeValue t, Interval &ivalid);
04413     CoreExport float GetViewportThickness();
04417     CoreExport int GetViewportSides();
04421     CoreExport float GetViewportAngle();
04427     CoreExport BOOL GetRenderable();
04430     CoreExport BOOL GetGenUVs();
04433     CoreExport BOOL GetDispRenderMesh();
04436     CoreExport BOOL GetUseViewport();
04439     CoreExport BOOL GetViewportOrRenderer();
04444     CoreExport void SetThickness(TimeValue t, float thick);
04450     CoreExport void SetSides(TimeValue t, int s);
04455     CoreExport void SetAngle(TimeValue t, float a);
04456     CoreExport void SetViewportThickness(float thick);
04460     CoreExport void SetViewportSides(int s);
04465     CoreExport void SetViewportAngle(float a);
04469     CoreExport void SetRenderable(BOOL sw);
04473     CoreExport void SetGenUVs(BOOL sw);
04476     CoreExport void SetDispRenderMesh(BOOL sw);
04480     CoreExport void SetUseViewport(BOOL sw);
04483     CoreExport void SetViewportOrRenderer(BOOL sw);
04484     CoreExport virtual Mesh* GetRenderMesh(TimeValue t, INode *inode, View& view, BOOL& needDelete);
04492     CoreExport virtual void GetRenderMeshInfo(TimeValue t, INode *inode, View& view, int &nverts, int &nfaces); // Get info on the rendering mesh
04501     CoreExport virtual void GenerateMesh(TimeValue t, int option, Mesh *mesh);
04509     virtual int NumberOfVertices(TimeValue t, int curve = -1) { return 0; } // Informational only, curve = -1: total in all curves
04511     virtual int NumberOfCurves()=0;                 // Number of curve polygons in the shape
04517     virtual BOOL CurveClosed(TimeValue t, int curve)=0;     // Returns TRUE if the curve is closed
04528     virtual Point3 InterpCurve3D(TimeValue t, int curve, float param, int ptype=PARAM_SIMPLE)=0;    // Interpolate from 0-1 on a curve
04539     virtual Point3 TangentCurve3D(TimeValue t, int curve, float param, int ptype=PARAM_SIMPLE)=0;   // Get tangent at point on a curve
04561     virtual float LengthOfCurve(TimeValue t, int curve)=0;  // Get the length of a curve
04565     virtual int NumberOfPieces(TimeValue t, int curve)=0;   // Number of sub-curves in a curve
04579     virtual Point3 InterpPiece3D(TimeValue t, int curve, int piece, float param, int ptype=PARAM_SIMPLE)=0; // Interpolate from 0-1 on a sub-curve
04590     virtual Point3 TangentPiece3D(TimeValue t, int curve, int piece, float param, int ptype=PARAM_SIMPLE)=0;        // Get tangent on a sub-curve
04600     virtual MtlID GetMatID(TimeValue t, int curve, int piece) { return 0; }
04605     virtual BOOL CanMakeBezier() { return FALSE; }                  // Return TRUE if can turn into a bezier representation
04609     virtual void MakeBezier(TimeValue t, BezierShape &shape) {}     // Create the bezier representation
04615     virtual ShapeHierarchy &OrganizeCurves(TimeValue t, ShapeHierarchy *hier=NULL)=0;       // Ready for lofting, extrusion, etc.
04625     virtual void MakePolyShape(TimeValue t, PolyShape &shape, int steps = PSHAPE_BUILTIN_STEPS, BOOL optimize = FALSE)=0;   // Create a PolyShape representation with optional fixed steps & optimization
04631     virtual int MakeCap(TimeValue t, MeshCapInfo &capInfo, int capType)=0;  // Generate mesh capping info for the shape
04637     virtual int MakeCap(TimeValue t, PatchCapInfo &capInfo) { return 0; }   // Only implement if CanMakeBezier=TRUE -- Gen patch cap info
04651     virtual BOOL AttachShape(TimeValue t, INode *thisNode, INode *attachNode, BOOL weldEnds=FALSE, float weldThreshold=0.0f) { return FALSE; }  // Return TRUE if attached
04652     // UVW Mapping switch access
04653     virtual BOOL HasUVW() { return GetGenUVs(); }
04654     virtual BOOL HasUVW (int mapChannel) { return (mapChannel==1) ? HasUVW() : FALSE; }
04655     virtual void SetGenUVW(BOOL sw) { SetGenUVs(sw); }
04656     virtual void SetGenUVW (int mapChannel, BOOL sw) { if (mapChannel==1) SetGenUVW (sw); }
04657     // These handle loading and saving the data in this class. Should be called
04658     // by derived class BEFORE it loads or saves any chunks
04665     CoreExport virtual IOResult Save(ISave *isave);
04672     CoreExport virtual IOResult Load(ILoad *iload);     
04673 
04677     CoreExport virtual Class_ID PreferredCollapseType();
04681     CoreExport virtual BOOL GetExtendedProperties(TimeValue t, MSTR &prop1Label, MSTR &prop1Data, MSTR &prop2Label, MSTR &prop2Data);
04703     CoreExport virtual void RescaleWorldUnits(float f);
04704     // New reference support for r4
04730     CoreExport virtual RefResult ShapeObject::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message );
04741     CoreExport virtual RefTargetHandle GetReference(int i);
04750 protected:
04751     CoreExport virtual void SetReference(int i, RefTargetHandle rtarg);
04752 public:
04760     CoreExport virtual Animatable* SubAnim(int i);
04768     CoreExport virtual MSTR SubAnimName(int i);
04773     CoreExport ParamDimension *GetParameterDim(int pbIndex);
04776     CoreExport MSTR GetParameterName(int pbIndex);
04798     CoreExport virtual int RemapRefOnLoad(int iref);
04799     
04807     virtual int NumRefs() {return 1;}
04808     virtual int NumSubs() {return 1;}
04822     CoreExport void BeginEditParams( IObjParam *ip, ULONG flags,Animatable *prev);
04823     
04838     CoreExport void EndEditParams( IObjParam *ip, ULONG flags,Animatable *next);
04839     
04840     // Get the validity of the ShapeObject parts
04849     CoreExport Interval GetShapeObjValidity(TimeValue t);
04850     // The following displays the shape's generated mesh if necessary
04873     CoreExport int Display(TimeValue t, INode *inode, ViewExp* vpt, int flags);
04874     
04875     // Get the bounding box for the shape, if it's active.  Leaves bbox unchanged if not.
04884     CoreExport virtual Box3 GetBoundingBox(TimeValue t, Matrix3 *tm=NULL);
04885     
04892     CoreExport virtual void InvalidateGeomCache();
04893 
04895 
04901     int SetProperty(ULONG id, void *data) 
04902     {
04903         AnimProperty *prop = (AnimProperty *)GetProperty(id);
04904         if (prop) prop = (AnimProperty*)data;
04905         else 
04906         {
04907             prop = (AnimProperty *)data;
04908             aprops.Append(1, &prop);
04909         }
04910         return 1;
04911     }
04912 
04914 
04918     void *GetProperty(ULONG id) 
04919     {   
04920         for(int i = 0;i<aprops.Count();i++)
04921             if (aprops[i] && aprops[i]->ID() == id )
04922                 return aprops[i];
04923         return NULL;
04924     }
04925 
04926     // Get/Set the UsePhyicalScaleUVs flag.  When true, the UV's
04927     // assigned to renderable spline are scaled to the size
04928     // of the object.
04930     CoreExport BOOL GetUsePhysicalScaleUVs();
04932     CoreExport void SetUsePhysicalScaleUVs(BOOL flag);
04933 
04934 private:
04935 
04939     void SetAspect(HWND hWnd);
04945     float GetAspect(TimeValue t, BOOL viewport);
04946     void CheckAspectLock(HWND hWnd);
04950     void OnAspectChange(HWND hWnd);
04951     void OnLengthWidthChange(HWND hWnd, BOOL lengthChange);
04955     BOOL UseViewOrRenderParams();
04956     BOOL CanLockAspect(BOOL vpt);
04957 };
04958 
04959 // Set ShapeObject's global Constant Cross-Section angle threshold (angle in radians) --
04960 // Used for renderable shapes.
04961 CoreExport void SetShapeObjectCCSThreshold(float angle);
04962 
04963 /*------------------------------------------------------------------- 
04964 WSMObject : This is the helper object for the WSM modifier
04965 ---------------------------------------------------------------------*/
04966 
04972 class WSMObject : public Object {
04973 public:                                         
04977     SClass_ID SuperClassID() { return WSM_OBJECT_CLASS_ID; }                
04983     virtual Modifier *CreateWSMMod(INode *node)=0;
04984     
04987     virtual int UsesWireColor() { return FALSE; }   // TRUE if the object color is used for display
04988     
04991     virtual BOOL NormalAlignVector(TimeValue t,Point3 &pt, Point3 &norm) {pt=Point3(0,0,0);norm=Point3(0,0,-1);return TRUE;}
04992     
04995     virtual BOOL SupportsDynamics() { return FALSE; } // TRUE if spacewarp or collision object supports Dynamics
04996 
05005     virtual ForceField *GetForceField(INode *node) {return NULL;}
05006         
05010     virtual CollisionObject *GetCollisionObject(INode *node) {return NULL;}     
05011 
05012     CoreExport void* GetInterface(ULONG id);
05013 };
05014 
05015 
05016 //---------------------------------------------------------------------------------
05017 
05018 
05019 class ControlMatrix3;
05020 
05021 // Used with EnumModContexts()
05022 
05027 class ModContextEnumProc: public MaxHeapOperators {
05028 public:
05030     virtual ~ModContextEnumProc() {;}
05036     virtual BOOL proc(ModContext *mc)=0;  // Return FALSE to stop, TRUE to continue.
05037 };
05038 
05039 /*------------------------------------------------------------------- 
05040 Modifier: these are the ObjectSpace and World Space modifiers: They are 
05041 subclassed off of BaseObject so that they can put up a graphical 
05042 representation in the viewport. 
05043 ---------------------------------------------------------------------*/
05044 
05053 class Modifier : public BaseObject {
05054     friend class ModNameRestore;
05055     MSTR modName;
05056 public:
05057 
05058     CoreExport Modifier();
05059     CoreExport ~Modifier();
05060 
05063     CoreExport virtual MSTR GetName();
05067     CoreExport virtual void SetName(MSTR n);
05068 
05069     SClass_ID SuperClassID() { return OSM_CLASS_ID; }
05070 
05071     // Disables all mod apps that reference this modifier _and_ have a select
05072     // anim flag turned on.
05074     void DisableModApps() { NotifyDependents(FOREVER,PART_OBJ,REFMSG_DISABLE); }
05076     void EnableModApps() {  NotifyDependents(FOREVER,PART_OBJ,REFMSG_ENABLE); }
05077 
05078     // This disables or enables the mod. All mod apps referencing will be affected.
05081     void DisableMod() { 
05082         SetAFlag(A_MOD_DISABLED);
05083         NotifyDependents(FOREVER, (PartID)(PART_ALL|PART_OBJECT_TYPE),REFMSG_CHANGE); 
05084     }
05087     void EnableMod() {      
05088         ClearAFlag(A_MOD_DISABLED);
05089         NotifyDependents(FOREVER, (PartID)(PART_ALL|PART_OBJECT_TYPE), REFMSG_CHANGE); 
05090     }
05096     int IsEnabled() { return !TestAFlag(A_MOD_DISABLED); }
05097 
05098     // Same as above but for viewports only
05102     void DisableModInViews() { 
05103         SetAFlag(A_MOD_DISABLED_INVIEWS);
05104         NotifyDependents(FOREVER, (PartID)(PART_ALL|PART_OBJECT_TYPE), REFMSG_CHANGE); 
05105     }
05108     void EnableModInViews() {      
05109         ClearAFlag(A_MOD_DISABLED_INVIEWS);
05110         NotifyDependents(FOREVER,(PartID)(PART_ALL|PART_OBJECT_TYPE), REFMSG_CHANGE); 
05111     }
05115     int IsEnabledInViews() { return !TestAFlag(A_MOD_DISABLED_INVIEWS); }
05116 
05117     // Same as above but for renderer only
05121     void DisableModInRender() { 
05122         SetAFlag(A_MOD_DISABLED_INRENDER);
05123         NotifyDependents(FOREVER,(PartID)(PART_ALL|PART_OBJECT_TYPE), REFMSG_CHANGE); 
05124     }
05128     void EnableModInRender() {      
05129         ClearAFlag(A_MOD_DISABLED_INRENDER);
05130         NotifyDependents(FOREVER,(PartID)(PART_ALL|PART_OBJECT_TYPE), REFMSG_CHANGE); 
05131     }
05137     int IsEnabledInRender() { return !TestAFlag(A_MOD_DISABLED_INRENDER); }
05138 
05157     CoreExport virtual Interval LocalValidity(TimeValue t);
05168     virtual ChannelMask ChannelsUsed()=0;
05173     virtual ChannelMask ChannelsChanged()=0;
05174     // this is used to invalidate cache's in Edit Modifiers:
05217     virtual void NotifyInputChanged(Interval changeInt, PartID partID, RefMessage message, ModContext *mc) {}
05218 
05219     // This method indicates if the modifier changes the selection type channel or not.
05220     // If a modifier wants to change dynamically if it changes the subobj sel type
05221     // or not, it can overwrite this method.
05222     // ChannelsChanged() however can not be dynamically implemented.
05229     virtual bool ChangesSelType(){ return ChannelsChanged()&SUBSEL_TYPE_CHANNEL ? true : false;}
05230 
05231     // These call ChannelsUsed/Changed() but also OR in GFX_DATA_CHANNEL as appropriate.
05235     CoreExport ChannelMask TotalChannelsUsed();
05240     CoreExport ChannelMask TotalChannelsChanged();
05241 
05242     // This is the method that is called when the modifier is needed to 
05243     // apply its effect to the object. Note that the INode* is always NULL
05244     // for object space modifiers.
05260     virtual void ModifyObject(TimeValue t, ModContext &mc, ObjectState* os, INode *node)=0;
05261 
05262     // this should return FALSE for things like edit modifiers
05264     virtual int NeedUseSubselButton() { return 1; }
05265 
05266     // Modifiers that place a dependency on topology should return TRUE
05267     // for this method. An example would be a modifier that stores a selection
05268     // set base on vertex indices.
05275     virtual BOOL DependOnTopology(ModContext &mc) {return FALSE;}
05276 
05277     // this can return:
05278     //   DEFORM_OBJ_CLASS_ID -- not really a class, but so what
05279     //   MAPPABLE_OBJ_CLASS_ID -- ditto
05280     //   TRIOBJ_CLASS_ID
05281     //   BEZIER_PATCH_OBJ_CLASS_ID
05290     virtual Class_ID InputType()=0;
05291 
05292     virtual void ForceNotify(Interval& i) 
05293     {NotifyDependents(i,ChannelsChanged(),REFMSG_CHANGE );}
05294 
05302     virtual IOResult SaveLocalData(ISave *isave, LocalModData *ld) { return IO_OK; }  
05311     virtual IOResult LoadLocalData(ILoad *iload, LocalModData **pld) { return IO_OK; }  
05312 
05313     // These handle loading and saving the modifier name. Should be called
05314     // by derived class BEFORE it loads or saves any chunks
05333     CoreExport IOResult Save(ISave *isave);
05337     CoreExport IOResult Load(ILoad *iload);
05338 
05339     // This will call proc->proc once for each application of the modifier.
05345     CoreExport void EnumModContexts(ModContextEnumProc *proc);
05346 
05347     // This method will return the IDerivedObject and index of this modifier 
05348     // for a given modifier context.
05354     CoreExport void GetIDerivedObject(ModContext *mc, IDerivedObject *&derObj, int &modIndex);
05355 
05356     // In case the modifier changes the object type (basically the os->obj pointer in ModifyObject)
05357     // *and* changes the ExtensionChannel, it has to overwrite this method and copy only the channels
05358     // that it doesn't modify/added already to the new object.
05365     CoreExport virtual void CopyAdditionalChannels(Object *fromObj, Object *toObj) { toObj->CopyAdditionalChannels(fromObj);}
05366 
05367     // Animatable Overides...
05368     CoreExport SvGraphNodeReference SvTraverseAnimGraph(IGraphObjectManager *gom, Animatable *owner, int id, DWORD flags);
05369     CoreExport MSTR SvGetName(IGraphObjectManager *gom, IGraphNode *gNode, bool isBeingEdited);
05370     CoreExport bool SvCanSetName(IGraphObjectManager *gom, IGraphNode *gNode);
05371     CoreExport bool SvSetName(IGraphObjectManager *gom, IGraphNode *gNode, MSTR &name);
05372     CoreExport bool SvHandleDoubleClick(IGraphObjectManager *gom, IGraphNode *gNode);
05373     CoreExport COLORREF SvHighlightColor(IGraphObjectManager *gom, IGraphNode *gNode);
05374     CoreExport bool SvIsSelected(IGraphObjectManager *gom, IGraphNode *gNode);
05375     CoreExport MultiSelectCallback* SvGetMultiSelectCallback(IGraphObjectManager *gom, IGraphNode *gNode);
05376     CoreExport bool SvCanSelect(IGraphObjectManager *gom, IGraphNode *gNode);
05377     CoreExport bool SvCanInitiateLink(IGraphObjectManager *gom, IGraphNode *gNode);
05378     CoreExport bool SvCanConcludeLink(IGraphObjectManager *gom, IGraphNode *gNode, IGraphNode *gNodeChild);
05379     CoreExport bool SvLinkChild(IGraphObjectManager *gom, IGraphNode *gNodeThis, IGraphNode *gNodeChild);
05380     CoreExport bool SvCanRemoveThis(IGraphObjectManager *gom, IGraphNode *gNode);
05381     CoreExport bool SvRemoveThis(IGraphObjectManager *gom, IGraphNode *gNode);
05382 
05383 private:
05384 };
05385 
05390 class OSModifier : public Modifier {
05391 public:
05394     SClass_ID SuperClassID() { return OSM_CLASS_ID; }
05395 };
05396 
05402 class WSModifier : public Modifier {
05403 public:
05406     SClass_ID SuperClassID() { return WSM_CLASS_ID; }
05407 };
05408 
05409 CoreExport void MakeHitRegion(HitRegion& hr, int type, int crossing, int epsi, IPoint2 *p);
05410 
05430 class PolyLineProc: public MaxHeapOperators {
05431 public:
05433     virtual ~PolyLineProc() {;}
05437     virtual int proc(Point3 *p, int n)=0;
05442     virtual void SetLineColor(float r, float g, float b) {}
05443     virtual void SetLineColor(Point3 c) {}
05444     virtual void Marker(Point3 *p,MarkerType type) {}
05445 };
05446 #pragma warning(pop)
05447 
05452 class DrawLineProc : public PolyLineProc {
05453     GraphicsWindow *gw;
05454 public:
05456     DrawLineProc() { gw = NULL; }
05458     DrawLineProc(GraphicsWindow *g) { gw = g; }
05464     int proc(Point3 *p, int n) { gw->polyline(n, p, NULL, NULL, 0, NULL); return 0; }
05470     void SetLineColor(float r, float g, float b) {gw->setColor(LINE_COLOR,r,g,b);}
05471     void SetLineColor(Point3 c) {gw->setColor(LINE_COLOR,c);}
05472     void Marker(Point3 *p,MarkerType type) {gw->marker(p,type);}
05473 };
05474 
05475 
05481 class BoxLineProc : public PolyLineProc {
05482     Box3 box;
05483     Matrix3 *tm;
05484 public:
05486     BoxLineProc() { box.Init();}
05489     BoxLineProc(Matrix3* m) { tm = m;  box.Init(); }
05491     Box3& Box() { return box; }
05498     CoreExport int proc(Point3 *p, int n);
05499     CoreExport void Marker(Point3 *p,MarkerType type);
05500 };
05501 
05502 
05503 // Apply the PolyLineProc to each edge (represented by an array of Point3's) of the box
05504 // after passing it through the Deformer def.
05505 CoreExport void DoModifiedBox(Box3& box, Deformer &def, PolyLineProc& lp);
05506 CoreExport void DoModifiedLimit(Box3& box, float z, int axis, Deformer &def, PolyLineProc& lp);
05507 CoreExport void DrawCenterMark(PolyLineProc& lp, Box3& box );
05508 
05509 // Some functions to draw mapping icons
05510 CoreExport void DoSphericalMapIcon(BOOL sel,float radius, PolyLineProc& lp);
05511 CoreExport void DoCylindricalMapIcon(BOOL sel,float radius, float height, PolyLineProc& lp);
05512 CoreExport void DoPlanarMapIcon(BOOL sel,float width, float length, PolyLineProc& lp);
05513 
05514 //---------------------------------------------------------------------
05515 // Data structures for keeping log of hits during sub-object hit-testing.
05516 //---------------------------------------------------------------------
05517 
05518 class HitLog;
05519 
05547 class HitRecord: public MaxHeapOperators {
05548     friend class HitLog;    
05549     HitRecord *next;
05550 public:         
05551     INode *nodeRef;
05552     ModContext *modContext;
05553     DWORD distance;
05554     ulong hitInfo;
05555     HitData *hitData;
05559     HitRecord() { next = NULL; modContext = NULL; distance = 0; hitInfo = 0; hitData = NULL;}
05562     HitRecord(INode *nr, ModContext *mc, DWORD d, ulong inf, HitData *hitdat) {
05563         next = NULL;
05564         nodeRef = nr; modContext = mc; distance = d; hitInfo = inf; hitData = hitdat;
05565     }               
05568     HitRecord(HitRecord *n,INode *nr, ModContext *mc, DWORD d, ulong inf, HitData *hitdat) {
05569         next = n;
05570         nodeRef = nr; modContext = mc; distance = d; hitInfo = inf; hitData = hitdat;
05571     }               
05575     HitRecord *     Next() { return next; }
05578     CoreExport ~HitRecord();
05579 };                                      
05580 
05586 class HitLog: public MaxHeapOperators {
05587     HitRecord *first;
05588     int hitIndex;
05589     bool hitIndexReady;         // CAL-07/10/03: hitIndex is ready to be increased.
05590 public:
05592     HitLog()  { first = NULL; hitIndex = 0; hitIndexReady = false; }
05594     ~HitLog() { Clear(); }
05596     CoreExport void Clear();
05597     CoreExport void ClearHitIndex(bool ready = false)       { hitIndex = 0; hitIndexReady = ready; }
05598     CoreExport void IncrHitIndex()      { if (hitIndexReady) hitIndex++; else hitIndexReady = true; }
05601     HitRecord* First() { return first; }
05606     CoreExport HitRecord* ClosestHit();
05622     CoreExport void LogHit(INode *nr, ModContext *mc, DWORD dist, ulong info, HitData *hitdat = NULL);
05623 };
05624 
05625 
05626 // Creates a new empty derived object, sets it to point at the given
05627 // object and returns a pointer to the derived object.
05632 CoreExport Object *MakeObjectDerivedObject(Object *obj);
05633 
05635 
05636 #define SPACEWARP_CAT_GEOMDEF       1
05637 #define SPACEWARP_CAT_MODBASED      2
05638 #define SPACEWARP_CAT_PARTICLE      3
05639 
05640 
05641 CoreExport MCHAR *GetSpaceWarpCatString(int id);
05642 
05643 // ObjectConverter - allows users to register methods to (for example)
05644 // allow Max to convert TriObjects directly into their plug-in object type.
05645 
05662 class ObjectConverter : public InterfaceServer {
05663 public:
05666     virtual Class_ID ConvertsFrom ()=0;
05669     virtual Class_ID ConvertsTo ()=0;
05670     // NOTE: There's a serious problem in that this method does not accept a TimeValue.
05671     // See below for details.
05675     virtual Object *Convert (Object *from)=0;
05677     virtual void DeleteThis () { }
05678 };
05679 
05680 // There was a problem in the above ObjectConverter class in that its Convert
05681 // method doesn't accept a time parameter.  It's too late to change that, so we've
05682 // implemented the following interface to supply the correct method.  Users'
05683 // ObjectConverters should subclass off of both ObjectConverter and
05684 // ITimeBasedConverter.  They should implement the GetInterface method as
05685 // follows:
05686 //BaseInterface *MyConverter::GetInterface (Interface_ID id) {
05687 //if (id == INTERFACE_TIME_BASED_CONVERTER) return (ITimeBasedConverter *)this;
05688 //return ObjectConverter::GetInterface (id);
05689 //}
05690 // They should then implement ConvertWithTime properly, and use Convert only
05691 // to call ConvertWithTime with a time of GetCOREInterface()->GetTime().
05692 // Convert should not be called (and won't be called by the system if this
05693 // interface is properly set up).
05694 
05695 #define INTERFACE_TIME_BASED_CONVERTER Interface_ID(0x1e064bad,0x716643db)
05696 
05697 class ITimeBasedConverter : public BaseInterface {
05698 public:
05699     Interface_ID GetID () { return INTERFACE_TIME_BASED_CONVERTER; }
05700     // This is the method that should be used to do the right conversion:
05701     virtual Object *ConvertWithTime (TimeValue t, Object *from)=0;
05702 };
05703 
05707 CoreExport bool RegisterObjectConverter (ObjectConverter *conv);
05721 CoreExport int CanConvertTriObject (Class_ID to);
05726 CoreExport int CanConvertPatchObject (Class_ID to);
05731 CoreExport int CanConvertSplineShape (Class_ID to);
05734 CoreExport void RegisterStaticEditTri (Object *triob);
05743 CoreExport void RegisterCollapseType (Class_ID cid, MSTR name, bool canSelfConvert=false);
05744 
05745 // Developers have to return a class derived from this class with implementations for 
05746 // all memberfunctions when implementing subobjects for obejcts and modifiers (see GetSubObjType())
05747 
05748 
05754 class ISubObjType : public InterfaceServer
05755 {
05756 public:
05759     virtual MaxIcon *GetIcon()=0;
05762     virtual MCHAR *GetName()=0;
05763 };
05764 
05765 // Generic implementation for subobject types. This SubObjectType will either use the 
05766 // SubObjectIcons_16i.bmp and  SubObjectIcons_16a.bmp bitmaps in the UI directory 
05767 // (for the GenSubObjType(int idx) constructor), or any other bmp file that is specified
05768 // in the GenSubObjType(MCHAR *nm, MCHAR* pFilePrefix, int idx) constructor. The 
05769 // bitmap files have to reside in the UI directory.
05770 
05784 class GenSubObjType : public ISubObjType {
05785     MSTR name;
05786     MaxIcon *mIcon;
05787     int mIdx;
05788     MSTR mFilePrefix;
05789 
05790 public:
05802     GenSubObjType(MCHAR *nm, MCHAR* pFilePrefix, int idx) : name(nm), mIcon(NULL), mIdx(idx), mFilePrefix(pFilePrefix) {}
05803 
05809     GenSubObjType(int idx) : mIcon(NULL), mIdx(idx), mFilePrefix(_M("SubObjectIcons")) {}
05810 
05812     CoreExport ~GenSubObjType();
05815     void SetName(MCHAR *nm){name = nm;}
05818     MCHAR *GetName() { return name;}
05821     CoreExport MaxIcon *GetIcon(); 
05822 };
05823