FromHoudiniCurvesConverter::DuplicateEnds::ReturnType FromHoudiniCurvesConverter::DuplicateEnds::operator()( typename T::Ptr data ) const
{
	assert( data );

	typedef typename T::ValueType::value_type ValueType;

	std::vector<ValueType> newValues;
	const std::vector<ValueType> &origValues = data->readable();
	
	size_t index = 0;
	for ( size_t i=0; i < m_vertsPerCurve.size(); i++ )
	{
		for ( size_t j=0; j < (size_t)m_vertsPerCurve[i]; j++, index++ )
		{
			newValues.push_back( origValues[index] );
			
			if ( j == 0 || j == (size_t)m_vertsPerCurve[i]-1 )
			{
				newValues.push_back( origValues[index] );
				newValues.push_back( origValues[index] );
			}
		}
	}
	
	data->writable().swap( newValues );
}
예제 #2
0
	DataPtr operator() ( typename T::Ptr data ) const
	{
		assert( data );
		typedef typename T::ValueType::value_type Value;

		const unsigned vPoints = m_resolution.y;
		const unsigned uPoints = m_resolution.x;

		typename T::Ptr newData = new T();
		newData->writable().reserve( ( vPoints ) * uPoints );

		for ( unsigned int v = 0; v < vPoints; v++ )
		{
			int iSeg;
			float fSeg;

			if ( v == vPoints - 1 )
			{
				iSeg = m_curves->numSegments( m_curveIndex ) - 1;
				fSeg = 0.9999f;
			}
			else
			{
				float curveParam = float(v) / ( vPoints - 1 );
				fSeg = curveParam * m_curves->numSegments( m_curveIndex );
				iSeg = (int)floor( fSeg );
				fSeg = fSeg - iSeg;
			}

			for ( unsigned u = 0; u < uPoints ; u ++)
			{
				Value value;
				LinearInterpolator<Value>()(
					data->readable()[ m_varyingOffset + iSeg ],
					data->readable()[ m_varyingOffset + iSeg + 1],
					fSeg,
					value
				);
				newData->writable().push_back( value );
			}
		}

		return newData;
	}
예제 #3
0
		IECore::DataPtr operator()( typename T::Ptr inData )
		{
			assert( inData );

			const typename T::Ptr outData = new T();
			outData->writable().resize( m_vertIds->readable().size() );

			typename T::ValueType::iterator outIt = outData->writable().begin();

			for ( typename T::ValueType::size_type i = 0; i <  m_vertIds->readable().size(); i++ )
			{
				*outIt++ = inData->readable()[ m_vertIds->readable()[ i ] ];
			}

			return outData;
		}
예제 #4
0
	object operator()( typename T::Ptr data )
	{
		return object( data->readable() );
	}
예제 #5
0
	DataPtr operator() ( typename T::Ptr data ) const
	{
		assert( data );
		return new TypedData< typename T::ValueType::value_type >( data->readable()[ m_curveIndex ] );
	}