]> git.mxchange.org Git - simgear.git/blob - simgear/scene/tgdb/ShaderGeometry.cxx
Random trees from Stuart Buchanan
[simgear.git] / simgear / scene / tgdb / ShaderGeometry.cxx
1 #include "ShaderGeometry.hxx"
2
3 using namespace osg;
4
5 namespace simgear
6 {
7 void ShaderGeometry::drawImplementation(RenderInfo& renderInfo) const
8 {
9     for(PositionSizeList::const_iterator itr = _trees.begin();
10         itr != _trees.end();
11         ++itr) {
12         glColor4fv(itr->ptr());
13         _geometry->draw(renderInfo);
14     }
15 }
16
17 BoundingBox ShaderGeometry::computeBound() const
18 {
19     BoundingBox geom_box = _geometry->getBound();
20     BoundingBox bb;
21     for(PositionSizeList::const_iterator itr = _trees.begin();
22         itr != _trees.end();
23         ++itr) {
24         bb.expandBy(geom_box.corner(0)*(*itr)[3] +
25                     Vec3((*itr)[0], (*itr)[1], (*itr)[2]));
26         bb.expandBy(geom_box.corner(7)*(*itr)[3] +
27                     Vec3((*itr)[0], (*itr)[1], (*itr)[2]));
28     }
29     return bb;
30 }
31
32 }