43 lines
901 B
C++
43 lines
901 B
C++
#ifndef CG1_TRACER_CLOUDSHADER_H
|
|
#define CG1_TRACER_CLOUDSHADER_H
|
|
|
|
#include "scene/scene.h"
|
|
#include "shader.h"
|
|
#include "primitive/primitive.h"
|
|
#include "common/noise/worleynoise.h"
|
|
|
|
int const NOISE_SIZE = 128;
|
|
|
|
struct CloudSettings
|
|
{
|
|
int densitySamples = 100;
|
|
float scale = 1;
|
|
float densityTreshold = 0.55f;
|
|
float densityIntensity = 2.5f;
|
|
float densityAbsorption = 1;
|
|
Color cloudColor = Color(0.7f, 0.7f, 0.7f);
|
|
Color wispyColor = Color(0.9f, 0.9f, 0.9f);
|
|
float wispyIntensity = 0.3f;
|
|
};
|
|
|
|
class CloudShader : public Shader
|
|
{
|
|
public:
|
|
CloudShader(CloudSettings const &settings = CloudSettings());
|
|
|
|
// Shader functions
|
|
Color shade(Scene const &scene, Ray const &ray) const;
|
|
|
|
private:
|
|
CloudSettings settings;
|
|
|
|
|
|
bool isTransparent() const;
|
|
|
|
Noise cloudNoise;
|
|
|
|
float getCloudDensity(Vector3d point) const;
|
|
};
|
|
|
|
|
|
#endif //CG1_TRACER_CLOUDSHADER_H
|