本文整理汇总了C++中ogre::SceneNode::translate方法的典型用法代码示例。如果您正苦于以下问题:C++ SceneNode::translate方法的具体用法?C++ SceneNode::translate怎么用?C++ SceneNode::translate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::SceneNode
的用法示例。
在下文中一共展示了SceneNode::translate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawNewCore
void TestGame::DrawNewCore(Logic::CoreBuiltEvnt *evnt){
Ogre::Entity* drop= mSceneMgr->createEntity("Mesh"+evnt->building->mSysName, "BaseDropNew.mesh");
drop->setCastShadows(true);
const Ogre::AxisAlignedBox test =drop->getBoundingBox();
Control::ClickHelper* helpr = new Control::ClickHelper(Logic::CHT_BUILDING);
helpr->target = evnt->building;
drop->setUserAny(Ogre::Any(helpr));
Ogre::SceneNode *coreNode = evnt->country->mNode->createChildSceneNode();
Ogre::Vector3 tempvect = calculateActualPointFromCenter(evnt->country->mCapital.mPosition,evnt->tile->mPosition);
tempvect= tempvect*TILESIZE;
coreNode->attachObject(drop);
coreNode->translate(tempvect);
coreNode->pitch(Ogre::Degree(90));
coreNode->scale(0.5,0.5,0.5);
Ogre::AnimationState* temp= drop->getAnimationState("drop");
temp->setLoop(false);
temp->setEnabled(true);
mAllAnimation .insert(temp);
Ogre::Entity* basePlane= mSceneMgr->createEntity("MeshBaseFloor"+evnt->building->mSysName, "BaseCloseLook.mesh");
basePlane->setMaterialName("BaseCloseLook/Rockwall");
Ogre::SceneNode *BaseDraw = evnt->country->mNode->createChildSceneNode(),*camspot;
BaseDraw->attachObject(basePlane);
BaseDraw->translate(2000*evnt->building->mSlot,0,0);
camspot = BaseDraw->createChildSceneNode("CamPoint_"+evnt->building->mSysName);
camspot->setPosition(0,45,45);
camspot->lookAt(Ogre::Vector3(0,0,0), Ogre::Node::TS_PARENT);
helpr = new Control::ClickHelper(Logic::CHT_EMPTYSPACE);
helpr->target = evnt->building;
basePlane->setUserAny(Ogre::Any(helpr));
}
示例2: update
void OgreCharacterController::update(Ogre::Real elapsedTime, OIS::Keyboard * input)
{
Ogre::SceneNode * node = getMainNode();
OGRE_ANIMATION_STATE state = IDLE;
if(input->isKeyDown(OIS::KC_W)) {
node->translate(node->getOrientation() * Ogre::Vector3(0, 0, elapsedTime*100));
state = RUN;
}
if(input->isKeyDown(OIS::KC_S)) {
node->translate(node->getOrientation() * Ogre::Vector3(0, 0, elapsedTime*-50));
state = RUN;
}
if(input->isKeyDown(OIS::KC_A)) {
node->yaw(Ogre::Radian(2*elapsedTime));
}
if(input->isKeyDown(OIS::KC_D))
node->yaw(Ogre::Radian(-2*elapsedTime));
if(input->isKeyDown(OIS::KC_RETURN)) {
state = DRAWSWORDS;
}
if(input->isKeyDown(OIS::KC_SPACE)) {
state = SLICE;
}
if(input->isKeyDown(OIS::KC_PGUP)) {
//mRigidBody->setLinearVelocity(btVector3(0, 50, 0));
}
animate(elapsedTime, state);
}
示例3: _buildRoom
//-----------------------------------------------------------------------------
void SSAOApp::_buildRoom()
{
Ogre::Plane plane(Ogre::Vector3::UNIT_Y, 0.0f);
Ogre::MeshPtr planeMesh =
Ogre::MeshManager::getSingleton().createPlane("Plane.mesh"
,Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME
,plane
, 1000, 1000
, 1, 1, true
, 1, 5, 5
, Ogre::Vector3::UNIT_Z );
Ogre::SceneNode *wallNode;
wallNode = _makeWall("Plane.mesh", "ground");
wallNode = _makeWall("Plane.mesh", "left wall");
wallNode->translate(-500, 500, 0);
wallNode->roll(Ogre::Radian(-Ogre::Math::PI / 2));
wallNode = _makeWall("Plane.mesh", "back wall");
wallNode->translate(0, 500, -500);
wallNode->pitch(Ogre::Radian(Ogre::Math::PI / 2));
wallNode = _makeWall("Plane.mesh", "right wall");
wallNode->translate(500, 500, 0);
wallNode->roll(Ogre::Radian(Ogre::Math::PI / 2));
}
示例4:
Banderin::Banderin( Ogre::String nombre , Ogre::SceneManager* sm , float _x , float _y , float _z){
x = _x;
y = _y;
z = _z;
_sceneManager = sm;
nodoBanderin = _sceneManager->createSceneNode("Banderin"+nombre);
Ogre::SceneNode* nodoSuperiorIzq = _sceneManager->createSceneNode(nombre+"superiorIzq");
Ogre::SceneNode* nodoBandera = _sceneManager->createSceneNode(nombre+"bandera");
Ogre::SceneNode* nodoSuperiorDer = _sceneManager->createSceneNode(nombre+"superiorDer");
Ogre::SceneNode* nodoBaseDer = _sceneManager->createSceneNode(nombre+"baseDer");
Ogre::Entity* entBanderin = _sceneManager->createEntity("usb_cilindro.mesh");
Ogre::Entity* entSuperiorIzq = _sceneManager->createEntity("poly10.mesh");
Ogre::Entity* entBandera = _sceneManager->createEntity("usb_planocurvo.mesh");
Ogre::Entity* entSuperiorDer = _sceneManager->createEntity("poly10.mesh");
Ogre::Entity* entBaseDer = _sceneManager->createEntity("usb_cilindro.mesh");
entBanderin->setMaterialName("banderin");
entSuperiorIzq->setMaterialName("superior");
entBandera->setMaterialName("bandera");
entSuperiorDer->setMaterialName("superior");
entBaseDer->setMaterialName("banderin");
nodoSuperiorIzq->attachObject(entSuperiorIzq);
nodoSuperiorIzq->setScale(0.03,0.008,0.06);
nodoSuperiorIzq->translate(2.2,7.2,0.0);
nodoSuperiorIzq->rotate(Ogre::Vector3(0.0,0.0,1.0),Ogre::Radian(Ogre::Degree(180.0)));
nodoBandera->attachObject(entBandera);
nodoBandera->setScale(1.2,3.85,1.0);
nodoBandera->translate(-2.2,7.2,0.0);
nodoBandera->rotate(Ogre::Vector3(0.0,0.0,1.0),Ogre::Radian(Ogre::Degree(90.0)));
nodoSuperiorDer->attachObject(entSuperiorDer);
nodoSuperiorDer->setScale(0.03,0.008,0.06);
nodoSuperiorDer->translate(-152.2,7.2,0.0);
nodoBaseDer->attachObject(entBaseDer);
nodoBaseDer->translate(-150.0,0.0,0.0);
nodoBanderin->attachObject(entBanderin);
nodoBanderin->addChild(nodoSuperiorIzq);
nodoBanderin->addChild(nodoBandera);
nodoBanderin->addChild(nodoSuperiorDer);
nodoBanderin->addChild(nodoBaseDer);
nodoBanderin->setPosition(x,y,z);
nodoBanderin->setScale(60.0,600.0,60.0);
}
示例5: _updateLocatorPos
void VLogicModel::_updateLocatorPos()
{
for (VLocatorMap::iterator itr = mLocators.begin(); itr != mLocators.end(); ++itr)
{
VLocatorValue &tempValue = itr->second;
// 只更新创建出来的(已经使用的)locator node
if (tempValue.mLocatorNode != VNULL)
{
if (!tempValue.mBoneName.empty())
{
Ogre::Bone *bone = VNULL;
try
{
bone = mSkeleton->getBone(tempValue.mBoneName);
}
catch (const Ogre::Exception &e)
{
Ogre::LogManager::getSingleton().logMessage("LogicModel::_updateLocatorPos " + mName + e.getDescription());
continue;
}
assert(bone != VNULL);
Ogre::SceneNode *locatorNode = tempValue.mLocatorNode;
assert(locatorNode != VNULL);
locatorNode->setPosition(bone->_getDerivedPosition());
locatorNode->setOrientation(bone->_getDerivedOrientation());
if (tempValue.mTranslateFirst)
{
// 先平移,再旋转
locatorNode->translate(tempValue.mPosition, Ogre::Node::TS_LOCAL);
locatorNode->rotate(tempValue.mOrientation, Ogre::Node::TS_LOCAL);
}
else
{
// 先旋转,再平移
locatorNode->rotate(tempValue.mOrientation, Ogre::Node::TS_LOCAL);
locatorNode->translate(tempValue.mPosition, Ogre::Node::TS_LOCAL);
}
}
}
}
if (mLocators.size() != 0)
{
mModelMainNode->_update(true, false);
}
}
示例6: debugDrawClassification
void NavigationCell::debugDrawClassification( Ogre::Vector3 start, Ogre::Vector3 end )
{
Ogre::Root *root = Ogre::Root::getSingletonPtr();
Ogre::SceneManager* mgr = root->getSceneManager( "SceneManagerInstance" );
Ogre::ManualObject* debug;
Ogre::SceneNode* node;
if( mgr->hasManualObject( "debugDrawClassification" ) )
debug = mgr->getManualObject( "debugDrawClassification" );
else
{
debug = mgr->createManualObject( "debugDrawClassification" );
node = mgr->getRootSceneNode()->createChildSceneNode();
node->attachObject( debug );
node->translate( 0, 1, 0 );
debug->setQueryFlags( 0 );
debug->setRenderQueueGroup( Ogre::RENDER_QUEUE_OVERLAY );
}
debug->begin( "debug/blue", Ogre::RenderOperation::OT_LINE_LIST );
debug->position( start );
debug->position( end );
debug->end();
// debugDrawCell( debug, "debug/yellow", "debug/blue" );
}
示例7: getBase
Ogre::SceneNode * WheelAnimalSceneObj::getBaseCenter()
{
if(_sn == NULL)
{
_sn = Orz::OgreGraphicsManager::getSingleton().getSceneManager()->getRootSceneNode()->createChildSceneNode(getCenterPoint());
//_sn->yaw(Ogre::Radian(Ogre::Math::PI));
for(int i=0 ; i<(BASE_ALL-BASE_0); ++i)
{
Ogre::SceneNode * base = getBase(i);
Ogre::Node * parent = base->getParent();
Ogre::Vector3 p = base->getPosition();
if(parent)
{
parent->removeChild(base);
}
base->translate(-getCenterPoint());
_sn->addChild(base);
Ogre::SceneManager * sm = OgreGraphicsManager::getSingleton().getSceneManager();
Ogre::Entity * ent = sm->createEntity("ring"+Ogre::StringConverter::toString(i), "zp_dwdzgh.mesh");
Ogre::SceneNode * node = base->createChildSceneNode("ring"+Ogre::StringConverter::toString(i),Ogre::Vector3(0.f, 10.f, 0.f));
node->setScale(0.6f,0.6f,0.6f);
node->attachObject(ent);
Orz::OgreGraphicsManager::getSingleton().getSceneManager()->getSceneNode("ring"+Ogre::StringConverter::toString(i))->setVisible(false);
}
}
return _sn;
}
示例8: CreateTerrain
// Create the scene node for the terrain. We don't need to make the mesh as the later calls
// will do that.
Ogre::SceneNode* Region::CreateTerrain(Ogre::SceneNode* regionNode,
const float width, const float length, Ogre::String terrainName) {
LG::Log("Region::CreateTerrain: r=%s, w=%f, l=%f, n=%s", this->Name.c_str(), width, length, terrainName.c_str());
Ogre::SceneNode* terrainNode = regionNode->createChildSceneNode("TerrainSceneNode/" + terrainName);
terrainNode->setInheritOrientation(true);
terrainNode->setInheritScale(false);
terrainNode->translate(0.0, 0.0, 0.0);
return terrainNode;
}
示例9:
Ogre::SceneNode *VLogicModel::_createLocatorSceneNode(const Ogre::Vector3 &pos, const Ogre::Quaternion &ori)
{
static VUINT32 count = 0;
Ogre::StringUtil::StrStreamType str;
str<<"Locator_"<<std::setw(5)<<std::setfill('0')<<count++<<std::ends;
Ogre::SceneNode *locatorNode = mModelMainNode->createChildSceneNode(str.str());
locatorNode->translate(pos);
locatorNode->setOrientation(ori);
return locatorNode;
}
示例10:
/*
"15000,700000,x,y,0", "false,false,barren,2500,1",
"false,co2,barren,6000,2", "h2o,n2/o2,gaia,6300,3", "false,co2,barren,3400,4",
"false,h2/he,gasgiant,71000,5", "false,h2/he,gasgiant,60000,6", "false,h2/he,gasgiant,25000,7",
"false,h2/he,gasgiant,25000,8", "false,n-ice,ice,1100,9"
*/
StarSystem::StarSystem(Ogre::SceneManager *sceneMgr, std::string *bodyDefinition) {
Ogre::SceneNode *systemNode = sceneMgr->getRootSceneNode()->createChildSceneNode(Ogre::Vector3(0,0,0));
createOrbits(systemNode, sceneMgr, bodyDefinition);
float PositionOffset = 0.0;
float distance = -1000.0;
systemNode->translate(0, PositionOffset, distance);
}
示例11: createScene
//--------------------------------------------------------------------------------------
void LapTrainer::createScene(void)
{
//Create right stick
Ogre::Entity* StickRight = mSceneMgr->createEntity("StickRight", "instrument_stick.mesh");
StickRight -> setCastShadows(true);
Ogre::SceneNode* RightNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("RightNode", Ogre::Vector3(0,0,0),Ogre::Quaternion(1,0,0,0));
//RightNode->setPosition(Ogre::Vector3(300, 100, 100));
RightNode->setPosition(Ogre::Vector3(300, 500, 500));//alex
RightNode->setOrientation(0.383022, -0.383022, 0.821394, -0.178606);//alex
RightNode->scale( 1, 1, 1);
Ogre::SceneNode* child = RightNode->createChildSceneNode("MoveNodeRight");
child->attachObject(StickRight);
child->translate(0,0,0);
//Create left stick
Ogre::Entity* entPenguin2 = mSceneMgr->createEntity("StickLeft", "instrument_stick.mesh");
entPenguin2 -> setCastShadows(true);
Ogre::SceneNode* nodPenguin2 = mSceneMgr->getRootSceneNode()->createChildSceneNode("LeftNode", Ogre::Vector3(0,0,0),Ogre::Quaternion(1,0,0,0));
//nodPenguin2->setPosition(Ogre::Vector3(-300, 100, 100));
nodPenguin2->setPosition(Ogre::Vector3(-300, 500, 500));//alex
//nodPenguin2->setOrientation(0.821394, -0.178606, 0.383022, -0.383022);//alex //this stick is not working
nodPenguin2->setOrientation(0.821394, -0.178606, 0.383022, -0.383022);//alex //this stick is not working
nodPenguin2->scale( 1, 1, 1);
Ogre::SceneNode* child2 = nodPenguin2->createChildSceneNode("MoveNodeLeft");
child2->attachObject(entPenguin2);
child2->translate(0,0,0);
Ogre::Entity* Element1 = mSceneMgr->createEntity("Element1", "exercise1.mesh");//Place your mesh here
Element1 -> setCastShadows(true);
Ogre::SceneNode* Element1Node = mSceneMgr->getRootSceneNode()->createChildSceneNode("Element1Node", Ogre::Vector3(0, -200, 200));//X-Y-Z
Element1Node->scale( 400, 400, 400);
Element1Node->attachObject(Element1);
Ogre::Entity* Element2 = mSceneMgr->createEntity("Element2", "Sphere002.mesh");//Place your mesh here
Element2 -> setCastShadows(true);
//Ogre::SceneNode* Element2Node = mSceneMgr->getRootSceneNode()->createChildSceneNode("Element2Node", Ogre::Vector3(0, 50, 100));//X-Y-Z
Ogre::SceneNode* Element2Node = mSceneMgr->getRootSceneNode()->createChildSceneNode("Element2Node", Ogre::Vector3(0,0,0),Ogre::Quaternion(1,0,0,0));
Element2Node->setPosition(Ogre::Vector3(300, 500, 500));
Element2Node->setOrientation(0.383022, -0.383022, 0.821394, -0.178606);
Element2Node->scale( 60, 60, 60);
Element2Node->attachObject(Element2);
Ogre::Entity* Element3 = mSceneMgr->createEntity("Element3", "Sphere002.mesh");//Place your mesh here
Element3 -> setCastShadows(true);
//Ogre::SceneNode* Element2Node = mSceneMgr->getRootSceneNode()->createChildSceneNode("Element2Node", Ogre::Vector3(0, 50, 100));//X-Y-Z
Ogre::SceneNode* Element3Node = mSceneMgr->getRootSceneNode()->createChildSceneNode("Element3Node", Ogre::Vector3(0,0,0),Ogre::Quaternion(1,0,0,0));
Element3Node->setPosition(Ogre::Vector3(-300, 500, 500));
Element3Node->setOrientation(0.821394, -0.178606, 0.383022, -0.383022);
Element3Node->scale( 60, 60, 60);
Element3Node->attachObject(Element3);
}
示例12: createExitPoint
void CharacterManager::createExitPoint( Ogre::Vector3 position )
{
Ogre::SceneNode* mNode = mSceneMgr->getRootSceneNode()->createChildSceneNode( "ExitPoint" + Ogre::StringConverter::toString( ++mExitPointCount ) );
Ogre::Entity* mEntity = mSceneMgr->createEntity( "ExitPoint" + Ogre::StringConverter::toString( ++mExitPointCount ), "Cylinder.mesh" );
mEntity->setMaterialName( "Cylinder/Yellow" );
mNode->attachObject( mEntity );
mNode->setPosition( position );
mNode->translate( 0, -position.y, 0 );
mNode->setScale( 50, 15, 50 );
mExitPointList.push_back( mNode );
}
示例13: update
void HelloOgre::update(float){
static int move_dir = -1;
static float move_step = 2.0f;
static int move_count = 0;
static float move_offset = 0.0f;
if( move_count % 150 == 0 ){
move_dir *= -1;
}
move_offset = move_step * move_dir;
move_count++;
if( ogre_head_node ){
ogre_head_node->translate( Ogre::Vector3(move_offset, 0.0f, 0.0f));
ogre_head_node->rotate( Ogre::Vector3( 0.0f, 1.0f, 0.0f ), Ogre::Radian(0.1f) );
}
if( ogre_head_node2 ){
ogre_head_node2->translate( Ogre::Vector3(-move_offset, 0.0f, 0.0f));
ogre_head_node2->rotate( Ogre::Vector3( 0.0f, 1.0f, 0.0f ), Ogre::Radian(0.1f) );
}
size_t nsize = vec_ogre_head_node.size();
Ogre::SceneNode* pnode = NULL;
size_t half_size = nsize >> 1;
for( size_t i=0; i<half_size; ++i ){
pnode = vec_ogre_head_node[i];
pnode->translate( Ogre::Vector3((move_offset*i*0.1f), 0.0f, 0.0f));
pnode->rotate( Ogre::Vector3( 0.0f, 1.0f, 0.0f ), Ogre::Radian(0.1f) );
}
for( size_t i=0; i<half_size; ++i ){
pnode = vec_ogre_head_node[half_size+i];
pnode->translate( Ogre::Vector3(-(move_offset*i*0.1f), 0.0f, 0.0f));
pnode->rotate( Ogre::Vector3( 0.0f, 1.0f, 0.0f ), Ogre::Radian(0.1f) );
}
}
示例14: repositionSceneNode
void ModelRenderer::repositionSceneNode()
{
if (mModel) {
Ogre::SceneNode* node = mTexture->getRenderContext()->getSceneNode();
if (node) {
node->setOrientation(mDefaultRotation);
node->rotate(mModel->getDefinition()->getRotation());
//translate the scale node according to the translate defined in the model
node->setPosition(mDefaultTranslation);
node->translate(mModel->getDefinition()->getTranslate());
}
}
}
示例15: debugDrawCellAndNeigbours
void NavigationCell::debugDrawCellAndNeigbours()
{
Ogre::Root *root = Ogre::Root::getSingletonPtr();
Ogre::SceneManager* mgr = root->getSceneManager( "SceneManagerInstance" );
Ogre::ManualObject* debug;
Ogre::SceneNode* debugNode;
if( mgr->hasSceneNode( "debugDrawNode" ) )
{
debugNode = mgr->getSceneNode( "debugDrawNode" );
}
else
{
debugNode = mgr->getRootSceneNode()->createChildSceneNode( "debugDrawNode" );
debugNode->translate( 0, 1, 0 ); // Move up slightly to see lines better.
}
if( mgr->hasManualObject( "debugDraw" ) )
debug = mgr->getManualObject( "debugDraw" );
else
{
debug = mgr->createManualObject( "debugDraw" );
debugNode->attachObject( debug );
debug->setQueryFlags( 0 );
debug->setRenderQueueGroup( Ogre::RENDER_QUEUE_OVERLAY );
}
for( int i = 0; i < 3; i++ )
{
if( mLinks[i] )
{
debug->begin( "debug/blue", Ogre::RenderOperation::OT_LINE_STRIP );
debug->position( mLinks[i]->mVertices[0] );
debug->position( mLinks[i]->mVertices[1] );
debug->position( mLinks[i]->mVertices[2] );
debug->position( mLinks[i]->mVertices[0] );
debug->end();
}
}
debug->begin( "debug/yellow", Ogre::RenderOperation::OT_LINE_STRIP );
debug->position( mVertices[0].x, mVertices[0].y+1, mVertices[0].z );
debug->position( mVertices[1].x, mVertices[1].y+1, mVertices[1].z );
debug->position( mVertices[2].x, mVertices[2].y+1, mVertices[2].z );
debug->position( mVertices[0].x, mVertices[0].y+1, mVertices[0].z );
debug->end();
}