osg--几种效果

billboards

适用于小草等的绘制

osg::BillBoard继承自osg::Geode,其下所有osg::Drawable面向观察者。旋转行为通过setMode()设置,分别为

  • POINT_ROT_EYE 几何体z轴旋转到窗口y轴
  • POINT_ROT_WORLD
  • AXIAL_ROT
    • setAxis()

锚点

billboard->addDrawable( child, osg::Vec3(1.0f, 0.0f, 0.0f) );

正向

setNormal()

默认法线是几何体的-y轴

示例

#include 
#include 
#include 
#include 

osg::Geometry* createQuad()
{
	osg::ref_ptr texture = new osg::Texture2D;
	osg::ref_ptr image =
		osgDB::readImageFile("Images/osg256.png");
	texture->setImage(image.get());

	osg::ref_ptr quad =
		osg::createTexturedQuadGeometry(
			osg::Vec3(-0.5f, 0.0f, -0.5f),
			osg::Vec3(1.0f, 0.0f, 0.0f),
			osg:

你可能感兴趣的:(#,osg)