diff --git a/src/main/opencl/kernel/include/block.h b/src/main/opencl/kernel/include/block.h index 5cb2475..91a836d 100644 --- a/src/main/opencl/kernel/include/block.h +++ b/src/main/opencl/kernel/include/block.h @@ -95,7 +95,7 @@ bool BlockPalette_intersectNormalizedBlock(BlockPalette self, image2d_array_t at hit = AABB_full_intersect(box, tempRay, &tempRecord); tempRecord.material = modelPointer; } else if (ray.flags & RAY_INDIRECT) { - AABB box = AABB_new(0.125, 0.875, 0.125, 0.875, 0.125, 0.875); + AABB box = AABB_new(0.125f, 0.875f, 0.125f, 0.875f, 0.125f, 0.875f); hit = AABB_full_intersect(box, tempRay, &tempRecord); tempRecord.material = modelPointer; } else { diff --git a/src/main/opencl/kernel/include/camera.h b/src/main/opencl/kernel/include/camera.h index 8239f14..a64be77 100644 --- a/src/main/opencl/kernel/include/camera.h +++ b/src/main/opencl/kernel/include/camera.h @@ -19,13 +19,13 @@ Ray Camera_pinHole(float x, float y, Random random, __global const float* projec float fovTan = projectorSettings[2]; ray.origin = (float3) (0, 0, 0); - ray.direction = (float3) (fovTan * x, fovTan * y, 1.0); + ray.direction = (float3) (fovTan * x, fovTan * y, 1.0f); if (aperature > 0) { ray.direction *= subjectDistance / ray.direction.z; float r = sqrt(Random_nextFloat(random)) * aperature; - float theta = Random_nextFloat(random) * M_PI_F * 2.0; + float theta = Random_nextFloat(random) * M_PI_F * 2.0f; float rx = cos(theta) * r; float ry = sin(theta) * r; diff --git a/src/main/opencl/kernel/include/material.h b/src/main/opencl/kernel/include/material.h index f9368d2..d27d42c 100644 --- a/src/main/opencl/kernel/include/material.h +++ b/src/main/opencl/kernel/include/material.h @@ -58,8 +58,8 @@ bool Material_sample(Material self, image2d_array_t atlas, float2 uv, MaterialSa if (self.tint == 0xFE000000) { // Light block - sample->color.xyz = 0.5; - sample->color.w = 1.0; + sample->color.xyz = 0.5f; + sample->color.w = 1.0f; } else if (color.w > EPS) { sample->color = color; } else { @@ -89,7 +89,7 @@ bool Material_sample(Material self, image2d_array_t atlas, float2 uv, MaterialSa if (self.flags & 0b010) sample->emittance = Atlas_read_uv(uv.x, uv.y, self.normal_emittance, self.textureSize, atlas).w; else - sample->emittance = (self.normal_emittance & 0xFF) / 255.0; + sample->emittance = (self.normal_emittance & 0xFF) / 255.0f; // specular, metalness, roughness if (self.flags & 0b001) { @@ -98,9 +98,9 @@ bool Material_sample(Material self, image2d_array_t atlas, float2 uv, MaterialSa sample->metalness = smr.y; sample->roughness = smr.z; } else { - sample->specular = (self.specular_metalness_roughness & 0xFF) / 255.0; - sample->metalness = ((self.specular_metalness_roughness >> 8) & 0xFF) / 255.0; - sample->roughness = ((self.specular_metalness_roughness >> 16) & 0xFF) / 255.0; + sample->specular = (self.specular_metalness_roughness & 0xFF) / 255.0f; + sample->metalness = ((self.specular_metalness_roughness >> 8) & 0xFF) / 255.0f; + sample->roughness = ((self.specular_metalness_roughness >> 16) & 0xFF) / 255.0f; } return true; @@ -121,7 +121,7 @@ float3 _Material_diffuseReflection(IntersectionRecord record, Random random) { float ux, uy, uz; float vx, vy, vz; - if (fabs(record.normal.x) > 0.1) { + if (fabs(record.normal.x) > 0.1f) { xx = 0; xy = 1; } else { diff --git a/src/main/opencl/kernel/include/rayTracer.c b/src/main/opencl/kernel/include/rayTracer.c index 6e06899..8677326 100644 --- a/src/main/opencl/kernel/include/rayTracer.c +++ b/src/main/opencl/kernel/include/rayTracer.c @@ -29,10 +29,10 @@ Ray ray_to_camera( int cropX = canvasConfig[4]; int cropY = canvasConfig[5]; - float halfWidth = fullWidth / (2.0 * fullHeight); - float invHeight = 1.0 / fullHeight; + float halfWidth = fullWidth / (2.0f * fullHeight); + float invHeight = 1.0f / fullHeight; float x = -halfWidth + ((gid % width) + Random_nextFloat(random) + cropX) * invHeight; - float y = -0.5 + ((gid / width) + Random_nextFloat(random) + cropY) * invHeight; + float y = -0.5f + ((gid / width) + Random_nextFloat(random) + cropY) * invHeight; switch (*projectorType) { case 0: @@ -107,8 +107,8 @@ __kernel void render( ray.material = 0; ray.flags = 0; - float3 color = (float3) (0.0); - float3 throughput = (float3) (1.0); + float3 color = (float3) (0.0f); + float3 throughput = (float3) (1.0f); for (int depth = 0; depth < *rayDepth; depth++) { IntersectionRecord record = IntersectionRecord_new(); @@ -203,7 +203,7 @@ __kernel void preview( float3 color; if (closestIntersect(scene, textureAtlas, ray, &record, &sample, &material)) { - float shading = dot(record.normal, (float3) (0.25, 0.866, 0.433)); + float shading = dot(record.normal, (float3) (0.25f, 0.866f, 0.433f)); shading = fmax(0.3f, shading); color = sample.color.xyz * shading; } else { diff --git a/src/main/opencl/kernel/include/sky.h b/src/main/opencl/kernel/include/sky.h index e11b0f7..7f3494e 100644 --- a/src/main/opencl/kernel/include/sky.h +++ b/src/main/opencl/kernel/include/sky.h @@ -51,7 +51,7 @@ bool Sun_intersect(Sun self, image2d_array_t atlas, Ray ray, MaterialSample* sam return false; } - float radius = 0.03; + float radius = 0.03f; float width = radius * 4; float width2 = width * 2; @@ -112,7 +112,7 @@ void Sky_intersect(image2d_t skyTexture, float skyIntensity, Ray ray, MaterialSa float phi = (asin(clamp(direction.y, -1.0f, 1.0f)) + M_PI_2_F) * M_1_PI_F; sample->color = read_imagef(skyTexture, skySampler, (float2) (theta, phi)) * skyIntensity; - sample->emittance = 1.0; + sample->emittance = 1.0f; } #endif diff --git a/src/main/opencl/tonemap/include/post_processing_filter.c b/src/main/opencl/tonemap/include/post_processing_filter.c index 4a01878..44374cd 100644 --- a/src/main/opencl/tonemap/include/post_processing_filter.c +++ b/src/main/opencl/tonemap/include/post_processing_filter.c @@ -23,7 +23,7 @@ __kernel void filter( switch (type) { case 0: // GAMMA - color = pow(color, 1.0 / 2.2); + color = pow(color, 1.0f / 2.2f); break; case 1: // TONEMAP1 @@ -34,7 +34,7 @@ __kernel void filter( // ACES color = (color * (2.51f * color + 0.03f)) / (color * (2.43f * color + 0.59f) + 0.14f); color = clamp(color, (float3)(0), (float3)(1)); - color = pow(color, 1.0 / 2.2); + color = pow(color, 1.0f / 2.2f); break; case 3: // HABLE @@ -55,7 +55,7 @@ float ue4_filter_process_component(float c, float saturation, float slope, float float logc = log10(c); if (logc >= ta && logc <= sa) { - return saturation * (slope * (logc + 0.733) + 0.18); + return saturation * (slope * (logc + 0.733f) + 0.18f); } if (logc > sa) { return saturation * (1 + whiteClip - (2 * (1 + whiteClip - shoulder)) / (1 + exp(((2 * slope) / (1 + whiteClip - shoulder)) * (logc - sa)))); @@ -95,7 +95,7 @@ __kernel void ue4_filter( ue4_filter_process_component(color.z, saturation, slope, toe, shoulder, blackClip, whiteClip, ta, sa) ); color = clamp(color, 0.0f, 1.0f); - color = pow(color, 1.0 / 2.0); + color = pow(color, 1.0f / 2.0f); float4 pixel; pixel.xyz = color;