From 73cd7b9c1d3e3a689712aa8ea760d3c6506dd890 Mon Sep 17 00:00:00 2001 From: Syoyo Fujita Date: Tue, 20 Jun 2017 03:02:57 +0900 Subject: [PATCH] Fix build on Visual Studio. --- appveyor.yml | 2 +- tiny_gltf_loader.h | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index e6fb52a..a8d6d8b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,4 +9,4 @@ configuration: Release build: parallel: true - project: TinyGLTFSolution.sln + project: TinyGLTF.sln diff --git a/tiny_gltf_loader.h b/tiny_gltf_loader.h index 84140cb..f3bc8c1 100644 --- a/tiny_gltf_loader.h +++ b/tiny_gltf_loader.h @@ -2064,7 +2064,10 @@ static bool ParseSkin(Skin *skin, std::string *err, const picojson::object &o) { ParseNumberProperty(&skeleton, err, o, "skeleton", false, "Skin"); skin->skeleton = static_cast(skeleton); - skin->joints = std::vector(joints.begin(), joints.end()); + skin->joints.resize(joints.size()); + for (size_t i = 0; i < joints.size(); i++) { + skin->joints[i] = static_cast(joints[i]); + } double invBind = -1.0; ParseNumberProperty(&invBind, err, o, "inverseBindMatrices", true, "Skin"); @@ -2270,7 +2273,10 @@ bool TinyGLTFLoader::LoadFromString(Model *model, std::string *err, Scene scene; ParseStringProperty(&scene.name, err, o, "name", false); - std::vector nodesIds(nodes.begin(), nodes.end()); + std::vector nodesIds; + for (size_t i = 0; i < nodes.size(); i++) { + nodesIds.push_back(static_cast(nodes[i])); + } scene.nodes = nodesIds; model->scenes.push_back(scene); @@ -2632,7 +2638,7 @@ static void SerializeValue(const std::string &key, const Value &value, picojson: static void SerializeGltfBufferData(const std::vector &data, const std::string &binFilePath) { std::ofstream output(binFilePath.c_str(), std::ofstream::binary); - output.write(reinterpret_cast(&data[0]), ssize_t(data.size())); + output.write(reinterpret_cast(&data[0]), std::streamsize(data.size())); output.close(); }