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


C++ IVideoDriver::drawIndexedTriangleList方法代码示例

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


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

示例1: render

void Sprite::render()
{
    IVideoDriver* driver = SceneManager->getVideoDriver();
    driver->setMaterial(Material);
    driver->setTransform(ETS_WORLD, AbsoluteTransformation);
    driver->drawIndexedTriangleList(&Vertices[0], 4, &Indices[0], 4);
}
开发者ID:blaketrahan,项目名称:coquelicot,代码行数:7,代码来源:sprite.cpp

示例2: render

	virtual void render()
	{
		IVideoDriver* driver = SceneManager->getVideoDriver();

		driver->setMaterial(Material);
		driver->setTransform(ETS_WORLD, AbsoluteTransformation);
		driver->drawIndexedTriangleList(VertexBuffer, IndexBuffer, Descriptor, 4);
	}
开发者ID:fdejaeger,项目名称:Irrlicht,代码行数:8,代码来源:main.cpp

示例3: render

 virtual void render()
  { 
      u16 indices[] = { 0,1,3, 3,1,2, 1,0,2, 2,0,3 };
      IVideoDriver* driver = SceneManager->getVideoDriver();
      driver->setMaterial(Material);
      driver->setTransform(ETS_WORLD, AbsoluteTransformation);
      driver->drawIndexedTriangleList(&Vertices[0], 4, &indices[0], 4);
  }
开发者ID:tecan,项目名称:IrrlichtDemos,代码行数:8,代码来源:hybridVideoTexture.cpp

示例4: render

void DecalSceneNode::render()
{
u16 indices[] = { 0,1,2, 0,2,3};
IVideoDriver* driver = SceneManager->getVideoDriver();
driver->setMaterial(Material);
driver->setTransform(video::ETS_WORLD, AbsoluteTransformation);
driver->drawIndexedTriangleList(&Vertices[0], 4, &indices[0], 2);
}
开发者ID:tecan,项目名称:IrrlichtDemos,代码行数:8,代码来源:decalscenenode.cpp

示例5: render

void GrassNode::render()
{
    IVideoDriver* driver = SceneManager->getVideoDriver();
    driver->setMaterial(Material);
    driver->setTransform(ETS_WORLD, AbsoluteTransformation);
    float Z = -5;
    for (int i = 0; i < particle.size(); i++)
    {

        Vertices[0].Pos = vector3df(particle[i]->pos.X + -fx, particle[i]->pos.Y + -fy,Z);//, 0,0,0,SColor(255,255,255,255),0,1);
        Vertices[1].Pos = vector3df(particle[i]->pos.X +  fx, particle[i]->pos.Y + -fy,Z);//, 0,0,0,SColor(255,255,255,255),1,1);
        Vertices[2].Pos = vector3df(particle[i]->pos.X +  fx, particle[i]->pos.Y +  fy,Z);//, 0,0,0,SColor(255,255,255,255),1,0);
        Vertices[3].Pos = vector3df(particle[i]->pos.X + -fx, particle[i]->pos.Y +  fy,Z);//, 0,0,0,SColor(255,255,255,255),0,0);
        if (particle[i]->dir <= 0) {
            float x = (particle[i]->crntFrm % stepww)*fWidth;
            float y = (particle[i]->crntFrm / stepww)*fHeight;
            Vertices[0].TCoords.X = x;
            Vertices[0].TCoords.Y = y+fHeight;
            Vertices[1].TCoords.X = x+fWidth;
            Vertices[1].TCoords.Y = y+fHeight;
            Vertices[2].TCoords.X = x+fWidth;
            Vertices[2].TCoords.Y = y;
            Vertices[3].TCoords.X = x;
            Vertices[3].TCoords.Y = y;
        } else if (particle[i]->dir > 0)
        {
            float x = (particle[i]->crntFrm % stepww)*fWidth;
            float y = (particle[i]->crntFrm / stepww)*fHeight;
            Vertices[1].TCoords.X = x;
            Vertices[1].TCoords.Y = y+fHeight;
            Vertices[0].TCoords.X = x+fWidth;
            Vertices[0].TCoords.Y = y+fHeight;
            Vertices[3].TCoords.X = x+fWidth;
            Vertices[3].TCoords.Y = y;
            Vertices[2].TCoords.X = x;
            Vertices[2].TCoords.Y = y;
        }
        driver->drawIndexedTriangleList(&Vertices[0], 4, &Indices[0], 4);
    }
}
开发者ID:blaketrahan,项目名称:King,代码行数:40,代码来源:grass.cpp

示例6: main


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

    CvCapture *capture;
    IplImage *frame;
    char AviFileName[]="Accel World.mp4";
    capture = cvCaptureFromAVI(AviFileName);

    if (driver->queryFeature(irr::video::EVDF_RENDER_TO_TARGET))
    {
        m_pRenderTexture = driver->addRenderTargetTexture(irr::core::dimension2d<irr::u32>((irr::u32)(720), (irr::u32)(480)));
        m_cRenderMaterial.setTexture(0, m_pRenderTexture);
    }

//     m_pRenderTexture = driver->getTexture("wall.bmp");
//     m_cRenderMaterial.setTexture(0, m_pRenderTexture);

    while(device->run())
    {
        const u32 now = device->getTimer()->getTime();
        const f32 frameDeltaTime = (f32)(now - then) / 1000.f; // Time in seconds
        then = now;

        if(receiver.IsKeyDown(irr::KEY_KEY_W))
            camshift.Z -= MOVEMENT_SPEED * frameDeltaTime;
        else if(receiver.IsKeyDown(irr::KEY_KEY_S))
            camshift.Z += MOVEMENT_SPEED * frameDeltaTime;

        if(receiver.IsKeyDown(irr::KEY_KEY_A))
            camshift.X -= MOVEMENT_SPEED * frameDeltaTime;
        else if(receiver.IsKeyDown(irr::KEY_KEY_D))
            camshift.X += MOVEMENT_SPEED * frameDeltaTime;

        if(receiver.IsKeyDown(irr::KEY_KEY_X))
            camshift.Y -= MOVEMENT_SPEED * frameDeltaTime;
        else if(receiver.IsKeyDown(irr::KEY_SPACE))
            camshift.Y += MOVEMENT_SPEED * frameDeltaTime;

        cam->setPosition(camPos + camshift);


        driver->beginScene(true, true, SColor(255,0,0,0));




        driver->setRenderTarget(m_pRenderTexture, true, true, irr::video::SColor(0,0,0,0));
        
        if(cvGrabFrame(capture))
        {
            frame=cvRetrieveFrame(capture);

            void* pBits = m_pRenderTexture->lock();
            u32  Pitch = m_pRenderTexture->getPitch();  

            int wmin= Pitch;
//             for(int h=0; h< 100; h++) 
//                 memcpy((char*)pBits+((h)*wmin),(char*)frame->imageDataOrigin + h * wmin, wmin);

            char* tmp = new char[frame->imageSize + 720 * 480];
            for (int i = 0; i < 480; ++i)
            {
                for (int j = 0; j < 720; ++j)
                {
                    tmp[(i * 720 + j) * 4] = frame->imageDataOrigin[(i * 720 + j) * 3];
                    tmp[(i * 720 + j) * 4 + 1] = frame->imageDataOrigin[(i * 720 + j) * 3 + 1];
                    tmp[(i * 720 + j) * 4 + 2] = frame->imageDataOrigin[(i * 720 + j) * 3 + 2];
                    tmp[(i * 720 + j) * 4 + 3] = 255;
                }
            }

            memcpy(pBits,tmp, frame->imageSize + 720 * 480);

            delete []tmp;

            m_pRenderTexture->unlock();

        }

        driver->setRenderTarget(0, false, false, irr::video::SColor(0,100,100,100));

        //driver->setTransform(video::ETS_VIEW, core::matrix4());
        driver->setTransform(video::ETS_WORLD, core::matrix4());
        //driver->setTransform(video::ETS_PROJECTION, core::matrix4());

        driver->setMaterial(m_cRenderMaterial);
        driver->drawIndexedTriangleList(m_cPlaneVertices, 4, m_iPlaneIndices, 2);

        



        smgr->drawAll();

        driver->endScene();
    }

    //controller.removeListener(listener);
    device->drop();

    return 0;
}
开发者ID:kerrot,项目名称:Work,代码行数:101,代码来源:Source.cpp


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