Cleanup: Use consistent "vert" term for mesh normals
Use "vert" instead of "vertex" when referring to mesh normals. This was
discussed as part of 1af62cb3bf but never completely
implemented.
This commit is contained in:
@@ -142,7 +142,7 @@ static void geom_add_vertex_normal(const char *p,
|
||||
* making them ever-so-slightly non unit length. Make sure they are
|
||||
* normalized. */
|
||||
normalize_v3(normal);
|
||||
r_global_vertices.vertex_normals.append(normal);
|
||||
r_global_vertices.vert_normals.append(normal);
|
||||
}
|
||||
|
||||
static void geom_add_uv_vertex(const char *p, const char *end, GlobalVertices &r_global_vertices)
|
||||
@@ -282,16 +282,16 @@ static void geom_add_polygon(Geometry *geom,
|
||||
/* Ignore corner normal index, if the geometry does not have any normals.
|
||||
* Some obj files out there do have face definitions that refer to normal indices,
|
||||
* without any normals being present (#98782). */
|
||||
if (got_normal && !global_vertices.vertex_normals.is_empty()) {
|
||||
if (got_normal && !global_vertices.vert_normals.is_empty()) {
|
||||
corner.vertex_normal_index += corner.vertex_normal_index < 0 ?
|
||||
global_vertices.vertex_normals.size() :
|
||||
global_vertices.vert_normals.size() :
|
||||
-1;
|
||||
if (corner.vertex_normal_index < 0 ||
|
||||
corner.vertex_normal_index >= global_vertices.vertex_normals.size()) {
|
||||
corner.vertex_normal_index >= global_vertices.vert_normals.size()) {
|
||||
fprintf(stderr,
|
||||
"Invalid normal index %i (valid range [0, %zu)), ignoring face\n",
|
||||
corner.vertex_normal_index,
|
||||
size_t(global_vertices.vertex_normals.size()));
|
||||
size_t(global_vertices.vert_normals.size()));
|
||||
face_valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ void MeshFromGeometry::create_materials(Main *bmain,
|
||||
void MeshFromGeometry::create_normals(Mesh *mesh)
|
||||
{
|
||||
/* No normal data: nothing to do. */
|
||||
if (global_vertices_.vertex_normals.is_empty()) {
|
||||
if (global_vertices_.vert_normals.is_empty()) {
|
||||
return;
|
||||
}
|
||||
/* Custom normals can only be stored on face corners. */
|
||||
@@ -375,7 +375,7 @@ void MeshFromGeometry::create_normals(Mesh *mesh)
|
||||
int n_index = curr_corner.vertex_normal_index;
|
||||
float3 normal(0, 0, 0);
|
||||
if (n_index >= 0) {
|
||||
normal = global_vertices_.vertex_normals[n_index];
|
||||
normal = global_vertices_.vert_normals[n_index];
|
||||
}
|
||||
copy_v3_v3(loop_normals[tot_loop_idx], normal);
|
||||
tot_loop_idx++;
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace blender::io::obj {
|
||||
struct GlobalVertices {
|
||||
Vector<float3> vertices;
|
||||
Vector<float2> uv_vertices;
|
||||
Vector<float3> vertex_normals;
|
||||
Vector<float3> vert_normals;
|
||||
|
||||
/**
|
||||
* Vertex colors might not be present in the file at all, or only
|
||||
|
||||
Reference in New Issue
Block a user