2013-12-01 18:24:53 +00:00
|
|
|
#ifndef CLOUDSRENDERER_H
|
|
|
|
#define CLOUDSRENDERER_H
|
|
|
|
|
|
|
|
#include "software_global.h"
|
|
|
|
|
2013-12-17 22:45:09 +00:00
|
|
|
#include "LightFilter.h"
|
|
|
|
|
2013-12-01 18:24:53 +00:00
|
|
|
namespace paysages {
|
|
|
|
namespace software {
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Software renderer of a group of cloud layers.
|
|
|
|
*/
|
2013-12-17 22:45:09 +00:00
|
|
|
class SOFTWARESHARED_EXPORT CloudsRenderer: public LightFilter
|
2013-12-01 18:24:53 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
CloudsRenderer(SoftwareRenderer* parent);
|
|
|
|
virtual ~CloudsRenderer();
|
|
|
|
|
|
|
|
/*!
|
2013-12-04 21:52:18 +00:00
|
|
|
* \brief Update the renderer with the bound scenery.
|
|
|
|
*
|
|
|
|
* Don't call this if another thread is currently using this renderer.
|
2013-12-01 18:24:53 +00:00
|
|
|
*/
|
2013-12-17 22:45:09 +00:00
|
|
|
virtual void update();
|
2013-12-01 18:24:53 +00:00
|
|
|
|
|
|
|
/*!
|
2013-12-04 21:52:18 +00:00
|
|
|
* \brief Get the layer renderer for a given layer.
|
2013-12-01 18:24:53 +00:00
|
|
|
*
|
|
|
|
* The returned renderer is managed by this object and should not be deleted.
|
|
|
|
*/
|
|
|
|
virtual BaseCloudLayerRenderer* getLayerRenderer(unsigned int layer);
|
|
|
|
|
|
|
|
/*!
|
2013-12-04 21:52:18 +00:00
|
|
|
* \brief Get the cloud model for a given layer.
|
|
|
|
*
|
|
|
|
* The returned model is managed by this object and should not be deleted.
|
|
|
|
*/
|
|
|
|
virtual BaseCloudsModel* getLayerModel(unsigned int layer);
|
|
|
|
|
2013-12-20 16:30:27 +00:00
|
|
|
/*!
|
|
|
|
* \brief Override de default density model for a given layer.
|
|
|
|
*
|
|
|
|
* This must be called after each update().
|
|
|
|
* Ownership of the model is taken.
|
|
|
|
*/
|
|
|
|
virtual void setLayerModel(unsigned int layer, BaseCloudsModel* model, bool delete_old=true);
|
|
|
|
|
2013-12-04 21:52:18 +00:00
|
|
|
/*!
|
|
|
|
* \brief Get the composited color, as applied on a base color and location.
|
2013-12-01 18:24:53 +00:00
|
|
|
*/
|
|
|
|
virtual Color getColor(const Vector3 &eye, const Vector3 &location, const Color &base);
|
|
|
|
|
|
|
|
/*!
|
2013-12-04 21:52:18 +00:00
|
|
|
* \brief Alter a light, as if passed through all layers.
|
2013-12-01 18:24:53 +00:00
|
|
|
*
|
|
|
|
* Return true if the light was altered.
|
|
|
|
*/
|
2013-12-17 22:45:09 +00:00
|
|
|
virtual bool applyLightFilter(LightComponent &light, const Vector3 &at) override;
|
2013-12-01 18:24:53 +00:00
|
|
|
private:
|
|
|
|
SoftwareRenderer* parent;
|
2013-12-04 21:52:18 +00:00
|
|
|
|
2013-12-01 18:24:53 +00:00
|
|
|
std::vector<BaseCloudLayerRenderer*> layer_renderers;
|
|
|
|
BaseCloudLayerRenderer* fake_renderer;
|
2013-12-04 21:52:18 +00:00
|
|
|
|
|
|
|
std::vector<BaseCloudsModel*> layer_models;
|
|
|
|
BaseCloudsModel* fake_model;
|
2013-12-01 18:24:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // CLOUDSRENDERER_H
|