Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding more spheres to the scene; rudimentary materials
- Loading branch information
Showing
2 changed files
with
40 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c19c430
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for anyone silly like me, if spheres appear to be 'drawn' in different order, depending on when they were initialized, here's what probably happens.
dist_i
gets passed ast0
, and changes value inside that function (much likematerial
).Be careful with what you're passing in functions (addresses or values?). The problem arose when writing this in Go.
c19c430
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for anyone stupid like me,
dist_i < spheres_dist
in line 39 andspheres_dist = dist_i
in line 40 make sure that the sphere closest to the camera will be drawn. Also,return spheres_dist<1000
in line 46 guarantees that the sphere a) father than 1000 from the camera, b) doesn't intersect with the ray will not be drawn