本文整理汇总了C++中ogre::SceneNode::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ SceneNode::getName方法的具体用法?C++ SceneNode::getName怎么用?C++ SceneNode::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::SceneNode
的用法示例。
在下文中一共展示了SceneNode::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addObject
void PhysicsSystem::addObject (const Ptr& ptr)
{
std::string mesh = MWWorld::Class::get(ptr).getModel(ptr);
Ogre::SceneNode* node = ptr.getRefData().getBaseNode();
handleToMesh[node->getName()] = mesh;
OEngine::Physic::RigidBody* body = mEngine->createAndAdjustRigidBody(mesh, node->getName(), node->getScale().x, node->getPosition(), node->getOrientation());
mEngine->addRigidBody(body);
}
示例2: createInstance
Monster* MonsterFactory::createInstance(SceneManager* sceneMgr, Maze* maze, MonsterManager* monsterMgr)
{
Ogre::SceneNode* monsterNode = sceneMgr->getRootSceneNode()->createChildSceneNode();
Ogre::Entity* entity = sceneMgr->createEntity(mParams["mesh"]);
//entity->setCastShadows(true);
monsterNode->attachObject(entity);
Monster* mon;
mon = new Monster(monsterNode, entity, maze, monsterMgr);
if (mParams.find("radius") != mParams.end())
mon->setRadius((float)atof(mParams["radius"].c_str()));
if (mParams.find("blood") != mParams.end())
{
mon->setBlood((float)atof(mParams["blood"].c_str()));
mon->setMaxBlood(mon->getBlood());
}
if (mParams.find("speed") != mParams.end())
mon->setSpeed((float)atof(mParams["speed"].c_str()));
if (mParams.find("spell") != mParams.end())
mon->setType((mParams["spell"].c_str()));
if (mParams.find("scale") != mParams.end())
{
float scale = (float)atof(mParams["scale"].c_str());
mon->setScale(scale, scale, scale);
}
//mon->setScale(2, 2, 2);
// 创建怪物头顶血条
BillboardSet* healthHUD = sceneMgr->createBillboardSet();
healthHUD->setMaterialName("Glass/Billboard");
healthHUD->setDefaultWidth(100);
healthHUD->setDefaultHeight(14);
SceneNode* hudNode = monsterNode->createChildSceneNode();
hudNode->attachObject(healthHUD);
/*Billboard* b2 = healthHUD->createBillboard(0, entity->getBoundingBox().getSize().y, 0);
b2->setColour(ColourValue::Black);*/
Billboard* b = healthHUD->createBillboard(0, entity->getBoundingBox().getSize().y, 0);
//b->setColour(ColourValue(0, 0.75f, 0));
//b->setDimensions(96, 12);
mon->setHealthHUD(healthHUD);
// 测试粒子by kid
Ogre::ParticleSystem* ps = sceneMgr->createParticleSystem(monsterNode->getName() + "frozen", "Glass/MonsterFrozen");
monsterNode->attachObject(ps);
ps->setVisible(false);
ps = sceneMgr->createParticleSystem(monsterNode->getName() + "burn", "Glass/MonsterBurn");
monsterNode->attachObject(ps);
ps->setVisible(false);
return mon;
}
示例3: addActor
void PhysicsSystem::addActor (const Ptr& ptr)
{
std::string mesh = MWWorld::Class::get(ptr).getModel(ptr);
Ogre::SceneNode* node = ptr.getRefData().getBaseNode();
//TODO:optimize this. Searching the std::map isn't very efficient i think.
mEngine->addCharacter(node->getName(), mesh, node->getPosition(), node->getScale().x, node->getOrientation());
}
示例4: _createBillboardSet
//---------------------------------------------------------------------
bool BillboardSetElement::_createBillboardSet(void)
{
Ogre::SceneNode* parent = mBasicNode;
if (parent)
{
mBillboardSet = mSystem->getSceneManager()->createBillboardSet( parent->getName() );
mBillboardSet->setMaterialName(mBillboardMaterial);
if ( (mStacks > 1) || (mSlices > 1) )
mBillboardSet->setTextureStacksAndSlices(mStacks, mSlices);
mBillboardSet->setCastShadows(false);
mBillboardSet->setVisible(mVisible);
parent->attachObject(mBillboardSet);
for ( int i=0; i<mBillboardCount; ++i )
{
Ogre::Billboard *billboard = mBillboardSet->createBillboard(0, i*mBillboardInterval, 0, mBillboardColour * mAlphaValue);
assert (billboard);
billboard->setDimensions(mBillboardWidth, mBillboardHeight);
}
_resetBillboardStartTexIndex();
_resetBillboardStartScaleTime();
return true;
}
return false;
}
示例5: _DestroyFakeNode
void CFakeObjectEntityManager::_DestroyFakeNode(FakeObject& obj)
{
//销毁摄像机
CEngineInterface::GetMe()->GetFairySystem()->getSceneManager()->destroyCamera(obj.pCamera);
//销毁ViewPort
if(!obj.ptrRenderTexture.isNull() && obj.ptrRenderTexture->getBuffer()->getRenderTarget())
{
obj.ptrRenderTexture->getBuffer()->getRenderTarget()->removeAllViewports();
}
//销毁RenderTexture
obj.ptrRenderTexture.setNull();
Ogre::TextureManager::getSingleton().remove(
Ogre::String(obj.strName) + "_RenderTexture");
//销毁Rectangle2D
if (obj.pRectange)
{
Ogre::SceneNode* parentNode = obj.pRectange->getParentSceneNode();
if (parentNode)
{
parentNode->detachObject(obj.pRectange);
// 摧毁Rectangle2D所挂接的scene node
if (parentNode->getParentSceneNode())
parentNode->getParentSceneNode()->removeAndDestroyChild(parentNode->getName());
}
delete obj.pRectange;
obj.pRectange = NULL;
}
}
示例6: unloadCell
void Scene::unloadCell (CellStoreCollection::iterator iter)
{
std::cout << "Unloading cell\n";
ListHandles functor;
(*iter)->forEach<ListHandles>(functor);
{
// silence annoying g++ warning
for (std::vector<Ogre::SceneNode*>::const_iterator iter2 (functor.mHandles.begin());
iter2!=functor.mHandles.end(); ++iter2){
Ogre::SceneNode* node = *iter2;
mPhysics->removeObject (node->getName());
}
if ((*iter)->mCell->isExterior())
{
ESM::Land* land =
MWBase::Environment::get().getWorld()->getStore().get<ESM::Land>().search(
(*iter)->mCell->getGridX(),
(*iter)->mCell->getGridY()
);
if (land)
mPhysics->removeHeightField( (*iter)->mCell->getGridX(), (*iter)->mCell->getGridY() );
}
}
mRendering.removeCell(*iter);
//mPhysics->removeObject("Unnamed_43");
MWBase::Environment::get().getWorld()->getLocalScripts().clearCell (*iter);
MWBase::Environment::get().getMechanicsManager()->drop (*iter);
MWBase::Environment::get().getSoundManager()->stopSound (*iter);
mActiveCells.erase(*iter);
}
示例7: attachActor
void Actor::attachActor(Actor* obj)
{
Ogre::SceneNode* target = obj->getNode();
gameLog("Actor::attachActor " + target->getName() + " to " + mNode->getName());
target->getParent()->removeChild(target);
mNode->addChild(target);
}
示例8: unloadCell
void Scene::unloadCell (CellStoreCollection::iterator iter)
{
std::cout << "Unloading cell\n";
ListHandles functor;
(*iter)->forEach<ListHandles>(functor);
{
// silence annoying g++ warning
for (std::vector<Ogre::SceneNode*>::const_iterator iter (functor.mHandles.begin());
iter!=functor.mHandles.end(); ++iter){
Ogre::SceneNode* node = *iter;
mPhysics->removeObject (node->getName());
}
}
mRendering.removeCell(*iter);
//mPhysics->removeObject("Unnamed_43");
mWorld->getLocalScripts().clearCell (*iter);
mEnvironment.mMechanicsManager->dropActors (*iter);
mEnvironment.mSoundManager->stopSound (*iter);
mActiveCells.erase(*iter);
}
示例9: update
void Replicator::update(float value)
{
//logFile << getFrequentcyRange() << " :\t " << value << "\n";
Ogre::Vector3 currentScale = getScale();
this->setThreshold(0.7*this->getThreshold() + 0.4*value);
float result = value / this->getThreshold();
int numOfChildrenToGenerate = result > 1.0 ? (result - value) * 2 : 0;
//logFile << value / this->getThreashold() << "\t" << (result - value) * 10 << "\t" << numOfChildrenToGenerate << "\n";
for ( int i = 0; i < numOfChildrenToGenerate; i++ ) {
createChildren(numOfChildrenToGenerate);
}
for(std::vector<Ogre::Entity*>::size_type i = 0; i < children.size(); ) {
Ogre::SceneNode* childNode = children[i]->getParentSceneNode();
Ogre::Real res = childNode->getScale().length();
if ( res < 0.1 ) {
children[i]->setVisible(false);
childNode->setVisible(false);
childNode->detachObject(children[i]->getName());
_sceneManager->destroyEntity(children[i]->getName());
// entity is now destroyed, don't try to use the pointer anymore!
// optionally destroy node
_sceneManager->destroySceneNode(childNode->getName());
children.erase( children.begin() + i );
} else {
Ogre::Vector3 currScale = childNode->getScale();
childNode->setScale(Ogre::Vector3(currScale.x - currScale.x/3, currScale.y - currScale.y/3, currScale.z - currScale.z/3));
i++;
}
}
}
示例10: mAdd
// add a control point
Ogre::String CTrack::mAdd( ControlPoint tCP )
{
Ogre::Entity *ent;
char name[16];
sprintf(name, "ControlPoint%d", mCount++);
ent = mSm->createEntity(name, "point.mesh");
ent->setQueryFlags(ObjectControl::CONTROL_POINT);
Ogre::SceneNode *mCurrentObject = mSm->getRootSceneNode()->createChildSceneNode(std::string(name) + "Node", tCP.pos);
mCurrentObject->attachObject(ent);
mCurrentObject->setScale(0.05f, 0.05f, 0.05f);
tCP.name = mCurrentObject->getName();
CPs.push_back(tCP);
return mCurrentObject->getName();
}
示例11: insertObjectPhysics
void PhysicsSystem::insertObjectPhysics(const MWWorld::Ptr& ptr, const std::string model){
Ogre::SceneNode* node = ptr.getRefData().getBaseNode();
// unused
//Ogre::Vector3 objPos = node->getPosition();
addObject (node->getName(), model, node->getOrientation(),
node->getScale().x, node->getPosition());
}
示例12: scaleObject
void PhysicsSystem::scaleObject (const Ptr& ptr)
{
Ogre::SceneNode* node = ptr.getRefData().getBaseNode();
std::string handle = node->getName();
if(handleToMesh.find(handle) != handleToMesh.end())
{
removeObject(handle);
addObject(ptr);
}
if (OEngine::Physic::PhysicActor* act = mEngine->getCharacter(handle))
act->setScale(node->getScale().x);
}
示例13: createActor
//-----------------------------------------------------------------------
void ActorObject::createActor(void)
{
assert(!mActor);
assert(mProxy && !mActorName.empty());
Ogre::SceneNode* parent = getSceneNode();
assert(parent);
Ogre::SceneManager* creator = parent->getCreator();
assert(creator);
mActor = new Actor(mSystem, parent->getName(), mActorName, parent);
mActor->setUserObject(mProxy);
}
示例14: mousePressed
bool TutorialApplication::mousePressed(
const OIS::MouseEvent& me, OIS::MouseButtonID id)
{
Ogre::Vector2 mousePos =
Ogre::Vector2(static_cast<Ogre::Real>(me.state.X.abs),static_cast<Ogre::Real>(me.state.Y.abs));
Ogre::Ray mouseRay =
mCamera->getCameraToViewportRay(
mousePos.x / float(me.state.width),
mousePos.y / float(me.state.height));
mRayScnQuery = mSceneMgr->createRayQuery(Ogre::Ray());
mRayScnQuery->setRay(mouseRay);
mRayScnQuery->setSortByDistance(true);
Ogre::RaySceneQueryResult& result = mRayScnQuery->execute();
Ogre::RaySceneQueryResult::iterator it = result.begin();
Ogre::SceneNode* mCurObject;
mMovableFound = false;
for ( ; it != result.end(); it++)
{
mMovableFound =
it->movable &&
it->movable->getName() != "" &&
it->movable->getName() != "MainCam" &&
it->movable->getName() != "Ground" &&
it->movable->getName() != "ground";
if (mMovableFound)
{
//Ogre::Vector3 intersect = it->worldFragment->singleIntersection;
mCurObject = it->movable->getParentSceneNode();
Ogre::LogManager::getSingletonPtr()->logMessage("Moveable object found: "+mCurObject->getName());
//Ogre::LogManager::getSingletonPtr()->logMessage("Position: "+Ogre::StringConverter::toString(intersect));
break;
}
}
if(mMovableFound)
{
// We have selected an entity
std::cout << "Moveable object found" << std::endl;
Ogre::LogManager::getSingletonPtr()->logMessage("Moveable object found");
}
return true;
}
示例15: deepCopySceneNode
//!
//! Creates a deep copy of the given scene node.
//!
//! \param sceneNode The scene node to copy.
//! \param sceneNodeCopy The scene node to add the copied objects to (will be created if 0).
//! \param namePrefix The prefix to use for names of copied objects.
//! \param sceneManager The scene manager to use for creating the object.
//!
void OgreTools::deepCopySceneNode ( Ogre::SceneNode *sceneNode, Ogre::SceneNode *&sceneNodeCopy, const QString &namePrefix, Ogre::SceneManager *sceneManager /* = 0 */ )
{
// make sure the given scene node is valid
if (!sceneNode) {
Log::error("The given scene node is invalid.", "OgreTools::deepCopySceneNode");
return;
}
// make sure a valid scene manager is available
if (!sceneManager)
sceneManager = sceneNode->getCreator();
if (!sceneManager) {
Log::error("No valid scene manager available.", "OgreTools::deepCopySceneNode");
return;
}
// create the target scene node if it doesn't exist yet
if (!sceneNodeCopy) {
QString sceneNodeCopyName = QString("%1_%2Copy").arg(namePrefix).arg(sceneNode->getName().c_str());
sceneNodeCopy = copySceneNode(sceneNode, sceneNodeCopyName, sceneManager);
if (!sceneNodeCopy) {
Log::error("The scene node could not be copied.", "OgreTools::deepCopySceneNode");
return;
}
}
// iterate over the list of attached objects
Ogre::SceneNode::ObjectIterator objectIterator = sceneNode->getAttachedObjectIterator();
while (objectIterator.hasMoreElements()) {
Ogre::MovableObject *movableObject = objectIterator.getNext();
if (movableObject) {
QString entityCopyName = QString("%1_%2Copy").arg(namePrefix).arg(movableObject->getName().c_str());
Ogre::MovableObject *movableObjectCopy = cloneMovableObject(movableObject, entityCopyName, sceneManager);
if (movableObjectCopy)
sceneNodeCopy->attachObject(movableObjectCopy);
}
}
// iterate over the list of child nodes
Ogre::SceneNode::ChildNodeIterator childNodeIterator = sceneNode->getChildIterator();
while (childNodeIterator.hasMoreElements() ) {
Ogre::SceneNode *childSceneNode = (Ogre::SceneNode *) childNodeIterator.getNext();
QString childSceneNodeCopyName = QString("%1_%2Copy").arg(namePrefix).arg(childSceneNode->getName().c_str());
Ogre::SceneNode *childSceneNodeCopy = copySceneNode(childSceneNode, childSceneNodeCopyName, sceneManager);
if (childSceneNodeCopy) {
sceneNodeCopy->addChild(childSceneNodeCopy);
deepCopySceneNode(childSceneNode, childSceneNodeCopy, namePrefix, sceneManager);
}
}
}