本文整理汇总了C++中ISceneManager::createTerrainTriangleSelector方法的典型用法代码示例。如果您正苦于以下问题:C++ ISceneManager::createTerrainTriangleSelector方法的具体用法?C++ ISceneManager::createTerrainTriangleSelector怎么用?C++ ISceneManager::createTerrainTriangleSelector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISceneManager
的用法示例。
在下文中一共展示了ISceneManager::createTerrainTriangleSelector方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
int idCenario = 0;
int quadId;
vector3df p1, p2, p3, p4;
SMatrix mtxCenario;
CArquivoMatrizes *_fileMtx = new CArquivoMatrizes();
CSampleSceneNode *myQuad[2500];
CGerEventos eventos;
IrrlichtDevice *device = createDevice(EDT_OPENGL, dimension2d<s32>(800, 600), 16, false,false,false, &eventos);
device->setWindowCaption(L"Editor de matrizes - Warbugs");
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
smgr->addCameraSceneNodeFPS();
//smgr->addCameraSceneNode(0, vector3df(0,100,0), vector3df(0,0,0));
smgr->loadScene(pathCenario[idCenario]);
mtxCenario = _fileMtx->getMatrix(idCenario);
ITerrainSceneNode *sceneTerrain = (ITerrainSceneNode*)smgr->getSceneNodeFromType(ESNT_TERRAIN, 0);
ITriangleSelector *sceneTris = smgr->createTerrainTriangleSelector(sceneTerrain, 0);
sceneTerrain->setTriangleSelector(sceneTris);
for(int i=0; i<50; i++) // z
{
for(int j=0; j<50;j++) // x
{
//if(
//{
p1.X = 10.0;
p1.Y = 1.0;
p1.Z = 0.0;
p2.X = 10.0;
p2.Y = 1.0;
p2.Z = 500.0;
p3.X = 0.0;
p3.Y = 1.0;
p3.Z = 500.0;
p4.X = 0.0;
p4.Y = 1.0;
p4.Z = 0.0;
quadId = j + (i * 10);
myQuad[quadId] = new CSampleSceneNode(smgr->getRootSceneNode(), smgr, quadId, p1, p2, p3, p4);
//}
}
}
while(device->run())
{
driver->beginScene(true, true, SColor(0,100,100,100));
smgr->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
示例2: main
//.........这里部分代码省略.........
//);
//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
Fly2D::Brain* brains[nRobots];
//all to a default type
//for ( int i=0; i<nRobots; i++ )
//{
//brains[i] = new Fly2D::BrainForward;
////brains[i] = new Fly2D::BrainCircle();
//}