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


C++ Appearance::setBlendAttributes方法代码示例

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


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

示例1: loadPackedMedia

bool PraetoriansTerrainWater::loadPackedMedia(const char* path)
{
  unsigned int signature;
  unsigned short chunkid;
  unsigned int chunklength;
  unsigned int texturescount;///use one in this version
  unsigned int watercount;
  unsigned int vertexcount;
  unsigned int indexcount;
  
  Tuple3f* vertices;
  unsigned short* indices;
  Tuple4ub* colors;
  Tuple2f* txcoords;
  ArchivedFile* file;
  WaterDatabase* wdatabase;
  
  if (!(file = FileSystem::checkOut(path)))
    return Logger::writeErrorLog(String("Could not load -> ") + path);
    
  wdatabase = Gateway::getWaterDatabase();
  
  file->read(&signature, 4);
  
  file->read(&chunkid, 2);
  file->read(&chunklength, 4);
  file->read(&texturescount, 4);
  for (unsigned int i = 0; i < texturescount; i++)
    file->seek((256 * 256 * 4) + 6, SEEKD);
    
  file->read(&watercount, 4);
  for (unsigned int i = 0; i < watercount; i++)
  {
    file->read(&chunkid, 2);
    file->read(&chunklength, 4);
    file->seek(48, SEEKD);
    file->read(&vertexcount, 4);
    
    vertices = new Tuple3f[vertexcount];
    colors = new Tuple4ub[vertexcount];
    txcoords = new Tuple2f[vertexcount];
    for (unsigned int j = 0; j < vertexcount; j++)
    {
      file->read(vertices[j], 12);
      Swap(vertices[j].x, vertices[j].z);
      file->read(colors[j], 4);
      Swap(colors[j].x, colors[j].z);
      file->read(txcoords[j], 8);
    }
    
    file->read(&indexcount, 4);
    indices = new unsigned short[indexcount];
    file->read(indices, indexcount * 2);
    
    String watername = String("H2O_") + int(wdatabase->getWatersCount());
    Geometry* geometry;
    geometry = new Geometry(watername, indexcount, vertexcount);
    geometry->setIndices(indices, false);
    geometry->setVertices(vertices, false);
    geometry->setColors(colors, false);
    geometry->setTextureElements(txcoords, 2, false);
    geometry->computeBounds();
    
    Appearance* appearance = new Appearance();
    appearance->setBlendAttributes(BlendAttributes(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
    appearance->setTexture(0, wdatabase->getWaterTexture());
    
    Model* model = new Model();
    model->setAppearance(appearance);
    model->setGeometry(geometry);
    
    TransformGroup* group = new TransformGroup();
    group->addChild(model);
    group->updateBoundsDescriptor();
    wdatabase->addWaterModel(group);
    
    deleteArray(vertices);
    deleteArray(indices);
    deleteArray(colors);
    deleteArray(txcoords);
  }
  
  FileSystem::checkIn(file);
  
  return true;
}
开发者ID:hyperiris,项目名称:praetoriansmapeditor,代码行数:86,代码来源:PraetoriansTerrainWater.cpp


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