| 14 | STAR_EXCEPTION(LightmapException, StarException); |
| 15 | |
| 16 | class Lightmap { |
| 17 | public: |
| 18 | Lightmap(); |
| 19 | Lightmap(unsigned width, unsigned height); |
| 20 | Lightmap(Lightmap const& lightMap); |
| 21 | Lightmap(Lightmap&& lightMap) noexcept; |
| 22 | |
| 23 | Lightmap& operator=(Lightmap const& lightMap); |
| 24 | Lightmap& operator=(Lightmap&& lightMap) noexcept; |
| 25 | |
| 26 | operator ImageView(); |
| 27 | |
| 28 | void set(unsigned x, unsigned y, float v); |
| 29 | void set(unsigned x, unsigned y, Vec3F const& v); |
| 30 | void add(unsigned x, unsigned y, Vec3F const& v); |
| 31 | Vec3F get(unsigned x, unsigned y) const; |
| 32 | |
| 33 | bool empty() const; |
| 34 | |
| 35 | Vec2U size() const; |
| 36 | unsigned width() const; |
| 37 | unsigned height() const; |
| 38 | float* data(); |
| 39 | |
| 40 | private: |
| 41 | size_t len() const; |
| 42 | |
| 43 | std::unique_ptr<float[]> m_data; |
| 44 | unsigned m_width; |
| 45 | unsigned m_height; |
| 46 | }; |
| 47 | |
| 48 | inline void Lightmap::set(unsigned x, unsigned y, float v) { |
| 49 | if (x >= m_width || y >= m_height) { |