本文整理汇总了C++中IAnimatedMeshSceneNode类的典型用法代码示例。如果您正苦于以下问题:C++ IAnimatedMeshSceneNode类的具体用法?C++ IAnimatedMeshSceneNode怎么用?C++ IAnimatedMeshSceneNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IAnimatedMeshSceneNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createNode
ISceneNode* Render::createNode(bool isMD2, IAnimatedMesh* mesh, ITexture* texture, bool light,core::vector3df scale, core::vector3df pos, core::vector3df rotation)
{
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(mesh, NULL, IDFlag_IsPickable);
if(node)
{
pos.Y += -node->getBoundingBox().MinEdge.Y * scale.Y;
node->setPosition(pos);
node->setRotation(rotation);
node->setScale(scale);
node->setAnimationSpeed(20.f);
scene::ITriangleSelector* selector = 0;
selector = smgr->createTriangleSelector(node);
node->setTriangleSelector(selector);
selector->drop();
//Autoscale
//f32 scale = 0.25f;
node->setScale(scale);
if (texture)
{
//node->setMaterialFlag(EMF_LIGHTING, false);
node->setMaterialTexture(0, texture);
}
node->setMD2Animation(EMAT_STAND);
}
return node;
}
示例2: setupSceneAndManager
pAnimatedSceneObject AnimatedSceneObject::init(pObject const& parent)
{
setupSceneAndManager(parent);
std::ostringstream oss;
oss << Conf::i().expand("rc/model/") << name_ << ".x";
IAnimatedMesh* mesh = smgr_->getMesh( oss.str().c_str() );
IAnimatedMeshSceneNode* temp = smgr_->addAnimatedMeshSceneNode( mesh, parent->body() );
temp->setAnimationSpeed(0);
body_ = temp;
body_->grab(); //added so its d'tor order is consistent with view::Object.
body_->getMaterial(0).Shininess = 0;
for( size_t i = 0; i < body_->getMaterialCount(); ++i ) {
body_->getMaterial(i).MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
body_->getMaterial(i).MaterialTypeParam = 0.01f;
body_->getMaterial(i).DiffuseColor.set(255, 255, 255, 255);
}
//test
body_->grab();
pAnimatedSceneObject self = static_pointer_cast<AnimatedSceneObject>( shared_from_this() );
scene()->addPickMapping( body_, self );
return self;
}
示例3: init
void TestLevel::init() {
IAnimatedMesh* mesh = smgr->getMesh("img/sydney.md2");
IAnimatedMeshSceneNode * tmpnode = smgr->addAnimatedMeshSceneNode(mesh);
if (tmpnode) {
tmpnode->setMaterialFlag(EMF_LIGHTING, false);
tmpnode->setMD2Animation(scene::EMAT_STAND);
tmpnode->setMaterialTexture(0, driver->getTexture("img/sydney.bmp"));
}
tmpnode->setPosition(vector3df(-222,0,0));
vector3df wsp(0,5,-10);
ship = new TestPlayerShip(TestPlayerShip::createTestPlayerShipNode(context));
ship->attachNewCamera(new StaticCamera(context,ship));
// ship.attachCamera(cam);
this->node = new NonPlayerShip(tmpnode);
testPlanet = Planet::createTestPlanet(context);
}
示例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;
}
示例5: createNode
IAnimatedMeshSceneNode* Level::createNode(
const LevelConfig::Model& model, u32 position)
{
IAnimatedMeshSceneNode* node = _game->getDevice()->getSceneManager(
)->addAnimatedMeshSceneNode(model.Mesh, _rootNode,
-1, _board->getPosition(position));
node->setAnimationSpeed(model.AnimationSpeed);
return node;
}
示例6: 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;
}
示例7: addNinja
static ISceneNode* addNinja(ISceneManager* smgr, core::vector3df pos)
{
IAnimatedMeshSceneNode* ninja = smgr->addAnimatedMeshSceneNode(
smgr->getMesh("Assets/model/ninja/ninja.b3d"));
ninja->setFrameLoop(182, 204);
ninja->setMaterialFlag(video::EMF_LIGHTING, false);
ninja->setAnimationSpeed(12);
ninja->setPosition(pos);
return ninja;
}
示例8: loadPlayerNode
//loads the player and sets initial position
IAnimatedMeshSceneNode* Player::loadPlayerNode(IrrlichtDevice* device, ISceneManager* smgr)
{
IAnimatedMesh* player = smgr->getMesh("Assets/player.x");
if (!player) { device->drop(); return NULL; }
IAnimatedMeshSceneNode *plyrNode = smgr->addAnimatedMeshSceneNode(player);
for (int i = 0; i < plyrNode->getMaterialCount(); i++)
{
plyrNode->getMaterial(i).NormalizeNormals = true;
}
plyrNode->setPosition(vector3df(5.0f, 0.1f, 5.0f));
return plyrNode;
}
示例9: switch
bool CRaycastTankExample::OnEvent(const SEvent& event)
{
if (!device)
return false;
switch(event.EventType)
{
case EET_MOUSE_INPUT_EVENT:
{
if(event.MouseInput.Event==EMIE_RMOUSE_PRESSED_DOWN)
{
shootSphere(vector3df(0.2,0.2,0.2), 0.2);
}
}
break;
case EET_KEY_INPUT_EVENT:
{
KeyIsDown[event.KeyInput.Key] = event.KeyInput.PressedDown;
if(event.KeyInput.Key == KEY_KEY_P && event.KeyInput.PressedDown == false)
{
world->pauseSimulation(!world->simulationPaused());
}
else
if(event.KeyInput.Key == KEY_KEY_R && event.KeyInput.PressedDown == false)
{
// Re-Spawn our tank at the original location.
irr::core::matrix4 mat;
mat.setTranslation(spawnPoint);
tank->setWorldTransform(mat);
tank->setAngularVelocity(vector3df(0,0,0));
tank->setLinearVelocity(vector3df(0,0,0));
}
if(event.KeyInput.Key == KEY_SPACE && event.KeyInput.PressedDown == false)
{
IAnimatedMeshSceneNode *node = static_cast<IAnimatedMeshSceneNode*>(tank->getCollisionShape()->getSceneNode());
vehicle->getRigidBody()->applyImpulse(vector3df(0,0,-500), node->getJointNode("Muzzle")->getPosition(), ERBTS_LOCAL);
createMuzzleFlash(node->getJointNode("Muzzle"));
}
}
break;
default:
break;
}
return false;
}
示例10: main
int main()
{
MyIrrlichtComposition mDevice(video::EDT_SOFTWARE,dimension2d<u32>(800,600 ));
mDevice.AddBackground("background.png");
IAnimatedMeshSceneNode* node = mDevice.mLoadMesh(vector3df(0,10,0),vector3df(0,-90,0),vector3df(0.2,0.2,0.2),"raven.md2","raven.jpg");
const int count=5;
IAnimatedMeshSceneNode* plat[count+1];
for(int i(0);i<count;++i)
plat[i] = mDevice.mLoadMesh(vector3df(-41+i*20, -20+i*10, 0),vector3df(30,0,0),vector3df(2.5,2.5,2.5),"platform02.obj","platform00.tga");
mDevice.AddCamera();
//u32 then = mDevice()->getTimer()->getTime();
f32 g=-0.2;
while(mDevice()->run())
{
g-=0.002;
// двигаем ее текущую позицию вправо или влево
if(mDevice.receiver.IsKeyDown(irr::KEY_KEY_A))
mDevice.ObjMoving(node, vector3df(0,0,-0.25));
else if(mDevice.receiver.IsKeyDown(irr::KEY_KEY_D))
mDevice.ObjMoving(node, vector3df(0,0,0.25));
//считываем для выхода
if(mDevice.receiver.IsKeyDown(irr::KEY_ESCAPE))
return 0;
//"гравитация"
mDevice.ObjMoving(node, vector3df(0,g,0));
//движение камеры
mDevice.SetCamera(vector3df(0, node->getPosition().Y, 0));
mDevice.MoveCamera(vector3df(0 , node->getPosition().Y, node->getPosition().Z + 50));
//перенос игрока на другую сторону при вылете за пределы поля
if(node->getPosition().X == -45)
mDevice.ObjMoving(node, vector3df(0, 0, -90));
else if(node->getPosition().X == 45)
mDevice.ObjMoving(node, vector3df(0, 0, 90));
//обработка столкновения и "прыжок"
for(int i(0);i<count;++i)
if(mDevice.mCollision(node,plat[i]))
g=0.2;
//выход, если слишком сильно упал
f32 fall=-150;
if (node->getPosition().Y>fall - 5 && node->getPosition().Y<fall + 5)
return 0;
//обработка сцены
mDevice.ShowScene();
}
mDevice()->drop();
return 0;
}
示例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 );
}
示例12: getParentNode
bool PlayerObject::initWithLevel(int level)
{
// IMesh* mesh = _assets->getMesh(PLAYER, MESH, 0);
// if (!mesh)
// return false;
//
// IMeshSceneNode* node = _smgr->addMeshSceneNode(mesh);
// _node = node;
// if (node)
// {
// node->setMaterialFlag(EMF_LIGHTING, true);
//// node->setMaterialFlag(EMF_FOG_ENABLE, true);
// node->setMaterialTexture(0, _assets->getTexture(PLAYER, TEXTURE, 0));
//// for (int i = 0; i < 9; i++)//TODO : comment faire pour ne pas mettre le nombre de textures en dur
//// {
//// node->setMaterialTexture(0, _ressources->getTexture(PLAYER, TEXTURE, 0));
//// }
//
// this->scaleOnCase();
// this->updateNodePosition();
// return true;
// }
_level = level;
IAnimatedMesh* mesh = static_cast<IAnimatedMesh*>(_assets->getMesh(PLAYER, MESH, _level));
if (!mesh)
return false;
IAnimatedMeshSceneNode* node = _smgr->addAnimatedMeshSceneNode(mesh, getParentNode(), NODE_ID_PLAYER);
_node = node;
if (node)
{
node->setMaterialFlag(EMF_LIGHTING, false);
// node->setMaterialFlag(EMF_FOG_ENABLE, true);
startNewAnim(EMAT_STAND, REPEAT);
startNewAnim(EMAT_SALUTE, ONCE);
// node->setMD2Animation(EMAT_STAND);
this->scaleOnCase();
this->updateNodePosition();
node->setMaterialTexture(0, _assets->getTexture(PLAYER, TEXTURE, _level));
return true;
}
return false;
}
示例13: loadSceneObject
SceneObject* PhysicsSim::loadSceneObject(stringw mesh_file, stringw texture_file)
{
IAnimatedMesh *mesh = smgr->getMesh(mediaDirectory + mesh_file);
IAnimatedMeshSceneNode* Node = smgr->addAnimatedMeshSceneNode(mesh, smgr->getRootSceneNode());
stringw tex_file = texture_file;
if(tex_file == L"")
{
tex_file = mesh_file;
if(tex_file.find(".dae") > -1)
tex_file.remove(".dae");
if(tex_file.find(".3ds") > -1)
tex_file.remove(".3ds");
tex_file.append(".jpg");
}
tex_file = mediaDirectory + tex_file;
if(smgr->getFileSystem()->existFile(tex_file))
Node->setMaterialTexture(0, driver->getTexture(tex_file));
Node->setMaterialFlag(EMF_LIGHTING, true);
Node->setMaterialFlag(EMF_TEXTURE_WRAP, false);
Node->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
Node->addShadowVolumeSceneNode(0,-1,false);
Node->getMaterial(0).AmbientColor.set(255,255,255,255);
updateObjects();
return Node;
}
示例14: 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();
}
示例15: addCheckPoint
void Game::addCheckPoint(const vector3df& position, const vector3df& rotation)
{
string<char> str = "checkpoint" + checkpoint->size();
IAnimatedMesh *cp1 = smgr->addHillPlaneMesh(str.c_str(), dimension2d<f32>(1000,1000), dimension2d<u32>(1,1));
IAnimatedMeshSceneNode *c = smgr->addAnimatedMeshSceneNode(cp1);
c->setRotation(rotation);
c->setPosition(position);
//c->setDebugDataVisible(EDS_BBOX);
checkpoint->push_back(c);
if (checkpoint->size() == 1)
{
first_checkpoint = c;
}
c->setMaterialType(EMT_TRANSPARENT_ADD_COLOR);
//c->setMaterialFlag(EMF_BACK_FACE_CULLING, false);
}