Ray casting with spheres.

This commit is contained in:
2016-12-25 21:47:28 -04:00
parent cc3525d064
commit 54bf4d4822
8 changed files with 319 additions and 0 deletions

27
sphere.hpp Normal file
View File

@@ -0,0 +1,27 @@
#pragma once
#ifndef SPHERE_HPP
#define SPHERE_HPP
#include <glm/vec3.hpp>
#include "figure.hpp"
using glm::vec3;
class Sphere : public Figure {
public:
vec3 m_center;
float m_radius;
Sphere(): m_center(vec3(0.0f)), m_radius(0.5f) { }
Sphere(float x, float y, float z, float r): m_center(vec3(x, y, z)), m_radius(r) { }
Sphere(vec3 _c, float r): m_center(_c), m_radius(r) { }
virtual ~Sphere() { }
virtual bool intersect(Ray & r, float & t) const;
};
#endif