diff options
author | Aras Pranckevicius <aras@nesnausk.org> | 2022-06-14 10:19:02 +0300 |
---|---|---|
committer | Aras Pranckevicius <aras@nesnausk.org> | 2022-06-14 10:19:02 +0300 |
commit | 1b4f35f6a5889d8d2e65c6231e84f8b1744c4f96 (patch) | |
tree | cfae52865680308729ad955ad623c3151188097a /source/blender/io/wavefront_obj/importer/obj_import_objects.hh | |
parent | 827fa8176737f822b7f8d2354b05e59976c7101a (diff) |
obj: vertex colors support in importer and exporter
Adds support for vertex colors to OBJ I/O.
Importer:
- Supports both "xyzrgb" and "MRGB" vertex color formats.
- Whenever vertex color is present in the file for a model, it is
imported and a Color attribute is created (per-vertex, full float
color data type). Color coming from the file is assumed to be sRGB,
and is converted to linear upon import.
Exporter:
- Option to export the vertex colors. Defaults to "off", since not
all 3rd party software supports vertex colors.
- When the option is "on", if a mesh has a color attribute layer,
the active one is exported in "xyzrgb" form. If the mesh has
per-face-corner colors, they are averaged on the vertices.
Colors are converted from linear to sRGB upon export.
Reviewed By: Howard Trickey
Differential Revision: https://developer.blender.org/D15159
Diffstat (limited to 'source/blender/io/wavefront_obj/importer/obj_import_objects.hh')
-rw-r--r-- | source/blender/io/wavefront_obj/importer/obj_import_objects.hh | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/io/wavefront_obj/importer/obj_import_objects.hh b/source/blender/io/wavefront_obj/importer/obj_import_objects.hh index b67ba46af03..69babc26bb0 100644 --- a/source/blender/io/wavefront_obj/importer/obj_import_objects.hh +++ b/source/blender/io/wavefront_obj/importer/obj_import_objects.hh @@ -26,6 +26,7 @@ struct GlobalVertices { Vector<float3> vertices; Vector<float2> uv_vertices; Vector<float3> vertex_normals; + Vector<float3> vertex_colors; }; /** @@ -102,6 +103,8 @@ struct Geometry { int vertex_start_ = 0; int vertex_count_ = 0; + int vertex_color_start_ = 0; + int vertex_color_count_ = 0; /** Edges written in the file in addition to (or even without polygon) elements. */ Vector<MEdge> edges_; |