This structure contains the lat/long coordinates (in radians) of the center of the simulation, obtained by calling iface::get_data(IFACEDATA_SCENARIO_CENTER, *)
typedef struct {
vector2d latlon;
} iface_scenario_center_type;
This class is used to instantiate objects that will handle the graphics window and any gui dialogs.
class gui_type {
public:
int doneflag;
This field is set to "1" if an "exit" command from the user is detected.
gui_type();
virtual ~gui_type();
virtual void query_win_dim(int *v) = 0;
This virtual method gets the length and height dimension in the 2D integer array "v".
virtual void reset_win_dim(int *v) = 0;
This virtual method sets the length and height dimension in the 2D integer array "v".
virtual void init(int argc, char **argv) = 0;
This virtual method initializes the object w/ the arguments from main().
};
This class is used to contain physical information about objects described by the "semobj_data" file.
class correlate public dbl_llist {
public:
int keycode;
This field contains the semantic correlation code used to correlate a simulation entity w/ this info.
string_type objname;
This field contains the 3D name/filename representing the object.
fx_params trail;
This field contains information on displaying trail f/x on the object (engine, smoke, visualization, etc) and is defined as follows:
typedef struct { vector3d xyz; vector3d hpr; double scale; } fx_params;
fx_params damage;
This field contains information on displaying damage f/x (smoke, fire, etc) on the object.
fx_rotor_params rotor[4];
This field contains information on displaying rotor f/x on the object and is defined as follows:
typedef struct { fx_params state; int count; } fx_rotor_params;
int num_rotors;
This field contains the # of rotor f/x attached to the object and is limited to a maximum of 4.
int sfx_moving_id;
This field contains a sound id to be used if the object is moving.
int sfx_idle_id;
This field contains a sound id to be used if the object is stationary.
int fx_flag;
This bit field contains various control flags. The bits "0x0000ffff" are reserved for the vissim system, and some of them are:
FX_FLAG_NULL - initial setting FX_FLAG_TRAIL - display trail f/x FX_FLAG_DAMAGE - display damage f/x FX_FLAG_MISSILE_FLAME_JET - display an exhaust cone f/x FX_FLAG_ROTORS - display rotor f/x FX_FLAG_SFX_IDLE - activate idle sound FX_FLAG_SFX_MOVING - activate moving sound
correlate();
correlate(FILE *infile, char *token);
This constructor populates this class w/ data from infile & token.
virtual ~correlate();
correlate *find(int code);
This method recursively goes through the list of correlate objects and compares "code" w/ keycode and returns that object if a match is found.
};
This class manages a double linked list of symbol_correlation_types.
class symbol_lut_type : public dbl_llist_manager {
public:
virtual ~symbol_lut_type() {}
dbl_llist *find(int code);
This method recursively goes through the list of symbol_correlation_type objects and compares "code" w/ symbol_correlation_type::sym_id and returns that object if a match is found.
dbl_llist *find(char *code);
This method recursively goes through the list of symbol_correlation_type objects and compares "code" w/ symbol_correlation_type::sym_sim and returns that object if a match is found.
void dump(FILE *outfile);
This method dumps the contents of the link list to "outfile
int read_data(FILE *infile, char *token);
This method extracts a linklist of symbol_correlation_types from an ascii file.
};
This class is used to manage a list of correlates.
class platform_manager : public dbl_llist_manager {
public:
virtual ~platform_manager() { }
int read_data(char *filename);
This method reads in a list of correlates from an ascii file.
};
This class is used to hold a string for rendering.
class labeltype : public dbl_llist {
protected:
string_type label;
This field contains a label to be placed on the screen.
public:
vector2d pos;
This field contains a coordinate to place the label, based on a virtual screen of 640 x 480.
void set_label(char *string);
This method is used to set the label.
char *get_label();
This method is used to get the label.
};
This class is used to hold a line for rendering.
class linetype : public dbl_llist {
public:
int data;
This field is for miscellanious data (most likely 4 bytes of RGBA).
vector3d pt[2];
This field contains the coordinates to place the line's endpoints, 2D or 3D depending on the application.
};
This class handles the more frequently allocated data structures.
class vmem_manager : public memman {
public:
vmem_manager(int maxlists, int maxbuffers);
"maxlists" is the # of different types of data structures. "maxbuffers" is the number of byte buffers the class manages.
void *pop(int item, int size=0);
This method allocates an item of type "item". "size" is used if the item is a buffer. Some predefined types are:
MM_LINE - allocate linetype MM_LABEL - allocate labeltype
};
This class correlates simulation entities w/ visualization data.
class symbol_correlation_type : public dbl_llist {
public:
string_type sym_label;
This field contains the name of the platform.
int sym_id;
This field contains a correlation id to match a simulation entity w/ this object.
string_type sym_sim;
This field contains string to match a simulation entity w/ this object.
unsigned int sym_3D;
This field contains an id to match a simulation entity w/ a 3D object.
unsigned int sym_2D;
This field contains an id to match a simulation entity w/ a 2D symbol.
vector4uc sym_2D_color;
This field contains a color to correlate w/ a simulation entity.
string_type sym_2D_colorname;
This field contains a color name that correlates w/ the entries in "rgb.txt".
int sym_sds;
This field contains an id that correlates w/ an object in SDS-PCIG.
int burst_warhead;
This field contains the warhead id for a DIS fire/detonate pdu
int burst_fuze;
This field contains the fuze id for a DIS fire/detonate pdu
int burst_quantity;
This field contains the quantity for a DIS fire/detonate pdu
int burst_rate;
This field contains the rate of fire for a DIS fire/detonate pdu.
symbol_correlation_type();
virtual ~symbol_correlation_type();
};
This class maintains the state data for a platform/object.
class plat_stat_type {
public:
vector3d pos;
This field contains the x, y, z positional data for the object.
vector3d acc;
This field contains the dvx, dvy, dvz acceleration data for the object.
vector3d vel;
This field contains the vx, vy, vz velocity data for the object.
vector3d rpy;
This field contains the roll, pitch, yaw orientation data for the object.
vector3d drpy;
This field contains the angular velocity for the object.
double timer;
This field contains the simulation time of the last physical update.
double machine_time;
This field contains the computer time of the last update.
int dead_recogn_flag;
This field is a flag set to true if dead-recogning is to be applied
plat_stat_type();
void dead_recog(double *currtime, double *multiplier, double *newtime);
This method performs dead recogning algorithms to the positional and orientation data. "currtime" is the current time in the simulation. "multiplier" is a time multiplier if the simulation is running faster than realtime. "newtime" is the current system time.
};
This class is an interface to represent a simple radar object.
class basic_radar_data_type : public dbl_llist {
public:
int id;
Id of the radar
double frequency;
Frequence of the emitter in Hz
double freq_range;
Frequency range of emitter in Hz
double power;
Power of emitter in watts
double prf;
Pulse repetition frequency of emitter in Hz
double pulse_width;
Pulse width of emitter in meters
double beam_azimuth;
Emitter's main beam azimuth in radians
double beam_az_sweep;
Emitter's main beam azimuth FOV in radians
double beam_elevation;
Emitter's main beam elevation in radians
double beam_ele_sweep;
Emitter's main beam elevation FOV in radians
int mode;
Current mode state of the radar of the following:
symbol_correlation_type *str;
Pointer to .ini info on the radar
basic_radar_data_type();
virtual ~basic_radar_data_type() {}
};
This class is an interface to the rendering library for this object/platform.
class platform_data {
protected:
basic_platform *parent;
This field contains a pointer to the simulation interface to this object/platform.
public:
platform_data(basic_platform *x);
"x" is the pointer to the simulation interface to this object.
virtual ~platform_data();
virtual void label(dbl_llist_manager *label_manager) = 0;
This method adds a label to the list of labels to be rendered to the screen.
virtual void update(double *machine_time) = 0;
This method forces the graphical object to update its current state.
virtual int perform(iface *isim, int task, void *data);
This method "asks" the object to perform a certain "task". "task" values of 0-65535 are reserved. Objects that do not recognize the "task" should return 0. "data" is a generic pointer who's contents are dependent on the task. Predefined tasks are:
PERFORM_QUERY_ID - "data" is a pointer to an integer, and is filled w/ the id of the object. PERFORM_PLATFORM_DEACTIVATE - informs the object that it is "invisible".
virtual void render(iface *isim) = 0;
This method renders the object using the specified graphics library API. "isim" is the manager for this object.
virtual int init(iface *isim, correlate *basis, symbol_correlation_type *str) = 0;
This method initializes the object w/ a correlation "basis" and its relevant data ("str").
"isim" is the manager for this object.
};
This class is an interface to the simulation for this object/platform.
class basic_platform : public dbl_llist {
protected:
virtual void update_data(double *machine_time) = 0;
This method causes this object to update itself to the simulation, and to update the graphical component.
public:
platform_data *vis_data;
This field contains a pointer to the graphical component, and is allocated using the
function registered with register_platform_data_loaderCB();
plat_stat_type plat_clone;
This field contains a snapshot of the state data for this object/platfrom.
int platform_flag;
This bit field contains various flags. The lower bits (0x0000ffff) are reserved. Some predefined flags are:
int id;
This field contains a unique identifier for this object.
int type;
This field contains the correlation code for this platform.
basic_platform();
virtual ~basic_platform();
void label(dbl_llist_manager *label_manager);
This method adds a "label" of class labeltype to be rendered.
void update(iface *isim, double *currtime, double *multiplier, double *machine_time, int pause);
This method is a command to update itself to the current time ( ("currtime" .. "machine_time") * "multiplier") and
if set, whether or not the simulation is "pause"d.
virtual int perform(iface *isim, int task, void *data);
This method "asks" the object to perform a certain "task". "task" values of 0-65535 are reserved.
Objects that do not recognize the "task" should return 0. "data" is a generic pointer who's contents are dependent on the task.
virtual void update_platform(plat_stat_type *pc);
Not only does this method update the class, but it updates the simulation too.
};
This class is an interface to the simulation.
class iface : public dbl_llist_manager {
public:
unsigned int interface_flag;
This bit field contains various flags. The lower bits (0x0000ffff) are reserved. Some predefined flags are:
platform_manager platman;
This field contains a list of type correlate
void *data_loader;
This field contains a callback that allocates a new object derived from basic_platform
iface();
virtual ~iface();
basic_platform *get_platform(int platid);
This method searches for a object/platform with the unique identifier "platid".
void register_platform_data_loaderCB(void *func);
This method registers a new callback to allocate new objects derived from basic_platform
virtual void init();
This method initializes the object.
virtual void cleanup();
This method re-initializes the object.
virtual void label(dbl_llist_manager *label_manager) = 0;
This method builds a list of labels to be put to the screen.
virtual void parse_input(int argc, char **argv) = 0;
This method uses the inputs to main() as setup parameters.
virtual void update(double *machine_time) = 0;
This method is used to tell the object to update and match the current simulation.
virtual void mcp(class_plat_stat_type *pc) = 0;
This method is used for an externally controlled object/platform.
virtual int get_data(int type, void *data) { return 0; }
This method is used to request data, identified by "type" and stored in "data" - returns true if sueccessful.
virtual int set_data(int type, void *data) { return 0; }
This method sets data, Identified by "type" and stored in "data" - returns true if sueccessful.
};
void deg_to_dms(double d_lat, double d_lon, char *lat, char *lon, int format);
void dms_to_deg(char *lat, char *lon, double *d_lat, double *d_lon);
void xy_to_deg(double x, double y, double *lat, double *lon);
void deg_to_xy(double lat, double lon, double *x, double *y);
void xy_to_rad(double x, double y, double *lat, double *lon);
void rad_to_xy(double lat, double lon, double *x, double *y);
void init_earth(double center_lat, double enter_lon, double earth_radius);
int parse_setup(char *filename);
int write_setup(char *filename);
void init_color_lut(char *filename);
void register_platform_data_loaderCB((void (*)(void))func);
void register_setup_CB((void (*)(FILE *, char *))setupCB);
void register_setup_out_CB((void (*)(FILE *))setup_outCB);
extern double CONVERT_ctrlat;
extern double CONVERT_ctrlon;
extern double CONVERT_EarthRadius;
extern vmem_manager vmemman;
extern string_type terrain_name;
extern double camera_dist;
extern double camera_height;
extern double camera_azimuth;
extern double camera_angular_velocity;
extern int local_game_fogflag[3];
extern double local_game_fog_start;
extern double local_game_fog_end;
extern vector4uc local_game_fog_color;
extern int openglflag;
extern double backplane;
extern string_type overlay_name;
extern int overlay_intensity;
extern string_type map_indexname;
extern vector4uc tile_color;
extern int controller;
extern vector3d controller_speed;
extern symbol_lut_type symbol_lut;
extern binary_tree colortree;
extern unsigned int security_level;
extern int scramnet_flag;
extern string_type DATANAME_SEMOBJ;
extern string_type DATANAME_SETUP;