本文整理汇总了C++中IAnimatedMeshSceneNode::setPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ IAnimatedMeshSceneNode::setPosition方法的具体用法?C++ IAnimatedMeshSceneNode::setPosition怎么用?C++ IAnimatedMeshSceneNode::setPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAnimatedMeshSceneNode
的用法示例。
在下文中一共展示了IAnimatedMeshSceneNode::setPosition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateScene
void CScene::UpdateScene(vector<vector3df> otherClientPosition, ICameraSceneNode* camera)
{
ISceneManager* smgr=device->getSceneManager();
IVideoDriver* driver=device->getVideoDriver();
// 测试用
IAnimatedMesh* personMeshTest=smgr->getMesh("../../media/sydney.md2");
IAnimatedMeshSceneNode* personNode = smgr->addAnimatedMeshSceneNode( personMeshTest );
if (!personMeshTest)
{
device->drop();
return ;
}
if (personNode)
{
personNode->setScale(vector3df(0.4f,0.4f,0.4f));
personNode->setPosition(vector3df(0.0f,10.0f,0.0f));
personNode->setMaterialTexture( 0, driver->getTexture("../../media/sydney.bmp") );
personNode->setMaterialFlag(EMF_LIGHTING, false);
personNode->getMaterial(0).Shininess=28.0f;
personNode->getMaterial(0).NormalizeNormals=true;
personNode->setMD2Animation ( scene::EMAT_STAND );
}
personMeshTest->setMaterialFlag(EMF_LIGHTING,false);
// 显示其他客户端
for (int i=0;i!=otherClientPosition.size();i++)
{
IAnimatedMesh* personMesh=smgr->getMesh("../../media/sydney.md2");
IAnimatedMeshSceneNode* personNode = smgr->addAnimatedMeshSceneNode( personMesh );
if (!personMesh)
{
device->drop();
return ;
}
if (personNode && personNode->getPosition()!=camera->getPosition())
{
// personNode->setPosition(vector3df(10,20,0));
// personNode->setScale(vector3df(0.5,0.5,0.5));
personNode->setPosition(otherClientPosition[i]);
personNode->setMaterialTexture( 0, driver->getTexture("../../media/sydney.bmp") );
personNode->setMaterialFlag(EMF_LIGHTING, false);
personNode->getMaterial(0).Shininess=28.0f;
personNode->getMaterial(0).NormalizeNormals=true;
personNode->setMD2Animation ( scene::EMAT_STAND );
}
personMesh->setMaterialFlag(EMF_LIGHTING,false);
}
}
示例2: 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;
}
示例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: 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;
}
示例5: 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;
}
示例6: setupHud
void Game::setupHud(){
IAnimatedMesh* gunmesh = smgr->getMesh("resources/models/weapons/test.obj");
IAnimatedMeshSceneNode* gunnode;
if(gunmesh)
{
gunnode = smgr->addAnimatedMeshSceneNode(gunmesh, gunnode);
gunnode->setParent(camera);
gunnode->setPosition(vector3df(50, 0, 1000));
gunnode->setRotation(vector3df(0, 0, 1000));
gunnode->updateAbsolutePosition();
std::cout << gunnode->getAbsolutePosition().X << ", " << gunnode->getAbsolutePosition().Y << ", "
<< gunnode->getAbsolutePosition().Z;
//gunnode->setScale(vector3df(1, 1, 1));
}
}
示例7: mLoadMesh
IAnimatedMeshSceneNode* MyIrrlichtComposition::mLoadMesh(vector3df pos,vector3df rot,vector3df scale, std::string name1, std::string name2)
{
IAnimatedMeshSceneNode* obj = smgr->addAnimatedMeshSceneNode(smgr->getMesh(name1.c_str()));
if(obj)
{
obj->setPosition(pos);
obj->setMD2Animation(scene::EMAT_RUN);
obj->setRotation(rot);
obj->setScale(scale);
obj->setMaterialTexture(0, driver->getTexture(name2.c_str()));
obj->addShadowVolumeSceneNode();
return obj;
}
else
exit(2);
}
示例8: 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);
}
示例9: 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;
}
示例10: addModel
void Unit::addModel() {
IAnimatedMeshSceneNode* modelNode = Game::getInstance().sceneManager->addAnimatedMeshSceneNode( model, node );
if (modelNode)
{
modelNode->setMaterialTexture( 0, texture );
modelNode->getMaterial(0).Shininess = 0;
modelNode->setScale(vector3df(0.15f, 0.15f, 0.15f) );
modelNode->addShadowVolumeSceneNode(0, 0, false);
modelNode->setID(0);
currentAnimation = IDLE_ANIMATION;
float randX = rand() % 8 - 4;
float randZ =rand() % 8 - 4;
modelNode->setPosition(vector3df(randX, 0.0f, randZ));
}
modelNodes.push_back(modelNode);
}
示例11: produce
void AnnyFactory::produce(int x,int y,int z){
std::string sydneyMesh = "monkey.obj";
std::string sydneyMaterial = "unwrappedPainted.png";//"monkey.bmp";
IAnimatedMesh* mesh = sceneManager->getMesh((RESOURCES+sydneyMesh).c_str());
if (!mesh)
{
exit(1);
}
IAnimatedMeshSceneNode* node = sceneManager->addAnimatedMeshSceneNode( mesh );
const wchar_t* name = L"Monkey head";
objectList->addObject(name);
if (node)
{
node->setMaterialFlag(EMF_LIGHTING, false);
node->setMD2Animation(scene::EMAT_RUN);
node->setMaterialTexture( 0, driver->getTexture((RESOURCES+sydneyMaterial).c_str()) );
node->setName(name);
node->setPosition(core::vector3df(x,y,z));
node->setScale(core::vector3df(10,10,10));
node->setRotation(core::vector3df(0,200,0));
}
}
示例12: drawVector
void PhysicsSim::drawVector(Vector3D init, Vector3D end, Color c)
{
Vector3D vec = end-init;
float length = vec.getLength();
stringw meshname("ArrowMesh");
meshname += (int)arrows.size();
IAnimatedMesh* arrow = smgr->addArrowMesh (meshname, c, c, 4, 8, length, (length - 0.4 < 0.0) ? length*0.4 : (length-0.4));
IAnimatedMeshSceneNode *arrownode = smgr->addAnimatedMeshSceneNode(arrow);
arrownode->setPosition(init);
//arrownode->setScale(vector3df(1.0, length, 1.0));
vec.normalize();
quaternion q;
q.rotationFromTo(vector3df(0,1,0), vec);
vector3df rot;
q.toEuler(rot);
arrownode->setRotation(vector3df(rot.X*180.0/M_PI, rot.Y*180.0/M_PI, rot.Z*180.0/M_PI));
arrows.push_back(arrownode);
}
示例13: addTile
void Tile::addTile(float x, float y, float z) {
IAnimatedMeshSceneNode* tempnode = smgr->addAnimatedMeshSceneNode(tile[0]);
tempnode->setPosition(core::vector3df(x,y,z));
entity.insert(tempnode);
}
示例14: main
int main()
{
IrrlichtDevice *device = createDevice( video::EDT_OPENGL, dimension2d<u32>(1024, 768), 32, false, false, true, 0);
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
smgr->addCameraSceneNodeFPS();
const s32 randLength = 1024;
srand(device->getTimer()->getRealTime());
//Creating the grid for unit measure, etc
u32 tileNumber = 128;
IAnimatedMesh* groundMesh = smgr->addHillPlaneMesh("", dimension2d<float>(8,8),dimension2d<u32>(tileNumber,tileNumber),0,0.0f,dimension2df(0,0),dimension2df(tileNumber,tileNumber));
IAnimatedMeshSceneNode * groundNode = smgr->addAnimatedMeshSceneNode(groundMesh);
groundNode->setMaterialTexture(0,driver->getTexture("../media/grid2.png"));
groundNode->setMaterialFlag(EMF_LIGHTING,false);
groundNode->setPosition(vector3df(0,-2,0));
//obstacles for stuff
EntityGroup obstacles;
for(int i = 0; i < 20; i++)
{
ISceneNode* s = smgr->addSphereSceneNode(20);
IrrlichtBaseEntity * e = new IrrlichtBaseEntity(s);
s->setPosition(vector3df(rand()%randLength - (randLength/2),0,rand()%randLength - (randLength/2)));
obstacles.push_back(e);
}
//Nodes for vehicles
ISceneNode * cube = smgr->addCubeSceneNode(4);
ISceneNode * cube2 = smgr->addCubeSceneNode(4);
cube->setMaterialFlag(EMF_LIGHTING,false);
cube->setMaterialTexture(0,driver->getTexture("../media/v1-solid.png"));
cube2->setMaterialFlag(EMF_LIGHTING,false);
cube2->setMaterialTexture(0,driver->getTexture("../media/v2-solid.png"));
//Creating the actual vehicles
IrrlichtMobileEntity * Entity1 = new IrrlichtMobileEntity(cube ,vector3df(0,0,0), 1, 90, 40);
IrrlichtMobileEntity * Entity2 = new IrrlichtMobileEntity(cube2,vector3df(0,0,300), 1, 100, 50);
//Creating the steering conrollers, constructor also sets steering on entity
SimpleSteeringController* Entity1Steering = new SimpleSteeringController(Entity1);
SimpleSteeringController * Entity2Steering = new SimpleSteeringController(Entity2);
//Setting up other params for behaviors
Entity1Steering->SetObstacles(obstacles);
Entity1Steering->SetHideTarget(Entity2);
Entity1Steering->SetBehaviorFlag(EBF_HIDE,true);
Entity1Steering->SetBehaviorFlag(EBF_AVOID,true);
Entity2Steering->SetObstacles(obstacles);
Entity2Steering->SetPursuitTarget(Entity1);
Entity2Steering->SetBehaviorFlag(EBF_PURSUIT,true);
Entity2Steering->SetBehaviorFlag(EBF_AVOID,true);
//vars for tracking time between frames. This allows framerate independent motion state updates.
u32 then = device->getTimer()->getTime();
float timeUpdate = 0;
while(device->run())
{
const u32 now = device->getTimer()->getTime();
const float frameDeltaTime = (float)(now - then) / 1000.f; // Time in seconds
then = now;
timeUpdate += frameDeltaTime;
if(timeUpdate > 1)
{
core::stringw str = L"desteer v0.0.1 FPS: ";
str += (s32)driver->getFPS();
device->setWindowCaption(str.c_str());
timeUpdate = 0;
}
//Do behavior updates before the rendering.
Entity1->Update(frameDeltaTime);
Entity2->Update(frameDeltaTime);
driver->beginScene(true, true, SColor(255,100,101,140));
smgr->drawAll();
driver->endScene();
}
//Clean up irrlicht.
device->drop();
return 0;
}
示例15: removeTile
void Tile::removeTile(float x, float y, float z) {
IAnimatedMeshSceneNode* tempnode = smgr->addAnimatedMeshSceneNode(tile[0]);
tempnode->setPosition(core::vector3df(x,y,z));
//entity.erase(entity.find(tempnode)); // <-- kaatuu
}