2016-07-12 17:40:45 +00:00
|
|
|
#pragma once
|
2013-12-08 16:56:59 +00:00
|
|
|
|
|
|
|
#include "software_global.h"
|
|
|
|
|
|
|
|
#include "LightComponent.h"
|
|
|
|
|
2015-11-18 18:37:00 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2013-12-08 16:56:59 +00:00
|
|
|
namespace paysages {
|
|
|
|
namespace software {
|
|
|
|
|
|
|
|
/**
|
2016-01-03 18:21:23 +00:00
|
|
|
* Light status at a given point.
|
2013-12-08 16:56:59 +00:00
|
|
|
*
|
|
|
|
* The light status is the combination of all LightComponent received at a given location.
|
|
|
|
*/
|
2015-11-09 21:30:46 +00:00
|
|
|
class SOFTWARESHARED_EXPORT LightStatus {
|
|
|
|
public:
|
|
|
|
LightStatus(LightingManager *manager, const Vector3 &location, const Vector3 &eye, bool filtered = true);
|
2013-12-08 16:56:59 +00:00
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
inline Vector3 getLocation() const {
|
|
|
|
return location;
|
|
|
|
}
|
2013-12-08 19:54:34 +00:00
|
|
|
|
2013-12-08 16:56:59 +00:00
|
|
|
void pushComponent(LightComponent component);
|
|
|
|
|
2013-12-08 19:54:34 +00:00
|
|
|
Color apply(const Vector3 &normal, const SurfaceMaterial &material);
|
|
|
|
|
2015-09-29 20:31:25 +00:00
|
|
|
/**
|
|
|
|
* Return the sum of all received lights.
|
|
|
|
*/
|
|
|
|
Color getSum() const;
|
|
|
|
|
2015-10-15 22:14:54 +00:00
|
|
|
/**
|
|
|
|
* Set the safety offset for this status.
|
|
|
|
*
|
|
|
|
* The offset is used to not hit the surface we are currently working on immediately.
|
|
|
|
* It adds a small vector toward the light at the start of shadow casting.
|
|
|
|
* This number should remain very small to not produce precision errors.
|
|
|
|
*/
|
|
|
|
void setSafetyOffset(double safety_offset);
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
private:
|
2015-10-15 22:14:54 +00:00
|
|
|
double safety_offset;
|
2013-12-26 18:03:19 +00:00
|
|
|
double max_power;
|
2015-11-09 21:30:46 +00:00
|
|
|
LightingManager *manager;
|
2013-12-08 16:56:59 +00:00
|
|
|
Vector3 location;
|
|
|
|
Vector3 eye;
|
2015-09-29 20:31:25 +00:00
|
|
|
bool filtered;
|
2015-12-10 23:36:50 +00:00
|
|
|
vector<LightComponent> components;
|
2013-12-08 16:56:59 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|