本文整理汇总了C++中hkArray类的典型用法代码示例。如果您正苦于以下问题:C++ hkArray类的具体用法?C++ hkArray怎么用?C++ hkArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了hkArray类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: 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
示例3: 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
示例4: builder
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
示例5: 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
示例6: setSpecificProperty
void hkvStaticMeshAsset::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(), "Model") == 0))
{
if (hkvStringHelper::safeCompare(prop.getName(), "LODSwitchDistances") == 0)
{
m_lodDistances = prop.getArray();
}
}
}
开发者ID:RexBaribal,项目名称:projectanarchy,代码行数:12,代码来源:hkvStaticMeshAsset.cpp
示例7: 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
示例8: getVDBViewersByName
void hkDefaultDemo::getVDBViewersByName( const char* name, hkArray<hkProcess*>& processes )
{
if (m_vdb)
{
int tag = hkProcessFactory::getInstance().getProcessId( name );
m_vdb->getCurrentProcesses( processes );
int np = processes.getSize();
for (int pi = np -1; pi >= 0; --pi)
{
if (processes[pi]->getProcessTag() != tag)
processes.removeAt(pi);
}
}
}
开发者ID:venkatarajasekhar,项目名称:viper,代码行数:15,代码来源:hkDefaultDemo.cpp
示例9: 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
示例10: 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
示例11: createConvexTranslateShapeAndAddToArray
void DestructibleBridgeUtil::createConvexTranslateShapeAndAddToArray(hkpBoxShape* shape, hkReal posX, hkReal posY, hkReal posZ, hkReal scale, hkArray<hkpShape*>& shapes)
{
hkVector4 position(posX, posY, posZ);
position.mul4(scale);
hkpConvexTranslateShape* translatedShape = new hkpConvexTranslateShape(shape, position);
shapes.pushBack(translatedShape);
}
开发者ID:venkatarajasekhar,项目名称:viper,代码行数:7,代码来源:DestructibleBridgeUtil.cpp
示例12: 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
示例13: checkFormatCompatibility
bool hkvTextureTransformationSettings::checkFormatCompatibility(
hkArray<hkvAssetLogMessage>& out_messages)
{
// Check if the file and data formats are compatible
if (!hkvTextureFileToDataFormatMapping::getInstance().isMapped(m_targetFileFormat, m_targetDataFormat))
{
hkStringBuf msg;
msg.printf("The target file format (%s) is not compatible with the target data format (%s)",
hkvTextureFileFormatNames[m_targetFileFormat], hkvTextureDataFormatNames[m_targetDataFormat]);
out_messages.pushBack(hkvAssetLogMessage(HKV_MESSAGE_CATEGORY_ASSET_TRANSFORMATION, HKV_MESSAGE_SEVERITY_ERROR, msg));
}
// Check if the platform can handle the target data format
if (m_platform != HKV_TARGET_PLATFORM_ANY)
{
if (!hkvPlatformToTextureDataFormatMapping::getInstance().isMapped(m_platform, m_targetDataFormat))
{
const char* platformName = "";
hkvGetTargetPlatformDefinition().idToString(m_platform, platformName);
hkStringBuf msg;
msg.printf("The target data format (%s) is not compatible with the target platform (%s)",
hkvTextureDataFormatNames[m_targetDataFormat], platformName);
out_messages.pushBack(hkvAssetLogMessage(HKV_MESSAGE_CATEGORY_ASSET_TRANSFORMATION, HKV_MESSAGE_SEVERITY_ERROR, msg));
}
}
// Check if the platform can handle the target file format
if (m_platform != HKV_TARGET_PLATFORM_ANY)
{
if (!hkvPlatformToTextureFileFormatMapping::getInstance().isMapped(m_platform, m_targetFileFormat))
{
const char* platformName = "";
hkvGetTargetPlatformDefinition().idToString(m_platform, platformName);
hkStringBuf msg;
msg.printf("The target file format (%s) is not compatible with the target platform (%s)",
hkvTextureFileFormatNames[m_targetFileFormat], platformName);
out_messages.pushBack(hkvAssetLogMessage(HKV_MESSAGE_CATEGORY_ASSET_TRANSFORMATION, HKV_MESSAGE_SEVERITY_ERROR, msg));
}
}
return true;
}
开发者ID:guozanhua,项目名称:projectanarchy,代码行数:44,代码来源:hkvTextureTransformationSettings.cpp
示例14: 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
示例15: SetTransformScaleRange
static void SetTransformScaleRange( hkArray<hkQsTransform>& transforms, int numTracks, int boneIdx
, float ¤tTime, 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
示例16: 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
示例17: 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
示例18: SetTransformPositionRange
static void SetTransformPositionRange( hkArray<hkQsTransform>& transforms, int numTracks, int boneIdx
, float ¤tTime, 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
示例19: SetTransformRotationRange
static void SetTransformRotationRange( hkArray<hkQsTransform>& transforms, int numTracks, int boneIdx
, float ¤tTime, 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
示例20: _mergeCompoundNodes
static void _mergeCompoundNodes(hkgDisplayObject* dispObj, hkxNode* node, hkgArray<hkgAssetConverter::Mapping>& meshes, const hkArray<hkpRigidBody*>& rbs )
{
// See if it is in itself an rb or not. If it is then return.
int gi;
for (gi=0; gi < node->m_numAttributeGroups; ++gi)
{
hkxAttributeGroup* group = &node->m_attributeGroups[gi];
if ( (group->m_numAttributes > 0) && (hkString::strCmp( group->m_name, "hkpRigidBody") == 0) )
return; // it is an rb, not a shape or ramdom mesh
}
// could be an old style export scene, so will not have attributes
// check for rbs of the same name..
if (node->m_name)
{
for (int rbl = 0; rbl < rbs.getSize(); ++rbl)
{
if (rbs[rbl]->getName() && (hkString::strCmp( rbs[rbl]->getName(), node->m_name) == 0) )
return; // rb by the same name as this node so can assume it is this one
}
}
// merge the mesh (if it is a mesh) into the rb, transforming it as required.
if ( hkString::strCmp( node->m_object.m_class->getName(), hkxMeshClass.getName()) == 0 )
{
hkxMesh* theMesh = (hkxMesh*)node->m_object.m_object;
hkgDisplayObject* toBeMerged = _findDisplayObject( theMesh, meshes );
const float* tA = toBeMerged->getTransform();
const float* tB = dispObj->getTransform();
float bInv[16];
float geomT[16];
hkgMat4Invert(bInv, tB);
hkgMat4Mult(geomT, bInv, tA);
int numGeom = toBeMerged->getNumGeometry();
for (gi=numGeom-1; gi >= 0; --gi)
{
hkgGeometry* geom = toBeMerged->removeGeometry(gi);
geom->transform(geomT); // bake in relative transform
dispObj->addGeometry(geom);
geom->removeReference(); // remove ref given back by previous remove
}
}
// recurse
for (int ci=0; ci < node->m_numChildren; ++ci)
{
_mergeCompoundNodes(dispObj, node->m_children[ci], meshes, rbs );
}
}
开发者ID:venkatarajasekhar,项目名称:viper,代码行数:51,代码来源:hkDefaultPhysicsDemo.cpp
注:本文中的hkArray类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论