void OgreSample8App::setupModes() { StringVector matNames; matNames.push_back("Examples/BumpMapping/MultiLight"); matNames.push_back("Examples/BumpMapping/MultiLightSpecular"); matNames.push_back("Examples/OffsetMapping/Specular"); matNames.push_back("Examples/ShowUV"); matNames.push_back("Examples/ShowNormals"); matNames.push_back("Examples/ShowTangents"); matNames.push_back("RTSS/NormalMapping_SinglePass"); matNames.push_back("RTSS/NormalMapping_MultiPass"); mPossibilities["ogrehead.mesh"] = matNames; mPossibilities["knot.mesh"] = matNames; matNames.clear(); matNames.push_back("Examples/Athene/NormalMapped"); matNames.push_back("Examples/Athene/NormalMappedSpecular"); matNames.push_back("Examples/Athene/NormalMappedSpecular"); matNames.push_back("Examples/ShowUV"); matNames.push_back("Examples/ShowNormals"); matNames.push_back("Examples/ShowTangents"); matNames.push_back("RTSS/Athene/NormalMapping_SinglePass"); matNames.push_back("RTSS/Athene/NormalMapping_MultiPass"); mPossibilities["athene.mesh"] = matNames; for (std::map<Ogre::String,Ogre::StringVector>::iterator it = mPossibilities.begin(); it != mPossibilities.end(); it++) { Ogre::MeshPtr mesh = MeshManager::getSingleton().load(it->first,ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY); unsigned short src,dest; if (!mesh->suggestTangentVectorBuildParams(VES_TANGENT,src,dest)) { mesh->buildTangentVectors(VES_TANGENT,src,dest); } Entity* ent = mSceneMgr->createEntity(mesh->getName(),mesh->getName()); ent->setMaterialName(it->second.front()); } mMeshMenu->addItem(new CEGUI::ListboxTextItem("athene.mesh")); mMeshMenu->addItem(new CEGUI::ListboxTextItem("ogrehead.mesh")); mMeshMenu->addItem(new CEGUI::ListboxTextItem("knot.mesh")); mMeshMenu->setItemSelectState(size_t(0),true); const char * a = mMeshMenu->getSelectedItem()->getText().c_str(); Ogre::StringVector::iterator it = mPossibilities[a].begin(); Ogre::StringVector::iterator itEnd = mPossibilities[mMeshMenu->getSelectedItem()->getText().c_str()].end(); for (; it != itEnd; it++) { mMaterialMenu->addItem(new ListboxTextItem(it->c_str())); } mMaterialMenu->setItemSelectState(size_t(0),true); mSceneMgr->getEntity(mMeshMenu->getSelectedItem()->getText().c_str())->setMaterialName(mMaterialMenu->getSelectedItem()->getText().c_str()); }
Ogre::MeshPtr loadMesh(const Ogre::String& meshName, const Ogre::String& groupName, const Ogre::String& baseResourceName, const Ogre::String& baseGroupName) { // Load the mesh Ogre::MeshPtr mesh = loadCorrelativeResource( meshName, groupName, baseResourceName, baseGroupName, Ogre::MeshManager::getSingleton()); if (mesh.isNull()) { OGRE_EXCEPT(Ogre::Exception::ERR_ITEM_NOT_FOUND, "Unable to load mesh " + meshName, "loadMesh"); } // Try to resolve skeleton resource if (mesh->hasSkeleton() && mesh->getSkeleton().isNull()) { // resolve correlative with mesh Ogre::SkeletonPtr skeleton = loadCorrelativeResource( mesh->getSkeletonName(), groupName, mesh->getName(), mesh->getGroup(), Ogre::SkeletonManager::getSingleton()); if (skeleton.isNull()) { // resolve correlative with base resource skeleton = loadCorrelativeResource( mesh->getSkeletonName(), groupName, baseResourceName, baseGroupName, Ogre::SkeletonManager::getSingleton()); } if (skeleton.isNull()) { OGRE_EXCEPT(Ogre::Exception::ERR_ITEM_NOT_FOUND, "Unable to load skeleton " + mesh->getSkeletonName() + " for mesh " + mesh->getName(), "loadMesh"); } // Set to the actual name mesh->setSkeletonName(skeleton->getName()); } return mesh; }
Ogre::Mesh* EC_Mesh::PrepareMesh(const std::string& mesh_name, bool clone) { if (!ViewEnabled()) return 0; if (renderer_.expired()) return 0; RendererPtr renderer = renderer_.lock(); Ogre::MeshManager& mesh_mgr = Ogre::MeshManager::getSingleton(); Ogre::MeshPtr mesh = mesh_mgr.getByName(SanitateAssetIdForOgre(mesh_name)); // For local meshes, mesh will not get automatically loaded until used in an entity. Load now if necessary if (mesh.isNull()) { try { mesh_mgr.load(mesh_name, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); mesh = mesh_mgr.getByName(mesh_name); } catch (Ogre::Exception& e) { LogError("Could not load mesh " + mesh_name + ": " + std::string(e.what())); return 0; } } // If mesh is still null, must abort if (mesh.isNull()) { LogError("Mesh " + mesh_name + " does not exist"); return 0; } if (clone) { try { mesh = mesh->clone(renderer->GetUniqueObjectName("EC_Mesh_clone")); mesh->setAutoBuildEdgeLists(false); cloned_mesh_name_ = mesh->getName(); } catch (Ogre::Exception& e) { LogError("Could not clone mesh " + mesh_name + ":" + std::string(e.what())); return 0; } } if (mesh->hasSkeleton()) { Ogre::SkeletonPtr skeleton = Ogre::SkeletonManager::getSingleton().getByName(mesh->getSkeletonName()); if (skeleton.isNull() || skeleton->getNumBones() == 0) { LogDebug("Mesh " + mesh_name + " has a skeleton with 0 bones. Disabling the skeleton."); mesh->setSkeletonName(""); } } return mesh.get(); }
void SoundEditAction::_createIndicatorInstance(void) { Ogre::SceneManager* sceneManager = mSceneManipulator->getSceneManager(); mSoundMovingEntity = sceneManager->createEntity("SoundMovingEntity", "axes.mesh"); mSoundNode = mSceneManipulator->getIndicatorRootSceneNode()->createChildSceneNode(); mSoundNode->setVisible(false); mSoundNode->createChildSceneNode()->attachObject(mSoundMovingEntity); mSoundMovingEntity->getParentSceneNode()->setScale(10,10,10); Real radius = 1; int rings = 16; int segments = 64; Ogre::MeshPtr sphereMesh = WX::createCommonSphere("SoundRadiusEntity", radius, rings, segments); Ogre::MaterialPtr material = WX::createPureColourMaterial( Ogre::ColourValue(1, 0, 0, 0.75) ); material->getTechnique(0)->getPass(0)->setPolygonMode(Ogre::PM_WIREFRAME); mSoundRadiusEntity = sceneManager->createEntity("SoundRadiusEntity", sphereMesh->getName()); mSoundNode->createChildSceneNode()->attachObject(mSoundRadiusEntity); mSoundRadiusEntity->setMaterialName(material->getName()); mSoundRadiusEntity->getParentSceneNode()->setVisible(false); mFirstInit = true; }
void OLMeshTracker::DoReload(Ogre::MeshPtr meshP) { if (!m_shouldQueueMeshOperations) { ReloadMeshQm* rmq = new ReloadMeshQm(10, meshP); rmq->Process(); delete(rmq); return; } LGLOCK_ALOCK trackerLock; meshP->unload(); // DEBUG trackerLock.Lock(MeshTrackerLock); // check to see if in unloaded list, if so, remove it and claim success Ogre::String meshName = meshP->getName(); GenericQm* reloadEntry = m_meshesToLoad->Find(meshName); if (reloadEntry != NULL) { // if already being loaded, we're done LG::Log("OLMeshTracker::DoReload: asked to reload but already loading: %s", meshName.c_str()); trackerLock.Unlock(); return; } // add this to the loading list LG::Log("OLMeshTracker::DoReload: queuing reloading: %s", meshName.c_str()); ReloadMeshQm* rmq = new ReloadMeshQm(10, meshP); m_meshesToLoad->AddLast(rmq); trackerLock.Unlock(); LGLOCK_NOTIFY_ALL(MeshTrackerLock); /* OLD CODE // for the moment, don't do anything fancy if (meshP->isLoaded()) { meshP->reload(); } UpdateSceneNodesForMesh(meshP); // do we need to call update on all scene nodes that use this mesh? */ }
//------------------------------------------------------------------------------------------- void MagickWidget::loadMesh(Ogre::MeshPtr pMesh) { QString directory(OgitorsRoot::getSingletonPtr()->GetProjectOptions()->ProjectDir.c_str()); if(directory.isEmpty()) directory = "./"; QDir(directory).mkpath("entitycache"); Ogre::TexturePtr texture = Ogre::TextureManager::getSingleton().createManual( "MeshMagickTex", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D, 512, 512, 0, Ogre::PF_R8G8B8A8 , Ogre::TU_RENDERTARGET ); Ogre::RenderTexture *rttTex = texture->getBuffer()->getRenderTarget(); Ogre::SceneManager *mSceneMgr = Ogre::Root::getSingletonPtr()->createSceneManager("OctreeSceneManager", "MeshMagickTexMgr"); Ogre::Light *dirl = mSceneMgr->createLight("DisplayLight"); dirl->setDirection(-1,-1,-1); dirl->setDiffuseColour(1,1,1); dirl->setType(Ogre::Light::LT_DIRECTIONAL); Ogre::Camera* RTTCam = mSceneMgr->createCamera("MeshMagickCam"); RTTCam->setNearClipDistance(0.01F); RTTCam->setFarClipDistance(0); RTTCam->setAspectRatio(1); RTTCam->setFOVy(Ogre::Degree(90)); RTTCam->setPosition(0,0,1); RTTCam->lookAt(0,0,0); Ogre::Viewport *v = rttTex->addViewport( RTTCam ); v->setClearEveryFrame( true ); v->setBackgroundColour(Ogre::ColourValue(0,0,0)); Ogre::Entity *mEntity; mEntity = mSceneMgr->createEntity("scbDisplay", pMesh->getName()); mSceneMgr->getRootSceneNode()->attachObject(mEntity); Ogre::Vector3 vSize = mEntity->getBoundingBox().getHalfSize(); Ogre::Vector3 vCenter = mEntity->getBoundingBox().getCenter(); vSize += Ogre::Vector3(vSize.z, vSize.z, vSize.z); float maxsize = std::max(std::max(vSize.x,vSize.y),vSize.z); vSize = Ogre::Vector3(0, 0, maxsize * 1.15f) + vCenter; RTTCam->setPosition(vSize.x,vSize.y,vSize.z); RTTCam->lookAt(vCenter.x,vCenter.y,vCenter.z); rttTex->update(); Ogre::String imagefile = OgitorsUtils::QualifyPath(directory.toStdString() + "/entitycache/meshmagick.png"); rttTex->writeContentsToFile(imagefile); mEntity->detachFromParent(); mSceneMgr->destroyEntity(mEntity); rttTex->removeAllViewports(); Ogre::Root::getSingletonPtr()->destroySceneManager(mSceneMgr); mDisplayWidget->setImage(QString(imagefile.c_str())); }
// BETWEEN FRAME OPERATION void VisCalcFrustDist::queueMeshUnload(Ogre::MeshPtr meshP) { Ogre::String meshName = meshP->getName(); // if it's in the list to be loaded but we're unloading it, remove from load list /* if (meshesToLoad.find(meshName) != meshesToLoad.end()) { meshesToLoad.erase(meshName); } */ // for the moment, just unload it and don't queue unloadTheMesh(meshP); }
void MergeMesh::addMesh( Ogre::MeshPtr mesh ) { if( mesh->getSkeleton().isNull() ) { log( "Skipped: " + mesh->getName() + " has no skeleton" ); return; } if( m_BaseSkeleton.isNull() ) { m_BaseSkeleton = mesh->getSkeleton(); log( "Set: base skeleton (" + m_BaseSkeleton->getName()+")" ); } if( mesh->getSkeleton() != m_BaseSkeleton ) { log( "Skipped: " + mesh->getName() + " has other skeleton ("+ mesh->getSkeleton()->getName() +")" ); return; } m_Meshes.push_back( mesh ); }
bool AssetsManager::exportMesh(Ogre::MeshPtr mesh, const std::string& filePath) { if (filePath != "") { Ogre::MeshSerializer serializer; try { serializer.exportMesh(mesh.get(), filePath); S_LOG_INFO("Exported mesh " << filePath); } catch (const Ogre::Exception& ex) { S_LOG_FAILURE("Error when exporting mesh " << mesh->getName() << "to path " << filePath <<"." << ex); return false; } return true; } return false; }
void LodManager::loadLod(Ogre::MeshPtr mesh) { assert(mesh->getNumLodLevels() == 1); std::string lodDefName = convertMeshNameToLodName(mesh->getName()); try { Ogre::ResourcePtr resource = LodDefinitionManager::getSingleton().load(lodDefName, "General"); const LodDefinition& def = *static_cast<const LodDefinition*>(resource.get()); loadLod(mesh, def); } catch (Ogre::FileNotFoundException ex) { // Exception is thrown if a mesh hasn't got a loddef. // By default, use the automatic mesh lod management system. loadAutomaticLod(mesh); } }
MeshShape* MeshShape::GetMeshShape (Ogre::Entity* pEntity) { if (!pEntity) return 0; Ogre::MeshPtr pMesh = pEntity->getMesh(); assert(!pMesh.isNull() && "entity has no mesh"); if (pMesh.isNull()) return 0; // look in cache MeshShape*& pShape = gMeshShapeCache[pMesh->getName()]; if (pShape) { pShape->Update(pEntity); return pShape; } // register new shape pShape = new MeshShape(pMesh); pShape->Update(pEntity); return pShape; }
std::string AssetsManager::resolveFilePathForMesh(Ogre::MeshPtr meshPtr) { Ogre::ResourceGroupManager& manager = Ogre::ResourceGroupManager::getSingleton(); const std::multimap<std::string, std::string>& locations = EmberOgre::getSingleton().getResourceLocations(); for (std::multimap<std::string, std::string>::const_iterator I = locations.begin(); I != locations.end(); ++I) { std::string group = I->first; std::string fileName = meshPtr->getName(); Ogre::FileInfoListPtr files = manager.findResourceFileInfo(group, fileName, false); for (Ogre::FileInfoList::const_iterator J = files->begin(); J != files->end(); ++J) { if (J->filename == fileName) { return I->second + J->filename; } } } return ""; }
void LodInputBuffer::fillBuffer( Ogre::MeshPtr mesh ) { meshName = mesh->getName(); boundingSphereRadius = mesh->getBoundingSphereRadius(); bool sharedVerticesAdded = false; unsigned short submeshCount = mesh->getNumSubMeshes(); submesh.resize(submeshCount); for (unsigned short i = 0; i < submeshCount; i++) { const SubMesh* ogresubmesh = mesh->getSubMesh(i); LodInputBuffer::Submesh& outsubmesh = submesh[i]; outsubmesh.indexBuffer.fillBuffer(ogresubmesh->indexData); outsubmesh.useSharedVertexBuffer = ogresubmesh->useSharedVertices; if (!outsubmesh.useSharedVertexBuffer) { outsubmesh.vertexBuffer.fillBuffer(ogresubmesh->vertexData); } else if (!sharedVerticesAdded) { sharedVerticesAdded = true; sharedVertexBuffer.fillBuffer(mesh->sharedVertexData); } } }
// unload all about this mesh. The mesh itself and the textures. // BETWEEN FRAME OPERATION void VisCalcFrustDist::unloadTheMesh(Ogre::MeshPtr meshP) { if (m_shouldCullTextures) { Ogre::Mesh::SubMeshIterator smi = meshP->getSubMeshIterator(); while (smi.hasMoreElements()) { Ogre::SubMesh* oneSubMesh = smi.getNext(); Ogre::String subMeshMaterialName = oneSubMesh->getMaterialName(); Ogre::MaterialPtr subMeshMaterial = (Ogre::MaterialPtr)Ogre::MaterialManager::getSingleton().getByName(subMeshMaterialName); if (!subMeshMaterial.isNull()) { Ogre::Material::TechniqueIterator techIter = subMeshMaterial->getTechniqueIterator(); while (techIter.hasMoreElements()) { Ogre::Technique* oneTech = techIter.getNext(); Ogre::Technique::PassIterator passIter = oneTech->getPassIterator(); while (passIter.hasMoreElements()) { Ogre::Pass* onePass = passIter.getNext(); Ogre::Pass::TextureUnitStateIterator tusIter = onePass->getTextureUnitStateIterator(); while (tusIter.hasMoreElements()) { Ogre::TextureUnitState* oneTus = tusIter.getNext(); Ogre::String texName = oneTus->getTextureName(); Ogre::TexturePtr texP = (Ogre::TexturePtr)Ogre::TextureManager::getSingleton().getByName(texName); if (!texP.isNull()) { // if (texP.useCount() <= 1) { texP->unload(); LG::IncStat(LG::StatCullTexturesUnloaded); // LG::Log("unloadTheMesh: unloading texture %s", texName.c_str()); // } } } } } } } } if (m_shouldCullMeshes) { LG::OLMeshTracker::Instance()->MakeUnLoaded(meshP->getName(), Ogre::String(), NULL); LG::IncStat(LG::StatCullMeshesUnloaded); // LG::Log("unloadTheMesh: unloading mesh %s", mshName.c_str()); } }
void DrawToolOGRE::popMatrix() { assert(pOgreDrawInternal); //create the entity corresponding to what has been drawn so far by //pOgreDrawInternal std::ostringstream s; s << "mesh[" << mMeshName++ <<"]"; Ogre::MeshPtr ogreMesh = pOgreDrawInternal->convertToMesh(s.str(), "General"); s.str(""); s << "entity[" << mEntityName++ <<"]"; Ogre::Entity *e = pSceneMgr->createEntity(s.str(), ogreMesh->getName()); //restore drawing of primitives to OgreDraw pOgreDraw = pOgreDrawSave; //attach the entity to the top stack node. Ogre::SceneNode* currentSceneNode = sceneNodeStack.top(); currentSceneNode->attachObject(e); //reduce stack size by one sceneNodeStack.pop(); assert(!sceneNodeStack.empty()); }
CreateObjectAction::CreateObjectAction(SceneManipulator* sceneManipulator) : Action(sceneManipulator) , mDirty(true) , mObject() , mHasPosition(false) , mRangeSphereEntity(NULL) , mRangeSphereNode(NULL) { // create a entity for indicate the range of a point light mRangeSphereNode = getIndicatorRootSceneNode()->createChildSceneNode(); Ogre::MeshPtr sphereMesh = Fairy::createCommonSphere("PointLightRangeSphere", 100, 16, 16); Ogre::MaterialPtr material = Fairy::createPureColourMaterial(Ogre::ColourValue(0, 1, 0, 0.75)); material->getTechnique(0)->getPass(0)->setPolygonMode(Ogre::PM_WIREFRAME); material->getTechnique(0)->getPass(0)->setCullingMode(Ogre::CULL_NONE); mRangeSphereEntity = getSceneManager()->createEntity("CreateLightRangeSphere", sphereMesh->getName()); mRangeSphereEntity->setMaterialName(material->getName()); mRangeSphereNode->attachObject(mRangeSphereEntity); mRangeSphereNode->setVisible(false); }
bool AssetsManager::exportMesh(Ogre::MeshPtr mesh, const std::string& filePath) { if (filePath != "") { Ogre::MeshSerializer serializer; try { std::string dirname(filePath); size_t end = dirname.find_last_of("/\\"); if (end != std::string::npos) { dirname = dirname.substr(0, end); } oslink::directory osdir(dirname); if (!osdir.isExisting()) { oslink::directory::mkdir(dirname.c_str()); } serializer.exportMesh(mesh.get(), filePath); S_LOG_INFO("Exported mesh " << filePath); } catch (const Ogre::Exception& ex) { S_LOG_FAILURE("Error when exporting mesh " << mesh->getName() << "to path " << filePath <<"." << ex); return false; } return true; } return false; }
// =============================================================================== // Someone wants to delete this mesh. Check to see if it's a shared mesh and decide if we // should actually delete it or not. void OLMeshTracker::DeleteMesh(Ogre::MeshPtr mesh) { Ogre::MeshManager::getSingleton().remove(mesh->getName()); }
//------------------------------------------------------------------------------------------------ void StaticMeshToShapeConverter::addMesh(const Ogre::MeshPtr &mesh, const Ogre::Matrix4 &transform) { // Each entity added need to reset size and radius // next time getRadius and getSize are asked, they're computed. mBounds = Ogre::Vector3(-1.0f, -1.0f, -1.0f); mBoundRadius = -1; //_entity = entity; //_node = (SceneNode*)(_entity->getParentNode()); mTransform = transform; if (mesh->hasSkeleton()) { Ogre::LogManager::getSingleton().logMessage("MeshToShapeConverter::addMesh : Mesh " + mesh->getName() + " as skeleton but added to trimesh non animated"); } if (mesh->sharedVertexData) { VertexIndexToShape::addStaticVertexData (mesh->sharedVertexData); } for (unsigned int i = 0; i < mesh->getNumSubMeshes(); ++i) { Ogre::SubMesh *sub_mesh = mesh->getSubMesh(i); if (!sub_mesh->useSharedVertices) { VertexIndexToShape::addIndexData(sub_mesh->indexData, mVertexCount); VertexIndexToShape::addStaticVertexData(sub_mesh->vertexData); } else { VertexIndexToShape::addIndexData(sub_mesh->indexData); } } }
Indicator(const ObjectPtr &object, SceneManipulator *sceneManipulator) : mProxy(NULL) { assert(sceneManipulator); mUserAny = Ogre::Any(); mProxy = new ObjectProxy(object); // 根据光源位置来定节点位置 Ogre::Vector3 pos = VariantCast<Ogre::Vector3>(object->getProperty("position")); mIndicatorSceneNode = sceneManipulator->getIndicatorRootSceneNode()->createChildSceneNode(pos); Real radius = 5; int rings = 16; int segments = 16; Ogre::MeshPtr sphereMesh = createCommonSphere(radius, rings, segments); Ogre::MaterialPtr material = createPureColourMaterial( Ogre::ColourValue(1, 0, 0, 0.75) ); mIndicatorEntity = sceneManipulator->getSceneManager()->createEntity(mIndicatorSceneNode->getName(), sphereMesh->getName()); //david-<< //mIndicatorEntity->setNormaliseNormals(true); //david->> mIndicatorEntity->setMaterialName(material->getName()); setUserObject(mProxy); mIndicatorSceneNode->attachObject(mIndicatorEntity); // 选择时不考虑粒子系统的包围盒,用的是指示器的包围盒 ParticleSystemObject *particleSystemObject = static_cast<ParticleSystemObject *> (object.get()); Ogre::ParticleSystem *system = particleSystemObject->getParticleSystem(); if (system) system->setQueryFlags(0); // 根据光源类型来挂接模型 showIndicator(false); }
// Create the scene node for the ocean. We create a plane, add the ocean material, create a scene node // and add the plane to the scene node and return that scene node. // BETWEEN FRAME OPERATION Ogre::SceneNode* Region::CreateOcean(Ogre::SceneNode* regionNode, const float width, const float length, const float waterHeight, Ogre::String waterName) { Ogre::Plane* oceanPlane = new Ogre::Plane(0.0, 0.0, 1.0, 0); Ogre::MeshPtr oceanMesh = Ogre::MeshManager::getSingleton().createPlane(waterName, OLResourceGroupName, *oceanPlane, width, length, 2, 2, true, 2, 2.0, 2.0, Ogre::Vector3::UNIT_Y); Ogre::String oceanMaterialName = LG::GetParameter("Renderer.Ogre.OceanMaterialName"); LG::Log("Region::CreateOcean: r=%s, h=%f, n=%s, m=%s", regionNode->getName().c_str(), waterHeight, waterName.c_str(), oceanMaterialName.c_str()); oceanMesh->getSubMesh(0)->setMaterialName(oceanMaterialName); Ogre::Entity* oceanEntity = LG::RendererOgre::Instance()->m_sceneMgr->createEntity("WaterEntity/" + waterName, oceanMesh->getName()); oceanEntity->addQueryFlags(Ogre::SceneManager::WORLD_GEOMETRY_TYPE_MASK); oceanEntity->setCastShadows(false); Ogre::SceneNode* oceanNode = regionNode->createChildSceneNode("WaterSceneNode/" + waterName); oceanNode->setInheritOrientation(true); oceanNode->setInheritScale(false); oceanNode->translate(width/2.0f, length/2.0f, waterHeight); oceanNode->attachObject(oceanEntity); return oceanNode; }
void CSaveSceneView::SceneNodeExplore(Ogre::SceneNode *SceneNode) { Ogre::Entity *Entity = NULL; Ogre::Camera *Camera = NULL; Ogre::Light *Light = NULL; Ogre::ParticleSystem *ParticleSystem = NULL; Ogre::ManualObject *ManualObject = NULL; Ogre::BillboardSet *BillboardSet = NULL; xmlTextWriterStartElement(m_XmlWriter, BAD_CAST "SceneNode"); Ogre::String SceneNodeName = SceneNode->getName(); xmlTextWriterWriteAttribute(m_XmlWriter, BAD_CAST "SceneNodeName", BAD_CAST SceneNodeName.c_str()); Ogre::SceneNode::ObjectIterator obji = SceneNode->getAttachedObjectIterator(); while (obji.hasMoreElements()) { Ogre::MovableObject* mobj = obji.getNext(); Ogre::String Type = mobj->getMovableType(); if (Type == "Entity") { Entity = (Ogre::Entity *)(mobj); Ogre::String EntityName = Entity->getName(); xmlTextWriterStartElement(m_XmlWriter, BAD_CAST "Entity"); xmlTextWriterWriteAttribute(m_XmlWriter, BAD_CAST "EntityName", BAD_CAST EntityName.c_str()); Ogre::MeshPtr Mesh = Entity->getMesh(); Ogre::String MeshName = Mesh->getName(); xmlTextWriterWriteAttribute(m_XmlWriter, BAD_CAST "MeshName", BAD_CAST MeshName.c_str()); xmlTextWriterEndElement(m_XmlWriter); } if (Type == "Camera") { Camera = (Ogre::Camera *)(mobj); Ogre::String CameraName = Camera->getName(); xmlTextWriterStartElement(m_XmlWriter, BAD_CAST "Camera"); xmlTextWriterWriteAttribute(m_XmlWriter, BAD_CAST "CameraName", BAD_CAST CameraName.c_str()); Ogre::Vector3 CameraPosition = Camera->getPosition(); xmlTextWriterWriteFormatAttribute(m_XmlWriter, BAD_CAST "XPosition", "%f",CameraPosition.x); xmlTextWriterWriteFormatAttribute(m_XmlWriter, BAD_CAST "YPosition", "%f",CameraPosition.y); xmlTextWriterWriteFormatAttribute(m_XmlWriter, BAD_CAST "ZPosition", "%f",CameraPosition.z); Ogre::Vector3 CameraDirection = Camera->getDirection(); xmlTextWriterWriteFormatAttribute(m_XmlWriter, BAD_CAST "XDirection", "%f",CameraDirection.x); xmlTextWriterWriteFormatAttribute(m_XmlWriter, BAD_CAST "YDirection", "%f",CameraDirection.y); xmlTextWriterWriteFormatAttribute(m_XmlWriter, BAD_CAST "ZDirection", "%f",CameraDirection.z); xmlTextWriterEndElement(m_XmlWriter); } if (Type == "Light") { Light = (Ogre::Light *)(mobj); } if (Type == "ParticleSystem") { ParticleSystem = (Ogre::ParticleSystem *)(mobj); } if (Type == "ManualObject") { ManualObject = (Ogre::ManualObject *)(mobj); } if (Type == "BillboardSet") { BillboardSet = (Ogre::BillboardSet *)(mobj); } } Ogre::Node::ChildNodeIterator nodei = SceneNode->getChildIterator(); while (nodei.hasMoreElements()) { Ogre::SceneNode* node = (Ogre::SceneNode*)(nodei.getNext()); // Add this subnode and its children... SceneNodeExplore(node); } xmlTextWriterEndElement(m_XmlWriter); //end SceneNode }
IntersectPoint::IntersectPoint(SceneManipulator* sceneManipulator) : HitIndicator(sceneManipulator) , mIntersectNode(NULL) , mIntersectEntity(NULL) { // Create intersection node and entity mIntersectNode = getIndicatorRootSceneNode()->createChildSceneNode(); Real radius = 1; int rings = 16; int segments = 16; Ogre::MeshPtr sphereMesh = createCommonSphere(radius, rings, segments); Ogre::MaterialPtr material = createColourMaterial( Ogre::ColourValue(1, 0, 0, 0.75), Ogre::ColourValue(0, 1, 0), 1); mIntersectEntity = getSceneManager()->createEntity(mIntersectNode->getName(), sphereMesh->getName()); mIntersectEntity->setQueryFlags(0); mIntersectEntity->setNormaliseNormals(true); mIntersectEntity->setMaterialName(material->getName()); mIntersectEntity->setRenderQueueGroup(Ogre::RENDER_QUEUE_7); mIntersectNode->attachObject(mIntersectEntity); mIntersectNode->setVisible(false); reshape(); }
bool ModelBackgroundLoader::poll(const TimeFrame& timeFrame) { #if OGRE_THREAD_SUPPORT if (mState == LS_UNINITIALIZED) { //Start to load the meshes for (SubModelDefinitionsStore::const_iterator I_subModels = mModel.getDefinition()->getSubModelDefinitions().begin(); I_subModels != mModel.getDefinition()->getSubModelDefinitions().end(); ++I_subModels) { Ogre::MeshPtr meshPtr = static_cast<Ogre::MeshPtr> (Ogre::MeshManager::getSingleton().getByName((*I_subModels)->getMeshName())); if (meshPtr.isNull() || !meshPtr->isPrepared()) { try { Ogre::BackgroundProcessTicket ticket = Ogre::ResourceBackgroundQueue::getSingleton().prepare(Ogre::MeshManager::getSingleton().getResourceType(), (*I_subModels)->getMeshName(), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, false, 0, 0, createListener()); if (ticket) { addTicket(ticket); } } catch (const std::exception& ex) { S_LOG_FAILURE("Could not load the mesh " << (*I_subModels)->getMeshName() << " when loading model " << mModel.getName() << "." << ex); continue; } } } mState = LS_MESH_PREPARING; return poll(timeFrame); } else if (mState == LS_MESH_PREPARING) { if (areAllTicketsProcessed()) { mState = LS_MESH_PREPARED; return poll(timeFrame); } } else if (mState == LS_MESH_PREPARED) { for (SubModelDefinitionsStore::const_iterator I_subModels = mModel.getDefinition()->getSubModelDefinitions().begin(); I_subModels != mModel.getDefinition()->getSubModelDefinitions().end(); ++I_subModels) { Ogre::MeshPtr meshPtr = static_cast<Ogre::MeshPtr> (Ogre::MeshManager::getSingleton().getByName((*I_subModels)->getMeshName())); if (!meshPtr.isNull()) { if (!meshPtr->isLoaded()) { #if OGRE_THREAD_SUPPORT == 1 Ogre::BackgroundProcessTicket ticket = Ogre::ResourceBackgroundQueue::getSingleton().load(Ogre::MeshManager::getSingleton().getResourceType(), meshPtr->getName(), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, false, 0, 0, createListener()); if (ticket) { // meshPtr->setBackgroundLoaded(true); addTicket(ticket); } #else if (!timeFrame.isTimeLeft()) { return false; } try { meshPtr->load(); } catch (const std::exception& ex) { S_LOG_FAILURE("Could not load the mesh " << meshPtr->getName() << " when loading model " << mModel.getName() << "." << ex); continue; } #endif } } } mState = LS_MESH_LOADING; return poll(timeFrame); } else if (mState == LS_MESH_LOADING) { if (areAllTicketsProcessed()) { mState = LS_MESH_LOADED; return poll(timeFrame); } } else if (mState == LS_MESH_LOADED) { for (SubModelDefinitionsStore::const_iterator I_subModels = mModel.getDefinition()->getSubModelDefinitions().begin(); I_subModels != mModel.getDefinition()->getSubModelDefinitions().end(); ++I_subModels) { Ogre::MeshPtr meshPtr = static_cast<Ogre::MeshPtr> (Ogre::MeshManager::getSingleton().getByName((*I_subModels)->getMeshName())); if (!meshPtr.isNull()) { if (meshPtr->isLoaded()) { Ogre::Mesh::SubMeshIterator subMeshI = meshPtr->getSubMeshIterator(); while (subMeshI.hasMoreElements()) { Ogre::SubMesh* submesh(subMeshI.getNext()); Ogre::MaterialPtr materialPtr = static_cast<Ogre::MaterialPtr> (Ogre::MaterialManager::getSingleton().getByName(submesh->getMaterialName())); if (materialPtr.isNull() || !materialPtr->isPrepared()) { // S_LOG_VERBOSE("Preparing material " << materialPtr->getName()); Ogre::BackgroundProcessTicket ticket = Ogre::ResourceBackgroundQueue::getSingleton().prepare(Ogre::MaterialManager::getSingleton().getResourceType(),submesh->getMaterialName(), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, false, 0, 0, createListener()); if (ticket) { addTicket(ticket); } } } } } for (PartDefinitionsStore::const_iterator I_parts = (*I_subModels)->getPartDefinitions().begin(); I_parts != (*I_subModels)->getPartDefinitions().end(); ++I_parts) { if ((*I_parts)->getSubEntityDefinitions().size() > 0) { for (SubEntityDefinitionsStore::const_iterator I_subEntities = (*I_parts)->getSubEntityDefinitions().begin(); I_subEntities != (*I_parts)->getSubEntityDefinitions().end(); ++I_subEntities) { const std::string& materialName = (*I_subEntities)->getMaterialName(); if (materialName != "") { Ogre::MaterialPtr materialPtr = static_cast<Ogre::MaterialPtr> (Ogre::MaterialManager::getSingleton().getByName(materialName)); if (materialPtr.isNull() || !materialPtr->isPrepared()) { // S_LOG_VERBOSE("Preparing material " << materialName); Ogre::BackgroundProcessTicket ticket = Ogre::ResourceBackgroundQueue::getSingleton().prepare(Ogre::MaterialManager::getSingleton().getResourceType(), materialName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, false, 0, 0, createListener()); if (ticket) { addTicket(ticket); } } } } } } } mState = LS_MATERIAL_PREPARING; return poll(timeFrame); } else if (mState == LS_MATERIAL_PREPARING) { if (areAllTicketsProcessed()) { mState = LS_MATERIAL_PREPARED; return poll(timeFrame); } } else if (mState == LS_MATERIAL_PREPARED) { for (SubModelDefinitionsStore::const_iterator I_subModels = mModel.getDefinition()->getSubModelDefinitions().begin(); I_subModels != mModel.getDefinition()->getSubModelDefinitions().end(); ++I_subModels) { Ogre::MeshPtr meshPtr = static_cast<Ogre::MeshPtr> (Ogre::MeshManager::getSingleton().getByName((*I_subModels)->getMeshName())); Ogre::Mesh::SubMeshIterator subMeshI = meshPtr->getSubMeshIterator(); while (subMeshI.hasMoreElements()) { Ogre::SubMesh* submesh(subMeshI.getNext()); Ogre::MaterialPtr materialPtr = static_cast<Ogre::MaterialPtr> (Ogre::MaterialManager::getSingleton().getByName(submesh->getMaterialName())); if (!materialPtr.isNull() && !materialPtr->isLoaded()) { #if OGRE_THREAD_SUPPORT == 1 Ogre::BackgroundProcessTicket ticket = Ogre::ResourceBackgroundQueue::getSingleton().load(Ogre::MaterialManager::getSingleton().getResourceType(), materialPtr->getName(), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, false, 0, 0, createListener()); if (ticket) { // materialPtr->setBackgroundLoaded(true); addTicket(ticket); } #else Ogre::Material::TechniqueIterator techIter = materialPtr->getSupportedTechniqueIterator(); while (techIter.hasMoreElements()) { Ogre::Technique* tech = techIter.getNext(); Ogre::Technique::PassIterator passIter = tech->getPassIterator(); while (passIter.hasMoreElements()) { Ogre::Pass* pass = passIter.getNext(); Ogre::Pass::TextureUnitStateIterator tusIter = pass->getTextureUnitStateIterator(); while (tusIter.hasMoreElements()) { Ogre::TextureUnitState* tus = tusIter.getNext(); unsigned int frames = tus->getNumFrames(); for (unsigned int i = 0; i < frames; ++i) { if (!timeFrame.isTimeLeft()) { return false; } //This will automatically load the texture. // S_LOG_VERBOSE("Loading texture " << tus->getTextureName()); Ogre::TexturePtr texturePtr = tus->_getTexturePtr(i); } } } } if (!timeFrame.isTimeLeft()) { return false; } // S_LOG_VERBOSE("Loading material " << materialPtr->getName()); materialPtr->load(); #endif } } for (PartDefinitionsStore::const_iterator I_parts = (*I_subModels)->getPartDefinitions().begin(); I_parts != (*I_subModels)->getPartDefinitions().end(); ++I_parts) { if ((*I_parts)->getSubEntityDefinitions().size() > 0) { for (SubEntityDefinitionsStore::const_iterator I_subEntities = (*I_parts)->getSubEntityDefinitions().begin(); I_subEntities != (*I_parts)->getSubEntityDefinitions().end(); ++I_subEntities) { const std::string& materialName = (*I_subEntities)->getMaterialName(); if (materialName != "") { Ogre::MaterialPtr materialPtr = static_cast<Ogre::MaterialPtr> (Ogre::MaterialManager::getSingleton().getByName(materialName)); if (!materialPtr.isNull() && !materialPtr->isLoaded()) { #if OGRE_THREAD_SUPPORT == 1 Ogre::BackgroundProcessTicket ticket = Ogre::ResourceBackgroundQueue::getSingleton().load(Ogre::MaterialManager::getSingleton().getResourceType(), materialPtr->getName(), Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, false, 0, 0, createListener()); if (ticket) { addTicket(ticket); } #else Ogre::Material::TechniqueIterator techIter = materialPtr->getSupportedTechniqueIterator(); while (techIter.hasMoreElements()) { Ogre::Technique* tech = techIter.getNext(); Ogre::Technique::PassIterator passIter = tech->getPassIterator(); while (passIter.hasMoreElements()) { Ogre::Pass* pass = passIter.getNext(); Ogre::Pass::TextureUnitStateIterator tusIter = pass->getTextureUnitStateIterator(); while (tusIter.hasMoreElements()) { Ogre::TextureUnitState* tus = tusIter.getNext(); unsigned int frames = tus->getNumFrames(); for (unsigned int i = 0; i < frames; ++i) { if (!timeFrame.isTimeLeft()) { return false; } //This will automatically load the texture. // S_LOG_VERBOSE("Loading texture " << tus->getTextureName()); Ogre::TexturePtr texturePtr = tus->_getTexturePtr(i); } } } } if (!timeFrame.isTimeLeft()) { return false; } // S_LOG_VERBOSE("Loading material " << materialPtr->getName()); materialPtr->load(); #endif } } } } } } mState = LS_MATERIAL_LOADING; return poll(timeFrame); } else if (mState == LS_MATERIAL_LOADING) { if (areAllTicketsProcessed()) { mState = LS_DONE; return true; } } else { return true; } return false; #else //If there's no threading support, just return here. return true; #endif }
void World::LoadSceneFile(string sceneFile) { Ogre::LogManager::getSingleton().setLogDetail(Ogre::LL_LOW); Ogre::SceneNode* worldNode = m_sceneMgr->getRootSceneNode()->createChildSceneNode(); worldNode->rotate(Ogre::Vector3::UNIT_X, Ogre::Degree(-90.0f)); string meshName; float fDrawDistance; bool bIsLod; Ogre::Vector3 position; Ogre::Quaternion rotation; ifstream sceneStream(sceneFile); // skip the title and the table title of the file string strline; int i = 0; while (!sceneStream.eof()) { getline(sceneStream, strline); if (strline.length() == 0) continue; std::istringstream ss(strline); std::string token; getline(ss, token, ','); boost::trim(token); meshName = token; getline(ss, token, ','); boost::trim(token); fDrawDistance = lexical_cast<float>(token); getline(ss, token, ','); boost::trim(token); bIsLod = lexical_cast<bool>(token); getline(ss, token, ','); boost::trim(token); position.x = lexical_cast<float>(token); getline(ss, token, ','); boost::trim(token); position.y = lexical_cast<float>(token); getline(ss, token, ','); boost::trim(token); position.z = lexical_cast<float>(token); getline(ss, token, ','); boost::trim(token); rotation.w = lexical_cast<float>(token); getline(ss, token, ','); boost::trim(token); rotation.x = lexical_cast<float>(token); getline(ss, token, ','); boost::trim(token); rotation.y = lexical_cast<float>(token); getline(ss, token, ','); boost::trim(token); rotation.z = lexical_cast<float>(token); Ogre::MeshPtr mesh; Ogre::Entity* entity; Ogre::Entity* realEntity = m_sceneMgr->createEntity(meshName); if (fDrawDistance > 300.0f && !bIsLod) continue; if (bIsLod) { mesh = Ogre::MeshManager::getSingleton().createManual(meshName + "lod" + std::to_string(i), "General"); // empty mesh mesh->createManualLodLevel(0, "NULL"); mesh->createManualLodLevel(700, meshName); mesh->_setBounds( realEntity->getMesh()->getBounds()); mesh->_setBoundingSphereRadius(realEntity->getMesh()->getBoundingSphereRadius()); mesh->load(); entity->setRenderingDistance(fDrawDistance); entity = m_sceneMgr->createEntity(mesh->getName()); } else { mesh = Ogre::MeshManager::getSingleton().getByName(meshName); entity = m_sceneMgr->createEntity(meshName); entity->setRenderingDistance(fDrawDistance); } m_sceneMgr->destroyEntity(realEntity); Ogre::SceneNode* sceneNode = worldNode->createChildSceneNode(); sceneNode->attachObject(entity); fix_gta_coord(rotation); sceneNode->rotate(rotation); sceneNode->setPosition(position); i++; } worldNode->setScale(5.0f, 5.0f, 5.0f); sceneStream.close(); Ogre::LogManager::getSingleton().setLogDetail(Ogre::LL_NORMAL); }
void RoR::GfxEnvmap::SetupEnvMap() { m_rtt_texture = Ogre::TextureManager::getSingleton().getByName("EnvironmentTexture"); for (int face = 0; face < NUM_FACES; face++) { m_render_targets[face] = m_rtt_texture->getBuffer(face)->getRenderTarget(); m_cameras[face] = gEnv->sceneManager->createCamera("EnvironmentCamera-" + TOSTRING(face)); m_cameras[face]->setAspectRatio(1.0); m_cameras[face]->setProjectionType(Ogre::PT_PERSPECTIVE); m_cameras[face]->setFixedYawAxis(false); m_cameras[face]->setFOVy(Ogre::Degree(90)); m_cameras[face]->setNearClipDistance(0.1f); m_cameras[face]->setFarClipDistance(gEnv->mainCamera->getFarClipDistance()); Ogre::Viewport* v = m_render_targets[face]->addViewport(m_cameras[face]); v->setOverlaysEnabled(false); v->setClearEveryFrame(true); v->setBackgroundColour(gEnv->mainCamera->getViewport()->getBackgroundColour()); m_render_targets[face]->setAutoUpdated(false); } m_cameras[0]->setDirection(+Ogre::Vector3::UNIT_X); m_cameras[1]->setDirection(-Ogre::Vector3::UNIT_X); m_cameras[2]->setDirection(+Ogre::Vector3::UNIT_Y); m_cameras[3]->setDirection(-Ogre::Vector3::UNIT_Y); m_cameras[4]->setDirection(-Ogre::Vector3::UNIT_Z); m_cameras[5]->setDirection(+Ogre::Vector3::UNIT_Z); if (App::diag_envmap.GetActive()) { // create fancy mesh for debugging the envmap Ogre::Overlay* overlay = Ogre::OverlayManager::getSingleton().create("EnvMapDebugOverlay"); if (overlay) { Ogre::Vector3 position = Ogre::Vector3::ZERO; float scale = 1.0f; Ogre::MeshPtr mesh = Ogre::MeshManager::getSingletonPtr()->createManual("cubeMapDebug", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); // create sub mesh Ogre::SubMesh* sub = mesh->createSubMesh(); // Initialize render operation sub->operationType = Ogre::RenderOperation::OT_TRIANGLE_LIST; // sub->useSharedVertices = true; mesh->sharedVertexData = new Ogre::VertexData; sub->indexData = new Ogre::IndexData; // Create vertex declaration size_t offset = 0; mesh->sharedVertexData->vertexDeclaration->addElement(0, offset, Ogre::VET_FLOAT3, Ogre::VES_POSITION); offset += Ogre::VertexElement::getTypeSize(Ogre::VET_FLOAT3); mesh->sharedVertexData->vertexDeclaration->addElement(0, offset, Ogre::VET_FLOAT3, Ogre::VES_TEXTURE_COORDINATES); // Create and bind vertex buffer mesh->sharedVertexData->vertexCount = 14; Ogre::HardwareVertexBufferSharedPtr vertexBuffer = Ogre::HardwareBufferManager::getSingleton().createVertexBuffer( mesh->sharedVertexData->vertexDeclaration->getVertexSize(0), mesh->sharedVertexData->vertexCount, Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY); mesh->sharedVertexData->vertexBufferBinding->setBinding(0, vertexBuffer); // Vertex data static const float vertexData[] = { // Position Texture coordinates // Index 0.0, 2.0, -1.0, 1.0, 1.0, // 0 0.0, 1.0, -1.0, -1.0, 1.0, // 1 1.0, 2.0, -1.0, 1.0, -1.0, // 2 1.0, 1.0, -1.0, -1.0, -1.0, // 3 2.0, 2.0, 1.0, 1.0, -1.0, // 4 2.0, 1.0, 1.0, -1.0, -1.0, // 5 3.0, 2.0, 1.0, 1.0, 1.0, // 6 3.0, 1.0, 1.0, -1.0, 1.0, // 7 4.0, 2.0, -1.0, 1.0, 1.0, // 8 4.0, 1.0, -1.0, -1.0, 1.0, // 9 1.0, 3.0, -1.0, 1.0, 1.0, // 10 2.0, 3.0, 1.0, 1.0, 1.0, // 11 1.0, 0.0, -1.0, -1.0, 1.0, // 12 2.0, 0.0, 1.0, -1.0, 1.0, // 13 }; // Fill vertex buffer float* pData = static_cast<float*>(vertexBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD)); for (size_t vertex = 0, i = 0; vertex < mesh->sharedVertexData->vertexCount; vertex++) { // Position *pData++ = position.x + scale * vertexData[i++]; *pData++ = position.y + scale * vertexData[i++]; *pData++ = 0.0; // Texture coordinates *pData++ = vertexData[i++]; *pData++ = vertexData[i++]; *pData++ = vertexData[i++]; } vertexBuffer->unlock(); // Create index buffer sub->indexData->indexCount = 36; Ogre::HardwareIndexBufferSharedPtr indexBuffer = Ogre::HardwareBufferManager::getSingleton().createIndexBuffer( Ogre::HardwareIndexBuffer::IT_16BIT, sub->indexData->indexCount, Ogre::HardwareBuffer::HBU_STATIC_WRITE_ONLY); sub->indexData->indexBuffer = indexBuffer; // Index data static const Ogre::uint16 indexData[] = { // Indices // Face 0, 1, 2, // 0 2, 1, 3, // 1 2, 3, 4, // 2 4, 3, 5, // 3 4, 5, 6, // 4 6, 5, 7, // 5 6, 7, 8, // 6 8, 7, 9, // 7 10, 2, 11, // 8 11, 2, 4, // 9 3, 12, 5, // 10 5, 12, 13, // 11 }; // Fill index buffer indexBuffer->writeData(0, indexBuffer->getSizeInBytes(), indexData, true); mesh->_setBounds(Ogre::AxisAlignedBox::BOX_INFINITE); mesh->_setBoundingSphereRadius(10); mesh->load(); Ogre::Entity* e = gEnv->sceneManager->createEntity(mesh->getName()); e->setCastShadows(false); e->setRenderQueueGroup(Ogre::RENDER_QUEUE_OVERLAY - 1); e->setVisible(true); e->setMaterialName("tracks/EnvMapDebug"); Ogre::SceneNode* mDebugSceneNode = new Ogre::SceneNode(gEnv->sceneManager); mDebugSceneNode->attachObject(e); mDebugSceneNode->setPosition(Ogre::Vector3(0, 0, -5)); mDebugSceneNode->setFixedYawAxis(true, Ogre::Vector3::UNIT_Y); mDebugSceneNode->setVisible(true); mDebugSceneNode->_update(true, true); mDebugSceneNode->_updateBounds(); overlay->add3D(mDebugSceneNode); overlay->show(); } } }
ReloadMeshQm(float prio, Ogre::MeshPtr meshpp) { this->priority = prio; this->meshP = meshpp; this->uniq = meshpp->getName(); }