Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/pbvh_colors.cc
| Show First 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | static void pbvh_vertex_color_get(const PBVH &pbvh, PBVHVertRef vertex, float r_color[4]) | ||||
| if (pbvh.color_domain == ATTR_DOMAIN_CORNER) { | if (pbvh.color_domain == ATTR_DOMAIN_CORNER) { | ||||
| const MeshElemMap &melem = pbvh.pmap[index]; | const MeshElemMap &melem = pbvh.pmap[index]; | ||||
| int count = 0; | int count = 0; | ||||
| zero_v4(r_color); | zero_v4(r_color); | ||||
| for (const int i_poly : Span(melem.indices, melem.count)) { | for (const int i_poly : Span(melem.indices, melem.count)) { | ||||
| const MPoly &mp = pbvh.mpoly[i_poly]; | const MPoly &mp = pbvh.mpoly[i_poly]; | ||||
| Span<T> colors{static_cast<const T *>(pbvh.color_layer->data) + mp.loopstart, mp.totloop}; | Span<T> colors{static_cast<const T *>(pbvh.color_layer->data) + mp.loopstart, mp.totloop}; | ||||
| Span<MLoop> loops{pbvh.mloop + mp.loopstart, mp.totloop}; | Span<int> poly_verts{pbvh.corner_verts + mp.loopstart, mp.totloop}; | ||||
| for (const int i_loop : IndexRange(mp.totloop)) { | for (const int i : IndexRange(mp.totloop)) { | ||||
| if (loops[i_loop].v == index) { | if (poly_verts[i] == index) { | ||||
| float temp[4]; | float temp[4]; | ||||
| to_float(colors[i_loop], temp); | to_float(colors[i], temp); | ||||
| add_v4_v4(r_color, temp); | add_v4_v4(r_color, temp); | ||||
| count++; | count++; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if (count) { | if (count) { | ||||
| Show All 11 Lines | static void pbvh_vertex_color_set(PBVH &pbvh, PBVHVertRef vertex, const float color[4]) | ||||
| int index = vertex.i; | int index = vertex.i; | ||||
| if (pbvh.color_domain == ATTR_DOMAIN_CORNER) { | if (pbvh.color_domain == ATTR_DOMAIN_CORNER) { | ||||
| const MeshElemMap &melem = pbvh.pmap[index]; | const MeshElemMap &melem = pbvh.pmap[index]; | ||||
| for (const int i_poly : Span(melem.indices, melem.count)) { | for (const int i_poly : Span(melem.indices, melem.count)) { | ||||
| const MPoly &mp = pbvh.mpoly[i_poly]; | const MPoly &mp = pbvh.mpoly[i_poly]; | ||||
| MutableSpan<T> colors{static_cast<T *>(pbvh.color_layer->data) + mp.loopstart, mp.totloop}; | MutableSpan<T> colors{static_cast<T *>(pbvh.color_layer->data) + mp.loopstart, mp.totloop}; | ||||
| Span<MLoop> loops{pbvh.mloop + mp.loopstart, mp.totloop}; | Span<int> poly_verts{pbvh.corner_verts + mp.loopstart, mp.totloop}; | ||||
| for (const int i_loop : IndexRange(mp.totloop)) { | for (const int i : IndexRange(mp.totloop)) { | ||||
| if (loops[i_loop].v == index) { | if (poly_verts[i] == index) { | ||||
| from_float(color, colors[i_loop]); | from_float(color, colors[i]); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| from_float(color, static_cast<T *>(pbvh.color_layer->data)[index]); | from_float(color, static_cast<T *>(pbvh.color_layer->data)[index]); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 68 Lines • Show Last 20 Lines | |||||