00001
00002
00004
00024 #if !defined(AFX_AVIARY_H__2A021471_6B37_458F_BF41_D73CEC91E67F__INCLUDED_)
00025 #define AFX_AVIARY_H__2A021471_6B37_458F_BF41_D73CEC91E67F__INCLUDED_
00026
00027 #if _MSC_VER > 1000
00028 #pragma once
00029 #endif // _MSC_VER > 1000
00030
00031
00032
00033 #include <ltengineobjects.h>
00034
00035
00036 #include "helper.h"
00037 #include "textstream.h"
00038
00039
00040 #include <iltcommon.h>
00041 #include <iltphysics.h>
00042 #include <iltmodel.h>
00043 #include <physics/collision_mgr.h>
00044
00045 #include "Aria.h"
00046 #include "boidmodel.h"
00047
00048 #include "vector"
00049 using namespace std;
00050
00051 class Aviary
00052 {
00053 public:
00054 #if 0 // I've deprecated the simple constructors
00055 Aviary();
00057 Aviary(float maxVelocity, float maxAcceleration);
00058 #endif
00059
00060 Aviary(BoidType m_boidType,char *modelFileName,char *textureFile,
00061 char *renderStyleSet, float scale, float mass,
00062 float maxVelocity, float maxAcceleration, bool circleDirection);
00063
00064 virtual ~Aviary();
00065
00067 void Behave(HOBJECT hObject, float fFrameTime);
00068
00070 LTRESULT GenBoid(LTVector3f startPoint);
00071
00073 LTRESULT KillBoid();
00075 LTRESULT KillBoid(CBoidModel *pBoid);
00076
00077
00078
00082 inline void setSeekPoint(const LTVector3f &dest) {
00083 m_seekPoints[0]=dest;
00084 m_seekPointWeights[0]=1;
00085 }
00086
00090 inline void getSeekPoint(LTVector3f *dest) { *dest=m_seekPoints[0]; }
00091
00093 inline void setSeekPoint(BoidDestination which,LTVector3f &dest) {
00094 m_seekPoints[which]=dest;
00095 }
00096
00101 inline void getSeekPoint(BoidDestination which,LTVector3f *dest) {
00102 *dest=m_seekPoints[which];
00103 }
00104
00106 inline LTVector3f getSeekPoint(BoidDestination which) {
00107 return m_seekPoints[which];
00108 }
00109
00111 inline void setSeekPointWeight(BoidDestination which,float weight) {
00112 m_seekPointWeights[which]=weight;
00113 }
00114
00116 inline float getSeekPointWeight(BoidDestination which) {
00117 return m_seekPointWeights[which];
00118 }
00119
00121 inline void setRadius(float rad) { m_birdRadius=rad; }
00122
00124 inline float getRadius() { return m_birdRadius; }
00125
00127 inline int getNumBoids() { return m_boids.size(); }
00128
00129
00130 inline void setMaxSpeed(const float &x) { m_maxSpeed=x; }
00131 inline void setMaxForce(const float &x) { m_maxForce=x; }
00132 inline float getMaxSpeed() { return m_maxSpeed; }
00133 inline float getMaxForce() { return m_maxForce; }
00134
00136 void populateDefaultAviary();
00137
00138 protected:
00140 void issueNewSeekPoint(LTVector3f *dest);
00142 BoidDestination selectNewSeekPoint();
00143
00144 BoidBehavior m_style;
00145 LTVector3f m_seekPoints[AV_NUMSEEKPOINTS];
00146 float m_seekPointWeights[AV_NUMSEEKPOINTS];
00147
00148 float m_maxSpeed;
00149 float m_maxForce;
00150 float m_birdRadius;
00151 bool m_bCircleDirection;
00152
00153 BoidType m_boidType;
00154
00155 vector<CBoidModel *> m_boids;
00156
00157
00158
00159 ObjectCreateStruct m_ocs;
00160
00167 void initInternalOCS(BoidType m_boidType,char *modelFileName,char *textureFile,
00168 char *renderStyleSet, float scale, float mass,
00169 float maxVelocity, float maxAcceleration);
00170
00172 void BirdHasReachedPoint(CBoidModel *pBoid);
00173
00174 #if 0
00175 #define m_weight 10.0f
00176 #else
00177 float m_weight;
00178 #endif
00179
00180 };
00181
00182 #endif // !defined(AFX_AVIARY_H__2A021471_6B37_458F_BF41_D73CEC91E67F__INCLUDED_)