Added CUBES!
This commit is contained in:
28
source/include/cube.h
Normal file
28
source/include/cube.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* DoRayMe - a quick and dirty Raytracer
|
||||
* Cube header
|
||||
*
|
||||
* Created by Manoël Trapier
|
||||
* Copyright (c) 2020 986-Studio.
|
||||
*
|
||||
*/
|
||||
#ifndef DORAYME_CUBE_H
|
||||
#define DORAYME_CUBE_H
|
||||
|
||||
#include <shape.h>
|
||||
#include <ray.h>
|
||||
#include <intersect.h>
|
||||
|
||||
class Cube : public Shape {
|
||||
private:
|
||||
void checkAxis(double axeOrigine, double axeDirection, double *axeMin, double *axeMax);
|
||||
|
||||
Intersect localIntersect(Ray r);
|
||||
|
||||
Tuple localNormalAt(Tuple point);
|
||||
|
||||
public:
|
||||
Cube() : Shape(SHAPE_CUBE) {};
|
||||
};
|
||||
|
||||
#endif /* DORAYME_CUBE_H */
|
||||
@@ -18,4 +18,7 @@ bool double_equal(double a, double b);
|
||||
|
||||
double deg_to_rad(double deg);
|
||||
|
||||
double min3(double a, double b, double c);
|
||||
double max3(double a, double b, double c);
|
||||
|
||||
#endif /* DORAYME_MATH_HELPER_H */
|
||||
|
||||
@@ -22,6 +22,8 @@ enum ShapeType
|
||||
SHAPE_NONE,
|
||||
SHAPE_SPHERE,
|
||||
SHAPE_PLANE,
|
||||
SHAPE_CUBE,
|
||||
SHAPE_CONE,
|
||||
};
|
||||
|
||||
/* Base class for all object that can be presented in the world */
|
||||
|
||||
Reference in New Issue
Block a user