1 /* -*-c++-*-
2  *
3  * Copyright (C) 2007 Stuart Buchanan
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of the
8  * License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18  * MA 02110-1301, USA.
19  *
20  */
21 
22 #ifndef SG_MAT_MODEL_BIN_HXX
23 #define SG_MAT_MODEL_BIN_HXX
24 
25 #include <vector>
26 #include <simgear/math/SGMath.hxx>
27 
28 // forward decls
29 class SGMatModel;
30 
31 class SGMatModelBin {
32 public:
33   struct MatModel {
MatModelSGMatModelBin::MatModel34     MatModel(const SGVec3f& p, SGMatModel *m, int l, float rot) :
35       position(p), model(m), lod(l), rotation(rot)
36     { }
37     SGVec3f position;
38     SGMatModel *model;
39     int lod;
40     float rotation;
41   };
42   typedef std::vector<MatModel> MatModelList;
43 
insert(const MatModel & model)44   void insert(const MatModel& model)
45   {
46     _models.push_back(model);
47   }
48 
insert(const SGVec3f & p,SGMatModel * m,int l,float rot)49   void insert(const SGVec3f& p, SGMatModel *m, int l, float rot)
50   { insert(MatModel(p, m, l, rot)); }
51 
getNumModels() const52   unsigned getNumModels() const
53   { return _models.size(); }
getMatModel(unsigned i) const54   const MatModel& getMatModel(unsigned i) const
55   { return _models[i]; }
56 
57 private:
58   MatModelList _models;
59 };
60 
61 #endif
62