]> git.mxchange.org Git - simgear.git/blob - simgear/scene/model/model.hxx
Frederic Bouvier:
[simgear.git] / simgear / scene / model / model.hxx
1 // model.hxx - manage a 3D aircraft model.
2 // Written by David Megginson, started 2002.
3 //
4 // This file is in the Public Domain, and comes with no warranty.
5
6 #ifndef __MODEL_HXX
7 #define __MODEL_HXX 1
8
9 #ifndef __cplusplus
10 # error This library requires C++
11 #endif
12
13 #include <vector>
14 #include <set>
15
16 SG_USING_STD(vector);
17 SG_USING_STD(set);
18
19 #include <plib/sg.h>
20 #include <plib/ssg.h>
21
22 #include <simgear/props/props.hxx>
23
24
25 // Has anyone done anything *really* stupid, like making min and max macros?
26 #ifdef min
27 #undef min
28 #endif
29 #ifdef max
30 #undef max
31 #endif
32
33
34 /**
35  * Load a 3D model with or without XML wrapper.  Note, this version
36  * Does not know about or load the panel/cockpit information.  Use the
37  * "model_panel.hxx" version if you want to load an aircraft
38  * (i.e. ownship) with a panel.
39  *
40  * If the path ends in ".xml", then it will be used as a property-
41  * list wrapper to add animations to the model.
42  *
43  * Subsystems should not normally invoke this function directly;
44  * instead, they should use the FGModelLoader declared in loader.hxx.
45  */
46 ssgBranch *
47 sgLoad3DModel( const string& fg_root, const string &path,
48                           SGPropertyNode *prop_root, double sim_time_sec,
49                           ssgEntity *(*load_panel)(SGPropertyNode *) = 0 );
50
51
52 /**
53  * Make an offset matrix from rotations and position offset.
54  */
55 void
56 sgMakeOffsetsMatrix( sgMat4 * result, double h_rot, double p_rot, double r_rot,
57                      double x_off, double y_off, double z_off );
58
59 /**
60  * Make the animation
61  */
62 void
63 sgMakeAnimation( ssgBranch * model,
64                  const char * name,
65                  vector<SGPropertyNode_ptr> &name_nodes,
66                  SGPropertyNode *prop_root,
67                  SGPropertyNode_ptr node,
68                  double sim_time_sec,
69                  set<ssgBranch *> &ignore_branches );
70
71 /**
72  * Set the filter state on models
73  */
74 bool
75 sgSetModelFilter( bool filter );
76
77 /**
78  * Enable or disable Display list usage
79  */
80 extern bool sgUseDisplayList;
81
82 #endif // __MODEL_HXX