Added presentations from EVI 2017

This commit is contained in:
Miguel Angel Astor Romero
2017-10-23 15:25:36 -04:00
parent 68ae52b86a
commit d60fc66a77
52 changed files with 3409 additions and 0 deletions

View File

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