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


C++ NxMaterial::getDirOfAnisotropy方法代码示例

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


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

示例1: PMaterialIterator

int PMaterialIterator(const CKBehaviorContext& behcontext)
{
	
	CKBehavior* beh = behcontext.Behavior;

	CKContext* ctx = behcontext.Context;

	PhysicManager *pm = GetPMan();
	
	pFactory *pf = pFactory::Instance();

	if (beh->IsInputActive(0))
	{
		beh->ActivateInput(0,FALSE);

		//////////////////////////////////////////////////////////////////////////
		//we reset our session counter
		int sessionIndex=-1;
		beh->SetOutputParameterValue(0,&sessionIndex);


		LMaterials*sResults = NULL;
		beh->GetLocalParameterValue(0,&sResults);
		if (!sResults)
		{
			sResults = new LMaterials();
		}else
			sResults->clear();


		NxScene * scene = GetPMan()->getDefaultWorld()->getScene();
		for(int i = 0 ; i < GetPMan()->getDefaultWorld()->getScene()->getNbMaterials() ; i ++)
		{
		
			NxMaterial *currentMaterial = scene->getMaterialFromIndex(i);

			sResults->push_back(currentMaterial);
		}

		beh->SetLocalParameterValue(0,&sResults);



		if (sResults->size())
		{
			beh->ActivateInput(1);
		}else
		{
			beh->ActivateOutput(0);
			return 0;
		}
	}




	if( beh->IsInputActive(1) )
	{
		beh->ActivateInput(1,FALSE);

		int currentIndex=0;	CKParameterOut *pout = beh->GetOutputParameter(0);		pout->GetValue(&currentIndex);
		currentIndex++;



		LMaterials *sResults = NULL;	beh->GetLocalParameterValue(0,&sResults);
		if (!sResults)		{			beh->ActivateOutput(0);			return 0;		}

		if (currentIndex>=sResults->size())
		{
			sResults->clear();
			beh->ActivateOutput(0);
			return 0;
		}

		NxMaterial * material =  sResults->at(currentIndex);
		if (material!=NULL)
		{

			int sIndex = currentIndex+1;
			beh->SetOutputParameterValue(0,&sIndex);

			

					
			//SetOutputParameterValue<int>(beh,O_XML,material->xmlLinkID);
			SetOutputParameterValue<float>(beh,O_DFRICTION,material->getDynamicFriction());
			SetOutputParameterValue<float>(beh,O_SFRICTION,material->getStaticFriction());

			SetOutputParameterValue<float>(beh,O_RES,material->getRestitution());

			SetOutputParameterValue<float>(beh,O_DFRICTIONV,material->getDynamicFrictionV());
			SetOutputParameterValue<float>(beh,O_SFRICTIONV,material->getStaticFrictionV());

			SetOutputParameterValue<VxVector>(beh,O_ANIS,getFrom(material->getDirOfAnisotropy()));
			SetOutputParameterValue<int>(beh,O_FCMODE,material->getFrictionCombineMode());
			SetOutputParameterValue<int>(beh,O_RCMODE,material->getFrictionCombineMode());
			SetOutputParameterValue<int>(beh,O_FLAGS,material->getFlags());
		}

//.........这里部分代码省略.........
开发者ID:gbaumgart,项目名称:vt,代码行数:101,代码来源:PMaterialIterator.cpp

示例2: GetPMan


//.........这里部分代码省略.........
	scene->setUserContactReport(result->contactReport);
	scene->setUserTriggerReport(result->triggerReport);

	NxMaterialDesc *materialDescr = NULL;
	NxMaterial *material = NULL;
	if (referenceObject->HasAttribute(surfaceAttribute))
	{
		materialDescr  = createMaterialFromEntity(referenceObject);
		material =  result->getScene()->createMaterial(*materialDescr);
		material->userData = (void*)GetValueFromParameterStruct<int>(referenceObject->GetAttributeParameter(surfaceAttribute) ,E_MS_XML_TYPE);
	}else{
		
		if (getDefaultDocument())
		{
			
			materialDescr = createMaterialFromXML("Default",getDefaultDocument());
		}
		
		if (materialDescr)
		{
			material = result->getScene()->createMaterial(*materialDescr);
		}

		if (!material)
		{
			materialDescr = new NxMaterialDesc();
			materialDescr->setToDefault();
			material = result->getScene()->getMaterialFromIndex(0); 
			material->loadFromDesc(*materialDescr);
		}
	}
	
	int z = (int)material->userData;
	NxMaterial *zeroMaterial  = result->getScene()->getMaterialFromIndex(0);
	zeroMaterial->setDirOfAnisotropy(material->getDirOfAnisotropy());
	zeroMaterial->setStaticFriction(material->getStaticFriction());
	zeroMaterial->setDynamicFriction(material->getDynamicFriction());
	zeroMaterial->setStaticFrictionV(material->getStaticFrictionV());
	zeroMaterial->setDynamicFrictionV(material->getDynamicFrictionV());
	zeroMaterial->setFrictionCombineMode(material->getFrictionCombineMode());
	zeroMaterial->setRestitutionCombineMode(material->getRestitutionCombineMode());
	zeroMaterial->setFlags(material->getFlags());
	zeroMaterial->userData = material->userData;




	if (!material)
	{
		xLogger::xLog(XL_START,ELOGERROR,E_LI_MANAGER,"Couldn't create default material!");
	}
	result->setDefaultMaterial(material);

	scene->userData = result;

	
	//NxConstraintDominance testDom(1.0, 1.0f);
	//result->getScene()->setDominanceGroupPair(1, 2,testDom );	//board - debris



	//////////////////////////////////////////////////////////////////////////
	//there is no world settings attribute  : 
	/*
	if (!referenceObject->HasAttribute(GetPMan()->att_sleep_settings) )
	{
		referenceObject->SetAttribute(GetPMan()->att_sleep_settings);
		using namespace vtTools;
		AttributeTools::SetAttributeValue<int>(referenceObject,GetPMan()->att_sleep_settings,0,&sSettings->m_SleepSteps);
		AttributeTools::SetAttributeValue<float>(referenceObject,GetPMan()->att_sleep_settings,1,&sSettings->m_AngularThresold);
		AttributeTools::SetAttributeValue<float>(referenceObject,GetPMan()->att_sleep_settings,2,&sSettings->m_LinearThresold);
		AttributeTools::SetAttributeValue<int>(referenceObject,GetPMan()->att_sleep_settings,3,&sSettings->m_AutoSleepFlag);
	}	
	*/
	

	/*
	result->SleepingSettings(sSettings);
	//////////////////////////////////////////////////////////////////////////

	result->Reference(referenceObject);
	
	result->Init();
*/


	result->_checkForDominanceConstraints();
	result->_construct();






	return result;
	

	//return NULL;

}
开发者ID:gbaumgart,项目名称:vt,代码行数:101,代码来源:pFactoryWorld.cpp


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