billboards
适用于小草等的绘制
osg::BillBoard继承自osg::Geode,其下所有osg::Drawable面向观察者。旋转行为通过setMode()设置,分别为
- POINT_ROT_EYE 几何体z轴旋转到窗口y轴
- POINT_ROT_WORLD
- AXIAL_ROT
锚点
billboard->addDrawable( child, osg::Vec3(1.0f, 0.0f, 0.0f) );
正向
setNormal()
默认法线是几何体的-y轴
示例
#include <osg/Billboard>
#include <osg/Texture2D>
#include <osgDB/ReadFile>
#include <osgViewer/Viewer>
osg::Geometry* createQuad()
{
osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;
osg::ref_ptr<osg::Image> image =
osgDB::readImageFile("Images/osg256.png");
texture->setImage(image.get());
osg::ref_ptr<osg::Geometry> quad =
osg::createTexturedQuadGeometry(
osg::Vec3(-0.5f, 0.0f, -0.5f),
osg::Vec3(1.0f, 0.0f, 0.0f),
osg:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)