本文整理汇总了C++中iecore::CompoundObjectPtr类的典型用法代码示例。如果您正苦于以下问题:C++ CompoundObjectPtr类的具体用法?C++ CompoundObjectPtr怎么用?C++ CompoundObjectPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CompoundObjectPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pointRays
IECoreGL::ConstRenderablePtr StandardLightVisualiser::pointRays()
{
IECoreGL::GroupPtr group = new IECoreGL::Group();
addWireframeCurveState( group.get() );
IECore::CompoundObjectPtr parameters = new CompoundObject;
parameters->members()["aimType"] = new IntData( 1 );
group->getState()->add(
new IECoreGL::ShaderStateComponent( ShaderLoader::defaultShaderLoader(), TextureLoader::defaultTextureLoader(), faceCameraVertexSource(), "", IECoreGL::Shader::constantFragmentSource(), parameters )
);
IntVectorDataPtr vertsPerCurve = new IntVectorData;
V3fVectorDataPtr p = new V3fVectorData;
const int numRays = 8;
for( int i = 0; i < numRays; ++i )
{
const float angle = M_PI * 2.0f * float(i)/(float)numRays;
const V2f dir( cos( angle ), sin( angle ) );
addRay( dir * .5, dir * 1, vertsPerCurve->writable(), p->writable() );
}
IECoreGL::CurvesPrimitivePtr curves = new IECoreGL::CurvesPrimitive( IECore::CubicBasisf::linear(), false, vertsPerCurve );
curves->addPrimitiveVariable( "P", IECore::PrimitiveVariable( IECore::PrimitiveVariable::Vertex, p ) );
curves->addPrimitiveVariable( "Cs", IECore::PrimitiveVariable( IECore::PrimitiveVariable::Constant, new Color3fData( Color3f( 1.0f, 0.835f, 0.07f ) ) ) );
group->addChild( curves );
return group;
}
示例2: computeGlobals
IECore::ConstCompoundObjectPtr SubTree::computeGlobals( const Gaffer::Context *context, const ScenePlug *parent ) const
{
IECore::CompoundObjectPtr result = inPlug()->globalsPlug()->getValue()->copy();
const IECore::CompoundData *inputForwardDeclarations = result->member<IECore::CompoundData>( "gaffer:forwardDeclarations" );
if( inputForwardDeclarations )
{
std::string root = rootPlug()->getValue();
if( !root.size() || root[root.size()-1] != '/' )
{
root += "/";
}
IECore::CompoundDataPtr forwardDeclarations = new IECore::CompoundData;
for( IECore::CompoundDataMap::const_iterator it = inputForwardDeclarations->readable().begin(), eIt = inputForwardDeclarations->readable().end(); it != eIt; it++ )
{
const IECore::InternedString &inputPath = it->first;
if( inputPath.string().compare( 0, root.size(), root ) == 0 )
{
std::string outputPath( inputPath, root.size()-1 );
forwardDeclarations->writable()[outputPath] = it->second;
}
}
result->members()["gaffer:forwardDeclarations"] = forwardDeclarations;
}
return result;
}
示例3: computeProcessedMetadata
IECore::ConstCompoundObjectPtr CopyImageMetadata::computeProcessedMetadata( const Gaffer::Context *context, const IECore::CompoundObject *inputMetadata ) const
{
ConstCompoundObjectPtr copyFrom = copyFromPlug()->metadataPlug()->getValue();
if ( copyFrom->members().empty() )
{
return inputMetadata;
}
const std::string names = namesPlug()->getValue();
const bool invert = invertNamesPlug()->getValue();
if ( !invert && !names.size() )
{
return inputMetadata;
}
IECore::CompoundObjectPtr result = inputMetadata->copy();
for ( IECore::CompoundObject::ObjectMap::const_iterator it = copyFrom->members().begin(), eIt = copyFrom->members().end(); it != eIt; ++it )
{
bool copy = false;
if ( matchMultiple( it->first.c_str(), names.c_str() ) != invert )
{
copy = true;
}
if ( copy )
{
result->members()[it->first] = it->second;
}
}
return result;
}
示例4: computeProcessedMetadata
IECore::ConstCompoundObjectPtr DeleteImageMetadata::computeProcessedMetadata( const Gaffer::Context *context, const IECore::CompoundObject *inputMetadata ) const
{
if ( inputMetadata->members().empty() )
{
return inputMetadata;
}
const std::string names = namesPlug()->getValue();
const bool invert = invertNamesPlug()->getValue();
if ( !invert && !names.size() )
{
return inputMetadata;
}
IECore::CompoundObjectPtr result = new IECore::CompoundObject;
for ( IECore::CompoundObject::ObjectMap::const_iterator it = inputMetadata->members().begin(), eIt = inputMetadata->members().end(); it != eIt; ++it )
{
bool keep = true;
if ( StringAlgo::matchMultiple( it->first.c_str(), names.c_str() ) != invert )
{
keep = false;
}
if ( keep )
{
result->members()[it->first] = it->second;
}
}
return result;
}
示例5: fullAttributes
IECore::CompoundObjectPtr ScenePlug::fullAttributes( const ScenePath &scenePath ) const
{
ContextPtr tmpContext = new Context( *Context::current(), Context::Borrowed );
Context::Scope scopedContext( tmpContext.get() );
IECore::CompoundObjectPtr result = new IECore::CompoundObject;
IECore::CompoundObject::ObjectMap &resultMembers = result->members();
ScenePath path( scenePath );
while( path.size() )
{
tmpContext->set( scenePathContextName, path );
IECore::ConstCompoundObjectPtr a = attributesPlug()->getValue();
const IECore::CompoundObject::ObjectMap &aMembers = a->members();
for( IECore::CompoundObject::ObjectMap::const_iterator it = aMembers.begin(), eIt = aMembers.end(); it != eIt; it++ )
{
if( resultMembers.find( it->first ) == resultMembers.end() )
{
resultMembers.insert( *it );
}
}
path.pop_back();
}
return result;
}
示例6: addEnvLightVisualiser
void StandardLightVisualiser::addEnvLightVisualiser( GroupPtr &output, Color3f multiplier, const std::string &textureName )
{
IECoreGL::GroupPtr sphereGroup = new IECoreGL::Group();
Imath::M44f trans;
trans.scale( V3f( 1, 1, -1 ) );
trans.rotate( V3f( -0.5 * M_PI, -0.5 * M_PI, 0 ) );
sphereGroup->setTransform( trans );
IECoreGL::SpherePrimitivePtr sphere = new IECoreGL::SpherePrimitive();
sphereGroup->addChild( sphere );
IECore::CompoundObjectPtr parameters = new CompoundObject;
parameters->members()["lightMultiplier"] = new Color3fData( multiplier );
parameters->members()["previewOpacity"] = new FloatData( 1 );
parameters->members()["mapSampler"] = new StringData( textureName );
parameters->members()["defaultColor"] = new Color3fData( Color3f( textureName == "" ? 1.0f : 0.0f ) );
sphereGroup->getState()->add(
new IECoreGL::ShaderStateComponent( ShaderLoader::defaultShaderLoader(), TextureLoader::defaultTextureLoader(), IECoreGL::Shader::defaultVertexSource(), "", environmentLightDrawFragSource(), parameters )
);
sphereGroup->getState()->add(
new IECoreGL::DoubleSidedStateComponent( false )
);
output->addChild( sphereGroup );
}
示例7: computeProcessedGlobals
IECore::ConstCompoundObjectPtr DeleteGlobals::computeProcessedGlobals( const Gaffer::Context *context, IECore::ConstCompoundObjectPtr inputGlobals ) const
{
if( inputGlobals->members().empty() )
{
return inputGlobals;
}
const std::string names = namesPlug()->getValue();
const bool invert = invertNamesPlug()->getValue();
if( !invert && !names.size() )
{
return inputGlobals;
}
const std::string prefix = namePrefix();
IECore::CompoundObjectPtr result = new IECore::CompoundObject;
for( IECore::CompoundObject::ObjectMap::const_iterator it = inputGlobals->members().begin(), eIt = inputGlobals->members().end(); it != eIt; ++it )
{
bool keep = true;
if( boost::starts_with( it->first.c_str(), prefix ) )
{
if( matchMultiple( it->first.c_str() + prefix.size(), names.c_str() ) != invert )
{
keep = false;
}
}
if( keep )
{
result->members()[it->first] = it->second;
}
}
return result;
}
示例8: computeProcessedMetadata
IECore::ConstCompoundObjectPtr ImageMetadata::computeProcessedMetadata( const Gaffer::Context *context, const IECore::CompoundObject *inputMetadata ) const
{
const CompoundDataPlug *p = metadataPlug();
if ( !p->children().size() )
{
return inputMetadata;
}
IECore::CompoundObjectPtr result = new IECore::CompoundObject;
// Since we're not going to modify any existing members (only add new ones),
// and our result becomes const on returning it, we can directly reference
// the input members in our result without copying. Be careful not to modify
// them though!
result->members() = inputMetadata->members();
std::string name;
for ( CompoundDataPlug::MemberPlugIterator it( p ); !it.done(); ++it )
{
IECore::DataPtr d = p->memberDataAndName( it->get(), name );
if ( d )
{
result->members()[name] = d;
}
}
return result;
}
示例9: computeProcessedGlobals
IECore::ConstCompoundObjectPtr Set::computeProcessedGlobals( const Gaffer::Context *context, IECore::ConstCompoundObjectPtr inputGlobals ) const
{
std::string name = namePlug()->getValue();
if( !name.size() )
{
return inputGlobals;
}
IECore::CompoundObjectPtr result = new IECore::CompoundObject;
// Since we're not going to modify any existing members other than the sets,
// and our result becomes const on returning it, we can directly reference
// the input members in our result without copying. We have to be careful not
// to modify the input sets though.
result->members() = inputGlobals->members();
CompoundDataPtr sets = new CompoundData;
if( const CompoundData *inputSets = inputGlobals->member<CompoundData>( "gaffer:sets" ) )
{
sets->writable() = inputSets->readable();
}
result->members()["gaffer:sets"] = sets;
ConstObjectPtr set = pathMatcherPlug()->getValue();
// const cast is acceptable because we're just using it to place a const object into a
// container that will be treated as const everywhere immediately after return from this method.
sets->writable()[name] = const_cast<Data *>( static_cast<const Data *>( set.get() ) );
return result;
}
示例10: computeProcessedGlobals
IECore::ConstCompoundObjectPtr Options::computeProcessedGlobals( const Gaffer::Context *context, IECore::ConstCompoundObjectPtr inputGlobals ) const
{
const CompoundDataPlug *p = optionsPlug();
if( !p->children().size() )
{
return inputGlobals;
}
IECore::CompoundObjectPtr result = new IECore::CompoundObject;
// Since we're not going to modify any existing members (only add new ones),
// and our result becomes const on returning it, we can directly reference
// the input members in our result without copying. Be careful not to modify
// them though!
result->members() = inputGlobals->members();
const std::string prefix = computePrefix( context );
std::string name;
for( NameValuePlugIterator it( p ); !it.done(); ++it )
{
IECore::DataPtr d = p->memberDataAndName( it->get(), name );
if( d )
{
result->members()[prefix + name] = d;
}
}
return result;
}
示例11: computeGlobals
IECore::ConstCompoundObjectPtr Attributes::computeGlobals( const Gaffer::Context *context, const ScenePlug *parent ) const
{
ConstCompoundObjectPtr inputGlobals = inPlug()->globalsPlug()->getValue();
if( !globalPlug()->getValue() )
{
return inputGlobals;
}
const CompoundDataPlug *p = attributesPlug();
IECore::CompoundObjectPtr result = new CompoundObject;
// Since we're not going to modify any existing members (only add new ones),
// and our result becomes const on returning it, we can directly reference
// the input members in our result without copying. Be careful not to modify
// them though!
result->members() = inputGlobals->members();
std::string name;
for( CompoundDataPlug::MemberPlugIterator it( p ); !it.done(); ++it )
{
IECore::DataPtr d = p->memberDataAndName( it->get(), name );
if( d )
{
result->members()["attribute:" + name] = d;
}
}
return result;
}
示例12: computeAttributes
IECore::ConstCompoundObjectPtr OSLLight::computeAttributes( const SceneNode::ScenePath &path, const Gaffer::Context *context, const GafferScene::ScenePlug *parent ) const
{
IECore::CompoundObjectPtr result = new IECore::CompoundObject;
ConstCompoundObjectPtr shaderAttributes = shaderInPlug()->attributes();
result->members() = shaderAttributes->members();
attributesPlug()->fillCompoundObject( result->members() );
return result;
}
示例13: computeProcessedGlobals
IECore::ConstCompoundObjectPtr Outputs::computeProcessedGlobals( const Gaffer::Context *context, IECore::ConstCompoundObjectPtr inputGlobals ) const
{
const CompoundPlug *dsp = outputsPlug();
if( !dsp->children().size() )
{
return inputGlobals;
}
IECore::CompoundObjectPtr result = new IECore::CompoundObject;
// Since we're not going to modify any existing members (only add new ones),
// and our result becomes const on returning it, we can directly reference
// the input members in our result without copying. Be careful not to modify
// them though!
result->members() = inputGlobals->members();
// add our outputs to the result
for( InputCompoundPlugIterator it( dsp ); it != it.end(); it++ )
{
const CompoundPlug *outputPlug = it->get();
if( outputPlug->getChild<BoolPlug>( "active" )->getValue() )
{
// backwards compatibility with old plug layout
const StringPlug *namePlug = outputPlug->getChild<StringPlug>( "label" );
if( !namePlug )
{
namePlug = outputPlug->getChild<StringPlug>( "name" );
}
const std::string name = namePlug->getValue();
const StringPlug *fileNamePlug = outputPlug->getChild<StringPlug>( "fileName" );
if( !fileNamePlug )
{
// backwards compatibility with old plug layout
fileNamePlug = outputPlug->getChild<StringPlug>( "name" );
}
const std::string fileName = fileNamePlug->getValue();
const std::string type = outputPlug->getChild<StringPlug>( "type" )->getValue();
const std::string data = outputPlug->getChild<StringPlug>( "data" )->getValue();
if( name.size() && fileName.size() && type.size() && data.size() )
{
DisplayPtr d = new Display( fileName, type, data );
outputPlug->getChild<CompoundDataPlug>( "parameters" )->fillCompoundData( d->parameters() );
result->members()["output:" + name] = d;
}
}
}
return result;
}
示例14: computeAttributes
IECore::ConstCompoundObjectPtr Light::computeAttributes( const SceneNode::ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent ) const
{
IECore::CompoundObjectPtr result = new IECore::CompoundObject;
std::string lightAttribute = "light";
IECoreScene::ShaderNetworkPtr lightShaders = computeLight( context );
if( const IECoreScene::Shader *shader = lightShaders->outputShader() )
{
lightAttribute = shader->getType();
}
result->members()[lightAttribute] = lightShaders;
return result;
}
示例15: attributes
IECore::ConstCompoundObjectPtr Shader::attributes( const Gaffer::Plug *output ) const
{
IECore::CompoundObjectPtr result = new IECore::CompoundObject;
NetworkBuilder networkBuilder( output );
if( networkBuilder.network()->size() )
{
std::string attr = typePlug()->getValue();
std::string postfix = attributeSuffixPlug()->getValue();
if( postfix != "" )
{
attr += ":" + postfix;
}
result->members()[attr] = boost::const_pointer_cast<IECoreScene::ShaderNetwork>( networkBuilder.network() );
}
return result;
}