本文整理汇总了C++中TextureUnitState::setTextureVScroll方法的典型用法代码示例。如果您正苦于以下问题:C++ TextureUnitState::setTextureVScroll方法的具体用法?C++ TextureUnitState::setTextureVScroll怎么用?C++ TextureUnitState::setTextureVScroll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextureUnitState
的用法示例。
在下文中一共展示了TextureUnitState::setTextureVScroll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loader
//Do not use this constructor yourself - instead, call getTexture()
//to get/create an ImpostorTexture for an Entity.
ImpostorTexture::ImpostorTexture(ImpostorPage *group, Entity *entity)
: loader(0)
{
//Store scene manager and entity
ImpostorTexture::sceneMgr = group->sceneMgr;
ImpostorTexture::entity = entity;
ImpostorTexture::group = group;
//Add self to list of ImpostorTexture's
entityKey = ImpostorBatch::generateEntityKey(entity);
typedef std::pair<String, ImpostorTexture *> ListItem;
selfList.insert(ListItem(entityKey, this));
//Calculate the entity's bounding box and it's diameter
boundingBox = entity->getBoundingBox();
//Note - this radius calculation assumes the object is somewhat rounded (like trees/rocks/etc.)
Real tmp;
entityRadius = boundingBox.getMaximum().x - boundingBox.getCenter().x;
tmp = boundingBox.getMaximum().y - boundingBox.getCenter().y;
if (tmp > entityRadius) entityRadius = tmp;
tmp = boundingBox.getMaximum().z - boundingBox.getCenter().z;
if (tmp > entityRadius) entityRadius = tmp;
entityDiameter = 2.0f * entityRadius;
entityCenter = boundingBox.getCenter();
//Render impostor textures
renderTextures(false);
//Set up materials
for (int o = 0; o < IMPOSTOR_YAW_ANGLES; ++o){
for (int i = 0; i < IMPOSTOR_PITCH_ANGLES; ++i){
material[i][o] = MaterialManager::getSingleton().create(getUniqueID("ImpostorMaterial"), "Impostors");
Material *m = material[i][o].getPointer();
Pass *p = m->getTechnique(0)->getPass(0);
TextureUnitState *t = p->createTextureUnitState(texture->getName());
t->setTextureUScroll((float)o / IMPOSTOR_YAW_ANGLES);
t->setTextureVScroll((float)i / IMPOSTOR_PITCH_ANGLES);
p->setLightingEnabled(false);
m->setReceiveShadows(false);
if (group->getBlendMode() == ALPHA_REJECT_IMPOSTOR){
p->setAlphaRejectSettings(CMPF_GREATER_EQUAL, 128);
//p->setAlphaRejectSettings(CMPF_GREATER_EQUAL, 64);
} else if (group->getBlendMode() == ALPHA_BLEND_IMPOSTOR){
p->setSceneBlending(SBF_SOURCE_ALPHA, SBF_ONE_MINUS_SOURCE_ALPHA);
p->setDepthWriteEnabled(false);
}
}
}
}
示例2: if
//Do not use this constructor yourself - instead, call getTexture()
//to get/create an ImpostorTexture for an Entity.
ImpostorTexture::ImpostorTexture(ImpostorPage *group, Entity *entity) :
loader(0)
{
//Store scene manager and entity
ImpostorTexture::sceneMgr = group->getParentPagedGeometry()->getSceneManager();
ImpostorTexture::entity = entity;
ImpostorTexture::group = group;
//Add self to list of ImpostorTexture's
entityKey = ImpostorBatch::generateEntityKey(entity);
typedef std::pair<String, ImpostorTexture *> ListItem;
selfList.insert(ListItem(entityKey, this));
//Calculate the entity's bounding box and it's diameter
boundingBox = entity->getBoundingBox();
entityRadius = Math::boundingRadiusFromAABB(boundingBox);
entityDiameter = 2.0f * entityRadius;
entityCenter = boundingBox.getCenter();
//Render impostor textures
renderTextures(false);
//Set up materials
for (int o = 0; o < IMPOSTOR_YAW_ANGLES; ++o){
for (int i = 0; i < IMPOSTOR_PITCH_ANGLES; ++i){
#if OGRE_VERSION_MAJOR <= 1
#if OGRE_VERSION_MINOR <= 8
material[i][o] = MaterialManager::getSingleton().create(getUniqueID("ImpostorMaterial"), "Impostors");
#else
material[i][o] = MaterialManager::getSingleton().create(getUniqueID("ImpostorMaterial"), "Impostors").staticCast<Ogre::Material>();
#endif
#endif
Material *m = material[i][o].getPointer();
Pass *p = m->getTechnique(0)->getPass(0);
TextureUnitState *t = p->createTextureUnitState(texture->getName());
t->setTextureUScroll((float)o / IMPOSTOR_YAW_ANGLES);
t->setTextureVScroll((float)i / IMPOSTOR_PITCH_ANGLES);
p->setLightingEnabled(false);
m->setReceiveShadows(false);
if (group->getBlendMode() == ALPHA_REJECT_IMPOSTOR){
p->setAlphaRejectSettings(CMPF_GREATER_EQUAL, 128);
//p->setAlphaRejectSettings(CMPF_GREATER_EQUAL, 64);
} else if (group->getBlendMode() == ALPHA_BLEND_IMPOSTOR){
p->setSceneBlending(SBF_SOURCE_ALPHA, SBF_ONE_MINUS_SOURCE_ALPHA);
p->setDepthWriteEnabled(false);
}
}
}
}