本文整理匯總了C++中Billboard::getNumDrawables方法的典型用法代碼示例。如果您正苦於以下問題:C++ Billboard::getNumDrawables方法的具體用法?C++ Billboard::getNumDrawables怎麽用?C++ Billboard::getNumDrawables使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Billboard
的用法示例。
在下文中一共展示了Billboard::getNumDrawables方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: apply
void IntersectVisitor::apply(Billboard& node)
{
if (!enterNode(node)) return;
// IntersectVisitor doesn't have getEyeLocal(), can we use NodeVisitor::getEyePoint()?
const Vec3& eye_local = getEyePoint();
for(unsigned int i = 0; i < node.getNumDrawables(); i++ )
{
const Vec3& pos = node.getPosition(i);
osg::ref_ptr<RefMatrix> billboard_matrix = new RefMatrix;
node.computeMatrix(*billboard_matrix,eye_local,pos);
pushMatrix(billboard_matrix.get(), osg::Transform::RELATIVE_RF);
intersect(*node.getDrawable(i));
popMatrix();
}
leaveNode();
}
示例2: apply
void ScreenMVCullVisitor::apply(Billboard& node)
{
bool status = _cullingStatus;
bool firstStatus = _firstCullStatus;
if(isCulled(node))
{
_firstCullStatus = firstStatus;
_cullingStatus = status;
return;
}
// push the node's state.
StateSet* node_state = node.getStateSet();
if(node_state)
pushStateSet(node_state);
// traverse any call callbacks and traverse any children.
handle_cull_callbacks_and_traverse(node);
const Vec3& eye_local = getEyeLocal();
const RefMatrix& modelview = *getModelViewMatrix();
for(unsigned int i = 0; i < node.getNumDrawables(); ++i)
{
const Vec3& pos = node.getPosition(i);
Drawable* drawable = node.getDrawable(i);
// need to modify isCulled to handle the billboard offset.
// if (isCulled(drawable->getBound())) continue;
if(drawable->getCullCallback())
{
if(drawable->getCullCallback()->cull(this,drawable,&_renderInfo)
== true)
continue;
}
RefMatrix* billboard_matrix = createOrReuseMatrix(modelview);
node.computeMatrix(*billboard_matrix,eye_local,pos);
if(_computeNearFar && drawable->getBound().valid())
updateCalculatedNearFar(*billboard_matrix,*drawable,true);
float depth = distance(pos,modelview);
/*
if (_computeNearFar)
{
if (d<_computed_znear)
{
if (d<0.0) OSG_NOTIFY(osg::WARN)<<"Alerting billboard handling ="<<d<< std::endl;
_computed_znear = d;
}
if (d>_computed_zfar) _computed_zfar = d;
}
*/
StateSet* stateset = drawable->getStateSet();
if(stateset)
pushStateSet(stateset);
if(osg::isNaN(depth))
{
/*OSG_NOTIFY(osg::NOTICE)<<"CullVisitor::apply(Billboard&) detected NaN,"<<std::endl
<<" depth="<<depth<<", pos=("<<pos<<"),"<<std::endl
<<" *billboard_matrix="<<*billboard_matrix<<std::endl;
OSG_NOTIFY(osg::DEBUG_INFO) << " NodePath:" << std::endl;
for (NodePath::const_iterator i = getNodePath().begin(); i != getNodePath().end(); ++i)
{
OSG_NOTIFY(osg::DEBUG_INFO) << " \"" << (*i)->getName() << "\"" << std::endl;
}*/
}
else
{
addDrawableAndDepth(drawable,billboard_matrix,depth);
}
if(stateset)
popStateSet();
}
// pop the node's state off the geostate stack.
if(node_state)
popStateSet();
_firstCullStatus = firstStatus;
_cullingStatus = status;
}