Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
77 lines
1.5 KiB
Plaintext
77 lines
1.5 KiB
Plaintext
|
|
// Declare pixel shader version
|
|
ps.1.1
|
|
|
|
|
|
|
|
//RGBA
|
|
def c6, 0.0, 0.0, 1.0, 0.0
|
|
|
|
// Define constant for biasing back from [-0.5,0.5]
|
|
// to [0,1]
|
|
|
|
def c7, 0.5, 0.5, 0.5, 0.5
|
|
|
|
|
|
// Get colors from all 4 texture stages
|
|
|
|
tex t0 // 1st texel
|
|
tex t1 // 2nd texel
|
|
tex t2 // etc.
|
|
tex t3
|
|
|
|
|
|
// We could to this:
|
|
//PCN_MULTFACTOR 0
|
|
// mul r0, c[0], t0
|
|
// mad r1, c[0], t1, r0
|
|
// mad r0, c[0], t2, r1
|
|
// mad r0, c[0], t3, r0
|
|
//
|
|
// But that would loose low bits of precision, so instead
|
|
// we bias to 9 bit signed components and operate on those,
|
|
// shifting the end result back to the [0,1] unsigned range
|
|
// This is so that when averaging values of say,
|
|
// 1.0 and 1.0 the result will still be 1.0
|
|
// instead of saturating at 1.0 and being divided
|
|
// down to 0.5 for the average.
|
|
// The use of bias means that a value of 0.5 (127)
|
|
// stored in the texture actualy represents the
|
|
// value zero when doing the pixel math,
|
|
|
|
// Average the first two, then the second two
|
|
|
|
add_d2 r0, t0_bias, t1_bias
|
|
add_d2 r1, t2_bias, t3_bias
|
|
|
|
// Average the averages.
|
|
// Result is still in [-.5, .5] range
|
|
|
|
add_d2 r1, r0, r1
|
|
|
|
|
|
// Bring back to the [0,1] range
|
|
|
|
add r0, r1, c7
|
|
|
|
|
|
// It would be nice to preserve the un-filtered
|
|
// velocity, but we don't have a sample over the
|
|
// center texel and we're writing to a new color
|
|
// buffer, so no luck there.
|
|
|
|
//////////////////////////////////////////
|
|
// Replicate blue into alpha so that both
|
|
// contain the same position.
|
|
|
|
// replicate blue to all channels of r1
|
|
|
|
dp3 r1.rgba, r0, c6
|
|
|
|
|
|
// Update alpha of destination
|
|
|
|
mov r0.a, r1.a
|
|
|
|
|