X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Freflection-demo%2Fgltf-scene.cpp;h=a303e21d847ed90f97917414ba2fdaf9114d423b;hb=4f2d9d01598786b08a6f50d86e140d23951be2e0;hp=46e39cf5de9a98f505ea839e9f596c65c7970ec2;hpb=1d3a43d6f7d92377858f0f655c3659e7881c912a;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/reflection-demo/gltf-scene.cpp b/examples/reflection-demo/gltf-scene.cpp index 46e39cf..a303e21 100644 --- a/examples/reflection-demo/gltf-scene.cpp +++ b/examples/reflection-demo/gltf-scene.cpp @@ -14,11 +14,12 @@ * limitations under the License. * */ -#include +// HEADER #include "gltf-scene.h" -#include "pico-json.h" +// EXTERNAL INCLUDES +#include namespace { @@ -26,26 +27,22 @@ namespace const std::vector GLTF_STR_ATTRIBUTE_TYPE = { "POSITION", "NORMAL", - "TEXCOORD_0" -}; + "TEXCOORD_0"}; const std::vector> GLTF_STR_COMPONENT_TYPE = { - std::make_pair( "VEC2", 2 ), - std::make_pair( "VEC3", 3 ), - std::make_pair( "VEC4", 4 ), - std::make_pair( "SCALAR", 1 ) -}; + std::make_pair("VEC2", 2), + std::make_pair("VEC3", 3), + std::make_pair("VEC4", 4), + std::make_pair("SCALAR", 1)}; -glTFAttributeType glTFAttributeTypeStrToEnum( const std::string& name ) +glTFAttributeType glTFAttributeTypeStrToEnum(const std::string& name) { - int index = -1; - auto iter = std::find_if( GLTF_STR_ATTRIBUTE_TYPE.begin(), GLTF_STR_ATTRIBUTE_TYPE.end(), - [name, &index]( const std::string& val ) - { + int index = -1; + auto iter = std::find_if(GLTF_STR_ATTRIBUTE_TYPE.begin(), GLTF_STR_ATTRIBUTE_TYPE.end(), [name, &index](const std::string& val) { index++; return val == name; }); - if( iter == GLTF_STR_ATTRIBUTE_TYPE.end() ) + if(iter == GLTF_STR_ATTRIBUTE_TYPE.end()) { return glTFAttributeType::UNDEFINED; } @@ -53,14 +50,12 @@ glTFAttributeType glTFAttributeTypeStrToEnum( const std::string& name ) return static_cast(index); } -uint32_t glTFComponentTypeStrToNum( const std::string& name ) +uint32_t glTFComponentTypeStrToNum(const std::string& name) { - auto iter = std::find_if( GLTF_STR_COMPONENT_TYPE.begin(), GLTF_STR_COMPONENT_TYPE.end(), - [name]( const std::pair& val ) - { - return val.first == name; - }); - if( iter == GLTF_STR_COMPONENT_TYPE.end() ) + auto iter = std::find_if(GLTF_STR_COMPONENT_TYPE.begin(), GLTF_STR_COMPONENT_TYPE.end(), [name](const std::pair& val) { + return val.first == name; + }); + if(iter == GLTF_STR_COMPONENT_TYPE.end()) { return 0; } @@ -92,10 +87,9 @@ struct JsonResult }; template -JsonResult JsonFindValue( const picojson::object& object, const std::string& name ) +JsonResult JsonFindValue(const picojson::object& object, const std::string& name) { - auto iter = find_if(object.begin(), object.end(), [name](decltype(*object.begin())& item) - { + auto iter = find_if(object.begin(), object.end(), [name](decltype(*object.begin())& item) { return item.first == name; }); @@ -107,11 +101,10 @@ JsonResult JsonFindValue( const picojson::object& object, const return {true, iter->second}; }; - template -JsonResult JsonGetValue( const picojson::value& val, const std::string& name, const Converted& onFail ) +JsonResult JsonGetValue(const picojson::value& val, const std::string& name, const Converted& onFail) { - if( val.contains(name) ) + if(val.contains(name)) { return {true, static_cast(val.get(name).get())}; } @@ -119,9 +112,9 @@ JsonResult JsonGetValue( const picojson::value& val, const std::strin } template -bool JsonGetValueOut( const picojson::value& val, const std::string& name, Converted& writeOut ) +bool JsonGetValueOut(const picojson::value& val, const std::string& name, Converted& writeOut) { - if( val.contains(name) ) + if(val.contains(name)) { writeOut = static_cast(val.get(name).get()); return true; @@ -129,27 +122,26 @@ bool JsonGetValueOut( const picojson::value& val, const std::string& name, Conve return false; } - /** * Safe json value accessor */ template -JsonResult> JsonGetArray( const picojson::value& val, const std::string& name, std::vector valueOnFail = {} ) +JsonResult> JsonGetArray(const picojson::value& val, const std::string& name, std::vector valueOnFail = {}) { - if(val.contains(name) ) + if(val.contains(name)) { - const auto& array = val.get(name).get(); + const auto& array = val.get(name).get(); std::vector result{}; - for( const auto& item : array ) + for(const auto& item : array) { - result.emplace_back( static_cast(item.get()) ); + result.emplace_back(static_cast(item.get())); } return {true, result}; } return {false, valueOnFail}; } -} +} // namespace glTF::glTF(const std::string& filename) { @@ -157,17 +149,17 @@ glTF::glTF(const std::string& filename) ParseJSON(); } -void glTF::LoadFromFile( const std::string& filename ) +void glTF::LoadFromFile(const std::string& filename) { - std::string jsonFile( filename ); + std::string jsonFile(filename); jsonFile += ".gltf"; - std::string binFile( filename ); + std::string binFile(filename); binFile += ".bin"; // load binary GLTF_LOG("LoadFromFile: %s", binFile.c_str()); - mBuffer = LoadFile(binFile); + mBuffer = LoadFile(binFile); jsonBuffer = LoadFile(jsonFile); // Log errors @@ -177,7 +169,7 @@ void glTF::LoadFromFile( const std::string& filename ) } else { - GLTF_LOG( "GLTF[BIN]: %s loaded, size = %d", binFile.c_str(), int(mBuffer.size())); + GLTF_LOG("GLTF[BIN]: %s loaded, size = %d", binFile.c_str(), int(mBuffer.size())); } if(jsonBuffer.empty()) { @@ -185,7 +177,7 @@ void glTF::LoadFromFile( const std::string& filename ) } else { - GLTF_LOG( "GLTF: %s loaded, size = %d", binFile.c_str(), int(jsonBuffer.size())); + GLTF_LOG("GLTF: %s loaded, size = %d", binFile.c_str(), int(jsonBuffer.size())); } // Abort if errors @@ -198,18 +190,18 @@ void glTF::LoadFromFile( const std::string& filename ) auto err = picojson::parse(jsonNode, std::string(reinterpret_cast(jsonBuffer.data()))); if(!err.empty()) { - GLTF_LOG( "GLTF: Error parsing %s, error: %s", jsonFile.c_str(), err.c_str()); + GLTF_LOG("GLTF: Error parsing %s, error: %s", jsonFile.c_str(), err.c_str()); return; } else { - GLTF_LOG( "GLTF: %s loaded, size = %d", jsonFile.c_str(), int(jsonBuffer.size())); + GLTF_LOG("GLTF: %s loaded, size = %d", jsonFile.c_str(), int(jsonBuffer.size())); } } bool glTF::ParseJSON() { - if (!jsonNode.is()) + if(!jsonNode.is()) { return false; } @@ -218,212 +210,211 @@ bool glTF::ParseJSON() mNodes.emplace_back(); // Sources for textures to be resolved later - std::vector textureSources{}; + std::vector textureSources{}; std::vector images{}; - for( auto& val : jsonNode.get() ) + for(auto& val : jsonNode.get()) { - GLTF_LOG( "node: %s", val.first.c_str()); + GLTF_LOG("node: %s", val.first.c_str()); // Parse bufferviews - if( val.first == "bufferViews" ) + if(val.first == "bufferViews") { auto bufferViews = val.second; - for( auto& view : bufferViews.get() ) + for(auto& view : bufferViews.get()) { auto bufferIndex = uint32_t(view.get("buffer").get()); - auto byteLength = uint32_t(view.get("byteLength").get()); - auto byteOffset = uint32_t(view.get("byteOffset").get()); + auto byteLength = uint32_t(view.get("byteLength").get()); + auto byteOffset = uint32_t(view.get("byteOffset").get()); glTF_BufferView bufferView{}; bufferView.bufferIndex = bufferIndex; - bufferView.byteLength = byteLength; - bufferView.byteOffset = byteOffset; + bufferView.byteLength = byteLength; + bufferView.byteOffset = byteOffset; - mBufferViews.emplace_back( bufferView ); + mBufferViews.emplace_back(bufferView); } } // parse accessors - else if( val.first == "accessors" ) + else if(val.first == "accessors") { - for( const auto& accessor : val.second.get() ) + for(const auto& accessor : val.second.get()) { - auto gltfAccessor = glTF_Accessor{}; - gltfAccessor.bufferView = uint32_t(accessor.get( "bufferView" ).get()); - gltfAccessor.componentType = uint32_t(accessor.get( "componentType" ).get()); - gltfAccessor.count = uint32_t(accessor.get( "count" ).get()); - gltfAccessor.type = accessor.get( "type" ).get(); - gltfAccessor.componentSize = glTFComponentTypeStrToNum( gltfAccessor.type ); - mAccessors.emplace_back( gltfAccessor ); + auto gltfAccessor = glTF_Accessor{}; + gltfAccessor.bufferView = uint32_t(accessor.get("bufferView").get()); + gltfAccessor.componentType = uint32_t(accessor.get("componentType").get()); + gltfAccessor.count = uint32_t(accessor.get("count").get()); + gltfAccessor.type = accessor.get("type").get(); + gltfAccessor.componentSize = glTFComponentTypeStrToNum(gltfAccessor.type); + mAccessors.emplace_back(gltfAccessor); } } // parse meshes - else if( val.first == "meshes" ) + else if(val.first == "meshes") { - for( const auto& mesh : val.second.get() ) + for(const auto& mesh : val.second.get()) { glTF_Mesh gltfMesh{}; - gltfMesh.name = mesh.get( "name" ).get(); + gltfMesh.name = mesh.get("name").get(); // get primitives (in this implementation assuming single mesh consists of // one and only one primitive) const auto& primitive = mesh.get("primitives").get()[0]; - const auto& attrs = primitive.get("attributes").get(); - for( const auto& attr : attrs ) + const auto& attrs = primitive.get("attributes").get(); + for(const auto& attr : attrs) { - auto type = glTFAttributeTypeStrToEnum( attr.first ); + auto type = glTFAttributeTypeStrToEnum(attr.first); auto bvIndex = uint32_t(attr.second.get()); - gltfMesh.attributes.emplace_back( std::make_pair( type, bvIndex ) ); + gltfMesh.attributes.emplace_back(std::make_pair(type, bvIndex)); GLTF_LOG("GLTF: ATTR: type: %d, index: %d", int(type), int(bvIndex)); } - gltfMesh.indices = uint32_t(primitive.get("indices").get()); + gltfMesh.indices = uint32_t(primitive.get("indices").get()); gltfMesh.material = uint32_t(primitive.get("material").get()); - mMeshes.emplace_back( gltfMesh ); + mMeshes.emplace_back(gltfMesh); } } // parse cameras - else if( val.first == "cameras" ) + else if(val.first == "cameras") { glTF_Camera tgifCamera{}; - for( const auto& camera : val.second.get() ) + for(const auto& camera : val.second.get()) { - tgifCamera.name = camera.get( "name" ).to_str(); - tgifCamera.isPerspective = (camera.get( "type" ).to_str() == "perspective" ); + tgifCamera.name = camera.get("name").to_str(); + tgifCamera.isPerspective = (camera.get("type").to_str() == "perspective"); if(tgifCamera.isPerspective) { - const auto& perspective = camera.get( "perspective" ); - tgifCamera.yfov = static_cast(perspective.get( "yfov" ).get()); - tgifCamera.zfar = static_cast(perspective.get( "zfar" ).get()); - tgifCamera.znear = static_cast(perspective.get( "znear" ).get()); + const auto& perspective = camera.get("perspective"); + tgifCamera.yfov = static_cast(perspective.get("yfov").get()); + tgifCamera.zfar = static_cast(perspective.get("zfar").get()); + tgifCamera.znear = static_cast(perspective.get("znear").get()); } - mCameras.emplace_back( tgifCamera ); + mCameras.emplace_back(tgifCamera); } } // parse nodes - else if( val.first == "nodes" ) + else if(val.first == "nodes") { auto nodeIndex = 1u; - for( const auto& node : val.second.get() ) + for(const auto& node : val.second.get()) { glTF_Node gltfNode{}; - gltfNode.name = node.get( "name" ).to_str(); - auto rotation = JsonGetArray( node, "rotation", {0.0f, 0.0f, 0.0f, 1.0f} ); - auto translation = JsonGetArray( node, "translation", {0.0f, 0.0f, 0.0f} ); - auto scale = JsonGetArray( node, "scale", {1.0f, 1.0f, 1.0f} ); - std::copy( rotation.result.begin(), rotation.result.end(), gltfNode.rotationQuaternion ); - std::copy( translation.result.begin(), translation.result.end(), gltfNode.translation ); - std::copy( scale.result.begin(), scale.result.end(), gltfNode.scale ); - - auto children = JsonGetArray( node, "children" ); + gltfNode.name = node.get("name").to_str(); + auto rotation = JsonGetArray(node, "rotation", {0.0f, 0.0f, 0.0f, 1.0f}); + auto translation = JsonGetArray(node, "translation", {0.0f, 0.0f, 0.0f}); + auto scale = JsonGetArray(node, "scale", {1.0f, 1.0f, 1.0f}); + std::copy(rotation.result.begin(), rotation.result.end(), gltfNode.rotationQuaternion); + std::copy(translation.result.begin(), translation.result.end(), gltfNode.translation); + std::copy(scale.result.begin(), scale.result.end(), gltfNode.scale); + + auto children = JsonGetArray(node, "children"); if(children.success) { gltfNode.children = std::move(children.result); } - gltfNode.index = nodeIndex; + gltfNode.index = nodeIndex; gltfNode.cameraId = 0xffffffff; - gltfNode.meshId = 0xffffffff; + gltfNode.meshId = 0xffffffff; - auto cameraId = JsonGetValue( node, "camera", 0xffffffff ); - if( cameraId.success ) + auto cameraId = JsonGetValue(node, "camera", 0xffffffff); + if(cameraId.success) { gltfNode.cameraId = cameraId.result; } - auto meshId = JsonGetValue( node, "mesh", 0xffffffff ); - if( meshId.success ) + auto meshId = JsonGetValue(node, "mesh", 0xffffffff); + if(meshId.success) { gltfNode.meshId = meshId.result; } - mNodes.emplace_back( gltfNode ); + mNodes.emplace_back(gltfNode); ++nodeIndex; } - } // parse scenes, note: only first scene is being parsed - else if( val.first == "scenes" ) + else if(val.first == "scenes") { - auto& sceneNode = mNodes[0]; - const auto& scene = val.second.get()[0]; - sceneNode.name = JsonGetValue( scene, "name", std::string() ); - auto result = JsonGetArray( scene, "nodes" ); - sceneNode.children = result.result; - sceneNode.index = 0; + auto& sceneNode = mNodes[0]; + const auto& scene = val.second.get()[0]; + sceneNode.name = JsonGetValue(scene, "name", std::string()); + auto result = JsonGetArray(scene, "nodes"); + sceneNode.children = result.result; + sceneNode.index = 0; } - else if( val.first == "materials" ) + else if(val.first == "materials") { - for( const auto& node : val.second.get() ) + for(const auto& node : val.second.get()) { // Get pbr material, base color texture glTF_Material material{}; - material.doubleSided = JsonGetValue( node, "doubleSided", false ).result; - material.name = JsonGetValue( node, "name", std::string() ).result; - if( node.contains("pbrMetallicRoughness") ) + material.doubleSided = JsonGetValue(node, "doubleSided", false).result; + material.name = JsonGetValue(node, "name", std::string()).result; + if(node.contains("pbrMetallicRoughness")) { const auto& node0 = node.get("pbrMetallicRoughness"); if(node0.contains("baseColorTexture")) { - const auto& node1 = node0.get("baseColorTexture"); - auto index = uint32_t(node1.get("index").get()); - auto texCoord = uint32_t(node1.get("texCoord").get()); - material.pbrMetallicRoughness.enabled = true; - material.pbrMetallicRoughness.baseTextureColor.index = index; + const auto& node1 = node0.get("baseColorTexture"); + auto index = uint32_t(node1.get("index").get()); + auto texCoord = uint32_t(node1.get("texCoord").get()); + material.pbrMetallicRoughness.enabled = true; + material.pbrMetallicRoughness.baseTextureColor.index = index; material.pbrMetallicRoughness.baseTextureColor.texCoord = texCoord; } } - mMaterials.emplace_back( material ); + mMaterials.emplace_back(material); } } - else if( val.first == "textures" ) + else if(val.first == "textures") { - for(const auto& item : val.second.get() ) + for(const auto& item : val.second.get()) { - auto source = JsonGetValue( item, "source", 0xffffffff ); - textureSources.emplace_back( source.result ); + auto source = JsonGetValue(item, "source", 0xffffffff); + textureSources.emplace_back(source.result); } } - else if( val.first == "images" ) + else if(val.first == "images") { - for(const auto& item : val.second.get() ) + for(const auto& item : val.second.get()) { glTF_Texture tex{}; - JsonGetValueOut( item, "name", tex.name ); - JsonGetValueOut( item, "uri", tex.uri ); - images.emplace_back( tex ); + JsonGetValueOut(item, "name", tex.name); + JsonGetValueOut(item, "uri", tex.uri); + images.emplace_back(tex); } } } // Resolve cross-referencing - for( const auto& source : textureSources ) + for(const auto& source : textureSources) { - mTextures.emplace_back( images[source] ); + mTextures.emplace_back(images[source]); } return true; } -glTF_Buffer glTF::LoadFile( const std::string& filename ) +glTF_Buffer glTF::LoadFile(const std::string& filename) { - Dali::FileStream fileStream( filename.c_str(), Dali::FileStream::READ | Dali::FileStream::BINARY ); - FILE* fin = fileStream.GetFile(); + Dali::FileStream fileStream(filename.c_str(), Dali::FileStream::READ | Dali::FileStream::BINARY); + FILE* fin = fileStream.GetFile(); std::vector buffer; - if( fin ) + if(fin) { - if( fseek( fin, 0, SEEK_END ) ) + if(fseek(fin, 0, SEEK_END)) { return {}; } auto size = ftell(fin); - if( fseek( fin, 0, SEEK_SET ) ) + if(fseek(fin, 0, SEEK_SET)) { return {}; } buffer.resize(unsigned(size)); - auto result = fread( buffer.data(), 1, size_t(size), fin ); - if( result != size_t(size) ) + auto result = fread(buffer.data(), 1, size_t(size), fin); + if(result != size_t(size)) { GLTF_LOG("LoadFile: Result: %d", int(result)); // return empty buffer @@ -441,9 +432,9 @@ glTF_Buffer glTF::LoadFile( const std::string& filename ) std::vector glTF::GetMeshes() const { std::vector retval; - for( auto& mesh : mMeshes ) + for(auto& mesh : mMeshes) { - retval.emplace_back( &mesh ); + retval.emplace_back(&mesh); } return retval; } @@ -451,27 +442,27 @@ std::vector glTF::GetMeshes() const std::vector glTF::GetCameras() { std::vector cameras; - for( const auto& cam : mCameras ) + for(const auto& cam : mCameras) { - cameras.emplace_back( &cam ); + cameras.emplace_back(&cam); } return cameras; } -std::vector glTF::GetMeshAttributeBuffer( const glTF_Mesh& mesh, const std::vector& attrTypes ) +std::vector glTF::GetMeshAttributeBuffer(const glTF_Mesh& mesh, const std::vector& attrTypes) { // find buffer views struct Data { uint32_t accessorIndex{0u}; uint32_t byteStride{0u}; - char* srcPtr{ nullptr }; + char* srcPtr{nullptr}; }; std::vector data{}; - for( const auto& attrType : attrTypes ) + for(const auto& attrType : attrTypes) { - std::find_if( mesh.attributes.begin(), mesh.attributes.end(), [&data, &attrType]( const std::pair& item ){ - if( item.first == attrType ) + std::find_if(mesh.attributes.begin(), mesh.attributes.end(), [&data, &attrType](const std::pair& item) { + if(item.first == attrType) { data.emplace_back(); data.back().accessorIndex = item.second; @@ -491,32 +482,32 @@ std::vector glTF::GetMeshAttributeBuffer( const glTF_Mesh& mesh, glTF_Buffer retval{}; // data is interleaved - if( data.size() > 1 ) + if(data.size() > 1) { - auto attributeCount = mAccessors[data[0].accessorIndex].count;// / mAccessors[data[0].accessorIndex].componentSize; + auto attributeCount = mAccessors[data[0].accessorIndex].count; // / mAccessors[data[0].accessorIndex].componentSize; uint32_t attributeStride = 0; // now find buffer view stride for particular accessor - for( auto& item : data ) + for(auto& item : data) { auto& accessor = mAccessors[item.accessorIndex]; // Update byte stride for this buffer view auto& bufferView = mBufferViews[accessor.bufferView]; - item.byteStride = bufferView.byteLength / attributeCount; + item.byteStride = bufferView.byteLength / attributeCount; attributeStride += item.byteStride; item.srcPtr = reinterpret_cast(mBuffer.data()) + bufferView.byteOffset; } // now allocate final buffer and interleave data - retval.resize( attributeStride * attributeCount ); + retval.resize(attributeStride * attributeCount); auto* dstPtr = retval.data(); - for( auto i = 0u; i < attributeCount; ++i ) + for(auto i = 0u; i < attributeCount; ++i) { - for(auto& item : data ) + for(auto& item : data) { - std::copy( item.srcPtr, - item.srcPtr + item.byteStride, - reinterpret_cast(dstPtr) ); + std::copy(item.srcPtr, + item.srcPtr + item.byteStride, + reinterpret_cast(dstPtr)); dstPtr += item.byteStride; item.srcPtr += item.byteStride; } @@ -525,19 +516,17 @@ std::vector glTF::GetMeshAttributeBuffer( const glTF_Mesh& mesh, else // copy data directly as single buffer { auto& bufferView = mBufferViews[mAccessors[data[0].accessorIndex].bufferView]; - retval.resize( bufferView.byteLength ); - std::copy( mBuffer.begin() + bufferView.byteOffset, - mBuffer.begin() + bufferView.byteOffset + bufferView.byteLength, - retval.begin()); - + retval.resize(bufferView.byteLength); + std::copy(mBuffer.begin() + bufferView.byteOffset, + mBuffer.begin() + bufferView.byteOffset + bufferView.byteLength, + retval.begin()); } return retval; } - -const glTF_Mesh* glTF::FindMeshByName( const std::string& name ) const +const glTF_Mesh* glTF::FindMeshByName(const std::string& name) const { - for( const auto& mesh : mMeshes ) + for(const auto& mesh : mMeshes) { if(mesh.name == name) return &mesh; @@ -545,34 +534,32 @@ const glTF_Mesh* glTF::FindMeshByName( const std::string& name ) const return nullptr; } -uint32_t glTF::GetMeshAttributeCount( const glTF_Mesh* mesh ) const +uint32_t glTF::GetMeshAttributeCount(const glTF_Mesh* mesh) const { const auto& accessor = mAccessors[mesh->attributes[0].second]; - return accessor.count;// / accessor.componentSize; + return accessor.count; // / accessor.componentSize; } -std::vector glTF::GetMeshIndexBuffer( const glTF_Mesh* mesh ) const +std::vector glTF::GetMeshIndexBuffer(const glTF_Mesh* mesh) const { // check GL component type const auto& accessor = mAccessors[mesh->indices]; - if( accessor.componentType == 0x1403 ) // GL_UNSIGNED_SHORT + if(accessor.componentType == 0x1403) // GL_UNSIGNED_SHORT { std::vector retval{}; - retval.resize( accessor.count ); + retval.resize(accessor.count); const auto& bufferView = mBufferViews[accessor.bufferView]; - const auto* srcPtr = reinterpret_cast - (reinterpret_cast(mBuffer.data()) + bufferView.byteOffset); - std::copy( srcPtr, srcPtr + accessor.count, retval.data() ); + const auto* srcPtr = reinterpret_cast(reinterpret_cast(mBuffer.data()) + bufferView.byteOffset); + std::copy(srcPtr, srcPtr + accessor.count, retval.data()); return retval; } return {}; } -const glTF_Node* glTF::FindNodeByName( const std::string& name ) const +const glTF_Node* glTF::FindNodeByName(const std::string& name) const { - auto iter = std::find_if( mNodes.begin(), mNodes.end(), [name]( const glTF_Node& node ) - { - return !name.compare( node.name ); + auto iter = std::find_if(mNodes.begin(), mNodes.end(), [name](const glTF_Node& node) { + return !name.compare(node.name); }); if(iter == mNodes.end())