From: Mikko Rasa Date: Sat, 2 Jul 2016 16:58:44 +0000 (+0300) Subject: Use the proper array size in the raytrace example X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=dcac1b2c9423b2e8bc61093e30d521951575c59d;p=libs%2Fmath.git Use the proper array size in the raytrace example --- diff --git a/examples/raytrace.cpp b/examples/raytrace.cpp index 2af8653..7827bd3 100644 --- a/examples/raytrace.cpp +++ b/examples/raytrace.cpp @@ -50,6 +50,8 @@ int RayTracer::main() { load_shape(); + vector > points(shape->get_max_ray_intersections()); + for(unsigned y=0; y ray(LinAl::Vector(0, 0, 5), LinAl::Vector(xf, yf, -2)); - Geometry::SurfacePoint points[4]; - unsigned count = shape->get_intersections(ray, points, 4); + unsigned count = shape->get_intersections(ray, &points[0], points.size()); UInt8 *pixel = pixels+y*width+x; if(count) *pixel = 255*(0.2+max(dot(points[0].normal, LinAl::Vector(0, 0, 1)), 0.0)*0.8);