62 lines
1.7 KiB
C++
62 lines
1.7 KiB
C++
#ifndef BASECLOUDSMODEL_H
|
|
#define BASECLOUDSMODEL_H
|
|
|
|
#include "../software_global.h"
|
|
|
|
namespace paysages {
|
|
namespace software {
|
|
|
|
/**
|
|
* Abstract class for all cloud models (cirrus, cumulus...).
|
|
*/
|
|
class SOFTWARESHARED_EXPORT BaseCloudsModel {
|
|
public:
|
|
typedef struct {
|
|
double density;
|
|
double border_distance;
|
|
} CloudDensityInfo;
|
|
|
|
public:
|
|
BaseCloudsModel(CloudLayerDefinition *layer);
|
|
virtual ~BaseCloudsModel();
|
|
|
|
inline CloudLayerDefinition *getLayer() const {
|
|
return layer;
|
|
}
|
|
|
|
virtual void update();
|
|
|
|
virtual void getAltitudeRange(double *min_altitude, double *max_altitude) const;
|
|
virtual void getDetailRange(double *min_step, double *max_step) const;
|
|
|
|
/**
|
|
* Get the cloud density info at a given location.
|
|
*
|
|
* This will contain the local density (0.0-1.0), and an estimated distance to the nearest border.
|
|
*/
|
|
virtual CloudDensityInfo getDensity(const Vector3 &location, double quality) const;
|
|
|
|
/**
|
|
* Get the normal vector at a given location, to be used by lighting.
|
|
*
|
|
* The length of the result vector indicates its relevance. A short vector marks an area
|
|
* where applying a normal vector is not relevant.
|
|
*/
|
|
Vector3 getNormal(const Vector3 &location) const;
|
|
|
|
/**
|
|
* Get the presence of clouds, at a detail level, given a density factor.
|
|
*
|
|
* The detail value is assumed to have a continuous derivative.
|
|
* To do so, it may return negative-or-zero values for non-presence.
|
|
*/
|
|
virtual double getDetailValue(const Vector3 &location, double density, double quality) const;
|
|
|
|
protected:
|
|
CloudLayerDefinition *layer;
|
|
};
|
|
}
|
|
}
|
|
|
|
#endif // BASECLOUDSMODEL_H
|