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


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

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


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

示例1: loadItem

// ----------------------------------------------------------------------------
ISceneNode* Track::loadItem(stringc name)
{
    ISceneManager* sm = Editor::getEditor()->getSceneManager();
    ISceneNode* node = 0;
    if (name == "banana")
    {
        node = sm->addAnimatedMeshSceneNode(sm->getMesh("models/banana.b3d"));
        node->setName("banana");
    }
    if (name == "item")
    {
        node = sm->addAnimatedMeshSceneNode(sm->getMesh("models/gift-box.b3d"));
        node->setName("item");
    }
    if (name == "small-nitro")
    {
        node = sm->addAnimatedMeshSceneNode(sm->getMesh("models/nitrotank-small.b3d"));
        node->setName("small-nitro");
    }
    if (name == "big-nitro")
    {
        node = sm->addAnimatedMeshSceneNode(sm->getMesh("models/nitrotank-big.b3d"));
        node->setName("big-nitro");
    }
    return node;
} // loadItem
开发者ID:mcsab,项目名称:stk-editor,代码行数:27,代码来源:track.cpp

示例2: meshLoaders

/** This won't test render results. Currently, not all mesh loaders are tested. */
bool meshLoaders(void)
{
	IrrlichtDevice *device = createDevice( EDT_NULL, dimension2d<u32>(160, 120), 32);
	assert(device);
	if (!device)
		return false;

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

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

	bool result = (mesh != 0);

	if (mesh)
	{
		if (mesh != smgr->getMesh("../media/ninja.b3d"))
		{
			logTestString("Loading from same file results in different meshes!");
				result=false;
		}
	}

	device->drop();

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

示例3: main

int main( ) {
	// Boring stuff: set up the scene, object & camera as usual
	IrrlichtDevice* device = createDevice( DRIVER, dimension2d<s32>( 640, 480 ), 16, false, false, false, 0 );
	IVideoDriver* driver = device->getVideoDriver( );
	ISceneManager* smgr = device->getSceneManager( );
	IGUIEnvironment* guienv = device->getGUIEnvironment( );
	device->getFileSystem( )->changeWorkingDirectoryTo( MEDIA_DIRECTORY );
	guienv->addStaticText( L"Lens Flare", rect<s32>( 10, 10, 260, 22 ), true );
	IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( smgr->getMesh( "sydney.md2" ) );
	node->setMaterialFlag( EMF_LIGHTING, false );
	node->setMD2Animation( scene::EMAT_STAND );
	node->setMaterialTexture( 0, driver->getTexture("sydney.bmp") );
	IAnimatedMeshSceneNode* node2 = smgr->addAnimatedMeshSceneNode( smgr->getMesh( "sydney.md2" ) );
	node2->setMaterialFlag( EMF_LIGHTING, false );
	node2->setMD2Animation( scene::EMAT_STAND );
	node2->setMaterialTexture( 0, driver->getTexture("sydney.bmp") );
	node2->setPosition( vector3df( 20.0f, 0.0f, 0.0f ) );
	ICameraSceneNode* cam = smgr->addCameraSceneNode( 0, vector3df( 40.0f, 30.0f, -40.0f ), vector3df( 0.0f, 5.0f, 0.0f ) );

	ISceneNode* sun = smgr->addSphereSceneNode( 50.0f, 16 );
	sun->setPosition( vector3df( 0.0f, 50.0f, 1000.0f ) );
	sun->setMaterialFlag( EMF_LIGHTING, false );
	sun->setMaterialTexture( 0, driver->getTexture("sun.png") );
	// Interesting stuff

	// As before, we make a renderer
	IPostProc* ppRenderer = new CRendererPostProc( smgr, dimension2di( 1024, 512 ), true, true, SColor( 255u, 100u, 101u, 140u ) );
	// Now make a flare effect:
	// (render from, output size, sun scene node)
	// can also use a vector instead of a scene node - when using a scene node the position will follow node automatically
	CLensFlarePostProc* ppFlare1 = new CLensFlarePostProc( ppRenderer, dimension2di( 1024, 512 ), driver->getTexture("flare.png"), sun, 50.0f );
	CLensFlarePostProc* ppFlare2 = new CLensFlarePostProc( ppFlare1, dimension2di( 1024, 512 ), driver->getTexture("flare.png"), vector3df( -2000.0f, 50.0f, 1000.0f ) );
	ppFlare2->setQuality( PPQ_CRUDE ); // Setting the quality to crude avoids pixel checking, which is slow (expecially when more than one lens flare), so if you use >1 flare, set most of them to crude.

	// These variables aren't important - they are just for showing the FPS
	wchar_t tmp[255]; u8 t = 0u;

	while( device->run( ) ) {
		cam->setPosition( vector3df( -(device->getCursorControl( )->getPosition( ).X - 320.0f) * 0.1f, (device->getCursorControl( )->getPosition( ).Y - 240.0f) * 0.2f, -70.0f ) );
		driver->beginScene( false, driver->getDriverType( ) == video::EDT_DIRECT3D9 );
		ppFlare2->render( NULL );
		guienv->drawAll( );
		driver->endScene( );

		// Show the current FPS
		if( ++ t == 30u ) { t = 0u; swprintf(tmp, 255, L"%ls fps:%3d", driver->getName(), driver->getFPS() ); device->setWindowCaption( tmp ); }
	}

	delete ppFlare1;
	delete ppFlare2;
	delete ppRenderer;

	// Back to boring stuff
	device->drop();
	return 0;
}
开发者ID:tecan,项目名称:IrrlichtDemos,代码行数:56,代码来源:main.cpp

示例4: testTransparentVertexAlphaMore

bool testTransparentVertexAlphaMore(E_DRIVER_TYPE driverType)
{
	IrrlichtDevice *device = createDevice(driverType, dimension2d<u32>(160, 120));
	if (!device)
		return true;

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

	if (driver->getColorFormat() != video::ECF_A8R8G8B8)
	{
		device->closeDevice();
		device->run();
		device->drop();
		return true;
	}

	logTestString("Testing driver %ls\n", driver->getName());

	IAnimatedMesh* mesh = smgr->getMesh("../media/sydney.md2");
	IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
	IMeshSceneNode* cube = smgr->addCubeSceneNode(10.0f,0,-1,vector3df(-5,3,-15));

	if (node)
	{
		node->setMaterialFlag(EMF_LIGHTING, false);
		node->setFrameLoop(0, 310);
		node->setMaterialTexture( 0, driver->getTexture("../media/sydney.bmp") );
	}
	if (cube)
	{
		cube->getMaterial(0).MaterialType = EMT_TRANSPARENT_VERTEX_ALPHA;
		cube->setMaterialTexture(0, driver->getTexture("../media/wall.bmp"));
		cube->setMaterialFlag(EMF_LIGHTING, false);
		smgr->getMeshManipulator()->setVertexColorAlpha(cube->getMesh(),128);
	}
	// second cube without texture
	cube = smgr->addCubeSceneNode(10.0f,0,-1,vector3df(5,3,-15));
	if (cube)
	{
		cube->getMaterial(0).MaterialType = EMT_TRANSPARENT_VERTEX_ALPHA;
		cube->setMaterialFlag(EMF_LIGHTING, false);
		smgr->getMeshManipulator()->setVertexColorAlpha(cube->getMesh(),128);
	}

	smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));

	driver->beginScene(true, true, SColor(0,200,200,200));
	smgr->drawAll();
	driver->endScene();

	bool result = takeScreenshotAndCompareAgainstReference(driver, "-transparentVertexAlphaChannelMore.png", 99.18f);

	device->closeDevice();
	device->run();
	device->drop();

	return result;
}
开发者ID:Badcreature,项目名称:sagcg,代码行数:59,代码来源:transparentMaterials.cpp

示例5: 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

示例6: 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

示例7: createObject

    static i3DObject * createObject(_string name, _string meshName) 
    {
        ISceneManager* smgr = irrDevice->getSceneManager();
        IAnimatedMesh* mesh = smgr->getMesh(meshName);
        if (mesh == NULL)
        {
			printf("failed to load %s\n", meshName);
            return NULL;
        }

        return new CIrr3DObject(smgr, name, mesh);
    }
开发者ID:xiaofeme,项目名称:tt,代码行数:12,代码来源:cirr3dengine.hpp

示例8: runTestWithDriver

//! Tests lightmaps under all drivers that support them
static bool runTestWithDriver(E_DRIVER_TYPE driverType)
{
    IrrlichtDevice *device = createDevice( driverType, dimension2d<u32>(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();

    logTestString("Testing driver %ls\n", driver->getName());
    if (driver->getDriverAttributes().getAttributeAsInt("MaxTextures")<2)
    {
        device->closeDevice();
        device->run();
        device->drop();
        return true;
    }

    stabilizeScreenBackground(driver);

    bool result = true;
    bool added = device->getFileSystem()->addFileArchive("../media/map-20kdm2.pk3");
    assert_log(added);

    if(added)
    {
        ISceneNode * node = smgr->addOctreeSceneNode(smgr->getMesh("20kdm2.bsp")->getMesh(0), 0, -1, 1024);
        assert_log(node);

        if (node)
        {
            node->setMaterialFlag(EMF_LIGHTING, false);
            node->setPosition(core::vector3df(-1300,-820,-1249));
            node->setScale(core::vector3df(1, 5, 1));

            (void)smgr->addCameraSceneNode(0, core::vector3df(0,0,0), core::vector3df(40,100,30));

            driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,255,255,0));
            smgr->drawAll();
            driver->endScene();

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

    device->closeDevice();
    device->run();
    device->drop();

    return result;
}
开发者ID:D3anil,项目名称:irrlicht,代码行数:52,代码来源:lightMaps.cpp

示例9: addRunWaySceneNode

ISceneNode* MySceneManager::addRunWaySceneNode( const core::vector3df& position /*= core::vector3df( 0 )*/,
	f32 interval /*= 200*/, f32 width /*= 300*/,
	const core::vector3df& colorFrom /*= core::vector3df( 0, 63, 255 )*/, const core::vector3df& colorTo /*= core::vector3df( 255, 255, 0 )*/,
	s32 numOfArrows /*= 15 */ )
{
	MyIrrlichtEngine* pEngine = MyIrrlichtEngine::GetEngine();
	ISceneManager* smgr = pEngine->GetSceneManager();
	IVideoDriver* driver = pEngine->GetVideoDriver();
	u32 TimeMs = pEngine->GetDevice()->getTimer()->getTime();
	f32 delay = 100;

	// 跑道根节点
	ISceneNode* runWay = smgr->addEmptySceneNode();
	runWay->setPosition( position );
	// 供复制的节点
	ISceneNode* node = smgr->addMeshSceneNode( smgr->getMesh( "../media/UnitModel/UnitPlane.obj" ), runWay );
	node->setScale( vector3df( 90, 176, 1 ) );
	node->setRotation( vector3df( 0, 45, 0 ) );
	node->setMaterialTexture( 0, driver->getTexture( "../media/UIResource/Game/arrow.png" ) );
	node->setMaterialFlag( EMF_BACK_FACE_CULLING, false );
	// 节点临时变量
	ISceneNode* copy;
	// Shader
	SceneNodeShader shader;
	// 色彩偏移量
	vector3df colorOffset = ( colorTo - colorFrom ) / (f32)numOfArrows;
	// 右跑道
	for( int i=0; i<numOfArrows; i++ )
	{
		copy = node->clone();
		copy->setPosition( vector3df( width / 2.f, 0, interval * i ) );
		RunWayBlink* ani = new RunWayBlink( (u32)(delay * i), (f32)i, colorFrom, colorOffset );
		copy->addAnimator( ani );
		ani->drop();
	}
	node->setRotation( vector3df( 0, 45, 180 ) );
	// 左跑道
	for( int i=0; i<numOfArrows; i++ )
	{
		copy = node->clone();
		copy->setPosition( vector3df( -width / 2.f, 0, interval * i ) );
		RunWayBlink* ani = new RunWayBlink( (u32)(delay * i), (f32)i, colorFrom, colorOffset );
		copy->addAnimator( ani );
		ani->drop();
	}
	node->setVisible( false );

	return runWay;
	//return CreateRunWay( position, interval, width, colorFrom, colorTo, numOfArrows );
}
开发者ID:HermanYang,项目名称:Scar,代码行数:50,代码来源:MySceneManager.cpp

示例10: main

int main()
{
    IrrlichtDevice *device =
        createDevice( video::EDT_SOFTWARE, dimension2d<u32>(640, 480), 16,
            false, false, false, 0);

    if (!device)
        return 1;

    device->setWindowCaption(L"Have a go here: Chapter 3");

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

    IAnimatedMesh* mesh = smgr->getMesh("/home/fuyajun/Documents/irrlicht-1.7.2/media/sydney.md2");
    if (!mesh)
    {
        device->drop();
        return 1;
    }
    IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );

    MyAnimationEndCallback animEndCallback;

    //连续动画
    if (node)
    {
        node->setMaterialFlag(EMF_LIGHTING, false);
        node->setMD2Animation(scene::EMAT_STAND);
        node->setMaterialTexture( 0, driver->getTexture("/home/fuyajun/Documents/irrlicht-1.7.2/media/sydney.bmp") );

        node->setLoopMode(false);
        node->setAnimationEndCallback(&animEndCallback);
    }

    smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));

    while(device->run())
    {
        driver->beginScene(true, true, SColor(255,100,101,140));

        smgr->drawAll();

        driver->endScene();
    }

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

示例11: example_helloworld

int example_helloworld()
{
	// create device
	IrrlichtDevice *device = startup();
	if (device == 0)
		return 1; // could not create selected driver.

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

	IAnimatedMesh* mesh = smgr->getMesh("../../media/sydney.md2");
	if (!mesh)
	{
		device->drop();
		return 1;
	}
	IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );

	/*
	To let the mesh look a little bit nicer, we change its material. We
	disable lighting because we do not have a dynamic light in here, and
	the mesh would be totally black otherwise. Then we set the frame loop,
	such that the predefined STAND animation is used. And last, we apply a
	texture to the mesh. Without it the mesh would be drawn using only a
	color.
	*/
	if (node)
	{
		node->setMaterialFlag(EMF_LIGHTING, false);
		node->setMD2Animation(scene::EMAT_STAND);
		node->setMaterialTexture( 0, driver->getTexture("../../media/sydney.bmp") );
	}

	/*
	To look at the mesh, we place a camera into 3d space at the position
	(0, 30, -40). The camera looks from there to (0,5,0), which is
	approximately the place where our md2 model is.
	*/
	smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));

	EventReceiver_basic receiver(device);
	device->setEventReceiver(&receiver);

	return run ( device );

}
开发者ID:jivibounty,项目名称:irrlicht,代码行数:47,代码来源:main.cpp

示例12: main

int main()
{
	eventReceiver receiver;
	IrrlichtDevice *device = createDevice( video::EDT_OPENGL, dimension2d<u32>(1366, 768), 16,true, false, false,&receiver);
	device->setWindowCaption(L"(WhizGeek || Mclightning).com");
	IVideoDriver* driver = device->getVideoDriver();
	ISceneManager* smgr = device->getSceneManager();

	scene::ICameraSceneNode* kam= smgr->addCameraSceneNode(NULL,vector3df(0,0,200),vector3df(0,0,0));
	
	//kam->setPosition(vector3df(0,0,200));

	ISceneNode* kutu=smgr->addCubeSceneNode(50,0,2,vector3df(50,0,0));
	ISceneNode* kutu2=smgr->addCubeSceneNode(50,0,2,vector3df(-50,0,0));
	ITexture *duvar=driver->getTexture("wall.jpg");
	kutu->setMaterialTexture(0,duvar);
	kutu->setMaterialFlag(video::EMF_LIGHTING, false);
	kutu2->setMaterialTexture(0,duvar);
	kutu2->setMaterialFlag(video::EMF_LIGHTING, false);

		IAnimatedMesh* mesh = smgr->getMesh("sydney.md2");
		IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
		node->setMaterialFlag(EMF_LIGHTING, false);
		node->setMD2Animation(scene::EMAT_STAND);
		node->setMaterialTexture( 0, driver->getTexture("sydney.bmp") );
		node->setRotation(vector3df(0,270,0));
		
	irFinder ir("test",true,230,255);
	CvPoint in;
	while(device->run())
	{		
		if(receiver.IsKeyDown(KEY_ESCAPE))
		{
			device->drop();
			return 0;
		}
		driver->beginScene(true, true, SColor(255,0,0,255));
		in=ir.yenile();
		//node->setPosition(vector3df(30*in.x/320,30*(240-in.y)/240,0));
		kam->setPosition(vector3df(in.x-160,(240-in.y),200));
		smgr->drawAll();
		driver->endScene();
	}
	device->drop();
}
开发者ID:ayildirim,项目名称:Irrlicht-HeadTracking,代码行数:45,代码来源:main.cpp

示例13: md2Animation

/** At the moment, this just verifies that the last frame of the animation produces the expected bitmap. */
bool md2Animation(void)
{
	// Use EDT_BURNINGSVIDEO since it is not dependent on (e.g.) OpenGL driver versions.
	IrrlichtDevice *device = createDevice( EDT_BURNINGSVIDEO, dimension2d<u32>(160, 120), 32);
	assert(device);
	if (!device)
		return false;

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

	IAnimatedMesh* mesh = smgr->getMesh("../media/sydney.md2");
	IAnimatedMeshSceneNode* node;
	assert(mesh);

	if(mesh)
	{
		node = smgr->addAnimatedMeshSceneNode(mesh);
		assert(node);

		if(node)
		{
			node->setPosition(vector3df(20, 0, 30));
			node->setMaterialFlag(EMF_LIGHTING, false);
			node->setMaterialTexture(0, driver->getTexture("../media/sydney.bmp"));
			node->setLoopMode(false);

			(void)smgr->addCameraSceneNode();

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

	bool result = takeScreenshotAndCompareAgainstReference(driver, "-md2Animation.png");
	device->drop();

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

示例14: main

int main()
{
	IrrlichtDevice *device =
	                createDevice( video::EDT_OPENGL, dimension2d<u32>(640, 480), 16,
	                        false, false, false, 0);

	if (!device)
		cout<<"error";
	else
	{
		device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");
		IVideoDriver* driver = device->getVideoDriver();
		ISceneManager* smgr = device->getSceneManager();
		IGUIEnvironment* guienv = device->getGUIEnvironment();
		guienv->addStaticText(L"Hello World! This is the Irrlicht Software renderer!",
		                rect<s32>(10,10,260,22), true);
        IAnimatedMesh* mesh = smgr->getMesh("sydney.md2");
        if (!mesh)
        {
                device->drop();
                return 1;
        }
        IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
        if (node)
        {
                node->setMaterialFlag(EMF_LIGHTING, false);
                node->setMD2Animation(scene::EMAT_STAND);
                node->setMaterialTexture( 0, driver->getTexture("sydney.bmp") );
        }
        smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));
        while(device->run())
        {
            driver->beginScene(true, true, SColor(255,100,101,140));

            smgr->drawAll();
            guienv->drawAll();

            driver->endScene();
        }
        device->drop();

	}
	cout<<"hello world2";
}
开发者ID:pH-,项目名称:testirrlicht,代码行数:44,代码来源:helloworld.cpp

示例15: BaseGameEntity

GameFieldNeo::GameFieldNeo()
	: BaseGameEntity(BaseGameEntity::GetNextValidID(), vector3df(0.f, 0.f, 0.f), 0.f, vector3df(1.f, 1.f, 1.f))	  
{
	// get ready scene node
	ISceneManager* pSmgr = IrrDvc.GetSmgr();
	m_pMesh = pSmgr->getMesh("Rsrc/Cube.dae");
	if (m_pMesh)
	{
		m_pSceneNode = pSmgr->addAnimatedMeshSceneNode(m_pMesh);
		m_pSceneNode->setScale(vector3df(10.f, 10.f, 10.f));
		m_pSceneNode->setMaterialFlag(video::EMF_LIGHTING, false);		
	}	

	scene::ISceneNodeAnimator* pAnim = pSmgr->createRotationAnimator(core::vector3df(1,1,1));
	if (pAnim)
	{
		m_pSceneNode->addAnimator(pAnim);
		pAnim->drop();
	}
}
开发者ID:ptptomr,项目名称:project_ran,代码行数:20,代码来源:GameFieldNeo.cpp


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