本文整理汇总了C++中osg::RenderInfo::getUserData方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderInfo::getUserData方法的具体用法?C++ RenderInfo::getUserData怎么用?C++ RenderInfo::getUserData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::RenderInfo
的用法示例。
在下文中一共展示了RenderInfo::getUserData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawImplementation
void FadeText::drawImplementation(osg::RenderInfo& renderInfo) const
{
osg::State& state = *renderInfo.getState();
ViewBlendColourMap::iterator itr = _viewBlendColourMap.find(renderInfo.getView());
if (itr != _viewBlendColourMap.end())
{
Text::drawImplementation(*renderInfo.getState(), itr->second );
}
else
{
Text::drawImplementation(*renderInfo.getState(), osg::Vec4(1.0f,1.0f,1.0f,1.0f) );
}
// now pass on new details
FadeTextUserData* userData = dynamic_cast<FadeTextUserData*>(renderInfo.getUserData());
if (!userData)
{
if (renderInfo.getUserData())
{
OSG_NOTICE<<"Warning user data not of supported type."<<std::endl;
return;
}
userData = getGlobalFadeText()->createNewFadeTextUserData(renderInfo.getView());
if (!userData)
{
OSG_NOTICE<<"Memory error, unable to create FadeTextUserData."<<std::endl;
return;
}
renderInfo.setUserData(userData);
}
unsigned int frameNumber = renderInfo.getState()->getFrameStamp()->getFrameNumber();
if (frameNumber != userData->_frameNumber)
{
// new frame so must reset UserData structure.
userData->_frameNumber = frameNumber;
userData->_fadeTextInView.clear();
}
osg::Matrix lmv = state.getModelViewMatrix();
computeMatrix(lmv, &state);
lmv.postMult(state.getModelViewMatrix());
if (renderInfo.getView() && renderInfo.getView()->getCamera())
{
// move from camera into the view space.
lmv.postMult(state.getInitialInverseViewMatrix());
lmv.postMult(renderInfo.getView()->getCamera()->getViewMatrix());
}
FadeTextData ftd(const_cast<osgText::FadeText*>(this));
ftd._vertices[0].set(osg::Vec3d(_textBB.xMin(),_textBB.yMin(),_textBB.zMin())*lmv);
ftd._vertices[1].set(osg::Vec3d(_textBB.xMax(),_textBB.yMin(),_textBB.zMin())*lmv);
ftd._vertices[2].set(osg::Vec3d(_textBB.xMax(),_textBB.yMax(),_textBB.zMin())*lmv);
ftd._vertices[3].set(osg::Vec3d(_textBB.xMin(),_textBB.yMax(),_textBB.zMin())*lmv);
userData->_fadeTextInView.push_back(ftd);
}