本文整理汇总了C++中CIwMaterial::Reset方法的典型用法代码示例。如果您正苦于以下问题:C++ CIwMaterial::Reset方法的具体用法?C++ CIwMaterial::Reset怎么用?C++ CIwMaterial::Reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIwMaterial
的用法示例。
在下文中一共展示了CIwMaterial::Reset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawTexture
void Graphics::DrawTexture(const Rect& screenCoords, int textureId, const Rect& textureCoord, float xOffset, float yOffset)
{
static CIwSVec2 textureUVs[4];
static CIwSVec2 screenXY[4];
static CIwMaterial material;
CIwTexture* texture = (CIwTexture*)ResourceManager::GetInstance().GetTexture(textureId)->GetData();
if (!texture)
return;
material.Reset();
material.SetAlphaMode(CIwMaterial::ALPHA_BLEND);
material.SetTexture(texture);
int16 width = texture->GetWidth();
int16 height = texture->GetHeight();
static const int16 uvSize = 4096;
// screen coordinates
screenXY[0] = CIwSVec2((int16)(screenCoords.left + xOffset), (int16)(screenCoords.top + yOffset));
screenXY[1] = CIwSVec2((int16)(screenCoords.left + xOffset), (int16)(screenCoords.bottom + yOffset));
screenXY[2] = CIwSVec2((int16)(screenCoords.right + xOffset), (int16)(screenCoords.top + yOffset));
screenXY[3] = CIwSVec2((int16)(screenCoords.right + xOffset), (int16)(screenCoords.bottom + yOffset));
// texture's UV coordinates
textureUVs[0] = CIwSVec2(((int16)textureCoord.left * uvSize) / width, ((int16)textureCoord.top * uvSize) / height);
textureUVs[1] = CIwSVec2(((int16)textureCoord.left * uvSize) / width, ((int16)textureCoord.bottom * uvSize) / height);
textureUVs[2] = CIwSVec2(((int16)textureCoord.right * uvSize) / width, ((int16)textureCoord.top * uvSize) / height);
textureUVs[3] = CIwSVec2(((int16)textureCoord.right * uvSize) / width, ((int16)textureCoord.bottom * uvSize) / height);
IwGxSetMaterial(&material);
IwGxSetUVStream(textureUVs);
IwGxSetColStream(NULL);
IwGxSetVertStreamScreenSpace(screenXY, 4);
IwGxDrawPrims(IW_GX_QUAD_STRIP, NULL, 4);
IwGxFlush();
}