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


C++ Texture::Envmap方法代码示例

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


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

示例1: Setup

//----------------------------------------------------------------------------
bool EnvironmentMaps::Setup ()
{
    // load model
    m_spkScene = new Node(1);
    m_spkTrnNode = new Node(1);
    m_spkScene->AttachChild(m_spkTrnNode);

    Stream kStream;
    bool bLoaded = kStream.Load("Face.mgc");
    if ( !bLoaded )
        return false;
    m_spkModel = (Node*) kStream.GetObjectAt(0);

    m_spkTrnNode->AttachChild(m_spkModel);

    // attach environment map
    Image* pkImage = Image::Load("SphereMap.mif");
    if ( !pkImage )
        return false;

    Texture* pkTexture = new Texture;
    pkTexture->SetImage(pkImage);
    pkTexture->Filter() = Texture::FM_LINEAR;
    pkTexture->Mipmap() = Texture::MM_NONE;
    pkTexture->Apply() = Texture::AM_DECAL;
    pkTexture->Envmap() = Texture::EM_SPHERE;
    TextureState* pkTS = new TextureState;
    pkTS->Set(0,pkTexture);
    m_spkModel->SetRenderState(pkTS);

    return true;
}
开发者ID:Hengplank,项目名称:kucgbowling,代码行数:33,代码来源:EnvironmentMaps.cpp

示例2: CreateSnakeBody

//----------------------------------------------------------------------------
void WrigglingSnake::CreateSnakeBody ()
{
    // create the B-spline curve for the snake body
    Vector3f* akCtrl = new Vector3f[m_iNumCtrl];
    int i;
    for (i = 0; i < m_iNumCtrl; i++)
    {
        // control points for a snake
        float fRatio = ((float)i)/(float)(m_iNumCtrl-1);
        float fX = -1.0f + 2.0f*fRatio;
        float fXMod = 10.0f*fX - 4.0f;
        akCtrl[i].X() = fX;
        akCtrl[i].Y() = ms_fRadius*(1.5f + Mathf::ATan(fXMod)/Mathf::PI);
        akCtrl[i].Z() = 0.0f;

        // sinusoidal motion for snake
        m_afAmplitude[i] = 0.1f+fRatio*Mathf::Exp(-fRatio);
        m_afPhase[i] = 1.5f*fRatio*Mathf::TWO_PI;
    }

    // the control points are copied by the curve objects
    m_pkCenter = new BSplineCurve3f(m_iNumCtrl,akCtrl,m_iDegree,false,true);
    delete[] akCtrl;

    // generate a tube surface
    bool bClosed = false;
    Vector3f kUpVector = Vector3f::UNIT_Y;
    int iMedialSamples = 128;
    int iSliceSamples = 32;
    bool bWantNormals = true;
    bool bWantColors = false;
    bool bSampleByArcLength = false;
    bool bInsideView = false;
    Vector2f kTextureMin(0.0f,0.0f), kTextureMax(1.0f,16.0f);

    m_spkSnakeBody = new TubeSurface(m_pkCenter,Radial,bClosed,kUpVector,
        iMedialSamples,iSliceSamples,bWantNormals,bWantColors,
        bSampleByArcLength,bInsideView,&kTextureMin,&kTextureMax);

    // attach a texture for the snake body
    Texture* pkTexture = new Texture;
    pkTexture->SetImage(Image::Load("snake.mif"));
    pkTexture->Filter() = Texture::FM_LINEAR;
    pkTexture->Mipmap() = Texture::MM_LINEAR_LINEAR;
    pkTexture->Apply() = Texture::AM_REPLACE;
    pkTexture->Wrap() = Texture::WM_WRAP_S_WRAP_T;
    TextureState* pkTS = new TextureState;
    pkTS->Set(0,pkTexture);
    //m_spkSnakeBody->SetRenderState(pkTS);

    // Set up a light map to add to the current color.
    pkTexture = new Texture;
    pkTexture->SetImage(Image::Load("LightMap.mif"));
    pkTexture->Filter() = Texture::FM_LINEAR;
    pkTexture->Mipmap() = Texture::MM_LINEAR_LINEAR;
    pkTexture->Apply() = Texture::AM_ADD;
    pkTexture->Envmap() = Texture::EM_SPHERE;
    pkTS->Set(1,pkTexture);
    m_spkSnakeBody->SetRenderState(pkTS);


    m_spkSnakeRoot->AttachChild(m_spkSnakeBody);
}
开发者ID:Hengplank,项目名称:kucgbowling,代码行数:64,代码来源:WrigglingSnake.cpp


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