mirror of
https://github.com/mcneel/opennurbs.git
synced 2026-03-17 23:16:02 +08:00
Sync changes from upstream repository
Co-authored-by: Andrew le Bihan <andy@mcneel.com> Co-authored-by: Brian Gillespie <brian@mcneel.com> Co-authored-by: Dale Lear <dalelear@mcneel.com> Co-authored-by: Giulio Piacentino <giulio@mcneel.com> Co-authored-by: Greg Arden <greg@mcneel.com> Co-authored-by: Lars <lars@mcneel.com> Co-authored-by: Lowell <lowell@mcneelcom> Co-authored-by: Nathan Letwory <nathan@mcneel.com> Co-authored-by: Pierre Cuvilliers <pierre@mcneel.com> Co-authored-by: Tim Hemmelman <tim@mcneel.com>
This commit is contained in:
@@ -1021,6 +1021,31 @@ void ON_SubD::SetPerFaceColorsFromPackId() const
|
||||
ChangeRenderContentSerialNumber(); // face color changes.
|
||||
}
|
||||
|
||||
bool ON_SubD::HasPerFaceColorsFromPackId() const
|
||||
{
|
||||
ON_SubDFaceIterator fit(*this);
|
||||
const ON_SubDFace* f = fit.FirstFace();
|
||||
if (nullptr == f)
|
||||
return false;
|
||||
bool bHasPerFaceColorsFromPackId = false;
|
||||
for (/*empty init*/; nullptr != f; f = fit.NextFace())
|
||||
{
|
||||
const ON_Color f_color = f->PerFaceColor();
|
||||
if (((unsigned int)f_color) == ((unsigned int)ON_Color::UnsetColor))
|
||||
continue;
|
||||
const unsigned pack_id = f->PackId();
|
||||
const ON_Color pack_id_color
|
||||
= (0 == pack_id)
|
||||
? ON_Color::UnsetColor
|
||||
: ON_Color::RandomColor(pack_id);
|
||||
if (((unsigned int)pack_id_color) != ((unsigned int)f_color))
|
||||
return false;
|
||||
bHasPerFaceColorsFromPackId = true;
|
||||
}
|
||||
return bHasPerFaceColorsFromPackId;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// ON_SubDMeshFragment - texture coordinates
|
||||
|
||||
Reference in New Issue
Block a user