3 * Copyright (C) 2011 Stuart Buchanan
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.
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.
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,
22 #ifndef SG_BUILDING_BIN_HXX
23 #define SG_BUILDING_BIN_HXX
30 #include <osg/Geometry>
34 #include <simgear/scene/util/OsgMath.hxx>
47 Building(BuildingType t, const SGVec3f& p, float w, float d, float h, int f, float rot, bool pitch) :
56 radius(std::max(d, 0.5f*w))
58 Building(const SGVec3f& p, Building b) :
67 radius(std::max(b.depth, 0.5f*b.width))
80 float getFootprint() {
85 typedef std::vector<Building> BuildingList;
86 BuildingList buildings;
91 void insert(const Building& model)
93 buildings.push_back(model);
96 void insert(BuildingType t, const SGVec3f& p, float w, float d, float h, int f, float rot, bool pitch)
97 { insert(Building(t, p, w, d, h, f, rot, pitch)); }
99 unsigned getNumBuildings() const
100 { return buildings.size(); }
101 const Building& getBuilding(unsigned i) const
102 { return buildings[i]; }
106 typedef std::list<SGBuildingBin*> SGBuildingBinList;
108 osg::Group* createRandomBuildings(SGBuildingBinList buildinglist, const osg::Matrix& transform,
109 const SGReaderWriterOptions* options);