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

📄 vertexlitgeneric_envmappedbumpmap_nolighting_ps14.vsh

📁 hl2 source code. Do not use it illegal.
💻 VSH
字号:
vs.1.1

;------------------------------------------------------------------------------
; Shader specific constant:
;	 c95	 = [sOffset, tOffset, 0, 0]
;------------------------------------------------------------------------------

#include "macros.vsh"

;------------------------------------------------------------------------------
; Vertex blending
;------------------------------------------------------------------------------

&AllocateRegister( \$worldPos );
&AllocateRegister( \$worldNormal );
&AllocateRegister( \$worldTangentS );
&AllocateRegister( \$worldTangentT );

&SkinPositionNormalAndTangentSpace( $g_numBones, $worldPos, $worldNormal, 
					$worldTangentS, $worldTangentT );

;------------------------------------------------------------------------------
; 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 );

;------------------------------------------------------------------------------
; Lighting
;------------------------------------------------------------------------------

; Transform tangent space basis vectors to env map space (world space)
; This will produce a set of vectors mapping from tangent space to env space
; We'll use this to transform normals from the normal map from tangent space
; to environment map space. 
; NOTE: use dp3 here since the basis vectors are vectors, not points

; svect
mov oT1.x, $worldTangentS.x
mov oT2.x, $worldTangentS.y
mov oT3.x, $worldTangentS.z
&FreeRegister( \$worldTangentS );

; tvect
mov oT1.y, $worldTangentT.x
mov oT2.y, $worldTangentT.y
mov oT3.y, $worldTangentT.z
&FreeRegister( \$worldTangentT );

; normal
mov oT1.z, $worldNormal.x
mov oT2.z, $worldNormal.y
mov oT3.z, $worldNormal.z
 
&FreeRegister( \$worldNormal );

; Compute the vector from vertex to camera
&AllocateRegister( \$eyeVector );
sub $eyeVector.xyz, $cEyePos, $worldPos  

&FreeRegister( \$worldPos );

; eye vector
mov oT4.xyz, $eyeVector

&FreeRegister( \$eyeVector );

;------------------------------------------------------------------------------
; Texture coordinates
;------------------------------------------------------------------------------
dp4 oT0.x, $vTexCoord0, c94
dp4 oT0.y, $vTexCoord0, c95


⌨️ 快捷键说明

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