本文整理汇总了C++中RendererPtr::setAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ RendererPtr::setAttribute方法的具体用法?C++ RendererPtr::setAttribute怎么用?C++ RendererPtr::setAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RendererPtr
的用法示例。
在下文中一共展示了RendererPtr::setAttribute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render
void SceneProcedural::render( RendererPtr renderer ) const
{
Context::Scope scopedContext( m_context );
/// \todo See above.
try
{
// get all the attributes, and early out if we're not visibile
ConstCompoundObjectPtr attributes = m_scenePlug->attributesPlug()->getValue();
const BoolData *visibilityData = attributes->member<BoolData>( "gaffer:visibility" );
if( visibilityData && !visibilityData->readable() )
{
return;
}
// if we are visible then make an attribute block to contain everything, set the name
// and get on with generating things.
AttributeBlock attributeBlock( renderer );
std::string name = "";
for( ScenePlug::ScenePath::const_iterator it = m_scenePath.begin(), eIt = m_scenePath.end(); it != eIt; it++ )
{
name += "/" + it->string();
}
renderer->setAttribute( "name", new StringData( name ) );
// transform
std::set<float> transformTimes;
motionTimes( ( m_options.transformBlur && m_attributes.transformBlur ) ? m_attributes.transformBlurSegments : 0, transformTimes );
{
ContextPtr timeContext = new Context( *m_context );
Context::Scope scopedTimeContext( timeContext );
MotionBlock motionBlock( renderer, transformTimes, transformTimes.size() > 1 );
for( std::set<float>::const_iterator it = transformTimes.begin(), eIt = transformTimes.end(); it != eIt; it++ )
{
timeContext->setFrame( *it );
renderer->concatTransform( m_scenePlug->transformPlug()->getValue() );
}
}
// attributes
for( CompoundObject::ObjectMap::const_iterator it = attributes->members().begin(), eIt = attributes->members().end(); it != eIt; it++ )
{
if( const StateRenderable *s = runTimeCast<const StateRenderable>( it->second.get() ) )
{
s->render( renderer );
}
else if( const ObjectVector *o = runTimeCast<const ObjectVector>( it->second.get() ) )
{
for( ObjectVector::MemberContainer::const_iterator it = o->members().begin(), eIt = o->members().end(); it != eIt; it++ )
{
const StateRenderable *s = runTimeCast<const StateRenderable>( it->get() );
if( s )
{
s->render( renderer );
}
}
}
else if( const Data *d = runTimeCast<const Data>( it->second.get() ) )
{
renderer->setAttribute( it->first, d );
}
}
// object
std::set<float> deformationTimes;
motionTimes( ( m_options.deformationBlur && m_attributes.deformationBlur ) ? m_attributes.deformationBlurSegments : 0, deformationTimes );
{
ContextPtr timeContext = new Context( *m_context );
Context::Scope scopedTimeContext( timeContext );
unsigned timeIndex = 0;
for( std::set<float>::const_iterator it = deformationTimes.begin(), eIt = deformationTimes.end(); it != eIt; it++, timeIndex++ )
{
timeContext->setFrame( *it );
ConstObjectPtr object = m_scenePlug->objectPlug()->getValue();
if( const Primitive *primitive = runTimeCast<const Primitive>( object.get() ) )
{
if( deformationTimes.size() > 1 && timeIndex == 0 )
{
renderer->motionBegin( deformationTimes );
}
primitive->render( renderer );
if( deformationTimes.size() > 1 && timeIndex == deformationTimes.size() - 1 )
{
renderer->motionEnd();
}
}
else if( const Camera *camera = runTimeCast<const Camera>( object.get() ) )
{
//.........这里部分代码省略.........