Initial commit.
This commit is contained in:
30
code/x_shaders/bump.psh
Normal file
30
code/x_shaders/bump.psh
Normal file
@@ -0,0 +1,30 @@
|
||||
xps.1.1
|
||||
|
||||
tex t0 ; color map
|
||||
tex t1 ; normal map
|
||||
|
||||
#include "../win32/shader_constants.h"
|
||||
|
||||
; Dot product the bump with the light and halfangle vectors
|
||||
xdd r0, r1, t1_bx2, v0_bx2, t1_bx2, v1_bx2
|
||||
|
||||
; Factor in the light color and add ambient
|
||||
mad r0, r0_sat, c[CP_DIFFUSE_COLOR], c[CP_AMBIENT_COLOR]
|
||||
|
||||
; Raise N.H^2
|
||||
mul r1.a, r1_sat.a, r1_sat.a
|
||||
|
||||
; Modulate against base texture
|
||||
mul r0.rgb, r0.rgb, t0.rgb
|
||||
+mov r0.a, t0.a
|
||||
|
||||
; N.H^4,^16,^64
|
||||
mul r1.a, r1.a, r1.a
|
||||
mul r1.a, r1.a, r1.a
|
||||
mul r1.a, r1.a, r1.a
|
||||
|
||||
; Modulate the specular highlight by the gloss map
|
||||
mul r1.a, t1.a, r1.a
|
||||
|
||||
; Add the specular to the color
|
||||
xfc zero, zero, r0.rgb, prod, t1.a, r1.a, r0.a
|
||||
64
code/x_shaders/bump.vsh
Normal file
64
code/x_shaders/bump.vsh
Normal file
@@ -0,0 +1,64 @@
|
||||
;------------------------------------------------------------------------------
|
||||
; Vertex components (as specified in the vertex DECL)
|
||||
; v0 = pVertex[i].p
|
||||
; v1 = pVertex[i].n
|
||||
; v2 = pVertex[i].t0
|
||||
; v3 = pVertex[i].t1
|
||||
; v4 = pVertex[i].basis.vTangent;
|
||||
;------------------------------------------------------------------------------
|
||||
xvs.1.1
|
||||
|
||||
#include "../win32/shader_constants.h"
|
||||
|
||||
#pragma screenspace
|
||||
|
||||
; Transform position for world, view, and projection matrices
|
||||
m4x4 oPos, v0, c[CV_WORLDVIEWPROJ_0]
|
||||
|
||||
; Multiply by 1/w and add viewport offset.
|
||||
; r12 is a read-only alias for oPos.
|
||||
rcc r1.x, r12.w
|
||||
mad oPos.xyz, r12, r1.x, c[CV_VIEWPORT_OFFSETS]
|
||||
|
||||
; Pass thru the base tex coords
|
||||
mov oT0, v2
|
||||
mov oT1, v3
|
||||
|
||||
; Generate binormal vector
|
||||
mov r7, v4
|
||||
mul r8, r7.yzxw, v1.zxyw
|
||||
mad r8, -r7.zxyw, v1.yzxw, r8
|
||||
|
||||
; Get the light vector
|
||||
mov r1, c[CV_LIGHT_DIRECTION]
|
||||
|
||||
; Move the point light vector into tangent space
|
||||
; Put in tex coord set 2
|
||||
dp3 r3.x, r1, v4
|
||||
dp3 r3.y, r1, r8
|
||||
dp3 r3.z, r1, v1
|
||||
|
||||
; Multiply with 0.5 and add 0.5
|
||||
; Put it in diffuse
|
||||
mad oD0.xyz, r3.xyz, c[CV_HALF].yyyy, c[CV_HALF].yyyy
|
||||
|
||||
; Get the vector toward the camera
|
||||
mov r2, -c[CV_CAMERA_DIRECTION]
|
||||
|
||||
; Get the half angle
|
||||
add r2.xyz, r2.xyz, r1.xyz
|
||||
|
||||
; Normalize half angle
|
||||
dp3 r11.x, r2.xyz, r2.xyz
|
||||
rsq r11.xyz, r11.x
|
||||
mul r2.xyz, r2.xyz, r11.xyz
|
||||
|
||||
; Move the half angle into tangent space
|
||||
; Put in tex coord set 3
|
||||
dp3 r3.x, r2, v4
|
||||
dp3 r3.y, r2, r8
|
||||
dp3 r3.z, r2, v1
|
||||
|
||||
; Multiply with 0.5 and add 0.5
|
||||
; Put it in specular
|
||||
mad oD1.xyz, r3.xyz, c[CV_HALF].yyyy, c[CV_HALF].yyyy
|
||||
BIN
code/x_shaders/bump.xpu
Normal file
BIN
code/x_shaders/bump.xpu
Normal file
Binary file not shown.
BIN
code/x_shaders/bump.xvu
Normal file
BIN
code/x_shaders/bump.xvu
Normal file
Binary file not shown.
38
code/x_shaders/dlight.psh
Normal file
38
code/x_shaders/dlight.psh
Normal file
@@ -0,0 +1,38 @@
|
||||
xps.1.1
|
||||
|
||||
tex t0 ; base map
|
||||
tex t1 ; normal map
|
||||
tex t2 ; ranged point light vector
|
||||
tex t3 ; tangent space vector
|
||||
|
||||
#include "../win32/shader_constants.h"
|
||||
|
||||
; dot product bump and cube maps
|
||||
dp3 r1.rgb, t1_bx2, t3_bx2
|
||||
|
||||
; factor in falloff
|
||||
mul r0.rgb, r1.rgb, t2.a
|
||||
|
||||
; factor in the light color
|
||||
mul r0.rgb, r0.rgb, c[CP_DIFFUSE_COLOR]
|
||||
|
||||
; factor in base texture
|
||||
mul r0, r0, t0
|
||||
|
||||
xfc zero, zero, r0, zero, zero, zero, zero
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
56
code/x_shaders/dlight.vsh
Normal file
56
code/x_shaders/dlight.vsh
Normal file
@@ -0,0 +1,56 @@
|
||||
;------------------------------------------------------------------------------
|
||||
; Vertex components (as specified in the vertex DECL)
|
||||
; v0 = pVertex[i].p
|
||||
; v1 = pVertex[i].n
|
||||
; v2 = pVertex[i].t0
|
||||
; v3 = pVertex[i].Tangent
|
||||
;------------------------------------------------------------------------------
|
||||
xvs.1.1
|
||||
|
||||
#include "../win32/shader_constants.h"
|
||||
|
||||
#pragma screenspace
|
||||
|
||||
; Transform position for world, view, and projection matrices
|
||||
m4x4 oPos, v0, c[CV_WORLDVIEWPROJ_0]
|
||||
|
||||
; Multiply by 1/w and add viewport offset.
|
||||
; r12 is a read-only alias for oPos.
|
||||
rcc r1.x, r12.w
|
||||
mad oPos.xyz, r12, r1.x, c[CV_VIEWPORT_OFFSETS]
|
||||
|
||||
; Pass thru the base tex coords
|
||||
mov oT0, v2
|
||||
mov oT1, v2
|
||||
|
||||
; Generate binormal vector
|
||||
mov r7, v3
|
||||
mul r8, r7.yzxw, v1.zxyw
|
||||
mad r8, -r7.zxyw, v1.yzxw, r8
|
||||
|
||||
; Get the point light vector
|
||||
add r1, c[CV_LIGHT_POSITION], -v0
|
||||
|
||||
; Divide each component by the range value
|
||||
mul r2.xyz, r1.xyz, c[CV_ONE_OVER_LIGHT_RANGE].x
|
||||
|
||||
; Multiply with 0.5 and add 0.5
|
||||
; Put it in tex coord set 1
|
||||
mad oT2.xyz, r2.xyz, c[CV_HALF].yyyy, c[CV_HALF].yyyy
|
||||
|
||||
; Move the point light vector into tangent space
|
||||
dp3 r9.x, r1, v3
|
||||
dp3 r9.y, r1, r8
|
||||
dp3 r9.z, r1, v1
|
||||
|
||||
; Put the tangent space vector in tex coord set 2
|
||||
mov oT3.xyz, r9.xyz
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
code/x_shaders/dlight.xpu
Normal file
BIN
code/x_shaders/dlight.xpu
Normal file
Binary file not shown.
BIN
code/x_shaders/dlight.xvu
Normal file
BIN
code/x_shaders/dlight.xvu
Normal file
Binary file not shown.
53
code/x_shaders/environment.vsh
Normal file
53
code/x_shaders/environment.vsh
Normal file
@@ -0,0 +1,53 @@
|
||||
;------------------------------------------------------------------------------
|
||||
; Vertex components (as specified in the vertex DECL)
|
||||
; v0 = pVertex[i].p
|
||||
; v1 = pVertex[i].n
|
||||
;------------------------------------------------------------------------------
|
||||
xvs.1.1
|
||||
|
||||
#include "../win32/shader_constants.h"
|
||||
|
||||
#pragma screenspace
|
||||
|
||||
; Get the view vector
|
||||
add r2, c[CV_CAMERA_DIRECTION], -v0
|
||||
|
||||
; Normalize the view vector
|
||||
dp3 r11.x, r2.xyz, r2.xyz
|
||||
rsq r11.xyz, r11.x
|
||||
mul r2.xyz, r2.xyz, r11.xyz
|
||||
|
||||
; Get the dot product of the view vector
|
||||
; and the vertex normal
|
||||
dp3 r3.x, r2, v1
|
||||
|
||||
; Add the offsets
|
||||
mul r4.x, v1.x, r3.x
|
||||
mul r4.y, c[CV_HALF].x, r2.x
|
||||
sub oT0.x, r4.x, r4.y
|
||||
|
||||
mul r4.x, v1.y, r3.x
|
||||
mul r4.y, c[CV_HALF].x, r2.y
|
||||
sub oT0.y, r4.x, r4.y
|
||||
|
||||
mov oT0.z, c[CV_ONE].z
|
||||
|
||||
; Transform position for world, view, and projection matrices
|
||||
m4x4 oPos, v0, c[CV_WORLDVIEWPROJ_0]
|
||||
|
||||
; Multiply by 1/w and add viewport offset.
|
||||
; r12 is a read-only alias for oPos.
|
||||
rcc r1.x, r12.w
|
||||
mad oPos.xyz, r12, r1.x, c[CV_VIEWPORT_OFFSETS]
|
||||
|
||||
; Set the color
|
||||
mov oD0, v2
|
||||
|
||||
; Transform vertex to view space
|
||||
m4x4 r0, v0, c[CV_VIEW_0]
|
||||
|
||||
; Use distance from vertex to eye as fog factor
|
||||
dp3 r0.w, r0, r0
|
||||
rsq r1.w, r0.w
|
||||
mul oFog.x, r0.w, r1.w
|
||||
|
||||
BIN
code/x_shaders/environment.xvu
Normal file
BIN
code/x_shaders/environment.xvu
Normal file
Binary file not shown.
25
code/x_shaders/extracthot.psh
Normal file
25
code/x_shaders/extracthot.psh
Normal file
@@ -0,0 +1,25 @@
|
||||
;------------------------------------------------------------------------------
|
||||
; Filter to get extract "hot" parts of the image
|
||||
;
|
||||
; Copyright (C) 2002 Microsoft Corporation
|
||||
; All rights reserved.
|
||||
;------------------------------------------------------------------------------
|
||||
xps.1.1
|
||||
|
||||
; source textures
|
||||
tex t0
|
||||
tex t1
|
||||
|
||||
#include "../win32/shader_constants.h"
|
||||
|
||||
; We've set our original depth/stencil as an ARGB texture, put stencil in A:
|
||||
mov r0, t1.b
|
||||
|
||||
; Remove low end
|
||||
sub r1, t0, c[CP_EXTRACT_CUTOFF] ; Remove low end
|
||||
|
||||
; Throw out pixels that weren't stenciled:
|
||||
cnd r0, r0.a, r1, zero
|
||||
|
||||
; Output = r0 + SCALE*r0 = (1+SCALE) * r0
|
||||
xfc c[CP_EXTRACT_SCALE], r0_sat, zero, r0_sat, zero, zero, r0_sat.a
|
||||
BIN
code/x_shaders/extracthot.xpu
Normal file
BIN
code/x_shaders/extracthot.xpu
Normal file
Binary file not shown.
30
code/x_shaders/hotblur.psh
Normal file
30
code/x_shaders/hotblur.psh
Normal file
@@ -0,0 +1,30 @@
|
||||
;------------------------------------------------------------------------------
|
||||
; Filter to blur and image.
|
||||
;
|
||||
; Copyright (C) 2002 Microsoft Corporation
|
||||
; All rights reserved.
|
||||
;------------------------------------------------------------------------------
|
||||
xps.1.1
|
||||
|
||||
; Default filter is box filter, but this is easily overwritten using SetPixelShaderConstant
|
||||
|
||||
; When setting a pixel shader constant in the main application, we must check to see if the
|
||||
; filter coefficient is negative, in which case we set the constant as a positive
|
||||
; number and negate the constant in the expression below.
|
||||
|
||||
def c0, 0.25f, 0.25f, 0.25f, 0.25f
|
||||
def c1, 0.25f, 0.25f, 0.25f, 0.25f
|
||||
def c2, 0.25f, 0.25f, 0.25f, 0.25f
|
||||
def c3, 0.25f, 0.25f, 0.25f, 0.25f
|
||||
|
||||
; source textures
|
||||
tex t0
|
||||
tex t1
|
||||
tex t2
|
||||
tex t3
|
||||
|
||||
xmma discard, discard, r0, c0, t0, c1, t1 ;r0 = (c0 * t0 + c1 * t1)
|
||||
xmma discard, discard, r1, c2, t2, c3, t3 ;r1 = (c2 * t2 + c3 * t3)
|
||||
add r0, r0_sat, r1_sat ;r0 = r0 + r1
|
||||
|
||||
xfc zero, zero, zero, r0, zero, zero, r0.a
|
||||
BIN
code/x_shaders/hotblur.xpu
Normal file
BIN
code/x_shaders/hotblur.xpu
Normal file
Binary file not shown.
10
code/x_shaders/rain.psh
Normal file
10
code/x_shaders/rain.psh
Normal file
@@ -0,0 +1,10 @@
|
||||
xps.1.1
|
||||
|
||||
tex t0 // normal texture lookup in t0
|
||||
|
||||
;mov r0.a, v0.a // Move alpha channel into r0
|
||||
|
||||
// blend modulated colors
|
||||
;xfc r0.a, t0, zero, Zero, zero, zero, r0.a
|
||||
|
||||
mul r0, v0, t0
|
||||
59
code/x_shaders/rain.vsh
Normal file
59
code/x_shaders/rain.vsh
Normal file
@@ -0,0 +1,59 @@
|
||||
;------------------------------------------------------------------------------
|
||||
; Vertex components (as specified in the vertex DECL)
|
||||
; v0 = vPosition
|
||||
; v1 = vFields
|
||||
; v2 = vTex
|
||||
;------------------------------------------------------------------------------
|
||||
xvs.1.1
|
||||
|
||||
#define LEFT r6
|
||||
#define DOWN r7
|
||||
#define TEMPPOS r8
|
||||
#define TEMP r9
|
||||
#define TEMPALPHA r10
|
||||
|
||||
#define CV_ONE 1
|
||||
#define CV_WORLDVIEWPROJ_0 2
|
||||
#define CV_WORLDVIEWPROJ_1 3
|
||||
#define CV_WORLDVIEWPROJ_2 4
|
||||
#define CV_WORLDVIEWPROJ_3 5
|
||||
#define CV_ALPHA 20
|
||||
#define CV_FADEALPHA 21
|
||||
#define CV_LEFT 26
|
||||
#define CV_DOWN 27
|
||||
|
||||
|
||||
; get possible alpha source
|
||||
; alpha = mAlpha * (pos.y / -item->pos.z);
|
||||
;rcp r10.x, -v0.z
|
||||
;mul r10.x, v2.z, r10.x
|
||||
;mul r10.x, c[CV_ALPHA].w, r10.x
|
||||
|
||||
; if (alpha > mAlpha) alpha = mAlpha
|
||||
;min r10.x, r10.x, c[CV_ALPHA].w
|
||||
|
||||
; set the constant color to add alpha to
|
||||
mov oD0, c[CV_ONE]
|
||||
|
||||
; set the alpha fade
|
||||
;mov r11.w, c[CV_ALPHA].w
|
||||
;mul oD0.w, c[CV_FADEALPHA].w, r10.x
|
||||
mov oD0.w, v2.z
|
||||
|
||||
; Pass thru the tex coords
|
||||
mov oT0.xy, v2.xy
|
||||
|
||||
; Add in other angles based on the field
|
||||
mul LEFT, v1.y, c[CV_LEFT]
|
||||
mul DOWN, v1.z, c[CV_DOWN]
|
||||
|
||||
; Set the final position
|
||||
add r4, v0, LEFT
|
||||
add r4, DOWN, r4
|
||||
|
||||
; Transform position to clip space
|
||||
dp4 oPos.x, r4, c[CV_WORLDVIEWPROJ_0]
|
||||
dp4 oPos.y, r4, c[CV_WORLDVIEWPROJ_1]
|
||||
dp4 oPos.z, r4, c[CV_WORLDVIEWPROJ_2]
|
||||
dp4 oPos.w, r4, c[CV_WORLDVIEWPROJ_3]
|
||||
|
||||
30
code/x_shaders/shadow.vsh
Normal file
30
code/x_shaders/shadow.vsh
Normal file
@@ -0,0 +1,30 @@
|
||||
;------------------------------------------------------------------------------
|
||||
; Vertex components (as specified in the vertex DECL)
|
||||
; v0 = pVertex[i].p
|
||||
; v1 = extrusion determinant
|
||||
;------------------------------------------------------------------------------
|
||||
xvs.1.1
|
||||
|
||||
#include "../win32/shader_constants.h"
|
||||
|
||||
#pragma screenspace
|
||||
|
||||
; Determine the distance to the ground
|
||||
add r4, v0, c[CV_SHADOW_FACTORS]
|
||||
sub r5, r4, c[CV_SHADOW_PLANE]
|
||||
|
||||
; Factor in the extrusion determinant
|
||||
; r3 will either be the distance to the ground, or 0
|
||||
mul r3, v1.x, -r5
|
||||
|
||||
; Extrude the vertex if necessary
|
||||
mad r0, r3.z, c[CV_LIGHT_DIRECTION].xyz, v0.xyz
|
||||
mov r0.w, v0.w
|
||||
|
||||
; transform to hclip space
|
||||
m4x4 oPos, r0, c[CV_WORLDVIEWPROJ_0]
|
||||
|
||||
; Multiply by 1/w and add viewport offset.
|
||||
; r12 is a read-only alias for oPos.
|
||||
rcc r1.x, r12.w
|
||||
mad oPos.xyz, r12, r1.x, c[CV_VIEWPORT_OFFSETS]
|
||||
BIN
code/x_shaders/shadow.xvu
Normal file
BIN
code/x_shaders/shadow.xvu
Normal file
Binary file not shown.
15
code/x_shaders/specular_dynamic.psh
Normal file
15
code/x_shaders/specular_dynamic.psh
Normal file
@@ -0,0 +1,15 @@
|
||||
xps.1.1
|
||||
|
||||
tex t0 ; normal map + gloss map
|
||||
|
||||
texm3x2pad t1, t0_bx2 ; u = t0 dot (t1) light vector
|
||||
texm3x2tex t2, t0_bx2 ; v = t0 dot (t2) half vector
|
||||
; fetch texture 4 at u, v
|
||||
; t2.a = (N dot H)^16
|
||||
|
||||
tex t3 ; ranged point light vector
|
||||
|
||||
mul_x4 r1, t0.a, t2.a ; (N dot H)^16 * gloss value
|
||||
|
||||
; Factor in falloff
|
||||
mul r0.rgb, r1, t3.a
|
||||
68
code/x_shaders/specular_dynamic.vsh
Normal file
68
code/x_shaders/specular_dynamic.vsh
Normal file
@@ -0,0 +1,68 @@
|
||||
;------------------------------------------------------------------------------
|
||||
; Vertex components (as specified in the vertex DECL)
|
||||
; v0 = pVertex[i].p
|
||||
; v1 = pVertex[i].n
|
||||
; v2 = pVertex[i].t0
|
||||
; v3 = pVertex[i].basis.vTangent;
|
||||
;------------------------------------------------------------------------------
|
||||
xvs.1.1
|
||||
|
||||
#include "../win32/shader_constants.h"
|
||||
|
||||
#pragma screenspace
|
||||
|
||||
; Transform position for world, view, and projection matrices
|
||||
m4x4 oPos, v0, c[CV_WORLDVIEWPROJ_0]
|
||||
|
||||
; Multiply by 1/w and add viewport offset.
|
||||
; r12 is a read-only alias for oPos.
|
||||
rcc r1.x, r12.w
|
||||
mad oPos.xyz, r12, r1.x, c[CV_VIEWPORT_OFFSETS]
|
||||
|
||||
; Generate binormal vector
|
||||
mov r7, v3
|
||||
mul r8, r7.yzxw, v1.zxyw
|
||||
mad r8, -r7.zxyw, v1.yzxw, r8
|
||||
|
||||
; Get the light vector
|
||||
add r10, c[CV_LIGHT_POSITION], -v0
|
||||
|
||||
; Divide each component by the range value
|
||||
mul r3.xyz, r10.xyz, c[CV_ONE_OVER_LIGHT_RANGE].x
|
||||
|
||||
; Multiply with 0.5 and add 0.5
|
||||
; Put it in tex coord set 3
|
||||
mad oT3.xyz, r3.xyz, c[CV_HALF].yyyy, c[CV_HALF].yyyy
|
||||
|
||||
; Normalize the light vector
|
||||
dp3 r11.x, r10.xyz, r10.xyz
|
||||
rsq r11.xyz, r11.x
|
||||
mul r10.xyz, r10.xyz, r11.xyz
|
||||
|
||||
; Move the light vector into tangent space
|
||||
; Put into T1
|
||||
dp3 oT1.x, r10, v3
|
||||
dp3 oT1.y, r10, r8
|
||||
dp3 oT1.z, r10, v1
|
||||
|
||||
; Get the vector toward the camera
|
||||
mov r2, -c[CV_CAMERA_DIRECTION]
|
||||
|
||||
; Get the half angle
|
||||
add r2.xyz, r2.xyz, r10.xyz
|
||||
|
||||
; Normalize half angle
|
||||
dp3 r11.x, r2.xyz, r2.xyz
|
||||
rsq r11.xyz, r11.x
|
||||
mul r2.xyz, r2.xyz, r11.xyz
|
||||
|
||||
; Move the half angle into tangent space
|
||||
dp3 oT2.x, r2, v3
|
||||
dp3 oT2.y, r2, r8
|
||||
dp3 oT2.z, r2, v1
|
||||
|
||||
; Move the bump map coordinates into t0
|
||||
mov oT0.xyz, v2
|
||||
|
||||
|
||||
|
||||
BIN
code/x_shaders/specular_dynamic.xpu
Normal file
BIN
code/x_shaders/specular_dynamic.xpu
Normal file
Binary file not shown.
BIN
code/x_shaders/specular_dynamic.xvu
Normal file
BIN
code/x_shaders/specular_dynamic.xvu
Normal file
Binary file not shown.
10
code/x_shaders/specular_static.psh
Normal file
10
code/x_shaders/specular_static.psh
Normal file
@@ -0,0 +1,10 @@
|
||||
xps.1.1
|
||||
|
||||
tex t0 ; normal map + gloss map
|
||||
|
||||
texm3x2pad t1, t0_bx2 ; u = t0 dot (t1) light vector
|
||||
texm3x2tex t2, t0_bx2 ; v = t0 dot (t2) half vector
|
||||
; fetch texture 4 at u, v
|
||||
; t2.a = (N dot H)^16
|
||||
|
||||
mul r0, t0.a, t2.a ; (N dot H)^16 * gloss value
|
||||
53
code/x_shaders/specular_static.vsh
Normal file
53
code/x_shaders/specular_static.vsh
Normal file
@@ -0,0 +1,53 @@
|
||||
;------------------------------------------------------------------------------
|
||||
; Vertex components (as specified in the vertex DECL)
|
||||
; v0 = pVertex[i].p
|
||||
; v1 = pVertex[i].n
|
||||
; v2 = pVertex[i].t0
|
||||
; v3 = pVertex[i].basis.vTangent;
|
||||
;------------------------------------------------------------------------------
|
||||
xvs.1.1
|
||||
|
||||
#include "../win32/shader_constants.h"
|
||||
|
||||
#pragma screenspace
|
||||
|
||||
; Transform position for world, view, and projection matrices
|
||||
m4x4 oPos, v0, c[CV_WORLDVIEWPROJ_0]
|
||||
|
||||
; Multiply by 1/w and add viewport offset.
|
||||
; r12 is a read-only alias for oPos.
|
||||
rcc r1.x, r12.w
|
||||
mad oPos.xyz, r12, r1.x, c[CV_VIEWPORT_OFFSETS]
|
||||
|
||||
; Generate binormal vector
|
||||
mov r7, v3
|
||||
mul r8, r7.yzxw, v1.zxyw
|
||||
mad r8, -r7.zxyw, v1.yzxw, r8
|
||||
|
||||
; Get the light vector
|
||||
mov r10, c[CV_LIGHT_DIRECTION]
|
||||
|
||||
; Move the light vector into tangent space
|
||||
; Put into T1
|
||||
dp3 oT1.x, r10, v3
|
||||
dp3 oT1.y, r10, r8
|
||||
dp3 oT1.z, r10, v1
|
||||
|
||||
; Get the vector toward the camera
|
||||
mov r2, -c[CV_CAMERA_DIRECTION]
|
||||
|
||||
; Get the half angle
|
||||
add r2.xyz, r2.xyz, r10.xyz
|
||||
|
||||
; Normalize half angle
|
||||
dp3 r11.x, r2.xyz, r2.xyz
|
||||
rsq r11.xyz, r11.x
|
||||
mul r2.xyz, r2.xyz, r11.xyz
|
||||
|
||||
; Move the half angle into tangent space
|
||||
dp3 oT2.x, r2, v3
|
||||
dp3 oT2.y, r2, r8
|
||||
dp3 oT2.z, r2, v1
|
||||
|
||||
; Move the bump map coordinates into t0
|
||||
mov oT0.xyz, v2
|
||||
BIN
code/x_shaders/specular_static.xpu
Normal file
BIN
code/x_shaders/specular_static.xpu
Normal file
Binary file not shown.
BIN
code/x_shaders/specular_static.xvu
Normal file
BIN
code/x_shaders/specular_static.xvu
Normal file
Binary file not shown.
Reference in New Issue
Block a user