2022-11-11 14:39:48 +01:00
|
|
|
#ifndef REFRACTIONSHADER_H
|
|
|
|
#define REFRACTIONSHADER_H
|
|
|
|
|
|
|
|
#include "shader/shader.h"
|
|
|
|
|
2023-01-24 19:59:13 +01:00
|
|
|
class RefractionShader : public Shader
|
|
|
|
{
|
2022-11-11 14:39:48 +01:00
|
|
|
|
|
|
|
public:
|
2023-01-24 19:59:13 +01:00
|
|
|
// Constructor
|
2023-01-24 20:23:16 +01:00
|
|
|
RefractionShader(float indexInside, float indexOutside, Color const &objectColor = Color(1, 1, 1), float lightLoss = 0);
|
2022-11-11 14:39:48 +01:00
|
|
|
|
2023-01-24 19:59:13 +01:00
|
|
|
// Shader functions
|
|
|
|
Color shade(Scene const &scene, Ray const &ray) const override;
|
|
|
|
|
|
|
|
bool isTransparent() const override;
|
2023-01-24 22:55:48 +01:00
|
|
|
Color transparency(const Scene &scene, const Ray &ray, float maxLength) const override;
|
2022-11-11 14:39:48 +01:00
|
|
|
|
|
|
|
private:
|
2023-01-24 19:59:13 +01:00
|
|
|
float indexInside;
|
|
|
|
float indexOutside;
|
2023-01-24 20:23:16 +01:00
|
|
|
float lightLoss;
|
2023-01-24 19:59:13 +01:00
|
|
|
Color objectColor;
|
2023-01-24 21:11:30 +01:00
|
|
|
|
|
|
|
float remainingLightIntensity(float distanceThroughObject) const;
|
2022-11-11 14:39:48 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|