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


C++ IAnimatedMeshSceneNode::getTriangleSelector方法代码示例

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


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

示例1: main


//.........这里部分代码省略.........

    //sceneManager->setAmbientLight(irr::video::SColorf(1.0, 1.0, 1.0, 0.0));

    irr::scene::ICameraSceneNode *camera;
    camera = sceneManager->addCameraSceneNodeMaya(0, 100.0f, 200.0f, 2000.0f, 77);
    //camera = sceneManager->addCameraSceneNode(cube->getRubicElt(1, 1, 1)->anode, vector3df(100, 0, 0), vector3df(0, 0, 50));

    ISceneCollisionManager *colisionManager = sceneManager->getSceneCollisionManager();
        //ISceneNode *node = cube->getRubicElt(2, 2, 2)->node;
        //IAnimatedMeshSceneNode *node = cube->getRubicElt(2, 2, 2)->anode;

    //scene::ITriangleSelector* selector = 0;
    //selector = sceneManager->createTriangleSelector(node);
    //selector = sceneManager->createTriangleSelectorFromBoundingBox(node);
    //   node->setTriangleSelector(selector);
    //selector->drop();


    //La chaine pour le titre de la fenetre
    irr::core::vector3df posCam;
    core::position2d<s32> posCursor = device->getCursorControl()->getPosition();

/*** essay gestion colision mouse cube ***/
    irr::core::line3d<float> collRay;
	collRay = colisionManager->getRayFromScreenCoordinates(posCursor, sceneManager->getActiveCamera());

    // get the collision
	core::vector3df collPoint;
	core::triangle3df collTriangle;
	IAnimatedMeshSceneNode *node = 0;
	const scene::ISceneNode* pNode = 0;

	//pNode = colisionManager->getSceneNodeAndCollisionPointFromRay(collRay, collPoint, collTriangle);
/****************************************/

    wchar_t titre[100];
    bool hasCollision = false;
    int i = 0;

    //La boucle de rendu
    while(device->run()){

        posCam = camera->getPosition();
        posCursor = device->getCursorControl()->getPosition();
        swprintf(titre, 100, L"FPS : %d (mode debug) |  PosCam :  "
        "X : %f Y : %f Z : %f, m.X : %ld m.Y : %ld", driver->getFPS(), posCam.X, posCam.Y, posCam.Z, posCursor.X, posCursor.Y);
        device->setWindowCaption(titre);


        collRay = colisionManager->getRayFromScreenCoordinates(posCursor, sceneManager->getActiveCamera());
        for(int i = 0; i < 3; i++){
            //if(hasCollision) break;
            for(int j = 0; j < 3; j++){
                //if(hasCollision) break;
                for(int k = 0; k < 3; k++){
                    //if(hasCollision) break;
                    node = cube->getRubicElt(i, j, k)->anode;
                    hasCollision = colisionManager->getCollisionPoint(collRay, node->getTriangleSelector(), collPoint, collTriangle, pNode);

                    if(hasCollision && pNode->isTrulyVisible() && !sceneManager->isCulled(pNode)){
                        //fprintf(stdout, "ID : %ld\n", pNode->getID());
                        fprintf(stdout, "collPoint.X : %f, collPoint.Y : %f, collPoint.Z : %f\n,", collPoint.X, collPoint.Y, collPoint.Z);
                        //hasCollision = false;
                        //pNode->setMaterialFlag(video::EMF_LIGHTING, receiver.GetMouseState().LeftButtonDown);
                        cube->getRubicElt(i, j, k)->anode->setMaterialFlag(video::EMF_WIREFRAME, receiver.GetMouseState().RightButtonDown);
                        //cube->getRubicElt(i, j, k)->anode->setMaterialFlag(video::EMF_LIGHTING, receiver.GetMouseState().RightButtonDown);

                        //cube->rotate(cube->getRubicElt(1, 1, 1), vector3df(0, 0, 0));
                    }
                }
            }
        }
        //hasCollision = false;

        //collRay = colisionManager->getRayFromScreenCoordinates(posCursor, sceneManager->getActiveCamera());
        //oui = colisionManager->getCollisionPoint(collRay, node->getTriangleSelector(), collPoint, collTriangle, pNode);

        //if(oui){
        //    //printf("YYYYYYYEEEEEEAAAAAAHHHHHH\n\n");
        //    fprintf(stdout, "ID : %ld\n", pNode->getID());
        //    oui = false;
        //}


//printf("posCur.X : %ld, posCur.Y : %ld,, posNode.X : %ld, posNode.Y : %ld\n", posCursor.X, posCursor.Y, posNode.X, posNode.Y);

        driver->beginScene(true, true, irr::video::SColor(0, 50, 70, 50));
//c_down->setRotation(irr::core::vector3df(i*2.f, 0, 0));

        i++;

        sceneManager->drawAll();
        driver->endScene ();

        device->sleep(20);
    }

    device->drop();
    return 0;
}
开发者ID:druiduz,项目名称:Rubirrks,代码行数:101,代码来源:main.cpp


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