summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/scene3d-light/scene3d-light-example.cpp23
-rw-r--r--examples/scene3d/scene3d-example.cpp40
-rw-r--r--examples/scene3d/scene3d-example.h20
3 files changed, 34 insertions, 49 deletions
diff --git a/examples/scene3d-light/scene3d-light-example.cpp b/examples/scene3d-light/scene3d-light-example.cpp
index e38d146b..4be4720c 100644
--- a/examples/scene3d-light/scene3d-light-example.cpp
+++ b/examples/scene3d-light/scene3d-light-example.cpp
@@ -15,11 +15,10 @@
*
*/
+#include <dali-scene3d/dali-scene3d.h>
+#include <dali-scene3d/public-api/light/light.h>
#include <dali-toolkit/dali-toolkit.h>
-#include <dali-scene3d/public-api/controls/scene-view/scene-view.h>
-#include <dali-scene3d/public-api/controls/model/model.h>
#include <dali/devel-api/actors/actor-devel.h>
-#include <dali-scene3d/public-api/light/light.h>
#include <dali/integration-api/debug.h>
@@ -152,7 +151,7 @@ public:
sceneView.SetImageBasedLightSource("", "", 1.0f);
light1.Enable(true);
light2.Enable(true);
- light6.Enable(false); // to reset state of lights
+ light6.Enable(false); // to reset state of lights
light6.Enable(true);
light3.Enable(true);
}
@@ -194,19 +193,19 @@ public:
}
private:
- Application& mApplication;
- Scene3D::Light light1;
- Scene3D::Light light2;
- Scene3D::Light light3;
- Scene3D::Light light4;
- Scene3D::Light light5;
- Scene3D::Light light6;
+ Application& mApplication;
+ Scene3D::Light light1;
+ Scene3D::Light light2;
+ Scene3D::Light light3;
+ Scene3D::Light light4;
+ Scene3D::Light light5;
+ Scene3D::Light light6;
Scene3D::SceneView sceneView;
};
int DALI_EXPORT_API main(int argc, char** argv)
{
- Application application = Application::New(&argc, &argv);
+ Application application = Application::New(&argc, &argv);
Scene3dLightController test(application);
application.MainLoop();
return 0;
diff --git a/examples/scene3d/scene3d-example.cpp b/examples/scene3d/scene3d-example.cpp
index 430946e3..b6517278 100644
--- a/examples/scene3d/scene3d-example.cpp
+++ b/examples/scene3d/scene3d-example.cpp
@@ -15,23 +15,10 @@
*
*/
#include "scene3d-example.h"
-#include <dali-toolkit/dali-toolkit.h>
#include <dirent.h>
#include <cstring>
+#include <filesystem>
#include <string_view>
-#include "dali-scene3d/public-api/loader/model-loader.h"
-#include "dali-scene3d/public-api/loader/light-parameters.h"
-#include "dali-scene3d/public-api/loader/load-result.h"
-#include "dali-scene3d/public-api/loader/shader-definition-factory.h"
-#include "dali-toolkit/public-api/controls/scrollable/item-view/default-item-layout.h"
-#include "dali-toolkit/public-api/controls/scrollable/item-view/item-factory.h"
-#include "dali-toolkit/public-api/controls/text-controls/text-label.h"
-#include "dali-toolkit/public-api/visuals/gradient-visual-properties.h"
-#include "dali/public-api/actors/layer.h"
-#include "dali/public-api/adaptor-framework/key.h"
-#include "dali/public-api/events/key-event.h"
-#include "dali/public-api/object/property-array.h"
-#include "dali/public-api/render-tasks/render-task-list.h"
#include "scene3d-extension.h"
using namespace Dali;
@@ -59,7 +46,8 @@ const std::string RESOURCE_TYPE_DIRS[]{
using StringVector = std::vector<std::string>;
StringVector ListFiles(
- const std::string& path, bool (*predicate)(const char*) = [](const char*) { return true; })
+ const std::string& path, bool (*predicate)(const char*) = [](const char*)
+ { return true; })
{
StringVector results;
@@ -127,7 +115,8 @@ Actor CreateErrorMessage(std::string msg)
void ConfigureBlendShapeShaders(ResourceBundle& resources, const SceneDefinition& scene, Actor root, std::vector<BlendshapeShaderConfigurationRequest>&& requests)
{
std::vector<std::string> errors;
- auto onError = [&errors](const std::string& msg) {
+ auto onError = [&errors](const std::string& msg)
+ {
errors.push_back(msg);
};
if(!scene.ConfigureBlendshapeShaders(resources, root, std::move(requests), onError))
@@ -142,7 +131,8 @@ void ConfigureBlendShapeShaders(ResourceBundle& resources, const SceneDefinition
Actor LoadScene(std::string sceneName, CameraActor camera, std::vector<Dali::Animation>& generatedAnimations, Animation& animation)
{
- ResourceBundle::PathProvider pathProvider = [](ResourceType::Value type) {
+ ResourceBundle::PathProvider pathProvider = [](ResourceType::Value type)
+ {
return Application::GetResourcePath() + RESOURCE_TYPE_DIRS[type];
};
@@ -178,13 +168,19 @@ Actor LoadScene(std::string sceneName, CameraActor camera, std::vector<Dali::Ani
cameraParameters[0].ConfigureCamera(camera);
SetActorCentered(camera);
- ViewProjection viewProjection = cameraParameters[0].GetViewProjection();
- Transforms xforms{
+ std::filesystem::path modelPath(path);
+ std::string extension = modelPath.extension();
+ std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower);
+
+ Scene3D::Loader::ShaderManagerPtr shaderManager = (extension == GLTF_EXTENSION) ? new Scene3D::Loader::ShaderManager() : nullptr;
+ ViewProjection viewProjection = cameraParameters[0].GetViewProjection();
+ Transforms xforms{
MatrixStack{},
viewProjection};
NodeDefinition::CreateParams nodeParams{
resources,
xforms,
+ shaderManager,
{},
{},
{}};
@@ -267,11 +263,11 @@ void Scene3DExample::OnInit(Application& app)
// get scenes
auto resPath = Application::GetResourcePath();
auto scenePath = resPath + RESOURCE_TYPE_DIRS[ResourceType::Mesh];
- auto sceneNames = ListFiles(scenePath, [](const char* name) {
+ auto sceneNames = ListFiles(scenePath, [](const char* name)
+ {
auto len = strlen(name);
return (len > DLI_EXTENSION.size() && DLI_EXTENSION.compare(name + (len - DLI_EXTENSION.size())) == 0) ||
- (len > GLTF_EXTENSION.size() && GLTF_EXTENSION.compare(name + (len - GLTF_EXTENSION.size())) == 0);
- });
+ (len > GLTF_EXTENSION.size() && GLTF_EXTENSION.compare(name + (len - GLTF_EXTENSION.size())) == 0); });
mSceneNames = sceneNames;
// create Dali objects
diff --git a/examples/scene3d/scene3d-example.h b/examples/scene3d/scene3d-example.h
index 3f56eba1..01391049 100644
--- a/examples/scene3d/scene3d-example.h
+++ b/examples/scene3d/scene3d-example.h
@@ -17,21 +17,11 @@
*
*/
+#include <dali-scene3d/dali-scene3d.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/navigation-view/navigation-view.h>
+#include <dali/dali.h>
#include <memory>
-#include "dali-scene3d/public-api/loader/animation-definition.h"
-#include "dali-scene3d/public-api/loader/camera-parameters.h"
-#include "dali-scene3d/public-api/loader/node-definition.h"
-#include "dali-scene3d/public-api/loader/scene-definition.h"
-#include "dali-toolkit/devel-api/controls/navigation-view/navigation-view.h"
-#include "dali-toolkit/public-api/controls/scrollable/item-view/item-factory.h"
-#include "dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h"
-#include "dali-toolkit/public-api/controls/scrollable/item-view/item-view.h"
-#include "dali/public-api/actors/camera-actor.h"
-#include "dali/public-api/adaptor-framework/application.h"
-#include "dali/public-api/common/vector-wrapper.h"
-#include "dali/public-api/events/pan-gesture-detector.h"
-#include "dali/public-api/render-tasks/render-task.h"
-#include "dali/public-api/signals/connection-tracker.h"
class Scene3DExtension;
@@ -83,4 +73,4 @@ private: // methods
void OnKeyboardFocusChanged(Dali::Actor originalFocusedActor, Dali::Actor currentFocusedActor);
};
-#endif //SCENE_LAUNCHER_H_
+#endif // SCENE_LAUNCHER_H_