MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / sampleVertexColor

Function sampleVertexColor

source/MRMesh/MRTextureColors.cpp:70–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70Color sampleVertexColor( const Mesh& mesh, VertId v, const MeshTexture& tex, const TriCornerUVCoords& triCornerUvCoords )
71{
72 Vector4f sumWC;
73 float sumW = 0;
74 for ( EdgeId e : orgRing( mesh.topology, v ) )
75 {
76 auto l = mesh.topology.left( e );
77 if ( !l )
78 continue;
79 //auto lvs = mesh.topology.getTriVerts( l );
80 const auto d0 = edgeVector( mesh.topology, mesh.points, e );
81 const auto d1 = edgeVector( mesh.topology, mesh.points, mesh.topology.next( e ) );
82 const auto angle = MR::angle( d0, d1 );
83 sumWC += angle * Vector4f( tex.sample( tex.filter, getUV( v, mesh.topology.getTriVerts( l ), triCornerUvCoords[l] ) ) );
84 sumW += angle;
85 }
86 if ( sumW > 0 )
87 return Color( sumWC/ sumW );
88 return {};
89}
90
91VertColors sampleVertexColors( const Mesh& mesh, const MeshTexture& tex, const TriCornerUVCoords& triCornerUvCoords )
92{

Callers 1

sampleVertexColorsFunction · 0.85

Calls 9

orgRingFunction · 0.85
edgeVectorFunction · 0.85
getUVFunction · 0.85
ColorClass · 0.85
leftMethod · 0.80
sampleMethod · 0.80
getTriVertsMethod · 0.80
angleFunction · 0.70
nextMethod · 0.45

Tested by

no test coverage detected