diff --git a/include/light/ltface.hh b/include/light/ltface.hh index 345ae732..50f8cd81 100644 --- a/include/light/ltface.hh +++ b/include/light/ltface.hh @@ -65,6 +65,8 @@ struct lightgrid_sample_t { qvec3b round_to_int() const; float brightness() const; + + bool operator==(const lightgrid_sample_t &other) const; }; struct lightgrid_samples_t { @@ -72,6 +74,8 @@ struct lightgrid_samples_t { void add(const qvec3d &color, int style); int used_styles() const; + + bool operator==(const lightgrid_samples_t &other) const; }; lightgrid_samples_t CalcLightgridAtPoint(const mbsp_t *bsp, const qvec3d &world_point); diff --git a/light/ltface.cc b/light/ltface.cc index 01e75aab..c422ddb1 100644 --- a/light/ltface.cc +++ b/light/ltface.cc @@ -3326,6 +3326,13 @@ float lightgrid_sample_t::brightness() const return (color[0] + color[1] + color[2]) / 3.0; } +bool lightgrid_sample_t::operator==(const lightgrid_sample_t &other) const +{ + return used == other.used && + style == other.style && + color == other.color; +} + int lightgrid_samples_t::used_styles() const { int used = 0; @@ -3339,6 +3346,11 @@ int lightgrid_samples_t::used_styles() const return used; } +bool lightgrid_samples_t::operator==(const lightgrid_samples_t &other) const +{ + return samples_by_style == other.samples_by_style; +} + lightgrid_samples_t CalcLightgridAtPoint(const mbsp_t *bsp, const qvec3d &world_point) { // TODO: use more than 1 ray for better performance