本文整理汇总了C++中SubEntity::getMaterialName方法的典型用法代码示例。如果您正苦于以下问题:C++ SubEntity::getMaterialName方法的具体用法?C++ SubEntity::getMaterialName怎么用?C++ SubEntity::getMaterialName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SubEntity
的用法示例。
在下文中一共展示了SubEntity::getMaterialName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void OgreSample13App::setupInstancedMaterialToEntity(Ogre::Entity *ent)
{
for (Ogre::uint i=0;i<ent->getNumSubEntities();++i)
{
SubEntity * se = ent->getSubEntity(i);
String materialName = se->getMaterialName();
se->setMaterialName(buildInstancedMaterial(materialName));
}
}
示例2: OnMouseMove
int MultiPlayChapter::OnMouseMove(int x, int y)
{
if( m_pkThirdCube->IsWait() )
return 0;
if( g_nMouseState & 1 )
{
//Ray mouseRay = m_pkCamera->getCameraToViewportRay((float)x/m_pkWindow->getWidth(), (float)y/m_pkWindow->getHeight());
Ray mouseRay = m_pkCamera->getCameraToViewportRay((float)(x-(m_pkWindow->getWidth()*0.25f))/m_pkViewport->getActualWidth(), (float)y/m_pkViewport->getActualHeight());
Entity *target;
float dis;
int subIndex = -1;
Vector3 result;
if( m_pkCollisionTools->raycastFromPoint(mouseRay.getOrigin(), mouseRay.getDirection(), result, target, dis, subIndex) )
{
if( m_currentEntity == target )
return 0;
if( m_currentEntity )
{
m_pkMIManager->SetTransparency(m_currentEntity, 0.4f, m_nCurrentSubIndex);
m_currentEntity = 0;
}
SubEntity *subEntity = target->getSubEntity(subIndex);
if( subEntity->getMaterialName().substr(0,10) == "07-Default" )
return 0;
for(int i=0; i<4; ++i)
{
if( target == m_pkMaterialChange[i] && subIndex == m_nMaterialChangeIndex[i] )
{
m_currentEntity = target;
m_nCurrentSubIndex = subIndex;
m_nCurrentMOC = result;
}
}
if( m_currentEntity == 0 )
return 0;
m_pkMIManager->ChangeOriginalMaterial(m_currentEntity, subIndex);
}
}
return 0;
}
示例3: OnMouseClick
int MultiPlayChapter::OnMouseClick(int x, int y, unsigned short nButton, unsigned short nModifier)
{
if( m_pkThirdCube->IsWait() )
return 0;
switch( nButton )
{
case 0:
{
ShowCursor(true);
if( m_pkThirdCube->IsShuffle() )
break;
Ray mouseRay = m_pkCamera->getCameraToViewportRay((float)(x-(m_pkWindow->getWidth()*0.25f))/m_pkViewport->getActualWidth(), (float)y/m_pkViewport->getActualHeight());
Entity *target;
float dis;
int subIndex = 0;
Vector3 result;
if( m_pkCollisionTools->raycastFromPoint(mouseRay.getOrigin(), mouseRay.getDirection(), result, target, dis, subIndex) )
{
SubEntity *subEntity = target->getSubEntity(subIndex);
if( subEntity->getMaterialName() == "07-Default" )
break;
String tmp = target->getParentNode()->getName();
int dumiIndex = Ogre::StringConverter::parseInt(tmp.substr(5,2));
m_pkThirdCube->InputFirstSelect(dumiIndex-1, result);
Vector3 dumi(m_pkThirdCube->GetDumiPos(dumiIndex-1));
int axis=0;
float x, y, z;
x = result.x<0?result.x*-1: result.x;
y = result.y<0?result.y*-1: result.y;
z = result.z<0?result.z*-1: result.z;
for(int i=0; i<27; ++i)
{
Entity *entity = m_pkThirdCube->GetBoxEntity(i);
m_pkMIManager->AddData(new MIManagerData(entity, new EntityMaterialInstance(entity)));
}
Vector3 Ray1[2] = { Vector3(dumi), Vector3(dumi) };
Vector3 Ray2[2] = { Vector3(dumi), Vector3(dumi) };
Vector3 dir(Vector3::ZERO);
if( x > 15.4f )
axis = 1;
else if( y > 15.4f )
axis = 2;
else if( z > 15.4f )
axis = 3;
switch( axis )
{
case 1:
{
dir.x = result.x<0?1.0f:-1.0f;
Ray1[0].x = dumi.x<0?dumi.x-10.0f: dumi.x+10.0f;
Ray1[1].x = Ray1[0].x;
Ray2[0].x = Ray1[0].x;
Ray2[1].x = Ray1[0].x;
if( dumi.y == 0 )
{
Ray1[0].y = dumi.y+10.5f;
Ray1[1].y = dumi.y-10.5f;
}
else if( dumi.y > 0 )
{
Ray1[0].y = dumi.y-10.5f;
Ray1[1].y = dumi.y-21.0f;
}
else if( dumi.y < 0 )
{
Ray1[0].y = dumi.y+10.5f;
Ray1[1].y = dumi.y+21.0f;
}
if( dumi.z == 0 )
{
Ray2[0].z = dumi.z+10.5f;
Ray2[1].z = dumi.z-10.5f;
}
else if( dumi.z > 0 )
{
Ray2[0].z = dumi.z-10.5f;
Ray2[1].z = dumi.z-21.0f;
}
else if( dumi.z < 0 )
{
Ray2[0].z = dumi.z+10.5f;
Ray2[1].z = dumi.z+21.0f;
}
}
break;
case 2:
{
dir.y = result.y<0?1.0f:-1.0f;
Ray1[0].y = dumi.y<0?dumi.y-10.0f: dumi.y+10.0f;
Ray1[1].y = Ray1[0].y;
Ray2[0].y = Ray1[0].y;
Ray2[1].y = Ray1[0].y;
if( dumi.x == 0 )
{
//.........这里部分代码省略.........
示例4: loadObject
//.........这里部分代码省略.........
String entityName = "object" + TOSTRING(objcounter) + "(" + name + ")";
objcounter++;
SceneNode *tenode = gEnv->sceneManager->getRootSceneNode()->createChildSceneNode();
bool background_loading = BSETTING("Background Loading", false);
MeshObject *mo = NULL;
if (String(mesh) != "none")
{
mo = new MeshObject(mesh, entityName, tenode, NULL, background_loading);
}
//mo->setQueryFlags(OBJECTS_MASK);
//tenode->attachObject(te);
tenode->setScale(sc);
tenode->setPosition(pos);
tenode->rotate(rotation);
tenode->pitch(Degree(-90));
tenode->setVisible(true);
// register in map
loadedObject_t *obj = &loadedObjects[instancename];
obj->instanceName = instancename;
obj->loadType = 0;
obj->enabled = true;
obj->sceneNode = tenode;
obj->collTris.clear();
if (mo && uniquifyMaterial && !instancename.empty())
{
for (unsigned int i = 0; i < mo->getEntity()->getNumSubEntities(); i++)
{
SubEntity *se = mo->getEntity()->getSubEntity(i);
String matname = se->getMaterialName();
String newmatname = matname + "/" + instancename;
//LOG("subentity " + TOSTRING(i) + ": "+ matname + " -> " + newmatname);
se->getMaterial()->clone(newmatname);
se->setMaterialName(newmatname);
}
}
//String meshGroup = ResourceGroupManager::getSingleton().findGroupContainingResource(mesh);
//MeshPtr mainMesh = mo->getMesh();
//collision box(es)
bool virt=false;
bool rotating=false;
bool classic_ref=true;
// everything is of concrete by default
ground_model_t *gm = gEnv->collisions->getGroundModelByString("concrete");
char eventname[256] = {};
while (!ds->eof())
{
size_t ll=ds->readLine(line, 1023);
// little workaround to trim it
String lineStr = String(line);
Ogre::StringUtil::trim(lineStr);
const char* ptline = lineStr.c_str();
if (ll==0 || line[0]=='/' || line[0]==';') continue;
if (!strcmp("end",ptline)) break;
if (!strcmp("movable", ptline)) {ismovable=true;continue;};
if (!strcmp("localizer-h", ptline))
{