And now we have cylinders!

This commit is contained in:
Godzil
2020-02-22 22:58:57 +00:00
parent b9bacd3ac9
commit d87bbb184e
9 changed files with 571 additions and 4 deletions

33
source/include/cylinder.h Normal file
View File

@@ -0,0 +1,33 @@
/*
* DoRayMe - a quick and dirty Raytracer
* Cylinder header
*
* Created by Manoël Trapier
* Copyright (c) 2020 986-Studio.
*
*/
#ifndef DORAYME_CYLINDER_H
#define DORAYME_CYLINDER_H
#include <shape.h>
#include <ray.h>
#include <intersect.h>
class Cylinder : public Shape {
private:
Intersect localIntersect(Ray r);
Tuple localNormalAt(Tuple point);
bool checkCap(Ray r, double t);
void intersectCaps(Ray r, Intersect &xs);
public:
bool isClosed;
double minCap;
double maxCap;
Cylinder() : minCap(-INFINITY), maxCap(INFINITY), isClosed(false), Shape(SHAPE_CYLINDER) {};
};
#endif //DORAYME_CYLINDER_H

View File

@@ -23,6 +23,7 @@ enum ShapeType
SHAPE_SPHERE,
SHAPE_PLANE,
SHAPE_CUBE,
SHAPE_CYLINDER,
SHAPE_CONE,
};