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


C++ PxScene::getNbActors方法代码示例

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


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

示例1: renderScene

void renderScene(int iteration) {
	RenderUtil::startRender(sCamera->getEye(), sCamera->getDir());
	
	PxScene* scene;
	PxGetPhysics().getScenes(&scene,1);
	PxU32 nbActors = scene->getNbActors(PxActorTypeSelectionFlag::eRIGID_DYNAMIC);
	if(nbActors) {
		std::vector<PxRigidActor*> actors(nbActors);
		scene->getActors(PxActorTypeSelectionFlag::eRIGID_DYNAMIC, 
							(PxActor**)&actors[0], nbActors);
		for (PxU32 i = 0; i < nbActors; i++)
			RenderUtil::renderActors(&actors[i], 1, false, PxVec3(0.3,0.3,0.3));
	}		
	if (iteration == 0) {
		char* result = "Initial Guess";
		glRasterPos2i(20,-25);
		for(int i = 0; i < strlen(result); i++)
			glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, result[i]);
	} else {
		char* label = "Iteration #";
		char buffer[10]; itoa(iteration, buffer, 10);
		char* result = new char[strlen(label)+strlen(buffer)];
		sprintf(result,"%s%s",label,buffer);
		glRasterPos2i(20,-25);
		for(int i = 0; i < strlen(result); i++)
			glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, result[i]);
	}
	
	std::string buffer, result;
	matrix<double> state = render_system->getState();
	std::string theta1 = "theta1 = " + to_string((long double) state(0,0));
	std::string theta2 = "theta2 = " + to_string((long double) state(1,0));
	std::string thetaDot1 = "thetaDot1 = " + to_string((long double) state(2,0));
	std::string thetaDot2 = "thetaDot1 = " + to_string((long double) state(3,0));
	glRasterPos2i(-35,38);
	for(int i = 0; i < theta1.length(); i++)
		glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, theta1[i]);
	glRasterPos2i(-37,33);
	for(int i = 0; i < theta2.length(); i++)
		glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, theta2[i]);
	glRasterPos2i(-39,28);
	for(int i = 0; i < thetaDot1.length(); i++)
		glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, thetaDot1[i]);
	glRasterPos2i(-41,23);
	for(int i = 0; i < thetaDot2.length(); i++)
		glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, thetaDot2[i]);
	RenderUtil::finishRender();
}
开发者ID:flair2005,项目名称:Spacetime-Optimization-of-Articulated-Character-Motion,代码行数:48,代码来源:Render.cpp

示例2: renderCallback

void renderCallback()
{
	simulatePhysics(true);

	gGlutRenderer->startRender(sCamera->getEye(), sCamera->getDir());

	PxScene* scene;
	PxGetPhysics().getScenes(&scene, 1);
	PxU32 nbActors = scene->getNbActors(PxActorTypeSelectionFlag::eRIGID_DYNAMIC | PxActorTypeSelectionFlag::eRIGID_STATIC);
	if (nbActors)
	{
		std::vector<PxRigidActor*> actors(nbActors);
		scene->getActors(PxActorTypeSelectionFlag::eRIGID_DYNAMIC | PxActorTypeSelectionFlag::eRIGID_STATIC, (PxActor**)&actors[0], nbActors);
		gGlutRenderer->renderActors(&actors[0], (PxU32)actors.size(), true);
	}

	gGlutRenderer->finishRender();
}
开发者ID:blueness9527,项目名称:FloyPhysics,代码行数:18,代码来源:main.cpp

示例3: PxCollectForExportScene

void PxCollectForExportScene(const PxScene& scene, PxCollection& collection)
{
    // Collect actors
    {
        const PxActorTypeSelectionFlags selectionFlags = PxActorTypeSelectionFlag::eRIGID_STATIC
                |PxActorTypeSelectionFlag::eRIGID_DYNAMIC
#if PX_USE_PARTICLE_SYSTEM_API
                |PxActorTypeSelectionFlag::ePARTICLE_SYSTEM
                |PxActorTypeSelectionFlag::ePARTICLE_FLUID
#endif
#if PX_USE_CLOTH_API
                |PxActorTypeSelectionFlag::eCLOTH
#endif
                ;

        Ps::Array<PxActor*> objects(scene.getNbActors(selectionFlags));
        const PxU32 nb = scene.getActors(selectionFlags, objects.begin(), objects.size());

        PX_ASSERT(nb==objects.size());
        PX_UNUSED(nb);

        for(PxU32 i=0; i<objects.size(); i++)
            objects[i]->collectForExport(collection);
    }


    // Collect constraints
    {
        Ps::Array<PxConstraint*> objects(scene.getNbConstraints());
        const PxU32 nb = scene.getConstraints(objects.begin(), objects.size());

        PX_ASSERT(nb==objects.size());
        PX_UNUSED(nb);

        for(PxU32 i=0; i<objects.size(); i++)
        {
            PxU32 typeId;
            PxJoint* joint = reinterpret_cast<PxJoint*>(objects[i]->getExternalReference(typeId));
            if(typeId == PxConstraintExtIDs::eJOINT)
                joint->collectForExport(collection);
        }
    }

    // Collect articulations
    {
        Ps::Array<PxArticulation*> objects(scene.getNbArticulations());
        const PxU32 nb = scene.getArticulations(objects.begin(), objects.size());

        PX_ASSERT(nb==objects.size());
        PX_UNUSED(nb);

        for(PxU32 i=0; i<objects.size(); i++)
            objects[i]->collectForExport(collection);
    }

    // Collect aggregates
    {
        Ps::Array<PxAggregate*> objects(scene.getNbAggregates());
        const PxU32 nb = scene.getAggregates(objects.begin(), objects.size());

        PX_ASSERT(nb==objects.size());
        PX_UNUSED(nb);

        for(PxU32 i=0; i<objects.size(); i++)
            objects[i]->collectForExport(collection);
    }
}
开发者ID:thomhughes,项目名称:Awe,代码行数:67,代码来源:ExtExtensions.cpp


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