Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Triangle::build_volume(GLfloat* light_pos, float* camera_pos)
- {
- static float volume_size = 10.0f; //Some big number that will for sure cover our needs
- //Initialize our bottom vertices to our top ones....
- typedef float[3];
- vec3f yellowquad[4];
- vec3f blacktri[3];
- vec3f lightpos;
- // this will create create the first two points of our yellow quad on
- // the first two point of the black triangle
- for ( int i = 0; i < 2; i++ )
- {
- yellowquad[i][0] = blacktri[i][0];
- yellowquad[i][1] = blacktri[i][1];
- yellowquad[i][2] = blacktri[i][2];
- }
- // compute the projection from the light source to the
- // first two points of the black triangle (which we attached
- // the first two points of the yellow quad to)
- for ( int i=0; i<2; i++)
- {
- yellowquad[i+2][0] = (((blacktri[i][0] - lightpos[0])*1000.f) + lightpos[0]);
- yellowquad[i+2][1] = (((blacktri[i][1] - lightpos[1])*1000.f) + lightpos[1]);
- yellowquad[i+2][2] = (((blacktri[i][2] - lightpos[2])*1000.f) + lightpos[2]);
- }
- }
Add Comment
Please, Sign In to add comment