Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // First determine distance from midpoint along twist axis
- // x0+y0+z0+_twistData.z
- // X = X+Y
- code += "add "+temp2+", "+sourceRegisters[0]+".xxxx"+" , "+sourceRegisters[0]+".yyyy\n";
- // X = X + Z
- code += "add "+temp2+".x, "+temp2+".x , "+sourceRegisters[0]+".z\n";
- // X = X + d
- code += "add "+temp2+".x, "+temp2+".x , vc"+(constIndex+8)+".z\n";
- // Determine weight by scale
- // X = X / scale
- code += "div "+temp2+".x, "+temp2+".x, vc"+(constIndex+8)+".x\n";
- // Limit to -1 .. 1 by adding one, dividing by 2, saturate, multiply by two, substract one
- // for example -8 -> -7 -> -3.5 -> 0 -> 0 -> -1
- // or -0.8 -> 0.2 -> 0.1 -> 0.1 -> 0.2 -> -0.8
- code += "add "+temp2+".x, "+temp2+".x, vc"+(constIndex+12)+".y\n";
- code += "mul "+temp2+".x, "+temp2+".x, vc"+(constIndex+12)+".z\n";
- code += "sat "+temp2+","+temp2 + "\n";
- code += "mul "+temp2+".x, "+temp2+".x, vc"+(constIndex+12)+".w\n";
- code += "sub "+temp2+".x, "+temp2+".x, vc"+(constIndex+12)+".y\n";
- code += "sub "+temp2+".y, vc"+(constIndex+12)+".y, "+temp2+".x\n";
- // TODO Bilerp identity matrix and twistmatrix for distance/scale amount
- code += "";
- // Method 2: Directly bilerp two different options -> doesn't really work..
- code += "m44 " + temp1 + ", " + sourceRegisters[0] + ", vc"+constIndex+"\n";
- code += "m44 " + temp3 + ", " + sourceRegisters[0] + ", vc"+(constIndex+4)+"\n";
- code += "mul " + temp1 + ", " + temp1 + ", "+temp2+".x\n"; // weight 0
- code += "mul " + temp3 + ", " + temp3 + ", "+temp2+".y\n"; // weight 0
- code += "add " + targetRegisters[0] +", "+temp1+", "+temp3+"\n"; // sum = object result
Add Comment
Please, Sign In to add comment