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


C++ DrawElementsUInt::index方法代码示例

本文整理汇总了C++中DrawElementsUInt::index方法的典型用法代码示例。如果您正苦于以下问题:C++ DrawElementsUInt::index方法的具体用法?C++ DrawElementsUInt::index怎么用?C++ DrawElementsUInt::index使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DrawElementsUInt的用法示例。


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

示例1: updateVertexMaskingVector

/***************************************************************
* Function: updateVertexMaskingVector()
*
* 'updateVertexMaskingVector' without input value: checks all
* 'CAVEGeometry' objects and mark vertices of selected geometries
*  in 'mVertexMaskingVector', and vertices clusters of them.
*
***************************************************************/
void CAVEGeodeShape::updateVertexMaskingVector()
{
    mVertexMaskingVector.clear();
    mVertexMaskingVector.resize(mNumVertices, false);

    if (mGeometryVector.size() <= 0) return;
    for (int i = 0; i < mGeometryVector.size(); i++)
    {
	if (mGeometryVector[i]->mDOCollectorIndex >= 0)
	{
	    /* mark single indices contained in mGeometryVector[i] */
	    unsigned int nPrimitiveSets = mGeometryVector[i]->getNumPrimitiveSets();
	    if (nPrimitiveSets > 0)
	    {
		for (int j = 0; j < nPrimitiveSets; j++)
		{
	    	    PrimitiveSet *primSetRef = mGeometryVector[i]->getPrimitiveSet(j);

	    	    /* support primitive set 'DrawElementsUInt', add more types of primitive sets here if needed */
		    DrawElementsUInt* drawElementUIntRef = dynamic_cast <DrawElementsUInt*> (primSetRef);
		    if (drawElementUIntRef)
		    {
			unsigned int nIdices = drawElementUIntRef->getNumIndices();
			if (nIdices > 0)
			{
			    for (int k = 0; k < nIdices; k++)
			    {
				const int index = drawElementUIntRef->index(k);
				mVertexMaskingVector[index] = true;
			    }
			}
		    }
		}
	    }

	    /* mark clustered indices contained in 'mIndexClusterVector' */
	    const int numClusters = mGeometryVector[i]->mIndexClusterVector.size();
	    for (int j = 0; j < numClusters; j++)
	    {
		CAVEGeometry::IndexClusterBase *clusterPtr = mGeometryVector[i]->mIndexClusterVector[j];
		for (int k = 0; k < clusterPtr->mNumIndices; k++)
		{
		    const int index = clusterPtr->mIndexVector[k];
		    mVertexMaskingVector[index] = true;
		}
	    }
	}
    }
}
开发者ID:aprudhomme,项目名称:calvr_plugins,代码行数:57,代码来源:CAVEGeodeShape.cpp

示例2: mDOCollectorIndex

//Constructor: Making deep copy of 'refGeometry' without copy of 'mDOCollectorIndex'
CAVEGeometry::CAVEGeometry(CAVEGeometry *refGeometry): mDOCollectorIndex(-1)
{
    /* copy primitive set and index clusters */
    unsigned int nPrimitiveSets = refGeometry->getNumPrimitiveSets();
    if (nPrimitiveSets > 0)
    {
        for (int i = 0; i < nPrimitiveSets; i++)
        {
            PrimitiveSet* primSetRef = refGeometry->getPrimitiveSet(i);

            /* support primitive set 'DrawElementsUInt', add more types of primitive sets here if needed */
            DrawElementsUInt* drawElementUIntRef = dynamic_cast <DrawElementsUInt*> (primSetRef);
            if (drawElementUIntRef)
            {
                unsigned int nIdices = drawElementUIntRef->getNumIndices();
                const GLenum &mode = drawElementUIntRef->getMode();

                /* create duplicated primitive set, copy index field and add it to 'this' */
                DrawElementsUInt* drawElementUIntDup = new DrawElementsUInt(mode, 0);
                if (nIdices > 0)
                {
                    for (int j = 0; j < nIdices; j++) drawElementUIntDup->push_back(drawElementUIntRef->index(j));
                }
                addPrimitiveSet(drawElementUIntDup);
            }
        }
    }

    /* copy the field of overlapping index by calling addIndexCluster() function sets */
    const IndexClusterVector &refClusterVector = refGeometry->mIndexClusterVector;
    if (refClusterVector.size() > 0)
    {
        for (IndexClusterVector::const_iterator itrCluster = refClusterVector.begin();
                itrCluster != refClusterVector.end(); itrCluster++)
        {
            IndexClusterBase *clusterPtr = *itrCluster;
            addIndexCluster(clusterPtr);
        }
    }
}
开发者ID:aprudhomme,项目名称:calvr_plugins,代码行数:41,代码来源:CAVEGeometry.cpp


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