#include <dirent.h>\r
#include <cstring>\r
#include <string_view>\r
-#include "dali-scene3d/public-api/loader/dli-loader.h"\r
-#include "dali-scene3d/public-api/loader/gltf2-loader.h"\r
+#include "dali-scene3d/public-api/loader/model-loader.h"\r
#include "dali-scene3d/public-api/loader/light-parameters.h"\r
#include "dali-scene3d/public-api/loader/load-result.h"\r
#include "dali-scene3d/public-api/loader/shader-definition-factory.h"\r
}\r
}\r
\r
-Actor LoadScene(std::string sceneName, CameraActor camera, std::vector<AnimationDefinition>* animations, Animation& animation)\r
+Actor LoadScene(std::string sceneName, CameraActor camera, std::vector<Dali::Animation>& generatedAnimations, Animation& animation)\r
{\r
ResourceBundle::PathProvider pathProvider = [](ResourceType::Value type) {\r
return Application::GetResourcePath() + RESOURCE_TYPE_DIRS[type];\r
\r
auto path = pathProvider(ResourceType::Mesh) + sceneName;\r
\r
- ResourceBundle resources;\r
- SceneDefinition scene;\r
- SceneMetadata metaData;\r
- std::vector<AnimationGroupDefinition> animGroups;\r
- std::vector<CameraParameters> cameraParameters;\r
- std::vector<LightParameters> lights;\r
+ ResourceBundle resources;\r
+ SceneDefinition scene;\r
+ SceneMetadata metaData;\r
+ std::vector<Dali::Scene3D::Loader::AnimationDefinition> animations;\r
+ std::vector<AnimationGroupDefinition> animGroups;\r
+ std::vector<CameraParameters> cameraParameters;\r
+ std::vector<LightParameters> lights;\r
\r
- animations->clear();\r
+ animations.clear();\r
\r
LoadResult output{\r
resources,\r
scene,\r
metaData,\r
- *animations,\r
+ animations,\r
animGroups,\r
cameraParameters,\r
lights};\r
\r
- if(sceneName.rfind(DLI_EXTENSION) == sceneName.size() - DLI_EXTENSION.size())\r
- {\r
- DliLoader loader;\r
- DliLoader::InputParams input{\r
- pathProvider(ResourceType::Mesh),\r
- nullptr,\r
- {},\r
- {},\r
- nullptr,\r
- {}};\r
- DliLoader::LoadParams loadParams{input, output};\r
- if(!loader.LoadScene(path, loadParams))\r
- {\r
- ExceptionFlinger(ASSERT_LOCATION) << "Failed to load scene from '" << path << "': " << loader.GetParseError();\r
- }\r
- }\r
- else\r
- {\r
- ShaderDefinitionFactory sdf;\r
- sdf.SetResources(resources);\r
- LoadGltfScene(path, sdf, output);\r
-\r
- resources.mEnvironmentMaps.push_back({});\r
- }\r
+ Dali::Scene3D::Loader::ModelLoader modelLoader(path, pathProvider(ResourceType::Mesh) + "/", output);\r
+ modelLoader.LoadModel(pathProvider);\r
\r
if(cameraParameters.empty())\r
{\r
{},\r
{},\r
{}};\r
- Customization::Choices choices;\r
\r
Actor root = Actor::New();\r
SetActorCentered(root);\r
\r
+ auto& resourceChoices = modelLoader.GetResourceChoices();\r
for(auto iRoot : scene.GetRoots())\r
{\r
- auto resourceRefs = resources.CreateRefCounter();\r
- scene.CountResourceRefs(iRoot, choices, resourceRefs);\r
- resources.CountEnvironmentReferences(resourceRefs);\r
-\r
- resources.LoadResources(resourceRefs, pathProvider);\r
-\r
- if(auto actor = scene.CreateNodes(iRoot, choices, nodeParams))\r
+ if(auto actor = scene.CreateNodes(iRoot, resourceChoices, nodeParams))\r
{\r
scene.ConfigureSkeletonJoints(iRoot, resources.mSkeletons, actor);\r
scene.ConfigureSkinningShaders(resources, actor, std::move(nodeParams.mSkinnables));\r
}\r
}\r
\r
- if(!animations->empty())\r
+ generatedAnimations.clear();\r
+ if(!animations.empty())\r
{\r
+ generatedAnimations.reserve(animations.size());\r
auto getActor = [&](const Scene3D::Loader::AnimatedProperty& property)\r
{\r
Dali::Actor actor;\r
return actor;\r
};\r
\r
- animation = (*animations)[0].ReAnimate(getActor);\r
- animation.Play();\r
+ for(auto& animationDefinition : animations)\r
+ {\r
+ generatedAnimations.push_back(animationDefinition.ReAnimate(getActor));\r
+ }\r
+ generatedAnimations[0].Play();\r
}\r
\r
return root;\r
\r
auto id = mItemView.GetItemId(actor);\r
\r
- Scene3D::Loader::InitializeGltfLoader();\r
try\r
{\r
auto window = mApp.GetWindow();\r
auto renderTasks = window.GetRenderTaskList();\r
renderTasks.RemoveTask(mSceneRender);\r
\r
- auto scene = LoadScene(mSceneNames[id], mSceneCamera, &mSceneAnimations, mCurrentAnimation);\r
+ auto scene = LoadScene(mSceneNames[id], mSceneCamera, mSceneAnimations, mCurrentAnimation);\r
\r
auto sceneRender = renderTasks.CreateTask();\r
sceneRender.SetCameraActor(mSceneCamera);\r