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


C++ IVideoDriver类代码示例

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


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

示例1:

Human::Human()
{
	m_pStateMachine = NULL;
	m_p2DSprite = NULL;
	IVideoDriver* pDriver = IrrDvc.GetDriver();
	video::ITexture* pTexture = pDriver->getTexture(HUMAN_TEXTUREFILENAME);
	pTexture->grab(); //상속을 했을 경우 소멸자에서 drop를 호출 하는 데 여기서 개수를 맞춰주지 않으면
						//onExit 에서 에러 발생 후 죽음. 일단 임시 방편으로 텍스쳐 생성하고 grab을 호출 했는데
						//추후 상의 한 후 수정해야 함
}
开发者ID:ptptomr,项目名称:project_ran,代码行数:10,代码来源:Human.cpp

示例2: computePickingRay

math::SRay EditorScene::computePickingRay(u32 sx, u32 sy)
{
	IVideoDriver* driver = mDevice->getVideoDriver();

	sx = (static_cast<f32>(sx)) / BufferWndWidth * driver->getBackBufferWidth();
	sy = (static_cast<f32>(sy)) / BufferWndHeight * driver->getBackBufferHeight();

	math::SRay ray = mSceneManager->getPickingRay(sx, sy);
	return ray;
}
开发者ID:Wu1994,项目名称:GameFinal,代码行数:10,代码来源:EditorScene.cpp

示例3: runTestWithDriver

/** The test loads a texture, renders it using draw2dimage, loads another
	texture and renders the first one again. Due to the texture cache this
	can lead to rendering of the second texture in second place. */
static bool runTestWithDriver(E_DRIVER_TYPE driverType)
{
	IrrlichtDevice *device = createDevice( driverType, dimension2d<s32>(160, 120), 32);
	if (!device)
		return true; // Treat a failure to create a driver as benign; this saves a lot of #ifdefs

	IVideoDriver* driver = device->getVideoDriver();
	ISceneManager * smgr = device->getSceneManager();

	ITexture* tex1 = driver->getTexture("../media/wall.bmp");

	(void)smgr->addCameraSceneNode();

	driver->beginScene(true, true, SColor(255,100,101,140));
	driver->draw2DImage(tex1, position2di(0,0));
	driver->endScene();

	driver->getTexture("../media/tools.png");

	driver->beginScene(true, true, SColor(255,100,101,140));
	driver->draw2DImage(tex1, position2di(0,0));
	driver->endScene();

	bool result = takeScreenshotAndCompareAgainstReference(driver, "-textureRenderStates.png", 100);

	device->drop();

	return result;
}
开发者ID:jivibounty,项目名称:irrlicht,代码行数:32,代码来源:textureRenderStates.cpp

示例4:

/**
 * ドライバの情報表示
 */
void
IrrlichtBase::showDriverInfo()
{
	IVideoDriver *driver = device->getVideoDriver();
	if (driver) {
		dimension2d<s32> size = driver->getScreenSize();
		message_log("デバイス生成後のスクリーンサイズ:%d, %d", size.Width, size.Height);
		size = driver->getCurrentRenderTargetSize();
		message_log("デバイス生成後のRenderTargetの:%d, %d", size.Width, size.Height);
	}
}
开发者ID:John-He-928,项目名称:krkrz,代码行数:14,代码来源:IrrlichtBase.cpp

示例5:

bool
ProcGameIntro::OnExit(IrrlichtDevice& device)
{
	EntityMgr.Reset(true);

	// should I need to clear all texture here? 
	IVideoDriver* pDriver = IrrDvc.GetDriver();
	pDriver->removeAllTextures();

	return true;
}
开发者ID:ptptomr,项目名称:project_igf_2013,代码行数:11,代码来源:ProcGameIntro.cpp

示例6: b3dAnimation

/** Verify that two skinned animated mesh scene nodes can use different frames of the skinned mesh */
bool b3dAnimation(void)
{
	// Use EDT_BURNINGSVIDEO since it is not dependent on (e.g.) OpenGL driver versions.
	IrrlichtDevice *device = createDevice( EDT_BURNINGSVIDEO, dimension2d<s32>(160, 120), 32);
	assert(device);
	if (!device)
		return false;

	IVideoDriver* driver = device->getVideoDriver();
	ISceneManager * smgr = device->getSceneManager();

	IAnimatedMesh* mesh = smgr->getMesh("../media/ninja.b3d");
	IAnimatedMeshSceneNode* node1;
	IAnimatedMeshSceneNode* node2;
	assert(mesh);

	bool result = false;
	if(mesh)
	{
		node1 = smgr->addAnimatedMeshSceneNode(mesh);
		assert(node1);

		if(node1)
		{
			node1->setPosition(vector3df(-3, -3, 10));
			node1->setMaterialFlag(EMF_LIGHTING, false);
			node1->setAnimationSpeed(0.f);
		}

		node2 = smgr->addAnimatedMeshSceneNode(mesh);
		assert(node2);
		if(node2)
		{
			node2->setPosition(vector3df(3, -3, 10));
			node2->setMaterialFlag(EMF_LIGHTING, false);
			node2->setAnimationSpeed(0.f);
			node2->setCurrentFrame(62.f);
		}

		(void)smgr->addCameraSceneNode();

		// Just jump to the last frame since that's all we're interested in.
		device->run();
		driver->beginScene(true, true, SColor(255, 255, 255, 0));
		smgr->drawAll();
		driver->endScene();

		result = takeScreenshotAndCompareAgainstReference(driver, "-b3dAnimation.png");
	}

	device->drop();

	return result;
}
开发者ID:jivibounty,项目名称:irrlicht,代码行数:55,代码来源:b3dAnimation.cpp

示例7: main

int main()
{
	SDeviceContextSettings settings;
	settings.MultiSamplingCount = 4;
	settings.MultiSamplingQuality = 32;
	IApplication* device = createDevice(EDT_DIRECT3D11, 800, 600, EWS_NONE, true, settings);

	IVideoDriver* driver = device->getVideoDriver();
	ISceneManager* smgr = device->createSceneManager();
	IMeshManager* meshManager = driver->getMeshManager();

	IResourceGroupManager* resourceGroupManager = driver->getResourceGroupManager();
	resourceGroupManager->init("Resources.cfg");
	//resourceGroupManager->loadResourceGroup("General");

	XMFLOAT3 vertices[4];
	vertices[0] = XMFLOAT3(-10.0f, 0.0f, 10.0f);
	vertices[1] = XMFLOAT3(10.0f, 0.0f, 10.0f);
	vertices[2] = XMFLOAT3(-10.0f, 0.0f, -10.0f);
	vertices[3] = XMFLOAT3(10.0f, 0.0f, -10.0f);

	ISimpleMesh* mesh = meshManager->createSimpleMesh("pointlist", EVF_POSITION, 
		vertices, NULL, 4, sizeof(XMFLOAT3), 0, math::SAxisAlignedBox(), false);
	IMeshNode* meshNode = smgr->addMeshNode(mesh, nullptr, nullptr);
	meshNode->setMaterialName("test/ts_material");
	meshNode->setNeedCulling(false);

	ICameraNode* camera = smgr->addFpsCameraNode(1, nullptr, XMFLOAT3(0, 1.0f, -4.0f), XMFLOAT3(0, 1.0f, 0.0f));
	char caption[200];

	ITimer* timer = device->getTimer();
	timer->reset();

	while (device->run())
	{
		const float clearColor[] = { 0.0f, 0.0f, 0.0f, 1.0f };
		driver->beginScene(true, true, clearColor);

		float dt = timer->tick() * 0.001f;
		updateCamera(camera, dt);

		smgr->update(dt);
		smgr->drawAll();

		driver->endScene();

		sprintf(caption, "FPS:%f", getFps(dt));
		device->setWindowCaption(caption);
	}

	device->drop();

	return 0;
}
开发者ID:woyaofacai,项目名称:GameFinal,代码行数:54,代码来源:main.cpp

示例8: Dialog

TextureDialog::TextureDialog(EditorState *pstate, Node *pnode, CubeSide pface):
    Dialog(pstate),
    node(pnode),
    face(pface),
    lb(NULL),
    the_image(NULL),
    context(NULL)
{
    IVideoDriver *driver = state->device->getVideoDriver();
    IGUIEnvironment *guienv = state->device->getGUIEnvironment();

    // Window and basic items
    win = guienv->addWindow(rect<s32>(340, 50, 340 + 74 * 3 + 10, 50 + 74 * 3 + 10), true,
                            narrow_to_wide(std::string(getCubeSideName(face)) + " texture").c_str());
    guienv->addButton(rect<s32>(155, 30, 74*3, 55), win, ETD_GUI_ID_APPLY,   L"Apply",  L"Apply this texture selection to the node face");
    guienv->addButton(rect<s32>(155, 60, 74*3, 85), win, ETD_GUI_ID_IMPORT,  L"Import", L"Import images from files");
    guienv->addButton(rect<s32>(84,  60, 150,  85), win, ETD_GUI_ID_ACTIONS, L"Actions");

    // Fill out listbox
    lb = guienv->addListBox(rect<s32>(10, 104, 74 * 3, 74 * 3), win, 502);
    Media *media = &state->project->media;
    std::map<std::string, Media::Image*>& images = media->getList();
    int count = 1;
    lb->addItem(L"");
    lb->setSelected(0);
    for (std::map<std::string, Media::Image*>::const_iterator it = images.begin();
            it != images.end();
            ++it) {
        if (!it->second) {
            continue;
        }
        if (it->second->name == "default") {
            lb->addItem(L"");
        } else {
            lb->addItem(narrow_to_wide(it->second->name + " [used " +
                                       num_to_str(it->second->getHolders()) + " times]").c_str());
        }
        if (it->second == node->getTexture(face))
            lb->setSelected(count);
        count++;
    }

    Media::Image *image = node->getTexture(face);
    if (image) {
        the_image = driver->addTexture("tmpicon.png", image->get());
    }

    // Context menu
    context = guienv->addContextMenu(rect<s32>(84, 85, 150, 180), win, ETD_GUI_ID_ACTIONS_CM);
    context->addItem(L"Export", ETD_GUI_ID_EXPORT);
    context->setCloseHandling(ECMC_HIDE);
    context->setVisible(false);
    context->setEventParent(win);
}
开发者ID:asl97,项目名称:NodeBoxEditor,代码行数:54,代码来源:TextureDialog.cpp

示例9: LoadScene

void Editor::LoadScene()
{
	IVideoDriver *driver = device->getVideoDriver();
	ISceneManager *smgr = device->getSceneManager();

	// Calculate Projection Matrix
	matrix4 projMat;
	irr::f32 orth_w = (float)(driver->getScreenSize().Width - 256) / (float)driver->getScreenSize().Height;
	orth_w = 3 * orth_w;
	projMat.buildProjectionMatrixOrthoLH(orth_w, 3, 1, 100);

	// Create target
	target = smgr->addEmptySceneNode(0, 200);
	target->setPosition(vector3df(0, 0, 0));

	// Add rotational camera
	pivot = smgr->addEmptySceneNode(target, 199);
	camera[0] = smgr->addCameraSceneNode(NULL, vector3df(0, 0, -2), vector3df(0, 0, 0));
	camera[0]->setParent(pivot);
	pivot->setRotation(vector3df(25, -45, 0));

	// Add Topdown camera
	camera[1] = smgr->addCameraSceneNode(target, vector3df(0, 2, -0.01), vector3df(0, 0, 0));
	camera[1]->setProjectionMatrix(projMat, true);

	// Add front camera
	camera[2] = smgr->addCameraSceneNode(target, vector3df(0, 0, -5), vector3df(0, 0, 0));
	camera[2]->setProjectionMatrix(projMat, true);

	// Add side camera
	camera[3] = smgr->addCameraSceneNode(target, vector3df(5, 0, 0), vector3df(0, 0, 0));
	camera[3]->setProjectionMatrix(projMat, true);

	// Add Light
	ILightSceneNode* light = smgr->addLightSceneNode(target, vector3df(25, 50, 0));
	light->setLightType(ELT_POINT);
	light->setRadius(2000);

	// Add Plane
	IMeshSceneNode* plane = smgr->addCubeSceneNode(1, 0, -1,
			vector3df(0.5, -5.5, 0.5), vector3df(0, 0, 0),
			vector3df(10, 10, 10));
	plane->setMaterialTexture(0, driver->getTexture("media/texture_terrain.png"));
	plane->setMaterialFlag(video::EMF_BILINEAR_FILTER, false);
	plane->getMaterial(0).getTextureMatrix(0).setTextureScale(10, 10);

	// Add sky box
	scene::IMeshSceneNode* skybox = smgr->addCubeSceneNode(50);
	skybox->setMaterialTexture(0, driver->getTexture("media/sky.jpg"));
	skybox->setMaterialFlag(video::EMF_BILINEAR_FILTER, false);
	skybox->setMaterialFlag(video::EMF_LIGHTING, false);
	smgr->getMeshManipulator()->flipSurfaces(skybox->getMesh());
	state->plane_tri = smgr->createOctreeTriangleSelector(skybox->getMesh(), skybox);
}
开发者ID:stormchaser3000,项目名称:NodeBoxEditor,代码行数:54,代码来源:Editor.cpp

示例10: MovingEntity

Car::Car(vector3df position,
		   f64 radius,
		   vector3df velocity,
		   f64 maxSpeed,
		   vector3df heading,
		   f64 mass,
		   vector3df scale,
		   f64 turnRate,
		   f64 maxForce)
	: MovingEntity(position, radius, velocity, maxSpeed, heading, mass, scale, turnRate, maxForce),
  	  m_pSceneNode(null),
	  m_pStateMachine(null),
	  m_p2DSprite(null),
	  m_pCarPhaysics(null),
	  m_pMesh(null)
{
	// get ready state machine
	 m_pStateMachine = new StateMachine<Car>(this);
    
	// start from nothing
    m_pStateMachine->ChangeState(IdleCar::Instance());

	// get ready sprite
	ISceneManager* pSmgr = IrrDvc.GetSmgr();
	IVideoDriver* pDriver = IrrDvc.GetDriver();
	m_p2DSprite = pSmgr->addBillboardSceneNode();
	m_p2DSprite->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL);
	video::ITexture* pTexture = pDriver->getTexture("Rsrc/car.tga");
	// shkim, TODO.
	// why should I grap this texture here? as a result, get(+1)->grab(+1)->drop(-1) will give reference count as 1. 
	// that means nobody know when I release texture after using at all. how do I figure it out?
	// answer is, keeping texture resource during Proc life time. it means loading texture at Proc initializing time and releasing them at Proc releasing time.
	// for doing that, need to use grab/drop pair after getTexture()
	pTexture->grab();
	m_p2DSprite->setMaterialTexture(0, pTexture);
	m_p2DSprite->setMaterialFlag(video::EMF_LIGHTING, false);
	m_p2DSprite->setMaterialFlag(video::EMF_ZBUFFER, true);
	m_p2DSprite->setMaterialFlag(video::EMF_ZWRITE_ENABLE, true);
	m_p2DSprite->setSize(dimension2df(scale.X, scale.Y));
	m_p2DSprite->setPosition(position);
	m_p2DSprite->setID(ID());	

	// get ready 3d scene node
#ifdef DRAW_CAR_3D_MODEL // shkim, do not draw mode now
	m_pMesh = pSmgr->getMesh("Rsrc/cube.xml");
	m_pSceneNode = pSmgr->addAnimatedMeshSceneNode(m_pMesh);
	m_pSceneNode->setPosition(vector3df(0.f, 0.f, 0.f));
	m_pSceneNode->setRotation(vector3df(0.f, 0.f, 0.f));
	m_pSceneNode->setScale(vector3df(4.f, 8.f, 1.f));
	m_pSceneNode->setMaterialFlag(EMF_LIGHTING, false);
#endif // DRAW_CAR_3D_MODEL
	// get ready physics model
	m_pCarPhaysics = new iforce2d_TopdownCar(&Box2dWld.GetWorld());	
}
开发者ID:ptptomr,项目名称:project_igf_2013,代码行数:54,代码来源:Car.cpp

示例11:

bool
ProcTitle::OnExit(irr::IrrlichtDevice& device)
{	
	IGUIEnvironment* env = device.getGUIEnvironment();
	env->clear();

	// should I need to clear all texture here? 
	IVideoDriver* pDriver = IrrDvc.GetDriver();
	pDriver->removeAllTextures();

	return true;
}
开发者ID:ptptomr,项目名称:project_igf_2013,代码行数:12,代码来源:ProcTitle.cpp

示例12: BasePlayer

DummyObject::DummyObject(vector3df position,
						   double radius,
						   vector3df velocity,
						   double maxSpeed,
						   vector3df heading,
						   double mass,
						   vector3df scale,
						   double turnRate,
						   double maxForce)
	: BasePlayer(position, radius, velocity, maxSpeed, heading, mass, scale, turnRate, maxForce, PLAYER_ROLE_CHASER)
{
	m_pStateMachine = new StateMachine<DummyObject>(this);
    
	// start from idle state
    m_pStateMachine->SetCurrentState(IdleDummy::Instance());

	// get ready sprite
#if USE_BILL_BOARD_SPRITE	
	ISceneManager* pSmgr = IrrDevice::GetInstance().GetSmgr();
	m_p2DSprite = new BillBoard(pSmgr->getRootSceneNode(), pSmgr, 300);
	m_p2DSprite->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL);
	ITexture* pTexture = IrrDevice::GetInstance().GetDriver()->getTexture("Rsrc/hero.bmp");
	m_p2DSprite->setMaterialTexture(0, pTexture);
	m_p2DSprite->setMaterialFlag(video::EMF_LIGHTING, false);
	m_p2DSprite->setMaterialFlag(video::EMF_ZBUFFER, false);
	m_p2DSprite->setPosition(position);
	m_p2DSprite->setID(0);
	m_p2DSprite->getMaterial(0).getTextureMatrix(0).setTextureScale(0.5f,0.5f);	
#else
	ISceneManager* pSmgr = IrrDvc.GetSmgr();
	IVideoDriver* pDriver = IrrDvc.GetDriver();
	m_p2DSprite = pSmgr->addBillboardSceneNode();
	m_p2DSprite->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL);
	video::ITexture* pTexture = pDriver->getTexture("Rsrc/hero.tga");
	pTexture->grab();
	m_p2DSprite->setMaterialTexture(0, pTexture);
	m_p2DSprite->setMaterialFlag(video::EMF_LIGHTING, false);
	m_p2DSprite->setMaterialFlag(video::EMF_ZBUFFER, true);
	m_p2DSprite->setMaterialFlag(video::EMF_ZWRITE_ENABLE, true);
	m_p2DSprite->setSize(dimension2df(scale.X, scale.Y));
	m_p2DSprite->setPosition(position);
	m_p2DSprite->setID(ID());
	m_p2DSprite->getMaterial(0).getTextureMatrix(0).setTextureScale(0.5f,0.5f);	
	m_initState = DUMMY_STATE_IDLECHASER;

	//patrol¿¡ »ç¿ëµÉ µ¥ÀÌŸ ÃßÈÄ ·¹º§ µðÀÚÀÎµÈ ½ºÅ©¸³Æ®¿¡ ÀÇÇØ ™VÆõǵµ·Ï ¼öÁ¤¿ä
	//ÇöÀç MoviingEntity ¿Í º¯¼ö ¿¬°áÀº ³ªÁß¿¡ AI Å×½ºÆ®¸¦ À§ÇØ Àӽ÷Π¸¸µê.
	m_fSpeed = 30.0f;
 	m_bDirection=true;
	m_3dfStart = this->Pos()-vector3df(30.0f,0.0f,0.0f);
    m_3dfDest= this->Pos()+vector3df(30.0f,0.0f,0.0f);
#endif	
}
开发者ID:ptptomr,项目名称:project_ran,代码行数:53,代码来源:DummyObject.cpp

示例13: draw

void GUIForumPostItem::draw()
{
	if ( !IsVisible )
		return;

	IVideoDriver* pVideo = Environment->getVideoDriver();
	SColor black(255, 0, 0, 0), darkBlue(255, 0, 0, 128);

	pVideo->draw2DRectangle( AbsoluteRect, black, black, darkBlue, darkBlue, &AbsoluteClippingRect );

	IGUIElement::draw();
}
开发者ID:carribus,项目名称:firecell,代码行数:12,代码来源:GUIForumPostItem.cpp

示例14: setVisible

	void CLightSceneNode::setVisible(bool isVisible)
	{
		ISceneNode::setVisible(isVisible);

		if (DriverLightIndex < 0)
			return;
		IVideoDriver* driver = SceneManager->getVideoDriver();
		if (!driver)
			return;

		LightIsOn = isVisible;
		driver->turnLightOn((UINT32)DriverLightIndex, LightIsOn);
	}
开发者ID:zxycode007,项目名称:Sapphire,代码行数:13,代码来源:SapphireCLightSceneNode.cpp

示例15: createSplattingImg

// ----------------------------------------------------------------------------
ITexture* Terrain::createSplattingImg()
{
    IVideoDriver* vd = Editor::getEditor()->getVideoDriver();

    auto img = autoDropped(
        vd->createImage(ECF_A8R8G8B8, dimension2du(SPIMG_X, SPIMG_Y)));

    for (u32 i = 0; i < SPIMG_X; i++)
        for (u32 j = 0; j < SPIMG_Y; j++)
            img->setPixel(i, j, SColor(255, 0, 0, 0));

    return vd->addTexture("splatt.png", img.get());
} // initSplattingImg
开发者ID:Boyquotes,项目名称:stk-editor,代码行数:14,代码来源:terrain.cpp


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