⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unlitgeneric_inc.vsh

📁 hl2 source code. Do not use it illegal.
💻 VSH
字号:
#include "macros.vsh"

;------------------------------------------------------------------------------
;	 c20	 = Modulation color  BUGBUGBUG
;	 c90-c91 = Base texture transform
;    c92-c93 = Mask texture transform
;    c94-c95 = Detail texture transform
;------------------------------------------------------------------------------

sub UnlitGeneric
{
	local( $detail ) = shift;
	local( $envmap ) = shift;
	local( $envmapcameraspace ) = shift;
	local( $envmapsphere ) = shift;
	local( $vertexcolor ) = shift;

	local( $worldPos, $worldNormal, $projPos, $reflectionVector );

	;------------------------------------------------------------------------------
	; Vertex blending
	;------------------------------------------------------------------------------
	&AllocateRegister( \$worldPos );
	if( $envmap )
	{
		&AllocateRegister( \$worldNormal );
		&SkinPositionAndNormal( $g_numBones, $worldPos, $worldNormal );
	}
	else
	{
		&SkinPosition( $g_numBones, $worldPos );
	}

	;------------------------------------------------------------------------------
	; Transform the position from world to proj space
	;------------------------------------------------------------------------------

	&AllocateRegister( \$projPos );

	dp4 $projPos.x, $worldPos, $cViewProj0
	dp4 $projPos.y, $worldPos, $cViewProj1
	dp4 $projPos.z, $worldPos, $cViewProj2
	dp4 $projPos.w, $worldPos, $cViewProj3
	mov oPos, $projPos

	;------------------------------------------------------------------------------
	; Fog
	;------------------------------------------------------------------------------
	&CalcFog( $worldPos, $projPos );
	&FreeRegister( \$projPos );

	if( !$envmap )
	{
		&FreeRegister( \$worldPos );
	}


	
	;------------------------------------------------------------------------------
	; Texture coordinates (use world-space normal for envmap, tex transform for mask)
	;------------------------------------------------------------------------------
	dp4 oT0.x, $vTexCoord0, c90	; FIXME
	dp4 oT0.y, $vTexCoord0, c91	; FIXME

	if( $envmap )
	{
		if( $envmapcameraspace )
		{
			&AllocateRegister( \$reflectionVector );
			&ComputeReflectionVector( $worldPos, $worldNormal, $reflectionVector );

			; transform reflection vector into view space
			dp3 oT1.x, $reflectionVector, $cViewModel0
			dp3 oT1.y, $reflectionVector, $cViewModel1
			dp3 oT1.z, $reflectionVector, $cViewModel2

			&FreeRegister( \$reflectionVector );
		}
		elsif( $envmapsphere )
		{
			&AllocateRegister( \$reflectionVector );
			&ComputeReflectionVector( $worldPos, $worldNormal, $reflectionVector );
			&ComputeSphereMapTexCoords( $reflectionVector, "oT1" );

			&FreeRegister( \$reflectionVector );
		}
		else
		{
			&ComputeReflectionVector( $worldPos, $worldNormal, "oT1" );
		}

		; envmap mask
		dp4 oT2.x, $vTexCoord0, c92	; FIXME
		dp4 oT2.y, $vTexCoord0, c93 ; FIXME

		&FreeRegister( \$worldPos );
		&FreeRegister( \$worldNormal );
	}

	if( $detail )
	{
		dp4 oT3.x, $vTexCoord0, c94		; FIXME
		dp4 oT3.y, $vTexCoord0, c95		; FIXME
	}

	if( $vertexcolor )
	{
		; Modulation color
		mul oD0, $vColor, $cModulationColor
	}
	else
	{
		; Modulation color
		mov oD0, $cModulationColor
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -