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


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

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


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

示例1: CreateCloth

//----------------------------------------------------------------------------
void Cloth::CreateCloth ()
{
    // create quadratic spline using particles as control points
    m_pkSpline = new BSplineRectanglef(m_pkModule->GetRows(),
        m_pkModule->GetCols(),m_pkModule->Positions2D(),2,2,false,false,
        true,true);

    // generate a rectangle surface
    int iUSamples = 16;
    int iVSamples = 32;
    bool bWantNormals = false;
    bool bWantColors = false;
    bool bDoubleSided = true;
    Vector2f kTextureMin(0.0f,0.0f), kTextureMax(1.0f,1.0f);
    m_spkCloth = new RectangleSurface(m_pkSpline,iUSamples,iVSamples,
        bWantNormals,bWantColors,bDoubleSided,&kTextureMin,&kTextureMax);

    // attach a texture for the surface
    Texture* pkTexture = new Texture;
    pkTexture->SetImage(Image::Load("purplecloth.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_spkCloth->SetRenderState(pkTS);

    m_spkTrnNode->AttachChild(m_spkCloth);
}
开发者ID:Hengplank,项目名称:kucgbowling,代码行数:31,代码来源:Cloth.cpp

示例2: 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

示例3: CreateGround

//----------------------------------------------------------------------------
TriMesh* BallHill::CreateGround ()
{
    TriMesh* pkGround = NULL;
    CreateRectangleMesh(pkGround,Vector3f::ZERO,Vector3f::UNIT_X,
        Vector3f::UNIT_Y,Vector3f::UNIT_Z,32.0f,32.0f,false,false,true);
    m_spkGround = pkGround;

    // change the texture repeat
    int iVQuantity = m_spkGround->GetVertexQuantity();
    Vector2f* akUV = m_spkGround->Textures();
    for (int i = 0; i < iVQuantity; i++)
        akUV[i] *= 8.0f;

    Texture* pkTexture = new Texture;
    pkTexture->SetImage(Image::Load("grass.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_spkGround->SetRenderState(pkTS);

    return pkGround;
}
开发者ID:Hengplank,项目名称:kucgbowling,代码行数:26,代码来源:BallHill.cpp

示例4: CreateSphere

//----------------------------------------------------------------------------
void GelatinBlob::CreateSphere ()
{
    TriMesh* pkMesh = NULL;
    bool bWantNormals = false;
    bool bWantColors = false;
    bool bWantUVs = true;
    bool bOutsideView = true;
    CreateIcosahedronMesh(pkMesh,bWantNormals,bWantColors,bWantUVs,
        bOutsideView);

    m_spkSphere = pkMesh;

    // texture for the water objects
    Texture* pkTexture = new Texture;
    pkTexture->SetImage(Image::Load("WaterA.mif"));
    pkTexture->Filter() = Texture::FM_LINEAR;
    pkTexture->Mipmap() = Texture::MM_LINEAR_LINEAR;
    pkTexture->Wrap() = Texture::WM_WRAP_S_WRAP_T;
    TextureState* pkTS = new TextureState;
    pkTS->Set(0,pkTexture);
    m_spkSphere->SetRenderState(pkTS);

    // the texture has an alpha channel of 1/2
    AlphaState* pkAS = new AlphaState;
    pkAS->BlendEnabled() = true;
    m_spkSphere->SetRenderState(pkAS);
}
开发者ID:Hengplank,项目名称:kucgbowling,代码行数:28,代码来源:GelatinBlob.cpp

示例5: CreateBox

//----------------------------------------------------------------------------
void GelatinCube::CreateBox ()
{
    // Create a quadratic spline using the interior particles as control
    // points.
    int iSlices = m_pkModule->GetSlices()-2;
    int iRows = m_pkModule->GetRows()-2;
    int iCols = m_pkModule->GetCols()-2;
    m_pkSpline = new BSplineVolumef(iCols,iRows,iSlices,2,2,2);

    for (int iSlice = 0; iSlice < iSlices; iSlice++)
    {
        for (int iRow = 0; iRow < iRows; iRow++)
        {
            for (int iCol = 0; iCol < iCols; iCol++)
            {
                m_pkSpline->ControlPoint(iCol,iRow,iSlice) =
                    m_pkModule->Position(iSlice+1,iRow+1,iCol+1);
            }
        }
    }

    // generate a rectangle surface
    int iUSamples = 8;
    int iVSamples = 8;
    int iWSamples = 8;
    bool bWantNormals = false;
    bool bWantColors = false;
    bool bWantTextures = true;
    m_spkBox = new BoxSurface(m_pkSpline,iUSamples,iVSamples,iWSamples,
        bWantNormals,bWantColors,bWantTextures);

    // texture for the water objects
    Texture* pkTexture = new Texture;
    pkTexture->SetImage(Image::Load("WaterA.mif"));
    pkTexture->Filter() = Texture::FM_LINEAR;
    pkTexture->Mipmap() = Texture::MM_LINEAR_LINEAR;
    pkTexture->Wrap() = Texture::WM_WRAP_S_WRAP_T;
    TextureState* pkTS = new TextureState;
    pkTS->Set(0,pkTexture);
    m_spkBox->SetRenderState(pkTS);

    // the texture has an alpha channel of 1/2
    AlphaState* pkAS = new AlphaState;
    pkAS->BlendEnabled() = true;
    m_spkBox->SetRenderState(pkAS);

    m_spkBox->EnableSorting();

    m_spkTrnNode->AttachChild(m_spkBox);
}
开发者ID:Hengplank,项目名称:kucgbowling,代码行数:51,代码来源:GelatinCube.cpp

示例6: CreateWall

//----------------------------------------------------------------------------
void WaterDropFormation::CreateWall ()
{
    // generate the wall
    TriMesh* pkMesh = NULL;
    CreateRectangleMesh(pkMesh,Vector3f(-8.0f,0.0f,8.0f),Vector3f::UNIT_Y,
        Vector3f::UNIT_Z,Vector3f::UNIT_X,16.0f,8.0f,false,false,true);
    m_spkWall = pkMesh;

    // add a texture to the wall
    Texture* pkTexture = new Texture;
    pkTexture->SetImage(Image::Load("stone.mif"));
    pkTexture->Filter() = Texture::FM_LINEAR;
    pkTexture->Mipmap() = Texture::MM_LINEAR_LINEAR;
    pkTexture->Wrap() = Texture::WM_WRAP_S_WRAP_T;
    TextureState* pkTS = new TextureState;
    pkTS->Set(0,pkTexture);
    m_spkWall->SetRenderState(pkTS);

    m_spkTrnNode->AttachChild(m_spkWall);
}
开发者ID:Hengplank,项目名称:kucgbowling,代码行数:21,代码来源:WaterDropFormation.cpp

示例7: CreatePlane

//----------------------------------------------------------------------------
void WaterDropFormation::CreatePlane ()
{
    // generate the plane
    TriMesh* pkMesh = NULL;
    CreateRectangleMesh(pkMesh,Vector3f::ZERO,Vector3f::UNIT_X,
        Vector3f::UNIT_Y,Vector3f::UNIT_Z,8.0f,16.0f,false,false,true);
    m_spkPlane = pkMesh;

    // add a texture to the plane
    Texture* pkTexture = new Texture;
    pkTexture->SetImage(Image::Load("gravel.mif"));
    pkTexture->Filter() = Texture::FM_LINEAR;
    pkTexture->Mipmap() = Texture::MM_LINEAR_LINEAR;
    pkTexture->Wrap() = Texture::WM_WRAP_S_WRAP_T;
    TextureState* pkTS = new TextureState;
    pkTS->Set(0,pkTexture);
    m_spkPlane->SetRenderState(pkTS);

    m_spkTrnNode->AttachChild(m_spkPlane);
}
开发者ID:Hengplank,项目名称:kucgbowling,代码行数:21,代码来源:WaterDropFormation.cpp

示例8: CreateWaterRoot

//----------------------------------------------------------------------------
void WaterDropFormation::CreateWaterRoot ()
{
    m_spkWaterRoot = new Node(2);
    m_spkTrnNode->AttachChild(m_spkWaterRoot);
    m_spkWaterRoot->Translate() = 0.1f*Vector3f::UNIT_Z;
    m_spkWaterRoot->Scale() = 8.0f;

    // texture for the water objects
    Texture* pkTexture = new Texture;
    pkTexture->SetImage(Image::Load("WaterA.mif"));
    pkTexture->Filter() = Texture::FM_LINEAR;
    pkTexture->Mipmap() = Texture::MM_LINEAR_LINEAR;
    pkTexture->Wrap() = Texture::WM_WRAP_S_WRAP_T;
    TextureState* pkTS = new TextureState;
    pkTS->Set(0,pkTexture);
    m_spkWaterRoot->SetRenderState(pkTS);

    // the texture has an alpha channel of 1/2
    AlphaState* pkAS = new AlphaState;
    pkAS->BlendEnabled() = true;
    m_spkWaterRoot->SetRenderState(pkAS);
}
开发者ID:Hengplank,项目名称:kucgbowling,代码行数:23,代码来源:WaterDropFormation.cpp

示例9: CreateBall

//----------------------------------------------------------------------------
TriMesh* BallHill::CreateBall ()
{
    TriMesh* pkBall = NULL;
    m_fRadius = (float)m_kModule.Radius;
    CreateSphereMesh(pkBall,16,16,Vector3f::ZERO,m_fRadius,Vector3f::UNIT_X,
        Vector3f::UNIT_Y,Vector3f::UNIT_Z,false,false,true,true);
    m_spkBall = pkBall;
    m_spkBall->Translate().Z() = (float)m_kModule.A3 + m_fRadius;

    Texture* pkTexture = new Texture;
    pkTexture->SetImage(Image::Load("BallTexture.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_spkBall->SetRenderState(pkTS);

    UpdateBall();

    return m_spkBall;
}
开发者ID:Hengplank,项目名称:kucgbowling,代码行数:24,代码来源:BallHill.cpp

示例10: CreateRope

//----------------------------------------------------------------------------
void Rope::CreateRope ()
{
    // create quadratic spline using particles as control points
    int iNumCtrlPoints = m_pkModule->GetNumParticles();
    Vector3f* akCtrlPoint = m_pkModule->Positions();
    int iDegree = 2;
    m_pkSpline = new BSplineCurve3f(iNumCtrlPoints,akCtrlPoint,iDegree,
        false,true);

    // generate a tube surface whose medial axis is the spline
    bool bClosed = false;
    Vector3f kUpVector = Vector3f::UNIT_Z;
    int iMedialSamples = 64;
    int iSliceSamples = 8;
    bool bWantNormals = false;
    bool bWantColors = false;
    bool bSampleByArcLength = false;
    bool bInsideView = false;
    Vector2f kTextureMin(0.0f,0.0f), kTextureMax(1.0f,1.0f);

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

    // attach a texture for the rope
    Texture* pkTexture = new Texture;
    pkTexture->SetImage(Image::Load("rope.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_spkRope->SetRenderState(pkTS);

    m_spkTrnNode->AttachChild(m_spkRope);
}
开发者ID:Hengplank,项目名称:kucgbowling,代码行数:38,代码来源:Rope.cpp

示例11: CreateHill

//----------------------------------------------------------------------------
TriMesh* BallHill::CreateHill ()
{
    TriMesh* pkHill = NULL;
    CreateDiskMesh(pkHill,32,32,Vector3f::ZERO,2.0f,Vector3f::UNIT_X,
        Vector3f::UNIT_Y,Vector3f::UNIT_Z,false,false,true);
    m_spkHill = pkHill;

    // change the texture repeat
    int iVQuantity = m_spkHill->GetVertexQuantity();
    Vector2f* akUV = m_spkHill->Textures();
    int i;
    for (i = 0; i < iVQuantity; i++)
        akUV[i] *= 8.0f;

    Texture* pkTexture = new Texture;
    pkTexture->SetImage(Image::Load("gravel.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_spkHill->SetRenderState(pkTS);

    // adjust disk vertices to form elliptical paraboloid for the hill
    Vector3f* akVertex = m_spkHill->Vertices();
    for (i = 0; i < iVQuantity; i++)
    {
        akVertex[i].Z() = m_kModule.GetHeight(akVertex[i].X(),
            akVertex[i].Y());
    }
    m_spkHill->UpdateModelBound();
    m_spkHill->UpdateModelNormals();

    return m_spkHill;
}
开发者ID:Hengplank,项目名称:kucgbowling,代码行数:37,代码来源:BallHill.cpp

示例12: Setup

//----------------------------------------------------------------------------
bool RipplingOcean::Setup ()
{
    m_bStopped = false;
    m_fStopTime = GetTimeInSeconds();

    m_spkScene = new Node(1);
    m_spkTrnNode = new Node(1);
    m_spkScene->AttachChild(m_spkTrnNode);

    // Root node for a scene graph that contains a bump-mapped triangle mesh
    // square.
    m_spkModel = new Node(1);

    // create the triangle mesh surface
    TriMesh* pkMesh = NULL;
    CreateRectangleMesh(pkMesh, Vector3f::ZERO,
        Vector3f::UNIT_X, Vector3f::UNIT_Y, -Vector3f::UNIT_Z,
        1400.0f, 1200.0f, 50, 50, true, true, true);

    m_spkTriMesh = pkMesh;

    m_spkTriMesh->SetVertexShader(m_spkVertShader);
    m_spkTriMesh->SetPixelShader(m_spkPixShader);
    SetupShaders();

    Image* pkNormal = Image::Load("plasma.mif");
    if ( !pkNormal )
        return false;

    HeightToNormalMap( pkNormal );

    Texture* pkNormalTex = new Texture;
    pkNormalTex->SetImage(pkNormal);
    pkNormalTex->Mipmap() = Texture::MM_LINEAR_LINEAR;
    pkNormalTex->Filter() = Texture::FM_LINEAR;
    pkNormalTex->Apply() = Texture::AM_DECAL;
    pkNormalTex->Wrap() = Texture::WM_WRAP_S_WRAP_T;
    TextureState* pkTS = new TextureState;
    pkTS->Set(0,pkNormalTex);

    Image* pkWater = Image::Load("watergradient.mif");
    if (!pkWater)
        return false;

    Texture* pkWaterTex = new Texture;
    pkWaterTex->SetImage(pkWater);
    pkWaterTex->Apply() = Texture::AM_DECAL;
    pkWaterTex->Wrap() = Texture::WM_CLAMP_S_CLAMP_T;
    pkTS->Set(1,pkWaterTex);

    Image* pkSkySphere = Image::Load("sky.mif");
    if (!pkSkySphere)
        return false;

    Texture* pkSkySphereTex = new Texture;
    pkSkySphereTex->SetImage(pkSkySphere);
    pkTS->Set(2,pkSkySphereTex);

    m_spkTriMesh->SetRenderState(pkTS);

    m_spkModel->AttachChild(m_spkTriMesh);
    m_spkTrnNode->AttachChild(m_spkModel);

    // I'll admit that this is kind of a hack, but it puts the sun
    // a smidge higher in the sky.  It makes it look nicest to start.  =)
    Matrix3f kIncr;
    kIncr.FromAxisAngle(Vector3f::UNIT_X, -0.08f);
    m_spkTrnNode->Rotate() = kIncr; 

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

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