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


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

本文整理汇总了C++中ogre::TextureUnitState::setNumMipmaps方法的典型用法代码示例。如果您正苦于以下问题:C++ TextureUnitState::setNumMipmaps方法的具体用法?C++ TextureUnitState::setNumMipmaps怎么用?C++ TextureUnitState::setNumMipmaps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ogre::TextureUnitState的用法示例。


在下文中一共展示了TextureUnitState::setNumMipmaps方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CreateVertexBuffers

//------------------------------------------------------------------------------
Background2D::Background2D():
    m_AlphaMaxVertexCount( 0 ),
    m_AddMaxVertexCount( 0 ),

    m_ScrollEntity( NULL ),
    m_ScrollPositionStart( Ogre::Vector2::ZERO ),
    m_ScrollPositionEnd( Ogre::Vector2::ZERO ),
    m_ScrollType( Background2D::NONE ),
    m_ScrollSeconds( 0 ),
    m_ScrollCurrentSeconds( 0 ),
    m_Position( Ogre::Vector2::ZERO ),
    m_PositionReal( Ogre::Vector2::ZERO )

   ,m_range( Ogre::AxisAlignedBox::BOX_INFINITE )
    // for ffvii
   ,m_virtual_screen_size( 320, 240 )
{
    m_SceneManager = Ogre::Root::getSingleton().getSceneManager( "Scene" );
    m_RenderSystem = Ogre::Root::getSingletonPtr()->getRenderSystem();

    CreateVertexBuffers();

    m_AlphaMaterial = Ogre::MaterialManager::getSingleton().create( "Background2DAlpha", "General" );
    Ogre::Pass* pass = m_AlphaMaterial->getTechnique( 0 )->getPass( 0 );
    pass->setVertexColourTracking( Ogre::TVC_AMBIENT );
    pass->setCullingMode( Ogre::CULL_NONE );
    pass->setDepthCheckEnabled( true );
    pass->setDepthWriteEnabled( true );
    pass->setLightingEnabled( false );
    pass->setSceneBlending( Ogre::SBT_TRANSPARENT_ALPHA );
    pass->setAlphaRejectFunction( Ogre::CMPF_GREATER );
    pass->setAlphaRejectValue( 0 );
    Ogre::TextureUnitState* tex = pass->createTextureUnitState();
    tex->setTextureName( "system/blank.png" );
    tex->setNumMipmaps( -1 );
    tex->setTextureFiltering( Ogre::TFO_NONE );

    m_AddMaterial = Ogre::MaterialManager::getSingleton().create( "Background2DAdd", "General" );
    pass = m_AddMaterial->getTechnique( 0 )->getPass( 0 );
    pass->setVertexColourTracking( Ogre::TVC_AMBIENT );
    pass->setCullingMode( Ogre::CULL_NONE );
    pass->setDepthCheckEnabled( true );
    pass->setDepthWriteEnabled( true );
    pass->setLightingEnabled( false );
    pass->setSceneBlending( Ogre::SBT_ADD );
    pass->setAlphaRejectFunction( Ogre::CMPF_GREATER );
    pass->setAlphaRejectValue( 0 );
    tex = pass->createTextureUnitState();
    tex->setTextureName( "system/blank.png" );
    tex->setNumMipmaps( -1 );
    tex->setTextureFiltering( Ogre::TFO_NONE );

    m_SceneManager->addRenderQueueListener( this );
}
开发者ID:DeejStar,项目名称:q-gears,代码行数:55,代码来源:Background2D.cpp

示例2: CreateRenderTargetOverlay

void RenderWindow::CreateRenderTargetOverlay(int width, int height)
{
    width = max(1, width);
    height = max(1, height);

    Ogre::TexturePtr renderTarget = Ogre::TextureManager::getSingleton().createManual(
        rttTextureName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
        Ogre::TEX_TYPE_2D, width, height, 0, Ogre::PF_A8R8G8B8, Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE);

    Ogre::MaterialPtr rttMaterial = Ogre::MaterialManager::getSingleton().create(
        rttMaterialName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);

    Ogre::TextureUnitState *rttTuState = rttMaterial->getTechnique(0)->getPass(0)->createTextureUnitState();

    rttTuState->setTextureName(rttTextureName);
    rttTuState->setTextureFiltering(Ogre::TFO_NONE);
    rttTuState->setNumMipmaps(1);
    rttTuState->setTextureAddressingMode(Ogre::TextureUnitState::TAM_CLAMP);

    rttMaterial->setFog(true, Ogre::FOG_NONE); ///\todo Check, shouldn't here be false?
    rttMaterial->setReceiveShadows(false);
    rttMaterial->setTransparencyCastsShadows(false);

    rttMaterial->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBF_SOURCE_ALPHA, Ogre::SBF_ONE_MINUS_SOURCE_ALPHA);
    rttMaterial->getTechnique(0)->getPass(0)->setDepthWriteEnabled(false);
    rttMaterial->getTechnique(0)->getPass(0)->setDepthCheckEnabled(false);
    rttMaterial->getTechnique(0)->getPass(0)->setLightingEnabled(false);
    rttMaterial->getTechnique(0)->getPass(0)->setCullingMode(Ogre::CULL_NONE);

    overlayContainer = Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "MainWindow Overlay Panel");
    overlayContainer->setMaterialName(rttMaterialName);
    overlayContainer->setMetricsMode(Ogre::GMM_PIXELS);
    overlayContainer->setPosition(0, 0);
    overlayContainer->setDimensions((Ogre::Real)width, (Ogre::Real)height);
    overlayContainer->setPosition(0,0);

    overlay = Ogre::OverlayManager::getSingleton().create("MainWindow Overlay");
    overlay->add2D(static_cast<Ogre::OverlayContainer *>(overlayContainer));
    overlay->setZOrder(500);
    overlay->show();

//    ResizeOverlay(width, height);
}
开发者ID:katik,项目名称:naali,代码行数:43,代码来源:RenderWindow.cpp

示例3: textureName

CRosRttTexture::CRosRttTexture(unsigned width, unsigned height, Ogre::Camera * camera, bool isDepth /*= false*/ )
: m_materialName("MyRttMaterial")
, width_(width)
, height_(height)
, frame_("/map")
, m_bIsDepth( isDepth )
{
  assert( height > 0 && width > 0 );

  {
    // Set encoding
    current_image_.encoding = ROS_IMAGE_FORMAT;

    // Set image size
    current_image_.width = width;
    current_image_.height = height;

    // Set image row length in bytes (row length * 3 bytes for a color)
    current_image_.step = width * BPP;

#if OGRE_ENDIAN == ENDIAN_BIG
    current_image_.is_bigendian = true;
#else
        current_image_.is_bigendian = false;
#endif

    // Resize data
    current_image_.data.resize( width_ * height_ * BPP);

  }

  Ogre::TextureManager & lTextureManager( Ogre::TextureManager::getSingleton() );
  Ogre::String textureName("RVIZ_CamCast_Texture");
  bool lGammaCorrection( false );
  unsigned int lAntiAliasing( 0 );
  unsigned int lNumMipmaps( 0 );

  if( isDepth )
  {
	  texture_ = lTextureManager.createManual(textureName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
		  Ogre::TEX_TYPE_2D, width, height, lNumMipmaps,
		  OGRE_DEPTH_TEXTURE_FORMAT, Ogre::TU_RENDERTARGET, 0, lGammaCorrection, lAntiAliasing);
  }
  else
  {
	  texture_ = lTextureManager.createManual(textureName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
	  		  Ogre::TEX_TYPE_2D, width, height, lNumMipmaps,
	  		  OGRE_TEXTURE_FORMAT, Ogre::TU_RENDERTARGET, 0, lGammaCorrection, lAntiAliasing);
  }

  // Create render target
  Ogre::RenderTexture* lRenderTarget = NULL;

  Ogre::HardwarePixelBufferSharedPtr lRttBuffer = texture_->getBuffer();
  lRenderTarget = lRttBuffer->getRenderTarget();
  lRenderTarget->setAutoUpdated(true);

  // Create and attach viewport

  Ogre::Viewport* lRttViewport1 = lRenderTarget->addViewport(camera, 50, 0.00f, 0.00f, 1.0f, 1.0f);
  lRttViewport1->setAutoUpdated(true);
  Ogre::ColourValue lBgColor1(0.0,0.0,0.0,1.0);
  lRttViewport1->setBackgroundColour(lBgColor1);

  // create a material using this texture.

  //Get a reference on the material manager, which is a singleton.
  Ogre::MaterialManager& lMaterialManager = Ogre::MaterialManager::getSingleton();
  Ogre::MaterialPtr lMaterial = lMaterialManager.create(m_materialName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
  Ogre::Technique * lTechnique = lMaterial->getTechnique(0);
  Ogre::Pass* lPass = lTechnique->getPass(0);

  if( isDepth )
  {
	  lPass->setLightingEnabled(false);
  }

  Ogre::TextureUnitState* lTextureUnit = lPass->createTextureUnitState();
  lTextureUnit->setTextureName(textureName);

  lTextureUnit->setNumMipmaps(0);
  lTextureUnit->setTextureFiltering(Ogre::TFO_BILINEAR);

  update();
}
开发者ID:Praveen-Ramanujam,项目名称:srs_public,代码行数:85,代码来源:ros_rtt_texture.cpp

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