Browse Source

fixed perspective bug in master kernel

iver 7 months ago
parent
commit
d71c8fc9cd
2 changed files with 7 additions and 7 deletions
  1. 6 6
      src/RasterIver/kernels/master_kernel.h
  2. 1 1
      src/RasterIver/source code/rasteriver.c

+ 6 - 6
src/RasterIver/kernels/master_kernel.h

@@ -149,14 +149,14 @@ __kernel void raster_kernel(__global float* objects, __global float* verticies,
             }\
             \
             z0 = (z0 * object_s_z + object_z);\
-            x0 = (x0 * object_s_x + object_x) / z0;\
-            y0 = (y0 * object_s_y + object_y) / z0;\
+            x0 = (x0 * object_s_x + object_x) / z0 * height;\
+            y0 = (y0 * object_s_y + object_y) / z0 * width;\
             z1 = (z1 * object_s_z + object_z);\
-            x1 = (x1 * object_s_x + object_x) / z1;\
-            y1 = (y1 * object_s_y + object_y) / z1;\
+            x1 = (x1 * object_s_x + object_x) / z1 * height;\
+            y1 = (y1 * object_s_y + object_y) / z1 * width;\
             z2 = (z2 * object_s_z + object_z);\
-            x2 = (x2 * object_s_x + object_x) / z2;\
-            y2 = (y2 * object_s_y + object_y) / z2;\
+            y2 = (y2 * object_s_y + object_y) / z2 * height;\
+            x2 = (x2 * object_s_x + object_x) / z2 * width;\
             \
             if (i3 < 0 || i4 < 0 || i5 < 0){\
                 has_normals = 0;\

+ 1 - 1
src/RasterIver/source code/rasteriver.c

@@ -1207,7 +1207,7 @@ for (int id_x = -width / 2; id_x < width / 2; id_x++){
             // size_t local_size_2d[2] = {sqrt(local_size), sqrt(local_size)};
             size_t local_size_2d[2] = {16, 16};
 
-            erchk(clEnqueueNDRangeKernel(queue, compiled_kernel_master, 2, NULL, size_2d, local_size_2d, 0, NULL, NULL));
+            erchk(clEnqueueNDRangeKernel(queue, compiled_kernel_master, 2, NULL, size_2d, NULL, 0, NULL, NULL));
             erchk(clFinish(queue));
 
             erchk(clEnqueueReadBuffer(queue, output_memory_buffer, CL_TRUE, 0, sizeof(RI_uint) * width * height, frame_buffer, 0, NULL, NULL));