# HG changeset patch # User John Tsiombikas # Date 1279844523 -3600 # Node ID 575383f3a239f99fdc42d1add6606d0b7c99b937 # Parent b06518bb16e95cd6153d307741429adae9b6fa6d foo diff -r b06518bb16e9 -r 575383f3a239 rt.cl --- a/rt.cl Tue Jul 20 20:02:41 2010 +0100 +++ b/rt.cl Fri Jul 23 01:22:03 2010 +0100 @@ -25,6 +25,10 @@ global const struct Sphere *obj; }; +struct Matrix4x4 { + float m[16]; +}; + #define EPSILON 1e-6 float4 shade(struct Ray ray, struct SurfPoint sp, @@ -37,7 +41,8 @@ global const struct RendInfo *rinf, global const struct Sphere *sphlist, global const struct Light *lights, - global const struct Ray *primrays) + global const struct Ray *primrays, + global const struct Matrix4x4 xform) { int idx = get_global_id(0); diff -r b06518bb16e9 -r 575383f3a239 src/rt.cc --- a/src/rt.cc Tue Jul 20 20:02:41 2010 +0100 +++ b/src/rt.cc Fri Jul 23 01:22:03 2010 +0100 @@ -25,6 +25,9 @@ cl_float4 pos, color; } __attribute__((packed)); +struct Matrix4x4 { + cl_float m[16]; +}; static Ray get_primary_ray(int x, int y, int w, int h, float vfov_deg); @@ -41,6 +44,10 @@ {{-10, 10, -20, 1}, {1, 1, 1, 1}} }; +static Matrix4x4 xform = { + {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1} +}; + static RendInfo rinf; @@ -74,6 +81,7 @@ prog->set_arg_buffer(2, ARG_RD, sizeof sphlist, sphlist); prog->set_arg_buffer(3, ARG_RD, sizeof lightlist, lightlist); prog->set_arg_buffer(4, ARG_RD, xsz * ysz * sizeof *prim_rays, prim_rays); + prog->set_arg_buffer(5, ARG_RD, sizeof xform, &xform); global_size = xsz * ysz; return true;