本文整理汇总了C++中SubEntity::getMaterial方法的典型用法代码示例。如果您正苦于以下问题:C++ SubEntity::getMaterial方法的具体用法?C++ SubEntity::getMaterial怎么用?C++ SubEntity::getMaterial使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SubEntity
的用法示例。
在下文中一共展示了SubEntity::getMaterial方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setHighlighted
void MeshObject::setHighlighted( bool highlight )
{
String nameExtension = "_HighLight";
Entity* ent = getEntity();
int numEnts = ent->getNumSubEntities();
for( int i = 0; i < numEnts; i++ )
{
SubEntity* subent = ent->getSubEntity(i);
if( subent == NULL )
continue;
// TODO - optimieren, nur wenn der Typ verändert wird
//if(StringUtil::endsWith(subent->getMaterialName(),nameExtension)
// == highlight )
// continue;
MaterialPtr oldMaterial = subent->getMaterial();
// Highlight setzen
if( highlight )
{
MaterialPtr material = MaterialManager::getSingleton().getByName( oldMaterial->getName()+nameExtension );
if( material.isNull() )
{
material = oldMaterial->clone( oldMaterial->getName()+nameExtension );
material->setAmbient(1.0, 1.0, 1.0);
material->setDiffuse(1.0, 1.0, 1.0, 1.0);
material->setSelfIllumination(0.4, 0.4, 0.4);
}
subent->setMaterialName(material->getName());
}
// Highlight entfernen
else
{
String matName = oldMaterial->getName();
matName = matName.erase(matName.length() - nameExtension.length(), nameExtension.length() );
subent->setMaterialName( matName );
}
}
}
示例2: prepareEntityForSkinning
//-----------------------------------------------------------------------
void HardwareSkinningFactory::prepareEntityForSkinning(const Entity* pEntity, SkinningType skinningType,
bool correctAntidpodalityHandling, bool shearScale)
{
if (pEntity != NULL)
{
size_t lodLevels = pEntity->getNumManualLodLevels() + 1;
for(size_t indexLod = 0 ; indexLod < lodLevels ; ++indexLod)
{
const Entity* pCurEntity = pEntity;
if (indexLod > 0) pCurEntity = pEntity->getManualLodLevel(indexLod - 1);
ushort boneCount = 0,weightCount = 0;
bool isValid = extractSkeletonData(pCurEntity,boneCount,weightCount);
unsigned int numSubEntities = pCurEntity->getNumSubEntities();
for(unsigned int indexSub = 0 ; indexSub < numSubEntities ; ++indexSub)
{
SubEntity* pSubEntity = pCurEntity->getSubEntity(indexSub);
const MaterialPtr& pMat = pSubEntity->getMaterial();
imprintSkeletonData(pMat, isValid, boneCount, weightCount, skinningType, correctAntidpodalityHandling, shearScale);
}
}
}
}
示例3: 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))
{