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


C++ CTextureReference类代码示例

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


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

示例1: PaintEngineWindow

//-----------------------------------------------------------------------------
// Paints the engine window	itself
//-----------------------------------------------------------------------------
void CMiniViewportEngineRenderArea::PaintEngineWindow( int x, int y, int w, int h )
{
	if ( !enginetools->IsInGame() )
	{
		surface()->DrawSetColor( Color( 127, 127, 200, 63 ) );
		surface()->DrawFilledRect( x, y, x + w, y + h );
	}
	else
	{
		CMatRenderContextPtr pRenderContext( g_pMaterialSystem );

		g_pMatSystemSurface->DrawSetTextureMaterial( m_nEngineOutputTexture, m_ScreenMaterial );
		surface()->DrawSetColor( Color( 0, 0, 0, 255 ) );

		int nTexWidth = m_ScreenBuffer->GetActualWidth();
		int nTexHeight = m_ScreenBuffer->GetActualHeight();
		float flOOWidth = 1.0f / nTexWidth;
		float flOOHeight = 1.0f / nTexHeight;

		float s0, s1, t0, t1;

		s0 = ( 0.5f ) * flOOWidth;
		t0 = ( 0.5f ) * flOOHeight;
		s1 = ( (float)w - 0.5f ) * flOOWidth;
		t1 = ( (float)h - 0.5f ) * flOOHeight;

		vgui::surface()->DrawTexturedSubRect( x, y, x+w, y+h, s0, t0, s1, t1 );

		PaintOverlayText();
	}
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:34,代码来源:miniviewport.cpp

示例2: InitDefaultEnvCubemap

//-----------------------------------------------------------------------------
// Sets a default env_cubemap for rendering materials w/ specularity
//-----------------------------------------------------------------------------
void CSceneViewerApp::InitDefaultEnvCubemap( )
{
	// Deal with the default cubemap
	CMatRenderContextPtr pRenderContext( g_pMaterialSystem );
	ITexture *pCubemapTexture = g_pMaterialSystem->FindTexture( "editor/cubemap", NULL, true );
	m_DefaultEnvCubemap.Init( pCubemapTexture );
	pRenderContext->BindLocalCubemap( pCubemapTexture );
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:11,代码来源:sceneviewer.cpp

示例3:

static ITexture *GetPowerOfTwoFrameBufferTexture( void )
{
	if( !s_pPowerOfTwoFrameBufferTexture )
	{
		s_pPowerOfTwoFrameBufferTexture.Init( vgui::MaterialSystem()->FindTexture( "_rt_PowerOfTwoFB", TEXTURE_GROUP_RENDER_TARGET ) );
	}
	
	return s_pPowerOfTwoFrameBufferTexture;
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:9,代码来源:vmtpreviewpanel.cpp

示例4: OnDataChanged

void C_GlobalLight::OnDataChanged( DataUpdateType_t updateType )
{
    if ( updateType == DATA_UPDATE_CREATED )
    {
        m_SpotlightTexture.Init( m_TextureName, TEXTURE_GROUP_OTHER, true );
    }

    BaseClass::OnDataChanged( updateType );
}
开发者ID:sparrowstar,项目名称:Sourcemod-Name-TBD-EnginePort,代码行数:9,代码来源:c_env_global_light.cpp

示例5:

ITexture *GetPlayerModelTexture( void )
{ 
	if ( !s_pPlayerModelTexture )
	{
		s_pPlayerModelTexture.Init( materials->FindTexture( "_rt_playermodel", TEXTURE_GROUP_RENDER_TARGET ) );
		Assert( !IsErrorTexture( s_pPlayerModelTexture ) );
		AddReleaseFunc();
	}
	return s_pPlayerModelTexture;
}
开发者ID:Rahmstein,项目名称:IOS,代码行数:10,代码来源:rendertexture.cpp

示例6:

ITexture *GetScopeTexture( void )
{ 
	if ( !s_pScopeTexture )
	{
		s_pScopeTexture.Init( materials->FindTexture( "_rt_Scope", TEXTURE_GROUP_RENDER_TARGET ) );
		Assert( !IsErrorTexture( s_pScopeTexture ) );
		AddReleaseFunc();
	}
	return s_pScopeTexture;
}
开发者ID:nandrews0424,项目名称:halflife2-vr-old,代码行数:10,代码来源:rendertexture.cpp

示例7:

ITexture *GetPowerOfTwoFrameBufferTexture( void )
{
	if ( !s_pPowerOfTwoFrameBufferTexture )
	{
		s_pPowerOfTwoFrameBufferTexture.Init( materials->FindTexture( "_rt_PowerOfTwoFB", TEXTURE_GROUP_RENDER_TARGET ) );
		Assert( !IsErrorTexture( s_pPowerOfTwoFrameBufferTexture ) );
		AddReleaseFunc();
	}
	
	return s_pPowerOfTwoFrameBufferTexture;
}
开发者ID:TotallyMehis,项目名称:ZM-Updated,代码行数:11,代码来源:rendertexture.cpp

示例8: ReleaseRenderTargets

void ReleaseRenderTargets( void )
{
	s_pPowerOfTwoFrameBufferTexture.Shutdown();
	s_pCameraTexture.Shutdown();
	s_pWaterReflectionTexture.Shutdown();
	s_pWaterRefractionTexture.Shutdown();
	s_pQuarterSizedFB0.Shutdown();
	s_pQuarterSizedFB1.Shutdown();
	s_pFullFrameDepthTexture.Shutdown();
	s_pScopeTexture.Shutdown();

	for (int i=0; i<MAX_FB_TEXTURES; ++i)
		s_pFullFrameFrameBufferTexture[i].Shutdown();
}
开发者ID:nandrews0424,项目名称:halflife2-vr-old,代码行数:14,代码来源:rendertexture.cpp

示例9: InitSceneMaterials

void CMiniViewportEngineRenderArea::InitSceneMaterials()
{
	if ( m_ScreenBuffer )
		return;

	if ( g_pMaterialSystem->IsTextureLoaded( "_rt_LayoffResult"	) ) 
	{
		ITexture *pTexture = g_pMaterialSystem->FindTexture( "_rt_LayoffResult", TEXTURE_GROUP_RENDER_TARGET );
		m_ScreenBuffer.Init( pTexture );
	}
	else
	{
		// For now, layoff dimensions match aspect of back buffer
		int nBackBufferWidth, nBackBufferHeight;
		g_pMaterialSystem->GetBackBufferDimensions( nBackBufferWidth, nBackBufferHeight );
		float flAspect = nBackBufferWidth / (float)nBackBufferHeight;
		int nPreviewWidth = min( DEFAULT_PREVIEW_WIDTH, nBackBufferWidth );
		int nPreviewHeight = ( int )( nPreviewWidth / flAspect + 0.5f );

		g_pMaterialSystem->BeginRenderTargetAllocation();								// Begin allocating RTs which IFM can scribble into

		// LDR final result of either HDR or LDR rendering
		m_ScreenBuffer.Init( g_pMaterialSystem->CreateNamedRenderTargetTextureEx2(
			"_rt_LayoffResult", nPreviewWidth, nPreviewHeight, RT_SIZE_OFFSCREEN,
			g_pMaterialSystem->GetBackBufferFormat(), MATERIAL_RT_DEPTH_SHARED, TEXTUREFLAGS_BORDER ) );

		g_pMaterialSystem->EndRenderTargetAllocation();									// End allocating RTs which IFM can scribble into
	}

	KeyValues *pVMTKeyValues = NULL;
	pVMTKeyValues= new KeyValues( "UnlitGeneric" );
	pVMTKeyValues->SetString( "$basetexture", m_ScreenBuffer->GetName() );
	pVMTKeyValues->SetInt( "$nofog", 1 );
	m_ScreenMaterial.Init( "MiniViewportEngineRenderAreaSceneMaterial", pVMTKeyValues );
	m_ScreenMaterial->Refresh();
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:36,代码来源:miniviewport.cpp

示例10:

ITexture *GetDefRT_Specular()
{
	Assert( g_tex_Specular.IsValid() );
	return g_tex_Specular;
}
开发者ID:,项目名称:,代码行数:5,代码来源:

示例11: ShutdownSceneMaterials

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CMiniViewportEngineRenderArea::ShutdownSceneMaterials()
{
	m_ScreenBuffer.Shutdown();
	m_ScreenMaterial.Shutdown();
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:8,代码来源:miniviewport.cpp

示例12: ReleaseLayoffTexture

//-----------------------------------------------------------------------------
// Called when the layoff texture needs to be released
//-----------------------------------------------------------------------------
void CMiniViewportEngineRenderArea::ReleaseLayoffTexture()
{
	m_ScreenBuffer.Shutdown();
	m_ScreenMaterial.Shutdown();
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:8,代码来源:miniviewport.cpp

示例13: ShutdownDefaultEnvCubemap

void CSceneViewerApp::ShutdownDefaultEnvCubemap( )
{
	CMatRenderContextPtr pRenderContext( g_pMaterialSystem );
	pRenderContext->BindLocalCubemap( NULL );
	m_DefaultEnvCubemap.Shutdown( );
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:6,代码来源:sceneviewer.cpp

示例14: InitDeferredRTs

void InitDeferredRTs( bool bInitial )
{
	if( bInitial ) // TODO: Does not work correctly mid game
	{
		// First determine if we are using low or high
		if( GetGPUMemLevel() <= GPU_MEM_LEVEL_LOW || GetCPULevel() <= CPU_LEVEL_LOW )
		{
			g_cms_comp_res_x = CSM_COMP_RES_X_LOW;
			g_cms_comp_res_y = CSM_COMP_RES_Y_LOW;
			g_cms_comp_res_islow = true;
		}
		else
		{
			g_cms_comp_res_x = CSM_COMP_RES_X_HIGH;
			g_cms_comp_res_y = CSM_COMP_RES_Y_HIGH;
			g_cms_comp_res_islow = false;
		}
	}

	if ( !bInitial )
		materials->ReEnableRenderTargetAllocation_IRealizeIfICallThisAllTexturesWillBeUnloadedAndLoadTimeWillSufferHorribly(); // HAHAHAHA. No.

	//int screen_w, screen_h;
	int dummy = 128;

	//materials->GetBackBufferDimensions( screen_w, screen_h );

const ImageFormat fmt_gbuffer0 =
#if DEFCFG_LIGHTCTRL_PACKING
		IMAGE_FORMAT_RGBA8888;
#else
		IMAGE_FORMAT_RGB888;
#endif

#if !DEFCFG_LIGHTCTRL_PACKING
	const ImageFormat fmt_gbuffer2 = IMAGE_FORMAT_RGBA8888;
#endif

#if DEFCFG_DEFERRED_SHADING == 1
	const ImageFormat fmt_gbuffer2 = IMAGE_FORMAT_RGBA8888;
	const ImageFormat fmt_gbuffer3 = IMAGE_FORMAT_RGB888;
#endif
	const ImageFormat fmt_gbuffer1 = IMAGE_FORMAT_R32F;
	const ImageFormat fmt_lightAccum =
#if DEFCFG_LIGHTACCUM_COMPRESSED
		IMAGE_FORMAT_RGBA8888;
#else
		IMAGE_FORMAT_RGBA16161616F;
#endif
	const ImageFormat fmt_volumAccum = IMAGE_FORMAT_RGB888;
	const ImageFormat fmt_projVGUI = IMAGE_FORMAT_RGB888;

	const bool bShadowUseColor = 
#ifdef SHADOWMAPPING_USE_COLOR
		true;
#else
		false;
#endif

	const ImageFormat fmt_depth = GetDeferredManager()->GetShadowDepthFormat();
	const ImageFormat fmt_depthColor = bShadowUseColor ? IMAGE_FORMAT_R32F
		: g_pMaterialSystemHardwareConfig->GetNullTextureFormat();
#if DEFCFG_ENABLE_RADIOSITY == 1
	const ImageFormat fmt_radAlbedo = IMAGE_FORMAT_RGB888;
	const ImageFormat fmt_radNormal = IMAGE_FORMAT_RGB888;
	const ImageFormat fmt_radBuffer = IMAGE_FORMAT_RGB888;
#endif // DEFCFG_ENABLE_RADIOSITY

	if ( fmt_depth == IMAGE_FORMAT_D16_SHADOW )
		g_flDepthScalar = pow( 2.0, 16 );
	else if ( fmt_depth == IMAGE_FORMAT_D24X8_SHADOW )
		g_flDepthScalar = pow( 2.0, 24 );

	AssertMsg( fmt_depth == IMAGE_FORMAT_D16_SHADOW || fmt_depth == IMAGE_FORMAT_D24X8_SHADOW, "Unexpected depth format" );

	unsigned int gbufferFlags =			TEXTUREFLAGS_CLAMPS | TEXTUREFLAGS_CLAMPT | TEXTUREFLAGS_RENDERTARGET | TEXTUREFLAGS_POINTSAMPLE;
	unsigned int lightAccumFlags =		TEXTUREFLAGS_CLAMPS | TEXTUREFLAGS_CLAMPT | TEXTUREFLAGS_RENDERTARGET | TEXTUREFLAGS_POINTSAMPLE;
	unsigned int volumAccumFlags =		TEXTUREFLAGS_CLAMPS | TEXTUREFLAGS_CLAMPT | TEXTUREFLAGS_RENDERTARGET;
	unsigned int depthFlags =			TEXTUREFLAGS_CLAMPS | TEXTUREFLAGS_CLAMPT | TEXTUREFLAGS_RENDERTARGET;
	unsigned int shadowColorFlags =		TEXTUREFLAGS_CLAMPS | TEXTUREFLAGS_CLAMPT | TEXTUREFLAGS_RENDERTARGET | TEXTUREFLAGS_POINTSAMPLE;
	unsigned int projVGUIFlags =		TEXTUREFLAGS_CLAMPS | TEXTUREFLAGS_CLAMPT | TEXTUREFLAGS_RENDERTARGET;
#if DEFCFG_ENABLE_RADIOSITY == 1
	unsigned int radAlbedoNormalFlags =	TEXTUREFLAGS_CLAMPS | TEXTUREFLAGS_CLAMPT | TEXTUREFLAGS_RENDERTARGET | TEXTUREFLAGS_POINTSAMPLE;
	unsigned int radBufferFlags =		TEXTUREFLAGS_CLAMPS | TEXTUREFLAGS_CLAMPT | TEXTUREFLAGS_RENDERTARGET;
	unsigned int radNormalFlags =		TEXTUREFLAGS_CLAMPS | TEXTUREFLAGS_CLAMPT | TEXTUREFLAGS_RENDERTARGET | TEXTUREFLAGS_POINTSAMPLE;
#endif // DEFCFG_ENABLE_RADIOSITY

	materials->BeginRenderTargetAllocation();

	shadowData_general_t generalShadowData;

	if ( bInitial )
	{
		g_tex_Normals.Init( materials->CreateNamedRenderTargetTextureEx2( DEFRTNAME_GBUFFER0,
			dummy, dummy,
			RT_SIZE_FULL_FRAME_BUFFER_ROUNDED_UP,
			fmt_gbuffer0,
#if DEFCFG_DEFERRED_SHADING == 1
			MATERIAL_RT_DEPTH_NONE,
#else
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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