本文整理汇总了C++中Face::CacheOpacity方法的典型用法代码示例。如果您正苦于以下问题:C++ Face::CacheOpacity方法的具体用法?C++ Face::CacheOpacity怎么用?C++ Face::CacheOpacity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Face
的用法示例。
在下文中一共展示了Face::CacheOpacity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OGF
void CBuild::Flex2OGF()
{
float p_total = 0;
float p_cost = 1/float(g_XSplit.size());
validate_splits ();
g_tree.clear ();
g_tree.reserve (4096);
for (splitIt it=g_XSplit.begin(); it!=g_XSplit.end(); it++)
{
R_ASSERT ( ! (*it)->empty() );
u32 MODEL_ID = u32(it-g_XSplit.begin());
OGF* pOGF = new OGF();
Face* F = *((*it)->begin()); // first face
b_material* M = &(materials()[F->dwMaterial]); // and it's material
R_ASSERT (F && M);
try {
// Common data
pOGF->Sector = M->sector;
pOGF->material = F->dwMaterial;
// Collect textures
OGF_Texture T;
//pOGF->shader = M->shader;
//pOGF->shader_xrlc = &F->Shader();
TRY(T.name = textures()[M->surfidx].name);
TRY(T.pSurface = &(textures()[M->surfidx]));
TRY(pOGF->textures.push_back(T));
try {
if (F->hasImplicitLighting())
{
// specific lmap
string_path tn;
strconcat (sizeof(tn),tn,*T.name,"_lm.dds");
T.name = tn;
T.pSurface = T.pSurface; // Leave surface intact
R_ASSERT (pOGF);
pOGF->textures.push_back(T);
} else {
// If lightmaps persist
CLightmap* LM = F->lmap_layer;
if (LM) {
string_path fn;
sprintf_s (fn,"%s_1",LM->lm_texture.name);
T.name = fn;
T.pSurface = &(LM->lm_texture);
R_ASSERT (T.pSurface);
R_ASSERT (pOGF);
pOGF->textures.push_back(T); //.
sprintf (fn,"%s_2",LM->lm_texture.name);
T.name = fn;
pOGF->textures.push_back(T);
}
}
} catch (...) { clMsg("* ERROR: Flex2OGF, model# %d, *textures*",MODEL_ID); }
// Collect faces & vertices
F->CacheOpacity ();
bool _tc_ = !(F->flags.bOpaque);
try {
BuildOGFGeom( *pOGF, *(*it), _tc_ );
} catch (...) { clMsg("* ERROR: Flex2OGF, model# %d, *faces*",MODEL_ID); }
} catch (...)
{
clMsg("* ERROR: Flex2OGF, 1st part, model# %d",MODEL_ID);
}
try {
clMsg ("%3d: opt : v(%d)-f(%d)", MODEL_ID,pOGF->data.vertices.size(),pOGF->data.faces.size());
pOGF->Optimize ();
clMsg ("%3d: cb : v(%d)-f(%d)", MODEL_ID,pOGF->data.vertices.size(),pOGF->data.faces.size());
pOGF->CalcBounds ();
clMsg ("%3d: prog: v(%d)-f(%d)", MODEL_ID,pOGF->data.vertices.size(),pOGF->data.faces.size());
if (!b_noise) pOGF->MakeProgressive (c_PM_MetricLimit_static);
clMsg ("%3d: strp: v(%d)-f(%d)", MODEL_ID,pOGF->data.vertices.size(),pOGF->data.faces.size());
pOGF->Stripify ();
} catch (...) {
clMsg("* ERROR: Flex2OGF, 2nd part, model# %d",MODEL_ID);
}
g_tree.push_back (pOGF);
xr_delete (*it);
Progress (p_total+=p_cost);
}
g_XSplit.clear ();
}