• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ typenamet::Ptr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中typenamet::Ptr的典型用法代码示例。如果您正苦于以下问题:C++ Ptr类的具体用法?C++ Ptr怎么用?C++ Ptr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Ptr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: operator

	ReturnType operator()( const T *data )
	{
		PrimitiveVariableMap::iterator it = m_mesh->variables.find( m_name );
		if ( it == m_mesh->variables.end() && !m_remove )
		{
			typename T::Ptr data2 = 0;

			std::map<ConstDataPtr, DataPtr>::iterator dataIt = m_visitedData.find( data );
			if ( dataIt != m_visitedData.end() )
			{
				data2 = runTimeCast<T>( dataIt->second );
			}
			
			if ( !data2 )
			{
				typedef typename T::ValueType::value_type ValueType;
				ValueType defaultValue = DefaultValue<ValueType>()();
				size_t size = m_mesh->variableSize( m_interpolation ) - data->readable().size();
				
				data2 = new T();
				data2->writable().insert( data2->writable().end(), size, defaultValue );
				data2->writable().insert( data2->writable().end(), data->readable().begin(), data->readable().end() );
			}
			
			m_mesh->variables[m_name] = PrimitiveVariable( m_interpolation, data2 );
			
			m_visitedData[data] = data2;
		}
	}
开发者ID:AtomicFiction,项目名称:cortex,代码行数:29,代码来源:MeshMergeOp.cpp


示例2:

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 );
}
开发者ID:danbethell,项目名称:cortex,代码行数:26,代码来源:FromHoudiniCurvesConverter.cpp


示例3: operator

	ReturnType operator()( T * data )
	{
		typedef typename T::ValueType VecContainer;
		typedef typename VecContainer::value_type Vec;

		const VecContainer &points = data->readable();
		
		unsigned numElements = points.size();
		
		typename T::Ptr vD = new T();
		vTangentsData = vD;
		
		VecContainer &vTangents = vD->writable();
		vTangents.resize( numElements );
		
		PrimitiveEvaluator::ResultPtr result = m_evaluator->createResult();
		
		unsigned pIndex = 0;
		for( size_t curveIndex = 0; curveIndex < m_vertsPerCurve.size() ; curveIndex++ )
		{
			float v;
			float vStep = 1.0f / m_vertsPerCurve[curveIndex];
			
			for( int i = 0; i < m_vertsPerCurve[curveIndex]; i++ ) 
			{
				v = min( 1.0f, i * vStep );			
				m_evaluator->pointAtV( curveIndex, v, result );
				vTangents[ pIndex + i ] = result->vTangent().normalized();
			}
			pIndex += m_vertsPerCurve[curveIndex];
		}	
	}
开发者ID:Alwnikrotikz,项目名称:cortex-vfx,代码行数:32,代码来源:CurveTangentsOp.cpp


示例4: vectorDataFromTypeDesc

typename T::Ptr vectorDataFromTypeDesc( TypeDesc type, void *&basePointer )
{
    typename T::Ptr result = new T();
    result->writable().resize( type.arraylen, typename T::ValueType::value_type( 0 ) );
    basePointer = result->baseWritable();
    return result;
}
开发者ID:mor-vfx,项目名称:gaffer,代码行数:7,代码来源:OSLRenderer.cpp


示例5: T

ToHoudiniCurvesConverter::RemoveDuplicateEnds::ReturnType ToHoudiniCurvesConverter::RemoveDuplicateEnds::operator()( typename T::ConstPtr data ) const
{
	assert( data );

	typedef typename T::ValueType::value_type ValueType;

	const std::vector<ValueType> &origValues = data->readable();

	typename T::Ptr result = new T();
	std::vector<ValueType> &newValues = result->writable();
	
	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++ )
		{
			if ( j > 1 && j < (size_t)m_vertsPerCurve[i]-2 )
			{
				newValues.push_back( origValues[index] );
			}
		}
	}
	
	return result;
}
开发者ID:richardmonette,项目名称:cortex,代码行数:25,代码来源:ToHoudiniCurvesConverter.cpp


示例6: evaluatePrimitiveVariable

static DataPtr evaluatePrimitiveVariable( std::vector<GxSurfacePoint> &points, const std::string &primVarName )
{
	typename T::Ptr result = new T;
	result->writable().resize( points.size() );
	if( points.size() )
	{
		GxEvaluateSurface( points.size(), &(points[0]), primVarName.c_str(), result->baseSize() / points.size(), result->baseWritable() );
	}
	return result;
}
开发者ID:Alwnikrotikz,项目名称:cortex-vfx,代码行数:10,代码来源:GXEvaluator.cpp


示例7: operator

	DataPtr operator() ( T * 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 + 2 ) * uPoints );

		for ( unsigned int v = 0; v < vPoints; v++ )
		{
			size_t 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 = (size_t)floor( fSeg );
				fSeg = fSeg - iSeg;
			}

			const int num = v == 0 || v == vPoints - 1 ? 2 : 1;

			const size_t i0 = iSeg;
			const size_t i1 = std::min( iSeg + 1, m_curves->variableSize( PrimitiveVariable::Varying, m_curveIndex ) );

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

		return newData;
	}
开发者ID:Shockspot,项目名称:cortex,代码行数:52,代码来源:CurveExtrudeOp.cpp


示例8: operator

		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;
		}
开发者ID:Alwnikrotikz,项目名称:cortex-vfx,代码行数:16,代码来源:MeshPrimitive.cpp


示例9: operator

		IECore::DataPtr operator()( const T *inData )
		{
			const typename T::Ptr outData = new T();
			typename T::ValueType &out = outData->writable();
			out.resize( m_numVertices );

			size_t inIndex = 0;
			size_t outIndex = 0;
			const typename T::ValueType &in = inData->readable();
			for( vector<int>::const_iterator it = m_vertsPerCurve.begin(), eIt = m_vertsPerCurve.end(); it != eIt; it++ )
			{
				for( int i=0; i<*it; i++ )
				{
					out[outIndex++] = in[inIndex];
				}
				inIndex += m_step;
			}

			return outData;
		}
开发者ID:ImageEngine,项目名称:cortex,代码行数:20,代码来源:ToGLCurvesConverter.cpp


示例10: fnArrayData

IECore::ObjectPtr FromMayaArrayDataConverter<F,T>::doConversion( const MObject &object, IECore::ConstCompoundObjectPtr operands ) const
{
    typename MArrayTraits<F>::DataFn fnArrayData( object );
    if( !fnArrayData.hasObj( object ) )
    {
        return 0;
    }

    F array = fnArrayData.array();
    typename T::Ptr resultData = new T;
    typename T::ValueType &resultArray = resultData->writable();

    resultArray.resize( array.length() );
    for( unsigned int i=0; i<resultArray.size(); i++ )
    {
        resultArray[i] = IECore::convert<typename T::ValueType::value_type, typename MArrayTraits<F>::ValueType>( array[i] );
    }

    return resultData;
}
开发者ID:mor-vfx,项目名称:cortex,代码行数:20,代码来源:FromMayaArrayDataConverter.cpp


示例11: CreateUnmatchedResult

 Analysis::Result::Ptr DetectIn(LookaheadPluginsStorage<T>& container, DataLocation::Ptr input, const Module::DetectCallback& callback) const
 {
   const bool firstScan = 0 == Offset;
   const std::size_t maxSize = input->GetData()->Size();
   for (typename T::Iterator::Ptr iter = container.Enumerate(); iter->IsValid(); iter->Next())
   {
     Time::Timer timer;
     const typename T::Ptr plugin = iter->Get();
     const Analysis::Result::Ptr result = plugin->Detect(Params, input, callback);
     const String id = plugin->GetDescription()->Id();
     if (const std::size_t usedSize = result->GetMatchedDataSize())
     {
       Statistic::Self().AddAimed(*plugin, timer);
       Dbg("Detected %1% in %2% bytes at %3%.", id, usedSize, input->GetPath()->AsString());
       return result;
     }
     else
     {
       if (!firstScan)
       {
         Statistic::Self().AddMissed(*plugin, timer);
         timer = Time::Timer();
       }
       const std::size_t lookahead = result->GetLookaheadOffset();
       container.SetPluginLookahead(*plugin, id, lookahead);
       if (lookahead == maxSize)
       {
         Statistic::Self().AddAimed(*plugin, timer);
       }
       else
       {
         Statistic::Self().AddScanned(*plugin, timer);
       }
     }
   }
   const std::size_t minLookahead = container.GetMinimalPluginLookahead();
   return Analysis::CreateUnmatchedResult(minLookahead);
 }
开发者ID:djdron,项目名称:zxtune,代码行数:38,代码来源:raw_supp.cpp


示例12: operator

	ReturnType operator()( typename T::Ptr data )
	{
		typedef typename T::ValueType Container;
		typedef typename Container::value_type V;

		Container &output = data->writable();
		
		V2i paddedSize = m_size + V2i( 2 );

		V *op = &(output[0]);
		const char *ip = &(m_input[0]) + paddedSize.x + 1;
		for( int y=0; y<m_size.y; y++ )
		{
			for( int x=0; x<m_size.x; x++ )
			{
				*op++ = *ip++;
			}
			ip +=2; // skip padding on right and left of next row
		}
	}
开发者ID:Alwnikrotikz,项目名称:cortex-vfx,代码行数:20,代码来源:HitMissTransform.cpp


示例13: geometricVectorDataFromTypeDesc

typename T::Ptr geometricVectorDataFromTypeDesc( TypeDesc type, void *&basePointer )
{
    typename T::Ptr result = vectorDataFromTypeDesc<T>( type, basePointer );
    result->setInterpretation( geometricInterpretationFromVecSemantics( (TypeDesc::VECSEMANTICS)type.vecsemantics ) );
    return result;
}
开发者ID:mor-vfx,项目名称:gaffer,代码行数:6,代码来源:OSLRenderer.cpp


示例14: hexToDecVector

static typename T::Ptr hexToDecVector( const char *s )
{
	typename T::Ptr result = new T;
	IECore::hexToDec<typename T::ValueType::value_type>( s, s + strlen( s ), std::back_insert_iterator<typename T::ValueType>( result->writable() ) );
	return result;
}
开发者ID:Alwnikrotikz,项目名称:cortex-vfx,代码行数:6,代码来源:HexConversionBinding.cpp


示例15: operator

	ReturnType operator()( T * data )
	{
		typedef typename T::ValueType VecContainer;
		typedef typename VecContainer::value_type Vec;

		const VecContainer &points = data->readable();
		
		// the uvIndices array is indexed as with any other facevarying data. the values in the
		// array specify the connectivity of the uvs - where two facevertices have the same index
		// they are known to be sharing a uv. for each one of these unique indices we compute
		// the tangents and normal, by accumulating all the tangents and normals for the faces
		// that reference them. we then take this data and shuffle it back into facevarying
		// primvars for the mesh.
		int numUniqueTangents = 1 + *max_element( m_uvIds.begin(), m_uvIds.end() );
		
		VecContainer uTangents( numUniqueTangents, Vec( 0 ) );
		VecContainer vTangents( numUniqueTangents, Vec( 0 ) );
		VecContainer normals( numUniqueTangents, Vec( 0 ) );
		
		for( size_t faceIndex = 0; faceIndex < m_vertsPerFace.size() ; faceIndex++ )
		{
			
			assert( m_vertsPerFace[faceIndex] == 3 );

			// indices into the facevarying data for this face 
			size_t fvi0 = faceIndex * 3;
			size_t fvi1 = fvi0 + 1;
			size_t fvi2 = fvi1 + 1;
			assert( fvi2 < m_vertIds.size() );
			assert( fvi2 < m_u.size() );
			assert( fvi2 < m_v.size() );
			
			// positions for each vertex of this face
			const Vec &p0 = points[ m_vertIds[ fvi0 ] ];
			const Vec &p1 = points[ m_vertIds[ fvi1 ] ];
			const Vec &p2 = points[ m_vertIds[ fvi2 ] ];

			// uv coordinates for each vertex of this face
			const Imath::V2f uv0( m_u[ fvi0 ], m_v[ fvi0 ] );
			const Imath::V2f uv1( m_u[ fvi1 ], m_v[ fvi1 ] );
			const Imath::V2f uv2( m_u[ fvi2 ], m_v[ fvi2 ] );

			// compute tangents and normal for this face
			const Vec e0 = p1 - p0;
			const Vec e1 = p2 - p0;

			const Imath::V2f e0uv = uv1 - uv0;
			const Imath::V2f e1uv = uv2 - uv0;

			Vec tangent   = ( e0 * -e1uv.y + e1 * e0uv.y ).normalized();
			Vec bitangent = ( e0 * -e1uv.x + e1 * e0uv.x ).normalized();

			Vec normal = (p2-p1).cross(p0-p1);
			normal.normalize();

			// and accumlate them into the computation so far
			uTangents[ m_uvIds[fvi0] ] += tangent;
			uTangents[ m_uvIds[fvi1] ] += tangent;
			uTangents[ m_uvIds[fvi2] ] += tangent;
			
			vTangents[ m_uvIds[fvi0] ] += bitangent;
			vTangents[ m_uvIds[fvi1] ] += bitangent;
			vTangents[ m_uvIds[fvi2] ] += bitangent;
			
			normals[ m_uvIds[fvi0] ] += normal;
			normals[ m_uvIds[fvi1] ] += normal;
			normals[ m_uvIds[fvi2] ] += normal;
			
		}

		// normalize and orthogonalize everything
		for( size_t i = 0; i < uTangents.size(); i++ )
		{
			normals[i].normalize();

			uTangents[i].normalize();
			vTangents[i].normalize();

			// Make uTangent/vTangent orthogonal to normal
			uTangents[i] -= normals[i] * uTangents[i].dot( normals[i] );
			vTangents[i] -= normals[i] * vTangents[i].dot( normals[i] );

			uTangents[i].normalize();
			vTangents[i].normalize();

			if ( m_orthoTangents )
			{
				vTangents[i] -= uTangents[i] * vTangents[i].dot( uTangents[i] );
				vTangents[i].normalize();
			}
		
			// make things less sinister
			if( uTangents[i].cross( vTangents[i] ).dot( normals[i] ) < 0.0f )
			{
				uTangents[i] *= -1.0f;
			}
		}
		
		// convert the tangents back to facevarying data and add that to the mesh
		typename T::Ptr fvUD = new T();
//.........这里部分代码省略.........
开发者ID:AtomicFiction,项目名称:cortex,代码行数:101,代码来源:MeshTangentsOp.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ typenamewritertype::Pointer类代码示例发布时间:2022-05-31
下一篇:
C++ typenamestd::vector类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap