mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
examples: fix path_tracing.v compilation, using (*ptr) = expression
This commit is contained in:
parent
d5eafe79bd
commit
fb97c2e01e
6 changed files with 12 additions and 20 deletions
|
@ -101,7 +101,7 @@ fn new_image(w int, h int) Image {
|
|||
// write out a .ppm file
|
||||
fn (image Image) save_as_ppm(file_name string) {
|
||||
npixels := image.width * image.height
|
||||
mut f_out := os.create(file_name) or { exit }
|
||||
mut f_out := os.create(file_name) or { panic(err) }
|
||||
f_out.writeln('P3')
|
||||
f_out.writeln('${image.width} ${image.height}')
|
||||
f_out.writeln('255')
|
||||
|
@ -247,8 +247,8 @@ const(
|
|||
|
||||
struct Cache {
|
||||
mut:
|
||||
sin_tab [cache_len]f64
|
||||
cos_tab [cache_len]f64
|
||||
sin_tab [65536]f64
|
||||
cos_tab [65536]f64
|
||||
}
|
||||
|
||||
fn new_tabs() Cache {
|
||||
|
@ -429,7 +429,7 @@ fn ray_trace(w int, h int, samps int, file_name string, scene_id int) Image {
|
|||
r = r + radiance(Ray{cam.o+d.mult_s(140.0), d.norm()}, 0, scene_id).mult_s(samps1)
|
||||
}
|
||||
tmp_vec := Vec{clamp(r.x),clamp(r.y),clamp(r.z)}.mult_s(.25)
|
||||
*ivec = *ivec + tmp_vec
|
||||
(*ivec) = *ivec + tmp_vec
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue