X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=examples%2Fraytrace.cpp;h=7827bd39105674a0d1726b286948257dab9a4880;hb=dcac1b2c9423b2e8bc61093e30d521951575c59d;hp=2af86530ba227389b4c2421802fb08cb0b0dec7c;hpb=63b6f5c937a2f0dcf93ef9fd1a586985c32631ce;p=libs%2Fmath.git 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);