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


C++ ITexture类代码示例

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


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

示例1: getTextureSize

		const IntSize& getTextureSize(const std::string& _texture, bool _cache)
		{
			// предыдущя текстура
			static std::string old_texture;
			static IntSize old_size;

			if (old_texture == _texture && _cache)
				return old_size;
			old_texture = _texture;
			old_size.clear();

			if (_texture.empty())
				return old_size;

			RenderManager& render = RenderManager::getInstance();

			if (nullptr == render.getTexture(_texture))
			{
				if (!DataManager::getInstance().isDataExist(_texture))
				{
					MYGUI_LOG(Error, "Texture '" + _texture + "' not found");
					return old_size;
				}
				else
				{
					ITexture* texture = render.createTexture(_texture);
					texture->loadFromFile(_texture);
				}
			}

			ITexture* texture = render.getTexture(_texture);
			if (texture == nullptr)
			{
				MYGUI_LOG(Error, "Texture '" + _texture + "' not found");
				return old_size;
			}

			old_size.set(texture->getWidth(), texture->getHeight());

	#if MYGUI_DEBUG_MODE == 1
			if (!Bitwise::isPO2(old_size.width) || !Bitwise::isPO2(old_size.height))
			{
				MYGUI_LOG(Warning, "Texture '" + _texture + "' have non power of two size");
			}
	#endif

			return old_size;
		}
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:48,代码来源:MyGUI_TextureUtility.cpp

示例2: memset

//-----------------------------------------------------------------------------
// Purpose: Initializes all view systems
//-----------------------------------------------------------------------------
void CViewRender::Init( void )
{
	memset( &m_PitchDrift, 0, sizeof( m_PitchDrift ) );

	m_bDrawOverlay = false;

	m_pDrawEntities		= cvar->FindVar( "r_drawentities" );
	m_pDrawBrushModels	= cvar->FindVar( "r_drawbrushmodels" );

	beams->InitBeams();
	tempents->Init();

	m_TranslucentSingleColor.Init( "debug/debugtranslucentsinglecolor", TEXTURE_GROUP_OTHER );
	m_ModulateSingleColor.Init( "engine/modulatesinglecolor", TEXTURE_GROUP_OTHER );
	
	extern CMaterialReference g_material_WriteZ;
	g_material_WriteZ.Init( "engine/writez", TEXTURE_GROUP_OTHER );

	// FIXME:  
	QAngle angles;
	engine->GetViewAngles( angles );
	AngleVectors( angles, &m_vecLastFacing );

#if defined( REPLAY_ENABLED )
	m_pReplayScreenshotTaker = NULL;
#endif

#if defined( CSTRIKE_DLL )
	m_flLastFOV = default_fov.GetFloat();
#endif

	ITexture *depthOld = materials->FindTexture("_rt_FullFrameDepth", TEXTURE_GROUP_RENDER_TARGET);
	static int flags = TEXTUREFLAGS_NOMIP | TEXTUREFLAGS_NOLOD | TEXTUREFLAGS_DEPTHRENDERTARGET;
	if (depthOld)
		flags = depthOld->GetFlags();

	int iW, iH;
	materials->GetBackBufferDimensions(iW, iH);
	materials->BeginRenderTargetAllocation();
	materials->CreateNamedRenderTargetTextureEx(
		"_rt_FullFrameDepth_Alt",
		iW, iH, RT_SIZE_NO_CHANGE,
		IMAGE_FORMAT_A8,
		MATERIAL_RT_DEPTH_NONE,
		flags,
		0);
	materials->EndRenderTargetAllocation();
}
开发者ID:SCell555,项目名称:source-sdk-2013,代码行数:51,代码来源:view.cpp

示例3: GetAssetById

/*
*	Creates a render target
*	Param _kfWidth  : The width of the render terget
*	Param _kfHeight : The height of th erender target
*	Param _keFMT	: The render targets format
*	Return : ITexture, The render target
*/
ITexture* CDX9TextureManager::CreateRenderTarget( CAssetId& _rAssetId,const uint32 _kuWidth, const uint32 _kuHeight, const ESurfaceFormat _keFMT, const bool _bWriteOnly  )
{

	// Check if the render target has already been created.
	ITexture* pRenderTarget = NULL;
	pRenderTarget = GetAssetById( _rAssetId );
	if( pRenderTarget )
	{
		pRenderTarget->AddRef( );
		return pRenderTarget;
	}

	static const D3DFORMAT pFormats[] = 
	{
		D3DFMT_R32F,
		D3DFMT_X8R8G8B8,
		D3DFMT_D16,
	};

	
	// Do we want to crate a depth stencile?
	if( _keFMT == SF_uDepth )
	{
		// Create a depth stencile texture
		IDirect3DSurface9* pSurface = NULL;
		if( FAILED( CDX9Renderer::GetDevice( )->CreateDepthStencilSurface( _kuWidth, _kuHeight, pFormats[_keFMT], D3DMULTISAMPLE_NONE, 0, !_bWriteOnly, &pSurface, 0 ) ) )
		{
			// no
			// assert
			return NULL;
		}
		return new CDX9Texture( pSurface, CDX9Renderer::GetDevice( ), true );
	}

	// Create a render target

	IDirect3DTexture9* pTexture = NULL;
	//NOTE: The 0 may need to be a 1
	if( FAILED( CDX9Renderer::GetDevice( )->CreateTexture( _kuWidth, _kuHeight, 0, D3DUSAGE_RENDERTARGET, pFormats[_keFMT], D3DPOOL_DEFAULT, &pTexture, 0 ) ) )
	{
		// no 
		// assert
		assert_now( "Failed to texture!" );
		return NULL;
	}

	return new CDX9Texture( pTexture, CDX9Renderer::GetDevice( ) ) ;
}
开发者ID:ZacAdams89,项目名称:Z-Engine,代码行数:55,代码来源:DX9TextureManager.cpp

示例4: GetPowerOfTwoFrameBufferTexture

//-----------------------------------------------------------------------------
// paint it!
//-----------------------------------------------------------------------------
void CVMTPanel::OnPaint3D()
{
	if (!m_pMaterial)
		return;

	// Deal with refraction
	if ( m_pMaterial->NeedsPowerOfTwoFrameBufferTexture() )
	{
		ITexture *pTexture = GetPowerOfTwoFrameBufferTexture();
		if ( pTexture && !pTexture->IsError() )
		{
			CMatRenderContextPtr pRenderContext( MaterialSystem() );
			pRenderContext->CopyRenderTargetToTexture( pTexture );
			pRenderContext->SetFrameBufferCopyTexture( pTexture );
		}
	}

	// Draw a background (translucent objects will appear that way)

	// FIXME: Draw the outline of this panel?

//	pRenderContext->CullMode(MATERIAL_CULLMODE_CCW);

	RenderSphere( vec3_origin, SPHERE_RADIUS, 20, 20 );
	/*
	pRenderContext->MatrixMode( MATERIAL_PROJECTION );
	pRenderContext->LoadIdentity();
	pRenderContext->Ortho( 0, 0, m_iViewableWidth, m_iViewableHeight, 0, 1 );

	pRenderContext->Bind( m_pMaterial );
	IMesh *pMesh = pRenderContext->GetDynamicMesh();
	CMeshBuilder meshBuilder;

	meshBuilder.Begin( pMesh, MATERIAL_QUADS, 1 );

	if (!m_bUseActualSize)
	{
		DrawStretchedToPanel( meshBuilder );
	}
	else
	{
		DrawActualSize( meshBuilder );
	}

	meshBuilder.End();
	pMesh->Draw();
	*/
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:51,代码来源:vmtpanel.cpp

示例5: getTextureSize

		const IntSize& getTextureSize(const std::string& _texture, bool _cache)
		{
			static std::string prevTexture;
			static IntSize prevSize;

			if (prevTexture == _texture && _cache)
				return prevSize;

			prevTexture.clear();
			prevSize.clear();

			if (_texture.empty())
				return Constants::getZeroIntSize();

			RenderManager& render = RenderManager::getInstance();

			ITexture* texture = render.getTexture(_texture);
			if (texture == nullptr)
			{
				if (!DataManager::getInstance().isDataExist(_texture))
				{
					MYGUI_LOG(Error, "Texture '" + _texture + "' not found");
					return Constants::getZeroIntSize();
				}
				else
				{
					texture = render.createTexture(_texture);
					if (texture == nullptr)
					{
						MYGUI_LOG(Error, "Texture '" + _texture + "' not found");
						return Constants::getZeroIntSize();
					}
					texture->loadFromFile(_texture);
				}
			}

			prevSize = IntSize(texture->getWidth(), texture->getHeight());
			prevTexture = _texture;

#if MYGUI_DEBUG_MODE == 1
			if (!Bitwise::isPO2(prevSize.width) || !Bitwise::isPO2(prevSize.height))
			{
				MYGUI_LOG(Warning, "Texture '" + _texture + "' have non power of two size");
			}
#endif

			return prevSize;
		}
开发者ID:Anomalous-Software,项目名称:mygui,代码行数:48,代码来源:MyGUI_TextureUtility.cpp

示例6: UpdateScreenEffectTexture

//------------------------------------------------------------------------------
// CExampleEffect render
//------------------------------------------------------------------------------
void CExampleEffect::Render( int x, int y, int w, int h )
{
	if ( !IsEnabled() )
		return;

	// Render Effect
	Rect_t actualRect;
	UpdateScreenEffectTexture( 0, x, y, w, h, false, &actualRect );
	ITexture *pTexture = GetFullFrameFrameBufferTexture( 0 );

	CMatRenderContextPtr pRenderContext( materials );

	pRenderContext->DrawScreenSpaceRectangle( m_Material, x, y, w, h,
											actualRect.x, actualRect.y, actualRect.x+actualRect.width-1, actualRect.y+actualRect.height-1, 
											pTexture->GetActualWidth(), pTexture->GetActualHeight() );
}
开发者ID:1n73rf4c3,项目名称:source-sdk-2013,代码行数:19,代码来源:ScreenSpaceEffects.cpp

示例7: toLower

// ***************************************************************************
void			IDriver::getTextureShareName (const ITexture& tex, string &output)
{
	// Create the shared Name.
	output= toLower(tex.getShareName());

	// append format Id of the texture.
	static char	fmt[256];
	smprintf(fmt, 256, "@Fmt:%d", (uint32)tex.getUploadFormat());
	output+= fmt;

	// append mipmap info
	if(tex.mipMapOn())
		output+= "@MMp:On";
	else
		output+= "@MMp:Off";
}
开发者ID:Darkhunter,项目名称:Tranquillien-HCRP-Project-using-NeL,代码行数:17,代码来源:driver.cpp

示例8: if

INLINE void OGL14RendererDevice::UploadData(void *userData)
{
	RendererPacket *packet = static_cast<RendererPacket *>(userData);

	ITexture *texture = packet->pTexture;
	GLuint *t = static_cast<GLuint *>(texture->GetTextureName());
	GLuint tex = (GLuint)t;

	sVertex *data = static_cast<sVertex *>(packet->pVertexData);

	glPushMatrix();
	glLoadIdentity();

	this->SetBlendingOperation(packet->nBlendMode, packet->iColor.pixel);

	glBindTexture(GL_TEXTURE_2D, tex);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

/*
	eTextureFilter min = texture->GetFilter(Seed::TextureFilterTypeMin);
	eTextureFilter mag = texture->GetFilter(Seed::TextureFilterTypeMag);

	if (min == Seed::TextureFilterLinear)
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
	else if (min == Seed::TextureFilterNearest)
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

	if (mag == Seed::TextureFilterLinear)
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	else if (mag == Seed::TextureFilterNearest)
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
*/

	//glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
	glBegin(this->GetOpenGLMeshType(packet->nMeshType));
	for (u32 i = 0; i < packet->iSize; i++)
	{
		glTexCoord2f(data[i].cCoords.x, data[i].cCoords.y);
		glVertex3f(data[i].cVertex.x, data[i].cVertex.y, data[i].cVertex.z);
	}
	glEnd();

	glPopMatrix();
}
开发者ID:Patuti,项目名称:seed,代码行数:47,代码来源:Ogl14RendererDevice.cpp

示例9: OnBind

void CPupilProxy::OnBind( C_BaseEntity *pBaseEntity )
{
	if (!pBaseEntity || !m_pAnimatedTextureVar )
		return;

	if( m_pAnimatedTextureVar->GetType() != MATERIAL_VAR_TYPE_TEXTURE )
		return;

	ITexture *pTexture = m_pAnimatedTextureVar->GetTextureValue();
	int nFrameCount = pTexture->GetNumAnimationFrames();

	// Compute the lighting at the eye position of the entity; use it to dialate the pupil
	Vector forward;
	pBaseEntity->GetVectors( &forward, NULL, NULL );

	Vector eyePt = pBaseEntity->EyePosition();
	Vector color;
	engine->ComputeLighting( eyePt, &forward, false, color );

	// Compute the intensity...
	float flIntensity = ( 0.299f * color[0] + 0.587f * color[1] + 0.114f * color[2] ) * 0.5;
	flIntensity = clamp( flIntensity, 0, 1 );
	float flLastIntensity = m_pLightingVar->GetFloatValue( );
	if ( flIntensity > flLastIntensity )
	{
		float flMaxChange = m_flPupilCloseRate.GetFloat() * gpGlobals->frametime;
		if ( flIntensity > (flMaxChange + flLastIntensity) )
		{
			flIntensity = flLastIntensity + flMaxChange;
		}
	}
	else
	{
		float flMaxChange = m_flPupilOpenRate.GetFloat() * gpGlobals->frametime;
		if ( flIntensity < (flLastIntensity - flMaxChange) )
		{
			flIntensity = flLastIntensity - flMaxChange;
		}
	}

	int nFrame = nFrameCount * flIntensity;
	nFrame = clamp( nFrame, 0, nFrameCount - 1 );

	m_pAnimatedTextureFrameNumVar->SetIntValue( nFrame );
	m_pLightingVar->SetFloatValue( flIntensity );
}
开发者ID:paralin,项目名称:hl2sdk,代码行数:46,代码来源:proxypupil.cpp

示例10: GetTextureSize

void CUIDraw::GetTextureSize(int iTextureID,float &rfSizeX,float &rfSizeY)
{
	TTexturesMap::iterator Iter = m_texturesMap.find(iTextureID);
	if(Iter != m_texturesMap.end())
	{
		ITexture *pTexture = (*Iter).second;
		rfSizeX = (float) pTexture->GetWidth	();
		rfSizeY = (float) pTexture->GetHeight	();
	}
	else
	{
		// Unknow texture !
		CRY_ASSERT(0);
		rfSizeX = 0.0f;
		rfSizeY = 0.0f;
	}
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:17,代码来源:UIDraw.cpp

示例11: V_StrSubst

void CTextureSystem::OnFileChange( const char *pFilename, int context, CTextureSystem::EFileType eFileType )
{
	// It requires the forward slashes later...
	char fixedSlashes[MAX_PATH];
	V_StrSubst( pFilename, "\\", "/", fixedSlashes, sizeof( fixedSlashes ) );	

	// Get rid of the extension.
	if ( V_strlen( fixedSlashes ) < 5 )
	{
		Assert( false );
		return;
	}
	fixedSlashes[ V_strlen( fixedSlashes ) - 4 ] = 0;


	// Handle it based on what type of file we've got.
	if ( eFileType == k_eFileTypeVMT )
	{
		IEditorTexture *pTex = FindActiveTexture( fixedSlashes, NULL, FALSE );
		if ( pTex )
		{
			pTex->Reload( true );
		}
		else
		{
			EnumMaterial( fixedSlashes, context );
			IEditorTexture *pTex = FindActiveTexture( fixedSlashes, NULL, FALSE );
			if ( pTex )
			{
				GetMainWnd()->m_TextureBar.NotifyNewMaterial( pTex );
				GetMainWnd()->GetFaceEditSheet()->NotifyNewMaterial( pTex );
			}
		}
	}
	else if ( eFileType == k_eFileTypeVTF )
	{
		// Whether a VTF was added, removed, or modified, we do the same thing.. refresh it and any materials that reference it.
		ITexture *pTexture = materials->FindTexture( fixedSlashes, TEXTURE_GROUP_UNACCOUNTED, false );
		if ( pTexture )
		{
			pTexture->Download( NULL );
			ReloadMaterialsUsingTexture( pTexture );
		}
	}
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:45,代码来源:texturesystem.cpp

示例12:

ZombieLeader::~ZombieLeader()
{
    delete m_pStateMachine;

    // remove this scene node from parent
    m_p2DSprite->remove();

    // release texture resource
    IVideoDriver* pDriver = IrrDvc.GetDriver();
    ITexture* pTexture = pDriver->getTexture(ZOMBIELEADER_TEXTUREFILENAME);
    if (pTexture)
    {
        pTexture->drop();
    }

    // remove physics model - it will be deleted in parents
    //delete m_pZombiePhaysics;
}
开发者ID:ptptomr,项目名称:project_ran,代码行数:18,代码来源:ZombieLeader.cpp

示例13: Release

void CZZMaterialProxy::Release()
{
	// Disconnect the texture regenerator...
	if (m_pTexture)
	{
		//ITexture *pTexture = m_pTextureVar->GetTextureValue(); <- powoduje access violation
		if (m_pTexture)
			m_pTexture->SetTextureRegenerator(NULL);
	}
}
开发者ID:Zbyl,项目名称:StealthSpyGame,代码行数:10,代码来源:zzprocmat.cpp

示例14: DevMsg

void C_AwesomiumBrowserManager::OnCreateWebViewDocumentReady(WebView* pWebView, std::string id)
{
	// The master webview has created a new webview on demand.
	DevMsg("AwesomiumBrowserManager: OnCreateWebViewDocumentReady: %s\n", id.c_str());

	// TODO: Add global JS API object to the web view.

	//C_WebTab* pWebTab = g_pAnarchyManager->GetWebManager()->FindWebTab(id);
	C_AwesomiumBrowserInstance* pBrowserInstance = this->FindAwesomiumBrowserInstance(id);
	if (pBrowserInstance)
	{
		pBrowserInstance->SetWebView(pWebView);
		pBrowserInstance->SetState(2);
		//m_webViews[pBrowserInstance] = pWebView;	// obsolete perhaps??
		
		ITexture* pTexture = pBrowserInstance->GetTexture();
		if (pTexture && pTexture->GetImageFormat() == IMAGE_FORMAT_BGRA8888)
			pWebView->SetTransparent(true);

		std::string initialURI = pBrowserInstance->GetInitialURL();
		std::string uri = initialURI;
		//if (id == "network")
	//		uri = initialURI;
		//else if (id == "images")
		//	uri = initialURI;	// this should never happen, so comment it out to avoid confusion
			//uri = "asset://ui/imageLoader.html";
		//else if (id == "hud")
		//	uri = initialURI;
			//uri = (initialURI == "") ? "asset://ui/default.html" : initialURI;	// this should never happen, so comment it out to avoid confusion
		//else
	//		uri = initialURI;

		DevMsg("Loading initial URL: %s\n", uri.c_str());
		pWebView->LoadURL(WebURL(WSLit(uri.c_str())));
		/*
		if (id == "hud" )	// is this too early??
			g_pAnarchyManager->IncrementState();
		else if (id == "images" && AASTATE_AWESOMIUMBROWSERMANAGERIMAGESWAIT)
			g_pAnarchyManager->IncrementState();
		*/
	}
}
开发者ID:smsithlord,项目名称:AArcade-Source,代码行数:42,代码来源:c_awesomiumbrowsermanager.cpp

示例15: assert

//-----------------------------------------------------------------------------
// Does the dirty deed
//-----------------------------------------------------------------------------
void CBaseToggleTextureProxy::OnBind( void *pC_BaseEntity )
{
	assert ( m_TextureVar );

	if (!pC_BaseEntity)
		return;

	if( m_TextureVar->GetType() != MATERIAL_VAR_TYPE_TEXTURE )
	{
		return;
	}

	ITexture *pTexture = NULL;

	pTexture = m_TextureVar->GetTextureValue();

	if ( pTexture == NULL )
		 return;

	C_BaseEntity *pEntity = BindArgToEntity( pC_BaseEntity );

	if ( pEntity == NULL )
		 return;
	
	int numFrames = pTexture->GetNumAnimationFrames();
	int frame = pEntity->GetTextureFrameIndex();

	int intFrame = ((int)frame) % numFrames; 

	if ( m_WrapAnimation == false )
	{
		if ( frame > numFrames )
			 intFrame = numFrames;
	}
		
	m_TextureFrameNumVar->SetIntValue( intFrame );

	if ( ToolsEnabled() )
	{
		ToolFramework_RecordMaterialParams( GetMaterial() );
	}
}
开发者ID:Au-heppa,项目名称:source-sdk-2013,代码行数:45,代码来源:toggletextureproxy.cpp


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