本文整理汇总了C++中SetTexture函数的典型用法代码示例。如果您正苦于以下问题:C++ SetTexture函数的具体用法?C++ SetTexture怎么用?C++ SetTexture使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetTexture函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: m_bOwnsTexture
GLCube::GLCube(GLuint texId)
: m_bOwnsTexture(false), m_nTexID(0)
{
m_aabb.Min() = Eigen::Vector3d(-0.5,-0.5,-0.5);
m_aabb.Max() = Eigen::Vector3d(+0.5,+0.5,+0.5);
SetTexture(texId);
}
示例2: SetTexture
bool VImageState::Build(VWindowBase *pOwner, TiXmlElement *pNode, const char *szPath, bool bWrite)
{
if (!pNode)
return false;
// button texture name
const char *szTexture = XMLHelper::Exchange_String(pNode,"texture",NULL,bWrite);
if (szTexture) // only assign when defined to preserve normal state
SetTexture(VGUIManager::LoadTexture(szTexture,szPath));
// texture coordinates and stretch mode
float *texCoordData = (float*)(&texCoord.m_vMin);
XMLHelper::Exchange_Floats(pNode,"texcoords",texCoordData,4,bWrite);
const char *szStretchMode = XMLHelper::Exchange_String(pNode,"stretchmode",NULL,bWrite);
if (szStretchMode)
m_eStretchMode = GetStretchMode(szStretchMode);
// button color
XMLHelper::Exchange_Color(pNode,"color",m_iColor,bWrite);
XMLHelper::Exchange_Transparency(pNode,"transparency",m_eTranspType,bWrite);
// other states
bool bFiltering = false;
XMLHelper::Exchange_Bool(pNode,"filtering",bFiltering,bWrite);
if (bFiltering)
m_iAdditionalStateFlags |= RENDERSTATEFLAG_FILTERING;
// mouse over cursor
const char *szCursor = XMLHelper::Exchange_String(pNode,"cursor",NULL,bWrite);
if (szCursor) // only assign when defined to preserve normal state
m_spCursor = pOwner->GetMenuManager()->LoadCursorResource(szCursor,szPath);
return true;
}
示例3: TTF_RenderText_Shaded
void Texture_Text::RenderText_Shaded( SDL_Renderer* renderer, const std::string &str )
{
// Render with a text color
SDL_Surface* surface = TTF_RenderText_Shaded( textFont, str.c_str(), textColor, backgroundColor );
SetTexture( renderer, surface );
}
示例4: TTF_RenderText_Blended
void Texture_Text::RenderText_Blended( SDL_Renderer* renderer, const std::string &str )
{
// Render with a text color, nicer than TTF_RenderText_Shaded, but slower
SDL_Surface* surface = TTF_RenderText_Blended( textFont, str.c_str(), textColor );
SetTexture( renderer, surface );
}
示例5: q
void CDX9Renderer::FillGradient(const rect& r, cr_float angle, point hotspot, const color& c1, const color& c2, gradient_direction dir)
{
quad q((r - hotspot).rotate_to_quad(angle, r.topleft()));
SetTexture(NULL);
color vs[4];
switch (dir) {
case dir_up:
SetVertices(vs, c2, c2, c1, c1);
Quad(r, vs);
break;
case dir_down:
SetVertices(vs, c1, c1, c2, c2);
Quad(r, vs);
break;
case dir_left:
SetVertices(vs, c2, c1, c2, c1);
Quad(r, vs);
break;
case dir_right:
SetVertices(vs, c1, c2, c1, c2);
Quad(r, vs);
break;
}
}
示例6: TTF_RenderText_Solid
void Texture_Text::RenderText_Solid( SDL_Renderer* renderer, const std::string &str )
{
// Just render the text ( background will be transparent )
SDL_Surface* surface = TTF_RenderText_Solid( textFont, str.c_str(), textColor );
SetTexture( renderer, surface );
}
示例7: SetTexture
void CDX9Renderer::FillGradient(const rect& r, const color& c1, const color& c2, gradient_direction dir)
{
SetTexture(NULL);
color vs[4];
switch (dir) {
case dir_up:
SetVertices(vs, c2, c2, c1, c1);
Quad(r, vs);
break;
case dir_down:
SetVertices(vs, c1, c1, c2, c2);
Quad(r, vs);
break;
case dir_left:
SetVertices(vs, c2, c1, c2, c1);
Quad(r, vs);
break;
case dir_right:
SetVertices(vs, c1, c2, c1, c2);
Quad(r, vs);
break;
}
}
示例8: UpdateText
void Textbox::OnCreate()
{
myTexture = Scene.Get()->GetAssetManager()->CreateFromMemory<Texture>("");
UpdateText();
SetTexture(myTexture);
GUISprite::OnCreate();
}
示例9: RenderBatch
void CCryTBRenderer::RenderBatch(Batch* batch)
{
auto pRenderer = gEnv->pRenderer;
const float fZ = 1.f;
SVF_P3F_C4B_T2F* verts = new SVF_P3F_C4B_T2F[batch->vertex_count];
for (int i = 0; i < batch->vertex_count; ++i)
{
auto batchVtx = batch->vertex[i];
verts[i].xyz = Vec3{ batchVtx.x, batchVtx.y, fZ };
verts[i].st = Vec2{ batchVtx.u, batchVtx.v };
verts[i].color.dcolor = batchVtx.col;
}
auto btmp = static_cast<CCryTBBitmap*>(batch->bitmap);
pRenderer->Set2DMode(true,
pRenderer->GetWidth(), pRenderer->GetHeight());
pRenderer->SetTexture(btmp->GetCryTexture()->GetTextureID());
pRenderer->SetColorOp(eCO_MODULATE, eCO_MODULATE, DEF_TEXARG0, DEF_TEXARG0);
pRenderer->SetState(GS_NODEPTHTEST);
pRenderer->DrawDynVB(verts, nullptr,
batch->vertex_count, 0,
prtTriangleList);
pRenderer->Set2DMode(false, 0, 0);
SAFE_DELETE_ARRAY(verts);
}
示例10: Test28
void Test28()
{
InitWindow();
static Bitmap bm;
bm.w = bm.h = 256; bm.form = BMFORMAT_B8G8R8A8; bm.pal = 0;
bm.pix = (uchar*)malloc(bm.w * bm.h * 4);
memset(bm.pix, 127, bm.w * bm.h * 4);
static int px = 61, py = 89, vx = 2, vy = -3;
*(uint*)(bm.pix + (py*bm.w + px) * 4) = -1;
static texture t = CreateTexture(&bm, 1);
while(!appexit)
{
px += vx; if(px < 0 || px >= 256) {px -= vx; vx = -vx;}
py += vy; if(py < 0 || py >= 256) {py -= vy; vy = -vy;}
*(uint*)(bm.pix + (py*bm.w + px) * 4) = -1;
renderer->UpdateTexture(t, &bm);
BeginDrawing();
InitRectDrawing();
SetTexture(0, t);
DrawRect(0, 0, 256, 256, -1);
EndDrawing();
HandleWindow();
}
}
示例11: TranslationToTable
void PolyDrawArgs::SetTexture(FTexture *texture, uint32_t translationID, bool forcePal)
{
if (translationID != 0xffffffff && translationID != 0)
{
FRemapTable *table = TranslationToTable(translationID);
if (table != nullptr && !table->Inactive)
{
if (PolyRenderer::Instance()->RenderTarget->IsBgra())
mTranslation = (uint8_t*)table->Palette;
else
mTranslation = table->Remap;
mTextureWidth = texture->GetWidth();
mTextureHeight = texture->GetHeight();
mTexturePixels = texture->GetPixels();
return;
}
}
if (forcePal)
{
mTextureWidth = texture->GetWidth();
mTextureHeight = texture->GetHeight();
mTexturePixels = texture->GetPixels();
}
else
{
SetTexture(texture);
}
}
示例12: TranslationToTable
void RectDrawArgs::SetTexture(FSoftwareTexture *texture, uint32_t translationID, FRenderStyle style)
{
// Alphatexture overrides translations.
if (translationID != 0xffffffff && translationID != 0 && !(style.Flags & STYLEF_RedIsAlpha))
{
FRemapTable *table = TranslationToTable(translationID);
if (table != nullptr && !table->Inactive)
{
if (PolyTriangleDrawer::IsBgra())
mTranslation = (uint8_t*)table->Palette;
else
mTranslation = table->Remap;
mTexture = texture;
mTextureWidth = texture->GetWidth();
mTextureHeight = texture->GetHeight();
mTexturePixels = texture->GetPixels(style);
return;
}
}
if (style.Flags & STYLEF_RedIsAlpha)
{
mTexture = texture;
mTextureWidth = texture->GetWidth();
mTextureHeight = texture->GetHeight();
mTexturePixels = texture->GetPixels(style);
}
else
{
SetTexture(texture, style);
}
}
示例13: SetTexture
void RectDrawArgs::SetStyle(const FRenderStyle &renderstyle, double alpha, uint32_t fillcolor, uint32_t translationID, FSoftwareTexture *tex, bool fullbright)
{
SetTexture(tex, translationID, renderstyle);
SetColor(0xff000000 | fillcolor, fillcolor >> 24);
if (renderstyle == LegacyRenderStyles[STYLE_Normal] || (r_drawfuzz == 0 && renderstyle == LegacyRenderStyles[STYLE_OptFuzzy]))
{
SetStyle(Translation() ? TriBlendMode::NormalTranslated : TriBlendMode::Normal, alpha);
}
else if (renderstyle == LegacyRenderStyles[STYLE_Add] && fullbright && alpha == 1.0 && !Translation())
{
SetStyle(TriBlendMode::SrcColor, alpha);
}
else if (renderstyle == LegacyRenderStyles[STYLE_SoulTrans])
{
SetStyle(Translation() ? TriBlendMode::AddTranslated : TriBlendMode::Add, transsouls);
}
else if (renderstyle == LegacyRenderStyles[STYLE_Fuzzy] || (r_drawfuzz == 1 && renderstyle == LegacyRenderStyles[STYLE_OptFuzzy]))
{
SetColor(0xff000000, 0);
SetStyle(TriBlendMode::Fuzzy);
}
else if (renderstyle == LegacyRenderStyles[STYLE_Shadow] || (r_drawfuzz == 2 && renderstyle == LegacyRenderStyles[STYLE_OptFuzzy]))
{
SetColor(0xff000000, 0);
SetStyle(Translation() ? TriBlendMode::TranslucentStencilTranslated : TriBlendMode::TranslucentStencil, 1.0 - 160 / 255.0);
}
else if (renderstyle == LegacyRenderStyles[STYLE_Stencil])
{
SetStyle(Translation() ? TriBlendMode::StencilTranslated : TriBlendMode::Stencil, alpha);
}
else if (renderstyle == LegacyRenderStyles[STYLE_Translucent])
{
SetStyle(Translation() ? TriBlendMode::TranslucentTranslated : TriBlendMode::Translucent, alpha);
}
else if (renderstyle == LegacyRenderStyles[STYLE_Add])
{
SetStyle(Translation() ? TriBlendMode::AddTranslated : TriBlendMode::Add, alpha);
}
else if (renderstyle == LegacyRenderStyles[STYLE_Shaded])
{
SetStyle(Translation() ? TriBlendMode::ShadedTranslated : TriBlendMode::Shaded, alpha);
}
else if (renderstyle == LegacyRenderStyles[STYLE_TranslucentStencil])
{
SetStyle(Translation() ? TriBlendMode::TranslucentStencilTranslated : TriBlendMode::TranslucentStencil, alpha);
}
else if (renderstyle == LegacyRenderStyles[STYLE_Subtract])
{
SetStyle(Translation() ? TriBlendMode::SubtractTranslated : TriBlendMode::Subtract, alpha);
}
else if (renderstyle == LegacyRenderStyles[STYLE_AddStencil])
{
SetStyle(Translation() ? TriBlendMode::AddStencilTranslated : TriBlendMode::AddStencil, alpha);
}
else if (renderstyle == LegacyRenderStyles[STYLE_AddShaded])
{
SetStyle(Translation() ? TriBlendMode::AddShadedTranslated : TriBlendMode::AddShaded, alpha);
}
}
示例14: Entity
Bomb::Bomb(const Vector2& vInitialPos) :
Entity(vInitialPos),
m_texture("Assets/Projectiles/Bomb.bmp")
{
SetFrameTimer(2);
SetTexture(&m_texture, 16);
}
示例15: _isActive
Drawable::Drawable(Rect rect, SDL_Texture* texture, Color color)
: _isActive(true)
{
SetRect(rect);
SetTexture(texture);
_color = color;
}