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


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

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


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

示例1: _makeScene

  void  _makeScene()
  {
   mCamera->setNearClipDistance(1);
   mCamera->setFarClipDistance(1000);
   // Create the texture
   Ogre::TexturePtr texture = Ogre::TextureManager::getSingleton().createManual(
       "DynamicTexture", // name
       Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
       Ogre::TEX_TYPE_2D,      // type
       128, 128,         // width & height
       0,                // number of mipmaps
       Ogre::PF_BYTE_BGRA,     // pixel format
       Ogre::TU_DEFAULT);      // usage; should be TU_DYNAMIC_WRITE_ONLY_DISCARDABLE for
                         // textures updated very often (e.g. each frame)
    
   // Get the pixel buffer
   Ogre::HardwarePixelBufferSharedPtr pixelBuffer = texture->getBuffer();
    
   // Lock the pixel buffer and get a pixel box
   pixelBuffer->lock(Ogre::HardwareBuffer::HBL_NORMAL); // for best performance use HBL_DISCARD!
   const Ogre::PixelBox& pixelBox = pixelBuffer->getCurrentLock();
    
   Ogre::uint8* pDest = static_cast<Ogre::uint8*>(pixelBox.data);
    
   // Fill in some pixel data. This will give a semi-transparent blue,
   // but this is of course dependent on the chosen pixel format.
   for (size_t j = 0; j < 128; j++)
       for(size_t i = 0; i < 128; i++)
       {
        *pDest++ = 82  + (Ogre::Math::Sin(i) + Ogre::Math::Cos(j) * 10.5);
        *pDest++ = 45  + (Ogre::Math::Cos(i) + Ogre::Math::Sin(j) * 10.5);
        *pDest++ = 128 + (Ogre::Math::Tan(i) + Ogre::Math::Cos(j) * 10.5);
        *pDest++ = 255; // A
       }
    
   // Unlock the pixel buffer
   pixelBuffer->unlock();
    
   // Create a material using the texture
   Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().create(
       "DynamicTextureMaterial", // name
       Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    
   Ogre::TextureUnitState* tus = material->getTechnique(0)->getPass(0)->createTextureUnitState("DynamicTexture");
   tus->setScrollAnimation(0.005f, 0.0025f);
   tus->setRotateAnimation(0.009f);
   material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
   
   Ogre::Plane plane(Ogre::Vector3::UNIT_Y, 0);
   
    Ogre::MeshManager::getSingleton().createPlane("ground", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
        plane, 1500, 1500, 1, 1, true, 1, 1, 1, Ogre::Vector3::UNIT_Z);
    
    Ogre::Entity* entGround = mSceneMgr->createEntity("GroundEntity", "ground");
    mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(entGround);
    
    entGround->setMaterialName("DynamicTextureMaterial");
    entGround->setCastShadows(false);

   mCamera->setPosition(25,100,30);
   mCamera->lookAt(0,0,0);
  }
开发者ID:jlsandell,项目名称:gorilla,代码行数:62,代码来源:gorilla_ogreconsole.cpp


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