forked from blender/blender
main sync #3
@ -333,30 +333,26 @@ struct PBVHBatches {
|
||||
foreach_faces,
|
||||
GPUVertBufRaw *access)
|
||||
{
|
||||
float fno[3];
|
||||
short no[3];
|
||||
int last_poly = -1;
|
||||
const bool *sharp_faces = static_cast<const bool *>(
|
||||
CustomData_get_layer_named(args->pdata, CD_PROP_BOOL, "sharp_face"));
|
||||
short no[3];
|
||||
int last_poly = -1;
|
||||
bool flat = false;
|
||||
|
||||
foreach_faces([&](int /*buffer_i*/, int /*tri_i*/, int vertex_i, const MLoopTri *tri) {
|
||||
bool smooth = false;
|
||||
if (tri->poly != last_poly) {
|
||||
last_poly = tri->poly;
|
||||
|
||||
if (sharp_faces && sharp_faces[tri->poly]) {
|
||||
smooth = true;
|
||||
flat = sharp_faces && sharp_faces[tri->poly];
|
||||
if (flat) {
|
||||
const MPoly &poly = args->polys[tri->poly];
|
||||
float fno[3];
|
||||
BKE_mesh_calc_poly_normal(
|
||||
&poly, args->mloop + poly.loopstart, args->vert_positions, fno);
|
||||
normal_float_to_short_v3(no, fno);
|
||||
}
|
||||
else {
|
||||
smooth = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!smooth) {
|
||||
if (!flat) {
|
||||
normal_float_to_short_v3(no, args->vert_normals[vertex_i]);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user