From c64e319d7b2592e0c680cee200f74a74e39833d1 Mon Sep 17 00:00:00 2001 From: granzuglia Date: Mon, 6 Nov 2006 09:31:43 +0000 Subject: [PATCH] added support for texture-mapping --- wrap/io_trimesh/import_dae.h | 17 ++++++++++++++++- wrap/io_trimesh/util_dae.h | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/wrap/io_trimesh/import_dae.h b/wrap/io_trimesh/import_dae.h index b8fa8f67..fbd7b423 100644 --- a/wrap/io_trimesh/import_dae.h +++ b/wrap/io_trimesh/import_dae.h @@ -238,6 +238,19 @@ namespace io { } else return E_NOMESH; } + + static void GetTexture(const QDomDocument& doc,AdditionalInfoDAE* inf) + { + QDomNodeList txlst = doc.elementsByTagName("library_images"); + for(int img = 0;img < txlst.size();++img) + { + QDomNodeList nlst = txlst.at(img).toElement().elementsByTagName("init_from"); + if (nlst.size() > 0) + { + inf->dae->texturefile.push_back(nlst.at(0).firstChild().nodeValue()); + } + } + } public: //merge all meshes in the collada's file in the templeted mesh m @@ -261,6 +274,8 @@ namespace io { file.close(); info->doc = doc; + //GetTexture(*(info->doc),inf); + QDomNodeList& scenes = info->doc->elementsByTagName("scene"); int scn_size = scenes.size(); if (scn_size == 0) @@ -369,7 +384,7 @@ namespace io { info->doc = doc; - + GetTexture(*(info->doc),inf); QDomNodeList& scenes = info->doc->elementsByTagName("scene"); int scn_size = scenes.size(); diff --git a/wrap/io_trimesh/util_dae.h b/wrap/io_trimesh/util_dae.h index baa896d8..2bb3774e 100644 --- a/wrap/io_trimesh/util_dae.h +++ b/wrap/io_trimesh/util_dae.h @@ -37,7 +37,7 @@ namespace io { } QDomDocument* doc; - std::vector texturefile; + std::vector texturefile; }; class AdditionalInfoDAE : public AdditionalInfo