Many changes to jensen.
This commit is contained in:
14
sphere.cpp
14
sphere.cpp
@@ -44,19 +44,7 @@ vec3 Sphere::normal_at_int(Ray & r, float & t) const {
|
||||
}
|
||||
|
||||
vec3 Sphere::sample_at_surface() const {
|
||||
float theta;
|
||||
float u, sqrt1muu, x, y, z;
|
||||
|
||||
// Sampling formula from Wolfram Mathworld:
|
||||
// http://mathworld.wolfram.com/SpherePointPicking.html
|
||||
theta = random01()* (2.0f * pi<float>());
|
||||
u = (random01() * 2.0f) - 1.0f;
|
||||
sqrt1muu = glm::sqrt(1.0f - (u * u));
|
||||
x = m_radius * sqrt1muu * cos(theta);
|
||||
y = m_radius * sqrt1muu * sin(theta);
|
||||
z = m_radius * u;
|
||||
|
||||
return vec3(x, y, z) + m_center;
|
||||
return sample_sphere(m_center, m_radius);
|
||||
}
|
||||
|
||||
void Sphere::calculate_inv_area() {
|
||||
|
Reference in New Issue
Block a user