Skip to content

Commit

Permalink
look, i don't care if I do thousand commits for fixing the double to …
Browse files Browse the repository at this point in the history
…float thing
  • Loading branch information
101001000 committed Sep 3, 2023
1 parent ed79d42 commit e33562e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/Sampling.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

inline Vector3 uniformSampleSphere(float u1, float u2) {

float z = 1.0 - 2.0 * u1;
float r = sycl::sqrt(maxf(0.f, 1.0 - z * z));
float phi = 2.0 * PIF * u2;
float z = 1.0f - 2.0f * u1;
float r = sycl::sqrt(maxf(0.f, 1.0f - z * z));
float phi = 2.0f * PIF * u2;
float x = r * sycl::cos(phi);
float y = r * sycl::sin(phi);

Expand All @@ -31,21 +31,21 @@ inline Vector3 CosineSampleHemisphere(float u1, float u2){

Vector3 dir;
float r = sycl::sqrt(u1);
float phi = 2.0 * PIF * u2;
float phi = 2.0f * PIF * u2;
dir.x = r * sycl::cos(phi);
dir.y = r * sycl::sin(phi);
dir.z = sycl::sqrt(maxf(0.0, 1.0 - dir.x * dir.x - dir.y * dir.y));
dir.z = sycl::sqrt(maxf(0.0f, 1.0f - dir.x * dir.x - dir.y * dir.y));

return dir;
}

inline Vector3 ImportanceSampleGGX(float rgh, float r1, float r2) {
float a = maxf(0.001, rgh);
float a = maxf(0.001f, rgh);

float phi = r1 * PIF * 2;

float cosTheta = sycl::sqrt((1.0 - r2) / (1.0 + (a * a - 1.0) * r2));
float sinTheta = clamp(sycl::sqrt(1.0 - (cosTheta * cosTheta)), 0.0, 1.0);
float cosTheta = sycl::sqrt((1.0f - r2) / (1.0f + (a * a - 1.0f) * r2));
float sinTheta = clamp(sycl::sqrt(1.0f - (cosTheta * cosTheta)), 0.0f, 1.0f);
float sinPhi = sycl::sin(phi);
float cosPhi = sycl::cos(phi);

Expand Down
4 changes: 2 additions & 2 deletions src/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,8 @@ void calculateCameraRay(int x, int y, dev_Scene& scene, Camera& camera, Ray& ray
float ody = (-camera.sensorHeight / 2.0f) + dy;

// Random part of the sampling offset so we get antialasing
float rx = (1.0 / static_cast<float>(scene.x_res)) * (r1 - 0.5f) * camera.sensorWidth;
float ry = (1.0 / static_cast<float>(scene.y_res)) * (r2 - 0.5f) * camera.sensorHeight;
float rx = (1.0f / static_cast<float>(scene.x_res)) * (r1 - 0.5f) * camera.sensorWidth;
float ry = (1.0f / static_cast<float>(scene.y_res)) * (r2 - 0.5f) * camera.sensorHeight;

// Sensor point, the point where intersects the ray with the sensor
float SPx = odx + rx;
Expand Down

0 comments on commit e33562e

Please sign in to comment.