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


C++ ISceneManager::createTriangleSelector方法代码示例

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


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

示例1: Init

void Player::Init(UnitObject* pUnit,ITriangleSelector* pTerrain)
{
    Irrdevice* pDevice 	= Irrdevice::GetInstance();
    m_pUnitObject		= pUnit;

    ISceneManager* pSmgr = pDevice->GetSceneManager();

    SKeyMap aKeyMap[5];
    aKeyMap[0].Action = EKA_MOVE_FORWARD;
    aKeyMap[0].KeyCode = KEY_KEY_W;
    aKeyMap[1].Action = EKA_MOVE_BACKWARD;
    aKeyMap[1].KeyCode = KEY_KEY_S;
    aKeyMap[2].Action = EKA_STRAFE_LEFT;
    aKeyMap[2].KeyCode = KEY_KEY_A;
    aKeyMap[3].Action = EKA_STRAFE_RIGHT;
    aKeyMap[3].KeyCode = KEY_KEY_D;
    aKeyMap[4].Action = EKA_JUMP_UP;
    aKeyMap[4].KeyCode = KEY_SPACE;

    //각 유닛마다 카메라 생성
    m_pCamera = pSmgr->addCameraSceneNodeFPS(0,100.0f,0.5f,-1,aKeyMap,9,false,0,false,false);
    m_pCollisionAnimator = static_cast<ISceneNodeAnimatorCameraFPS*>(*(m_pCamera->getAnimators().begin()));	//카메라가 가지고 있는 FPS 카메라 애니메이션 을 가지온다. 이것은 줌 확대 기능 등!!


    //카메라 따라댕기는 유닉 오브젝트... 방향에 대한것도 설정해줘야함... 이것은 일단 나중에 테스트를 위하여
    m_pUnitObject->GetAnimatedNode()->setParent(m_pCamera);


    IMeshSceneNode* pNode = pSmgr->addCubeSceneNode(10,m_pCamera);
    m_pCamera->addChild(pUnit->GetAnimatedNode());

    pNode->setVisible(true);

    m_pMyTriangle = pSmgr->createTriangleSelector(pNode->getMesh(),pNode);

    m_pMetaTriangle = pSmgr->createMetaTriangleSelector();
    m_pMetaTriangle->addTriangleSelector(pTerrain);

    //역시 스크립트 적용 안할 수가 없다... 파일을 읽어와서 적용하던지.... 아우
    ISceneNodeAnimatorCollisionResponse * pani = pSmgr->createCollisionResponseAnimator(m_pMetaTriangle,m_pCamera);
    m_pCamera->addAnimator(pani);
    pani->drop();

}
开发者ID:JeongSeungSU,项目名称:FightingSprit,代码行数:44,代码来源:Player.cpp

示例2: initComponent

// init
// run when init object
void CObjectCollisionComponent::initComponent()
{
#ifdef GSGAMEPLAY

	IMesh *pMesh = NULL;
	ISceneNode		*node	= m_gameObject->getSceneNode();
	ISceneManager	*smgr	= getIView()->getSceneMgr();

	if ( node == NULL )
		return;	

	std::vector<SObjectCollisionParam>	listMesh;
	SObjectCollisionParam temp;

	if ( m_gameObject->getComponent( IObjectComponent::StaticMesh ) != NULL )
	{
		pMesh = ((IMeshSceneNode*) node)->getMesh();
		
		temp.mesh = pMesh;
		temp.node = node;
		listMesh.push_back( temp );
	}
	else if ( m_gameObject->getComponent( IObjectComponent::AnimMesh ) != NULL )
	{
		pMesh = ((IAnimatedMeshSceneNode*) node)->getMesh();
		
		temp.mesh = pMesh;
		temp.node = node;
		listMesh.push_back( temp );
	}
	else if ( m_gameObject->getComponent( IObjectComponent::ColladaMesh ) != NULL )
	{
		CColladaMeshComponent *comp = (CColladaMeshComponent*)m_gameObject->getComponent( IObjectComponent::ColladaMesh );		
		ISceneNode* colladaNode = comp->getColladaNode();

		std::queue<ISceneNode*>	listSceneNode;
		const core::list<ISceneNode*>* listChild = &colladaNode->getChildren();
		core::list<ISceneNode*>::ConstIterator it = listChild->begin(), end = listChild->end();
		while ( it != end )
		{
			listSceneNode.push( (*it) );
			it++;
		}

		while ( listSceneNode.size() )
		{
			CGameColladaSceneNode* sceneNode = (CGameColladaSceneNode*)listSceneNode.front();
			listSceneNode.pop();

			if ( sceneNode->getMesh() )
			{
				temp.mesh = sceneNode->getMesh();				
				temp.node = sceneNode;

				listMesh.push_back( temp );
			}

			const core::list<ISceneNode*>* listChild = &sceneNode->getChildren();
			it = listChild->begin();
			end = listChild->end();
			while ( it != end )
			{
				listSceneNode.push( (*it) );
				it++;
			}
		}		
	}

	for ( int i = 0; i < (int)listMesh.size(); i++ )
	{
		node = listMesh[i].node;
		pMesh = listMesh[i].mesh;

		switch ( m_collisionType )
		{
		case CObjectCollisionComponent::BoudingBox:
			{
				ITriangleSelector *selector = smgr->createTriangleSelectorFromBoundingBox(node);
				node->setTriangleSelector( selector );
				selector->drop();
			}
			break;
		case CObjectCollisionComponent::Triangle:
			{
				ITriangleSelector* selector = smgr->createTriangleSelector( pMesh, node );
				node->setTriangleSelector(selector);
				selector->drop();
			}
			break;
		case CObjectCollisionComponent::OctreeTriange:
			{
				ITriangleSelector* selector = smgr->createOctreeTriangleSelector( pMesh, node );
				node->setTriangleSelector(selector);
				selector->drop();
			}
			break;
		}
	}
//.........这里部分代码省略.........
开发者ID:codeman001,项目名称:gsleveleditor,代码行数:101,代码来源:CObjectCollisionComponent.cpp

示例3: main


//.........这里部分代码省略.........
    //sphere
        //node = smgr->addSphereSceneNode(
            //0.1,     // radius
            //50,     // poly count
            //0,      // parent
            //FruitID,     // id
            //vector3df(0, 0, 0),         // center
            //vector3df(0, 0, 0),           // rotation
            //vector3df(1.0f, 1.0f, 1.0f)   // scale
        //);
        //node->getMaterial(0).AmbientColor.set(0,0,0,255);
        //node->getMaterial(0).DiffuseColor.set(0,0,0,255);
        //node->getMaterial(0).Lighting = true;

//-- collision ------------------------------------------------------------//

    /* Put everything we want to do collision checking with inside the meta selector. */
    IMetaTriangleSelector * meta = smgr->createMetaTriangleSelector();
    array<ISceneNode *> nodes;
    smgr->getSceneNodesFromType(ESNT_ANY, nodes); // Find all nodes

    for (u32 i=0; i < nodes.size(); ++i)
    {
        ISceneNode * node = nodes[i];
        ITriangleSelector * selector = 0;

        switch(node->getType())
        {
            case ESNT_CUBE:
            case ESNT_ANIMATED_MESH:
            // Because the selector won't animate with the mesh,
            // and is only being used for camera collision, we'll just use an approximate
            // bounding box instead of ((IAnimatedMeshSceneNode*)node)->getMesh(0)
            selector = smgr->createTriangleSelectorFromBoundingBox(node);
            break;

            case ESNT_MESH:
            case ESNT_SPHERE: // Derived from IMeshSceneNode
            selector = smgr->createTriangleSelector(((IMeshSceneNode*)node)->getMesh(), node);
            break;

            case ESNT_TERRAIN:
            selector = smgr->createTerrainTriangleSelector((ITerrainSceneNode*)node);
            break;

            case ESNT_OCTREE:
            selector = smgr->createOctreeTriangleSelector(((IMeshSceneNode*)node)->getMesh(), node);
            break;

            default:
            // Don't create a selector for this node type
            break;
        }

        if(selector)
        {
            // Add it to the meta selector, which will take a reference to it
            meta->addTriangleSelector(selector);
            // And drop my reference to it, so that the meta selector owns it.
            selector->drop();
        }
    }

//-- robots ------------------------------------------------------------//

    //create robots
开发者ID:cirosantilli,项目名称:computer_vision2d,代码行数:67,代码来源:main.cpp


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