2015-10-18 15:26:19 +00:00
|
|
|
#ifndef VEGETATIONRENDERER_H
|
|
|
|
#define VEGETATIONRENDERER_H
|
|
|
|
|
|
|
|
#include "software_global.h"
|
|
|
|
|
|
|
|
#include "LightFilter.h"
|
|
|
|
|
|
|
|
namespace paysages {
|
|
|
|
namespace software {
|
|
|
|
|
2015-11-09 21:38:00 +00:00
|
|
|
class SOFTWARESHARED_EXPORT VegetationRenderer : public LightFilter {
|
|
|
|
public:
|
2015-10-18 15:26:19 +00:00
|
|
|
VegetationRenderer(SoftwareRenderer *parent);
|
2015-11-25 22:15:58 +00:00
|
|
|
virtual ~VegetationRenderer();
|
2015-10-18 15:26:19 +00:00
|
|
|
|
2015-10-18 15:35:42 +00:00
|
|
|
/**
|
|
|
|
* Totally enable or disable the vegetation layers rendering.
|
|
|
|
*/
|
|
|
|
void setEnabled(bool enabled);
|
|
|
|
|
2015-11-09 21:38:00 +00:00
|
|
|
inline SoftwareRenderer *getParent() const {
|
|
|
|
return parent;
|
|
|
|
}
|
2015-10-18 15:26:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Perform ray casting on a single instance.
|
2015-10-18 20:15:19 +00:00
|
|
|
*
|
|
|
|
* If *only_hit* is true, only care about hitting or not, do not compute the color.
|
|
|
|
*
|
2015-11-09 21:38:00 +00:00
|
|
|
* If *displaced* is true, *instance* is considered on already displaced terrain, else, terrain displacement is
|
|
|
|
*applied.
|
2015-10-18 15:26:19 +00:00
|
|
|
*/
|
2015-11-09 21:38:00 +00:00
|
|
|
RayCastingResult renderInstance(const SpaceSegment &segment, const VegetationInstance &instance,
|
|
|
|
bool only_hit = false, bool displaced = false);
|
2015-10-18 15:26:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Perform ray casting on a given segment.
|
|
|
|
*/
|
2015-11-09 21:38:00 +00:00
|
|
|
RayCastingResult getResult(const SpaceSegment &segment, bool only_hit = false);
|
2015-10-18 15:26:19 +00:00
|
|
|
|
2015-11-02 19:14:35 +00:00
|
|
|
/**
|
|
|
|
* Perform ray casting on a squared region.
|
|
|
|
*/
|
2015-11-09 21:38:00 +00:00
|
|
|
RayCastingResult getBoundResult(const SpaceSegment &segment, double x, double z, bool only_hit = false,
|
|
|
|
double xsize = 1.0, double zsize = 1.0);
|
2015-11-02 19:14:35 +00:00
|
|
|
|
2015-10-18 15:26:19 +00:00
|
|
|
virtual bool applyLightFilter(LightComponent &light, const Vector3 &at) override;
|
|
|
|
|
2015-11-09 21:38:00 +00:00
|
|
|
private:
|
2015-10-18 15:26:19 +00:00
|
|
|
SoftwareRenderer *parent;
|
2015-10-18 15:35:42 +00:00
|
|
|
bool enabled;
|
2015-10-18 15:26:19 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // VEGETATIONRENDERER_H
|