paysages3d/src/render/software/FluidMediumManager.h

60 lines
1.5 KiB
C
Raw Normal View History

#ifndef FLUIDMEDIUMMANAGER_H
#define FLUIDMEDIUMMANAGER_H
#include "software_global.h"
#include "SpaceSegment.h"
#include <vector>
namespace paysages {
namespace software {
typedef struct {
FluidMediumInterface *medium;
SpaceSegment segment;
} FluidMediumSegment;
2016-01-03 18:21:23 +00:00
/**
* Global object to interact with fluid medium (air, water, clouds...)
*
* This object handles the traversal of fluid medium and the collecting of
* medium density and properties.
* It is mainly used to compute the alteration made by such media on light.
*/
class SOFTWARESHARED_EXPORT FluidMediumManager {
public:
FluidMediumManager(SoftwareRenderer *renderer);
virtual ~FluidMediumManager();
2016-01-03 18:21:23 +00:00
/**
* Remove all registered medium.
*/
void clearMedia();
2016-01-03 18:21:23 +00:00
/**
* Register a new medium in the manager.
*/
void registerMedium(FluidMediumInterface *medium);
2016-01-03 18:21:23 +00:00
/**
2016-01-06 18:55:49 +00:00
* Apply complete medium traversal between 'location' and 'eye', to the base 'color'.
2016-01-03 18:21:23 +00:00
*
* Returns the light received by eye, transformed by medium traversal.
*/
virtual Color applyTraversal(const Vector3 &eye, const Vector3 &location, const Color &color) const;
2016-01-03 18:21:23 +00:00
/**
* Get the potential media traversed by a ray, unsorted
*/
virtual int getTraversedMedia(FluidMediumSegment segments[], const SpaceSegment &ray, int max_segments) const;
private:
SoftwareRenderer *renderer;
2015-12-10 23:36:50 +00:00
vector<FluidMediumInterface *> media;
};
}
}
#endif // FLUIDMEDIUMTRAVERSAL_H