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


C++ hkArray::getSize方法代码示例

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


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

示例1: path

const char* HK_CALL hkDemoFileSystem::removeDemoBasePath( const char* pathIn, hkArray<char>& buffer )
{
	hkString path( pathIn );
	path.makeLowerCase();
	// strip everything up to the demo root folder
	hkString root("/demos/");
	root.makeLowerCase();

	const char* str = path.cString();
	const char* start = hkString::strStr(str, root.cString());
	if ( start != HK_NULL )
	{
		int pos = static_cast<int>(start - str) + root.getLength();
		buffer.setSize( path.getLength() - pos + 1 );
		// copy the part of the string that follows the demo prefix
		hkString::memCpy( buffer.begin(), pathIn+pos, buffer.getSize()-1 );
		buffer[ buffer.getSize()-1 ] = 0; // null terminate
		return buffer.begin();
	}
	else 
	{
		// nothing to do
		return pathIn;
	}
}
开发者ID:venkatarajasekhar,项目名称:viper,代码行数:25,代码来源:hkDemoFilesystem.cpp

示例2: compareHitArrays

//
// Test function to make sure that the hits from the kd-tree are identical to the ones from the broadphase.
//
static hkBool compareHitArrays(const hkAabb& aabb, const hkPrimitiveId* kdHits, int numKdHits, const hkArray<hkpBroadPhaseHandlePair>& sapHits)
{
	hkLocalArray<const hkpCollidable*> sapCollidables(sapHits.getSize());

	for (int i=0; i<sapHits.getSize(); i++)
	{
		const hkpTypedBroadPhaseHandle* tp = static_cast<const hkpTypedBroadPhaseHandle*>( sapHits[i].m_b );
		const hkpCollidable* collB = static_cast<hkpCollidable*>(tp->getOwner());

		// Make sure no spurious hits from the broadphase
		hkAabb colAabb;
		hkpRigidBody* rb = hkGetRigidBody(collB);

		if (rb)
		{
			collB->getShape()->getAabb(rb->getTransform(), 0.0f, colAabb);
			hkBool aabbOverlap = colAabb.overlaps(aabb);

			if (aabbOverlap)
				sapCollidables.pushBack(collB);
		}
	}

	// Make sure that the contents of the arrays at the same
	// It would be faster to sort and do a string compare, but this is just as easy.
	
	hkBool isOk = true;
	for (int i=0; i<numKdHits; i++)
	{
		const hkpCollidable* kdCollidable = reinterpret_cast<const hkpCollidable*> (kdHits[i]);
		int idx = sapCollidables.indexOf(kdCollidable);
		
		if(idx < 0)
		{
			// There's a hit in the kd-tree's list but not the 3AxisSweep's list
			// It's possible that 3AxisSweep skipped something. So get the AABB of the body in the kd-tree list.
			hkAabb colAabb;
			hkpRigidBody* rb = hkGetRigidBody(kdCollidable);
			kdCollidable->getShape()->getAabb(rb->getTransform(), rb->getWorld()->getCollisionInput()->getTolerance(), colAabb);
			
			hkBool aabbOverlap = colAabb.overlaps(aabb);
			if (!aabbOverlap)
			{
				// Something in the list doesn't overlap with the query's aabb
				isOk = false;
			}

			continue;
		}

		sapCollidables.removeAt(idx);
	}

	// If we made it this far, they must agree.
	return isOk && sapCollidables.isEmpty();
}
开发者ID:venkatarajasekhar,项目名称:viper,代码行数:59,代码来源:AabbQueryDemo.cpp

示例3: removeDuplicatesFromArray

void HK_CALL SlidingWorldDemo::removeDuplicatesFromArray(hkArray<hkpBroadPhaseHandle*>& objectsEnteringBroadphaseBorder )
{
	hkArray<hkpBroadPhaseHandle*> noDups;
	noDups.reserve( objectsEnteringBroadphaseBorder.getSize() );
	for (int i = 0; i < objectsEnteringBroadphaseBorder.getSize(); i++)
	{
		if( noDups.indexOf( objectsEnteringBroadphaseBorder[i] ) == -1)
		{
			noDups.pushBack( objectsEnteringBroadphaseBorder[i] );
		}
	}

	objectsEnteringBroadphaseBorder.swap( noDups );
	
}
开发者ID:venkatarajasekhar,项目名称:viper,代码行数:15,代码来源:SlidingWorldDemo.cpp

示例4: FillTransforms

static void FillTransforms( hkArray<hkQsTransform>& transforms, int boneIdx, int numTracks
                            , const hkQsTransform& localTransform, PosRotScale prs = prsDefault
                                    , int from=0, int to=-1)
{
    int n = transforms.getSize() / numTracks;
    if (n == 0)
        return;

    if (to == -1 || to >= n) to = n-1;

    if ((prs & prsDefault) == prsDefault)
    {
        for (int idx = from; idx <= to; ++idx)
        {
            hkQsTransform& transform = transforms[idx*numTracks + boneIdx];
            transform = localTransform;
        }
    }
    else
    {
        for (int idx = from; idx <= to; ++idx)
        {
            hkQsTransform& transform = transforms[idx*numTracks + boneIdx];
            if ((prs & prsPos) != 0)
                transform.setTranslation(localTransform.getTranslation());
            if ((prs & prsRot) != 0)
                transform.setRotation(localTransform.getRotation());
            if ((prs & prsScale) != 0)
                transform.setScale(localTransform.getScale());
        }
    }
}
开发者ID:aerisarn,项目名称:hkxcmd,代码行数:32,代码来源:ConvertKF.cpp

示例5: buildQueryObects

void WorldLinearCastMultithreadedDemo::buildQueryObects( hkArray<hkpShape*>& shapes, hkArray<QueryObject>& objects )
{
	hkpShapeDisplayBuilder::hkpShapeDisplayBuilderEnvironment env;
	hkpShapeDisplayBuilder builder(env);

	for (int i = 0; i < shapes.getSize(); i++)
	{
		QueryObject qo;
		qo.m_transform = new hkTransform();
		qo.m_transform->setIdentity();

		qo.m_collidable = new hkpCollidable( shapes[i], qo.m_transform );
		objects.pushBack( qo );

		hkArray<hkDisplayGeometry*> displayGeometries;

		builder.buildDisplayGeometries( shapes[i], displayGeometries );
		hkDebugDisplay::getInstance().addGeometry( displayGeometries, hkTransform::getIdentity(), (hkUlong)qo.m_collidable, 0, 0 );

		while( displayGeometries.getSize() )
		{
			delete displayGeometries[0];
			displayGeometries.removeAt(0);
		}

		// Set green color
		HK_SET_OBJECT_COLOR((hkUlong)qo.m_collidable, hkColor::rgbFromChars(0,255,0,120));
	}
}
开发者ID:venkatarajasekhar,项目名称:viper,代码行数:29,代码来源:WorldLinearCastMultithreadedDemo.cpp

示例6: setProperty

void hkvImageFileProperties::setProperty(const hkvProperty& prop, const hkArray<hkStringPtr>& path, hkUint32 stackIndex, hkvProperty::Purpose purpose)
{
  int stackSize = (path.getSize() - stackIndex);
  
  if ((stackSize != 0))
    return;

  if (hkvStringHelper::safeCompare(prop.getName(), "FileFormat") == 0)
  {
    if (m_imageFormatInstance.setByString(prop.getString()) != HK_SUCCESS)
    {
      m_imageFormatInstance.setByDefinitionId(HKV_IMAGE_FILE_FORMAT_INVALID);
    }
  }
  else if (hkvStringHelper::safeCompare(prop.getName(), "Width") == 0)
  {
    m_width = prop.getUint();
  }
  else if (hkvStringHelper::safeCompare(prop.getName(), "Height") == 0)
  {
    m_height = prop.getUint();
  }
  else if (hkvStringHelper::safeCompare(prop.getName(), "HasAlpha") == 0)
  {
    m_hasAlpha = prop.getBool();
  }
}
开发者ID:RexBaribal,项目名称:projectanarchy,代码行数:27,代码来源:hkvImageFileProperties.cpp

示例7: setSpecificProperty

void hkvTextureAsset::setSpecificProperty(const hkvProperty& prop, const hkArray<hkStringPtr>& path, unsigned int stackIndex, hkvProperty::Purpose purpose)
{
  int stackSize = (path.getSize() - stackIndex);

  if ((stackSize == 1) && (hkvStringHelper::safeCompare(path.back(), "Texture") == 0))
  {
    m_imageProperties.setProperty(prop, path, stackIndex + 1, purpose);
    
    // Usage is still present here for backwards compatibility to convert older asset libraries, but has now moved to the texture transform rule instead.
    if (hkvStringHelper::safeCompare(prop.getName(), "Usage") == 0)
    {
      if (purpose == hkvProperty::PURPOSE_SERIALIZATION)
      {
        if (m_usageInstance.setByString(prop.getString()) != HK_SUCCESS)
        {
          m_usageInstance.setByAvailableElementsId(0);
        }
      }
    }
    else if (hkvStringHelper::safeCompare(prop.getName(), "sRGB") == 0)
    {
      m_sRgb = prop.getBool();
    }
  }
}
开发者ID:RexBaribal,项目名称:projectanarchy,代码行数:25,代码来源:hkvTextureAsset.cpp

示例8: setSpecificProperty

void hkvTextureAsset::setSpecificProperty(const hkvProperty& prop, const hkArray<hkStringPtr>& path, unsigned int stackIndex, hkvProperty::Purpose purpose)
{
    int stackSize = (path.getSize() - stackIndex);

    if ((stackSize == 1) && (hkvStringHelper::safeCompare(path.back(), "Texture") == 0))
    {
        m_imageProperties.setProperty(prop, path, stackIndex + 1, purpose);

        if (hkvStringHelper::safeCompare(prop.getName(), "Usage") == 0)
        {
            if (purpose == hkvProperty::PURPOSE_SERIALIZATION)
            {
                if (m_usageInstance.setByString(prop.getString()) != HK_SUCCESS)
                {
                    m_usageInstance.setByAvailableElementsId(0);
                }
            }
            else
            {
                m_usageInstance.setByAvailableElementsId(prop.getEnumValue());
            }
        }
        else if (hkvStringHelper::safeCompare(prop.getName(), "sRGB") == 0)
        {
            m_sRgb = prop.getBool();
        }
    }
}
开发者ID:bgarrels,项目名称:projectanarchy,代码行数:28,代码来源:hkvTextureAsset.cpp

示例9: setInternalProperty

void hkvTagfileAsset::setInternalProperty(const hkvProperty& prop, const hkArray<hkStringPtr>& path, unsigned int stackIndex, hkvProperty::Purpose purpose)
{
  int stackSize = (path.getSize() - stackIndex);

  if ((stackSize >= 1) && (hkvStringHelper::safeCompare(path[stackIndex + 0], "Tagfile") == 0))
  {
    setTagfileArrayProperty(prop, path, stackIndex, purpose);
  }
}
开发者ID:Arpit007,项目名称:projectanarchy,代码行数:9,代码来源:hkvTagfileAsset.cpp

示例10: setProperty

void hkvTextureTransformationRule::setProperty(const hkvProperty& prop, const hkArray<hkStringPtr>& path, unsigned int iStackIndex, hkvProperty::Purpose purpose)
{
  int iStackSize = (path.getSize() - iStackIndex);

  if (iStackSize == 0)
  {
    if (hkvStringHelper::safeCompare(prop.getName(), "Compression") == 0)
    {
      if (purpose == hkvProperty::PURPOSE_SERIALIZATION)
      {
        if (m_compressionInstance.setByString(prop.getString()) != HK_SUCCESS)
        {
          m_compressionInstance.setByAvailableElementsId(0);
        }
      }
      else
      {
        m_compressionInstance.setByAvailableElementsId(prop.getEnumValue());
      }
    }
    else if (hkvStringHelper::safeCompare(prop.getName(), "Usage") == 0)
    {
      if (purpose == hkvProperty::PURPOSE_SERIALIZATION)
      {
        if (m_usageInstance.setByString(prop.getString()) != HK_SUCCESS)
        {
          m_usageInstance.setByAvailableElementsId(0);
        }
      }
      else
      {
        m_usageInstance.setByAvailableElementsId(prop.getEnumValue());
      }
    }
    else if (hkvStringHelper::safeCompare(prop.getName(), "RemoveAlphaChannel") == 0)
    {
      m_removeAlphaChannel = prop.getBool();
    }
    else if (hkvStringHelper::safeCompare(prop.getName(), "CreateMipMaps") == 0)
    {
      m_createMipMaps = prop.getBool();
    }
    else if (hkvStringHelper::safeCompare(prop.getName(), "DownscaleLevel") == 0)
    {
      m_downscaleLevel = prop.getUint();
    }
    else if (hkvStringHelper::safeCompare(prop.getName(), "MinimumSize") == 0)
    {
      m_minSize = prop.getUint();
    }
    else if (hkvStringHelper::safeCompare(prop.getName(), "MaximumSize") == 0)
    {
      m_maxSize = prop.getUint();
    }
  }
}
开发者ID:cDoru,项目名称:projectanarchy,代码行数:56,代码来源:hkvTextureTransformationRule.cpp

示例11: SetTransformScaleRange

static void SetTransformScaleRange( hkArray<hkQsTransform>& transforms, int numTracks, int boneIdx
                                    , float &currentTime, float lastTime, int &frame
                                    , FloatKey &first, FloatKey &last)
{
    int n = transforms.getSize()/numTracks;
    for ( ; COMPARE(currentTime, lastTime) <= 0 && frame < n; currentTime += FramesIncrement, ++frame)
    {
        hkQsTransform& transform = transforms[frame*numTracks + boneIdx];
        SetTransformScale(transform, first.data);
    }
}
开发者ID:aerisarn,项目名称:hkxcmd,代码行数:11,代码来源:ConvertKF.cpp

示例12: reorderTriangles

/*---------------------------------------------------------------------------*/
void NifCollisionUtility::reorderTriangles(hkArray<hkGeometry::Triangle>& srcAry)
{
	int		length  (srcAry.getSize() - 1);
	short	idxGroup(0);

	//  for each triangle in list
	for (int idx(0); idx < length; ++idx)
	{
		hkGeometry::Triangle&	dstTri(srcAry[idx]);
		hkGeometry::Triangle&	srcTri(srcAry[idx+1]);
		int						vertsDst[3] = {dstTri.m_a, dstTri.m_b, dstTri.m_c};
		int						vertsSrc[3] = {srcTri.m_a, srcTri.m_b, srcTri.m_c};
		short					idxDst(0);
		short					idxSrc(0);
		short					cntPts(0);

		//  find common edge
		for (; idxDst < 3; ++idxDst)
		{
			for (idxSrc=0; idxSrc < 3; ++idxSrc)
			{
				if (vertsSrc[idxSrc] == vertsDst[idxDst])	break;
			}

			if (idxSrc > 2)
			{
				vertsDst[idxDst] = -1;
			}
		}

		for (idxDst=0; idxDst < 3; ++idxDst)
		{
			if (vertsDst[idxDst] != -1)		++cntPts;
		}

		//  swap two vertices in case of uneven triangle in group having common edge with precessor
		if ((cntPts == 2) && ((idxGroup % 2) == 1))
		{
			int	tmp(srcTri.m_a);

			srcTri.m_a = srcTri.m_c;
			srcTri.m_c = tmp;
		}
		//  no common edge => start new group
		else if (cntPts != 2)
		{
			idxGroup = 0;
		}

		//  increase index in group
		++idxGroup;

	}  //  for (int idxRes(0); idxRes < length; ++idxRes)
}
开发者ID:Hashmi1,项目名称:NifConvert,代码行数:55,代码来源:NifCollisionUtility.cpp

示例13: addTimersToVdb

void hkDefaultPhysicsDemo::addTimersToVdb( const hkArray<hkTimerData>& threadStreams, const hkArray<hkTimerData>& spuStreams )
{
	// reset our VDB stats list
	if (m_physicsViewersContext)
	{
		m_physicsViewersContext->m_monitorStreamBegins.setSize(0);
		m_physicsViewersContext->m_monitorStreamEnds.setSize(0);
	}

	for ( int i = 0; i < threadStreams.getSize(); ++i )
	{
		m_physicsViewersContext->m_monitorStreamBegins.pushBack(threadStreams[i].m_streamBegin);
		m_physicsViewersContext->m_monitorStreamEnds.pushBack(threadStreams[i].m_streamEnd);
	}
	for ( int ii = 0; ii < spuStreams.getSize(); ++ii )
	{
		m_physicsViewersContext->m_monitorStreamBegins.pushBack(spuStreams[ii].m_streamBegin);
		m_physicsViewersContext->m_monitorStreamEnds.pushBack(spuStreams[ii].m_streamEnd);
	}
}
开发者ID:venkatarajasekhar,项目名称:viper,代码行数:20,代码来源:hkDefaultPhysicsDemo.cpp

示例14: SetTransformPositionRange

static void SetTransformPositionRange( hkArray<hkQsTransform>& transforms, int numTracks, int boneIdx
                                       , float &currentTime, float lastTime, int &frame
                                       , Vector3Key &first, Vector3Key &last)
{
    int n = transforms.getSize()/numTracks;
    hkVector4 p = TOVECTOR4(first.data);
    for ( ; COMPARE(currentTime, lastTime) <= 0 && frame < n; currentTime += FramesIncrement, ++frame)
    {
        hkQsTransform& transform = transforms[frame*numTracks + boneIdx];
        SetTransformPosition(transform, p);
    }
}
开发者ID:aerisarn,项目名称:hkxcmd,代码行数:12,代码来源:ConvertKF.cpp

示例15: SetTransformRotationRange

static void SetTransformRotationRange( hkArray<hkQsTransform>& transforms, int numTracks, int boneIdx
                                       , float &currentTime, float lastTime, int &frame
                                       , QuatKey &first, QuatKey &last)
{
    int n = transforms.getSize()/numTracks;
    hkQuaternion q = TOQUAT(first.data);
    for ( ; COMPARE(currentTime, lastTime) <= 0&& frame < n; currentTime += FramesIncrement, ++frame)
    {
        hkQsTransform& transform = transforms[frame*numTracks + boneIdx];
        SetTransformRotation(transform, q);
    }
}
开发者ID:aerisarn,项目名称:hkxcmd,代码行数:12,代码来源:ConvertKF.cpp


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