Guest User

Untitled

a guest
Feb 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. void Triangle::build_volume(GLfloat* light_pos, float* camera_pos)
  2. {
  3. static float volume_size = 10.0f; //Some big number that will for sure cover our needs
  4. //Initialize our bottom vertices to our top ones....
  5.  
  6. typedef float[3];
  7. vec3f yellowquad[4];
  8. vec3f blacktri[3];
  9. vec3f lightpos;
  10.  
  11. // this will create create the first two points of our yellow quad on
  12. // the first two point of the black triangle
  13. for ( int i = 0; i < 2; i++ )
  14. {
  15. yellowquad[i][0] = blacktri[i][0];
  16. yellowquad[i][1] = blacktri[i][1];
  17. yellowquad[i][2] = blacktri[i][2];
  18. }
  19.  
  20. // compute the projection from the light source to the
  21. // first two points of the black triangle (which we attached
  22. // the first two points of the yellow quad to)
  23. for ( int i=0; i<2; i++)
  24. {
  25. yellowquad[i+2][0] = (((blacktri[i][0] - lightpos[0])*1000.f) + lightpos[0]);
  26. yellowquad[i+2][1] = (((blacktri[i][1] - lightpos[1])*1000.f) + lightpos[1]);
  27. yellowquad[i+2][2] = (((blacktri[i][2] - lightpos[2])*1000.f) + lightpos[2]);
  28. }
  29.  
  30.  
  31. }
Add Comment
Please, Sign In to add comment