34 lines
862 B
C++
34 lines
862 B
C++
#ifndef RAYTRYCPP_RENDEROBJECT_H
|
|
#define RAYTRYCPP_RENDEROBJECT_H
|
|
|
|
#include "Ray.h"
|
|
#include "RenderMaterial.h"
|
|
#include <optional>
|
|
|
|
namespace raytry {
|
|
class RenderObject {
|
|
public:
|
|
RenderObject() = default;
|
|
RenderObject(RenderObject const&) = default;
|
|
virtual ~RenderObject() = default;
|
|
|
|
[[nodiscard]] virtual std::optional<float> intersects(const Ray& ray) const {
|
|
return std::nullopt;
|
|
}
|
|
|
|
[[nodiscard]] virtual RenderMaterial material() const {
|
|
return {{197, 52, 27}};
|
|
}
|
|
|
|
[[nodiscard]] virtual QVector3D calculateNormal(QVector3D hitpoint) const {
|
|
hitpoint *= -1;
|
|
hitpoint.normalize();
|
|
return hitpoint;
|
|
}
|
|
|
|
constexpr static const float nearCrop{0.1f};
|
|
};
|
|
}// namespace raytry
|
|
|
|
#endif//RAYTRYCPP_RENDEROBJECT_H
|