2014-06-05 15:12:49 +00:00
|
|
|
#ifndef CANVASPIXEL_H
|
|
|
|
#define CANVASPIXEL_H
|
|
|
|
|
|
|
|
#include "software_global.h"
|
|
|
|
|
2014-06-10 13:13:16 +00:00
|
|
|
#include "CanvasFragment.h"
|
|
|
|
|
2015-10-18 15:26:19 +00:00
|
|
|
const int MAX_FRAGMENTS_PER_PIXEL = 5;
|
2014-06-10 13:13:16 +00:00
|
|
|
|
2014-06-05 15:12:49 +00:00
|
|
|
namespace paysages {
|
|
|
|
namespace software {
|
|
|
|
|
|
|
|
/**
|
2016-01-03 18:21:23 +00:00
|
|
|
* One pixel of a Canvas.
|
2014-06-05 15:12:49 +00:00
|
|
|
*
|
|
|
|
* A pixel stores superimposed fragments (CanvasFragment), sorted by their distance to camera.
|
|
|
|
*/
|
2015-11-09 21:30:46 +00:00
|
|
|
class SOFTWARESHARED_EXPORT CanvasPixel {
|
|
|
|
public:
|
2014-06-05 15:12:49 +00:00
|
|
|
CanvasPixel();
|
2014-06-10 13:13:16 +00:00
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
inline int getFragmentCount() const {
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
inline const Color &getComposite() const {
|
|
|
|
return composite;
|
|
|
|
}
|
|
|
|
inline const CanvasFragment &getFragment(int position) const {
|
|
|
|
return fragments[position];
|
|
|
|
}
|
2014-06-10 13:13:16 +00:00
|
|
|
const CanvasFragment *getFrontFragment() const;
|
|
|
|
|
|
|
|
void reset();
|
|
|
|
void pushFragment(const CanvasFragment &fragment);
|
2014-06-12 15:45:59 +00:00
|
|
|
void updateComposite();
|
2014-08-18 10:17:16 +00:00
|
|
|
void setComposite(const Color &color);
|
2014-06-10 13:13:16 +00:00
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
private:
|
2014-06-10 13:13:16 +00:00
|
|
|
int count;
|
2015-10-15 22:51:46 +00:00
|
|
|
CanvasFragment fragments[MAX_FRAGMENTS_PER_PIXEL];
|
2014-06-12 15:45:59 +00:00
|
|
|
Color composite;
|
2014-06-05 15:12:49 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // CANVASPIXEL_H
|