Restructure repository to include all source folders
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>
This commit is contained in:
67
GameTools/WORLDCREATOR/Shader/Dot3x2EmbMap_SrcAlpha.psh
Normal file
67
GameTools/WORLDCREATOR/Shader/Dot3x2EmbMap_SrcAlpha.psh
Normal file
@@ -0,0 +1,67 @@
|
||||
|
||||
// Declare pixel shader version
|
||||
ps.1.1
|
||||
|
||||
|
||||
// Define c[PCN_RED_MASK] as RGBA = (scale, 0, 0, 0)
|
||||
// Where scale [0,1] is applied to reduce the magnitude
|
||||
// of the s axis component of the normal.
|
||||
// Define c[PCN_GREEN_MASK] similarly to affect the
|
||||
// t axis component
|
||||
|
||||
|
||||
// blue mask for r axis component (blue = up out of texture)
|
||||
|
||||
//@@def c4, 0.0, 0.0, 1.0, 1.0
|
||||
|
||||
|
||||
def c2, 0.5, 0.5, 0.0, 0.0
|
||||
def c1, 1.0, 1.0, 0.0, 0.0
|
||||
|
||||
def c3, 0.0, 0.0, 1.0, 0.0
|
||||
|
||||
|
||||
// Get colors from all 4 texture stages
|
||||
// These are the neighbor samples used to calculate slopes
|
||||
// for the surface displacements
|
||||
// t0 = -s, 0
|
||||
// t1 = +s, 0
|
||||
// t2 = 0, +t
|
||||
// t3 = 0, -t
|
||||
|
||||
|
||||
|
||||
tex t0
|
||||
tex t1
|
||||
tex t2
|
||||
tex t3
|
||||
|
||||
|
||||
|
||||
// Source height from texture alpha! This is to allow for packing
|
||||
// other data into the .rgb fields.
|
||||
|
||||
|
||||
sub_x4 r0.a, t0, t1 // (t0 - t1)*4 : 4 for higher scale
|
||||
|
||||
mul t0.rgb, r0.a, c[5] // t0 = s result in red only
|
||||
|
||||
+ sub_x4 r1.a, t3, t2 // r1 = t result in alpha
|
||||
|
||||
mad r0, r1.a, c[6], t0 // r0 = red,green for s and t result
|
||||
//////
|
||||
//@@@@@ the red and green masks may scale down the displacements.
|
||||
// they are subsequently scaled up below. This looses precision, so
|
||||
// this should be re-coded to use mask values of 1.0 and scale
|
||||
// the result after.
|
||||
|
||||
|
||||
////////////////////////////////
|
||||
// increase scale
|
||||
// bases displacement about center 0.5 0.5
|
||||
|
||||
add_x2 r0, r0, r0
|
||||
|
||||
add r0, r0, c2 // bias red,green to 0.5
|
||||
|
||||
add r0, r0, c3 // add blue = 1.0
|
||||
76
GameTools/WORLDCREATOR/Shader/EqualCombine.psh
Normal file
76
GameTools/WORLDCREATOR/Shader/EqualCombine.psh
Normal file
@@ -0,0 +1,76 @@
|
||||
|
||||
// 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
|
||||
|
||||
|
||||
40
GameTools/WORLDCREATOR/Shader/Water.psh
Normal file
40
GameTools/WORLDCREATOR/Shader/Water.psh
Normal file
@@ -0,0 +1,40 @@
|
||||
|
||||
|
||||
// Declare pixel shader version 1.0
|
||||
ps.1.1
|
||||
|
||||
|
||||
|
||||
def c1, 0.5, 0.5, 0.5, 0.5
|
||||
def c2, 0.7, 0.7, 0.7, 0.7
|
||||
def c3, 1.0, 1.0, 1.0, 1.0
|
||||
|
||||
|
||||
|
||||
tex t0
|
||||
|
||||
|
||||
|
||||
texm3x2pad t2, t0_bx2
|
||||
texm3x2tex t3, t0_bx2
|
||||
|
||||
|
||||
|
||||
mov r0, t3
|
||||
|
||||
|
||||
dp3 r1.rgba, t0_bx2, v0_bx2
|
||||
|
||||
|
||||
|
||||
mad r0.a, r1.a, c1.a, c1.a
|
||||
mul r0.a, r0.a, r0.a
|
||||
mul r0.a, r0.a, r0.a
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
// use this line to set alpha to 0
|
||||
;mov r0.a, 1-c3
|
||||
|
||||
|
||||
|
||||
|
||||
92
GameTools/WORLDCREATOR/Shader/Water.vsh
Normal file
92
GameTools/WORLDCREATOR/Shader/Water.vsh
Normal file
@@ -0,0 +1,92 @@
|
||||
|
||||
|
||||
vs.1.1
|
||||
|
||||
|
||||
// Transform position to clip space and output it
|
||||
|
||||
dp4 oPos.x, v0, c[2]
|
||||
dp4 oPos.y, v0, c[3]
|
||||
dp4 oPos.z, v0, c[4]
|
||||
dp4 oPos.w, v0, c[5]
|
||||
|
||||
add r4, -v0, c[56]
|
||||
|
||||
|
||||
mul r3, r4, c[42].zzxx
|
||||
|
||||
|
||||
dp3 r3.w, r3, r3 // 3 instruction normalization
|
||||
rsq r3.w, r3.w
|
||||
mul r3.xyz, r3, r3.w
|
||||
|
||||
mad r7, r3, c[55].wwxx, c[55].xxyx
|
||||
|
||||
mad r8, r3.yxzz, c[55].wzxx, c[55].xxyx
|
||||
|
||||
|
||||
dp3 r4.w, r4, r4
|
||||
rsq r4.w, r4.w
|
||||
mul r4.xyz, r4, r4.w
|
||||
|
||||
|
||||
max r4.z, r4.z, -r4.z
|
||||
|
||||
|
||||
add r5, c[1], -r4.zzzz
|
||||
|
||||
|
||||
|
||||
mul r10, r5, r5
|
||||
mul r10, r10, r10
|
||||
mul r10, r10, c[42].w // mult by two
|
||||
|
||||
mul r10, r10, c[52]
|
||||
|
||||
|
||||
|
||||
add r10, c[1], -r10
|
||||
|
||||
|
||||
sge r10.w, r10.x, c[42].x
|
||||
mul r10, r10, r10.w
|
||||
|
||||
|
||||
|
||||
mul r7.xy, r7, r10
|
||||
mul r8.xy, r8, r10
|
||||
|
||||
|
||||
|
||||
|
||||
mul r5, r5, r5
|
||||
mul r5, r5, c[42].y
|
||||
|
||||
|
||||
//mov oD0, r5 // Option for diagnosis --
|
||||
// display the result as color
|
||||
|
||||
|
||||
|
||||
|
||||
mad oT2.z, r5, r3.x, r7.z
|
||||
mad oT3.z, r5, r3.y, r8.z
|
||||
|
||||
|
||||
|
||||
|
||||
mul oT2.xy, r7, c[53]
|
||||
mul oT3.xy, r8, c[53]
|
||||
|
||||
|
||||
|
||||
|
||||
mad oD0, r4, c[42].y, c[42].y
|
||||
|
||||
|
||||
|
||||
mov oT0.xy, v1
|
||||
|
||||
|
||||
|
||||
|
||||
104
GameTools/WORLDCREATOR/Shader/WaterAni1.psh
Normal file
104
GameTools/WORLDCREATOR/Shader/WaterAni1.psh
Normal file
@@ -0,0 +1,104 @@
|
||||
|
||||
|
||||
// Declare pixel shader version
|
||||
ps.1.1
|
||||
|
||||
|
||||
// Define a few masks and biasing values for putting things
|
||||
// in the right place
|
||||
|
||||
def c3, 0.5, 0.0, 0.0, 0.0
|
||||
def c4, 0.0, 1.0, 1.0, 1.0
|
||||
def c5, 1.0, 0.0, 0.0, 0.0
|
||||
|
||||
def c6, 0.0, 0.0, 1.0, 0.0
|
||||
|
||||
def c7, 0.5, 0.5, 0.5, 0.5 // Constant to determine equilibrium position
|
||||
// A gentle force pulls the blue and alpha to this
|
||||
// value.
|
||||
|
||||
|
||||
// Height must be in blue and alpha components
|
||||
// Red = force
|
||||
// green = velocity
|
||||
|
||||
// Get colors from all 4 texture stages
|
||||
// A vertex shader sets up texture coordinates so that the sampled
|
||||
// texels are the following for the pixel being rendered:
|
||||
//
|
||||
// t0 = texel at coordinate we are rendering to, and for which
|
||||
// we are computing the force.
|
||||
// t1 = 1st neighbor to the t0 texel
|
||||
// t2 = 2nd neighbor
|
||||
// t3 = 3rd neighbor
|
||||
|
||||
tex t0
|
||||
tex t1
|
||||
tex t2
|
||||
tex t3
|
||||
|
||||
|
||||
|
||||
sub r0.rgb, t1, t0 // Diff between 1st neighbor and center texel
|
||||
+ sub r0.a, t2.b, t0.b // Diff between 2nd neighbor and center texel
|
||||
// Use blue replicate to move blue into alpha
|
||||
// as the alpha might be dirty from a previous
|
||||
// alpha blend
|
||||
|
||||
//@@ + sub r0.a, t2.a, t0.a // Diff between 2nd neighbor and center texel
|
||||
|
||||
|
||||
// c7 - t0
|
||||
sub r1.rgb, c7, t0 // Force to pull t0 center to the c7 equilibrium value
|
||||
+ sub r1.a, t3.b, t0.b // Diff between 3rd neighbor and center texel to .a
|
||||
// Use blue replicate to move blue into alpha
|
||||
// as the alpha might be dirty from a previous
|
||||
// alpha blend
|
||||
|
||||
//@@ + sub r1.a, t3.a, t0.a // Diff between 3rd neighbor and center texel to .a
|
||||
|
||||
|
||||
|
||||
// Multiply r1.rgb by PCN_EQ_REST_FAC, and add it to the r0.rgb
|
||||
// Also add the .a components with no scaling factor -- all neighbor differences
|
||||
// scale the same.
|
||||
// Reason for multiplying by PCN_EQ_REST_FAC is to vary the strength of the
|
||||
// force pulling the center position to the value defined in c7
|
||||
|
||||
mad r1.rgb, r1, c[2], r0 // scale the equilibrium restore force
|
||||
+ add r1.a, r1.a, r0.a // Add 3rd neighbor diff to 2nd neighbor diff
|
||||
|
||||
|
||||
|
||||
// Add the force components in alpha to the force components in blue
|
||||
|
||||
add r1, r1, r1.a // r1 = r1.rgba + r1.aaaa
|
||||
// Blue now holds the correct total 'force' before
|
||||
// biasing to the unsigned range.
|
||||
|
||||
|
||||
// Replicate blue to rgba with a dp3
|
||||
// This is to move the total force into the red component so we can
|
||||
// store it in the texture render target.
|
||||
|
||||
|
||||
dp3 r1.rgba, r1, c6
|
||||
|
||||
|
||||
|
||||
// Mask force to red only, and add 0.5 red to bias the signed
|
||||
// force value up to center about 0.5. This is so we can store
|
||||
// the force value in the unsigned bits of the texture target
|
||||
|
||||
mad r1.rgba, r1, c5, c3
|
||||
|
||||
|
||||
// Mask off red of t0 source and put the r1 force result into red.
|
||||
// This carries forward the t0 position (blue,alpha) and velocity (green)
|
||||
// to the next stage
|
||||
// The output contains ( 0, t0.g, t0.b, t0.a ) + ( r1.r, 0, 0, 0 )
|
||||
|
||||
mad r0.rgba, t0, c4, r1
|
||||
|
||||
|
||||
|
||||
104
GameTools/WORLDCREATOR/Shader/WaterAni2.psh
Normal file
104
GameTools/WORLDCREATOR/Shader/WaterAni2.psh
Normal file
@@ -0,0 +1,104 @@
|
||||
|
||||
|
||||
// Declare pixel shader version
|
||||
ps.1.1
|
||||
|
||||
|
||||
// t0 = center height in blue and alpha,
|
||||
// velocity in green
|
||||
// partial force in red
|
||||
//
|
||||
// t1 = 4th neighbor point height in blue and alpha
|
||||
// red and green are irrelevant
|
||||
//
|
||||
// c[0] = RGBA = 0, force apply factor, 0, 0
|
||||
// c[1] = RGBA = 0, 0, velocity_apply factor, 0
|
||||
//
|
||||
|
||||
|
||||
// Define some masks for the various components
|
||||
// R,G,B,A
|
||||
|
||||
def c5, 0.0, 0.5, 0.0, 0.0
|
||||
def c6, 0.0, 1.0, 0.0, 0.0
|
||||
|
||||
def c7, 1.0, 0.0, 0.0, 0.0
|
||||
|
||||
|
||||
|
||||
tex t0 // see above for what these should be
|
||||
tex t1
|
||||
|
||||
|
||||
|
||||
// In alpha, subtract center position from 4th neighbor position
|
||||
// In rgb, bias the previous force back down to [-.5, .5] range, and also
|
||||
// bias prev velocity down to [-.5, .5] range. Other r0 fields will be
|
||||
// masked out.
|
||||
|
||||
mov r0.rgb, t0_bias
|
||||
+ sub r0.a, t1.b, t0.b // force from last neighbor
|
||||
// Use .b to replicate blue to alpha
|
||||
|
||||
|
||||
// Add 4th neighbor differece to previous force
|
||||
// Use t1 as temporary storage
|
||||
|
||||
add t1.rgba, r0, r0.a // r0.red + r0.aaaa
|
||||
|
||||
|
||||
|
||||
// t1.r is now the total force for all 4 neighbors
|
||||
// Move total force into green (into all components).
|
||||
// This is so we can apply the force value to the
|
||||
// velocity value held in the green input component.
|
||||
|
||||
dp3 t1.rgba, t1, c7
|
||||
|
||||
|
||||
|
||||
// Multiply total force by scale factor and add to
|
||||
// velocity (held in t0.green, biased)
|
||||
// In this op we care only about the resulting green.
|
||||
|
||||
//mad r1, t1, c[0], t0_bias
|
||||
|
||||
mad r1.rgb, t1, c[0], t0_bias
|
||||
+ mov t0.a, t0.b // replicate blue to alpha in case alpha is
|
||||
// dirty from a previous alpha blend
|
||||
|
||||
|
||||
// Replicate velocity to blue and alpha
|
||||
// This is so we can apply velocity to the previous position
|
||||
// Position is duplicated in blue and alpha so we can co-issue
|
||||
// instructions in the step 1 shader.
|
||||
|
||||
dp3 t1.rgba, r1, c6
|
||||
|
||||
|
||||
// Multiply velocity by scale factor and add to t0 position (blue, alpha)
|
||||
|
||||
mad r0, t1, c[1], t0
|
||||
|
||||
|
||||
// We need to output the velocity for use in the next time step.
|
||||
// Velocity is held in t1 and is signed, so we need to mask out
|
||||
// the unwanted color values and bias it back up to the unsigned
|
||||
// [0,1] range for storage as a texture color.
|
||||
// Need to update velocity to what we have in t1, writing only to
|
||||
// green of r0
|
||||
|
||||
mad t1, t1, c6, c5 // mask and bias back to unsigned range
|
||||
// r1 * (0,1,0,0) + (0,.5,0,0)
|
||||
|
||||
// Mask off r,g of r0 and add in velocity result
|
||||
// from the previous instruction
|
||||
// r0 * (0,0,mask,mask) + (0,velocity,0,0)
|
||||
//
|
||||
// c[PCN_POSITIONMASK] could be (0,0,1,1) or (0,0,.98,.98) etc to
|
||||
// slightly damped position each step
|
||||
|
||||
mad r0, r0, c[4], t1
|
||||
|
||||
|
||||
|
||||
20
GameTools/WORLDCREATOR/Shader/WaterGen.vsh
Normal file
20
GameTools/WORLDCREATOR/Shader/WaterGen.vsh
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
;v0 : vecPos
|
||||
;v1 : vecTexcoord
|
||||
|
||||
|
||||
vs.1.1
|
||||
|
||||
|
||||
// Transform vertex-position to clip-space
|
||||
dp4 oPos.x, v0, c[2]
|
||||
dp4 oPos.y, v0, c[3]
|
||||
dp4 oPos.z, v0, c[4]
|
||||
dp4 oPos.w, v0, c[5]
|
||||
|
||||
// Add offset to Texcoord
|
||||
add oT0, c[ 38 ], v1
|
||||
add oT1, c[ 39 ], v1
|
||||
add oT2, c[ 40 ], v1
|
||||
add oT3, c[ 41 ], v1
|
||||
|
||||
Reference in New Issue
Block a user