本文整理汇总了C++中GroupPtr::setTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ GroupPtr::setTransform方法的具体用法?C++ GroupPtr::setTransform怎么用?C++ GroupPtr::setTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GroupPtr
的用法示例。
在下文中一共展示了GroupPtr::setTransform方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: transformObject
ConstObjectPtr SOP_SceneCacheSource::transformObject( const IECore::Object *object, const Imath::M44d &transform, bool &hasAnimatedTopology, bool &hasAnimatedPrimVars, std::vector<InternedString> &animatedPrimVars )
{
if ( const Primitive *primitive = IECore::runTimeCast<const Primitive>( object ) )
{
TransformOpPtr transformer = new TransformOp();
transformer->inputParameter()->setValue( const_cast<Primitive*>( primitive ) ); // safe because we set the copy parameter
transformer->copyParameter()->setTypedValue( true );
transformer->matrixParameter()->setValue( new M44dData( transform ) );
ObjectPtr result = transformer->operate();
std::vector<std::string> &primVars = transformer->primVarsParameter()->getTypedValue();
for ( std::vector<std::string>::iterator it = primVars.begin(); it != primVars.end(); ++it )
{
if ( std::find( animatedPrimVars.begin(), animatedPrimVars.end(), *it ) == animatedPrimVars.end() )
{
animatedPrimVars.push_back( *it );
hasAnimatedPrimVars = true;
}
}
return result;
}
else if ( const Group *group = IECore::runTimeCast<const Group>( object ) )
{
GroupPtr result = group->copy();
MatrixTransformPtr matTransform = matrixTransform( transform );
matTransform->matrix *= group->getTransform()->transform();
result->setTransform( matTransform );
return result;
}
else if ( const CoordinateSystem *coord = IECore::runTimeCast<const CoordinateSystem>( object ) )
{
CoordinateSystemPtr result = coord->copy();
MatrixTransformPtr matTransform = matrixTransform( transform );
matTransform->matrix *= coord->getTransform()->transform();
result->setTransform( matTransform );
return result;
}
return object;
}
示例2: transformObject
ConstObjectPtr SOP_SceneCacheSource::transformObject( const IECore::Object *object, const Imath::M44d &transform, Parameters ¶ms )
{
if ( const Primitive *primitive = IECore::runTimeCast<const Primitive>( object ) )
{
TransformOpPtr transformer = new TransformOp();
transformer->inputParameter()->setValue( const_cast<Primitive*>( primitive ) ); // safe because we set the copy parameter
transformer->copyParameter()->setTypedValue( true );
transformer->matrixParameter()->setValue( new M44dData( transform ) );
// add all Point and Normal prim vars to the transformation list, except for rest/Pref
const PrimitiveVariableMap &variables = primitive->variables;
std::vector<std::string> &primVars = transformer->primVarsParameter()->getTypedValue();
primVars.clear();
for ( PrimitiveVariableMap::const_iterator it = variables.begin(); it != variables.end(); ++it )
{
if ( despatchTypedData<TransformGeometricData, IECore::TypeTraits::IsGeometricTypedData, DespatchTypedDataIgnoreError>( it->second.data.get() ) )
{
// we don't want to alter rest/Pref because Houdini excepts these to be non-transforming prim vars
if ( it->first == "rest" || it->first == "Pref" )
{
continue;
}
primVars.push_back( it->first );
// add the transforming prim vars to the animated list
if ( std::find( params.animatedPrimVars.begin(), params.animatedPrimVars.end(), it->first ) == params.animatedPrimVars.end() )
{
params.animatedPrimVars.push_back( it->first );
params.hasAnimatedPrimVars = true;
}
}
}
return transformer->operate();
}
else if ( const Group *group = IECore::runTimeCast<const Group>( object ) )
{
GroupPtr result = group->copy();
MatrixTransformPtr matTransform = matrixTransform( transform );
if ( const Transform *transform = group->getTransform() )
{
matTransform->matrix *= transform->transform();
}
result->setTransform( matTransform );
return result;
}
else if ( const CoordinateSystem *coord = IECore::runTimeCast<const CoordinateSystem>( object ) )
{
CoordinateSystemPtr result = coord->copy();
MatrixTransformPtr matTransform = matrixTransform( transform );
if ( const Transform *transform = coord->getTransform() )
{
matTransform->matrix *= transform->transform();
}
result->setTransform( matTransform );
return result;
}
return object;
}
示例3: visualise
IECoreGL::ConstRenderablePtr StandardLightVisualiser::visualise( const IECore::InternedString &attributeName, const IECore::ObjectVector *shaderVector, IECoreGL::ConstStatePtr &state ) const
{
if( !shaderVector || shaderVector->members().size() == 0 )
{
return NULL;
}
IECore::InternedString metadataTarget;
const IECore::CompoundData *shaderParameters = NULL;
if( const IECore::Shader *shader = IECore::runTimeCast<const IECore::Shader>( shaderVector->members().back().get() ) )
{
metadataTarget = attributeName.string() + ":" + shader->getName();
shaderParameters = shader->parametersData();
}
else if( const IECore::Light *light = IECore::runTimeCast<const IECore::Light>( shaderVector->members().back().get() ) )
{
/// \todo Remove once all Light node derived classes are
/// creating only shaders.
metadataTarget = attributeName.string() + ":" + light->getName();
shaderParameters = light->parametersData().get();
}
if( !shaderParameters )
{
return NULL;
}
ConstStringDataPtr type = Metadata::value<StringData>( metadataTarget, "type" );
ConstM44fDataPtr orientation = Metadata::value<M44fData>( metadataTarget, "visualiserOrientation" );
const Color3f color = parameter<Color3f>( metadataTarget, shaderParameters, "colorParameter", Color3f( 1.0f ) );
const float intensity = parameter<float>( metadataTarget, shaderParameters, "intensityParameter", 1 );
const float exposure = parameter<float>( metadataTarget, shaderParameters, "exposureParameter", 0 );
const Color3f finalColor = color * intensity * pow( 2.0f, exposure );
if( type && type->readable() == "area" )
{
const std::string textureName = parameter<std::string>( metadataTarget, shaderParameters, "textureNameParameter", "" );
const bool flipNormal = parameter<bool>( metadataTarget, shaderParameters, "flipNormalParameter", 0 );
const bool doubleSided = parameter<bool>( metadataTarget, shaderParameters, "doubleSidedParameter", 0 );
const bool sphericalProjection = parameter<bool>( metadataTarget, shaderParameters, "sphericalProjectionParameter", 0 );
M44f projectionTransform = parameter<M44f>( metadataTarget, shaderParameters, "projectionTransformParameter", M44f() );
const std::vector<float> projectionTransformVector = parameter<std::vector<float> >( metadataTarget, shaderParameters, "projectionTransformParameter", std::vector<float>() );
if( projectionTransformVector.size() == 16 )
{
projectionTransform = M44f( (float(*)[4])(&projectionTransformVector[0]) );
}
addAreaLightVisualiser( state, finalColor, textureName, flipNormal, doubleSided,
sphericalProjection, projectionTransform );
return NULL;
}
GroupPtr result = new Group;
const float locatorScale = parameter<float>( metadataTarget, shaderParameters, "locatorScaleParameter", 1 );
Imath::M44f topTrans;
if( orientation )
{
topTrans = orientation->readable();
}
topTrans.scale( V3f( locatorScale ) );
result->setTransform( topTrans );
if( type && type->readable() == "environment" )
{
const std::string textureName = parameter<std::string>( metadataTarget, shaderParameters, "textureNameParameter", "" );
addEnvLightVisualiser( result, finalColor, textureName );
}
else
{
float coneAngle = parameter<float>( metadataTarget, shaderParameters, "coneAngleParameter", 0.0f );
float penumbraAngle = parameter<float>( metadataTarget, shaderParameters, "penumbraAngleParameter", 0.0f );
if( ConstStringDataPtr angleUnit = Metadata::value<StringData>( metadataTarget, "angleUnit" ) )
{
if( angleUnit->readable() == "radians" )
{
coneAngle *= 180.0 / M_PI;
penumbraAngle *= 180 / M_PI;
}
}
const std::string *penumbraType = NULL;
ConstStringDataPtr penumbraTypeData = Metadata::value<StringData>( metadataTarget, "penumbraType" );
if( penumbraTypeData )
{
penumbraType = &penumbraTypeData->readable();
}
float lensRadius = 0.0f;
if( parameter<bool>( metadataTarget, shaderParameters, "lensRadiusEnableParameter", true ) )
{
lensRadius = parameter<float>( metadataTarget, shaderParameters, "lensRadiusParameter", 0.0f );
}
addBasicLightVisualiser( type, result, finalColor, coneAngle, penumbraAngle, penumbraType, lensRadius / locatorScale );
}
//.........这里部分代码省略.........