Sync changes from upstream repository

Co-authored-by: Andrew Le Bihan <andy@mcneel.com>
Co-authored-by: chuck <chuck@mcneel.com>
Co-authored-by: Dale Fugier <dale@mcneel.com>
Co-authored-by: Dale Lear <dalelear@mcneel.com>
Co-authored-by: David Eränen <david.eranen@mcneel.com>
Co-authored-by: Greg Arden <greg@mcneel.com>
Co-authored-by: John Croudy <john.croudy@mcneel.com>
Co-authored-by: Lowell Walmsley <lowell@mcneel.com>
Co-authored-by: Nathan Letwory <nathan@mcneel.com>
Co-authored-by: piac <giulio@mcneel.com>
Co-authored-by: Steve Baer <steve@mcneel.com>
Co-authored-by: Tim Hemmelman <tim@mcneel.com>
This commit is contained in:
Bozo The Builder
2020-03-12 09:00:26 -07:00
parent acbc998a03
commit 01cdb463e6
50 changed files with 5774 additions and 1857 deletions

View File

@@ -488,6 +488,13 @@ bool ON_SubD::SetTextureCoordinates(
// The mesh topology, 3d vertex locations, 3d vertex normals
// CANNOT be modified to insert "texture seams."
//
ON_Xform P_xform, N_xform;
if (subd_xform && ON_TextureMapping::TYPE::srfp_mapping != mt)
{
subd_xform->GetMappingXforms(P_xform, N_xform);
}
ON_3dPoint tc;
ON_SubDMeshFragmentIterator frit(*this);
for (const ON_SubDMeshFragment* fragment = frit.FirstFragment(); nullptr != fragment; fragment = frit.NextFragment())
@@ -514,10 +521,18 @@ bool ON_SubD::SetTextureCoordinates(
const size_t N_stride = (N_count == P_count) ? fragment->m_N_stride : 0;
for (double* T1 = T + T_stride * T_count; T < T1; T += T_stride, P += P_stride, N += N_stride)
{
if (ON_TextureMapping::TYPE::srfp_mapping != mt)
if (ON_TextureMapping::TYPE::srfp_mapping == mt)
tc = ON_3dPoint(T[0], T[1], 0.0);
else if (false == mapping.Evaluate(ON_3dPoint(P), ON_3dVector(N), &tc))
tc = ON_3dPoint::NanPoint;
else
{
bool ok = subd_xform ?
mapping.Evaluate(ON_3dPoint(P), ON_3dVector(N), &tc, P_xform, N_xform) :
mapping.Evaluate(ON_3dPoint(P), ON_3dVector(N), &tc);
if(!ok)
tc = ON_3dPoint::NanPoint;
}
if (bApplyUVW)
tc = mapping.m_uvw * tc;
T[0] = tc.x;
@@ -602,6 +617,23 @@ void ON_SubDFace::SetTextureDomain(
}
}
void ON_SubDFace::SetMaterialChannelIndex(int material_channel_index) const
{
if ( material_channel_index >= 0 && material_channel_index <= ON_Material::MaximumMaterialChannelIndex )
{
m_material_channel_index = (unsigned short)material_channel_index;
}
else
{
ON_ERROR("Invalid material_channel_index value.");
m_material_channel_index = 0;
}
}
int ON_SubDFace::MaterialChannelIndex() const
{
return (int)m_material_channel_index;
}
const bool ON_SubDFace::TextureDomainIsSet() const
{