From 669533437778339e293c8b2bfefa32166a6cc708 Mon Sep 17 00:00:00 2001 From: Arystanbek Dyussenov Date: Sat, 23 Jan 2010 17:33:40 +0000 Subject: COLLADA branch: patch for importer from Sergey I. Sharybin to build against OpenCollada at revision 721. Thanks Sergey! People who want to build this branch will need update their OpenCollada. On Linux OpenCollada builds without patching. As usual I updated the build doc: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch#Building_the_COLLADA_GSoC_branch A small change will be necessary in cmake and scons options on Mac and Windows: OpenCollada's libBuffer was renamed to libbuffer. --- CMakeLists.txt | 2 +- config/linux2-config.py | 2 +- source/blender/collada/DocumentImporter.cpp | 29 +++++++++++++---------------- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c5bce899c5f..077b5125de9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -217,7 +217,7 @@ IF(UNIX AND NOT APPLE) IF (WITH_OPENCOLLADA) SET(OPENCOLLADA /usr/local/opencollada CACHE FILEPATH "OpenCollada Directory") SET(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib) - SET(OPENCOLLADA_LIB OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver pcre ftoa Buffer) + SET(OPENCOLLADA_LIB OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver pcre ftoa buffer) SET(OPENCOLLADA_INC ${OPENCOLLADA}) SET(PCRE /usr CACHE FILEPATH "PCRE Directory") SET(PCRE_LIBPATH ${PCRE}/lib) diff --git a/config/linux2-config.py b/config/linux2-config.py index fe07d6dd307..cf79a6a870f 100644 --- a/config/linux2-config.py +++ b/config/linux2-config.py @@ -156,7 +156,7 @@ BF_COLLADA = '#source/blender/collada' BF_COLLADA_INC = '${BF_COLLADA}' BF_COLLADA_LIB = 'bf_collada' BF_OPENCOLLADA = '/usr' -BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver pcre Buffer ftoa' +BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver pcre buffer ftoa' BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib' BF_PCRE = '' BF_PCRE_LIB = 'pcre' diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 26e95c378a6..ad8edccbf89 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -1564,15 +1564,13 @@ public: return NULL; } - MTex *assign_textures_to_uvlayer(COLLADAFW::InstanceGeometry::TextureCoordinateBinding &ctexture, + MTex *assign_textures_to_uvlayer(COLLADAFW::TextureCoordinateBinding &ctexture, Mesh *me, TexIndexTextureArrayMap& texindex_texarray_map, MTex *color_texture) { - - COLLADAFW::TextureMapId texture_index = ctexture.textureMapId; - - char *uvname = CustomData_get_layer_name(&me->fdata, CD_MTFACE, ctexture.setIndex); - + COLLADAFW::TextureMapId texture_index = ctexture.getTextureMapId(); + char *uvname = CustomData_get_layer_name(&me->fdata, CD_MTFACE, ctexture.getSetIndex()); + if (texindex_texarray_map.find(texture_index) == texindex_texarray_map.end()) { fprintf(stderr, "Cannot find texture array by texture index.\n"); @@ -1595,7 +1593,7 @@ public: return color_texture; } - MTFace *assign_material_to_geom(COLLADAFW::InstanceGeometry::MaterialBinding cmaterial, + MTFace *assign_material_to_geom(COLLADAFW::MaterialBinding cmaterial, std::map& uid_material_map, Object *ob, const COLLADAFW::UniqueId *geom_uid, MTex **color_texture, char *layername, MTFace *texture_face, @@ -1614,7 +1612,7 @@ public: Material *ma = uid_material_map[ma_uid]; assign_material(ob, ma, ob->totcol + 1); - COLLADAFW::InstanceGeometry::TextureCoordinateBindingArray& tex_array = + COLLADAFW::TextureCoordinateBindingArray& tex_array = cmaterial.getTextureCoordinateBindingArray(); TexIndexTextureArrayMap texindex_texarray_map = material_texture_mapping_map[ma]; unsigned int i; @@ -1714,7 +1712,7 @@ public: MTFace *texture_face = NULL; MTex *color_texture = NULL; - COLLADAFW::InstanceGeometry::MaterialBindingArray& mat_array = + COLLADAFW::MaterialBindingArray& mat_array = geom->getMaterialBindings(); // loop through geom's materials @@ -3130,7 +3128,7 @@ public: ob = create_lamp_object(lamp[0], ob, sce); } else if (controller.getCount() != 0) { - COLLADAFW::InstanceController *geom = (COLLADAFW::InstanceController*)controller[0]; + COLLADAFW::InstanceGeometry *geom = (COLLADAFW::InstanceGeometry*)controller[0]; ob = mesh_importer.create_mesh_object(node, geom, true, uid_material_map, material_texture_mapping_map); } // XXX instance_node is not supported yet @@ -3284,7 +3282,6 @@ public: int i = 0; COLLADAFW::Color col; - COLLADAFW::Texture ctex; MTex *mtex = NULL; TexIndexTextureArrayMap texindex_texarray_map; @@ -3298,7 +3295,7 @@ public: } // texture else if (ef->getDiffuse().isTexture()) { - ctex = ef->getDiffuse().getTexture(); + COLLADAFW::Texture ctex = ef->getDiffuse().getTexture(); mtex = create_texture(ef, ctex, ma, i, texindex_texarray_map); if (mtex != NULL) { mtex->mapto = MAP_COL; @@ -3316,7 +3313,7 @@ public: } // texture else if (ef->getAmbient().isTexture()) { - ctex = ef->getAmbient().getTexture(); + COLLADAFW::Texture ctex = ef->getAmbient().getTexture(); mtex = create_texture(ef, ctex, ma, i, texindex_texarray_map); if (mtex != NULL) { mtex->mapto = MAP_AMB; @@ -3333,7 +3330,7 @@ public: } // texture else if (ef->getSpecular().isTexture()) { - ctex = ef->getSpecular().getTexture(); + COLLADAFW::Texture ctex = ef->getSpecular().getTexture(); mtex = create_texture(ef, ctex, ma, i, texindex_texarray_map); if (mtex != NULL) { mtex->mapto = MAP_SPEC; @@ -3350,7 +3347,7 @@ public: } // texture else if (ef->getReflective().isTexture()) { - ctex = ef->getReflective().getTexture(); + COLLADAFW::Texture ctex = ef->getReflective().getTexture(); mtex = create_texture(ef, ctex, ma, i, texindex_texarray_map); if (mtex != NULL) { mtex->mapto = MAP_REF; @@ -3365,7 +3362,7 @@ public: } // texture else if (ef->getEmission().isTexture()) { - ctex = ef->getEmission().getTexture(); + COLLADAFW::Texture ctex = ef->getEmission().getTexture(); mtex = create_texture(ef, ctex, ma, i, texindex_texarray_map); if (mtex != NULL) { mtex->mapto = MAP_EMIT; -- cgit v1.2.3