当前位置: 首页>>代码示例>>C++>>正文


C++ TextureUnitState::setTextureAnisotropy方法代码示例

本文整理汇总了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 )); 
 
 
}
开发者ID:asvsfs,项目名称:TheJourney,代码行数:52,代码来源:BasicTutorial2.cpp

示例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);

//.........这里部分代码省略.........
开发者ID:arseniuss,项目名称:multiverse,代码行数:101,代码来源:UniversePlanet.cpp


注:本文中的ogre::TextureUnitState::setTextureAnisotropy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。