Skip to content

Instantly share code, notes, and snippets.

@define-private-public
Created January 3, 2017 18:50
Show Gist options
  • Save define-private-public/009e6317d1f67718eedfc413d2ede568 to your computer and use it in GitHub Desktop.
Save define-private-public/009e6317d1f67718eedfc413d2ede568 to your computer and use it in GitHub Desktop.
Peter Shirley Ray Tracing Mini-Books (in Nim); a code snippet that drove me nuts
method hit*(ry: rotate_y, r: ray, t_min, t_max: float, rec: var hit_record): bool=
# I thought this was copying the vec3 data, but it wasn't. It was copying the pointer...
var
origin = r.origin()
direction = r.direction()
# origin and direction are modified after this which caused the issue...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment