当前位置: 首页>>代码示例>>C++>>正文


C++ iecore::CompoundObjectPtr类代码示例

本文整理汇总了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;
}
开发者ID:HughMacdonald,项目名称:gaffer,代码行数:30,代码来源:StandardLightVisualiser.cpp

示例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;
}
开发者ID:jonathantopf,项目名称:gaffer,代码行数:28,代码来源:SubTree.cpp

示例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;
}
开发者ID:goddardl,项目名称:gaffer,代码行数:32,代码来源:CopyImageMetadata.cpp

示例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;
}
开发者ID:hradec,项目名称:gaffer,代码行数:31,代码来源:DeleteImageMetadata.cpp

示例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;
}
开发者ID:dboogert,项目名称:gaffer,代码行数:25,代码来源:ScenePlug.cpp

示例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 );
}
开发者ID:HughMacdonald,项目名称:gaffer,代码行数:26,代码来源:StandardLightVisualiser.cpp

示例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;
}
开发者ID:cedriclaunay,项目名称:gaffer,代码行数:35,代码来源:DeleteGlobals.cpp

示例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;
}
开发者ID:HughMacdonald,项目名称:gaffer,代码行数:27,代码来源:ImageMetadata.cpp

示例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;
}
开发者ID:cedriclaunay,项目名称:gaffer,代码行数:29,代码来源:Set.cpp

示例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;
}
开发者ID:ImageEngine,项目名称:gaffer,代码行数:29,代码来源:Options.cpp

示例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;
}
开发者ID:HughMacdonald,项目名称:gaffer,代码行数:28,代码来源:Attributes.cpp

示例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;
}
开发者ID:ImageEngine,项目名称:gaffer,代码行数:11,代码来源:OSLLight.cpp

示例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;
}
开发者ID:CRiant,项目名称:gaffer,代码行数:50,代码来源:Outputs.cpp

示例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;
}
开发者ID:appleseedhq,项目名称:gaffer,代码行数:16,代码来源:Light.cpp

示例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;
}
开发者ID:appleseedhq,项目名称:gaffer,代码行数:16,代码来源:Shader.cpp


注:本文中的iecore::CompoundObjectPtr类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。