2 #include "cloudgenerator.h"
3 #include <osg/BoundingBox>
26 m_transformMatrix.makeIdentity();
38 virtual void apply( osg::Geode &geode )
49 for(
unsigned int i = 0; i < geode.getNumDrawables(); ++i )
52 osg::BoundingBox bbox;
53 bbox.expandBy( geode.getDrawable( i )->getBound());
59 osg::BoundingBox bboxTrans;
61 std::cout <<
"center: " << bbox.center().x() <<
" " << bbox.center().y() <<
" " << bbox.center().z() << std::endl;
62 std::cout <<
"min: " << bbox.xMin() <<
" " << bbox.yMin() <<
" " << bbox.zMin() << std::endl;
63 std::cout <<
"max: " << bbox.xMax() <<
" " << bbox.yMax() <<
" " << bbox.zMax() << std::endl;
64 for(
unsigned int i = 0; i < 8; ++i )
66 osg::Vec3 xvec = bbox.corner( i ) * m_transformMatrix;
67 bboxTrans.expandBy( xvec );
70 std::cout <<
"bboxTrans: " << bboxTrans.center().x() <<
" " << bboxTrans.center().y() <<
" " << bboxTrans.center().z() << std::endl;
71 m_boundingBox.push_back(bboxTrans);
89 virtual void apply( osg::MatrixTransform &node )
96 std::cout <<
"TRANSFORM NODE" << std::endl;
97 m_transformMatrix *= node.getMatrix();
109 virtual void apply( osg::Billboard &node )
128 std::vector<osg::BoundingBox> &getBoundBox() {
return m_boundingBox; }
131 std::vector<osg::BoundingBox> m_boundingBox;
132 osg::Matrix m_transformMatrix;
149 CloudCreatorWang(std::string path, osg::Vec3 middlepos,
int type, osg::Vec4 color);
161 osg::Vec3 m_middlepos;