light: add operator== for lightgrid_samples_t

This commit is contained in:
Eric Wasylishen 2023-02-10 00:29:14 -07:00
parent 92eb58d715
commit 051cc29afb
2 changed files with 16 additions and 0 deletions

View File

@ -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);

View File

@ -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