mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
examples: fix path_tracing.v compilation, using (*ptr) = expression
This commit is contained in:
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user