本文整理汇总了C++中ogre::MovableObject::getParentSceneNode方法的典型用法代码示例。如果您正苦于以下问题:C++ MovableObject::getParentSceneNode方法的具体用法?C++ MovableObject::getParentSceneNode怎么用?C++ MovableObject::getParentSceneNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::MovableObject
的用法示例。
在下文中一共展示了MovableObject::getParentSceneNode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: collisionAABB
Object* ObjectManager::collisionAABB(const Ogre::Vector3& fromPoint, const Ogre::Vector3& toPoint, int queryMask)
{
Ogre::Vector3 direction = toPoint - fromPoint;
Ogre::Ray ray(fromPoint, direction);
mRayQuery->setRay(ray);
mRayQuery->setQueryMask(queryMask);
// The rays are sorted by the distance query set, [very important]
mRayQuery->setSortByDistance(true);
Ogre::RaySceneQueryResult& result = mRayQuery->execute();
Ogre::RaySceneQueryResult::iterator itr = result.begin();
// Just get the nearest object
if (itr != result.end() && itr->movable)
{
Ogre::MovableObject *object = itr->movable;
Ogre::Vector3 pos = object->getParentSceneNode()->getPosition();
// If the current starting point of an object in the distance is less than a predetermined range
// then return this obj
// Avoid using the square root operation squaredLength
if ((pos - fromPoint).squaredLength() <= direction.squaredLength())
return getObject(itr->movable->getName());
}
return NULL;
}
示例2: DumpNodes
/*dumper*/ /*TODO: humanize*/
void DumpNodes(std::stringstream &ss, Ogre::Node *n, int level)
{
for(int i = 0; i < level; i++)
{
ss << " ";
}
ss << "SceneNode: " << n->getName() << " (parent: " << n->getParent()->getName() << ")" << std::endl;
Ogre::SceneNode::ObjectIterator object_it = ((Ogre::SceneNode *)n)->getAttachedObjectIterator();
Ogre::Node::ChildNodeIterator node_it = n->getChildIterator();
Ogre::MovableObject *m;
while(object_it.hasMoreElements())
{
for(int i = 0; i < level + 2; i++)
{
ss << " ";
}
m = object_it.getNext();
ss << "parent(" << m->getParentSceneNode()->getName() << ") type " << m->getMovableType() << ": " << m->getName() << std::endl;
}
while(node_it.hasMoreElements())
{
DumpNodes(ss, node_it.getNext(), level + 2);
}
}
示例3:
void
BoxCenterManager::init()
{
mBoxCenterObjMap.clear();
ObjBoxCenterMap::iterator iter;
for(iter = mObjBoxCenterMap.begin();iter != mObjBoxCenterMap.end();iter++)
{
Ogre::MovableObject* mv = iter->second;
if (mv->getParentSceneNode())
{
mv->getParentSceneNode()->destroy();
}
delete iter->second;
}
mObjBoxCenterMap.clear();
}
示例4: preRenderTargetUpdate
void ReflectionTextureListener::preRenderTargetUpdate(const RenderTargetEvent& evt)
{
// Hide plane and objects below the water
mWater->setVisible(false);
/*list<Ogre::Entity*> entList = Level::getSingleton()->getEntityList();
list<Ogre::Entity*>::iterator it;
for (it = entList.begin();it != entList.end();it++){
if ((*it)->isVisible()){
Ogre::AxisAlignedBox box = (*it)->getWorldBoundingBox();
if (box.getMinimum().y < mWater->getSceneNode()->_getDerivedPosition().y){
(*it)->setVisible(false);
belowWaterEnts.push_back((*it));
}
}
}*/
/*std::vector<Entity*>::iterator i, iend;
iend = belowWaterEnts.end();
for (i = belowWaterEnts.begin(); i != iend; ++i)
{
(*i)->setVisible(false);
}*/
Ogre::SceneManager::MovableObjectIterator it = Level::getSingleton()->getSceneManager()->getMovableObjectIterator("Entity");
while(it.hasMoreElements()){
Ogre::MovableObject *m = it.getNext();
if (m->isVisible() && m->getParentSceneNode()->_getDerivedPosition().y < mWater->getSceneNode()->_getDerivedPosition().y){
m->setVisible(false);
belowWaterEnts.push_back(m);
}
}
Ogre::Camera* cam = Level::getSingleton()->getCurrentSegment()->getActiveCamera()->getCamera();
cam->enableReflection(mWater->getReflectionPlane());
}
示例5: diagnose
void OgreInfo::diagnose(std::ostream& outputStream)
{
Ogre::SceneManagerEnumerator::SceneManagerIterator sceneManagerI = Ogre::Root::getSingleton().getSceneManagerIterator();
while (sceneManagerI.hasMoreElements()) {
Ogre::SceneManager* sceneManager = sceneManagerI.getNext();
outputStream << "Scenemanager(" << sceneManager->getTypeName() << ") " << sceneManager->getName() << std::endl;
outputStream << " Number of scene nodes: " << countNodes(sceneManager->getRootSceneNode()) << std::endl;
outputStream << " Movable objects:" << std::endl;
unsigned int movableObjectCounter = 0;
Ogre::Root::MovableObjectFactoryIterator movableObjectFactoryI = Ogre::Root::getSingleton().getMovableObjectFactoryIterator();
while (movableObjectFactoryI.hasMoreElements()) {
Ogre::MovableObjectFactory* factory = movableObjectFactoryI.getNext();
std::string type(factory->getType());
{
Ogre::SceneManager::MovableObjectIterator I = sceneManager->getMovableObjectIterator(type);
while (I.hasMoreElements()) {
movableObjectCounter++;
Ogre::MovableObject* movable = I.getNext();
if (movable->getMovableType() == "Light") {
Ogre::Light* light = static_cast<Ogre::Light*> (movable);
outputStream << " * Light " << light->getName() << "(" << (light->isInScene() ? "in scene" : "not in scene") << ")" << std::endl;
outputStream << " Pos: " << light->getDerivedPosition() << std::endl;
outputStream << " Direction: " << light->getDerivedDirection() << std::endl;
} else {
std::stringstream ssPosAndOrientation;
if (movable->getParentSceneNode() && movable->isInScene()) {
ssPosAndOrientation << " pos: " << movable->getParentSceneNode()->getPosition() << " orientation: " << movable->getParentSceneNode()->getOrientation();
}
outputStream << " * " << type << " " << movable->getName() << "(" << (movable->isInScene() ? "in scene" : "not in scene") << ")" << ssPosAndOrientation.str() << std::endl;
// outputStream << " Pos: " << light->getDerivedPosition() << std::endl;
// outputStream << " Direction: " << light->getDerivedDirection() << std::endl;
}
}
}
}
outputStream << " Number of movable objects: " << movableObjectCounter << std::endl;
outputStream << " Cameras:" << std::endl;
{
Ogre::SceneManager::CameraIterator I = sceneManager->getCameraIterator();
while (I.hasMoreElements()) {
Ogre::Camera* camera = I.getNext();
outputStream << " Camera " << camera->getName() << "(" << (camera->isInScene() ? "in scene" : "not in scene") << ")" << std::endl;
outputStream << " Pos: " << camera->getDerivedPosition() << std::endl;
outputStream << " Direction: " << camera->getDerivedDirection() << std::endl;
outputStream << " Clip distances: " << camera->getNearClipDistance() << " - " << camera->getFarClipDistance() << std::endl;
}
}
}
size_t resourceMemoryUsage = 0;
outputStream << "Resource Managers:" << std::endl;
Ogre::ResourceGroupManager::ResourceManagerIterator I = Ogre::ResourceGroupManager::getSingleton().getResourceManagerIterator();
while (I.hasMoreElements()) {
std::string name = I.peekNextKey();
Ogre::ResourceManager* manager = I.getNext();
outputStream << " Resource Manager: " << name << std::endl;
if (manager->getMemoryBudget() == std::numeric_limits<size_t>::max()) {
outputStream << " Memory budget: not set" << std::endl;
} else {
outputStream << " Memory budget: " << manager->getMemoryBudget() << " bytes" << std::endl;
}
outputStream << " Memory usage: " << manager->getMemoryUsage() << " bytes" << std::endl;
resourceMemoryUsage += manager->getMemoryUsage();
Ogre::ResourceManager::ResourceMapIterator resourceI = manager->getResourceIterator();
if (resourceI.hasMoreElements()) {
outputStream << " Resources: " << std::endl;
int resourceCount = 0;
int loadedResourceCount = 0;
while (resourceI.hasMoreElements()) {
Ogre::ResourcePtr resource = resourceI.getNext();
if (resource->isLoaded()) {
std::string reloadable = resource->isReloadable() ? " reloadable" : "";
outputStream << " " << resource->getName() << " ( " << resource->getSize() << " bytes)" << reloadable;
Ogre::Texture* texture = dynamic_cast<Ogre::Texture*>(resource.get());
if (texture) {
outputStream << texture->getWidth() << "x" << texture->getHeight() << " ";
}
outputStream << std::endl;
loadedResourceCount++;
}
resourceCount++;
}
outputStream << " Total number of resources: " << resourceCount << std::endl;
outputStream << " Number of loaded resources: " << loadedResourceCount << std::endl;
}
}
outputStream << "Total memory usage for all resource manager: " << resourceMemoryUsage << " bytes" << std::endl;
outputStream << std::flush;
}