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


C++ Cell::GetFog方法代码示例

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


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

示例1: RenderCellMirrorMaskV

  void RenderCellMirrorMaskV( Cluster & clus, U32 cellOffset, S32 x, S32 z, U32 clipFlags)
  {
    clipFlags &= ~clipPLANE0;

    S32 x0, xend = x + meterPerClus;
    S32 z0, zend = z + meterPerClus;

    S32 meterStrideX    = heightField.meterPerCell;
    S32 meterStrideZ    = heightField.meterPerCell;
    S32 cellStrideWidth = heightField.cellPitch;

    Cell * c0 = &heightField.cellList[cellOffset];

    VertexC vertmem[25], * dv = vertmem, * ve = vertmem + 25;
    F32 fogs[25], * f = fogs;
    UVPair * uvlist = waterUVList0;
    for (z0 = z; z0 <= zend; z0 += meterStrideZ, c0 += cellStrideWidth)
    {
      Cell * c = c0;
      for (x0 = x; x0 <= xend; x0 += meterStrideX, dv++, c += 1, f++, uvlist++)
      {
        dv->vv.x = (F32) x0;
        dv->vv.z = (F32) z0;
        dv->vv.y = clus.waterHeight;

        dv->nv = waterNorms[0];

        dv->uv = *uvlist;

        dv->diffuse = waterColorMirror;

        if (Vid::Var::Terrain::shroud)
        {
          *f = (F32) c->GetFog() * U8toNormF32;
          dv->diffuse.Modulate( *f, *f, *f);
        }
      }
    }

    if (Vid::Var::Terrain::shroud && clus.shroudCount == 25)
    {
      RenderShroudMirrorMaskV( clus, vertmem, clipFlags);
      return;
    }

    Vid::DrawIndexedPrimitive( 
      PT_TRIANGLELIST,
      FVF_VERTEX,
      vertmem, 25, clusterI, 96, RS_BLEND_MODULATE | renderFlags | ((clipFlags & clipALL) ? 0 : DP_DONOTCLIP) );

    if (waterLayer2)
    {
      U32 a = U32(waterColorMirror.a * *Vid::Var::Terrain::waterAlphaTopFactor);

      UVPair * uvlist = waterUVList1;
      for (dv = vertmem; dv < ve; dv++, uvlist++)
      {
        dv->diffuse.a  = U8(a);
        dv->uv = *uvlist;
      }
      Vid::DrawIndexedPrimitive( 
        PT_TRIANGLELIST,
        FVF_TLVERTEX,
        vertmem, 25, clusterI, 96, RS_BLEND_MODULATE | renderFlags | ((clipFlags & clipALL) ? 0 : DP_DONOTCLIP) );
    }

#ifdef DOSTATISTICS
    if (clipFlags == clipNONE)
    {
      Statistics::noClipTris += 32;
    }
    else
    {
      Statistics::clipTris += 32;
    }
#endif
  }
开发者ID:grasmanek94,项目名称:darkreign2,代码行数:77,代码来源:terrain_render_vertexc.cpp

示例2: RenderClusterV

  // draw a single cluster
  //
  void RenderClusterV( Cluster &clus, S32 x, S32 z, U32 cellOffset, S32 cellStrideX, S32 cellStrideZ, U32 clipFlags) // = clipALL
  {
    // build list of vertex positions, normals, and colors
    S32 x0, xend = x + meterPerClus;
    S32 z0, zend = z + meterPerClus;

    S32 meterStrideX    = abs( cellStrideX) * heightField.meterPerCell;
    S32 meterStrideZ    = abs( cellStrideZ) * heightField.meterPerCell;
    S32 cellStrideWidth = cellStrideZ * heightField.cellPitch;

    Vid::SetBucketFlags( RS_BLEND_DEF | renderFlags | ((clipFlags & clipALL) ? 0 : DP_DONOTCLIP));
    Vid::SetTranBucketZMax( Vid::sortTERRAIN0 + 1);
    Vid::SetBucketMaterial( Vid::defMaterial);

/*    
    if (Vid::Clip::BoundsTestAlphaFar( clus.zDepth, clus.bounds.Radius()))
    {
      BucketMan::forceTranslucent = TRUE;
    }
*/
    Cell * c0 = &heightField.cellList[cellOffset];

    VertexC verts[25], * dv = verts;
    F32 fogs[25], * f = fogs;
    for (z0 = z; z0 <= zend; z0 += meterStrideZ, c0 += cellStrideWidth)
    {
      Cell * c = c0;
      for (x0 = x; x0 <= xend; x0 += meterStrideX, dv++, c += cellStrideX, f++)
      {
        dv->vv.x = (F32) x0;
        dv->vv.z = (F32) z0;
        dv->vv.y = c->height;

        dv->nv = normList[c->normal];

        dv->diffuse = c->color;
        if (Vid::Var::Terrain::shroud)
        {
          *f = (F32) c->GetFog() * U8toNormF32;
          dv->diffuse.Modulate( *f, *f, *f);
        }
      }
    }

    // reset loop variables
    c0 = &heightField.cellList[cellOffset];

    // submit cells
    U32 vcount = dv - verts;

//    Bool softS    = shroud && *softShroud;

    if (clus.status.water && Vid::Var::Terrain::water)
    {
      lowWaterHeight += clus.waterHeight;
      lowWaterCount++;

      if (!Vid::renderState.status.mirror)
      {
        RenderCellWaterV( clus, x, z, verts, fogs, vcount, clipFlags);
      }
    }

    for (z0 = z, vcount = 0; z0 < zend; z0 += meterStrideZ, vcount++, c0 += cellStrideWidth)
    {
      Cell *c = c0;
      for (x0 = x; x0 < xend; x0 += meterStrideX, vcount++, c += cellStrideX)
      {
        if ((!c->GetVisible() && c->GetFog() >= *Vid::Var::Terrain::shroudFog) /* || (isInvisS && c->GetFog() >= *Vid::Var::Terrain::shroudFog) */)
        {
          continue;
        }

        // 0*\--*3
        //  | \ |
        // 1*--\*2
        //
        U16 iv[4];

        iv[0] = (U16)(vcount);
        iv[1] = (U16)(vcount + 5);
        iv[2] = (U16)(vcount + 6);
        iv[3] = (U16)(vcount + 1);

        Bitmap *tex = texList[c->texture];
        Vid::SetBucketTexture( tex, FALSE, 0, RS_BLEND_DEF | renderFlags);

        VertexC * vertmem;
        U16 *     indexmem;
        if (!Vid::LockIndexedPrimitiveMem( (void **)&vertmem, 4, &indexmem, 6, &clus))
        {
          LOG_WARN( ("Terrain::RenderCluster: can't lock bucket!") );
          return;
        }

        UVPair * uvList = &cellUVList[c->uv];
        VertexC * dv = vertmem;
        for (U32 i = 0; i < 4; i++, dv++)
//.........这里部分代码省略.........
开发者ID:grasmanek94,项目名称:darkreign2,代码行数:101,代码来源:terrain_render_vertexc.cpp


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