本文整理汇总了C++中ogre::MeshPtr::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshPtr::getName方法的具体用法?C++ MeshPtr::getName怎么用?C++ MeshPtr::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::MeshPtr
的用法示例。
在下文中一共展示了MeshPtr::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ListboxTextItem
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());
}
示例2: loadCorrelativeResource
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;
}
示例3: PrepareMesh
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();
}
示例4: _createIndicatorInstance
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;
}
示例5: DoReload
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?
*/
}
示例6: loadMesh
//-------------------------------------------------------------------------------------------
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()));
}
示例7: queueMeshUnload
// 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);
}
示例8: addMesh
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 );
}
示例9: exportMesh
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;
}
示例10: loadLod
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);
}
}
示例11: MeshShape
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;
}
示例12: resolveFilePathForMesh
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 "";
}
示例13: fillBuffer
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);
}
}
}
示例14: unloadTheMesh
// 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());
}
}
示例15: popMatrix
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());
}