本文整理汇总了C++中iecore::MurmurHash::append方法的典型用法代码示例。如果您正苦于以下问题:C++ MurmurHash::append方法的具体用法?C++ MurmurHash::append怎么用?C++ MurmurHash::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iecore::MurmurHash
的用法示例。
在下文中一共展示了MurmurHash::append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hashEngine
void VectorWarp::hashEngine( const Imath::V2i &tileOrigin, const Gaffer::Context *context, IECore::MurmurHash &h ) const
{
Warp::hashEngine( tileOrigin, context, h );
h.append( tileOrigin );
ConstStringVectorDataPtr channelNames;
{
ImagePlug::GlobalScope c( context );
channelNames = vectorPlug()->channelNamesPlug()->getValue();
vectorPlug()->dataWindowPlug()->hash( h );
inPlug()->formatPlug()->hash( h );
}
ImagePlug::ChannelDataScope channelDataScope( context );
if( ImageAlgo::channelExists( channelNames->readable(), "R" ) )
{
channelDataScope.setChannelName( "R" );
vectorPlug()->channelDataPlug()->hash( h );
}
if( ImageAlgo::channelExists( channelNames->readable(), "G" ) )
{
channelDataScope.setChannelName( "G" );
vectorPlug()->channelDataPlug()->hash( h );
}
if( ImageAlgo::channelExists( channelNames->readable(), "A" ) )
{
channelDataScope.setChannelName( "A" );
vectorPlug()->channelDataPlug()->hash( h );
}
vectorModePlug()->hash( h );
vectorUnitsPlug()->hash( h );
}
示例2: hashChannelData
void CopyChannels::hashChannelData( const GafferImage::ImagePlug *parent, const Gaffer::Context *context, IECore::MurmurHash &h ) const
{
ConstCompoundObjectPtr mapping;
{
ImagePlug::GlobalScope c( context );
mapping = mappingPlug()->getValue();
}
if( const IntData *i = mapping->member<const IntData>( context->get<string>( ImagePlug::channelNameContextName ) ) )
{
const ImagePlug *inputImage = inPlugs()->getChild<ImagePlug>( i->readable() );
const V2i tileOrigin = context->get<V2i>( ImagePlug::tileOriginContextName );
const Box2i tileBound( tileOrigin, tileOrigin + V2i( ImagePlug::tileSize() ) );
Box2i inputDataWindow;
{
ImagePlug::GlobalScope c( context );
inputDataWindow = inputImage->dataWindowPlug()->getValue();
}
const Box2i validBound = BufferAlgo::intersection( tileBound, inputDataWindow );
if( validBound == tileBound )
{
h = inputImage->channelDataPlug()->hash();
}
else
{
ImageProcessor::hashChannelData( parent, context, h );
if( !BufferAlgo::empty( validBound ) )
{
inputImage->channelDataPlug()->hash( h );
h.append( BufferAlgo::intersection( inputDataWindow, tileBound ) );
}
}
}
else
{
h = ImagePlug::blackTile()->Object::hash();
}
}
示例3: hash
IECore::MurmurHash StringPlug::hash() const
{
bool performSubstitution = direction()==Plug::In && !getInput<ValuePlug>() && Plug::getFlags( Plug::PerformsSubstitutions );
if( performSubstitution )
{
IECore::ConstObjectPtr o = getObjectValue();
const IECore::StringData *s = IECore::runTimeCast<const IECore::StringData>( o.get() );
if( !s )
{
throw IECore::Exception( "StringPlug::getObjectValue() didn't return StringData - is the hash being computed correctly?" );
}
if( Context::hasSubstitutions( s->readable() ) )
{
IECore::MurmurHash result;
result.append( Context::current()->substitute( s->readable() ) );
return result;
}
}
// no substitutions
return ValuePlug::hash();
}
示例4: AiNode
AtNode *InstancingConverter::convert( const IECore::Primitive *primitive, const IECore::MurmurHash &additionalHash )
{
IECore::MurmurHash h = primitive->::IECore::Object::hash();
h.append( additionalHash );
MemberData::Cache::accessor a;
if( m_data->cache.insert( a, h ) )
{
a->second = NodeAlgo::convert( primitive );
return a->second;
}
else
{
if( a->second )
{
AtNode *instance = AiNode( "ginstance" );
AiNodeSetPtr( instance, "node", a->second );
return instance;
}
}
return NULL;
}
示例5: hash
void ImageStats::hash( const ValuePlug *output, const Context *context, IECore::MurmurHash &h ) const
{
ComputeNode::hash( output, context, h);
const int colorIndex = ::colorIndex( output );
if( colorIndex == -1 )
{
// Not a plug we know about
return;
}
const std::string channelName = this->channelName( colorIndex );
const Imath::Box2i area = areaPlug()->getValue();
if( channelName.empty() || BufferAlgo::empty( area ) )
{
h.append( static_cast<const FloatPlug *>( output )->defaultValue() );
return;
}
Sampler s( inPlug(), channelName, area );
s.hash( h );
}
示例6: hashAttributes
void Grid::hashAttributes( const ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent, IECore::MurmurHash &h ) const
{
Source::hashAttributes( path, context, parent, h );
if( path.size() == 1 )
{
h.append( 1 );
}
else if( path.size() == 2 )
{
if( path.back() == g_gridLinesName )
{
gridPixelWidthPlug()->hash( h );
}
else if( path.back() == g_centerLinesName )
{
centerPixelWidthPlug()->hash( h );
}
else if( path.back() == g_borderLinesName )
{
borderPixelWidthPlug()->hash( h );
}
}
}
示例7: contextHash
IECore::MurmurHash contextHash( const Context *context, bool ignoreFrame = false ) const
{
IECore::MurmurHash result;
std::vector<IECore::InternedString> names;
context->names( names );
for( std::vector<IECore::InternedString>::const_iterator it = names.begin(); it != names.end(); ++it )
{
// Ignore the UI values since they should be irrelevant
// to execution.
if( boost::starts_with( it->string(), "ui:" ) )
{
continue;
}
if( ignoreFrame && *it == g_frame )
{
continue;
}
result.append( *it );
context->get<const IECore::Data>( *it )->hash( result );
}
return result;
}
示例8: hashChannelData
void ColorProcessor::hashChannelData( const GafferImage::ImagePlug *output, const Gaffer::Context *context, IECore::MurmurHash &h ) const
{
const std::string &channels = channelsPlug()->getValue();
const std::string &channel = context->get<std::string>( ImagePlug::channelNameContextName );
const std::string &baseName = ImageAlgo::baseName( channel );
if(
( baseName != "R" && baseName != "G" && baseName != "B" ) ||
!StringAlgo::matchMultiple( channel, channels )
)
{
// Auxiliary channel, or not in channel mask. Pass through.
h = inPlug()->channelDataPlug()->hash();
return;
}
ImageProcessor::hashChannelData( output, context, h );
h.append( baseName );
{
Context::EditableScope layerScope( context );
layerScope.set( g_layerNameKey, ImageAlgo::layerName( channel ) );
colorDataPlug()->hash( h );
}
}
示例9: hashDataWindow
void Constant::hashDataWindow( const GafferImage::ImagePlug *output, const Gaffer::Context *context, IECore::MurmurHash &h ) const
{
ImageNode::hashDataWindow( output, context, h );
h.append( formatPlug()->hash() );
}
示例10: hashBranchSet
void Duplicate::hashBranchSet( const ScenePath &parentPath, const IECore::InternedString &setName, const Gaffer::Context *context, IECore::MurmurHash &h ) const
{
h.append( inPlug()->setHash( setName ) );
targetPlug()->hash( h );
childNamesPlug()->hash( h );
}
示例11: hashObject
void AlembicSource::hashObject( const ScenePath &path, const Gaffer::Context *context, const ScenePlug *parent, IECore::MurmurHash &h ) const
{
FileSource::hashObject( path, context, parent, h );
h.append( context->getFrame() );
}
示例12: hash
void ValuePlug::hash( IECore::MurmurHash &h ) const
{
h.append( hash() );
}
示例13: hashChannelData
void ColorProcessor::hashChannelData( const GafferImage::ImagePlug *output, const Gaffer::Context *context, IECore::MurmurHash &h ) const
{
ImageProcessor::hashChannelData( output, context, h );
h.append( context->get<std::string>( ImagePlug::channelNameContextName ) );
colorDataPlug()->hash( h );
}
示例14: hashChannelData
void Mix::hashChannelData( const GafferImage::ImagePlug *output, const Gaffer::Context *context, IECore::MurmurHash &h ) const
{
const float mix = mixPlug()->getValue();
if( mix == 0.0f )
{
h = inPlugs()->getChild< ImagePlug >( 0 )->channelDataPlug()->hash();
return;
}
else if( mix == 1.0f && !maskPlug()->getInput<ValuePlug>() )
{
h = inPlugs()->getChild< ImagePlug >( 1 )->channelDataPlug()->hash();
return;
}
ImageProcessor::hashChannelData( output, context, h );
h.append( mix );
const std::string channelName = context->get<std::string>( ImagePlug::channelNameContextName );
const V2i tileOrigin = context->get<V2i>( ImagePlug::tileOriginContextName );
const Box2i tileBound( tileOrigin, tileOrigin + V2i( ImagePlug::tileSize() ) );
for( ImagePlugIterator it( inPlugs() ); !it.done(); ++it )
{
if( !(*it)->getInput<ValuePlug>() )
{
continue;
}
IECore::ConstStringVectorDataPtr channelNamesData;
Box2i dataWindow;
{
ImagePlug::GlobalScope c( Context::current() );
channelNamesData = (*it)->channelNamesPlug()->getValue();
dataWindow = (*it)->dataWindowPlug()->getValue();
}
const std::vector<std::string> &channelNames = channelNamesData->readable();
if( ImageAlgo::channelExists( channelNames, channelName ) )
{
(*it)->channelDataPlug()->hash( h );
}
// The hash of the channel data we include above represents just the data in
// the tile itself, and takes no account of the possibility that parts of the
// tile may be outside of the data window. This simplifies the implementation of
// nodes like Constant (where all tiles are identical, even the edge tiles) and
// Crop (which does no processing of tiles at all). For most nodes this doesn't
// matter, because they don't change the data window, or they use a Sampler to
// deal with invalid pixels. But because our data window is the union of all
// input data windows, we may be using/revealing the invalid parts of a tile. We
// deal with this in computeChannelData() by treating the invalid parts as black,
// and must therefore hash in the valid bound here to take that into account.
const Box2i validBound = boxIntersection( tileBound, dataWindow );
h.append( validBound );
}
IECore::ConstStringVectorDataPtr maskChannelNamesData;
Box2i maskDataWindow;
{
ImagePlug::GlobalScope c( Context::current() );
maskChannelNamesData = maskPlug()->channelNamesPlug()->getValue();
maskDataWindow = maskPlug()->dataWindowPlug()->getValue();
}
const std::string &maskChannel = maskChannelPlug()->getValue();
if( maskPlug()->getInput<ValuePlug>() && ImageAlgo::channelExists( maskChannelNamesData->readable(), maskChannel ) )
{
h.append( maskPlug()->channelDataHash( maskChannel, tileOrigin ) );
}
const Box2i maskValidBound = boxIntersection( tileBound, maskDataWindow );
h.append( maskValidBound );
}
示例15: if
void IECoreArnold::RendererImplementation::addPrimitive( const IECore::Primitive *primitive, const std::string &attributePrefix )
{
if( !m_motionTimes.empty() )
{
// We're in a motion block. Just store samples
// until we have all of them.
m_motionPrimitives.push_back( primitive );
if( m_motionPrimitives.size() != m_motionTimes.size() )
{
return;
}
}
const CompoundDataMap &attributes = m_attributeStack.top().attributes->readable();
AtNode *shape = NULL;
if( automaticInstancing() )
{
IECore::MurmurHash hash;
for( CompoundDataMap::const_iterator it = attributes.begin(), eIt = attributes.end(); it != eIt; it++ )
{
if(
boost::starts_with( it->first.value(), attributePrefix ) ||
boost::starts_with( it->first.c_str(), "ai:shape:" )
)
{
hash.append( it->first.value() );
it->second->hash( hash );
}
}
if( !m_motionTimes.empty() )
{
vector<const Primitive *> prims;
for( vector<ConstPrimitivePtr>::const_iterator it = m_motionPrimitives.begin(), eIt = m_motionPrimitives.end(); it != eIt; ++it )
{
prims.push_back( it->get() );
}
shape = m_instancingConverter->convert( prims, m_motionTimes, hash );
}
else
{
shape = m_instancingConverter->convert( primitive, hash );
}
}
else
{
if( !m_motionTimes.empty() )
{
vector<const Object *> prims;
for( vector<ConstPrimitivePtr>::const_iterator it = m_motionPrimitives.begin(), eIt = m_motionPrimitives.end(); it != eIt; ++it )
{
prims.push_back( it->get() );
}
shape = NodeAlgo::convert( prims, m_motionTimes );
}
else
{
shape = NodeAlgo::convert( primitive );
}
}
if( strcmp( AiNodeEntryGetName( AiNodeGetNodeEntry( shape ) ), "ginstance" ) )
{
// it's not an instance, copy over attributes destined for this object type.
const CompoundDataMap &attributes = m_attributeStack.top().attributes->readable();
for( CompoundDataMap::const_iterator it = attributes.begin(), eIt = attributes.end(); it != eIt; it++ )
{
if( boost::starts_with( it->first.value(), attributePrefix ) )
{
ParameterAlgo::setParameter( shape, it->first.value().c_str() + attributePrefix.size(), it->second.get() );
}
else if( boost::starts_with( it->first.c_str(), "ai:shape:" ) )
{
ParameterAlgo::setParameter( shape, it->first.value().c_str() + 9, it->second.get() );
}
}
}
else
{
// it's an instance - make sure we don't get double transformations.
AiNodeSetBool( shape, "inherit_xform", false );
}
addShape( shape );
}