当前位置: 首页>>代码示例>>C++>>正文


C++ SetTexture函数代码示例

本文整理汇总了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);
}
开发者ID:Signafy,项目名称:SceneGraph,代码行数:7,代码来源:GLCube.cpp

示例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;
}
开发者ID:Bewolf2,项目名称:projectanarchy,代码行数:34,代码来源:VControlHelperObjects.cpp

示例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 );
}
开发者ID:olevegard,项目名称:SudDoku_SDL2,代码行数:7,代码来源:Texture_Text.cpp

示例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 );
}
开发者ID:olevegard,项目名称:SudDoku_SDL2,代码行数:7,代码来源:Texture_Text.cpp

示例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;
		}
	}
开发者ID:segafan,项目名称:Construct-classic,代码行数:27,代码来源:CDX9Renderer_Batch.cpp

示例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 );
}
开发者ID:olevegard,项目名称:SudDoku_SDL2,代码行数:7,代码来源:Texture_Text.cpp

示例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;
		}
	}
开发者ID:segafan,项目名称:Construct-classic,代码行数:25,代码来源:CDX9Renderer_Batch.cpp

示例8: UpdateText

void Textbox::OnCreate()
{
    myTexture = Scene.Get()->GetAssetManager()->CreateFromMemory<Texture>("");
    UpdateText();
    SetTexture(myTexture);
    GUISprite::OnCreate();
}
开发者ID:ANerd,项目名称:Skyport-gl,代码行数:7,代码来源:Textbox.cpp

示例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);
}
开发者ID:omggomb,项目名称:Plugin_TurboBadgerUI,代码行数:33,代码来源:CryTBRenderer.cpp

示例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();
	}
}
开发者ID:AdrienTD,项目名称:wkbre,代码行数:27,代码来源:test.cpp

示例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);
	}
}
开发者ID:emileb,项目名称:gzdoom,代码行数:30,代码来源:poly_draw_args.cpp

示例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);
	}
}
开发者ID:coelckers,项目名称:gzdoom,代码行数:33,代码来源:poly_draw_args.cpp

示例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);
	}
}
开发者ID:coelckers,项目名称:gzdoom,代码行数:60,代码来源:poly_draw_args.cpp

示例14: Entity

Bomb::Bomb(const Vector2& vInitialPos) :
	Entity(vInitialPos),
	m_texture("Assets/Projectiles/Bomb.bmp")
{
	SetFrameTimer(2);
	SetTexture(&m_texture, 16);
}
开发者ID:adamenkov,项目名称:jet-story,代码行数:7,代码来源:Projectiles.cpp

示例15: _isActive

Drawable::Drawable(Rect rect, SDL_Texture* texture, Color color)
	: _isActive(true)
{
	SetRect(rect);
	SetTexture(texture);
	_color = color;
}
开发者ID:TordTroen,项目名称:CPPInnlevering01,代码行数:7,代码来源:Drawable.cpp


注:本文中的SetTexture函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。