38 lines
1.4 KiB
C++
38 lines
1.4 KiB
C++
#ifndef RAYTRYCPP_RENDERMATERIAL_H
|
|
#define RAYTRYCPP_RENDERMATERIAL_H
|
|
|
|
#include "Ray.h"
|
|
#include <QColor>
|
|
#include <QVector3D>
|
|
|
|
namespace raytry {
|
|
class RenderMaterial {
|
|
public:
|
|
float ambientIntensity;
|
|
QColor ambientColor;
|
|
float diffuseIntensity;
|
|
QColor diffuseColor;
|
|
float specularIntensity;
|
|
float specularFalloff;
|
|
QColor specularColor;
|
|
float reflectivity;
|
|
float transparency;
|
|
float refractionIndex;
|
|
|
|
RenderMaterial(QColor materialColor);
|
|
RenderMaterial(float ambientIntensity, const QColor &ambientColor, float diffuseIntensity, const QColor &diffuseColor, float specularIntensity, float specularFalloff, const QColor &specularColor);
|
|
RenderMaterial(float ambientIntensity, const QColor &ambientColor, float diffuseIntensity, const QColor &diffuseColor, float specularIntensity, float specularFalloff, const QColor &specularColor, float reflectivity, float transparency, float refractionIndex);
|
|
|
|
~RenderMaterial() = default;
|
|
|
|
[[nodiscard]] std::optional<Ray> refractionRay(const Ray &incoming, const QVector3D &hitpoint, const QVector3D &normal) const;
|
|
[[nodiscard]] Ray reflectionRay(const Ray &incoming, const QVector3D &hitpoint, const QVector3D &normal) const;
|
|
};
|
|
|
|
QColor mixColor(QColor input, float intensity);
|
|
QColor addColors(QColor color1, const QColor& color2);
|
|
}// namespace raytry
|
|
|
|
|
|
#endif//RAYTRYCPP_RENDERMATERIAL_H
|