SHARE
TWEET

Shadow matrix

Archon Feb 21st, 2012 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.    groundPlane = D4(0, 1, 0, -.001);
  2.    double dot = groundPlane.a * lightPos[0] +
  3.                 groundPlane.b * lightPos[1] +
  4.                 groundPlane.c * lightPos[2] +
  5.                 groundPlane.d * lightPos[3];
  6.    shadowMatrix[0]  = dot - lightPos[0] * groundPlane.a;
  7.    shadowMatrix[4]  = 0.  - lightPos[0] * groundPlane.b;
  8.    shadowMatrix[8]  = 0.  - lightPos[0] * groundPlane.c;
  9.    shadowMatrix[12] = 0.  - lightPos[0] * groundPlane.d;
  10.  
  11.    shadowMatrix[1]  = 0.  - lightPos[1] * groundPlane.a;
  12.    shadowMatrix[5]  = dot - lightPos[1] * groundPlane.b;
  13.    shadowMatrix[9]  = 0.  - lightPos[1] * groundPlane.c;
  14.    shadowMatrix[13] = 0.  - lightPos[1] * groundPlane.d;
  15.  
  16.    shadowMatrix[2]  = 0.  - lightPos[2] * groundPlane.a;
  17.    shadowMatrix[6]  = 0.  - lightPos[2] * groundPlane.b;
  18.    shadowMatrix[10] = dot - lightPos[2] * groundPlane.c;
  19.    shadowMatrix[14] = 0.  - lightPos[2] * groundPlane.d;
  20.  
  21.    shadowMatrix[3]  = 0.  - lightPos[3] * groundPlane.a;
  22.    shadowMatrix[7]  = 0.  - lightPos[3] * groundPlane.b;
  23.    shadowMatrix[11] = 0.  - lightPos[3] * groundPlane.c;
  24.    shadowMatrix[15] = dot - lightPos[3] * groundPlane.d;
RAW Paste Data
Top