1 // model.hxx - manage a 3D aircraft model.
2 // Written by David Megginson, started 2002.
4 // This file is in the Public Domain, and comes with no warranty.
10 # error This library requires C++
13 #include <simgear/compiler.h>
24 #include <simgear/misc/sg_path.hxx>
25 #include <simgear/props/props.hxx>
28 // Has anyone done anything *really* stupid, like making min and max macros?
38 * Abstract class for adding data to the scene graph. modelLoaded() is
39 * called by sgLoad3DModel() after the model was loaded, and the destructor
40 * when the branch is removed from the graph.
42 class SGModelData : public ssgBase {
44 virtual ~SGModelData() {}
45 virtual void modelLoaded( const string& path, SGPropertyNode *prop,
51 * Load a 3D model with or without XML wrapper. Note, this version
52 * Does not know about or load the panel/cockpit information. Use the
53 * "model_panel.hxx" version if you want to load an aircraft
54 * (i.e. ownship) with a panel.
56 * If the path ends in ".xml", then it will be used as a property-
57 * list wrapper to add animations to the model.
59 * Subsystems should not normally invoke this function directly;
60 * instead, they should use the FGModelLoader declared in loader.hxx.
63 sgLoad3DModel( const string& fg_root, const string &path,
64 SGPropertyNode *prop_root, double sim_time_sec,
65 ssgEntity *(*load_panel)(SGPropertyNode *) = 0,
66 SGModelData *data = 0 );
70 * Make an offset matrix from rotations and position offset.
73 sgMakeOffsetsMatrix( sgMat4 * result, double h_rot, double p_rot, double r_rot,
74 double x_off, double y_off, double z_off );
80 sgMakeAnimation( ssgBranch * model,
82 vector<SGPropertyNode_ptr> &name_nodes,
83 SGPropertyNode *prop_root,
84 SGPropertyNode_ptr node,
87 set<ssgBranch *> &ignore_branches );
90 * Set the filter state on models
93 sgSetModelFilter( bool filter );
96 * Check if the ssg node contains an animation
99 sgCheckAnimationBranch (ssgEntity * entity);
102 * Enable or disable Display list usage
104 extern bool sgUseDisplayList;
106 #endif // __MODEL_HXX