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


C++ CTexture类代码示例

本文整理汇总了C++中CTexture的典型用法代码示例。如果您正苦于以下问题:C++ CTexture类的具体用法?C++ CTexture怎么用?C++ CTexture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CTexture类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: glDepthFunc

bool CScene::RenderShadow()
{
	std::list<axelynx::Camera *>::const_iterator ci = camlist.begin();
	std::list<axelynx::Camera *>::const_iterator ei = camlist.end();

	CShadowPass::SetShadowShader(defShader_);
	CShadowPass::StartPass();

	for(;ci!=ei;++ci)
	{
		if((*ci)->isEnabled())
		{
			frame_++;
			(*ci)->Bind(zpassed?-1:0);
			CMaterial::Free(); //материал зависит от камеры
			if(zpassed)
			{
				CEarlyZ::StartRenderPass();
			}
			else
			{
				glDepthFunc(GL_LESS);
				glDepthMask(GL_TRUE);
			}
			for(int i=0;i<256;++i)
			{
				if(visible_groups_[i])
					scenegraph_[i]->Render(*ci);
			}
			(*ci)->UnBind();
			CMaterial::Free(); //материал зависит от камеры
		}
	}

	CShader *cs = CShader::Current();

	if(cs)
		cs->UnBind();

	for(int i=0;i<16;++i)
	{
		CTexture *ct = CTexture::Current(i);
		if(ct)
			ct->UnBind();
	}

	if(zpassed)
		CEarlyZ::EndRenderPass();

	zpassed = false;
	glDisable(GL_DEPTH_TEST);
	glDisable(GL_CULL_FACE);
	glDepthMask(GL_TRUE);

	CShadowPass::EndPass();

	return true;
}
开发者ID:as2120,项目名称:axelynx,代码行数:58,代码来源:CScene.cpp

示例2: Swap

void CTexture::Swap( CTexture &tsrc )
{
CTexture temp;

temp.Copy( *this );
Copy( tsrc );
tsrc.Copy( temp );
temp.Init();
}
开发者ID:mistalro,项目名称:gpufractal,代码行数:9,代码来源:texture.cpp

示例3: TextureReset

void TextureReset(void)
{
	textures_done = false;
	build_time = 0;
	for (CTexture* t = tHead; t; t = t->_next)
		t->Clear();
	memset(prefix_used, 0, sizeof (prefix_used));
	memset(name_used, 0, sizeof (name_used));
	memset(suffix_used, 0, sizeof (suffix_used));
}
开发者ID:DX-MON,项目名称:pixelcity,代码行数:10,代码来源:Texture.cpp

示例4: BitmapLoaded

bool BitmapLoaded (int bmi, int bD1)
{
	CBitmap*		bmoP, * bmP = gameData.pig.tex.bitmaps [bD1] + bmi;
	CTexture*	texP;
#if 1
if (bmP->Flags () & BM_FLAG_PAGED_OUT)
	return false;
if ((bmoP = bmP->Override (-1)))
	bmP = bmoP;
#endif
return ((texP = bmP->Texture ()) && (texP->Handle ())) || (bmP->Buffer () != 0);
}
开发者ID:paud,项目名称:d2x-xl,代码行数:12,代码来源:loadtextures.cpp

示例5: TextureReset

void TextureReset (void)
{

  textures_done = false;
  build_time = 0;
  for (CTexture* t = head; t; t = t->_next)
    t->Clear ();
  ZeroMemory (prefix_used, sizeof (prefix_used));
  ZeroMemory (name_used, sizeof (name_used));
  ZeroMemory (suffix_used, sizeof (suffix_used));

}
开发者ID:96fps,项目名称:pixelcity,代码行数:12,代码来源:Texture.cpp

示例6: Initalise

void CPickup::Initalise(CVector3f p)
{
	m_isActive = true;
	m_theta = 0.0f;
	m_position = p;

	CTexture texture;
	// Texture - https://www.textures.com/download/cliffs0174/56219?secure=login
	texture.Load("Resources\\Textures\\rock.jpg", false);
	m_textureID = texture.m_textureID;

}
开发者ID:addrum,项目名称:Advanced-Games-Technology-Coursework,代码行数:12,代码来源:Pickup.cpp

示例7: DoWork

bool CTextureDDSJob::DoWork()
{
  CTexture texture;
  if (URIUtils::GetExtension(m_original).Equals(".dds"))
    return false;
  if (texture.LoadFromFile(m_original))
  { // convert to DDS
    CDDSImage dds;
    CLog::Log(LOGDEBUG, "Creating DDS version of: %s", m_original.c_str());
    return dds.Create(URIUtils::ReplaceExtension(m_original, ".dds"), texture.GetWidth(), texture.GetHeight(), texture.GetPitch(), texture.GetPixels(), 40);
  }
  return false;
}
开发者ID:misa17,项目名称:xbmc,代码行数:13,代码来源:TextureCacheJob.cpp

示例8: Render

void CUICustomItem::Render(FVF::TL*& Pointer, const Fvector2& pos, u32 color, 
						   float x1, float y1, float x2, float y2)
{
	CTexture* T		= RCache.get_ActiveTexture(0);
	Fvector2		ts;
	ts.set			(float(T->get_Width()),float(T->get_Height()));
	
	if (!(uFlags&flValidRect)){
		SetRect		(0,0,ts.x,ts.y);
	}
	if (!(uFlags&flValidOriginalRect)){
		iOriginalRect.set(0,0,ts.x,ts.y);
		uFlags |= flValidOriginalRect;
	}

	Fvector2 LTp,RBp;
	Fvector2 LTt,RBt;
	//координаты на экране в пикселях
	UI()->ClientToScreenScaled	(LTp, x1,y1);
	LTp.add						(pos);

	UI()->ClientToScreenScaled	(RBp, x2,y2);
	RBp.add						(pos);

	//текстурные координаты
	LTt.set			( iOriginalRect.x1/ts.x, iOriginalRect.y1/ts.y);
	RBt.set			( iOriginalRect.x2/ts.x, iOriginalRect.y2/ts.y);

	// Check mirror mode
	if (tmMirrorHorisontal == eMirrorMode || tmMirrorBoth == eMirrorMode)	std::swap	(LTt.x,RBt.x);
	if (tmMirrorVertical == eMirrorMode || tmMirrorBoth == eMirrorMode)		std::swap	(LTt.y,RBt.y);
	// clip poly
	sPoly2D			S; S.resize(4);
	S[0].set		(LTp.x-0.5f,LTp.y-0.5f,	LTt.x,LTt.y);	// LT
	S[1].set		(RBp.x-0.5f,LTp.y-0.5f,	RBt.x,LTt.y);	// RT
	S[2].set		(RBp.x-0.5f,RBp.y-0.5f,	RBt.x,RBt.y);	// RB
	S[3].set		(LTp.x-0.5f,RBp.y-0.5f,	LTt.x,RBt.y);	// LB
	
	sPoly2D D;
//	const C2DFrustum& FF = UI()->ScreenFrustum();
	sPoly2D* R		= UI()->ScreenFrustum().ClipPoly(S,D);
//	sPoly2D* R		= &S;
	if (R&&R->size()){
		for (u32 k=0; k<R->size()-2; k++){
			Pointer->set	((*R)[0+0].pt.x, (*R)[0+0].pt.y,	color, (*R)[0+0].uv.x, (*R)[0+0].uv.y); Pointer++;
			Pointer->set	((*R)[k+1].pt.x, (*R)[k+1].pt.y,	color, (*R)[k+1].uv.x, (*R)[k+1].uv.y); Pointer++;
			Pointer->set	((*R)[k+2].pt.x, (*R)[k+2].pt.y,	color, (*R)[k+2].uv.x, (*R)[k+2].uv.y); Pointer++;
		}
	}
}
开发者ID:OLR-xray,项目名称:XRay-NEW,代码行数:50,代码来源:UICustomItem.cpp

示例9: ClearTextureVector

void CStaticMesh::ClearTextureVector(std::vector<CTexture*>& textVector)
{
	for(uint16 i = 0; i < textVector.size(); ++i)
	{
		CTexture* texture = textVector[i];

		if(!CORE->GetTextureManager()->RemoveResource(texture->GetName()))
		{
			CHECKED_DELETE(texture);
		}
	}

	textVector.clear();
}
开发者ID:kusku,项目名称:red-forest,代码行数:14,代码来源:StaticMesh.cpp

示例10: TextureEditorPanel

/* TextureXPanel::openTEXTUREX
 * Loads a TEXTUREx or TEXTURES format texture list into the editor
 *******************************************************************/
bool TextureXPanel::openTEXTUREX(ArchiveEntry* entry)
{
	// Open texture list (check format)
	if (entry->getType()->getFormat() == "texturex")
	{
		// TEXTURE1/2 format
		if (!texturex.readTEXTUREXData(entry, tx_editor->patchTable()))
			return false;

		// Create default texture editor
		texture_editor = new TextureEditorPanel(this, tx_editor);

		// Update patch table usage info
		for (size_t a = 0; a < texturex.nTextures(); a++)
		{
			CTexture* tex = texturex.getTexture(a);

			// Go through texture's patches
			for (size_t p = 0; p < tex->nPatches(); p++)
				tx_editor->patchTable().patch(tex->getPatch(p)->getName()).used_in.push_back(tex->getName());
		}
	}
	else
	{
		// TEXTURES format
		if (!texturex.readTEXTURESData(entry))
			return false;

		// Create extended texture editor
		texture_editor = new ZTextureEditorPanel(this, tx_editor);

		// Add 'type' column
		list_textures->InsertColumn(2, "Type");
	}

	tx_entry = entry;

	// Add texture editor area
	GetSizer()->Add(texture_editor, 1, wxEXPAND|wxALL, 4);
	texture_editor->setupLayout();

	// Update format label
	label_tx_format->SetLabel("Format: " + texturex.getTextureXFormatString());

	// Update texture list
	list_textures->updateList();

	return true;
}
开发者ID:Blzut3,项目名称:SLADE,代码行数:52,代码来源:TextureXPanel.cpp

示例11: createTexture

bool CTexture::createTexture(const char* a_sFileName)
{
	CTexture* temp = CTexMgr->createTexture(a_sFileName);

	if (temp == NULL)
		return false;

	this->_fileName = temp->getFileName();
	this->_imgInfo = temp->getImgInfo();
	this->_rect = temp->getRect();
	this->_texture = temp->getTexture();

	return true;
	
}
开发者ID:EmptyBrain,项目名称:DirectXFramework,代码行数:15,代码来源:Texture.cpp

示例12: switch

void CTriangle::Render( uint32 i_iPass )
{
	switch( i_iPass )
	{
	case ePass_Lighting: break;
	}

	CGraphics *pGraphics = m_pParent->pGetParent()->pGetGraphics();

	CCamera *pCurCamera = pGraphics->pGetCurCamera();
	matrix44 matWorld; matMatrix44Identity( matWorld );
	pCurCamera->SetWorldMatrix( matWorld );

	m_pVertexShader->SetMatrix( m3dsc_worldmatrix, pCurCamera->matGetWorldMatrix() );
	m_pVertexShader->SetMatrix( m3dsc_viewmatrix, pCurCamera->matGetViewMatrix() );
	m_pVertexShader->SetMatrix( m3dsc_projectionmatrix, pCurCamera->matGetProjectionMatrix() );
	m_pVertexShader->SetMatrix( m3dsc_wvpmatrix, pCurCamera->matGetWorldMatrix() * pCurCamera->matGetViewMatrix() * pCurCamera->matGetProjectionMatrix() );

	vector3 vCamPos = pCurCamera->vGetPosition();
	m_pVertexShader->SetVector( 0, vector4( vCamPos.x, vCamPos.y, vCamPos.z, 0 ) );

	CLight *pLight = m_pParent->pGetCurrentLight();
	
	vector3 vLightPos = pLight->vGetPosition();
	m_pVertexShader->SetVector( 1, vector4( vLightPos.x, vLightPos.y, vLightPos.z, 0 ) );
	
	m_pPixelShader->SetVector( 0, pLight->vGetColor() );

	pGraphics->SetVertexFormat( m_pVertexFormat );
	pGraphics->SetVertexStream( 0, m_pVertexBuffer, 0, sizeof( vertexformat ) );
	pGraphics->SetVertexShader( m_pVertexShader );
	pGraphics->SetPixelShader( m_pPixelShader );

	CResManager *pResManager = m_pParent->pGetParent()->pGetResManager();
	CTexture *pTexture = (CTexture *)pResManager->pGetResource( m_hTexture );
	pGraphics->SetTexture( 0, pTexture->pGetTexture() );
	
	CTexture *pNormalmap = (CTexture *)pResManager->pGetResource( m_hNormalmap );
	pGraphics->SetTexture( 1, pNormalmap->pGetTexture() );

	for( uint32 i = 0; i < 2; ++i )
	{
		pGraphics->SetTextureSamplerState( i, m3dtss_addressu, m3dta_clamp );
		pGraphics->SetTextureSamplerState( i, m3dtss_addressv, m3dta_clamp );
	}

	pGraphics->pGetM3DDevice()->DrawPrimitive( m3dpt_trianglelist, 0, 1 );
}
开发者ID:stephanreiter,项目名称:muli3d,代码行数:48,代码来源:triangle.cpp

示例13:

	CQuad::CQuad(const CTexture & texture) {
		const float w = texture.getWidth();
		const float h = texture.getHeight();

		x0= y0= 0.0f;
		x1= w;
		y1= h;

		u0= v0 = 0.0f;
		if (texture.target() == GL_TEXTURE_2D)
			u1= v1 = 1.0f;
		else {
			u1 = w;
			v1 = h;
		}
	}
开发者ID:frachop,项目名称:hts-opengl,代码行数:16,代码来源:glquad.cpp

示例14: CNamed

CMaterial::CMaterial(CXMLTreeNode &TreeNode) : CNamed(TreeNode)
{
	std::string l_EffectTechnique = TreeNode.GetPszProperty("effect_technique");
	m_EffectTechnique = CEngine::GetSingletonPtr()->GetEffectManager()->GetResource(l_EffectTechnique);

	if (l_EffectTechnique == "diffuse_technique")
	{
		for (int i = 0; i < TreeNode.GetNumChildren(); ++i)
		{
			CXMLTreeNode l_Texture = TreeNode(i);
			CTexture * Texture = new CTexture();
			Texture->Load(l_Texture.GetPszProperty("filename"));
			m_Textures.push_back(Texture);
		}
	}
}
开发者ID:JContrerasPereira,项目名称:MasterUAB,代码行数:16,代码来源:Material.cpp

示例15: OPENGL_CHECK_FOR_ERRORS

bool CRenderTarget::Bind3DTexture(axelynx::Texture* tex, int texlayer, int rendertargetlayer)
{
	OPENGL_CHECK_FOR_ERRORS();
	


	glBindFramebuffer(GL_FRAMEBUFFER, fbo_); 
	OPENGL_CHECK_FOR_ERRORS();

	if(tex)
	{
		CTexture *ctex = dynamic_cast<CTexture*>(tex);
		glFramebufferTexture3D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + rendertargetlayer, GL_TEXTURE_3D, ctex->GetHandle(), 0, texlayer);
		used_layer_[rendertargetlayer] = true;
	}
	else
	{
		glFramebufferTexture3D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + rendertargetlayer, GL_TEXTURE_3D, 0, 0, texlayer);
		used_layer_[rendertargetlayer] = false;
	}

	OPENGL_CHECK_FOR_ERRORS();

	if(current_)
		current_->Bind();
	else
		glBindFramebuffer(GL_FRAMEBUFFER, 0); 

	
	OPENGL_CHECK_FOR_ERRORS();
	return true;
}
开发者ID:as2120,项目名称:axelynx,代码行数:32,代码来源:CRenderTarget.cpp


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