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

C++ PX_ASSERT函数代码示例

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

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



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

示例1: PX_ASSERT

void ParticleEmitter::updateDerivedBase()
{
	PX_ASSERT(mSpacingX > 0.0f);
	mSpacingY = mSpacingX * PxSqrt(3.0f) * 0.5f;
	mSpacingZ = mSpacingX;

	mNumX = 2*(int)floor(mExtentX/mSpacingX);
	mNumY = 2*(int)floor(mExtentY/mSpacingY);
	
	//SDS: limit minimal dimension to 1
	if (mNumX == 0)
	{
		mNumX = 1;
		mSpacingX = 0.0f;
	}
	if (mNumY == 0)
	{
		mNumY = 1;
		mSpacingY = 0.0f;
	}

	mNumSites = mNumX * mNumY;

	if (mShape == Shape::eELLIPSE) 
	{
		if (mNumX > 1) 
			mEllipseRadius2 = 0.5f - 1.0f/(mNumX-1);
		else			
			mEllipseRadius2 = 0.5f; 
		mEllipseRadius2 *= mEllipseRadius2;

		mEllipseConstX0 = (mNumX-0.5f) * 0.5f;
		mEllipseConstX1 = 1.0f/mNumX;
		mEllipseConstY0 = (mNumY-1.0f) * 0.5f;
		mEllipseConstY1 = PxSqrt(3.0f) * 0.5f / mNumY;
	}
	else 
	{
		mEllipseRadius2 = 0;
		mEllipseConstX0 = 0;
		mEllipseConstX1 = 0;
		mEllipseConstY0 = 0;
		mEllipseConstY1 = 0;
	}
}
开发者ID:akurt5,项目名称:AIEShit,代码行数:45,代码来源:ParticleEmitter.cpp


示例2: PX_ASSERT

		void ProfileEventHandler::reportEvents(Ps::Array<PxBufferedProfilerCallback*>& callbacks)
		{
			PX_ASSERT(mProfileZoneInterface);

			for (PxU32 callbackIndex = callbacks.size(); callbackIndex--; )
			{
				PxBufferedProfilerCallback& callback = *callbacks[callbackIndex];
				reportCollection(callback, mCrossThreadCollection);
				for (PxU32 i = mThreadCollections.size(); i--;)
				{
					reportCollection(callback, mThreadCollections[i]);
				}

				reportCudaCollection(callback);
			}

			clear();
		}
开发者ID:savant-nz,项目名称:carbon,代码行数:18,代码来源:ExtDefaultBufferedProfiler.cpp


示例3: getCudaModule

void CudaModuleScene::initCudaObj(ApexCudaFunc& func)
{
	for (int j = 0 ; j < numRegisteredFunctions ; j++)
	{
		const char* funcName = functionTable[j].funcName;
		if (func.testNameMatch(funcName))
		{
			ApexCudaModule* cudaModule = getCudaModule(functionTable[j].modIndex);
			PX_ASSERT(cudaModule->isValid());

			CUfunction cuFunc = 0;
			CUT_SAFE_CALL(cuModuleGetFunction(&cuFunc, cudaModule->getCuModule(), funcName));

			PxU16 id = getGpuDispatcher()->registerKernelNames( &funcName, 1 );
			func.init(this, funcName, cuFunc, cudaModule, id);
		}
	}
}
开发者ID:LiangYue1981816,项目名称:CrossEngine,代码行数:18,代码来源:CudaModuleScene.cpp


示例4: angularProject

//export this in the physx namespace so we can unit test it
PxQuat angularProject(PxU32 lockedDofs, const PxQuat& q, PxReal cosHalfTol, bool& truncated)
{
	PX_ASSERT(lockedDofs <= 7);
	truncated = false;

	switch (lockedDofs)
	{
	case 0: return q;
	case 1: return q;		// currently unimplemented
	case 2: return q;		// currently unimplemented
	case 3: return project(q, PxVec3(0, 0, 1), cosHalfTol, truncated);
	case 4: return q;		// currently unimplemented
	case 5: return project(q, PxVec3(0, 1, 0), cosHalfTol, truncated);
	case 6: return project(q, PxVec3(1, 0, 0), cosHalfTol, truncated);
	case 7: return truncate(q, cosHalfTol, truncated);
	default: return PxQuat(PxIdentity);
	}
}
开发者ID:magetron,项目名称:UnrealEngine4-mod,代码行数:19,代码来源:ExtD6Joint.cpp


示例5: createCylinderConvexMesh

PxConvexMesh* createCylinderConvexMesh(const PxF32 width, const PxF32 radius, const PxU32 numCirclePoints, PxPhysics& physics, PxCooking& cooking)
{
#define  MAX_NUM_VERTS_IN_CIRCLE 16
	PX_ASSERT(numCirclePoints<MAX_NUM_VERTS_IN_CIRCLE);
	PxVec3 verts[2*MAX_NUM_VERTS_IN_CIRCLE];
	PxU32 numVerts=2*numCirclePoints;
	const PxF32 dtheta=2*PxPi/(1.0f*numCirclePoints);
	for(PxU32 i=0;i<MAX_NUM_VERTS_IN_CIRCLE;i++)
	{
		const PxF32 theta=dtheta*i;
		const PxF32 cosTheta=radius*PxCos(theta);
		const PxF32 sinTheta=radius*PxSin(theta);
		verts[2*i+0]=PxVec3(-0.5f*width, cosTheta, sinTheta);
		verts[2*i+1]=PxVec3(+0.5f*width, cosTheta, sinTheta);
	}

	return createConvexMesh(verts,numVerts,physics,cooking);
}
开发者ID:LiangYue1981816,项目名称:CrossEngine,代码行数:18,代码来源:SampleVehicle_VehicleCooking.cpp


示例6: PX_ASSERT

unsigned int MaterialList::addTexture(const char* /*directory*/, const char* prefix, const char* textureName)
{
	char saneFileName[128];
	physx::string::sprintf_s(saneFileName, 128, "%s%s", prefix, textureName);

	if (mTextureNames.find(saneFileName) != mTextureNames.end())
	{
		PX_ASSERT(!"duplicated texture found!");
	}
	else
	{
		TextureInfo info;
		info.fromPath = (unsigned int)mPaths.size();
		mTextureNames[saneFileName] = info;
		return 1;
	}

	return 0;
}
开发者ID:Tungrus,项目名称:ApexTest,代码行数:19,代码来源:MaterialList.cpp


示例7: PX_ASSERT

//process value in range(0,1)
PX_FORCE_INLINE PxF32 processPositiveAnalogValue
(const PxF32 riseRate, const PxF32 fallRate,
 const PxF32 currentVal, const PxF32 targetVal,
 const PxF32 timestep)
{
	PX_ASSERT(targetVal>=-0.01f && targetVal<=1.01f);
	PxF32 val;
	if(currentVal<targetVal)
	{
		val=currentVal + riseRate*timestep;
		val=PxMin(val,targetVal);
	}
	else 
	{
		val=currentVal - fallRate*timestep;
		val=PxMax(val,targetVal);
	}
	return val;
}
开发者ID:galek,项目名称:YR02_03_Physics,代码行数:20,代码来源:VehicleUtilControl.cpp


示例8: PX_ASSERT

//GroupsMask64
void SampleApexResourceCallback::setApexSupport(nvidia::apex::ApexSDK& apexSDK)
{
	PX_ASSERT(!m_apexSDK);
	m_apexSDK	= &apexSDK;
#if APEX_USE_PARTICLES
	uint32_t count = m_apexSDK->getNbModules();
	nvidia::apex::Module **modules = m_apexSDK->getModules();
	for (uint32_t i=0; i<count; i++)
	{
		nvidia::apex::Module *m = modules[i];
		const char *name = m->getName();
		if ( strcmp(name,"Particles") == 0 )
		{
			mModuleParticles = static_cast< nvidia::apex::ModuleParticles *>(m);
			break;
		}
	}
#endif
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:20,代码来源:SampleApexResourceCallback.cpp


示例9: PX_ASSERT

bool RTree::load(PxInputStream& stream, PxU32 meshVersion)
{
	PX_ASSERT((mFlags & IS_DYNAMIC) == 0);
	PX_UNUSED(meshVersion);

	release();

	PxI8 a, b, c, d;
	readChunk(a, b, c, d, stream);
	if(a!='R' || b!='T' || c!='R' || d!='E')
		return false;

	bool mismatch = (littleEndian() == 1);
	if(readDword(mismatch, stream) != mVersion)
		return false;

	readFloatBuffer(&mBoundsMin.x, 4, mismatch, stream);
	readFloatBuffer(&mBoundsMax.x, 4, mismatch, stream);
	readFloatBuffer(&mInvDiagonal.x, 4, mismatch, stream);
	readFloatBuffer(&mDiagonalScaler.x, 4, mismatch, stream);
	mPageSize = readDword(mismatch, stream);
	mNumRootPages = readDword(mismatch, stream);
	mNumLevels = readDword(mismatch, stream);
	mTotalNodes = readDword(mismatch, stream);
	mTotalPages = readDword(mismatch, stream);
	mUnused = readDword(mismatch, stream);

	mPages = static_cast<RTreePage*>(
		Ps::AlignedAllocator<128>().allocate(sizeof(RTreePage)*mTotalPages, __FILE__, __LINE__));
	Cm::markSerializedMem(mPages, sizeof(RTreePage)*mTotalPages);
	for (PxU32 j = 0; j < mTotalPages; j++)
	{
		readFloatBuffer(mPages[j].minx, RTreePage::SIZE, mismatch, stream);
		readFloatBuffer(mPages[j].miny, RTreePage::SIZE, mismatch, stream);
		readFloatBuffer(mPages[j].minz, RTreePage::SIZE, mismatch, stream);
		readFloatBuffer(mPages[j].maxx, RTreePage::SIZE, mismatch, stream);
		readFloatBuffer(mPages[j].maxy, RTreePage::SIZE, mismatch, stream);
		readFloatBuffer(mPages[j].maxz, RTreePage::SIZE, mismatch, stream);
		ReadDwordBuffer(mPages[j].ptrs, RTreePage::SIZE, mismatch, stream);
	}

	return true;
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:43,代码来源:GuRTree.cpp


示例10: getNSIndex

ResID ApexResourceProvider::createResource(ResID nameSpace, const char* name, bool refCount)
{
	uint32_t nsIndex = getNSIndex(nameSpace);
	if (nsIndex < mNameSpaces.size())
	{
		NameSpace* ns = mNameSpaces[nsIndex];
		ResID id = ns->getOrCreateID(name, mResources[ns->getID()].name);
		PX_ASSERT(id < mResources.size());
		if (id < mResources.size() && refCount)
		{
			mResources[id].refCount++;
		}
		return id;
	}
	else
	{
		return INVALID_RESOURCE_ID;
	}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:19,代码来源:ApexResourceProvider.cpp


示例11: mModule

ImpactEmitterAsset::ImpactEmitterAsset(ModuleEmitter* m, NxResourceList& list, const char* name) :
	mModule(m),
	mName(name),
	mIofxAssetTracker(m->mSdk, NX_IOFX_AUTHORING_TYPE_NAME),
	mIosAssetTracker(m->mSdk),
#if NX_SDK_VERSION_MAJOR == 2
	mExplosionAssetTracker(m->mSdk, NX_EXPLOSION_AUTHORING_TYPE_NAME),
#endif
	mDefaultActorParams(NULL),
	mDefaultPreviewParams(NULL)
{
	NxParameterized::Traits* traits = NiGetApexSDK()->getParameterizedTraits();
	mParams = (ImpactEmitterAssetParameters*)traits->createNxParameterized(ImpactEmitterAssetParameters::staticClassName());

	PX_ASSERT(mParams);

	mParams->setSerializationCallback(this);
	list.add(*this);
}
开发者ID:LiangYue1981816,项目名称:CrossEngine,代码行数:19,代码来源:ImpactEmitterAsset.cpp


示例12: sizeof

Foundation* Foundation::createInstance(PxU32 version, PxErrorCallback& errc, PxAllocatorCallback& alloc)
{
	if (version != PX_PHYSICS_VERSION)
	{
		char* buffer = new char[256];
		physx::string::sprintf_s(buffer,256, "Wrong version: foundation version is 0x%08x, tried to create 0x%08x", PX_PHYSICS_VERSION, version);
		errc.reportError(PxErrorCode::eINVALID_PARAMETER, buffer, __FILE__, __LINE__);
		return 0;
	}

	if (!mInstance)
	{
		// if we don't assign this here, the Foundation object can't create member
		// subobjects which require the allocator

		mInstance = reinterpret_cast<Foundation*>( alloc.allocate( 
			sizeof(Foundation), "Foundation", __FILE__,__LINE__));

		if (mInstance)
		{
			PX_PLACEMENT_NEW(mInstance, Foundation)(errc, alloc);

			PX_ASSERT(mRefCount == 0);
			mRefCount = 1;

			//skip 0 which marks uninitialized timestaps in PX_WARN_ONCE
			mWarnOnceTimestap = (mWarnOnceTimestap == PX_MAX_U32) ? 1 : mWarnOnceTimestap + 1;

			return mInstance;
		}
		else
		{
			errc.reportError(PxErrorCode::eINTERNAL_ERROR, "Memory allocation for foundation object failed.", __FILE__, __LINE__);
		}
	}
	else
	{
		errc.reportError(PxErrorCode::eINVALID_OPERATION, "Foundation object exists already. Only one instance per process can be created.", __FILE__, __LINE__);
	}

	return 0;
}
开发者ID:Eorgregix,项目名称:Destruction,代码行数:42,代码来源:PsFoundation.cpp


示例13: PX_ASSERT

void ApexQuadricSimplifier::heapUpdate(uint32_t i)
{
	const uint32_t num = mHeap.size() - mNumDeletedHeapElements;
	PX_ASSERT(1 <= i && i < num);
	QuadricEdge* e = mHeap[i];
	while (i > 1)
	{
		uint32_t j = i >> 1;
		if (heapElementSmaller(e, mHeap[j]))
		{
			mHeap[i] = mHeap[j];
			mHeap[i]->heapPos = (int32_t)i;
			i = j;
		}
		else
		{
			break;
		}
	}

	while ((i << 1) < num)
	{
		uint32_t j = i << 1;
		if (j + 1 < num && heapElementSmaller(mHeap[j + 1], mHeap[j]))
		{
			j++;
		}

		if (heapElementSmaller(mHeap[j], e))
		{
			mHeap[i] = mHeap[j];
			mHeap[i]->heapPos = (int32_t)i;
			i = j;
		}
		else
		{
			break;
		}
	}
	mHeap[i] = e;
	mHeap[i]->heapPos = (int32_t)i;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:42,代码来源:ApexQuadricSimplifier.cpp


示例14: getCudaModule

void CudaModuleScene::initCudaObj(ApexCudaVar& var)
{
	const char* varName = var.getName();

	for (int j = 0 ; j < numRegisteredVariables ; j++)
	{
		if (nvidia::strcmp(variableTable[j].varName, varName) == 0)
		{
			ApexCudaModule* cudaModule = getCudaModule(variableTable[j].modIndex);
			PX_ASSERT(cudaModule->isValid());

			CUdeviceptr cuDevPtr;
			size_t size;
			cuModuleGetGlobal(&cuDevPtr, &size, cudaModule->getCuModule(), varName);

			var.init(this, cudaModule, cuDevPtr, size, getGpuDispatcher()->getCudaContextManager());
			break;
		}
	}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:20,代码来源:CudaModuleScene.cpp


示例15: PX_ASSERT

void SampleVehicle_VehicleManager::updateAndRecordTelemetryData
(const PxF32 timestep, const PxVec3& gravity, PxVehicleWheels* focusVehicle, PxVehicleTelemetryData* telemetryData)
{
	PX_ASSERT(focusVehicle && telemetryData);

	//Update the vehicle for which we want to record debug data.
	PxVehicleUpdateSingleVehicleAndStoreTelemetryData(timestep,gravity,*mSurfaceTirePairs,focusVehicle,*telemetryData);

	//Update the remaining vehicles.
	PxVehicleWheels* vehicles[MAX_NUM_4W_VEHICLES];
	PxU32 numVehicles=0;
	for(PxU32 i=0;i<mNumVehicles;i++)
	{
		if(focusVehicle!=mVehicles[i])
		{
			vehicles[numVehicles]=mVehicles[i];
			numVehicles++;
		}
	}
	PxVehicleUpdates(timestep,gravity,*mSurfaceTirePairs,numVehicles,vehicles);
}
开发者ID:thomhughes,项目名称:Awe,代码行数:21,代码来源:SampleVehicle_VehicleManager.cpp


示例16: PX_ASSERT

void ApexRenderSubmesh::setParams(SubmeshParameters* submeshParams, VertexBufferParameters* vertexBufferParams)
{

	if (vertexBufferParams == NULL && submeshParams != NULL)
	{
		vertexBufferParams = static_cast<VertexBufferParameters*>(submeshParams->vertexBuffer);
		PX_ASSERT(vertexBufferParams != NULL);
	}
	else if (submeshParams != NULL && submeshParams->vertexBuffer == NULL)
	{
		submeshParams->vertexBuffer = vertexBufferParams;
	}
	else if (mParams == NULL)
	{
		// Only emit this warning if mParams is empty yet (not on destruction of the object)
		APEX_INTERNAL_ERROR("Confliciting parameterized objects!");
	}
	mParams = submeshParams;

	mVertexBuffer.setParams(vertexBufferParams);
}
开发者ID:LiangYue1981816,项目名称:CrossEngine,代码行数:21,代码来源:ApexRenderSubmesh.cpp


示例17: PX_ASSERT

PxStream& MemoryWriteBuffer::storeBuffer(const void* buffer, PxU32 size)
{
	PxU32 expectedSize = currentSize + size;
	if(expectedSize > maxSize)
	{
		maxSize = expectedSize + 4096;

		PxU8* newData = new PxU8[maxSize];
		PX_ASSERT(newData!=NULL);

		if(data)
		{
			memcpy(newData, data, currentSize);
			delete[] data;
		}
		data = newData;
	}
	memcpy(data+currentSize, buffer, size);
	currentSize += size;
	return *this;
}
开发者ID:Mateuus,项目名称:warbrasil,代码行数:21,代码来源:PhysXRepXHelpers.cpp


示例18: PX_ASSERT

PxU32 MemoryOutputStream::write(const void* src, PxU32 size)
{
	PxU32 expectedSize = mSize + size;
	if(expectedSize > mCapacity)
	{
		mCapacity = expectedSize + 4096;

		PxU8* newData = new PxU8[mCapacity];
		PX_ASSERT(newData!=NULL);

		if(newData)
		{
			memcpy(newData, mData, mSize);
			delete[] mData;
		}
		mData = newData;
	}
	memcpy(mData+mSize, src, size);
	mSize += size;
	return size;
}
开发者ID:DevO2012,项目名称:PEEL,代码行数:21,代码来源:PINT_CommonPhysX3.cpp


示例19: switch

void Gu::GeometryUnion::set(const PxGeometry& g)
{
	switch(g.getType())
	{
	case PxGeometryType::eBOX :
		reinterpret_cast<PxBoxGeometry&>(geometry) = static_cast<const PxBoxGeometry&>(g);
		break;
	case PxGeometryType::eCAPSULE :
		reinterpret_cast<PxCapsuleGeometry&>(geometry) = static_cast<const PxCapsuleGeometry&>(g);
		break;
	case PxGeometryType::eSPHERE :
		reinterpret_cast<PxSphereGeometry&>(geometry) = static_cast<const PxSphereGeometry&>(g);
		reinterpret_cast<PxCapsuleGeometry&>(geometry).halfHeight = 0.0f;		//AM: make sphere geometry also castable as a zero height capsule.
		break;
	case PxGeometryType::ePLANE :
		reinterpret_cast<PxPlaneGeometry&>(geometry) = static_cast<const PxPlaneGeometry&>(g);
		break;
	case PxGeometryType::eCONVEXMESH :
		{
			reinterpret_cast<PxConvexMeshGeometry&>(geometry) = static_cast<const PxConvexMeshGeometry&>(g);
			reinterpret_cast<PxConvexMeshGeometryLL&>(geometry).hullData = &(Gu::getConvexMesh(get<PxConvexMeshGeometryLL>().convexMesh).getHull());
		}
		break;
	case PxGeometryType::eTRIANGLEMESH :
		{
			reinterpret_cast<PxTriangleMeshGeometry&>(geometry) = static_cast<const PxTriangleMeshGeometry&>(g);
			reinterpret_cast<PxTriangleMeshGeometryLL&>(geometry).meshData = &(Gu::getTriangleMesh(get<PxTriangleMeshGeometryLL>().triangleMesh).mesh.mData);
		}
		break;
	case PxGeometryType::eHEIGHTFIELD :
		{
			reinterpret_cast<PxHeightFieldGeometry&>(geometry) = static_cast<const PxHeightFieldGeometry&>(g);
			reinterpret_cast<PxHeightFieldGeometryLL&>(geometry).heightFieldData = &Gu::getHeightField(get<PxHeightFieldGeometryLL>().heightField).getData();
		}
		break;
	default :
		PX_ASSERT(0 && "geometry type not handled");
		break;
	}
}
开发者ID:rudysnow,项目名称:SimbiconPlatform,代码行数:40,代码来源:GuGeometryUnion.cpp


示例20: PX_ASSERT

/* 
 * Called by the owner (Scene) to start simulating the task graph.
 * Dispatch all tasks with refCount == 1
 */
void PxTaskMgr::startSimulation()
{
    PX_ASSERT( mCpuDispatcher );

	if( mGpuDispatcher )
	{
		mGpuDispatcher->startSimulation();
	}

	/* Handle empty task graph */
	if( mPendingTasks == 0 )
    {

		return;
    }

    bool gpuDispatch = false;
    for( PxTaskID i = 0 ; i < mTaskTable.size() ; i++ )
    {
		if(	mTaskTable[ i ].mType == PxTaskType::TT_COMPLETED )
		{
			continue;
		}
		if( !shdfnd::atomicDecrement( &mTaskTable[ i ].mRefCount ) )
		{
			mStartDispatch.pushBack(i);
		}
	}
	for( uint32_t i=0; i<mStartDispatch.size(); ++i)
	{
		gpuDispatch |= dispatchTask( mStartDispatch[i], gpuDispatch );
	}
	//mStartDispatch.resize(0);
	mStartDispatch.forceSize_Unsafe(0);

    if( mGpuDispatcher && gpuDispatch )
	{
        mGpuDispatcher->finishGroup();
	}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:44,代码来源:TaskManager.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ PYW_GIL_CHECK_LOCKED_SCOPE函数代码示例发布时间:2022-05-30
下一篇:
C++ PXA_GPIO_TO_IRQ函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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