Skip to content
Snippets Groups Projects
Sphere.h 854 B
Newer Older
Yoel's avatar
Yoel committed
#pragma once

#include "Light.h"
#include "Shape.h"
Yoel's avatar
Yoel committed

namespace shapes {
class Sphere : public Light, public Shape {
Yoel's avatar
Yoel committed
   public:
	Sphere(float radius, const std::shared_ptr<material::Material>& material);
Yoel's avatar
Yoel committed
	std::optional<cam::Hit> intersect(const cam::Ray& r) const override;
	std::pair<float, float> texture_coordinates(
	    const util::Vec3& pos) const override;
	util::Vec3 texture_coordinates(std::pair<float, float> texel) const;
Yoel's avatar
Yoel committed
	util::AxisAlignedBoundingBox bounds() const override;
Yoel's avatar
Yoel committed
	util::SurfacePoint sampleLight(const cam::Hit& h) const override;
	util::Vec3 lightEmission(const util::SurfacePoint& p) const override;
	virtual float lightPdf(const util::SurfacePoint& p,
	                       const util::Vec3& dl_out) const override;
Yoel's avatar
Yoel committed

Yoel's avatar
Yoel committed
	std::shared_ptr<material::Material> material;
	const float radius;
Yoel's avatar
Yoel committed
};
Yoel's avatar
Yoel committed
}  // namespace shapes