本文整理汇总了C++中ogre::TextureUnitState::setTextureAnisotropy方法的典型用法代码示例。如果您正苦于以下问题:C++ TextureUnitState::setTextureAnisotropy方法的具体用法?C++ TextureUnitState::setTextureAnisotropy怎么用?C++ TextureUnitState::setTextureAnisotropy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::TextureUnitState
的用法示例。
在下文中一共展示了TextureUnitState::setTextureAnisotropy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createCubeMesh
//-------------------------------------------------------------------------------------
void BasicTutorial2::createScene(void)
{
mSceneMgr->setAmbientLight(Ogre::ColourValue(0, 0, 0));
//mSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_ADDITIVE);
//Create cube
//Create a basic green color texture
Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().create("BoxColor", "General", true );
Ogre::Technique* tech = mat->getTechnique(0);
Ogre::Pass* pass = tech->getPass(0);
Ogre::TextureUnitState* tex = pass->createTextureUnitState();
tex->setTextureName("grassTexture.png");
//tex->setNumMipmaps(4);
tex->setTextureAnisotropy(1);
tex->setTextureFiltering(Ogre::FO_POINT, Ogre::FO_POINT, Ogre::FO_POINT);
//Create the one box and the supporting class objects
Ogre::ManualObject* testBox = createCubeMesh("TestBox1", "BoxColor");
Ogre::SceneNode* headNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
Ogre::MeshPtr Mesh = testBox->convertToMesh("TestBox2");
Ogre::StaticGeometry* pGeom = new Ogre::StaticGeometry (mSceneMgr, "Boxes");
Ogre::Entity* pEnt = mSceneMgr->createEntity("TestBox2");
//testBox->triangle
pGeom->setRegionDimensions(Ogre::Vector3(300, 300, 300));
World::Instance();
pGeom->build ();
mSceneMgr->setAmbientLight(Ogre::ColourValue(0.5, 0.5, 0.5));
Ogre::Light* l = mSceneMgr->createLight("MainLight");
l->setPosition(20,80,50);
//Create Cube
/* Ogre::Entity* entNinja = mSceneMgr->createEntity("Ninja", "ninja.mesh");
entNinja->setCastShadows(true);
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(entNinja);*/
Ogre::Light* directionalLight = mSceneMgr->createLight("directionalLight");
directionalLight->setType(Ogre::Light::LT_DIRECTIONAL);
directionalLight->setDiffuseColour(Ogre::ColourValue(.25, .25, 0));
directionalLight->setSpecularColour(Ogre::ColourValue(.25, .25, 0));
directionalLight->setDirection(Ogre::Vector3( 0, -1, 1 ));
}
示例2: create
void UniversePlanet::create() {
Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().create("BoxColor", "General", true);
Ogre::Technique* tech = mat->getTechnique(0);
Ogre::Pass* pass = tech->getPass(0);
Ogre::TextureUnitState* tex = pass->createTextureUnitState();
tex->setTextureName("materials/textures/grass.png");
tex->setNumMipmaps(4);
tex->setTextureAnisotropy(1);
tex->setTextureFiltering(Ogre::FO_POINT, Ogre::FO_POINT, Ogre::FO_POINT);
ManualObject *meshChunk = new ManualObject("meshChunk_" + getName());
int iVertex = 0;
block_t currentBlock;
block_t nextBlock;
Ogre::Vector3 v;
meshChunk->begin("BoxColor");
for(int w = 0; w < 6; ++w)
for(int z = 0; z < mWorldHeight; ++z)
for(int y = 0; y < mWorldSize; ++y)
for(int x = 0; x < mWorldSize; ++x) {
currentBlock = getBlock(w, x, y, z);
if(currentBlock == 0) continue;
//x-1
nextBlock = 0;
nextBlock = getBlock(w, x - 1, y, z);
if(nextBlock == 0) {
meshChunk->position(map(w, x, y, z + 1));
meshChunk->textureCoord(0, 1);
meshChunk->position(map(w, x, y + 1, z + 1));
meshChunk->textureCoord(1, 1);
meshChunk->position(map(w, x, y + 1, z));
meshChunk->textureCoord(1, 0);
meshChunk->position(map(w, x, y, z));
meshChunk->textureCoord(0, 0);
if(w == 0 || w == 3 || w == 5) meshChunk->quad(iVertex + 3, iVertex + 2, iVertex + 1, iVertex);
else meshChunk->quad(iVertex, iVertex + 1, iVertex + 2, iVertex + 3);
iVertex += 4;
}
//x+1
nextBlock = 0;
nextBlock = getBlock(w, x + 1, y, z);
if(nextBlock == 0) {
meshChunk->position(map(w, x + 1, y, z));
meshChunk->textureCoord(0, 1);
meshChunk->position(map(w, x + 1, y + 1, z));
meshChunk->textureCoord(1, 1);
meshChunk->position(map(w, x + 1, y + 1, z + 1));
meshChunk->textureCoord(1, 0);
meshChunk->position(map(w, x + 1, y, z + 1));
meshChunk->textureCoord(0, 0);
if(w == 0 || w == 3 || w == 5) meshChunk->quad(iVertex + 3, iVertex + 2, iVertex + 1, iVertex);
else meshChunk->quad(iVertex, iVertex + 1, iVertex + 2, iVertex + 3);
iVertex += 4;
}
//y-1
nextBlock = 0;
nextBlock = getBlock(w, x, y - 1, z);
if(nextBlock == 0) {
meshChunk->position(map(w, x, y, z));
meshChunk->textureCoord(0, 1);
meshChunk->position(map(w, x + 1, y, z));
meshChunk->textureCoord(1, 1);
meshChunk->position(map(w, x + 1, y, z + 1));
meshChunk->textureCoord(1, 0);
meshChunk->position(map(w, x, y, z + 1));
meshChunk->textureCoord(0, 0);
if(w == 0 || w == 3 || w == 5) meshChunk->quad(iVertex + 3, iVertex + 2, iVertex + 1, iVertex);
else meshChunk->quad(iVertex, iVertex + 1, iVertex + 2, iVertex + 3);
iVertex += 4;
}
//y+1
nextBlock = 0;
nextBlock = getBlock(w, x, y + 1, z);
if(nextBlock == 0) {
meshChunk->position(map(w, x, y + 1, z + 1));
meshChunk->textureCoord(0, 1);
meshChunk->position(map(w, x + 1, y + 1, z + 1));
meshChunk->textureCoord(1, 1);
meshChunk->position(map(w, x + 1, y + 1, z));
meshChunk->textureCoord(1, 0);
meshChunk->position(map(w, x, y + 1, z));
meshChunk->textureCoord(0, 0);
//.........这里部分代码省略.........