本文整理汇总了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;
}