From c6a1626cd3d1e63a86d8ff936b76f8382a15ce75 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 4 Oct 2015 20:20:10 +0200 Subject: [PATCH] Fix bug: x2egg replaced face normals with vertex normals --- pandatool/src/xfileegg/xFileMesh.cxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pandatool/src/xfileegg/xFileMesh.cxx b/pandatool/src/xfileegg/xFileMesh.cxx index 73e473b087..979650d74e 100644 --- a/pandatool/src/xfileegg/xFileMesh.cxx +++ b/pandatool/src/xfileegg/xFileMesh.cxx @@ -212,6 +212,13 @@ add_material(EggPrimitive *egg_prim) { //////////////////////////////////////////////////////////////////// int XFileMesh:: add_vertex(XFileVertex *vertex) { + if (vertex->_has_color) { + _has_colors = true; + } + if (vertex->_has_uv) { + _has_uvs = true; + } + int next_index = _vertices.size(); _unique_vertices.insert(UniqueVertices::value_type(vertex, next_index)); _vertices.push_back(vertex); @@ -228,6 +235,10 @@ add_vertex(XFileVertex *vertex) { //////////////////////////////////////////////////////////////////// int XFileMesh:: add_normal(XFileNormal *normal) { + if (normal->_has_normal) { + _has_normals = true; + } + int next_index = _normals.size(); _unique_normals.insert(UniqueNormals::value_type(normal, next_index)); _normals.push_back(normal); @@ -244,6 +255,10 @@ add_normal(XFileNormal *normal) { //////////////////////////////////////////////////////////////////// int XFileMesh:: add_material(XFileMaterial *material) { + if (material->has_material()) { + _has_materials = true; + } + int next_index = _materials.size(); _unique_materials.insert(UniqueMaterials::value_type(material, next_index)); _materials.push_back(material);