Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAras Pranckevicius <aras@nesnausk.org>2022-05-03 14:45:44 +0300
committerAras Pranckevicius <aras@nesnausk.org>2022-05-03 14:45:44 +0300
commit5962db093f2f1fcf735ceaaa1ba6bbd25efc397f (patch)
tree9d01eb4b69a672ef26b4059cf81f89ddbb1d73bf
parent5f5e7ac317ddef5fed1c85fc8568c3ce09141fc1 (diff)
Fix T97793, Fix T97795: Use correct defaults for missing values in new OBJ importer
- Fix T97793: when a UV coordinate after vt is missing, use zero. While at it, also use zeroes for positions & normals, since "maximum possible float" is very likely to cause issues in imported meshes. - Fix T97795: use 1.0 default if -bm value is missing, instead of zero. Reviewed By: Howard Trickey Differential Revision: https://developer.blender.org/D14826
-rw-r--r--source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
index 3724eaaa361..8df2a6bf16a 100644
--- a/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
+++ b/source/blender/io/wavefront_obj/importer/obj_import_file_reader.cc
@@ -71,7 +71,7 @@ static void geom_add_vertex(Geometry *geom,
GlobalVertices &r_global_vertices)
{
float3 vert;
- parse_floats(line, FLT_MAX, vert, 3);
+ parse_floats(line, 0.0f, vert, 3);
r_global_vertices.vertices.append(vert);
geom->vertex_count_++;
}
@@ -81,7 +81,7 @@ static void geom_add_vertex_normal(Geometry *geom,
GlobalVertices &r_global_vertices)
{
float3 normal;
- parse_floats(line, FLT_MAX, normal, 3);
+ parse_floats(line, 0.0f, normal, 3);
r_global_vertices.vertex_normals.append(normal);
geom->has_vertex_normals_ = true;
}
@@ -89,7 +89,7 @@ static void geom_add_vertex_normal(Geometry *geom,
static void geom_add_uv_vertex(const StringRef line, GlobalVertices &r_global_vertices)
{
float2 uv;
- parse_floats(line, FLT_MAX, uv, 2);
+ parse_floats(line, 0.0f, uv, 2);
r_global_vertices.uv_vertices.append(uv);
}
@@ -558,7 +558,7 @@ static bool parse_texture_option(StringRef &line, MTLMaterial *material, tex_map
return true;
}
if (parse_keyword(line, "-bm")) {
- line = parse_float(line, 0.0f, material->map_Bump_strength);
+ line = parse_float(line, 1.0f, material->map_Bump_strength);
return true;
}
if (parse_keyword(line, "-type")) {