Skip to content

Commit

Permalink
fix: rt_light range check
Browse files Browse the repository at this point in the history
  • Loading branch information
takumihara committed May 12, 2022
1 parent 10d24d6 commit 0fcc262
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ cmake-build-debug
.idea
CMakeLists.txt
miniRT
sample

# Prerequisites
*.d
Expand Down
4 changes: 4 additions & 0 deletions scenes/kohkubo_test/1.rt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
A 0.1 255,255,255
L 150,150,-150 0.9 255,255,255
C 0,0,-30 0,0,1 45
sp 0,0,0 10 255,0,0
2 changes: 1 addition & 1 deletion src/rt_params.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ char *load_light(t_program *p, char **info)
// todo: error is wrong
if (!(ft_strtod(info[1], &ratio) && 0.0 <= ratio && ratio <= 1.0))
return (ERR_MISCONFIGURED_AMBIENT);
if (!(get_color_from_str(info[2], &c) && check_color_range(c, 0.0, 255.0)))
if (get_color_from_str(info[2], &c) && check_color_range(c, 0.0, 255.0))
l.intensity = color_mult(c, ratio);
else
return (ERR_MISCONFIGURED_AMBIENT);
Expand Down

0 comments on commit 0fcc262

Please sign in to comment.