本文整理汇总了C++中CIwMaterial::SetColEmissive方法的典型用法代码示例。如果您正苦于以下问题:C++ CIwMaterial::SetColEmissive方法的具体用法?C++ CIwMaterial::SetColEmissive怎么用?C++ CIwMaterial::SetColEmissive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIwMaterial
的用法示例。
在下文中一共展示了CIwMaterial::SetColEmissive方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawText
//.........这里部分代码省略.........
IwGxLightingOn();
IwGxSetColStream(NULL);
IwGxSetNormStream(NULL);
CIwGxFont* mfont = static_cast<CIwGxFont*>(font->getFontHandle());
CIwGxFontPreparedData* prep_text = static_cast<CIwGxFontPreparedData*>(prepared_text);
// A font can consist of multiple materials so we need to process all of them
for (int t = 0; t < mfont->GetNumberMaterials(); t++)
{
// Set UV stream
uint32* char_ids;
int num_chars = IwGxFontSetUVs(*prep_text, -1, t, &char_ids);
// Generate transformed vertices from glyphs
int nv = num_chars << 2;
CzVec2* pVerts = IW_GX_ALLOC(CzVec2, nv);
CzVec2* pVert = pVerts;
if (m01 == 0 && m10 == 0)
{
// No rotation optimisation
for (int t2 = 0; t2 < num_chars; t2++)
{
CIwRect rc = prep_text->GetCharacterArea(char_ids[t2]);
float x1 = (float)rc.x;
float y1 = (float)rc.y;
float x2 = x1 + (float)rc.w;
float y2 = y1 + (float)rc.h;
float ax = (m00 * x1) + tx;
float ay = (m11 * y1) + ty;
float bx = (m00 * x2) + tx;
float by = (m11 * y2) + ty;
// if ((ax < clip.w && bx >= clip.x) && (ay < clip.h && by >= clip.y))
// {
pVert->x = ax + sx1;
pVert->y = ay + sy1;
pVert++;
pVert->x = ax - sx1;
pVert->y = by + sy2;
pVert++;
pVert->x = bx - sx2;
pVert->y = by - sy2;
pVert++;
pVert->x = bx + sx2;
pVert->y = ay - sy1;
pVert++;
// }
}
}
else
{
for (int t2 = 0; t2 < num_chars; t2++)
{
CIwRect rc = prep_text->GetCharacterArea(char_ids[t2]);
float x1 = (float)rc.x;
float y1 = (float)rc.y;
float x2 = x1 + (float)rc.w;
float y2 = y1 + (float)rc.h;
pVert->x = (m00 * x1 + m10 * y1 + tx + sx1);
pVert->y = (m01 * x1 + m11 * y1 + ty + sy1);
pVert++;
pVert->x = (m00 * x1 + m10 * y2 + tx - sx1);
pVert->y = (m01 * x1 + m11 * y2 + ty + sy2);
pVert++;
pVert->x = (m00 * x2 + m10 * y2 + tx - sx2);
pVert->y = (m01 * x2 + m11 * y2 + ty - sy2);
pVert++;
pVert->x = (m00 * x2 + m10 * y1 + tx + sx2);
pVert->y = (m01 * x2 + m11 * y1 + ty - sy1);
pVert++;
}
}
if (nv > 0)
{
// Set vertex stream
IwGxSetVertStreamScreenSpace((CIwFVec2*)pVerts, nv);
// Create a material
CIwMaterial* mat = IW_GX_ALLOC_MATERIAL();
mat->Copy(*IwGxFontGetFont()->GetMaterial(t));
mat->SetDepthWriteMode(CIwMaterial::DEPTH_WRITE_DISABLED);
mat->SetColEmissive(colour.get());
mat->SetClamping(true);
mat->SetFiltering(filter);
mat->SetAlphaMode(am);
mat->SetCullMode(CIwMaterial::CULL_BACK);
// mat->SetCullMode(CIwMaterial::CULL_NONE);
IwGxSetMaterial(mat);
// Finally draw the glyphs
IwGxDrawPrims(IW_GX_QUAD_LIST, NULL, nv);
CurrentAlphaMode = alpha_mode;
}
}
IwGxLightingOff();
CurrentTexture = NULL;
}