2004-03-03 20:26:06 +00:00
|
|
|
// FGAIThermal - AIBase derived class creates an AI thunderstorm
|
|
|
|
//
|
|
|
|
// Written by David Culp, started Feb 2004.
|
|
|
|
//
|
|
|
|
// Copyright (C) 2004 David P. Culp - davidculp2@comcast.net
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License as
|
|
|
|
// published by the Free Software Foundation; either version 2 of the
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful, but
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
#ifndef _FG_AIThermal_HXX
|
|
|
|
#define _FG_AIThermal_HXX
|
|
|
|
|
|
|
|
#include "AIManager.hxx"
|
|
|
|
#include "AIBase.hxx"
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
SG_USING_STD(string);
|
|
|
|
|
|
|
|
|
|
|
|
class FGAIThermal : public FGAIBase {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
FGAIThermal(FGAIManager* mgr);
|
|
|
|
~FGAIThermal();
|
|
|
|
|
|
|
|
bool init();
|
|
|
|
virtual void bind();
|
|
|
|
virtual void unbind();
|
|
|
|
void update(double dt);
|
|
|
|
|
David Culp:
I added some things to the AI stuff to improve the AIThermal processing.
Before, all the thermals were processed in order, and the last one overwrote
the prior one. Now, only the data from the nearest thermal is kept. This
way a tile can be populated with many thermals, and (as long as they have the
same diameter) the one nearest the airplane correctly takes effect. This
will make us ready for the next step, "auto-thermaling", where FlightGear's
tile manager can cover a tile with thermals, and set the thermal strength
based on land-use type.
I moved the enumerated object_type to the base class. When an AI object is
created it now sets the _otype variable in the base class. This lets the AI
manager find out what kind of AI object it is dealing with, using the base
pointer. I also added a function isa() to the base class, so the manager can
process objects differently based on their type.
The AI manager now sends AIThermal processing to a different function, where
only the data from the nearest thermal is kept. After the manager processes
all the AI objects, then the results from the nearest thermal are applied to
wind-from-down.
2004-03-07 12:08:46 +00:00
|
|
|
inline void setMaxStrength( double s ) { max_strength = s; };
|
2004-03-03 20:26:06 +00:00
|
|
|
inline void setDiameter( double d ) { diameter = d; };
|
2004-11-07 14:46:21 +00:00
|
|
|
inline void setHeight( double h ) { height = h; };
|
David Culp:
I added some things to the AI stuff to improve the AIThermal processing.
Before, all the thermals were processed in order, and the last one overwrote
the prior one. Now, only the data from the nearest thermal is kept. This
way a tile can be populated with many thermals, and (as long as they have the
same diameter) the one nearest the airplane correctly takes effect. This
will make us ready for the next step, "auto-thermaling", where FlightGear's
tile manager can cover a tile with thermals, and set the thermal strength
based on land-use type.
I moved the enumerated object_type to the base class. When an AI object is
created it now sets the _otype variable in the base class. This lets the AI
manager find out what kind of AI object it is dealing with, using the base
pointer. I also added a function isa() to the base class, so the manager can
process objects differently based on their type.
The AI manager now sends AIThermal processing to a different function, where
only the data from the nearest thermal is kept. After the manager processes
all the AI objects, then the results from the nearest thermal are applied to
wind-from-down.
2004-03-07 12:08:46 +00:00
|
|
|
inline double getStrength() const { return strength; };
|
|
|
|
inline double getDiameter() const { return diameter; };
|
2004-11-07 14:46:21 +00:00
|
|
|
inline double getHeight() const { return height; };
|
2004-03-03 20:26:06 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
double dt;
|
|
|
|
void Run(double dt);
|
David Culp:
I added some things to the AI stuff to improve the AIThermal processing.
Before, all the thermals were processed in order, and the last one overwrote
the prior one. Now, only the data from the nearest thermal is kept. This
way a tile can be populated with many thermals, and (as long as they have the
same diameter) the one nearest the airplane correctly takes effect. This
will make us ready for the next step, "auto-thermaling", where FlightGear's
tile manager can cover a tile with thermals, and set the thermal strength
based on land-use type.
I moved the enumerated object_type to the base class. When an AI object is
created it now sets the _otype variable in the base class. This lets the AI
manager find out what kind of AI object it is dealing with, using the base
pointer. I also added a function isa() to the base class, so the manager can
process objects differently based on their type.
The AI manager now sends AIThermal processing to a different function, where
only the data from the nearest thermal is kept. After the manager processes
all the AI objects, then the results from the nearest thermal are applied to
wind-from-down.
2004-03-07 12:08:46 +00:00
|
|
|
double max_strength;
|
2004-03-03 20:26:06 +00:00
|
|
|
double strength;
|
|
|
|
double diameter;
|
2004-11-07 14:46:21 +00:00
|
|
|
double height;
|
David Culp:
I added some things to the AI stuff to improve the AIThermal processing.
Before, all the thermals were processed in order, and the last one overwrote
the prior one. Now, only the data from the nearest thermal is kept. This
way a tile can be populated with many thermals, and (as long as they have the
same diameter) the one nearest the airplane correctly takes effect. This
will make us ready for the next step, "auto-thermaling", where FlightGear's
tile manager can cover a tile with thermals, and set the thermal strength
based on land-use type.
I moved the enumerated object_type to the base class. When an AI object is
created it now sets the _otype variable in the base class. This lets the AI
manager find out what kind of AI object it is dealing with, using the base
pointer. I also added a function isa() to the base class, so the manager can
process objects differently based on their type.
The AI manager now sends AIThermal processing to a different function, where
only the data from the nearest thermal is kept. After the manager processes
all the AI objects, then the results from the nearest thermal are applied to
wind-from-down.
2004-03-07 12:08:46 +00:00
|
|
|
double factor;
|
2004-03-03 20:26:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _FG_AIThermal_HXX
|