| 44 | } |
| 45 | |
| 46 | void ColladaSerializer::ColladaExporter::ColladaGeometries::addFloatSource(const std::string& mesh_id, |
| 47 | const std::string& suffix, const std::vector<double>& floats, const char* coords /* = "XYZ" */) |
| 48 | { |
| 49 | COLLADASW::FloatSource source(mSW); |
| 50 | source.setId(mesh_id + suffix); |
| 51 | source.setArrayId(mesh_id + suffix + COLLADASW::LibraryGeometries::ARRAY_ID_SUFFIX); |
| 52 | const size_t num_elems = strlen(coords); |
| 53 | source.setAccessorStride(static_cast<unsigned long>(num_elems)); |
| 54 | source.setAccessorCount(static_cast<unsigned long>(floats.size() / num_elems)); |
| 55 | for (size_t i = 0; i < num_elems; ++i) { |
| 56 | source.getParameterNameList().push_back(std::string(1, coords[i])); |
| 57 | } |
| 58 | source.prepareToAppendValues(); |
| 59 | for (std::vector<double>::const_iterator it = floats.begin(); it != floats.end(); ++it) { |
| 60 | source.appendValues(*it); |
| 61 | } |
| 62 | source.finish(); |
| 63 | } |
| 64 | |
| 65 | void ColladaSerializer::ColladaExporter::ColladaGeometries::write( |
| 66 | const std::string &mesh_id, const std::string &/**<@todo 'default_material_name' unused, remove? */, |