28 lines
670 B
C++
28 lines
670 B
C++
#ifndef REFRACTIONSHADER_H
|
|
#define REFRACTIONSHADER_H
|
|
|
|
#include "shader/shader.h"
|
|
|
|
class RefractionShader : public Shader
|
|
{
|
|
|
|
public:
|
|
// Constructor
|
|
RefractionShader(float indexInside, float indexOutside, Color const &objectColor = Color(1, 1, 1), float lightLoss = 0);
|
|
|
|
// Shader functions
|
|
Color shade(Scene const &scene, Ray const &ray) const override;
|
|
|
|
bool isTransparent() const override;
|
|
Color transparency(Scene const &scene, Ray const &ray) const override;
|
|
|
|
private:
|
|
float indexInside;
|
|
float indexOutside;
|
|
float lightLoss;
|
|
Color objectColor;
|
|
|
|
float remainingLightIntensity(float distanceThroughObject) const;
|
|
};
|
|
|
|
#endif
|