Guest User

Untitled

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