X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-scene3d%2Finternal%2Floader%2Fgltf2-util.cpp;h=219f207423208188b585cbb28cda7c0d4c3c596c;hb=469fdeab34b1f319e0d9a73a799f1a48732a0410;hp=90deac919ebeb71c45bfc60fbb3bf9f0a2f81af5;hpb=850ba75b1ce1c35fed34396e84ee4bfe7ed0ade1;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-scene3d/internal/loader/gltf2-util.cpp b/dali-scene3d/internal/loader/gltf2-util.cpp index 90deac9..219f207 100644 --- a/dali-scene3d/internal/loader/gltf2-util.cpp +++ b/dali-scene3d/internal/loader/gltf2-util.cpp @@ -281,44 +281,6 @@ const json::Reader& GetMeshPrimitiveReader() return MESH_PRIMITIVE_READER; } -const json::Reader& GetMeshExtrasReader() -{ - static const auto MESH_EXTRAS_READER = std::move(json::Reader() - .Register(*json::MakeProperty("targetNames", json::Read::Array, &gltf2::Mesh::Extras::mTargetNames))); - return MESH_EXTRAS_READER; -} - -std::vector ReadMeshExtensionsTargetsName(const json_value_s& j) -{ - auto& jsonObject = json::Cast(j); - std::vector result; - - auto element = jsonObject.start; - while(element) - { - auto jsonString = *element->name; - uint32_t index = json::Read::Number(*element->value); - - if(result.size() <= index) - { - result.resize(index + 1u); - } - - result[index] = json::Read::StringView(jsonString); - - element = element->next; - } - return result; -} - -const json::Reader& GetMeshExtensionsReader() -{ - static const auto MESH_EXTENSIONS_READER = std::move(json::Reader() - .Register(*json::MakeProperty("SXR_targets_names", ReadMeshExtensionsTargetsName, &gltf2::Mesh::Extensions::mSXRTargetsNames)) - .Register(*json::MakeProperty("avatar_shape_names", ReadMeshExtensionsTargetsName, &gltf2::Mesh::Extensions::mAvatarShapeNames))); - return MESH_EXTENSIONS_READER; -} - const json::Reader& GetMeshReader() { static const auto MESH_READER = std::move(json::Reader() @@ -326,9 +288,7 @@ const json::Reader& GetMeshReader() .Register(*json::MakeProperty("primitives", json::Read::Array::Read>, &gltf2::Mesh::mPrimitives)) - .Register(*json::MakeProperty("weights", json::Read::Array, &gltf2::Mesh::mWeights)) - .Register(*json::MakeProperty("extras", json::ObjectReader::Read, &gltf2::Mesh::mExtras)) - .Register(*json::MakeProperty("extensions", json::ObjectReader::Read, &gltf2::Mesh::mExtensions))); + .Register(*json::MakeProperty("weights", json::Read::Array, &gltf2::Mesh::mWeights))); return MESH_READER; } @@ -581,7 +541,8 @@ void AddTextureStage(uint32_t semantic, MaterialDefinition& materialDefinition, void ConvertMaterial(const gltf2::Material& material, const std::unordered_map& imageMetaData, decltype(ResourceBundle::mMaterials)& outMaterials, ConversionContext& context) { - auto getTextureMetaData = [](const std::unordered_map& metaData, const gltf2::TextureInfo& info) { + auto getTextureMetaData = [](const std::unordered_map& metaData, const gltf2::TextureInfo& info) + { if(!info.mTexture->mSource->mUri.empty()) { if(auto search = metaData.find(info.mTexture->mSource->mUri.data()); search != metaData.end()) @@ -835,7 +796,6 @@ void ConvertMeshes(const gltf2::Document& document, ConversionContext& context) { meshDefinition.mBlendShapes.reserve(primitive.mTargets.size()); meshDefinition.mBlendShapeVersion = BlendShapes::Version::VERSION_2_0; - uint32_t blendShapeIndex = 0u; for(const auto& target : primitive.mTargets) { MeshDefinition::BlendShape blendShape; @@ -862,22 +822,7 @@ void ConvertMeshes(const gltf2::Document& document, ConversionContext& context) blendShape.weight = mesh.mWeights[meshDefinition.mBlendShapes.size()]; } - // Get blendshape name from extras / SXR_targets_names / avatar_shape_names. - if(blendShapeIndex < mesh.mExtras.mTargetNames.size()) - { - blendShape.name = mesh.mExtras.mTargetNames[blendShapeIndex]; - } - else if(blendShapeIndex < mesh.mExtensions.mSXRTargetsNames.size()) - { - blendShape.name = mesh.mExtensions.mSXRTargetsNames[blendShapeIndex]; - } - else if(blendShapeIndex < mesh.mExtensions.mAvatarShapeNames.size()) - { - blendShape.name = mesh.mExtensions.mAvatarShapeNames[blendShapeIndex]; - } - meshDefinition.mBlendShapes.push_back(std::move(blendShape)); - ++blendShapeIndex; } } @@ -955,7 +900,8 @@ void ConvertNode(gltf2::Node const& node, const Index gltfIndex, Index parentInd auto& resources = output.mResources; const auto index = scene.GetNodeCount(); - auto weakNode = scene.AddNode([&]() { + auto weakNode = scene.AddNode([&]() + { std::unique_ptr nodeDefinition{new NodeDefinition()}; nodeDefinition->mParentIdx = parentIndex; @@ -1387,8 +1333,6 @@ void SetObjectReaders() json::SetObjectReader(GetMaterialExtensionsReader()); json::SetObjectReader(GetMaterialReader()); json::SetObjectReader(GetMeshPrimitiveReader()); - json::SetObjectReader(GetMeshExtrasReader()); - json::SetObjectReader(GetMeshExtensionsReader()); json::SetObjectReader(GetMeshReader()); json::SetObjectReader(GetSkinReader()); json::SetObjectReader(GetCameraPerspectiveReader());