Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007 #pragma once
00008
00009 #include "..\maxheap.h"
00010 #include "..\iparamm2.h"
00011 #include "..\control.h"
00012
00013 #define MAXBHVRNAME 256
00014
00019 #define BHVR_SETS_FORCE 0x00000001 //!< flag indicating that a behavior sets a force
00020 #define BHVR_SETS_GOAL 0x00000002 //!< flag indicating that a behavior sets a goal
00021 #define BHVR_SETS_SPEED 0x00000004 //!< flag indicating that a behavior sets the speed
00022
00023
00025 #define BEHAVIOR_SUPER_CLASS_ID REF_TARGET_CLASS_ID //!< behavior super class id
00026
00029 struct PerformOut: public MaxHeapOperators
00030 {
00032 Point3 frc;
00034 Point3 goal;
00036 float speedwt;
00038 float speedAtGoalwt;
00039 };
00040
00043 struct ConstraintInOut: public MaxHeapOperators
00044 {
00046 Point3 vel;
00048 float speed;
00050 Point3 pos;
00052 Point3 desGoal;
00053
00054 };
00055
00057 class BaseBehavior: public ReferenceTarget {
00058 public:
00059 enum BEHAVIOR_TYPE
00060 {
00061 FORCE = 0,
00062 CONSTRAINT,
00063 ORIENTATION
00064 };
00065
00066 BaseBehavior() {}
00067
00070
00071
00072
00077 SClass_ID SuperClassID() { return BEHAVIOR_SUPER_CLASS_ID; }
00078
00079 #pragma warning(push)
00080 #pragma warning(disable:4100)
00081
00083
00087 virtual void SetName(const MCHAR *newname) {}
00088
00090
00095 virtual const MCHAR *GetName() {return NULL;}
00096
00098
00116 virtual BEHAVIOR_TYPE BehaviorType() {return FORCE;}
00117
00119
00123 virtual BOOL IsWeightable()
00124 {if (BehaviorType() == BaseBehavior::CONSTRAINT) return FALSE;
00125 if (BehaviorType() == BaseBehavior::ORIENTATION) return FALSE;
00126 return TRUE;}
00127
00129
00132 virtual int CanConvertToMaxScript() {return FALSE;}
00134
00139
00140
00141
00154 virtual void SetUpDelegates(INodeTab& participants){};
00155
00157
00163 virtual void BehaviorStarted(TimeValue t, INode *node){};
00164
00166
00171 virtual void InitAtThisTime(TimeValue t){}
00172
00174
00195 virtual void InitBeforeSim(int FirstFrame, INode *n, int SimStart, int AssignIndex) {}
00197
00202
00203
00204
00247 virtual int Perform(INode *node, TimeValue t, int numsubsamples, BOOL DisplayHelpers,
00248 float BhvrWeight, PerformOut &out) {return FALSE;}
00249
00251
00287 virtual int Constraint(INode *node,
00288 TimeValue t,
00289 int numsubsamples,
00290 BOOL DesGoalExists,
00291 BOOL DisplayHelpers,
00292 BOOL finalSet,
00293 ConstraintInOut &inOut) {return FALSE;}
00294
00296
00306 virtual int Orient(const Point3 &vel,INode *node, TimeValue t,Quat &quat) {return FALSE;}
00308
00314
00315
00316
00322 virtual int Display(TimeValue t, ViewExp *vpt) {return 0;}
00323
00328 virtual void GetWorldBoundBox(TimeValue t, ViewExp *vpt, Box3& box ) {}
00330 #pragma warning(pop)
00331 };
00332
00333