2002-02-23 21:20:00 +00:00
|
|
|
// model.hxx - manage a 3D aircraft model.
|
|
|
|
// Written by David Megginson, started 2002.
|
|
|
|
//
|
|
|
|
// This file is in the Public Domain, and comes with no warranty.
|
|
|
|
|
|
|
|
#ifndef __MODEL_HXX
|
|
|
|
#define __MODEL_HXX 1
|
|
|
|
|
|
|
|
#ifndef __cplusplus
|
|
|
|
# error This library requires C++
|
|
|
|
#endif
|
|
|
|
|
2002-02-26 00:10:06 +00:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
SG_USING_STD(vector);
|
|
|
|
|
2002-04-20 14:07:34 +00:00
|
|
|
#include <plib/sg.h>
|
2002-08-07 01:34:49 +00:00
|
|
|
#include <plib/ssg.h>
|
2002-04-20 14:07:34 +00:00
|
|
|
|
2003-05-06 23:46:24 +00:00
|
|
|
#include <simgear/props/props.hxx>
|
2002-11-03 15:42:11 +00:00
|
|
|
|
2002-04-20 14:07:34 +00:00
|
|
|
|
2002-03-27 13:00:25 +00:00
|
|
|
// Has anyone done anything *really* stupid, like making min and max macros?
|
|
|
|
#ifdef min
|
|
|
|
#undef min
|
|
|
|
#endif
|
|
|
|
#ifdef max
|
|
|
|
#undef max
|
|
|
|
#endif
|
|
|
|
|
2002-06-10 13:20:26 +00:00
|
|
|
|
2002-08-07 01:34:49 +00:00
|
|
|
/**
|
2003-05-08 20:28:46 +00:00
|
|
|
* Load a 3D model with or without XML wrapper. Note, this version
|
|
|
|
* Does not know about or load the panel/cockpit information. Use the
|
|
|
|
* "model_panel.hxx" version if you want to load an aircraft
|
|
|
|
* (i.e. ownship) with a panel.
|
2002-08-07 01:34:49 +00:00
|
|
|
*
|
|
|
|
* If the path ends in ".xml", then it will be used as a property-
|
|
|
|
* list wrapper to add animations to the model.
|
|
|
|
*
|
|
|
|
* Subsystems should not normally invoke this function directly;
|
|
|
|
* instead, they should use the FGModelLoader declared in loader.hxx.
|
|
|
|
*/
|
2003-05-06 23:46:24 +00:00
|
|
|
ssgBranch * fgLoad3DModel( const string& fg_root, const string &path,
|
2003-05-08 15:56:31 +00:00
|
|
|
SGPropertyNode *prop_root, double sim_time_sec );
|
2002-02-23 21:20:00 +00:00
|
|
|
|
2002-03-30 21:24:19 +00:00
|
|
|
|
2002-08-07 01:34:49 +00:00
|
|
|
/**
|
2003-05-08 20:28:46 +00:00
|
|
|
* Make an offset matrix from rotations and position offset.
|
2002-08-07 01:34:49 +00:00
|
|
|
*/
|
2003-05-08 20:28:46 +00:00
|
|
|
void
|
|
|
|
fgMakeOffsetsMatrix( sgMat4 * result, double h_rot, double p_rot, double r_rot,
|
|
|
|
double x_off, double y_off, double z_off );
|
2002-06-10 13:20:26 +00:00
|
|
|
|
2003-05-08 20:28:46 +00:00
|
|
|
/**
|
|
|
|
* Make the animation
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
fgMakeAnimation( ssgBranch * model,
|
|
|
|
const char * name,
|
|
|
|
vector<SGPropertyNode_ptr> &name_nodes,
|
|
|
|
SGPropertyNode *prop_root,
|
|
|
|
SGPropertyNode_ptr node,
|
|
|
|
double sim_time_sec );
|
2003-03-19 20:45:09 +00:00
|
|
|
|
2002-06-10 13:20:26 +00:00
|
|
|
|
2002-02-23 21:20:00 +00:00
|
|
|
#endif // __MODEL_HXX
|