本文整理汇总了C++中StateSet::setRenderBinDetails方法的典型用法代码示例。如果您正苦于以下问题:C++ StateSet::setRenderBinDetails方法的具体用法?C++ StateSet::setRenderBinDetails怎么用?C++ StateSet::setRenderBinDetails使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StateSet
的用法示例。
在下文中一共展示了StateSet::setRenderBinDetails方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initStateset
void Virvo::initStateset()
{
StateSet *stateset = new StateSet();
stateset->setMode(GL_LIGHTING, StateAttribute::OFF);
stateset->setMode(GL_BLEND, StateAttribute::ON);
stateset->setRenderBinDetails(100, "RenderBin"); // draw after everything else
setStateSet(stateset);
}
示例2: initOQState
// Create and return a StateSet appropriate for performing an occlusion
// query test (disable lighting, texture mapping, etc). Probably some
// room for improvement here. Could disable shaders, for example.
StateSet* initOQState()
{
StateSet* state = new StateSet;
// TBD Possible bug, need to allow user to set render bin number.
state->setRenderBinDetails( 9, "RenderBin" );
state->setMode( GL_LIGHTING, StateAttribute::OFF | StateAttribute::PROTECTED);
state->setTextureMode( 0, GL_TEXTURE_2D, StateAttribute::OFF | StateAttribute::PROTECTED);
state->setMode( GL_CULL_FACE, StateAttribute::ON | StateAttribute::PROTECTED);
ColorMask* cm = new ColorMask( false, false, false, false );
state->setAttributeAndModes( cm, StateAttribute::ON | StateAttribute::PROTECTED);
Depth* d = new Depth( Depth::LEQUAL, 0.f, 1.f, false );
state->setAttributeAndModes( d, StateAttribute::ON | StateAttribute::PROTECTED);
PolygonMode* pm = new PolygonMode( PolygonMode::FRONT_AND_BACK, PolygonMode::FILL );
state->setAttributeAndModes( pm, StateAttribute::ON | StateAttribute::PROTECTED);
PolygonOffset* po = new PolygonOffset( -1., -1. );
state->setAttributeAndModes( po, StateAttribute::ON | StateAttribute::PROTECTED);
return state;
}
示例3: sizeof
Node *makeSky( void )
{
int i, j;
float lev[] = { -5, -1.0, 1.0, 15.0, 30.0, 60.0, 90.0 };
float cc[][4] =
{
{ 0.0, 0.0, 0.15 },
{ 0.0, 0.0, 0.15 },
{ 0.4, 0.4, 0.7 },
{ 0.2, 0.2, 0.6 },
{ 0.1, 0.1, 0.6 },
{ 0.1, 0.1, 0.6 },
{ 0.1, 0.1, 0.6 },
};
float x, y, z;
float alpha, theta;
float radius = 20.0f;
int nlev = sizeof( lev )/sizeof(float);
Geometry *geom = new Geometry;
Vec3Array& coords = *(new Vec3Array(19*nlev));
Vec4Array& colors = *(new Vec4Array(19*nlev));
Vec2Array& tcoords = *(new Vec2Array(19*nlev));
int ci = 0;
for( i = 0; i < nlev; i++ )
{
for( j = 0; j <= 18; j++ )
{
alpha = osg::DegreesToRadians(lev[i]);
theta = osg::DegreesToRadians((float)(j*20));
x = radius * cosf( alpha ) * cosf( theta );
y = radius * cosf( alpha ) * -sinf( theta );
z = radius * sinf( alpha );
coords[ci][0] = x;
coords[ci][1] = y;
coords[ci][2] = z;
colors[ci][0] = cc[i][0];
colors[ci][1] = cc[i][1];
colors[ci][2] = cc[i][2];
colors[ci][3] = 1.0;
tcoords[ci][0] = (float)j/18.0;
tcoords[ci][1] = (float)i/(float)(nlev-1);
ci++;
}
}
for( i = 0; i < nlev-1; i++ )
{
DrawElementsUShort* drawElements = new DrawElementsUShort(PrimitiveSet::TRIANGLE_STRIP);
drawElements->reserve(38);
for( j = 0; j <= 18; j++ )
{
drawElements->push_back((i+1)*19+j);
drawElements->push_back((i+0)*19+j);
}
geom->addPrimitiveSet(drawElements);
}
geom->setVertexArray( &coords );
geom->setTexCoordArray( 0, &tcoords );
geom->setColorArray( &colors );
geom->setColorBinding( Geometry::BIND_PER_VERTEX );
Texture2D *tex = new Texture2D;
tex->setImage(osgDB::readImageFile("Images/white.rgb"));
StateSet *dstate = new StateSet;
dstate->setTextureAttributeAndModes(0, tex, StateAttribute::OFF );
dstate->setTextureAttribute(0, new TexEnv );
dstate->setMode( GL_LIGHTING, StateAttribute::OFF );
dstate->setMode( GL_CULL_FACE, StateAttribute::ON );
// clear the depth to the far plane.
osg::Depth* depth = new osg::Depth;
depth->setFunction(osg::Depth::ALWAYS);
depth->setRange(1.0,1.0);
dstate->setAttributeAndModes(depth,StateAttribute::ON );
dstate->setRenderBinDetails(-2,"RenderBin");
geom->setStateSet( dstate );
Geode *geode = new Geode;
//.........这里部分代码省略.........
示例4: createImpostorSprite
//.........这里部分代码省略.........
int new_t = (int)(powf(2.0f,rounded_tp2));
const osg::Viewport& viewport = *(cv->getViewport());
// if dimension is bigger than window divide it down.
while (new_s>viewport.width()) new_s /= 2;
// if dimension is bigger than window divide it down.
while (new_t>viewport.height()) new_t /= 2;
// create the impostor sprite.
ImpostorSprite* impostorSprite =
impostorSpriteManager->createOrReuseImpostorSprite(new_s,new_t,cv->getTraversalNumber()-cv->getNumberOfFrameToKeepImpostorSprites());
if (impostorSprite==NULL)
{
OSG_WARN<<"Warning: unable to create required impostor sprite."<<std::endl;
return NULL;
}
// update frame number to show that impostor is in action.
impostorSprite->setLastFrameUsed(cv->getTraversalNumber());
// have successfully created an impostor sprite so now need to
// add it into the impostor.
addImpostorSprite(contextID,impostorSprite);
if (cv->getDepthSortImpostorSprites())
{
// the depth sort bin should probably be user definable,
// will look into this later. RO July 2001.
StateSet* stateset = impostorSprite->getStateSet();
stateset->setRenderBinDetails(10,"DepthSortedBin");
}
osg::Texture2D* texture = impostorSprite->getTexture();
texture->setTextureSize(new_s, new_t);
texture->setInternalFormat(GL_RGBA);
texture->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
texture->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
// update frame number to show that impostor is in action.
impostorSprite->setLastFrameUsed(cv->getTraversalNumber());
Vec3* coords = impostorSprite->getCoords();
Vec2* texcoords = impostorSprite->getTexCoords();
coords[0] = c01;
texcoords[0].set(0.0f,1.0f);
coords[1] = c00;
texcoords[1].set(0.0f,0.0f);
coords[2] = c10;
texcoords[2].set(1.0f,0.0f);
coords[3] = c11;
texcoords[3].set(1.0f,1.0f);
impostorSprite->dirtyBound();
Vec3* controlcoords = impostorSprite->getControlCoords();
if (isPerspectiveProjection)