diff options
Diffstat (limited to 'src/opencl_mesh_kit.hpp')
-rw-r--r-- | src/opencl_mesh_kit.hpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/opencl_mesh_kit.hpp b/src/opencl_mesh_kit.hpp index 5efd30e..29e8d64 100644 --- a/src/opencl_mesh_kit.hpp +++ b/src/opencl_mesh_kit.hpp @@ -52,18 +52,12 @@ const char kernel_src_zero_z[]=STRINGIFY( __kernel void zero_z(__global float4 *pos, unsigned int width, unsigned int height, float time) { unsigned int nx = get_global_id(0); unsigned int ny = get_global_id(1); - /* calculate uv coordinates of the mesh point [0.0;1.0] */ - float u = nx / (float) width; - float v = ny / (float) height; - /* calculate centered normalized coordinates [-1.0;1.0] */ - float x = u*2.0-1.0; - float y = v*2.0-1.0; - /* Calculate the desirated value of the mesh point */ - float z = 0.0f; - /* We only use normalized quaterinons here */ - float w = 1.0f; - /* Write output vertex (centered) */ - pos[ny*width+nx] = (float4)(x, y, z, w); + float4 out; + out.x = nx / (float) width * 2.0f - 1.0f; + out.y = ny / (float) height * 2.0f - 1.0f; + out.z = 0.0f; + out.w = 1.0f; + pos[ny*width+nx] = out; } ); |