From cf6aefb867c26e7544b4dbdcb09488d28d1e17c9 Mon Sep 17 00:00:00 2001 From: Kimmo Hoikka Date: Thu, 9 Jul 2015 18:34:05 +0100 Subject: [PATCH] Remove de-funct dynamics support Change-Id: I9633610eb33e9952dd3f10539e7272ed19287757 --- automated-tests/src/dali-devel/CMakeLists.txt | 5 - .../src/dali-devel/utc-Dali-DynamicsBody.cpp | 604 ------------------ .../src/dali-devel/utc-Dali-DynamicsBodyConfig.cpp | 679 --------------------- .../src/dali-devel/utc-Dali-DynamicsJoint.cpp | 378 ------------ .../src/dali-devel/utc-Dali-DynamicsShape.cpp | 265 -------- .../src/dali-devel/utc-Dali-DynamicsWorld.cpp | 314 ---------- .../dali-devel/utc-Dali-DynamicsWorldConfig.cpp | 98 --- automated-tests/src/dali-internal/CMakeLists.txt | 1 - automated-tests/src/dali/CMakeLists.txt | 1 - .../dali/dali-test-suite-utils/test-dynamics.cpp | 181 ------ .../src/dali/dali-test-suite-utils/test-dynamics.h | 317 ---------- .../test-platform-abstraction.cpp | 15 +- .../test-platform-abstraction.h | 5 - automated-tests/src/dali/utc-Dali-Actor.cpp | 8 - build/tizen/dali-core/Makefile.am | 9 +- dali/devel-api/dynamics/dynamics-body-config.cpp | 322 ---------- dali/devel-api/dynamics/dynamics-body-config.h | 391 ------------ dali/devel-api/dynamics/dynamics-body.cpp | 172 ------ dali/devel-api/dynamics/dynamics-body.h | 204 ------- dali/devel-api/dynamics/dynamics-collision.cpp | 117 ---- dali/devel-api/dynamics/dynamics-collision.h | 128 ---- dali/devel-api/dynamics/dynamics-joint.cpp | 133 ---- dali/devel-api/dynamics/dynamics-joint.h | 214 ------- dali/devel-api/dynamics/dynamics-shape.cpp | 128 ---- dali/devel-api/dynamics/dynamics-shape.h | 150 ----- dali/devel-api/dynamics/dynamics-world-config.cpp | 116 ---- dali/devel-api/dynamics/dynamics-world-config.h | 155 ----- dali/devel-api/dynamics/dynamics-world.cpp | 157 ----- dali/devel-api/dynamics/dynamics-world.h | 245 -------- dali/devel-api/dynamics/dynamics.h | 29 - dali/devel-api/file.list | 17 - dali/integration-api/core.h | 13 +- dali/integration-api/debug.cpp | 1 - dali/integration-api/debug.h | 1 - dali/integration-api/dynamics/dynamics-body-intf.h | 131 ---- .../dynamics/dynamics-body-settings.h | 140 ----- .../dynamics/dynamics-collision-data.h | 94 --- .../dynamics/dynamics-debug-vertex.h | 44 -- .../dynamics/dynamics-factory-intf.h | 88 --- .../integration-api/dynamics/dynamics-joint-intf.h | 94 --- .../integration-api/dynamics/dynamics-shape-intf.h | 61 -- .../integration-api/dynamics/dynamics-world-intf.h | 104 ---- .../dynamics/dynamics-world-settings.h | 101 --- dali/integration-api/file.list | 11 - dali/integration-api/platform-abstraction.h | 8 - dali/internal/event/actors/actor-impl.cpp | 433 ------------- dali/internal/event/actors/actor-impl.h | 97 +-- .../internal/event/common/thread-local-storage.cpp | 22 - dali/internal/event/common/thread-local-storage.h | 16 +- .../event/dynamics/dynamics-body-config-impl.cpp | 269 -------- .../event/dynamics/dynamics-body-config-impl.h | 194 ------ .../internal/event/dynamics/dynamics-body-impl.cpp | 261 -------- dali/internal/event/dynamics/dynamics-body-impl.h | 193 ------ .../event/dynamics/dynamics-capsule-shape-impl.cpp | 62 -- .../event/dynamics/dynamics-capsule-shape-impl.h | 70 --- .../event/dynamics/dynamics-collision-impl.cpp | 104 ---- .../event/dynamics/dynamics-collision-impl.h | 149 ----- .../event/dynamics/dynamics-collision-notifier.h | 90 --- .../event/dynamics/dynamics-cone-shape-impl.cpp | 62 -- .../event/dynamics/dynamics-cone-shape-impl.h | 69 --- .../event/dynamics/dynamics-cube-shape-impl.cpp | 62 -- .../event/dynamics/dynamics-cube-shape-impl.h | 69 --- .../dynamics/dynamics-cylinder-shape-impl.cpp | 62 -- .../event/dynamics/dynamics-cylinder-shape-impl.h | 69 --- .../event/dynamics/dynamics-declarations.h | 87 --- .../event/dynamics/dynamics-joint-impl.cpp | 336 ---------- dali/internal/event/dynamics/dynamics-joint-impl.h | 165 ----- dali/internal/event/dynamics/dynamics-notifier.h | 98 --- .../event/dynamics/dynamics-shape-impl.cpp | 56 -- dali/internal/event/dynamics/dynamics-shape-impl.h | 112 ---- .../event/dynamics/dynamics-slider-joint-impl.cpp | 137 ----- .../event/dynamics/dynamics-slider-joint-impl.h | 105 ---- .../event/dynamics/dynamics-sphere-shape-impl.cpp | 61 -- .../event/dynamics/dynamics-sphere-shape-impl.h | 69 --- .../dynamics/dynamics-universal-joint-impl.cpp | 156 ----- .../event/dynamics/dynamics-universal-joint-impl.h | 106 ---- .../event/dynamics/dynamics-world-config-impl.cpp | 104 ---- .../event/dynamics/dynamics-world-config-impl.h | 117 ---- .../event/dynamics/dynamics-world-impl.cpp | 384 ------------ dali/internal/event/dynamics/dynamics-world-impl.h | 251 -------- dali/internal/file.list | 23 - .../update/dynamics/scene-graph-dynamics-body.cpp | 327 ---------- .../update/dynamics/scene-graph-dynamics-body.h | 371 ----------- .../scene-graph-dynamics-capsule-shape.cpp | 63 -- .../dynamics/scene-graph-dynamics-capsule-shape.h | 88 --- .../dynamics/scene-graph-dynamics-collision-data.h | 98 --- .../dynamics/scene-graph-dynamics-cone-shape.cpp | 66 -- .../dynamics/scene-graph-dynamics-cone-shape.h | 87 --- .../dynamics/scene-graph-dynamics-cube-shape.cpp | 64 -- .../dynamics/scene-graph-dynamics-cube-shape.h | 88 --- .../scene-graph-dynamics-cylinder-shape.cpp | 64 -- .../dynamics/scene-graph-dynamics-cylinder-shape.h | 87 --- .../update/dynamics/scene-graph-dynamics-joint.cpp | 250 -------- .../update/dynamics/scene-graph-dynamics-joint.h | 254 -------- .../dynamics/scene-graph-dynamics-motion-state.cpp | 90 --- .../dynamics/scene-graph-dynamics-motion-state.h | 73 --- .../update/dynamics/scene-graph-dynamics-shape.cpp | 72 --- .../update/dynamics/scene-graph-dynamics-shape.h | 100 --- .../dynamics/scene-graph-dynamics-sphere-shape.cpp | 63 -- .../dynamics/scene-graph-dynamics-sphere-shape.h | 86 --- .../update/dynamics/scene-graph-dynamics-world.cpp | 416 ------------- .../update/dynamics/scene-graph-dynamics-world.h | 231 ------- dali/internal/update/manager/update-manager.cpp | 49 +- dali/internal/update/manager/update-manager.h | 48 -- 104 files changed, 15 insertions(+), 14289 deletions(-) delete mode 100644 automated-tests/src/dali-devel/utc-Dali-DynamicsBody.cpp delete mode 100644 automated-tests/src/dali-devel/utc-Dali-DynamicsBodyConfig.cpp delete mode 100644 automated-tests/src/dali-devel/utc-Dali-DynamicsJoint.cpp delete mode 100644 automated-tests/src/dali-devel/utc-Dali-DynamicsShape.cpp delete mode 100644 automated-tests/src/dali-devel/utc-Dali-DynamicsWorld.cpp delete mode 100644 automated-tests/src/dali-devel/utc-Dali-DynamicsWorldConfig.cpp delete mode 100644 automated-tests/src/dali/dali-test-suite-utils/test-dynamics.cpp delete mode 100644 automated-tests/src/dali/dali-test-suite-utils/test-dynamics.h delete mode 100644 dali/devel-api/dynamics/dynamics-body-config.cpp delete mode 100644 dali/devel-api/dynamics/dynamics-body-config.h delete mode 100644 dali/devel-api/dynamics/dynamics-body.cpp delete mode 100644 dali/devel-api/dynamics/dynamics-body.h delete mode 100644 dali/devel-api/dynamics/dynamics-collision.cpp delete mode 100644 dali/devel-api/dynamics/dynamics-collision.h delete mode 100644 dali/devel-api/dynamics/dynamics-joint.cpp delete mode 100644 dali/devel-api/dynamics/dynamics-joint.h delete mode 100644 dali/devel-api/dynamics/dynamics-shape.cpp delete mode 100644 dali/devel-api/dynamics/dynamics-shape.h delete mode 100644 dali/devel-api/dynamics/dynamics-world-config.cpp delete mode 100644 dali/devel-api/dynamics/dynamics-world-config.h delete mode 100644 dali/devel-api/dynamics/dynamics-world.cpp delete mode 100644 dali/devel-api/dynamics/dynamics-world.h delete mode 100644 dali/devel-api/dynamics/dynamics.h delete mode 100644 dali/integration-api/dynamics/dynamics-body-intf.h delete mode 100644 dali/integration-api/dynamics/dynamics-body-settings.h delete mode 100644 dali/integration-api/dynamics/dynamics-collision-data.h delete mode 100644 dali/integration-api/dynamics/dynamics-debug-vertex.h delete mode 100644 dali/integration-api/dynamics/dynamics-factory-intf.h delete mode 100644 dali/integration-api/dynamics/dynamics-joint-intf.h delete mode 100644 dali/integration-api/dynamics/dynamics-shape-intf.h delete mode 100644 dali/integration-api/dynamics/dynamics-world-intf.h delete mode 100644 dali/integration-api/dynamics/dynamics-world-settings.h delete mode 100644 dali/internal/event/dynamics/dynamics-body-config-impl.cpp delete mode 100644 dali/internal/event/dynamics/dynamics-body-config-impl.h delete mode 100644 dali/internal/event/dynamics/dynamics-body-impl.cpp delete mode 100644 dali/internal/event/dynamics/dynamics-body-impl.h delete mode 100644 dali/internal/event/dynamics/dynamics-capsule-shape-impl.cpp delete mode 100644 dali/internal/event/dynamics/dynamics-capsule-shape-impl.h delete mode 100644 dali/internal/event/dynamics/dynamics-collision-impl.cpp delete mode 100644 dali/internal/event/dynamics/dynamics-collision-impl.h delete mode 100644 dali/internal/event/dynamics/dynamics-collision-notifier.h delete mode 100644 dali/internal/event/dynamics/dynamics-cone-shape-impl.cpp delete mode 100644 dali/internal/event/dynamics/dynamics-cone-shape-impl.h delete mode 100644 dali/internal/event/dynamics/dynamics-cube-shape-impl.cpp delete mode 100644 dali/internal/event/dynamics/dynamics-cube-shape-impl.h delete mode 100644 dali/internal/event/dynamics/dynamics-cylinder-shape-impl.cpp delete mode 100644 dali/internal/event/dynamics/dynamics-cylinder-shape-impl.h delete mode 100644 dali/internal/event/dynamics/dynamics-declarations.h delete mode 100644 dali/internal/event/dynamics/dynamics-joint-impl.cpp delete mode 100644 dali/internal/event/dynamics/dynamics-joint-impl.h delete mode 100644 dali/internal/event/dynamics/dynamics-notifier.h delete mode 100644 dali/internal/event/dynamics/dynamics-shape-impl.cpp delete mode 100644 dali/internal/event/dynamics/dynamics-shape-impl.h delete mode 100644 dali/internal/event/dynamics/dynamics-slider-joint-impl.cpp delete mode 100644 dali/internal/event/dynamics/dynamics-slider-joint-impl.h delete mode 100644 dali/internal/event/dynamics/dynamics-sphere-shape-impl.cpp delete mode 100644 dali/internal/event/dynamics/dynamics-sphere-shape-impl.h delete mode 100644 dali/internal/event/dynamics/dynamics-universal-joint-impl.cpp delete mode 100644 dali/internal/event/dynamics/dynamics-universal-joint-impl.h delete mode 100644 dali/internal/event/dynamics/dynamics-world-config-impl.cpp delete mode 100644 dali/internal/event/dynamics/dynamics-world-config-impl.h delete mode 100644 dali/internal/event/dynamics/dynamics-world-impl.cpp delete mode 100644 dali/internal/event/dynamics/dynamics-world-impl.h delete mode 100644 dali/internal/update/dynamics/scene-graph-dynamics-body.cpp delete mode 100644 dali/internal/update/dynamics/scene-graph-dynamics-body.h delete mode 100644 dali/internal/update/dynamics/scene-graph-dynamics-capsule-shape.cpp delete mode 100644 dali/internal/update/dynamics/scene-graph-dynamics-capsule-shape.h delete mode 100644 dali/internal/update/dynamics/scene-graph-dynamics-collision-data.h delete mode 100644 dali/internal/update/dynamics/scene-graph-dynamics-cone-shape.cpp delete mode 100644 dali/internal/update/dynamics/scene-graph-dynamics-cone-shape.h delete mode 100644 dali/internal/update/dynamics/scene-graph-dynamics-cube-shape.cpp delete mode 100644 dali/internal/update/dynamics/scene-graph-dynamics-cube-shape.h delete mode 100644 dali/internal/update/dynamics/scene-graph-dynamics-cylinder-shape.cpp delete mode 100644 dali/internal/update/dynamics/scene-graph-dynamics-cylinder-shape.h delete mode 100644 dali/internal/update/dynamics/scene-graph-dynamics-joint.cpp delete mode 100644 dali/internal/update/dynamics/scene-graph-dynamics-joint.h delete mode 100644 dali/internal/update/dynamics/scene-graph-dynamics-motion-state.cpp delete mode 100644 dali/internal/update/dynamics/scene-graph-dynamics-motion-state.h delete mode 100644 dali/internal/update/dynamics/scene-graph-dynamics-shape.cpp delete mode 100644 dali/internal/update/dynamics/scene-graph-dynamics-shape.h delete mode 100644 dali/internal/update/dynamics/scene-graph-dynamics-sphere-shape.cpp delete mode 100644 dali/internal/update/dynamics/scene-graph-dynamics-sphere-shape.h delete mode 100644 dali/internal/update/dynamics/scene-graph-dynamics-world.cpp delete mode 100644 dali/internal/update/dynamics/scene-graph-dynamics-world.h diff --git a/automated-tests/src/dali-devel/CMakeLists.txt b/automated-tests/src/dali-devel/CMakeLists.txt index 17d283f..44e1966 100644 --- a/automated-tests/src/dali-devel/CMakeLists.txt +++ b/automated-tests/src/dali-devel/CMakeLists.txt @@ -10,10 +10,6 @@ SET(TC_SOURCES utc-Dali-Context.cpp utc-Dali-Constrainer.cpp utc-Dali-DistanceField.cpp - utc-Dali-DynamicsBodyConfig.cpp - utc-Dali-DynamicsShape.cpp - utc-Dali-DynamicsWorld.cpp - utc-Dali-DynamicsWorldConfig.cpp utc-Dali-Geometry.cpp utc-Dali-Hash.cpp utc-Dali-HitTestAlgorithm.cpp @@ -31,7 +27,6 @@ LIST(APPEND TC_SOURCES ../dali/dali-test-suite-utils/dali-test-suite-utils.cpp ../dali/dali-test-suite-utils/test-harness.cpp ../dali/dali-test-suite-utils/test-application.cpp - ../dali/dali-test-suite-utils/test-dynamics.cpp ../dali/dali-test-suite-utils/test-gesture-manager.cpp ../dali/dali-test-suite-utils/test-gl-abstraction.cpp ../dali/dali-test-suite-utils/test-gl-sync-abstraction.cpp diff --git a/automated-tests/src/dali-devel/utc-Dali-DynamicsBody.cpp b/automated-tests/src/dali-devel/utc-Dali-DynamicsBody.cpp deleted file mode 100644 index df7ac1c..0000000 --- a/automated-tests/src/dali-devel/utc-Dali-DynamicsBody.cpp +++ /dev/null @@ -1,604 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include -#include -#include -#include - -int UtcDaliDynamicsBodyConstructor(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - tet_infoline("UtcDaliDynamicsBodyConstructor - DynamicsBody::DynamicsBody()"); - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - // Default constructor - create an uninitialized handle - DynamicsBody body; - DALI_TEST_CHECK( !body ); - - // create world and actor - DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); - DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig bodyConfig(DynamicsBodyConfig::New()); - Actor actor(Actor::New()); - - // enable dynamics on the actor to create the Dynamicsbody - actor.EnableDynamics(bodyConfig); - - // initialize handle - body = actor.GetDynamicsBody(); - - DALI_TEST_CHECK( body ); - END_TEST; -} - -int UtcDaliDynamicsBodyGetMass(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - const float testMass = 1.23f; - - DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); - DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig bodyConfig(DynamicsBodyConfig::New()); - bodyConfig.SetMass(testMass); - Actor actor(Actor::New()); - - // enable dynamics on the actor to create the Dynamicsbody - actor.EnableDynamics(bodyConfig); - - tet_infoline("UtcDaliDynamicsBodyGetMass - DynamicsBody::GetMass"); - DALI_TEST_EQUALS( testMass, actor.GetDynamicsBody().GetMass(), Math::MACHINE_EPSILON_0, TEST_LOCATION ); - - END_TEST; -} - -int UtcDaliDynamicsBodyGetElasticity(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - const float testElasticity = 1.23f; - - DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); - DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig bodyConfig(DynamicsBodyConfig::New()); - bodyConfig.SetElasticity(testElasticity); - Actor actor(Actor::New()); - - // enable dynamics on the actor to create the Dynamicsbody - actor.EnableDynamics(bodyConfig); - - tet_infoline("UtcDaliDynamicsBodyGetMass - DynamicsBody::GetElasticity"); - DALI_TEST_EQUALS( testElasticity, actor.GetDynamicsBody().GetElasticity(), Math::MACHINE_EPSILON_0, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliDynamicsBodySetLinearVelocity(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - tet_infoline("UtcDaliDynamicsBodySetLinearVelocity - DynamicsBody::SetLinearVelocity"); - - TestApplication application; - TraceCallStack& trace( application.GetPlatform().GetTrace() ); - trace.Enable( true ); - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); - DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig bodyConfig(DynamicsBodyConfig::New()); - Actor actor(Actor::New()); - - // enable dynamics on the actor to create the Dynamicsbody - actor.EnableDynamics(bodyConfig); - - DynamicsBody body(actor.GetDynamicsBody()); - body.SetLinearVelocity(Vector3::ONE); - - DALI_TEST_CHECK( ! trace.FindMethod( "DynamicsBody::SetLinearVelocity" ) ); - - // update - application.SendNotification(); - application.Render(); - application.Render(); - - DALI_TEST_CHECK( trace.FindMethod( "DynamicsBody::SetLinearVelocity" ) ); - END_TEST; -} - -int UtcDaliDynamicsBodySetAngularVelocity(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - tet_infoline("UtcDaliDynamicsBodySetAngularVelocity - DynamicsBody::SetAngularVelocity"); - - TestApplication application; - TraceCallStack& trace( application.GetPlatform().GetTrace() ); - trace.Enable( true ); - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); - DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig bodyConfig(DynamicsBodyConfig::New()); - Actor actor(Actor::New()); - - // enable dynamics on the actor to create the Dynamicsbody - actor.EnableDynamics(bodyConfig); - - DynamicsBody body(actor.GetDynamicsBody()); - body.SetAngularVelocity(Vector3::ONE); - - DALI_TEST_CHECK( ! trace.FindMethod( "DynamicsBody::SetAngularVelocity" ) ); - - // update - application.SendNotification(); - application.Render(); - application.Render(); - - DALI_TEST_CHECK( trace.FindMethod( "DynamicsBody::SetAngularVelocity" ) ); - END_TEST; -} - -int UtcDaliDynamicsBodySetKinematic(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - const float testMass = 1.0f; - DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); - DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig bodyConfig(DynamicsBodyConfig::New()); - bodyConfig.SetMass(testMass); - Actor actor(Actor::New()); - - // enable dynamics on the actor to create the Dynamicsbody - actor.EnableDynamics(bodyConfig); - - DynamicsBody body(actor.GetDynamicsBody()); - - DALI_TEST_EQUALS( testMass, body.GetMass(), Math::MACHINE_EPSILON_0, TEST_LOCATION ); - - tet_infoline("UtcDaliDynamicsBodySetKinematic - DynamicsBody::SetKinematic(true)"); - body.SetKinematic(true); - - DALI_TEST_CHECK( body.IsKinematic() ); - DALI_TEST_EQUALS( 0.0f, body.GetMass(), Math::MACHINE_EPSILON_0, TEST_LOCATION ); - - tet_infoline("UtcDaliDynamicsBodySetKinematic - DynamicsBody::SetKinematic(false)"); - body.SetKinematic(false); - DALI_TEST_CHECK( !body.IsKinematic() ); - DALI_TEST_EQUALS( testMass, body.GetMass(), Math::MACHINE_EPSILON_0, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliDynamicsBodyIsKinematic(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - const float testMass = 1.0f; - DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); - DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig bodyConfig(DynamicsBodyConfig::New()); - bodyConfig.SetMass(testMass); - Actor actor(Actor::New()); - - // enable dynamics on the actor to create the Dynamicsbody - actor.EnableDynamics(bodyConfig); - - DynamicsBody body(actor.GetDynamicsBody()); - - DALI_TEST_EQUALS( testMass, body.GetMass(), Math::MACHINE_EPSILON_0, TEST_LOCATION ); - - tet_infoline("UtcDaliDynamicsBodySetKinematic - DynamicsBody::IsSetKinematic"); - body.SetKinematic(true); - - DALI_TEST_CHECK( body.IsKinematic() ); - body.SetKinematic(false); - DALI_TEST_CHECK( !body.IsKinematic() ); - END_TEST; -} - -int UtcDaliDynamicsBodySetSleepEnabled(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - tet_infoline("UtcDaliDynamicsBodySetSleepEnabled"); - - TestApplication application; - TraceCallStack& trace( application.GetPlatform().GetTrace() ); - trace.Enable( true ); - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); - DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig bodyConfig(DynamicsBodyConfig::New()); - Actor actor(Actor::New()); - - // enable dynamics on the actor to create the Dynamicsbody - actor.EnableDynamics(bodyConfig); - - DynamicsBody body(actor.GetDynamicsBody()); - - // SleepEnabled true by default - DALI_TEST_CHECK( body.GetSleepEnabled() ); - body.SetSleepEnabled(false); - - DALI_TEST_CHECK( ! trace.FindMethod( "DynamicsBody::SetSleepEnabled" ) ); - - // update - application.SendNotification(); - application.Render(); - application.Render(); - - DALI_TEST_CHECK( trace.FindMethod( "DynamicsBody::SetSleepEnabled" ) ); - - DALI_TEST_CHECK( ! body.GetSleepEnabled() ); - END_TEST; -} - -int UtcDaliDynamicsBodyGetSleepEnabled(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - tet_infoline("UtcDaliDynamicsBodyGetSleepEnabled"); - - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); - DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig bodyConfig(DynamicsBodyConfig::New()); - Actor actor(Actor::New()); - - // enable dynamics on the actor to create the Dynamicsbody - actor.EnableDynamics(bodyConfig); - - DynamicsBody body(actor.GetDynamicsBody()); - - // SleepEnabled true by default - DALI_TEST_CHECK( body.GetSleepEnabled() ); - body.SetSleepEnabled(false); - DALI_TEST_CHECK( !body.GetSleepEnabled() ); - END_TEST; -} - -int UtcDaliDynamicsBodyWakeUp(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - tet_infoline("UtcDaliDynamicsBodyWakeUp"); - - TestApplication application; - TraceCallStack& trace( application.GetPlatform().GetTrace() ); - trace.Enable( true ); - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); - DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig bodyConfig(DynamicsBodyConfig::New()); - Actor actor(Actor::New()); - - // enable dynamics on the actor to create the Dynamicsbody - actor.EnableDynamics(bodyConfig); - - DynamicsBody body(actor.GetDynamicsBody()); - - body.WakeUp(); - - DALI_TEST_CHECK( ! trace.FindMethod( "DynamicsBody::WakeUp" ) ); - - // update - application.SendNotification(); - application.Render(); - application.Render(); - - DALI_TEST_CHECK( trace.FindMethod( "DynamicsBody::WakeUp" ) ); - END_TEST; -} - -int UtcDaliDynamicsBodyAddAnchor(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - tet_infoline("UtcDaliDynamicsBodyAddAnchor - DynamicsBody::AddAnchor()"); - - TestApplication application; - - DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); - worldConfig.SetType(DynamicsWorldConfig::SOFT); - DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - Actor rootActor(Actor::New()); - world.SetRootActor(rootActor); - Stage::GetCurrent().Add(rootActor); - - DynamicsBodyConfig softConfig( DynamicsBodyConfig::New() ); - softConfig.SetType(DynamicsBodyConfig::SOFT); - DynamicsShape meshShape(DynamicsShape::NewSphere(1.f)); - softConfig.SetShape( meshShape ); - softConfig.SetMass(1.0f); - MeshActor softActor(MeshActor::New(mesh)); - - rootActor.Add(softActor); - softActor.EnableDynamics(softConfig); - DynamicsBody softBody(softActor.GetDynamicsBody()); - - DynamicsBodyConfig anchorConfig(DynamicsBodyConfig::New()); - anchorConfig.SetMass(0.0f); - Actor anchor(Actor::New()); - rootActor.Add(anchor); - anchor.EnableDynamics(anchorConfig); - DynamicsBody anchorBody(anchor.GetDynamicsBody()); - anchorBody.SetKinematic(true); - try - { - softBody.AddAnchor(0, anchorBody, false); - - DALI_TEST_CHECK(true) - } - catch(Dali::DaliException& e) - { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_CHECK( false ); - } - - rootActor.Remove(softActor); - rootActor.Remove(anchor); - Stage::GetCurrent().Remove(rootActor); - softActor.DisableDynamics(); - anchor.DisableDynamics(); - END_TEST; -} - -int UtcDaliDynamicsBodyConserveVolume(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - tet_infoline("UtcDaliDynamicsBodyConserveVolume"); - - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); - DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig bodyConfig(DynamicsBodyConfig::New()); - Actor actor(Actor::New()); - - // enable dynamics on the actor to create the Dynamicsbody - actor.EnableDynamics(bodyConfig); - - DynamicsBody body(actor.GetDynamicsBody()); - - body.ConserveVolume(false); - DALI_TEST_CHECK( true ); - END_TEST; -} - -int UtcDaliDynamicsBodyConserveShape(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - tet_infoline("UtcDaliDynamicsBodyConserveShape"); - - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); - DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig bodyConfig(DynamicsBodyConfig::New()); - Actor actor(Actor::New()); - - // enable dynamics on the actor to create the Dynamicsbody - actor.EnableDynamics(bodyConfig); - - DynamicsBody body(actor.GetDynamicsBody()); - - body.ConserveShape(false); - DALI_TEST_CHECK( true ); - END_TEST; -} diff --git a/automated-tests/src/dali-devel/utc-Dali-DynamicsBodyConfig.cpp b/automated-tests/src/dali-devel/utc-Dali-DynamicsBodyConfig.cpp deleted file mode 100644 index ecf45a4..0000000 --- a/automated-tests/src/dali-devel/utc-Dali-DynamicsBodyConfig.cpp +++ /dev/null @@ -1,679 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include - -#include -#include -#include -#include - -using namespace Dali; - - -int UtcDaliDynamicsBodyConfigNew(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - - tet_infoline("UtcDaliDynamicsBodyConfigNew - DynamicsBodyConfig::New()"); - - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig config(DynamicsBodyConfig::New()); - - DALI_TEST_CHECK( config ); - END_TEST; -} - -int UtcDaliDynamicsBodyConfigConstructor(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - tet_infoline("UtcDaliDynamicsBodyConfigConstructor - DynamicsBodyConfig::DynamicsBodyConfig()"); - - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - // Default constructor - create an uninitialized handle - DynamicsBodyConfig config; - - DALI_TEST_CHECK( !config ); - - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - // initialize handle - config = DynamicsBodyConfig::New(); - - DALI_TEST_CHECK( config ); - END_TEST; -} - -int UtcDaliDynamicsBodyConfigType(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig config(DynamicsBodyConfig::New()); - - tet_infoline("UtcDaliDynamicsBodyConfigType - DynamicsBodyConfig::GetType"); - DALI_TEST_CHECK( DynamicsBodyConfig::RIGID == config.GetType() ); - - tet_infoline("UtcDaliDynamicsBodyConfigType - DynamicsBodyConfig::SetType(const BodyType)"); - config.SetType( DynamicsBodyConfig::SOFT ); - DALI_TEST_CHECK( DynamicsBodyConfig::SOFT == config.GetType() ); - END_TEST; -} - -int UtcDaliDynamicsBodyConfigSetShape01(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - tet_infoline("UtcDaliDynamicsBodyConfigSetShape01 - DynamicsBodyConfig::SetShape(const DynamicsShape::ShapeType,const Vector3&)"); - - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig config(DynamicsBodyConfig::New()); - - DALI_TEST_CHECK( DynamicsShape::CUBE == config.GetShape().GetType() ); - - const float radius(1.5f); - config.SetShape(DynamicsShape::SPHERE, Vector3(radius, 0.0f, 0.0f)); - - DALI_TEST_CHECK( DynamicsShape::SPHERE == config.GetShape().GetType() ); - END_TEST; -} - -int UtcDaliDynamicsBodyConfigSetShape02(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - tet_infoline("UtcDaliDynamicsBodyConfigSetShape02 - DynamicsBodyConfig::SetShape(DynamicsShape)"); - - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig config(DynamicsBodyConfig::New()); - - DALI_TEST_CHECK( DynamicsShape::CUBE == config.GetShape().GetType() ); - - const float radius(1.5f); - DynamicsShape shape(DynamicsShape::NewSphere(radius)); - config.SetShape(shape); - - DALI_TEST_CHECK( DynamicsShape::SPHERE == config.GetShape().GetType() ); - END_TEST; -} - -int UtcDaliDynamicsBodyConfigGetShape(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - tet_infoline("UtcDaliDynamicsBodyConfigGetShape - DynamicsBodyConfig::GetShape"); - - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig config(DynamicsBodyConfig::New()); - - DALI_TEST_CHECK( DynamicsShape::CUBE == config.GetShape().GetType() ); - END_TEST; -} - -int UtcDaliDynamicsBodyConfigMass(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - const float testMass = 1.23f; - - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig config(DynamicsBodyConfig::New()); - config.SetMass(testMass); - - tet_infoline("UtcDaliDynamicsBodyConfigMass - DynamicsBodyConfig::GetMass"); - DALI_TEST_EQUALS( testMass, config.GetMass(), Math::MACHINE_EPSILON_0, TEST_LOCATION ); - - tet_infoline("UtcDaliDynamicsBodyConfigMass - DynamicsBodyConfig::SetMass"); - const float mass = config.GetMass() + 0.1f; - config.SetMass(mass); - DALI_TEST_EQUALS( mass, config.GetMass(), Math::MACHINE_EPSILON_0, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliDynamicsBodyConfigElasticity(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - const float testElasticity = 0.87f; - - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig config(DynamicsBodyConfig::New()); - config.SetElasticity(testElasticity); - - tet_infoline("UtcDaliDynamicsBodyConfigElasticity- DynamicsBodyConfig::GetElasticity"); - DALI_TEST_EQUALS( testElasticity, config.GetElasticity(), Math::MACHINE_EPSILON_0, TEST_LOCATION ); - - tet_infoline("UtcDaliDynamicsBodyConfigElasticity - DynamicsBodyConfig::SetElasticity"); - const float elasticity = config.GetElasticity() + 0.1f; - config.SetElasticity(elasticity); - DALI_TEST_EQUALS( elasticity, config.GetElasticity(), Math::MACHINE_EPSILON_0, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliDynamicsBodyConfigFriction(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - const float testFriction= 0.87f; - - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig config(DynamicsBodyConfig::New()); - config.SetFriction(testFriction); - - tet_infoline("UtcDaliDynamicsBodyConfigFriction - DynamicsBodyConfig::GetFriction"); - DALI_TEST_EQUALS( testFriction, config.GetFriction(), Math::MACHINE_EPSILON_0, TEST_LOCATION ); - - tet_infoline("UtcDaliDynamicsBodyConfigFriction - DynamicsBodyConfig::SetFriction"); - const float friction = config.GetFriction() + 0.1f; - config.SetFriction(friction); - DALI_TEST_EQUALS( friction, config.GetFriction(), Math::MACHINE_EPSILON_0, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliDynamicsBodyConfigLinearDamping(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - const float testDamping = 0.123f; - - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig config(DynamicsBodyConfig::New()); - config.SetLinearDamping(testDamping); - - tet_infoline("UtcDaliDynamicsBodyConfigLinearDamping- DynamicsBodyConfig::GetLinearDamping"); - DALI_TEST_EQUALS( testDamping, config.GetLinearDamping(), Math::MACHINE_EPSILON_0, TEST_LOCATION ); - - tet_infoline("UtcDaliDynamicsBodyConfigLinearDamping - DynamicsBodyConfig::SetLinearDamping"); - const float damping = config.GetLinearDamping() + 0.1f; - config.SetLinearDamping(damping); - DALI_TEST_EQUALS( damping, config.GetLinearDamping(), Math::MACHINE_EPSILON_0, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliDynamicsBodyConfigAngularDamping(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - const float testDamping = 0.123f; - - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig config(DynamicsBodyConfig::New()); - config.SetAngularDamping(testDamping); - - tet_infoline("UtcDaliDynamicsBodyConfigAngularDamping- DynamicsBodyConfig::GetAngularDamping"); - DALI_TEST_EQUALS( testDamping, config.GetAngularDamping(), Math::MACHINE_EPSILON_0, TEST_LOCATION ); - - tet_infoline("UtcDaliDynamicsBodyConfigAngularDamping - DynamicsBodyConfig::SetAngularDamping"); - const float damping = config.GetAngularDamping() + 0.1f; - config.SetAngularDamping(damping); - DALI_TEST_EQUALS( damping, config.GetAngularDamping(), Math::MACHINE_EPSILON_0, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliDynamicsBodyConfigLinearSleepVelocity(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - const float testSleepVelocity = 0.123f; - - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig config(DynamicsBodyConfig::New()); - config.SetLinearSleepVelocity(testSleepVelocity); - - tet_infoline("UtcDaliDynamicsBodyConfigLinearSleepVelocity - DynamicsBodyConfig::GetLinearSleepVelocity"); - DALI_TEST_EQUALS( testSleepVelocity, config.GetLinearSleepVelocity(), Math::MACHINE_EPSILON_0, TEST_LOCATION ); - - tet_infoline("UtcDaliDynamicsBodyConfigLinearSleepVelocity - DynamicsBodyConfig::SetLinearSleepVelocity"); - const float sleepVelocity = config.GetLinearSleepVelocity() + 0.1f; - config.SetLinearSleepVelocity(sleepVelocity); - DALI_TEST_EQUALS( sleepVelocity, config.GetLinearSleepVelocity(), Math::MACHINE_EPSILON_0, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliDynamicsBodyConfigAngularSleepVelocity(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - const float testSleepVelocity = 0.123f; - - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig config(DynamicsBodyConfig::New()); - config.SetAngularSleepVelocity(testSleepVelocity); - - tet_infoline("UtcDaliDynamicsBodyConfigAngularSleepVelocity - DynamicsBodyConfig::GetAngularSleepVelocity"); - DALI_TEST_EQUALS( testSleepVelocity, config.GetAngularSleepVelocity(), Math::MACHINE_EPSILON_0, TEST_LOCATION ); - - tet_infoline("UtcDaliDynamicsBodyConfigAngularSleepVelocity - DynamicsBodyConfig::SetAngularSleepVelocity"); - const float sleepVelocity = config.GetAngularSleepVelocity() + 0.1f; - config.SetAngularSleepVelocity(sleepVelocity); - DALI_TEST_EQUALS( sleepVelocity, config.GetAngularSleepVelocity(), Math::MACHINE_EPSILON_0, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliDynamicsBodyConfigCollisionGroup(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - const short int testGroup = 0x1234; - - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig config(DynamicsBodyConfig::New()); - config.SetCollisionGroup(testGroup); - - tet_infoline("UtcDaliDynamicsBodyConfigCollisionGroup- DynamicsBodyConfig::GetCollisionGroup"); - DALI_TEST_EQUALS( testGroup, config.GetCollisionGroup(), TEST_LOCATION ); - - tet_infoline("UtcDaliDynamicsBodyConfigCollisionGroup - DynamicsBodyConfig::SetCollisionGroup"); - const short int group = config.GetCollisionGroup() + 1; - config.SetCollisionGroup(group); - DALI_TEST_EQUALS( group, config.GetCollisionGroup(), TEST_LOCATION ); - END_TEST; -} - -int UtcDaliDynamicsBodyConfigCollisionMask(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - const short int testMask = 0x7ffe; - - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig config(DynamicsBodyConfig::New()); - config.SetCollisionMask(testMask); - - tet_infoline("UtcDaliDynamicsBodyConfigCollisionMask- DynamicsBodyConfig::GetCollisionMask"); - DALI_TEST_EQUALS( testMask, config.GetCollisionMask(), TEST_LOCATION ); - - tet_infoline("UtcDaliDynamicsBodyConfigCollisionMask - DynamicsBodyConfig::SetCollisionMask"); - const short int mask = config.GetCollisionMask() + 1; - config.SetCollisionMask(mask); - DALI_TEST_EQUALS( mask, config.GetCollisionMask(), TEST_LOCATION ); - END_TEST; -} - -int UtcDaliDynamicsBodyConfigAnchorHardness(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - const float testHardness = 0.87f; - - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig config(DynamicsBodyConfig::New()); - config.SetAnchorHardness(testHardness); - - tet_infoline("UtcDaliDynamicsBodyConfigAnchorHardness - DynamicsBodyConfig::GetAnchorHardness"); - DALI_TEST_EQUALS( testHardness, config.GetAnchorHardness(), Math::MACHINE_EPSILON_0, TEST_LOCATION ); - - tet_infoline("UtcDaliDynamicsBodyConfigAnchorHardness - DynamicsBodyConfig::SetAnchorHardness"); - const float hardness = config.GetAnchorHardness() + 0.1f; - config.SetAnchorHardness(hardness); - DALI_TEST_EQUALS( hardness, config.GetAnchorHardness(), Math::MACHINE_EPSILON_1, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliDynamicsBodyConfigVolumeConservation(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - tet_infoline("UtcDaliDynamicsBodyConfigVolumeConservation"); - - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig config(DynamicsBodyConfig::New()); - - const float conservation = config.GetVolumeConservation() + 0.1f; - config.SetVolumeConservation(conservation); - DALI_TEST_EQUALS( conservation, config.GetVolumeConservation(), Math::MACHINE_EPSILON_1, TEST_LOCATION ); - END_TEST; -} - -int UtcDaliDynamicsBodyConfigShapeConservation(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - tet_infoline("UtcDaliDynamicsBodyConfigShapeConservation"); - - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig config(DynamicsBodyConfig::New()); - - const float conservation = config.GetShapeConservation() + 0.1f; - config.SetShapeConservation(conservation); - DALI_TEST_EQUALS( conservation, config.GetShapeConservation(), Math::MACHINE_EPSILON_1, TEST_LOCATION ); - END_TEST; -} diff --git a/automated-tests/src/dali-devel/utc-Dali-DynamicsJoint.cpp b/automated-tests/src/dali-devel/utc-Dali-DynamicsJoint.cpp deleted file mode 100644 index 88f4eb4..0000000 --- a/automated-tests/src/dali-devel/utc-Dali-DynamicsJoint.cpp +++ /dev/null @@ -1,378 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include -#include -#include -#include - -using namespace Dali; - - -int UtcDaliDynamicsJointConstructor(void) -{ - tet_infoline("UtcDaliDynamicsJointConstructor - DynamicsJoint::DynamicsJoint"); - - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsJoint joint; - - DALI_TEST_CHECK( !joint ); - END_TEST; -} - -int UtcDaliDynamicsJointLinearLimit(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); - DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); - - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig bodyConfig(DynamicsBodyConfig::New()); - Actor actor1(Actor::New()); - actor1.EnableDynamics(bodyConfig); - Actor actor2(Actor::New()); - actor2.EnableDynamics(bodyConfig); - - DynamicsJoint joint( actor1.AddDynamicsJoint(actor2, Vector3() ) ); - - if( joint ) - { - tet_infoline("UtcDaliDynamicsJointLinearLimit - DynamicsJoint::SetLinearLimit()"); - joint.SetLinearLimit(DynamicsJoint::LINEAR_X, 0.0f, 1.0f); - } - DALI_TEST_CHECK( true ); - END_TEST; -} - -int UtcDaliDynamicsJointAngularLimit(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); - DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig bodyConfig(DynamicsBodyConfig::New()); - Actor actor1(Actor::New()); - actor1.EnableDynamics(bodyConfig); - Actor actor2(Actor::New()); - actor2.EnableDynamics(bodyConfig); - - DynamicsJoint joint( actor1.AddDynamicsJoint(actor2, Vector3() ) ); - - tet_infoline("UtcDaliDynamicsJointAngularLimit - DynamicsJoint::SetAngularLimit()"); - joint.SetAngularLimit(DynamicsJoint::ANGULAR_X, Degree(0.0f), Degree(1.0f) ); - DALI_TEST_CHECK( true ); - END_TEST; -} - -int UtcDaliDynamicsJointEnableSpring(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); - DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig bodyConfig(DynamicsBodyConfig::New()); - Actor actor1(Actor::New()); - actor1.EnableDynamics(bodyConfig); - Actor actor2(Actor::New()); - actor2.EnableDynamics(bodyConfig); - - DynamicsJoint joint( actor1.AddDynamicsJoint(actor2, Vector3() ) ); - - tet_infoline("UtcDaliDynamicsJointEnableSpring"); - joint.EnableSpring(DynamicsJoint::LINEAR_X, true ); - DALI_TEST_CHECK( true ); - END_TEST; -} - -int UtcDaliDynamicsJointSetSpringStiffness(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); - DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig bodyConfig(DynamicsBodyConfig::New()); - Actor actor1(Actor::New()); - actor1.EnableDynamics(bodyConfig); - Actor actor2(Actor::New()); - actor2.EnableDynamics(bodyConfig); - - DynamicsJoint joint( actor1.AddDynamicsJoint(actor2, Vector3() ) ); - - tet_infoline("UtcDaliDynamicsJointSetSpringStiffness"); - joint.SetSpringStiffness(DynamicsJoint::LINEAR_X, 1.0f ); - DALI_TEST_CHECK( true ); - END_TEST; -} - -int UtcDaliDynamicsJointSetSpringCenterPoint(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); - DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig bodyConfig(DynamicsBodyConfig::New()); - Actor actor1(Actor::New()); - actor1.EnableDynamics(bodyConfig); - Actor actor2(Actor::New()); - actor2.EnableDynamics(bodyConfig); - - DynamicsJoint joint( actor1.AddDynamicsJoint(actor2, Vector3() ) ); - - tet_infoline("UtcDaliDynamicsJointSetSpringCenterPoint"); - joint.SetSpringCenterPoint(DynamicsJoint::LINEAR_X, 0.5f ); - DALI_TEST_CHECK( true ); - END_TEST; -} - -int UtcDaliDynamicsJointEnableMotor(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); - DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig bodyConfig(DynamicsBodyConfig::New()); - Actor actor1(Actor::New()); - actor1.EnableDynamics(bodyConfig); - Actor actor2(Actor::New()); - actor2.EnableDynamics(bodyConfig); - - DynamicsJoint joint( actor1.AddDynamicsJoint(actor2, Vector3() ) ); - - tet_infoline("UtcDaliDynamicsJointEnableMotor"); - joint.EnableMotor(DynamicsJoint::LINEAR_X, true ); - DALI_TEST_CHECK( true ); - END_TEST; -} - -int UtcDaliDynamicsJointSetMotorVelocity(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); - DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig bodyConfig(DynamicsBodyConfig::New()); - Actor actor1(Actor::New()); - actor1.EnableDynamics(bodyConfig); - Actor actor2(Actor::New()); - actor2.EnableDynamics(bodyConfig); - - DynamicsJoint joint( actor1.AddDynamicsJoint(actor2, Vector3() ) ); - - tet_infoline("UtcDaliDynamicsJointSetMotorVelocity"); - joint.SetMotorVelocity(DynamicsJoint::LINEAR_X, 1.0f ); - DALI_TEST_CHECK( true ); - END_TEST; -} - -int UtcDaliDynamicsJointSetMotorForce(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); - DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig bodyConfig(DynamicsBodyConfig::New()); - Actor actor1(Actor::New()); - actor1.EnableDynamics(bodyConfig); - Actor actor2(Actor::New()); - actor2.EnableDynamics(bodyConfig); - - DynamicsJoint joint( actor1.AddDynamicsJoint(actor2, Vector3() ) ); - - tet_infoline("UtcDaliDynamicsJointSetMotorForce"); - joint.SetMotorForce(DynamicsJoint::LINEAR_X, 0.5f ); - DALI_TEST_CHECK( true ); - END_TEST; -} - -int UtcDaliDynamicsJointGetActor(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig(DynamicsWorldConfig::New()); - DynamicsWorld world( Stage::GetCurrent().InitializeDynamics(worldConfig) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - DynamicsBodyConfig bodyConfig(DynamicsBodyConfig::New()); - Actor actor1(Actor::New()); - actor1.EnableDynamics(bodyConfig); - Actor actor2(Actor::New()); - actor2.EnableDynamics(bodyConfig); - - DynamicsJoint joint( actor1.AddDynamicsJoint(actor2, Vector3() ) ); - - tet_infoline("UtcDaliDynamicsJointGetActor"); - DALI_TEST_CHECK( joint.GetActor(true) == actor1 && joint.GetActor(false) == actor2 ); - END_TEST; -} diff --git a/automated-tests/src/dali-devel/utc-Dali-DynamicsShape.cpp b/automated-tests/src/dali-devel/utc-Dali-DynamicsShape.cpp deleted file mode 100644 index a3364dd..0000000 --- a/automated-tests/src/dali-devel/utc-Dali-DynamicsShape.cpp +++ /dev/null @@ -1,265 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include -#include -#include -#include - -using namespace Dali; - - -int UtcDaliDynamicsShapeConstructor(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - tet_infoline("UtcDaliDynamicsShapeConstructor - DynamicsShape::DynamicsShape"); - - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( world ) - { - - // Default constructor - create an uninitialized handle - DynamicsShape shape; - DALI_TEST_CHECK( !shape ); - - // initialize handle - shape = DynamicsShape::NewCube(Vector3::ONE); - - DALI_TEST_CHECK( shape ); - } - else - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - } - - END_TEST; -} - -int UtcDaliDynamicsShapeNewCapsule(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - tet_infoline("UtcDaliDynamicsShapeNewCapsule - DynamicsShape::NewCapsule"); - - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( world ) - { - - DynamicsShape shape( DynamicsShape::NewCapsule( 1.0f, 2.0f ) ); - - DALI_TEST_CHECK( shape ); - DALI_TEST_CHECK( DynamicsShape::CAPSULE == shape.GetType() ); - } - else - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - } - - END_TEST; -} - -int UtcDaliDynamicsShapeNewCone(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - tet_infoline("UtcDaliDynamicsShapeNewCone - DynamicsShape::NewCone"); - - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( world ) - { - DynamicsShape shape( DynamicsShape::NewCone( 1.0f, 2.0f ) ); - - DALI_TEST_CHECK( shape ); - DALI_TEST_CHECK( DynamicsShape::CONE == shape.GetType() ); - } - else - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - } - - END_TEST; -} - -int UtcDaliDynamicsShapeNewCube(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - tet_infoline("UtcDaliDynamicsShapeNewCube - DynamicsShape::NewCube"); - - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( world ) - { - DynamicsShape shape( DynamicsShape::NewCube( Vector3::ONE ) ); - - DALI_TEST_CHECK( shape ); - DALI_TEST_CHECK( DynamicsShape::CUBE == shape.GetType() ); - } - else - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - } - END_TEST; -} - -int UtcDaliDynamicsShapeNewCylinder(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - tet_infoline("UtcDaliDynamicsShapeNewCylinder - DynamicsShape::NewCylinder"); - - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( world ) - { - DynamicsShape shape( DynamicsShape::NewCylinder( 1.0f, 2.0f ) ); - - DALI_TEST_CHECK( shape ); - DALI_TEST_CHECK( DynamicsShape::CYLINDER == shape.GetType() ); - } - else - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - } - END_TEST; -} - -int UtcDaliDynamicsShapeNewSphere(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - tet_infoline("UtcDaliDynamicsShapeNewSphere - DynamicsShape::NewSphere"); - - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( world ) - { - DynamicsShape shape( DynamicsShape::NewSphere( 1.0f ) ); - - DALI_TEST_CHECK( shape ); - DALI_TEST_CHECK( DynamicsShape::SPHERE == shape.GetType() ); - } - else - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - } - END_TEST; -} - -int UtcDaliDynamicsShapeGetType(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - tet_infoline("UtcDaliDynamicsShapeGetType - DynamicsShape::GetType"); - - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( world ) - { - DynamicsShape shape( DynamicsShape::NewSphere( 1.0f ) ); - - DALI_TEST_CHECK( shape ); - DALI_TEST_CHECK( DynamicsShape::SPHERE == shape.GetType() ); - } - else - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - } - END_TEST; -} diff --git a/automated-tests/src/dali-devel/utc-Dali-DynamicsWorld.cpp b/automated-tests/src/dali-devel/utc-Dali-DynamicsWorld.cpp deleted file mode 100644 index 2219975..0000000 --- a/automated-tests/src/dali-devel/utc-Dali-DynamicsWorld.cpp +++ /dev/null @@ -1,314 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include -#include -#include -#include -#include - -using namespace Dali; - -// Note: dali-core needs to be configured and built with --enable-dynamics for these tests to run. - -int UtcDaliDynamicsWorldConstructor(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - tet_infoline("UtcDaliDynamicsWorldConstructor - DynamicsWorld::DynamicsWorld"); - - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - // Default constructor - create an uninitialized handle - DynamicsWorld world; - DALI_TEST_CHECK( !world ); - - // initialize handle - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - world = DynamicsWorld::GetInstance( worldConfig ); - - DALI_TEST_CHECK( world ); - END_TEST; -} - -int UtcDaliDynamicsWorldGetInstanceP(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline( "No dynamics support compiled\n" ); - return 0; -#endif - TestApplication app; - Stage stage = Stage::GetCurrent(); - TraceCallStack& trace = app.GetPlatform().GetTrace(); - trace.Enable(true); - - DynamicsWorldConfig config = DynamicsWorldConfig::New(); - - bool asserted = false; - try - { - DALI_TEST_CHECK( DynamicsWorld::GetInstance( config ) ); - } - catch( Dali::DaliException& e ) - { - DALI_TEST_PRINT_ASSERT( e ); - asserted = true; - } - DALI_TEST_CHECK( !asserted ); - - DALI_TEST_CHECK( trace.FindMethod( "GetDynamicsFactory" ) ); - DALI_TEST_CHECK( trace.FindMethod( "DynamicsFactory::InitializeDynamics" ) ); - - END_TEST; -} - -int UtcDaliDynamicsWorldGetInstanceN(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline( "No dynamics support compiled\n" ); - return 0; -#endif - TestApplication app; - - DynamicsWorldConfig config; - - // Check that creating a DynamicsWorld instance without a valid config causes an assert. - bool asserted = false; - try - { - DynamicsWorld::GetInstance( config ); - } - catch( Dali::DaliException& e ) - { - DALI_TEST_PRINT_ASSERT( e ); - DALI_TEST_ASSERT( e, "object && \"DynamicsWorldConfig object is uninitialized!\"", TEST_LOCATION ); - asserted = true; - } - DALI_TEST_CHECK( asserted ); - - END_TEST; -} - -int UtcDaliDynamicsWorldGetP(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline( "No dynamics support compiled\n" ); - return 0; -#endif - TestApplication app; - - DynamicsWorldConfig config = DynamicsWorldConfig::New(); - - bool asserted = false; - try - { - DynamicsWorld::GetInstance( config ); - DynamicsWorld world = DynamicsWorld::Get(); - DALI_TEST_CHECK( world ); - } - catch( Dali::DaliException& e ) - { - DALI_TEST_PRINT_ASSERT( e ); - asserted = true; - } - DALI_TEST_CHECK( !asserted ); - - END_TEST; -} - -// No Negative check for UtcDaliDynamicsWorldGet as the instance is created on Get(). - -int UtcDaliDynamicsWorldDestroyInstanceP(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline( "No dynamics support compiled\n" ); - return 0; -#endif - TestApplication app; - - DynamicsWorldConfig config = DynamicsWorldConfig::New(); - DynamicsWorld world = DynamicsWorld::GetInstance( config ); - DALI_TEST_CHECK( world ); - - bool asserted = false; - try - { - DynamicsWorld::DestroyInstance(); - } - catch( Dali::DaliException& e ) - { - DALI_TEST_PRINT_ASSERT( e ); - asserted = true; - } - DALI_TEST_CHECK( !asserted ); - - END_TEST; -} - -int UtcDaliDynamicsWorldDestroyInstanceN(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline( "No dynamics support compiled\n" ); - return 0; -#endif - TestApplication app; - - // Check that calling DestroyInstance() when there is no instance is safe. - bool asserted = false; - try - { - DynamicsWorld::DestroyInstance(); - } - catch( Dali::DaliException& e ) - { - DALI_TEST_PRINT_ASSERT( e ); - asserted = true; - } - DALI_TEST_CHECK( !asserted ); - - END_TEST; -} - -int UtcDaliDynamicsWorldGravity(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - TraceCallStack& trace( application.GetPlatform().GetTrace() ); - trace.Enable( true ); - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - const Vector3 gravity(1.0f, 2.0f, 3.0f); - - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - tet_infoline("UtcDaliDynamicsWorldGravity - DynamicsWorld::SetGravity"); - world.SetGravity(gravity); - - // update - application.SendNotification(); - application.Render(); - application.Render(); - - DALI_TEST_CHECK( trace.FindMethod( "DynamicsWorld::SetGravity" ) ); - - tet_infoline("UtcDaliDynamicsWorldGravity - DynamicsWorld::GetGravity"); - DALI_TEST_EQUALS(gravity, world.GetGravity(), TEST_LOCATION); - END_TEST; -} - -int UtcDaliDynamicsWorldDebugDrawMode(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - TraceCallStack& trace( application.GetPlatform().GetTrace() ); - trace.Enable( true ); - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - const Vector3 gravity(1.0f, 2.0f, 3.0f); - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - const int mode(DynamicsWorld::DEBUG_MODE_WIREFRAME | DynamicsWorld::DEBUG_MODE_AABB); - - tet_infoline("UtcDaliDynamicsWorldDebugDrawMode - DynamicsWorld::SetDebugDrawMode"); - world.SetDebugDrawMode(mode); - - // update - application.SendNotification(); - application.Render(); - application.Render(); - - DALI_TEST_CHECK( trace.FindMethod( "DynamicsWorld::SetDebugDrawMode" ) ); - DALI_TEST_CHECK( trace.FindMethod( "DynamicsWorld::SetGravity" ) ); - - tet_infoline("UtcDaliDynamicsWorldDebugDrawMode - DynamicsWorld::GetDebugDrawMode"); - DALI_TEST_CHECK(mode == world.GetDebugDrawMode()); - END_TEST; -} - -int UtcDaliDynamicsWorldRootActor(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - const Vector3 gravity(1.0f, 2.0f, 3.0f); - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - DynamicsWorld world( DynamicsWorld::GetInstance( worldConfig ) ); - - if( !world ) - { - // cannot create dynamics world, log failure and exit - DALI_TEST_CHECK( false ); - END_TEST; - } - - Actor rootActor(Actor::New()); - - tet_infoline("UtcDaliDynamicsWorldDebugDrawMode - DynamicsWorld::GetRootActor"); - Actor actor(world.GetRootActor()); - DALI_TEST_CHECK( !actor ); - - tet_infoline("UtcDaliDynamicsWorldSetRootActor - DynamicsWorld::SetRootActor"); - world.SetRootActor(rootActor); - DALI_TEST_CHECK(rootActor == world.GetRootActor()); - END_TEST; -} diff --git a/automated-tests/src/dali-devel/utc-Dali-DynamicsWorldConfig.cpp b/automated-tests/src/dali-devel/utc-Dali-DynamicsWorldConfig.cpp deleted file mode 100644 index 16af634..0000000 --- a/automated-tests/src/dali-devel/utc-Dali-DynamicsWorldConfig.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include -#include -#include -#include - -using namespace Dali; - - -int UtcDaliDynamicsWorldConfigConstructor(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - tet_infoline("UtcDaliDynamicsWorldConfigConstructor - DynamicsWorldConfig::DynamicsWorldConfig"); - - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - // Default constructor - create an uninitialized handle - DynamicsWorldConfig worldConfig; - DALI_TEST_CHECK( !worldConfig ); - - // initialize handle - worldConfig = DynamicsWorldConfig::New(); - - DALI_TEST_CHECK( worldConfig ); - END_TEST; -} - -int UtcDaliDynamicsWorldConfigNew(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - tet_infoline("UtcDaliDynamicsWorldConfigNew - DynamicsWorldConfig::New"); - - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - // Default constructor - create an uninitialized handle - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - - DALI_TEST_CHECK( worldConfig ); - END_TEST; -} - -int UtcDaliDynamicsWorldConfigType(void) -{ -#if !defined(DALI_DYNAMICS_SUPPORT) - tet_infoline("No dynamics support compiled\n"); - return 0; -#endif - TestApplication application; - - // start up - application.SendNotification(); - application.Render(); - application.Render(); - - // Default constructor - create an uninitialized handle - DynamicsWorldConfig worldConfig( DynamicsWorldConfig::New() ); - - tet_infoline("UtcDaliDynamicsWorldConfigNew - DynamicsWorldConfig::GetType"); - DALI_TEST_CHECK(DynamicsWorldConfig::RIGID == worldConfig.GetType()); - - tet_infoline("UtcDaliDynamicsWorldConfigNew - DynamicsWorldConfig::SetType"); - worldConfig.SetType(DynamicsWorldConfig::SOFT); - DALI_TEST_CHECK(DynamicsWorldConfig::SOFT == worldConfig.GetType()); - END_TEST; -} diff --git a/automated-tests/src/dali-internal/CMakeLists.txt b/automated-tests/src/dali-internal/CMakeLists.txt index 97bb589..8678b55 100644 --- a/automated-tests/src/dali-internal/CMakeLists.txt +++ b/automated-tests/src/dali-internal/CMakeLists.txt @@ -20,7 +20,6 @@ LIST(APPEND TC_SOURCES ../dali/dali-test-suite-utils/test-harness.cpp ../dali/dali-test-suite-utils/dali-test-suite-utils.cpp ../dali/dali-test-suite-utils/test-application.cpp - ../dali/dali-test-suite-utils/test-dynamics.cpp ../dali/dali-test-suite-utils/test-gesture-manager.cpp ../dali/dali-test-suite-utils/test-gl-abstraction.cpp ../dali/dali-test-suite-utils/test-gl-sync-abstraction.cpp diff --git a/automated-tests/src/dali/CMakeLists.txt b/automated-tests/src/dali/CMakeLists.txt index 0ec26c8..a508a2b 100644 --- a/automated-tests/src/dali/CMakeLists.txt +++ b/automated-tests/src/dali/CMakeLists.txt @@ -82,7 +82,6 @@ LIST(APPEND TC_SOURCES dali-test-suite-utils/dali-test-suite-utils.cpp dali-test-suite-utils/test-harness.cpp dali-test-suite-utils/test-application.cpp - dali-test-suite-utils/test-dynamics.cpp dali-test-suite-utils/test-gesture-manager.cpp dali-test-suite-utils/test-gl-abstraction.cpp dali-test-suite-utils/test-gl-sync-abstraction.cpp diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-dynamics.cpp b/automated-tests/src/dali/dali-test-suite-utils/test-dynamics.cpp deleted file mode 100644 index a7ed945..0000000 --- a/automated-tests/src/dali/dali-test-suite-utils/test-dynamics.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "test-dynamics.h" - -using namespace Dali; - -namespace Dali -{ - - -TestDynamicsJoint::TestDynamicsJoint( TraceCallStack& trace ) -: mTrace( trace ) -{ - mTrace.PushCall( "DynamicsJoint::DynamicsJoint", "" ); -} - -TestDynamicsJoint::~TestDynamicsJoint() -{ - mTrace.PushCall( "DynamicsJoint::~DynamicsJoint", "" ); -} - -void TestDynamicsJoint::Initialize( - Integration::DynamicsBody* bodyA, const Vector3& positionA, const Quaternion& rotationA, const Vector3& offsetA, - Integration::DynamicsBody* bodyB, const Vector3& positionB, const Quaternion& rotationB, const Vector3& offsetB ) -{ - mTrace.PushCall( "DynamicsJoint::Initialize", "" ); -} - -void TestDynamicsJoint::SetLimit( const int axisIndex, const float lowerLimit, const float upperLimit ) -{ - mTrace.PushCall( "DynamicsJoint::SetLimit", "" ); -} - -void TestDynamicsJoint::EnableSpring( int axisIndex, bool flag ) -{ - mTrace.PushCall( "DynamicsJoint::EnableSpring", "" ); -} - -void TestDynamicsJoint::SetSpringStiffness( int axisIndex, float stiffness ) -{ - mTrace.PushCall( "DynamicsJoint::SetSpringStiffness", "" ); -} - -void TestDynamicsJoint::SetSpringDamping( int axisIndex, float damping ) -{ - mTrace.PushCall( "DynamicsJoint::SetSpringDamping", "" ); -} - -void TestDynamicsJoint::SetSpringCenterPoint( int axisIndex, float ratio ) -{ - mTrace.PushCall( "DynamicsJoint::SetSpringCenterPoint", "" ); -} - -void TestDynamicsJoint::EnableMotor( int axisIndex, bool flag ) -{ - mTrace.PushCall( "DynamicsJoint::EnableMotor", "" ); -} - -void TestDynamicsJoint::SetMotorVelocity( int axisIndex, float velocity ) -{ - mTrace.PushCall( "DynamicsJoint::SetMotorVelocity", "" ); -} - -void TestDynamicsJoint::SetMotorForce( int axisIndex, float force ) -{ - mTrace.PushCall( "DynamicsJoint::SetMotorForce", "" ); -} - - -TestDynamicsShape::TestDynamicsShape( TraceCallStack& trace ) -: mTrace( trace ) -{ - mTrace.PushCall( "DynamicsShape::DynamicsShape", "" ); -} - -TestDynamicsShape::~TestDynamicsShape() -{ - mTrace.PushCall( "DynamicsShape::~DynamicsShape", "" ); -} - -void TestDynamicsShape::Initialize( int type, const Vector3& dimensions ) -{ - mTrace.PushCall( "DynamicsShape::Initialize", "" ); -} - -void TestDynamicsShape::Initialize( int type, Geometry geometry ) -{ - mTrace.PushCall( "DynamicsShape::Initialize", "" ); -} - -TestDynamicsBody::TestDynamicsBody( TraceCallStack& trace ) -: mSettings( NULL ), - mConserveVolume( false ), - mConserveShape( false ), - mKinematic( false ), - mActivationState( true ), - mCollisionGroup( 0 ), - mCollisionMask( 0 ), - mTrace( trace ) -{ - mTrace.PushCall( "DynamicsBody::DynamicsBody", "" ); -} - -TestDynamicsBody::~TestDynamicsBody() -{ - mTrace.PushCall( "DynamicsBody::~DynamicsBody", "" ); -} - -TestDynamicsWorld::TestDynamicsWorld( TraceCallStack& trace ) -: mSettings( NULL ), - mTrace( trace ) -{ - mTrace.PushCall( "DynamicsWorld::DynamicsWorld", "" ); -} - -TestDynamicsWorld::~TestDynamicsWorld() -{ - mTrace.PushCall( "DynamicsWorld::~DynamicsWorld", "" ); -} - - -TestDynamicsFactory::TestDynamicsFactory( TraceCallStack& trace ) : mTrace( trace ) -{ -} - -TestDynamicsFactory::~TestDynamicsFactory() -{ -} - -bool TestDynamicsFactory::InitializeDynamics( const Integration::DynamicsWorldSettings& worldSettings ) -{ - mTrace.PushCall( "DynamicsFactory::InitializeDynamics", "" ); - return true; -} - -void TestDynamicsFactory::TerminateDynamics() -{ - mTrace.PushCall( "DynamicsFactory::InitializeDynamics", "" ); -} - -Integration::DynamicsWorld* TestDynamicsFactory::CreateDynamicsWorld() -{ - mTrace.PushCall( "DynamicsFactory::CreateDynamicsWorld", "" ); - return new TestDynamicsWorld( mTrace ); -} - -Integration::DynamicsBody* TestDynamicsFactory::CreateDynamicsBody() -{ - mTrace.PushCall( "DynamicsFactory::CreateDynamicsBody", "" ); - return new TestDynamicsBody( mTrace ); -} - -Integration::DynamicsJoint* TestDynamicsFactory::CreateDynamicsJoint() -{ - mTrace.PushCall( "DynamicsFactory::CreateDynamicsJoint", "" ); - return new TestDynamicsJoint( mTrace ); -} - -Integration::DynamicsShape* TestDynamicsFactory::CreateDynamicsShape() -{ - mTrace.PushCall( "DynamicsFactory::CreateDynamicsShape", "" ); - return new TestDynamicsShape( mTrace ); -} - - -} //namespace Dali diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-dynamics.h b/automated-tests/src/dali/dali-test-suite-utils/test-dynamics.h deleted file mode 100644 index 8731ea9..0000000 --- a/automated-tests/src/dali/dali-test-suite-utils/test-dynamics.h +++ /dev/null @@ -1,317 +0,0 @@ -#ifndef __TEST_DYNAMICS_H__ -#define __TEST_DYNAMICS_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace Dali -{ - -class TestDynamicsJoint : public Integration::DynamicsJoint -{ -public: - TestDynamicsJoint( TraceCallStack& trace ); - virtual ~TestDynamicsJoint(); - -public: // From Dali::Integration::DynamicsJoint - - void Initialize( Integration::DynamicsBody* bodyA, const Vector3& positionA, const Quaternion& rotationA, const Vector3& offsetA, - Integration::DynamicsBody* bodyB, const Vector3& positionB, const Quaternion& rotationB, const Vector3& offsetB ); - void SetLimit( const int axisIndex, const float lowerLimit, const float upperLimit ); - void EnableSpring( int axisIndex, bool flag ); - void SetSpringStiffness( int axisIndex, float stiffness ); - void SetSpringDamping( int axisIndex, float damping ); - void SetSpringCenterPoint( int axisIndex, float ratio ); - void EnableMotor( int axisIndex, bool flag ); - void SetMotorVelocity( int axisIndex, float velocity ); - void SetMotorForce( int axisIndex, float force ); - -private: - - TraceCallStack& mTrace; - -}; // class TestDynamicsJoint - -class TestDynamicsShape : public Integration::DynamicsShape -{ -public: - - TestDynamicsShape( TraceCallStack& trace ); - virtual ~TestDynamicsShape(); - -public: - void Initialize( int type, const Vector3& dimensions ); - void Initialize( int type, Geometry geometry ); - -private: - - TraceCallStack& mTrace; - -}; // class TestDynamicsShape - -class TestDynamicsBody : public Integration::DynamicsBody -{ -public: - TestDynamicsBody( TraceCallStack& trace ); - - virtual ~TestDynamicsBody(); - -public: // From Dali::Integration::DynamicsBody - - inline void Initialize( const Integration::DynamicsBodySettings& bodySettings, Integration::DynamicsShape* shape, - Integration::DynamicsWorld& dynamicsWorld, - const Vector3& startPosition, const Quaternion& startRotation ) - { - mTrace.PushCall( "DynamicsBody::~DynamicsBody", "" ); - } - - inline void SetMass( float mass ) - { - mTrace.PushCall( "DynamicsBody::SetMass", "" ); - } - - inline void SetElasticity( float elasticity ) - { - mTrace.PushCall( "DynamicsBody::SetElasticity", "" ); - } - - inline void SetLinearVelocity( const Vector3& velocity ) - { - mTrace.PushCall( "DynamicsBody::SetLinearVelocity", "" ); - } - - inline Vector3 GetLinearVelocity() const - { - mTrace.PushCall( "DynamicsBody::GetLinearVelocity", "" ); - return Vector3::ZERO; - } - - inline void SetAngularVelocity( const Vector3& velocity ) - { - mTrace.PushCall( "DynamicsBody::SetAngularVelocity", "" ); - } - - inline Vector3 GetAngularVelocity() const - { - mTrace.PushCall( "DynamicsBody::GetAngularVelocity", "" ); - return Vector3::ZERO; - } - - inline void SetKinematic( bool flag ) - { - mTrace.PushCall( "DynamicsBody::SetKinematic", "" ); - } - - inline bool IsKinematic() const - { - mTrace.PushCall( "DynamicsBody::IsKinematic", "" ); - return mKinematic; - } - - inline void SetSleepEnabled( bool flag ) - { - mTrace.PushCall( "DynamicsBody::SetSleepEnabled", "" ); - } - - inline void WakeUp() - { - mTrace.PushCall( "DynamicsBody::WakeUp", "" ); - } - - inline void AddAnchor( unsigned int index, const Integration::DynamicsBody* anchorBody, bool collisions ) - { - mTrace.PushCall( "DynamicsBody::AddAnchor", "" ); - } - - inline void ConserveVolume( bool flag ) - { - mTrace.PushCall( "DynamicsBody::ConserveVolume", "" ); - } - - inline void ConserveShape( bool flag ) - { - mTrace.PushCall( "DynamicsBody::ConserveShape", "" ); - } - - inline short int GetCollisionGroup() const - { - mTrace.PushCall( "DynamicsBody::GetCollisionGroup", "" ); - return mCollisionGroup; - } - - inline void SetCollisionGroup( short int collisionGroup ) - { - mTrace.PushCall( "DynamicsBody::SetCollisionGroup", "" ); - mCollisionGroup = collisionGroup; - } - - inline short int GetCollisionMask() const - { - mTrace.PushCall( "DynamicsBody::GetCollisionMask", "" ); - return mCollisionMask; - } - - inline void SetCollisionMask( short int collisionMask ) - { - mTrace.PushCall( "DynamicsBody::SetCollisionMask", "" ); - mCollisionMask = collisionMask; - } - - inline int GetType() const - { - mTrace.PushCall( "DynamicsBody::GetType", "" ); - return mSettings->type; - } - - inline bool IsActive() const - { - mTrace.PushCall( "DynamicsBody::IsActive", "" ); - return mActivationState; - } - - inline void SetTransform( const Vector3& position, const Quaternion& rotation ) - { - mTrace.PushCall( "DynamicsBody::SetTransform", "" ); - } - - inline void GetTransform( Vector3& position, Quaternion& rotation ) - { - mTrace.PushCall( "DynamicsBody::GetTransform", "" ); - } - - inline void GetSoftVertices( Geometry geometry ) const - { - mTrace.PushCall( "DynamicsBody::GetSoftVertices", "" ); - } - -private: - Dali::Integration::DynamicsBodySettings* mSettings; - bool mConserveVolume:1; - bool mConserveShape:1; - bool mKinematic:1; - bool mActivationState:1; - - short int mCollisionGroup; - short int mCollisionMask; - - TraceCallStack& mTrace; -}; // class TestDynamicsBody - -class TestDynamicsWorld : public Dali::Integration::DynamicsWorld -{ -public: - - TestDynamicsWorld( TraceCallStack& trace ); - - virtual ~TestDynamicsWorld(); - - inline void Initialize( const Dali::Integration::DynamicsWorldSettings& worldSettings ) - { - - mTrace.PushCall( "DynamicsWorld::Initialize", "" ); - } - - inline void AddBody( Dali::Integration::DynamicsBody* body ) - { - mTrace.PushCall( "DynamicsWorld::AddBody", "" ); - } - - inline void RemoveBody( Dali::Integration::DynamicsBody* body ) - { - mTrace.PushCall( "DynamicsWorld::RemoveBody", "" ); - } - - inline void AddJoint( Dali::Integration::DynamicsJoint* joint ) - { - mTrace.PushCall( "DynamicsWorld::AddJoint", "" ); - } - - inline void RemoveJoint( Dali::Integration::DynamicsJoint* joint ) - { - mTrace.PushCall( "DynamicsWorld::RemoveJoint", "" ); - } - - inline void SetGravity( const Vector3& gravity ) - { - mTrace.PushCall( "DynamicsWorld::SetGravity", "" ); - } - - inline void SetDebugDrawMode(int mode) - { - mTrace.PushCall( "DynamicsWorld::SetDebugDrawMode", "" ); - } - - inline const Integration::DynamicsDebugVertexContainer& DebugDraw() - { - mTrace.PushCall( "DynamicsWorld::DebugDraw", "" ); - return mDebugVertices; - } - - inline void Update( float elapsedSeconds ) - { - mTrace.PushCall( "DynamicsWorld::Update", "" ); - } - - inline void CheckForCollisions( Integration::CollisionDataContainer& contacts ) - { - mTrace.PushCall( "DynamicsWorld::CheckForCollisions", "" ); - } - -private: - Dali::Integration::DynamicsWorldSettings* mSettings; - Dali::Integration::DynamicsDebugVertexContainer mDebugVertices; - - TraceCallStack& mTrace; - -}; // class TestDynamicsWorld - -class TestDynamicsFactory : public Integration::DynamicsFactory -{ - -public: - - TestDynamicsFactory( TraceCallStack& trace ); - - virtual ~TestDynamicsFactory(); - - virtual bool InitializeDynamics( const Integration::DynamicsWorldSettings& worldSettings ); - - virtual void TerminateDynamics(); - - virtual Integration::DynamicsWorld* CreateDynamicsWorld(); - virtual Integration::DynamicsBody* CreateDynamicsBody(); - - virtual Integration::DynamicsJoint* CreateDynamicsJoint(); - - virtual Integration::DynamicsShape* CreateDynamicsShape(); - - TraceCallStack& mTrace; -}; // class TestDynamicsFactory - -} // Dali - -#endif // __TEST_DYNAMICS_H__ diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.cpp b/automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.cpp index 35d0a76..51edfdd 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.cpp @@ -38,8 +38,7 @@ TestPlatformAbstraction::TestPlatformAbstraction() mSize(), mClosestSize(), mLoadFileResult(), - mSaveFileResult( false ), - mDynamicsFactory( NULL ) + mSaveFileResult( false ) { Initialize(); } @@ -49,7 +48,6 @@ TestPlatformAbstraction::TestPlatformAbstraction() */ TestPlatformAbstraction::~TestPlatformAbstraction() { - delete mDynamicsFactory; } /** @@ -249,16 +247,6 @@ void TestPlatformAbstraction::JoinLoaderThreads() mTrace.PushCall("JoinLoaderThreads", ""); } -Integration::DynamicsFactory* TestPlatformAbstraction::GetDynamicsFactory() -{ - mTrace.PushCall("GetDynamicsFactory", ""); - if( mDynamicsFactory == NULL ) - { - mDynamicsFactory = new TestDynamicsFactory( mTrace ); - } - return mDynamicsFactory; -} - /** Call this every test */ void TestPlatformAbstraction::Initialize() { @@ -292,7 +280,6 @@ bool TestPlatformAbstraction::WasCalled(TestFuncEnum func) case IsLoadingFunc: return mTrace.FindMethod("IsLoading"); case SetDpiFunc: return mTrace.FindMethod("SetDpi"); case JoinLoaderThreadsFunc: return mTrace.FindMethod("JoinLoaderThreads"); - case GetDynamicsFactoryFunc: return mTrace.FindMethod("GetDynamicsFactory"); } return false; } diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.h b/automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.h index 926e75a..6c525fc 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.h +++ b/automated-tests/src/dali/dali-test-suite-utils/test-platform-abstraction.h @@ -27,7 +27,6 @@ #include #include "test-trace-call-stack.h" -#include "test-dynamics.h" namespace Dali { @@ -168,8 +167,6 @@ public: virtual void JoinLoaderThreads(); - virtual Integration::DynamicsFactory* GetDynamicsFactory(); - public: // TEST FUNCTIONS // Enumeration of Platform Abstraction methods @@ -187,7 +184,6 @@ public: // TEST FUNCTIONS IsLoadingFunc, SetDpiFunc, JoinLoaderThreadsFunc, - GetDynamicsFactoryFunc, } TestFuncEnum; /** Call this every test */ @@ -245,7 +241,6 @@ private: LoadFileResult mLoadFileResult; bool mSaveFileResult; - TestDynamicsFactory* mDynamicsFactory; }; } // Dali diff --git a/automated-tests/src/dali/utc-Dali-Actor.cpp b/automated-tests/src/dali/utc-Dali-Actor.cpp index 599e1c6..86f5e4c 100644 --- a/automated-tests/src/dali/utc-Dali-Actor.cpp +++ b/automated-tests/src/dali/utc-Dali-Actor.cpp @@ -2474,14 +2474,6 @@ int UtcDaliActorSetGetOverlay(void) } -// Current Dynamics functions are crashing, so testing these sections are futile - -int UtcDaliActorDynamics(void) -{ - DALI_TEST_CHECK( true ); - END_TEST; -} - int UtcDaliActorCreateDestroy(void) { Actor* actor = new Actor; diff --git a/build/tizen/dali-core/Makefile.am b/build/tizen/dali-core/Makefile.am index f17d918..0f5f12e 100644 --- a/build/tizen/dali-core/Makefile.am +++ b/build/tizen/dali-core/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (c) 2014 Samsung Electronics Co., Ltd. +# Copyright (c) 2015 Samsung Electronics Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -74,18 +74,15 @@ libdali_core_la_LIBADD = $(DALI_LDFLAGS) \ # Install headers under the correct subdirectories platformabstractiondir = $(includedir)/dali/integration-api platformabstractioneventsdir = $(includedir)/dali/integration-api/events -platformabstractiondynamicsdir = $(includedir)/dali/integration-api/dynamics platformabstraction_HEADERS = $(platform_abstraction_header_files) platformabstractionevents_HEADERS = $(platform_abstraction_events_header_files) -platformabstractiondynamics_HEADERS = $(platform_abstraction_dynamics_header_files) #devel api (used by adaptor / toolkit develapidir = $(devincludepath)/dali/devel-api develapiactorsdir = $(develapidir)/actors develapianimationdir = $(develapidir)/animation develapicommondir = $(develapidir)/common -develapidynamicsdir = $(develapidir)/dynamics develapieventsdir = $(develapidir)/events develapigeometrydir = $(develapidir)/geometry develapiimagesdir = $(develapidir)/images @@ -98,7 +95,6 @@ develapi_HEADERS = $(devel_api_header_files) develapiactors_HEADERS = $(devel_api_core_actors_header_files) develapianimation_HEADERS = $(devel_api_core_animation_header_files) develapicommon_HEADERS = $(devel_api_core_common_header_files) -develapidynamics_HEADERS = $(devel_api_core_dynamics_header_files) develapievents_HEADERS = $(devel_api_core_events_header_files) develapiimages_HEADERS = $(devel_api_core_images_header_files) develapimodeling_HEADERS = $(devel_api_core_modeling_header_files) @@ -150,8 +146,7 @@ linker_test_SOURCES = linker-test.cpp \ ../../../automated-tests/src/dali/dali-test-suite-utils/test-gl-abstraction.cpp \ ../../../automated-tests/src/dali/dali-test-suite-utils/test-gesture-manager.cpp \ ../../../automated-tests/src/dali/dali-test-suite-utils/test-gl-sync-abstraction.cpp \ - ../../../automated-tests/src/dali/dali-test-suite-utils/test-trace-call-stack.cpp \ - ../../../automated-tests/src/dali/dali-test-suite-utils/test-dynamics.cpp + ../../../automated-tests/src/dali/dali-test-suite-utils/test-trace-call-stack.cpp linker_test_CXXFLAGS = \ $(cxx_flags) \ diff --git a/dali/devel-api/dynamics/dynamics-body-config.cpp b/dali/devel-api/dynamics/dynamics-body-config.cpp deleted file mode 100644 index 9f2ee2b..0000000 --- a/dali/devel-api/dynamics/dynamics-body-config.cpp +++ /dev/null @@ -1,322 +0,0 @@ -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// INTERNAL HEADERS -#ifdef DALI_DYNAMICS_SUPPORT -#include -#include -#include -#include -#endif - -namespace Dali -{ - -DynamicsBodyConfig DynamicsBodyConfig::New() -{ -#ifdef DALI_DYNAMICS_SUPPORT - Internal::DynamicsBodyConfigPtr internal( new Internal::DynamicsBodyConfig() ); - - return DynamicsBodyConfig( internal.Get() ); -#else - return DynamicsBodyConfig(); -#endif -} - -DynamicsBodyConfig::DynamicsBodyConfig() -{ -} - -DynamicsBodyConfig::~DynamicsBodyConfig() -{ -} - -DynamicsBodyConfig::DynamicsBodyConfig(const DynamicsBodyConfig& handle) -: BaseHandle(handle) -{ -} - -DynamicsBodyConfig& DynamicsBodyConfig::operator=(const DynamicsBodyConfig& rhs) -{ - BaseHandle::operator=(rhs); - return *this; -} - -void DynamicsBodyConfig::SetType( const DynamicsBodyConfig::BodyType type ) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetType( type ); -#endif -} - -DynamicsBodyConfig::BodyType DynamicsBodyConfig::GetType() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetType(); -#else - return DynamicsBodyConfig::RIGID; -#endif -} - -void DynamicsBodyConfig::SetShape( const DynamicsShape::ShapeType type, const Vector3& dimensions ) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetShape( type, dimensions ); -#endif -} - -void DynamicsBodyConfig::SetShape( DynamicsShape shape ) -{ -#ifdef DALI_DYNAMICS_SUPPORT - Internal::DynamicsShapePtr internal( &(GetImplementation(shape)) ); - - GetImplementation(*this).SetShape( internal ); -#endif -} - -DynamicsShape DynamicsBodyConfig::GetShape() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - Internal::DynamicsShapePtr internal( GetImplementation(*this).GetShape() ); - - return DynamicsShape( internal.Get() ); -#else - return DynamicsShape(); -#endif -} - -float DynamicsBodyConfig::GetMass() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetMass(); -#else - return float(); -#endif -} - -void DynamicsBodyConfig::SetMass( float mass ) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetMass( mass ); -#endif -} - -float DynamicsBodyConfig::GetElasticity() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetElasticity(); -#else - return float(); -#endif -} - -void DynamicsBodyConfig::SetElasticity( float elasticity ) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetElasticity( elasticity ); -#endif -} - -float DynamicsBodyConfig::GetFriction() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetFriction(); -#else - return float(); -#endif -} - -void DynamicsBodyConfig::SetFriction(float friction) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetFriction( friction ); -#endif -} - -float DynamicsBodyConfig::GetLinearDamping() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetLinearDamping(); -#else - return float(); -#endif -} - -void DynamicsBodyConfig::SetLinearDamping( float damping ) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetLinearDamping( damping ); -#endif -} - -float DynamicsBodyConfig::GetAngularDamping() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetAngularDamping(); -#else - return float(); -#endif -} - -void DynamicsBodyConfig::SetAngularDamping(float damping) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetAngularDamping( damping ); -#endif -} - -float DynamicsBodyConfig::GetLinearSleepVelocity() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetLinearSleepVelocity(); -#else - return float(); -#endif -} - -void DynamicsBodyConfig::SetLinearSleepVelocity( float sleepVelocity ) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetLinearSleepVelocity( sleepVelocity ); -#endif -} - -float DynamicsBodyConfig::GetAngularSleepVelocity() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetAngularSleepVelocity(); -#else - return float(); -#endif -} - -void DynamicsBodyConfig::SetAngularSleepVelocity(float sleepVelocity) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetAngularSleepVelocity( sleepVelocity ); -#endif -} - -short int DynamicsBodyConfig::GetCollisionGroup() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetCollisionGroup(); -#else - return short(); -#endif -} - -void DynamicsBodyConfig::SetCollisionGroup(const short int collisionGroup) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetCollisionGroup(collisionGroup); -#endif -} - -short int DynamicsBodyConfig::GetCollisionMask() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetCollisionMask(); -#else - return short(); -#endif -} - -void DynamicsBodyConfig::SetCollisionMask(const short int collisionMask) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetCollisionMask(collisionMask); -#endif -} - -float DynamicsBodyConfig::GetStiffness() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetStiffness(); -#else - return float(); -#endif -} - -void DynamicsBodyConfig::SetStiffness( float stiffness ) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetStiffness( stiffness ); -#endif -} - -float DynamicsBodyConfig::GetAnchorHardness() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetAnchorHardness(); -#else - return float(); -#endif -} - -void DynamicsBodyConfig::SetAnchorHardness( float hardness ) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetAnchorHardness( hardness ); -#endif -} - -float DynamicsBodyConfig::GetVolumeConservation() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetVolumeConservation(); -#else - return float(); -#endif -} - -void DynamicsBodyConfig::SetVolumeConservation(float conservation) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetVolumeConservation(conservation); -#endif -} - -float DynamicsBodyConfig::GetShapeConservation() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetShapeConservation(); -#else - return float(); -#endif -} - -void DynamicsBodyConfig::SetShapeConservation(float conservation) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetShapeConservation(conservation); -#endif -} - -DynamicsBodyConfig::DynamicsBodyConfig( Internal::DynamicsBodyConfig* internal ) -#ifdef DALI_DYNAMICS_SUPPORT -: BaseHandle(internal) -#else -: BaseHandle(NULL) -#endif -{ -} - -} // namespace Dali diff --git a/dali/devel-api/dynamics/dynamics-body-config.h b/dali/devel-api/dynamics/dynamics-body-config.h deleted file mode 100644 index f54bdd0..0000000 --- a/dali/devel-api/dynamics/dynamics-body-config.h +++ /dev/null @@ -1,391 +0,0 @@ -#ifndef __DALI_DYNAMICS_BODY_CONFIG_H__ -#define __DALI_DYNAMICS_BODY_CONFIG_H__ - -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include - -// BASE CLASS INCLUDES -#include - -// INTERNAL INCLUDES -#include - -namespace Dali -{ -class DynamicsWorld; -struct Vector3; - -namespace Internal DALI_INTERNAL -{ -class DynamicsBodyConfig; -} // namespace Internal - -/** - * @brief Describes a DynamicsBody configuration. - * - * Use to create multiple instances of a DynamicsBody - */ -class DALI_IMPORT_API DynamicsBodyConfig : public BaseHandle -{ -public: - - /** - * @brief Enumeration of the types of dynamics bodies. - */ - enum BodyType - { - RIGID, ///< May have mass and therefore be affected by gravity and have velocity - SOFT, ///< Has a deformable shape - implies RIGID - }; // enum BodyType - - /** - * @brief Collision filtering flags. - * - * A DynamicsBody pair are considered for collision detection if a bitwise AND of - * the filter group from one DynamicsBody and the filter mask of the other DynamicsBody - * gives a non-zero result.@n - * Set the filter group with Dali::DynamicsBodyConfig::SetCollisionGroup and - * the filter mask with Dali::DynamicsBodyConfig::SetCollisionMask.@n - */ - enum CollisionFilter - { - COLLISION_FILTER_DEFAULT = (1 << 0), ///< The default group filter - COLLISION_FILTER_STATIC = (1 << 1), ///< The default group for static (zero mass) bodies - COLLISION_FILTER_ALL = (-1) ///< The default mask - }; - -public: - /** - * @brief Create a new DynamicsBody configuration object. - * - * All values are set to default values... - * @pre Stage::InitializeDynamics() must have been called - * @return a handle to the new DynamicsBodyconfig. - */ - static DynamicsBodyConfig New(); - - /** - * @brief Create an uninitialized handle. - * - * Initialize with one of the DynamicsBodyConfig New methods - */ - DynamicsBodyConfig(); - - /** - * @brief Destructor - * - * This is non-virtual since derived Handle types must not contain data or virtual methods. - */ - ~DynamicsBodyConfig(); - - /** - * @brief This copy constructor is required for (smart) pointer semantics. - * - * @param [in] handle A reference to the copied handle - */ - DynamicsBodyConfig(const DynamicsBodyConfig& handle); - - /** - * @brief This assignment operator is required for (smart) pointer semantics. - * - * @param [in] rhs A reference to the copied handle - * @return A reference to this - */ - DynamicsBodyConfig& operator=(const DynamicsBodyConfig& rhs); - -public: - /** - * @brief Set the type of DynamicsBody. - * - * @param[in] type A member of BodyType enumeration. - */ - void SetType( const BodyType type ); - - /** - * @brief Get the type of DynamicsBody specified by the Configuration. - * - * @return A member of BodyType enumeration. - */ - BodyType GetType() const; - - /** - * @brief Define the shape for the body. - * - * @param[in] type The type of shape - * @param[in] dimensions The parameters defining the shape ... - * - DynamicsShape::SPHERE - * - x radius - * - DynamicsShape::CUBE - * - x width of cube - * - y height of cube - * - z depth of cube - * - DynamicsShape::CYLINDER - * - x radius of ends - * - y length if cylinder - * - DynamicsShape::CAPSULE - * - x radius of end caps - * - y length of capsule - * - DynamicsShape::CONE - * - x radius of base - * - y length of cone - */ - void SetShape(const DynamicsShape::ShapeType type, const Vector3& dimensions); - - /** - * @brief Set the shape for the body. - * - * @param[in] shape A DynamicsShape. - */ - void SetShape( DynamicsShape shape ); - - /** - * @brief get the shape for the body. - * - * @return A DynamicsShape. - */ - DynamicsShape GetShape() const; - - /** - * @brief Set the mass for the body. - * - * @param[in] mass The mass for the body. - */ - void SetMass( float mass); - - /** - * @brief Get the mass that will be set on bodies created from this config. - * - * @return The mass that will be set on bodies created from this config - */ - float GetMass() const; - - /** - * @brief Get the @"elasticity@" of the body. - * - * @return The @"elasticity@". - * - * See @ref SetElasticity - */ - float GetElasticity() const; - - /** - * @brief Affects the @"elasticity@" of the body. - * - * This function sets the coefficient of restitution (COR) of an object.@n - * @param[in] elasticity The elasticity of the body. - * Assuming the other body in a collision has a elasticity factor of 1. - * Set elasticity == 0 to inhibit bouncing at impact, reduces the velocity of the body to 0. - * Set elasticity > 1 will increase the velocity of the object after impact - */ - void SetElasticity(float elasticity); - - /** - * @brief Get the friction coefficient for any DynamicsBody created from this DynamicsBodyConfig. - * - * @return The friction coefficient. - * - * See @ref SetFriction. - */ - float GetFriction() const; - - /** - * @brief Set the friction coefficient for any DynamicsBody created from this DynamicsBodyConfig. - * - * @param[in] friction The friction coefficient. - * This will be clamped between 0 and 1 - */ - void SetFriction(float friction); - - /** - * @brief Get the linear damping coefficient for any DynamicsBody created from this DynamicsBodyConfig. - * - * @return The linear damping coefficient. - * See @ref SetLinearDamping. - */ - float GetLinearDamping() const; - - /** - * @brief Set the linear damping coefficient for any DynamicsBody created from this DynamicsBodyConfig. - * - * @param[in] damping The linear damping coefficient. - * This will be clamped between 0 and 1 - */ - void SetLinearDamping( float damping ); - - /** - * @brief Get the angular damping coefficient for any DynamicsBody created from this DynamicsBodyConfig. - * - * @return The angular damping coefficient. - * - * See @ref SetAngularDamping. - */ - float GetAngularDamping() const; - - /** - * @brief Set the angular damping coefficient for any DynamicsBody created from this DynamicsBodyConfig. - * - * @param[in] damping The angular damping coefficient. - * This will be clamped between 0 and 1 - */ - void SetAngularDamping(float damping); - - /** - * @brief Get the linear velocity below which the DynamicsBody can be put to sleep by the simulation. - * - * @return The linear sleep velocity. - * - * See @ref SetLinearSleepVelocity, DynamicsBody::SetSleepEnabled. - */ - float GetLinearSleepVelocity() const; - - /** - * @brief Set the linear velocity below which the DynamicsBody can be put to sleep by the simulation. - * - * @param[in] sleepVelocity The linear sleep velocity. - * - * See @ref DynamicsBody::SetSleepEnabled. - */ - void SetLinearSleepVelocity(float sleepVelocity); - - /** - * @brief Get the angular velocity below which the DynamicsBody can be put to sleep by the simulation. - * - * @return The angular sleep velocity. - * - * See @ref SetAngularSleepVelocity, DynamicsBody::SetSleepEnabled. - */ - float GetAngularSleepVelocity() const; - - /** - * @brief Set the angular velocity below which the DynamicsBody can be put to sleep by the simulation. - * - * @param[in] sleepVelocity The angular sleep velocity. - * - * See @ref DynamicsBody::SetSleepEnabled. - */ - void SetAngularSleepVelocity(float sleepVelocity); - - /** - * @brief Get the collision filter group.@n - * - * See @ref CollisionFilter - * @return The collision filter group.@n - */ - short int GetCollisionGroup() const; - - /** - * @brief Set the collision filter group. - * - * See @ref CollisionFilter - * @param[in] collisionGroup The collision filter group - */ - void SetCollisionGroup(const short int collisionGroup); - - /** - * @brief Get the collision filter mask.@n - * - * See @ref CollisionFilter - * @return The collision filter mask.@n - */ - short int GetCollisionMask() const; - - /** - * @brief Set the collision filter mask. - * - * See @ref CollisionFilter - * @param[in] collisionMask The collision filter mask - */ - void SetCollisionMask(const short int collisionMask); - - /** - * @brief Get the stiffness coefficient for the soft body. - * - * See @ref SetStiffness - * @return The stiffness coefficient for the soft body. - */ - float GetStiffness() const; - - /** - * @brief Set the stiffness co-efficient for the soft body. - * - * @param[in] stiffness A value clamped between 0 and 1. - * Values closer to 1 make it more stiff. - */ - void SetStiffness( float stiffness ); - - /** - * @brief Get the anchor hardness.@n - * - * See @ref SetAnchorHardness. - * @return The anchor hardness. - */ - float GetAnchorHardness() const; - - /** - * @brief Set the hardness of an anchor, or how much the anchor is allowed to drift. - * - * @param[in] hardness 0 means a soft anchor with no drift correction, 1 mean a hard anchor with full correction - * hardness will be clamped between 0 and 1. - */ - void SetAnchorHardness( float hardness ); - - /** - * @brief Get the volume conservation coefficient. - * - * @return The volume conservation coefficient. - */ - float GetVolumeConservation() const; - - /** - * @brief Set the volume conservation coefficient. - * - * Defines the magnitude of the force used to conserve the volume of the body after DynamicsBody::ConserveVolume is invoked - * @param[in] conservation Range 0 <= conservation < +infinity - */ - void SetVolumeConservation(float conservation); - - /** - * @brief Get the shape conservation factor. - * - * @return The shape conservation factor. - */ - float GetShapeConservation() const; - - /** - * @brief Set the shape conservation factor. - * - * Defines the factor used to match the shape of the body when DynamicsBody::ConserveShape. is invoked - * @param[in] conservation Range 0 <= conservation < 1 - */ - void SetShapeConservation(float conservation); - - // Not intended for application developers -private: - /** - * @brief This constructor is used internally by Dali. - * - * @param [in] internal A pointer to a newly allocated Dali resource - */ - explicit DALI_INTERNAL DynamicsBodyConfig( Internal::DynamicsBodyConfig* internal ); -}; // class DynamicsBodyConfig - -} // namespace Dali - -#endif /* __DALI_DYNAMICS_BODY_CONFIG_H__ */ diff --git a/dali/devel-api/dynamics/dynamics-body.cpp b/dali/devel-api/dynamics/dynamics-body.cpp deleted file mode 100644 index 8cb656d..0000000 --- a/dali/devel-api/dynamics/dynamics-body.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// INTERNAL HEADERS -#include - -#ifdef DALI_DYNAMICS_SUPPORT -#include -#include -#include -#include -#endif - -namespace Dali -{ - -DynamicsBody::DynamicsBody() -{ -} - -DynamicsBody::~DynamicsBody() -{ -} - -DynamicsBody::DynamicsBody(const DynamicsBody& handle) -: BaseHandle(handle) -{ -} - -DynamicsBody& DynamicsBody::operator=(const DynamicsBody& rhs) -{ - BaseHandle::operator=(rhs); - return *this; -} - -DynamicsBody::DynamicsBody(Internal::DynamicsBody* internal) -#ifdef DALI_DYNAMICS_SUPPORT -: BaseHandle(internal) -#else -: BaseHandle(NULL) -#endif -{ -} - -float DynamicsBody::GetMass() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetMass(); -#else - return float(); -#endif -} - -float DynamicsBody::GetElasticity() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetElasticity(); -#else - return float(); -#endif -} - -void DynamicsBody::SetLinearVelocity(const Vector3& velocity) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetLinearVelocity(velocity); -#endif -} - -Vector3 DynamicsBody::GetCurrentLinearVelocity() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetCurrentLinearVelocity(); -#else - return Vector3(); -#endif -} - -void DynamicsBody::SetAngularVelocity(const Vector3& velocity) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetAngularVelocity(velocity); -#endif -} - -Vector3 DynamicsBody::GetCurrentAngularVelocity() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetCurrentAngularVelocity(); -#else - return Vector3(); -#endif -} - -void DynamicsBody::SetKinematic( const bool flag ) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetKinematic(flag); -#endif -} - -bool DynamicsBody::IsKinematic() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).IsKinematic(); -#else - return bool(); -#endif -} - -void DynamicsBody::SetSleepEnabled( const bool flag ) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetSleepEnabled(flag); -#endif -} - -bool DynamicsBody::GetSleepEnabled() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetSleepEnabled(); -#else - return bool(); -#endif -} - -void DynamicsBody::WakeUp() -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).WakeUp(); -#endif -} - -void DynamicsBody::AddAnchor(const unsigned int index, DynamicsBody body, const bool collisions) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).AddAnchor(index, &GetImplementation(body), collisions); -#endif -} - -void DynamicsBody::ConserveVolume(const bool flag) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).ConserveVolume(flag); -#endif -} - -void DynamicsBody::ConserveShape(const bool flag) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).ConserveShape(flag); -#endif -} - -} // namespace Dali diff --git a/dali/devel-api/dynamics/dynamics-body.h b/dali/devel-api/dynamics/dynamics-body.h deleted file mode 100644 index 9b9d847..0000000 --- a/dali/devel-api/dynamics/dynamics-body.h +++ /dev/null @@ -1,204 +0,0 @@ -#ifndef __DALI_DYNAMICS_BODY_H__ -#define __DALI_DYNAMICS_BODY_H__ - -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include - -// BASE CLASS INCLUDES -#include - -namespace Dali -{ - -namespace Internal DALI_INTERNAL -{ -class DynamicsBody; -} // namespace Internal - -class Actor; -class DynamicsBodyConfig; -class DynamicsShape; -class DynamicsWorld; - -/** - * @brief Represents a physical object in the physics world. - * - * The body is defined with a shape giving it dimension enabling it to collide with other bodies. - */ -class DALI_IMPORT_API DynamicsBody : public BaseHandle -{ -public: - /** - * @brief Constructor which creates an uninitialized DynamicsBody handle. - * - * Use Actor::EnableDynamics or Actor::GetDynamicsBody to initialize this handle - */ - DynamicsBody(); - - /** - * @brief Destructor - * - * This is non-virtual since derived Handle types must not contain data or virtual methods. - */ - ~DynamicsBody(); - - /** - * @brief This copy constructor is required for (smart) pointer semantics. - * - * @param [in] handle A reference to the copied handle - */ - DynamicsBody(const DynamicsBody& handle); - - /** - * @brief This assignment operator is required for (smart) pointer semantics. - * - * @param [in] rhs A reference to the copied handle - * @return A reference to this - */ - DynamicsBody& operator=(const DynamicsBody& rhs); - -public: - // Not intended for application developers - /** - * @brief This constructor is used by Dali New() methods. - * - * @param [in] body A pointer to a newly allocated Dali resource - */ - explicit DALI_INTERNAL DynamicsBody(Internal::DynamicsBody* body); - -public: - /** - * @brief Get the mass of the body. - * - * @return The mass. - */ - float GetMass() const; - - /** - * @brief Get the @"elasticity@" of the body. - * - * @return The @"elasticity@". - * @ref Dali::DynamicsBodyConfig::SetElasticity - */ - float GetElasticity() const; - - /** - * @brief Set the linear velocity for the body. - * - * Sets the speed and direction the body moves through space. - * This will cancel/override any forces/impulses currently acting on the body. - * @param[in] velocity The linear velocity - */ - void SetLinearVelocity(const Vector3& velocity); - - /** - * @brief Get the current linear velocity of the body. - * - * @return The current linear velocity of the body. - */ - Vector3 GetCurrentLinearVelocity() const; - - /** - * @brief Set the angular velocity for the body. - * - * Set the speed and axis that the body will rotate about itself. - * This will cancel/override any forces/impulses currently acting on the body. - * @param[in] velocity The angular velocity - */ - void SetAngularVelocity(const Vector3& velocity); - - /** - * @brief Get the current angular velocity of the body. - * - * @return The current angular velocity of the body. - */ - Vector3 GetCurrentAngularVelocity() const; - - /** - * @brief Set the body to be kinematic. - * - * Kinematic bodies can be animated by DALi's animation system, but there will be only one-way interaction - * dynamic objects will be pushed away but there is no influence from dynamics objects - * @pre Only rigid bodies can be kinematic. - * @param[in] flag Set true to enable kinematic control - */ - void SetKinematic( const bool flag ); - - /** - * @brief Get the kinematic state of the body. - * - * @return The kinematic state - */ - bool IsKinematic() const; - - /** - * @brief Set whether or not the simulation can put this DynamicsBody to sleep. - * - * The simulation monitors the velocity of non-static bodies and can elect to put motionless - * bodies to sleep.@n - * SleepEnabled is true by default. - * @param[in] flag Set true to allow the simulation to put the DynamicsBody to sleep, set false - * to keep the DynamicsBody enabled and updated each simulation update. - */ - void SetSleepEnabled( const bool flag ); - - /** - * @brief Get whether or not the simulation can put this DynamicsBody to sleep. - * - * @return A flag, when true, the simulation can put the DynamicsBody to sleep. - */ - bool GetSleepEnabled() const; - - /** - * @brief Wake up a DynamicsBody. - * - * If the DynamicsBody is currently sleeping it will be woken, - * otherwise no action is taken. - */ - void WakeUp(); - - /** - * @brief Anchor a node in a soft body. - * @param[in] index A node index - * @param[in] body A rigid body - * @param[in] collisions Allow collisions between this soft body and the anchor rigid body - */ - void AddAnchor(const unsigned int index, DynamicsBody body, const bool collisions); - - /** - * @brief Take a snapshot of the current volume of this body and conserve it while the shape is deformed. - * @param[in] flag Set true, to enable volume conservation, false to disable - * @ref Dali::DynamicsBodyConfig::SetVolumeConservation() - */ - void ConserveVolume(const bool flag); - - /** - * @brief Take a snapshot of the current shape of this body and conserve it while the shape is deformed. - * This resists the deformation of the body. - * @param[in] flag Set true, to enable shape conservation, false to disable - * @ref Dali::DynamicsBodyConfig::SetShapeConservation() - */ - void ConserveShape(const bool flag); - -}; // class DynamicsBody - -} // namespace Dali - -#endif /* __DALI_DYNAMICS_BODY_H__ */ diff --git a/dali/devel-api/dynamics/dynamics-collision.cpp b/dali/devel-api/dynamics/dynamics-collision.cpp deleted file mode 100644 index dcb89ef..0000000 --- a/dali/devel-api/dynamics/dynamics-collision.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// INTERNAL HEADERS -#include -#include - -#ifdef DALI_DYNAMICS_SUPPORT -#include -#include -#endif - -namespace Dali -{ - -DynamicsCollision::DynamicsCollision() -{ -} - -DynamicsCollision::~DynamicsCollision() -{ -} - -DynamicsCollision::DynamicsCollision(const DynamicsCollision& handle) -: BaseHandle(handle) -{ -} - -DynamicsCollision& DynamicsCollision::operator=(const DynamicsCollision& rhs) -{ - BaseHandle::operator=(rhs); - return *this; -} - -Actor DynamicsCollision::GetActorA() -{ -#ifdef DALI_DYNAMICS_SUPPORT - Internal::ActorPtr actor( GetImplementation(*this).GetActorA() ); - return Actor( actor.Get() ); -#else - return Actor(); -#endif -} - -Actor DynamicsCollision::GetActorB() -{ -#ifdef DALI_DYNAMICS_SUPPORT - Internal::ActorPtr actor( GetImplementation(*this).GetActorB() ); - return Actor( actor.Get() ); -#else - return Actor(); -#endif -} - -float DynamicsCollision::GetImpactForce() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetImpactForce(); -#else - return float(); -#endif -} - -Vector3 DynamicsCollision::GetPointOnA() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetPointOnA(); -#else - return Vector3(); -#endif -} - -Vector3 DynamicsCollision::GetPointOnB() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetPointOnB(); -#else - return Vector3(); -#endif -} - -Vector3 DynamicsCollision::GetNormal() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetNormal(); -#else - return Vector3(); -#endif -} - -DynamicsCollision::DynamicsCollision( Internal::DynamicsCollision* internal ) -#ifdef DALI_DYNAMICS_SUPPORT -: BaseHandle(internal) -#else -: BaseHandle(NULL) -#endif -{ -} - -} // namespace Dali diff --git a/dali/devel-api/dynamics/dynamics-collision.h b/dali/devel-api/dynamics/dynamics-collision.h deleted file mode 100644 index d2af3ee..0000000 --- a/dali/devel-api/dynamics/dynamics-collision.h +++ /dev/null @@ -1,128 +0,0 @@ -#ifndef __DALI_DYNAMICS_COLLISION_H__ -#define __DALI_DYNAMICS_COLLISION_H__ - -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// BASE CLASS INCLUDES -#include - -namespace Dali -{ - -class Actor; -struct Vector3; - -namespace Internal DALI_INTERNAL -{ - -class DynamicsCollision; - -} // namespace Internal - -/** - * @brief Contains information about a collision between two actors. - */ -class DALI_IMPORT_API DynamicsCollision : public BaseHandle -{ -public: - /** - * @brief Create an uninitialized handle. - * - * Initialized handles are received in DynamicsWorld::SignalCollision handlers - */ - DynamicsCollision(); - - /** - * @brief Destructor - * - * This is non-virtual since derived Handle types must not contain data or virtual methods. - */ - ~DynamicsCollision(); - - /** - * @brief This copy constructor is required for (smart) pointer semantics. - * - * @param [in] handle A reference to the copied handle - */ - DynamicsCollision(const DynamicsCollision& handle); - - /** - * @brief This assignment operator is required for (smart) pointer semantics. - * - * @param [in] rhs A reference to the copied handle - * @return A reference to this - */ - DynamicsCollision& operator=(const DynamicsCollision& rhs); - -public: - /** - * @brief Get the first actor in the collision. - * - * @return The first actor in the collision - */ - Actor GetActorA(); - - /** - * @brief Get the second actor in the collision. - * - * @return The second actor in the collision - */ - Actor GetActorB(); - - /** - * @brief Get the force of the impact. - * - * @return the impact force - * @note currently returns 0.5f for a new collision and 0.0f for dispersal - */ - float GetImpactForce() const; - - /** - * @brief Get the point of contact on the first Actor. - * - * @return The point of contact on the first Actor - */ - Vector3 GetPointOnA() const; - - /** - * @brief Get the point of contact on the second Actor. - * - * @return The point of contact on the second Actor - */ - Vector3 GetPointOnB() const; - - /** - * @brief Get the collision normal. - * - * @return The collision normal - */ - Vector3 GetNormal() const; - - // Not intended for application developers -public: - /** - * @brief This constructor is used internally by Dali. - * - * @param [in] internal A pointer to a newly allocated Dali resource - */ - explicit DALI_INTERNAL DynamicsCollision( Internal::DynamicsCollision* internal ); -}; // class DynamicsCollision - -} // namespace Dali - -#endif /* __DALI_DYNAMICS_COLLISION_H__ */ diff --git a/dali/devel-api/dynamics/dynamics-joint.cpp b/dali/devel-api/dynamics/dynamics-joint.cpp deleted file mode 100644 index ccc1137..0000000 --- a/dali/devel-api/dynamics/dynamics-joint.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// INTERNAL HEADERS -#include - -#ifdef DALI_DYNAMICS_SUPPORT -#include -#endif - -namespace Dali -{ - -DynamicsJoint::DynamicsJoint() -{ -} - -DynamicsJoint::~DynamicsJoint() -{ -} - -DynamicsJoint::DynamicsJoint(const DynamicsJoint& handle) -: BaseHandle(handle) -{ -} - -DynamicsJoint& DynamicsJoint::operator=(const DynamicsJoint& rhs) -{ - BaseHandle::operator=(rhs); - return *this; -} - -void DynamicsJoint::SetLinearLimit( const int axisIndex, const float lowerLimit, const float upperLimit ) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetLinearLimit(axisIndex, lowerLimit, upperLimit); -#endif -} - -void DynamicsJoint::SetAngularLimit( const int axisIndex, const Degree& lowerLimit, const Degree& upperLimit ) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetAngularLimit( axisIndex, Radian(lowerLimit), Radian(upperLimit) ); -#endif -} - -void DynamicsJoint::EnableSpring(const int axisIndex, const bool flag) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).EnableSpring(axisIndex, flag); -#endif -} - -void DynamicsJoint::SetSpringStiffness(const int axisIndex, const float stiffness) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetSpringStiffness(axisIndex, stiffness); -#endif -} - -void DynamicsJoint::SetSpringDamping(const int axisIndex, const float damping) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetSpringDamping(axisIndex, damping); -#endif -} - -void DynamicsJoint::SetSpringCenterPoint(const int axisIndex, const float ratio) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetSpringCenterPoint(axisIndex, ratio); -#endif -} - -void DynamicsJoint::EnableMotor(const int axisIndex, const bool flag) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).EnableMotor(axisIndex, flag); -#endif -} - -void DynamicsJoint::SetMotorVelocity(const int axisIndex, const float velocity) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetMotorVelocity(axisIndex, velocity); -#endif -} - -void DynamicsJoint::SetMotorForce(const int axisIndex, const float force) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetMotorForce(axisIndex, force); -#endif -} - -Actor DynamicsJoint::GetActor( const bool first ) const -{ -#ifdef DALI_DYNAMICS_SUPPORT - Internal::ActorPtr internal( GetImplementation(*this).GetActor(first) ); - - return Actor(internal.Get()); -#else - return Actor(); -#endif -} - -DynamicsJoint::DynamicsJoint(Internal::DynamicsJoint* internal) -#ifdef DALI_DYNAMICS_SUPPORT -: BaseHandle(internal) -#else -: BaseHandle(NULL) -#endif -{ -} - -} // namespace Dali diff --git a/dali/devel-api/dynamics/dynamics-joint.h b/dali/devel-api/dynamics/dynamics-joint.h deleted file mode 100644 index 06501e3..0000000 --- a/dali/devel-api/dynamics/dynamics-joint.h +++ /dev/null @@ -1,214 +0,0 @@ -#ifndef __DALI_DYNAMICS_JOINT_H__ -#define __DALI_DYNAMICS_JOINT_H__ - -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include - -// BASE CLASS INCLUDES -#include - -namespace Dali -{ -namespace Internal DALI_INTERNAL -{ -class DynamicsJoint; -} // namespace Internal - -class Actor; - -/** - * @brief Represents a connection (or constraint) relationship between two dynamic bodies. - */ -class DALI_IMPORT_API DynamicsJoint : public BaseHandle -{ -public: - /** - * @brief Enumeration to access springs and motors. - * - * The fields in the enum can be bitwise ORed to access more than one spring/motor - */ - enum AxisIndex - { - LINEAR_X = (1<<0), ///< index for spring/motor controlling X axis translation - LINEAR_Y = (1<<1), ///< index for spring/motor controlling Y axis translation - LINEAR_Z = (1<<2), ///< index for spring/motor controlling Z axis translation - ANGULAR_X = (1<<3), ///< index for spring/motor controlling X axis rotation - ANGULAR_Y = (1<<4), ///< index for spring/motor controlling Y axis rotation - ANGULAR_Z = (1<<5), ///< index for spring/motor controlling Z axis rotation - }; - -public: - - /** - * @brief Constructor which creates an uninitialized DynamicsJoint handle. - * - * Use DynamicsJoint::New(...) to initialize this handle. - */ - DynamicsJoint(); - - /** - * @brief Destructor - * - * This is non-virtual since derived Handle types must not contain data or virtual methods. - */ - ~DynamicsJoint(); - - /** - * @brief This copy constructor is required for (smart) pointer semantics. - * - * @param [in] handle A reference to the copied handle - */ - DynamicsJoint(const DynamicsJoint& handle); - - /** - * @brief This assignment operator is required for (smart) pointer semantics. - * - * @param [in] rhs A reference to the copied handle - * @return A reference to this - */ - DynamicsJoint& operator=(const DynamicsJoint& rhs); - -public: - /** - * @brief Set the limit for one or more linear/translation axis. - * - * @param[in] axisIndex A bitfield specifying which axis are affected. - * A combination of AxisIndex::LINEAR_X, AxisIndex::LINEAR_Y and AxisIndex::LINEAR_Z - * @param[in] lowerLimit The lower limit. - * @param[in] upperLimit The upper limit. - */ - void SetLinearLimit( const int axisIndex, const float lowerLimit, const float upperLimit ); - - /** - * @brief Set the limit for one or more angular/rotation axis. - * - * @param[in] axisIndex A bitfield specifying which axis are affected. - * A combination of AxisIndex::ANGULAR_X, AxisIndex::ANGULAR_Y and AxisIndex::ANGULAR_Z - * @param[in] lowerLimit The lower limit. - * @param[in] upperLimit The upper limit. - */ - void SetAngularLimit( const int axisIndex, const Degree& lowerLimit, const Degree& upperLimit ); - - /** - * @brief Enable a spring. - * - * This will disable the motor on axisIndex if it was enabled - * @param[in] axisIndex A bitfield specifying which springs are affected. - * @param[in] flag Set to true to enable the spring, or false to disable them. - * @see AxisIndex - * @code - * DynamicsJoint joint( jointActor.EnableDynamics(dynamicsWorld, firstActor, secondActor); - * - * // Set the joint limits/ranges - * joint.SetLinearLimit(DynamicsJoint::LINEAR_X, -100.0f, 100.0f); // translate +/-100 on x - axis - * joint.SetAngularLimit(DynamicsJoint::ROTATE_X, Degree(-180.0f), Degree(180.0f)); // rotate +/-180 degrees around x axis - * - * // Enable a spring on the x axis (translation and rotation) - * joint.EnableSpring(DynamicsJoint::LINEAR_X | DynamicsJoint::ANGULAR_X, true); - * joint.SetSpringStiffness(DynamicsJoint::LINEAR_X, 0.2f); // Set the springs translation stiffness to fairly loose - * joint.SetSpringStiffness(DynamicsJoint::ANGULAR_X, 1.0f); // Set the springs rotation stiffness to be very stiff - * - * // Set the springs natural rest point to be the center of the joints translation and 75% of its rotation limits - * joint.SetSpringCenterPoint(DynamicsJoint::LINEAR_X, 0.5f); - * joint.SetSpringCenterPoint(DynamicsJoint::ANGULAR_X, 0.75f); - * - * @endcode - */ - void EnableSpring(const int axisIndex, const bool flag); - - /** - * @brief Set the stiffness of a spring. - * - * @param[in] axisIndex A bitfield specifying which springs are affected. - * @param[in] stiffness Values > 0, lower values are less stiff and larger values more stiff. - */ - void SetSpringStiffness(const int axisIndex, const float stiffness); - - /** - * @brief Set the damping of a spring. - * - * @param[in] axisIndex A bitfield specifying which springs are affected. - * @param[in] damping Values clamped between 0 and 1, with 0 meaning no damping and 1 full damping [default: 0.5]. - */ - void SetSpringDamping(const int axisIndex, const float damping); - - /** - * @brief Set the Center point or Equilibrium point of the spring. - * - * @param[in] axisIndex A bitfield specifying which springs are affected. - * @param[in] ratio Values clamped between [0..1]. - * CentrePoint = lower + ((upper - lower) * ratio) - * 0 will set the centre point to the value set in SetTranslationLowerLimit or SetRotationLowerLimit. - * 1 will set the centre point to the value set in SetTranslationUpperLimit or SetRotationUpperLimit. - * 0.5 will be half way between the two. - */ - void SetSpringCenterPoint(const int axisIndex, const float ratio); - - /** - * @brief Enable motor. - * - * This will disable the spring on axisIndex if it was enabled - * @param[in] axisIndex A bitfield specifying which motors are affected. - * @param[in] flag Set to true to enable the motors, or false to disable them. - * @see AxisIndex - */ - void EnableMotor(const int axisIndex, const bool flag); - - /** - * @brief Set the velocity of the motor. - * - * @param[in] axisIndex A bitfield specifying which motors are affected. - * @param[in] velocity Set the target velocity of the motor. - */ - void SetMotorVelocity(const int axisIndex, const float velocity); - - /** - * @brief Set the force (or torque) for the motor. - * - * @param[in] axisIndex A bitfield specifying which motors are affected. - * @param[in] force Values clamped between [0..1]. - * 0 will apply no force and 1 will apply maximum force. - */ - void SetMotorForce(const int axisIndex, const float force); - - /** - * @brief Get one of the Actors in the joint. - * - * @param[in] first If true returns the first actor, else the second actor. - * The returned object may be uninitialized if the Actor has - * been destroyed. - * @return The actor in the joint - */ - Actor GetActor( const bool first ) const; - - // Not intended for application developers -public: - - /** - * @brief This constructor is used by Dali New() methods. - * - * @param [in] joint A pointer to a newly allocated Dali resource - */ - explicit DALI_INTERNAL DynamicsJoint(Internal::DynamicsJoint* joint); -}; // class DynamicsJoint - -} // namespace Dali - -#endif /* __DALI_DYNAMICS_JOINT_H__ */ diff --git a/dali/devel-api/dynamics/dynamics-shape.cpp b/dali/devel-api/dynamics/dynamics-shape.cpp deleted file mode 100644 index 44ee76d..0000000 --- a/dali/devel-api/dynamics/dynamics-shape.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// INTERNAL HEADERS - -#ifdef DALI_DYNAMICS_SUPPORT -#include -#include -#include -#include -#include -#include -#include -#endif - -namespace Dali -{ - -DynamicsShape DynamicsShape::NewCapsule(const float radius, const float length) -{ -#ifdef DALI_DYNAMICS_SUPPORT - Internal::DynamicsCapsuleShapePtr internal( new Internal::DynamicsCapsuleShape( radius, length) ); - - return DynamicsShape(internal.Get()); -#else - return DynamicsShape(); -#endif -} - -DynamicsShape DynamicsShape::NewCone(const float radius, const float length) -{ -#ifdef DALI_DYNAMICS_SUPPORT - Internal::DynamicsConeShapePtr internal( new Internal::DynamicsConeShape( radius, length) ); - - return DynamicsShape(internal.Get()); -#else - return DynamicsShape(); -#endif -} - -DynamicsShape DynamicsShape::NewCube(const Vector3& dimensions) -{ -#ifdef DALI_DYNAMICS_SUPPORT - Internal::DynamicsCubeShapePtr internal( new Internal::DynamicsCubeShape( dimensions ) ); - - return DynamicsShape(internal.Get()); -#else - return DynamicsShape(); -#endif -} - -DynamicsShape DynamicsShape::NewCylinder(const float radius, const float length) -{ -#ifdef DALI_DYNAMICS_SUPPORT - Internal::DynamicsCylinderShapePtr internal( new Internal::DynamicsCylinderShape( radius, length) ); - - return DynamicsShape(internal.Get()); -#else - return DynamicsShape(); -#endif -} - -DynamicsShape DynamicsShape::NewSphere(const float radius) -{ -#ifdef DALI_DYNAMICS_SUPPORT - Internal::DynamicsSphereShapePtr internal( new Internal::DynamicsSphereShape( radius ) ); - - return DynamicsShape(internal.Get()); -#else - return DynamicsShape(); -#endif -} - -DynamicsShape::DynamicsShape() -{ -} - -DynamicsShape::~DynamicsShape() -{ -} - -DynamicsShape::DynamicsShape(const DynamicsShape& handle) -: BaseHandle(handle) -{ -} - -DynamicsShape& DynamicsShape::operator=(const DynamicsShape& rhs) -{ - BaseHandle::operator=(rhs); - return *this; -} - -DynamicsShape::DynamicsShape(Internal::DynamicsShape* internal) -#ifdef DALI_DYNAMICS_SUPPORT -: BaseHandle(internal) -#else -: BaseHandle(NULL) -#endif -{ -} - -DynamicsShape::ShapeType DynamicsShape::GetType() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetType(); -#else - return DynamicsShape::CAPSULE; -#endif -} - -} // namespace Dali diff --git a/dali/devel-api/dynamics/dynamics-shape.h b/dali/devel-api/dynamics/dynamics-shape.h deleted file mode 100644 index 3c00ee1..0000000 --- a/dali/devel-api/dynamics/dynamics-shape.h +++ /dev/null @@ -1,150 +0,0 @@ -#ifndef __DALI_DYNAMICS_SHAPE_H__ -#define __DALI_DYNAMICS_SHAPE_H__ - -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include - -// BASE CLASS INCLUDES -#include - -namespace Dali -{ - -namespace Internal DALI_INTERNAL -{ -class DynamicsShape; -} // namespace Internal - -class DynamicsWorld; - -/** - * @brief Defines the shape of an object in the simulation. - */ -class DALI_IMPORT_API DynamicsShape : public BaseHandle -{ -public: - /** - * @brief The types of shape available. - */ - enum ShapeType - { - CAPSULE = 0, ///< A capsule (a cylinder capped with half spheres) defined by the radius of the caps and its height (the height is to the center of the caps) - CONE, ///< A cone defined by the radius of its base and its height - CUBE, ///< A cube defined by width,height and depth - CYLINDER, ///< A cylinder defined by the radius of its ends and its height - SPHERE, ///< A sphere defined by its radius - }; // enum ShapeType - -public: - /** - * @brief Creates a capsule. (A cylinder capped with half spheres) - * - * @param[in] radius The radius of the capsule. - * @param[in] length The length of the capsule. - * @return a handle to the new shape. - */ - static DynamicsShape NewCapsule(const float radius, const float length); - - /** - * @brief Creates a cone. - * - * @param[in] radius The radius of the cone. - * @param[in] length The length of the cone. - * @return a handle to the new shape. - */ - static DynamicsShape NewCone(const float radius, const float length); - - /** - * @brief Creates a cube shape. - * - * All angles are right angles, and opposite faces are equal. - * @param[in] dimensions The dimensions of the cuboid ( width, height and depth ). - * @return A handle to the new shape - */ - static DynamicsShape NewCube(const Vector3& dimensions); - - /** - * @brief Creates a cylinder. - * - * @param[in] radius The radius of the cylinder. - * @param[in] length The length of the cylinder. - * @return A handle to the new shape - */ - static DynamicsShape NewCylinder(const float radius, const float length); - - /** - * @brief Creates a sphere. - * - * @param[in] radius The radius of the sphere. - * @return A handle to the new shape - */ - static DynamicsShape NewSphere(const float radius); - -public: - /** - * @brief Constructor which creates an uninitialized DynamicsShape handle. - * - * Use one of the DynamicsShape::New methods to initialise the handle. - */ - DynamicsShape(); - - /** - * @brief Destructor - * - * This is non-virtual since derived Handle types must not contain data or virtual methods. - */ - ~DynamicsShape(); - - /** - * @brief This copy constructor is required for (smart) pointer semantics. - * - * @param [in] handle A reference to the copied handle - */ - DynamicsShape(const DynamicsShape& handle); - - /** - * @brief This assignment operator is required for (smart) pointer semantics. - * - * @param [in] rhs A reference to the copied handle - * @return A reference to this - */ - DynamicsShape& operator=(const DynamicsShape& rhs); - -public: - /** - * @brief Get the type of shape. - * - * @return One of the ShapeType enumeration. - */ - ShapeType GetType() const; - - // Not intended for application developers -public: - /** - * @brief This constructor is used by Dali New() methods. - * - * @param [in] internal A pointer to a newly allocated Dali resource - */ - explicit DALI_INTERNAL DynamicsShape(Internal::DynamicsShape* internal); -}; // class DynamicsShape - -} // namespace Dali - -#endif /* __DALI_DYNAMICS_SHAPE_H__ */ diff --git a/dali/devel-api/dynamics/dynamics-world-config.cpp b/dali/devel-api/dynamics/dynamics-world-config.cpp deleted file mode 100644 index e158fcd..0000000 --- a/dali/devel-api/dynamics/dynamics-world-config.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// INTERNAL HEADERS -#ifdef DALI_DYNAMICS_SUPPORT -#include -#endif - -namespace Dali -{ - -DynamicsWorldConfig DynamicsWorldConfig::New() -{ -#ifdef DALI_DYNAMICS_SUPPORT - Internal::DynamicsWorldConfigPtr internal( new Internal::DynamicsWorldConfig() ); - - return DynamicsWorldConfig( internal.Get() ); -#else - return DynamicsWorldConfig(); -#endif -} - -DynamicsWorldConfig::DynamicsWorldConfig() -{ -} - -DynamicsWorldConfig::~DynamicsWorldConfig() -{ -} - -DynamicsWorldConfig::DynamicsWorldConfig(const DynamicsWorldConfig& handle) -: BaseHandle(handle) -{ -} - -DynamicsWorldConfig& DynamicsWorldConfig::operator=(const DynamicsWorldConfig& rhs) -{ - BaseHandle::operator=(rhs); - return *this; -} - -void DynamicsWorldConfig::SetType( const DynamicsWorldConfig::WorldType type ) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetType( type ); -#endif -} - -DynamicsWorldConfig::WorldType DynamicsWorldConfig::GetType() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetType(); -#else - return DynamicsWorldConfig::RIGID; -#endif -} - -void DynamicsWorldConfig::SetUnit(float unit) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetUnit( unit ); -#endif -} - -float DynamicsWorldConfig::GetUnit() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetUnit(); -#else - return float(); -#endif -} - -void DynamicsWorldConfig::SetSimulationSubSteps(int subSteps) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetSimulationSubSteps( subSteps ); -#endif -} - -int DynamicsWorldConfig::GetSimulationSubSteps() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetSimulationSubSteps(); -#else - return int(); -#endif -} - -DynamicsWorldConfig::DynamicsWorldConfig( Internal::DynamicsWorldConfig* internal ) -#ifdef DALI_DYNAMICS_SUPPORT -: BaseHandle(internal) -#else -: BaseHandle(NULL) -#endif -{ -} - -} // namespace Dali diff --git a/dali/devel-api/dynamics/dynamics-world-config.h b/dali/devel-api/dynamics/dynamics-world-config.h deleted file mode 100644 index c973876..0000000 --- a/dali/devel-api/dynamics/dynamics-world-config.h +++ /dev/null @@ -1,155 +0,0 @@ -#ifndef __DALI_DYNAMICS_WORLD_CONFIG_H__ -#define __DALI_DYNAMICS_WORLD_CONFIG_H__ - -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include - -// BASE CLASS INCLUDES -#include - -namespace Dali -{ - -struct Vector3; - -namespace Internal DALI_INTERNAL -{ -class DynamicsWorldConfig; -} // namespace Internal - -/** - * @brief Describes the requirements/capabilities of a physics siumlation encapsulated by a DynamicsWorld. - */ -class DALI_IMPORT_API DynamicsWorldConfig : public BaseHandle -{ -public: - /** - * @brief Enumeration specifying the capabilities required by the dynamics simulation. - */ - enum WorldType - { - RIGID, ///< Adds rigid body dynamics (gravity, mass, velocity, friction) - SOFT, ///< Adds soft body dynamics - implies RIGID - }; // enum WorldType - - -public: - - /** - * @brief Create a new DynamicsWorld configuration object. - * - * All values are set to default values. - * @return A handle to the new DynamicsWorld configuration object. - */ - static DynamicsWorldConfig New(); - - /** - * @brief Default constructor, creates an uninitalized handle. - */ - DynamicsWorldConfig(); - - /** - * @brief Destructor - * - * This is non-virtual since derived Handle types must not contain data or virtual methods. - */ - ~DynamicsWorldConfig(); - - /** - * @brief This copy constructor is required for (smart) pointer semantics. - * - * @param [in] handle A reference to the copied handle - */ - DynamicsWorldConfig(const DynamicsWorldConfig& handle); - - /** - * @brief This assignment operator is required for (smart) pointer semantics. - * - * @param [in] rhs A reference to the copied handle - * @return A reference to this - */ - DynamicsWorldConfig& operator=(const DynamicsWorldConfig& rhs); - -public: - /** - * @brief Set the type of Dynamics world required for the application. - * - * @param[in] type A member of WorldType enumeration. - */ - void SetType( const WorldType type ); - - /** - * @brief Get the type of Dynamics World specified by the Configuration. - * - * @return A member of WorldType enumeration. - */ - WorldType GetType() const; - - /** - * @brief Set the world unit. - * - * The simulation units are in meters - * The entire simulation can be scaled by changing the world unit - * EG calling SetUnit(0.01f) will scale to centimeters - * position (Actor::SetPosition...), forces (DynamicsBody::SetLinearVelocity...) and sizes (DynamicsShape...) passed to the simulation - * @param[in] unit The world unit [default: 0.01f - 1 DALi unit == 1 simulation centimeter] - */ - void SetUnit(float unit); - - /** - * @brief Get the current world unit. - * - * @return The current world unit - * @ref SetUnit - */ - float GetUnit() const; - - /** - * @brief Set the number of simulation steps / DALi update tick. - * - * Use this to advance the simulation in smaller time steps, thus gaining a more accurate - * simulation for collision detection. - * Example: assume DAli is updating at 60Hz (16.667ms / update) - * Setting subSteps to 1 will update the simulation once per DALi update. - * Setting subSteps to 4 will perform 4 simulation updates per DALi update each with a time step of Approx 4.2ms. - * @param[in] subSteps The number of simulation steps per update tick - */ - void SetSimulationSubSteps(int subSteps); - - /** - * @brief Get the number of simulation steps / DALi update tick. - * - * @return The number of simulation steps per update tick - */ - int GetSimulationSubSteps() const; - - // Not intended for application developers -private: - /** - * @brief This constructor is used internally by Dali. - * - * @param [in] internal A pointer to a newly allocated Dali resource - */ - explicit DALI_INTERNAL DynamicsWorldConfig( Internal::DynamicsWorldConfig* internal ); -}; // class DynamicsWorldConfig - -} // namespace Dali - -#endif /* __DALI_DYNAMICS_WORLD_CONFIG_H__ */ diff --git a/dali/devel-api/dynamics/dynamics-world.cpp b/dali/devel-api/dynamics/dynamics-world.cpp deleted file mode 100644 index dcb0b0d..0000000 --- a/dali/devel-api/dynamics/dynamics-world.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// INTERNAL HEADERS -#include -#include - -#ifdef DALI_DYNAMICS_SUPPORT -#include -#include -#include -#include -#endif - -namespace Dali -{ - -#ifndef DALI_DYNAMICS_SUPPORT -DynamicsWorld::CollisionSignalType STUB_COLLISION_SIGNAL; -#endif - -DynamicsWorld::DynamicsWorld() -{ -} - -DynamicsWorld::~DynamicsWorld() -{ -} - -DynamicsWorld::DynamicsWorld(const DynamicsWorld& handle) -: BaseHandle(handle) -{ -} - -DynamicsWorld& DynamicsWorld::operator=(const DynamicsWorld& rhs) -{ - BaseHandle::operator=(rhs); - return *this; -} - -DynamicsWorld DynamicsWorld::GetInstance( DynamicsWorldConfig configuration ) -{ -#ifdef DALI_DYNAMICS_SUPPORT - Internal::DynamicsWorldConfigPtr configImpl( &( GetImplementation( configuration ) ) ); - - return DynamicsWorld( Internal::DynamicsWorld::GetInstance( configImpl ).Get() ); -#else - return DynamicsWorld(); -#endif -} - -DynamicsWorld DynamicsWorld::Get() -{ -#ifdef DALI_DYNAMICS_SUPPORT - Internal::DynamicsWorld* dynamicsWorld = Internal::DynamicsWorld::Get().Get(); - DALI_ASSERT_ALWAYS( dynamicsWorld && "DynamicsWorld doesn't exist" ); - return DynamicsWorld( dynamicsWorld ); -#else - return DynamicsWorld(); -#endif -} - -void DynamicsWorld::DestroyInstance() -{ -#ifdef DALI_DYNAMICS_SUPPORT - Internal::DynamicsWorld::DestroyInstance(); -#endif -} - -void DynamicsWorld::SetGravity(const Vector3& gravity ) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetGravity(gravity); -#endif -} - -const Vector3& DynamicsWorld::GetGravity() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetGravity(); -#else - return Vector3::ZERO; -#endif -} - -int DynamicsWorld::GetDebugDrawMode() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).GetDebugDrawMode(); -#else - return int(); -#endif -} - -void DynamicsWorld::SetDebugDrawMode(int mode) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetDebugDrawMode( mode ); -#endif -} - -void DynamicsWorld::SetRootActor(Actor actor) -{ -#ifdef DALI_DYNAMICS_SUPPORT - GetImplementation(*this).SetRootActor( &GetImplementation(actor) ); -#endif -} - -Actor DynamicsWorld::GetRootActor() const -{ -#ifdef DALI_DYNAMICS_SUPPORT - Internal::ActorPtr actor( GetImplementation(*this).GetRootActor() ); - - DALI_ASSERT_DEBUG(actor || "Root Actor has not been set"); - - return Actor(actor.Get()); -#else - return Actor(); -#endif -} - -DynamicsWorld::CollisionSignalType& DynamicsWorld::CollisionSignal() -{ -#ifdef DALI_DYNAMICS_SUPPORT - return GetImplementation(*this).CollisionSignal(); -#else - return STUB_COLLISION_SIGNAL; -#endif -} - -DynamicsWorld::DynamicsWorld( Internal::DynamicsWorld* internal ) -#ifdef DALI_DYNAMICS_SUPPORT -: BaseHandle(internal) -#else -: BaseHandle(NULL) -#endif -{ -} - -} // namespace Dali diff --git a/dali/devel-api/dynamics/dynamics-world.h b/dali/devel-api/dynamics/dynamics-world.h deleted file mode 100644 index 6ac7109..0000000 --- a/dali/devel-api/dynamics/dynamics-world.h +++ /dev/null @@ -1,245 +0,0 @@ -#ifndef __DALI_DYNAMICS_WORLD_H__ -#define __DALI_DYNAMICS_WORLD_H__ - -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include - -// BASE CLASS INCLUDES -#include - -// INTERNAL INCLUDES -#include -#include - -namespace Dali -{ - -namespace Internal DALI_INTERNAL -{ -class DynamicsWorld; -} // namespace Internal - -class Actor; -class DynamicsBody; -class DynamicsCollision; -class DynamicsJoint; -class DynamicsShape; - -/** - * @brief DynamicsWorld gives the application developer an alternative method of moving and rotating. - * actors in the DALi scene. - * - * Actors are represented by DynamicsBody objects in the dynamics simulation and are moved by - * forces (eg gravity). Dynamics also allows collisions between objects to be - * detected and responded to in signal handlers. - * - * DALi will update the physics simulation after animations and constraints, thus dynamics forces - * will override positions and orientations applied by animations and constrints. - * - * Here is an example illustrating the basic steps to initialise the simulation and - * add a rigid body. - * - * @code - * // Initialize and get a handle to the Dali::DynamicsWorld - * Dali::DynamicsWorldConfig worldConfig( Dali::DynamicsWorldConfig::New() ); - * Dali::DynamicsWorld dynamicsWorld( Dali::Stage::GetCurrent().InitializeDynamics( worldConfig ) ); - * - * // Create an actor to represent the world and act as a parent to DynamicsBody instances - * Dali::Actor dynamicsRootActor( Dali::Actor::New() ); - * dynamicsRootActor.SetParentOrigin( Dali::ParentOrigin::CENTER ); - * dynamicsWorld.SetRootActor( dynamicsRootActor ); - * Dali::Stage::GetCurrent().Add( dynamicsRootActor ); - * - * // create an actor to represent a rigid body - * Dali::Actor actor( Dali::Actor::New() ); - * actor.SetParentOrigin( Dali::ParentOrigin::CENTER ); - * - * // Enable dynamics for the actor, creating a rigid body with default configuration - * actor.EnableDynamics( Dali::DynamicsBodyConfig::New() ); - * - * // Add the actor to the scene - * dynamicsRootActor.Add( actor ); - * @endcode - * - * Signals - * | %Signal Name | Method | - * |---------------------------|----------------------------| - * | collision | @ref CollisionSignal() | - */ -class DALI_IMPORT_API DynamicsWorld : public BaseHandle -{ -public: - - // signals - typedef Signal< void ( DynamicsWorld, const DynamicsCollision ) > CollisionSignalType; ///< Type of collision signal - -public: - /** - * @brief Debug modes - */ - enum DEBUG_MODES - { - DEBUG_MODE_NONE = 0, - DEBUG_MODE_WIREFRAME = (1<<0), - DEBUG_MODE_FAST_WIREFRAME = (1<<1), - DEBUG_MODE_AABB = (1<<2), - DEBUG_MODE_CONTACT_POINTS = (1<<3), - DEBUG_MODE_NO_DEACTIVATION = (1<<4), - DEBUG_MODE_CONSTRAINTS = (1<<5), - DEBUG_MODE_CONSTRAINTS_LIMITS = (1<<6), - DEBUG_MODES_NORMALS = (1<<7), - }; - -public: - /** - * @brief Create an uninitialized DynamicsWorld handle. - */ - DynamicsWorld(); - - /** - * @brief Destructor - * - * This is non-virtual since derived Handle types must not contain data or virtual methods. - */ - ~DynamicsWorld(); - - /** - * @brief This copy constructor is required for (smart) pointer semantics. - * - * @param [in] handle A reference to the copied handle - */ - DynamicsWorld(const DynamicsWorld& handle); - - /** - * @brief This assignment operator is required for (smart) pointer semantics. - * - * @param [in] rhs A reference to the copied handle - * @return A reference to this - */ - DynamicsWorld& operator=(const DynamicsWorld& rhs); - - /** - * @brief Static / singleton creator and getter. - * Initialise the Dynamics simulation and create a DynamicsWorld object. - * - * Only one instance of DynamicsWorld will be created, so calling this method multiple times - * will return the same DynamicsWorld object. - * - * If an instance already exists, it is returned regardless of configuration being passed in. - * - * @param[in] configuration A DynamicsWorldConfig object describing the required capabilities of the dynamics world. - * @return A handle to the world object of the dynamics simulation, or an empty handle if Dynamics is not capable - * of supporting a requirement in the configuration as it is not available on the platform. - */ - static DynamicsWorld GetInstance( DynamicsWorldConfig configuration ); - - /** - * @brief Static / singleton getter. - * Get a handle to the world object of the dynamics simulation. - * - * Does not create an instance, use only if the instance is known to exist. - * - * @return A pointer to the dynamics world if it is installed. - */ - static DynamicsWorld Get(); - - /** - * @brief Static instance cleanup. - * Terminate the dynamics simulation. - * - * Calls Actor::DisableDynamics on all dynamics enabled actors, - * all handles to any DynamicsBody or DynamicsJoint objects held by applications - * will become detached from their actors and the simulation therefore should be discarded. - */ - static void DestroyInstance(); - -// Methods that modify the simulation -public: - - /** - * @brief Set the gravity for the world. - * - * @param[in] gravity a Vector3 specifying the applicable gravity for the world. - */ - void SetGravity( const Vector3& gravity ); - - /** - * @brief Get the gravity for the world. - * - * @return A Vector3 specifying the gravity that will be applied in the world. - */ - const Vector3& GetGravity() const; - - /** - * @brief Get the current debug drawmode. - * - * @return A combination of the flags in DEBUG_MODES or 0 if debug drawing is currently disabled. - */ - int GetDebugDrawMode() const; - - /** - * @brief Set the debug drawmode for the simulation. - * - * @param[in] mode A combination of the flags in DEBUG_MODES or 0 to disable debug drawing - */ - void SetDebugDrawMode(int mode); - - /** - * @brief Set the actor which will represent the dynamics world. - * - * All actors that will participate in the dynamics simulation must be direct children of this actor - * @param[in] actor The root actor for the dynamics simulation - */ - void SetRootActor(Actor actor); - - /** - * @brief Get the root actor for the simulation. - * - * @return The root actor for the dynamics simulation - */ - Actor GetRootActor() const; - -public: // Signals - - /** - * @brief This signal is emitted when a collision is detected between two DynamicsBodies. - * - * A callback of the following type may be connected: - * @code - * void YourCollisionHandler(Dali::DynamicsWorld world, const Dali::DynamicsCollision collisionData); - * @endcode - * - * @return The signal to connect to. - */ - CollisionSignalType& CollisionSignal(); - -public: // Not intended for application developers - - /** - * @brief This constructor is used internally by Dali. - * - * @param [in] internal A pointer to a newly allocated Dali resource - */ - explicit DALI_INTERNAL DynamicsWorld( Internal::DynamicsWorld* internal ); -}; - -} // namespace Dali - -#endif // __DALI_DYNAMICS_WORLD_H__ diff --git a/dali/devel-api/dynamics/dynamics.h b/dali/devel-api/dynamics/dynamics.h deleted file mode 100644 index 59282ec..0000000 --- a/dali/devel-api/dynamics/dynamics.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __DALI_DYNAMICS_H__ -#define __DALI_DYNAMICS_H__ - -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include -#include -#include -#include -#include -#include - -#endif //__DALI_DYNAMICS_H__ diff --git a/dali/devel-api/file.list b/dali/devel-api/file.list index a3126f0..c2e681d 100644 --- a/dali/devel-api/file.list +++ b/dali/devel-api/file.list @@ -4,13 +4,6 @@ devel_api_src_files = \ $(devel_api_src_dir)/animation/path-constrainer.cpp \ $(devel_api_src_dir)/common/hash.cpp \ $(devel_api_src_dir)/common/mutex.cpp \ - $(devel_api_src_dir)/dynamics/dynamics-body.cpp \ - $(devel_api_src_dir)/dynamics/dynamics-body-config.cpp \ - $(devel_api_src_dir)/dynamics/dynamics-collision.cpp \ - $(devel_api_src_dir)/dynamics/dynamics-joint.cpp \ - $(devel_api_src_dir)/dynamics/dynamics-shape.cpp \ - $(devel_api_src_dir)/dynamics/dynamics-world.cpp \ - $(devel_api_src_dir)/dynamics/dynamics-world-config.cpp \ $(devel_api_src_dir)/events/hit-test-algorithm.cpp \ $(devel_api_src_dir)/images/atlas.cpp \ $(devel_api_src_dir)/images/distance-field.cpp \ @@ -34,16 +27,6 @@ devel_api_core_common_header_files = \ $(devel_api_src_dir)/common/ref-counted-dali-vector.h \ $(devel_api_src_dir)/common/set-wrapper.h -devel_api_core_dynamics_header_files = \ - $(devel_api_src_dir)/dynamics/dynamics.h \ - $(devel_api_src_dir)/dynamics/dynamics-body.h \ - $(devel_api_src_dir)/dynamics/dynamics-body-config.h \ - $(devel_api_src_dir)/dynamics/dynamics-collision.h \ - $(devel_api_src_dir)/dynamics/dynamics-joint.h \ - $(devel_api_src_dir)/dynamics/dynamics-shape.h \ - $(devel_api_src_dir)/dynamics/dynamics-world.h \ - $(devel_api_src_dir)/dynamics/dynamics-world-config.h - devel_api_core_events_header_files = \ $(devel_api_src_dir)/events/hit-test-algorithm.h diff --git a/dali/integration-api/core.h b/dali/integration-api/core.h index c70edef..8b2dae0 100644 --- a/dali/integration-api/core.h +++ b/dali/integration-api/core.h @@ -53,13 +53,12 @@ namespace KeepUpdating { enum Reasons { - NOT_REQUESTED = 0x00, ///< Zero means that no further updates are required - STAGE_KEEP_RENDERING = 0x01, ///< - Stage::KeepRendering() is being used - ANIMATIONS_RUNNING = 0x02, ///< - Animations are ongoing - DYNAMICS_CHANGED = 0x04, ///< - A dynamics simulation is running - LOADING_RESOURCES = 0x08, ///< - Resources are being loaded - MONITORING_PERFORMANCE = 0x10, ///< - The --enable-performance-monitor option is being used - RENDER_TASK_SYNC = 0x20 ///< - A render task is waiting for render sync + NOT_REQUESTED = 0, ///< Zero means that no further updates are required + STAGE_KEEP_RENDERING = 1<<1, ///< - Stage::KeepRendering() is being used + ANIMATIONS_RUNNING = 1<<2, ///< - Animations are ongoing + LOADING_RESOURCES = 1<<3, ///< - Resources are being loaded + MONITORING_PERFORMANCE = 1<<4, ///< - The --enable-performance-monitor option is being used + RENDER_TASK_SYNC = 1<<5 ///< - A render task is waiting for render sync }; } diff --git a/dali/integration-api/debug.cpp b/dali/integration-api/debug.cpp index 1185139..dd62a17 100644 --- a/dali/integration-api/debug.cpp +++ b/dali/integration-api/debug.cpp @@ -129,7 +129,6 @@ Filter* Filter::gNode = NULL; Filter* Filter::gElement = NULL; Filter* Filter::gActor = Filter::New(Debug::Concise, false, "LOG_ACTOR"); Filter* Filter::gShader = Filter::New(Debug::Concise, false, "LOG_SHADER"); -Filter* Filter::gDynamics = Filter::New(Debug::Concise, false, "LOG_DYNAMICS"); Filter::FilterList* Filter::GetActiveFilters() { diff --git a/dali/integration-api/debug.h b/dali/integration-api/debug.h index 38deddd..8b17e38 100644 --- a/dali/integration-api/debug.h +++ b/dali/integration-api/debug.h @@ -251,7 +251,6 @@ public: static Filter *gElement; static Filter *gActor; static Filter *gShader; - static Filter *gDynamics; private: LogLevel mLoggingLevel; diff --git a/dali/integration-api/dynamics/dynamics-body-intf.h b/dali/integration-api/dynamics/dynamics-body-intf.h deleted file mode 100644 index c4cc943..0000000 --- a/dali/integration-api/dynamics/dynamics-body-intf.h +++ /dev/null @@ -1,131 +0,0 @@ -#ifndef __DALI_INTEGRATION_DYNAMICS_BODY_INTF_H__ -#define __DALI_INTEGRATION_DYNAMICS_BODY_INTF_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// INTERNAL INCLUDES -#include -#include - -namespace Dali -{ - -class Quaternion; -struct Vector3; - -namespace Integration -{ - -struct DynamicsBodySettings; -class DynamicsShape; -class DynamicsWorld; - -class DALI_IMPORT_API DynamicsBody -{ -public: - /** - * Destructor - */ - virtual ~DynamicsBody() {} - - /** - * Initialize the body - * @param[in] settings Configuration parameters for the new body - * @param[in] shape The collision shape for the body - * ~param[in] dynamicsWorld The dynamics world - * @param[in] startPosition The initial position for the body - * @param[in] startRotation The initial rotation of the body - */ - virtual void Initialize( const DynamicsBodySettings& settings, DynamicsShape* shape, - Integration::DynamicsWorld& dynamicsWorld, - const Vector3& startPosition, const Quaternion& startRotation ) = 0; - - /** - * Set the mass - * @param[in] mass The new mass for the body - */ - virtual void SetMass(const float mass) = 0; - - ///@ copydoc Dali::DynamicsBody::SetElasticity - virtual void SetElasticity(const float elasticity) = 0; - - /// @copydoc Dali::DynamicsBody::SetLinearVelocity - virtual void SetLinearVelocity(const Vector3& velocity) = 0; - - /// @copydoc Dali::DynamicsBody::GetLinearVelocity - virtual Vector3 GetLinearVelocity() const = 0; - - /// @copydoc Dali::DynamicsBody::SetAngularVelocity - virtual void SetAngularVelocity(const Vector3& velocity) = 0; - - /// @copydoc Dali::DynamicsBody::SetLinearVelocity - virtual Vector3 GetAngularVelocity() const = 0; - - /// @copydoc Dali::DynamicsBody::SetKinematic - virtual void SetKinematic(bool flag ) = 0; - - /// @copydoc Dali::DynamicsBody::IsKinematic - virtual bool IsKinematic() const = 0; - - /// @copydoc Dali::DynamicsBody::SetSleepEnabled - virtual void SetSleepEnabled(bool flag) = 0; - - /// @copydoc Dali::DynamicsBody::WakeUp - virtual void WakeUp() = 0; - - /// @copydoc Dali::DynamicsBody::AddAnchor - virtual void AddAnchor( unsigned int index, const DynamicsBody* anchorBody, const bool collisions ) = 0; - - /// @copydoc Dali::DynamicsBody::ConserveVolume - virtual void ConserveVolume( bool flag ) = 0; - - /// @copydoc Dali::DynamicsBody::ConserveShape - virtual void ConserveShape( bool flag ) = 0; - - /// @copydoc Dali::DynamicsBody::GetCollisionGroup - virtual short int GetCollisionGroup() const = 0; - - /// @copydoc Dali::DynamicsBody::SetCollisionGroup - virtual void SetCollisionGroup( short int collisionGroup ) = 0; - - /// @copydoc Dali::DynamicsBody::GetCollisionMask - virtual short int GetCollisionMask() const = 0; - - /// @copydoc Dali::DynamicsBody::SetCollisionMask - virtual void SetCollisionMask( short int collisionMask ) = 0; - - virtual int GetType() const = 0; - - virtual bool IsActive() const = 0; - - virtual void SetTransform( const Vector3& position, const Quaternion& rotation ) = 0; - virtual void GetTransform( Vector3& position, Quaternion& rotation ) = 0; - - /** - * Get the vertices and normal from a soft body - * @param[in,out] meshData A MeshData object with preallocated space for all the vertices. - */ - virtual void GetSoftVertices( Geometry geometry ) const = 0; - -}; // class DynamicsBody - - } //namespace Integration - -} //namespace Dali - -#endif // __DALI_INTEGRATION_DYNAMICS_BODY_INTF_H__ diff --git a/dali/integration-api/dynamics/dynamics-body-settings.h b/dali/integration-api/dynamics/dynamics-body-settings.h deleted file mode 100644 index a119c45..0000000 --- a/dali/integration-api/dynamics/dynamics-body-settings.h +++ /dev/null @@ -1,140 +0,0 @@ -#ifndef __DALI_INTEGRATION_DYNAMICS_BODY_SETTINGS_H__ -#define __DALI_INTEGRATION_DYNAMICS_BODY_SETTINGS_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// INTERNAL INCLUDES -#include -#include - -namespace Dali -{ - -namespace Integration -{ - -extern const float DEFAULT_DYNAMICS_BODY_MASS; -extern const float DEFAULT_DYNAMICS_BODY_ELASTICITY; -extern const float DEFAULT_DYNAMICS_BODY_FRICTION; -extern const float DEFAULT_DYNAMICS_BODY_LINEAR_DAMPING; -extern const float DEFAULT_DYNAMICS_BODY_ANGULAR_DAMPING; -extern const float DEFAULT_DYNAMICS_BODY_LINEAR_SLEEP_VELOCITY; -extern const float DEFAULT_DYNAMICS_BODY_ANGULAR_SLEEP_VELOCITY; -extern const float DEFAULT_DYNAMICS_LINEAR_STIFFNESS; -extern const float DEFAULT_DYNAMICS_ANCHOR_HARDNESS; - -/** - * Simple structure encapsulating the body configuration settings - * This structure is copyable - */ -struct DALI_IMPORT_API DynamicsBodySettings -{ -public: - - /** - * Constructor. - */ - DynamicsBodySettings() - : type( Dali::DynamicsBodyConfig::RIGID ), - mass(DEFAULT_DYNAMICS_BODY_MASS), - elasticity(DEFAULT_DYNAMICS_BODY_ELASTICITY), - friction(DEFAULT_DYNAMICS_BODY_FRICTION), - linearDamping(DEFAULT_DYNAMICS_BODY_LINEAR_DAMPING), - angularDamping(DEFAULT_DYNAMICS_BODY_ANGULAR_DAMPING), - linearSleepVelocity(DEFAULT_DYNAMICS_BODY_LINEAR_SLEEP_VELOCITY), - angularSleepVelocity(DEFAULT_DYNAMICS_BODY_ANGULAR_SLEEP_VELOCITY), - collisionGroup(Dali::DynamicsBodyConfig::COLLISION_FILTER_DEFAULT), - collisionMask(Dali::DynamicsBodyConfig::COLLISION_FILTER_ALL), - isCollisionFilterSet(false), - linearStiffness(DEFAULT_DYNAMICS_LINEAR_STIFFNESS), - anchorHardness(DEFAULT_DYNAMICS_ANCHOR_HARDNESS), - volumeConservation(0.0f), - shapeConservation(0.0f) - { - } - - DynamicsBodySettings(const DynamicsBodySettings& original) - : type(original.type), - mass(original.mass), - elasticity(original.elasticity), - friction(original.friction), - linearDamping(original.linearDamping), - angularDamping(original.angularDamping), - linearSleepVelocity(original.linearSleepVelocity), - angularSleepVelocity(original.angularSleepVelocity), - collisionGroup(original.collisionGroup), - collisionMask(original.collisionMask), - isCollisionFilterSet(original.isCollisionFilterSet), - linearStiffness(original.linearStiffness), - anchorHardness(original.anchorHardness), - volumeConservation(original.volumeConservation), - shapeConservation(original.shapeConservation) - { - } - - DynamicsBodySettings& operator=(const DynamicsBodySettings& rhs) - { - if( this != &rhs ) - { - type = rhs.type; - mass = rhs.mass; - elasticity = rhs.elasticity; - friction = rhs.friction; - linearDamping = rhs.linearDamping; - angularDamping = rhs.angularDamping; - linearSleepVelocity = rhs.linearSleepVelocity; - angularSleepVelocity = rhs.angularSleepVelocity; - collisionGroup = rhs.collisionGroup; - collisionMask = rhs.collisionMask; - isCollisionFilterSet = rhs.isCollisionFilterSet; - linearStiffness = rhs.linearStiffness; - anchorHardness = rhs.anchorHardness; - volumeConservation = rhs.volumeConservation; - shapeConservation = rhs.shapeConservation; - } - - return *this; - } - - ~DynamicsBodySettings() - { - } - -// attributes - Dali::DynamicsBodyConfig::BodyType type; ///< Type of dynamics body (Collision, Rigid, Soft) - float mass; - float elasticity; - float friction; - float linearDamping; - float angularDamping; - float linearSleepVelocity; ///< Linear velocity below which sleeping is updated - float angularSleepVelocity; ///< Angular velocity below which sleeping is updated - short int collisionGroup; - short int collisionMask; - bool isCollisionFilterSet; - float linearStiffness; - float anchorHardness; - float volumeConservation; - float shapeConservation; -}; // struct DynamicsBodySettings - -} // namespace Integration - -} // namespace Dali - -#endif // __DALI_INTEGRATION_DYNAMICS_BODY_SETTINGS_H__ diff --git a/dali/integration-api/dynamics/dynamics-collision-data.h b/dali/integration-api/dynamics/dynamics-collision-data.h deleted file mode 100644 index d1faabf..0000000 --- a/dali/integration-api/dynamics/dynamics-collision-data.h +++ /dev/null @@ -1,94 +0,0 @@ -#ifndef __DALI_INTEGRATION_DYNAMICS_COLLISION_DATA_H__ -#define __DALI_INTEGRATION_DYNAMICS_COLLISION_DATA_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -//INTERNAL HEADERS -#include - -namespace Dali -{ - -struct Vector3; - -namespace Integration -{ - -class DynamicsBody; - -struct DynamicsCollisionData -{ -public: - DynamicsCollisionData(DynamicsBody* bodyA, DynamicsBody* bodyB, const Vector3& pointOnA, const Vector3& pointOnB, const Vector3& normal, const float impact) - : mBodyA(bodyA), - mBodyB(bodyB), - mPointOnA(pointOnA), - mPointOnB(pointOnB), - mNormal(normal), - mImpact(impact) - { - } - - DynamicsCollisionData(const DynamicsCollisionData& rhs) - : mBodyA(rhs.mBodyA), - mBodyB(rhs.mBodyB), - mPointOnA(rhs.mPointOnA), - mPointOnB(rhs.mPointOnB), - mNormal(rhs.mNormal), - mImpact(rhs.mImpact) - { - } - - DynamicsCollisionData() - : mBodyA(NULL), - mBodyB(NULL), - mImpact(0.0f) - { - } - - ~DynamicsCollisionData() - { - } - - DynamicsCollisionData& operator=(const DynamicsCollisionData& rhs) - { - if( this != &rhs ) - { - mBodyA = rhs.mBodyA; - mBodyB = rhs.mBodyB; - mPointOnA = rhs.mPointOnA; - mPointOnB = rhs.mPointOnB; - mNormal = rhs.mNormal; - mImpact = rhs.mImpact; - } - return *this; - } - - DynamicsBody* mBodyA; - DynamicsBody* mBodyB; - Vector3 mPointOnA; - Vector3 mPointOnB; - Vector3 mNormal; - float mImpact; -}; // struct DynamicsCollisionData - -} // namespace Integration - -} // namespace Dali - -#endif // __DALI_INTEGRATION_DYNAMICS_COLLISION_DATA_H__ diff --git a/dali/integration-api/dynamics/dynamics-debug-vertex.h b/dali/integration-api/dynamics/dynamics-debug-vertex.h deleted file mode 100644 index 2e83a4b..0000000 --- a/dali/integration-api/dynamics/dynamics-debug-vertex.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef __DALI_INTEGRATION_DYNAMICS_DEBUG_VERTEX_H__ -#define __DALI_INTEGRATION_DYNAMICS_DEBUG_VERTEX_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// INTERNAL HEADERS -#include -#include -#include - -namespace Dali -{ - -namespace Integration -{ - -struct DynamicsDebugVertex -{ - Vector3 position; - Vector4 color; -}; // struct DynamicsDebugVertex - -typedef std::vector DynamicsDebugVertexContainer; - -} // namespace Integration - -} // namespace Dali - -#endif /* __DALI_INTEGRATION_DYNAMICS_DEBUG_VERTEX_H__ */ diff --git a/dali/integration-api/dynamics/dynamics-factory-intf.h b/dali/integration-api/dynamics/dynamics-factory-intf.h deleted file mode 100644 index e8b2564..0000000 --- a/dali/integration-api/dynamics/dynamics-factory-intf.h +++ /dev/null @@ -1,88 +0,0 @@ -#ifndef __DALI_INTEGRATION_DYNAMICS_FACTORY_INTF_H__ -#define __DALI_INTEGRATION_DYNAMICS_FACTORY_INTF_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -namespace Dali -{ - -namespace Integration -{ - -class DynamicsBody; -class DynamicsJoint; -class DynamicsShape; -class DynamicsWorld; -struct DynamicsWorldSettings; - -/** - * - */ -class DALI_IMPORT_API DynamicsFactory -{ -public: - - /** - * Destructor - */ - virtual ~DynamicsFactory() {} - - /** - * Initializes the dynamics simulation. Loads/links a dynamics library which can support - * all the features requested in worldSettings. - * @param[in] worldSettings Configuration data for the simulation. - * @return true if successful, otherwise false. - */ - virtual bool InitializeDynamics( const DynamicsWorldSettings& worldSettings ) = 0; - - /** - * Terminates the dynamics simulation. Unloads the dynamics library. - */ - virtual void TerminateDynamics() = 0; - - /** - * Create a DynamicsWorld object. - * @return A pointer to a DynamicsWorld object if successful, otherwise NULL. - */ - virtual DynamicsWorld* CreateDynamicsWorld() = 0; - - /** - * Create a DynamicsBody object. - * @return A pointer to a DynamicsBody object if successful, otherwise NULL. - */ - virtual DynamicsBody* CreateDynamicsBody( ) = 0; - - /** - * Create a DynamicsJoint object. - * @return A pointer to a DynamicsJoint object if successful, otherwise NULL. - */ - virtual DynamicsJoint* CreateDynamicsJoint() = 0; - - /** - * Create a DynamicsShape object. - * @return A pointer to a DynamicsShape object if successful, otherwise NULL. - */ - virtual DynamicsShape* CreateDynamicsShape() = 0; - -}; // class DynamicsFactory - -} // namespace Integration - -} // namespace Dali - -#endif // __DALI_INTEGRATION_DYNAMICS_FACTORY_INTF_H__ diff --git a/dali/integration-api/dynamics/dynamics-joint-intf.h b/dali/integration-api/dynamics/dynamics-joint-intf.h deleted file mode 100644 index 17dea82..0000000 --- a/dali/integration-api/dynamics/dynamics-joint-intf.h +++ /dev/null @@ -1,94 +0,0 @@ -#ifndef __DALI_INTEGRATION_DYNAMICS_JOINT_INTF_H__ -#define __DALI_INTEGRATION_DYNAMICS_JOINT_INTF_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// INTERNAL INCLUDES -#include - -namespace Dali -{ - -struct Vector3; -class Quaternion; - -namespace Integration -{ - -class DynamicsBody; - -/** - * - */ -class DALI_IMPORT_API DynamicsJoint -{ -public: - /** - * Destructor - */ - virtual ~DynamicsJoint() {} - - /** - * Initialize the joint - * @param[in] bodyA First body - * @param[in] positionA Position of first body - * @param[in] rotationA Orientation of first body - * @param[in] offsetA The offset (relative to bodyA) to the origin of the joint - * @param[in] bodyB Second body - * @param[in] positionA Position of second body - * @param[in] rotationA Orientation of second body - * @param[in] offsetB The offset (relative to bodyB) to the origin of the joint - */ - virtual void Initialize( DynamicsBody* bodyA, const Vector3& positionA, const Quaternion& rotationA, const Vector3& offsetA, - DynamicsBody* bodyB, const Vector3& positionB, const Quaternion& rotationB, const Vector3& offsetB ) = 0; - - /** - * Set the limits for the joint constraint - * @param[in] axisMask A number between 0 and 5 with 0 to 2 being Linear axis X, Y and Z and - * 3 to 5 being Angular axis X, Y and Z - * @param[in] low - */ - virtual void SetLimit( int axisIndex, float lowerLimit, float upperLimit ) = 0; - - /// @copydoc Dali::Internal::DynamicsJoint::EnableSpring - virtual void EnableSpring( int axisIndex, bool flag ) = 0; - - /// @copydoc Dali::Internal::DynamicsJoint::SetSpringStiffness - virtual void SetSpringStiffness( int axisIndex, float stiffness ) = 0; - - /// @copydoc Dali::Internal::DynamicsJoint::SetSpringDamping - virtual void SetSpringDamping( int axisIndex, float damping ) = 0; - - /// @copydoc Dali::Internal::DynamicsJoint::SetSpringCenterPoint - virtual void SetSpringCenterPoint( int axisIndex, float ratio ) = 0; - - /// @copydoc Dali::Internal::DynamicsJoint::EnableMotor - virtual void EnableMotor( int axisIndex, bool flag ) = 0; - - /// @copydoc Dali::Internal::DynamicsJoint::SetMotorVelocity - virtual void SetMotorVelocity( int axisIndex, float velocity ) = 0; - - /// @copydoc Dali::Internal::DynamicsJoint::SetMotorForce - virtual void SetMotorForce( int axisIndex, float force ) = 0; -}; // class DynamicsJoint - -} // namespace Integration - -} // namespace Dali - -#endif // __DALI_INTEGRATION_DYNAMICS_JOINT_INTF_H__ diff --git a/dali/integration-api/dynamics/dynamics-shape-intf.h b/dali/integration-api/dynamics/dynamics-shape-intf.h deleted file mode 100644 index d0aebfa..0000000 --- a/dali/integration-api/dynamics/dynamics-shape-intf.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef __DALI_INTEGRATION_DYNAMICS_SHAPE_INTF_H__ -#define __DALI_INTEGRATION_DYNAMICS_SHAPE_INTF_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// INTERNAL INCLUDES -#include -#include - -namespace Dali -{ - -struct Vector3; - - -namespace Integration -{ - -/** - * - */ -class DALI_IMPORT_API DynamicsShape -{ -public: - /** - * Destructor - */ - virtual ~DynamicsShape() {} - - /** - * Initialize the shape - */ - virtual void Initialize( int type, const Vector3& dimensions ) = 0; - - /** - * Initialize the shape - */ - virtual void Initialize( int type, Geometry geometry ) = 0; - -}; // class DynamicsShape - -} // namespace Integration - -} // namespace Dali - -#endif // __DALI_INTEGRATION_DYNAMICS_SHAPE_INTF_H__ diff --git a/dali/integration-api/dynamics/dynamics-world-intf.h b/dali/integration-api/dynamics/dynamics-world-intf.h deleted file mode 100644 index df9b2d7..0000000 --- a/dali/integration-api/dynamics/dynamics-world-intf.h +++ /dev/null @@ -1,104 +0,0 @@ -#ifndef __DALI_INTEGRATION_DYNAMICS_WORLD_INTF_H__ -#define __DALI_INTEGRATION_DYNAMICS_WORLD_INTF_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// INTERNAL INCLUDES -#include -#include - -namespace Dali -{ - -struct Vector3; - -namespace Integration -{ - -struct DynamicsCollisionData; -class DynamicsBody; -class DynamicsJoint; -class DynamicsWorld; -struct DynamicsWorldSettings; -typedef std::map CollisionDataContainer; - -DynamicsWorld* InitializeDynamics( DynamicsWorldSettings* settings ); - -/** - * @copydoc Dali::DynamicsWorld - */ -class DALI_IMPORT_API DynamicsWorld -{ -public: - /** - * Destructor - */ - virtual ~DynamicsWorld() {} - - virtual void Initialize( const DynamicsWorldSettings& worldSettings ) = 0; - - /** - * Add a body to the simulation - */ - virtual void AddBody(DynamicsBody* body) = 0; - - /** - * Remove a body from the simulation - */ - virtual void RemoveBody(DynamicsBody* body) = 0; - - /** - * Add a joint to the simulation - */ - virtual void AddJoint(DynamicsJoint* joint) = 0; - - /** - * Remove body from the simulation - */ - virtual void RemoveJoint(DynamicsJoint* joint) = 0; - - /// @copydoc Dali::DynamicsWorld::SetGravity - virtual void SetGravity( const Vector3& gravity ) = 0; - - /// @copydoc Dali::DynamicsWorld::SetDebugDrawMode - virtual void SetDebugDrawMode(int mode) = 0; - - /** - * Allow dynamics engine to do its debug drawing - */ - virtual const DynamicsDebugVertexContainer& DebugDraw() = 0; - - /** - * Update the simulation - * @param[in] elapsedSeconds The amount of time taht has elapsed since previous call - */ - virtual void Update( float elapsedSeconds ) = 0; - - /** - * Check for collisions between simulation objects - * @param[out] contacts A container which will be filled with the current collision/contact data - */ - virtual void CheckForCollisions( CollisionDataContainer& contacts ) = 0; - -}; // class DynamicsWorld - -} //namespace Integration - -} //namespace Dali - -#endif // __DALI_INTEGRATION_DYNAMICS_WORLD_INTF_H__ diff --git a/dali/integration-api/dynamics/dynamics-world-settings.h b/dali/integration-api/dynamics/dynamics-world-settings.h deleted file mode 100644 index 3e3d48e..0000000 --- a/dali/integration-api/dynamics/dynamics-world-settings.h +++ /dev/null @@ -1,101 +0,0 @@ -#ifndef __DALI_INTEGRATION_DYNAMICS_WORLD_SETTINGS_H__ -#define __DALI_INTEGRATION_DYNAMICS_WORLD_SETTINGS_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// INTERNAL INCLUDES -#include -#include -#include - -namespace Dali -{ - -namespace Integration -{ - -extern const Vector3 DEFAULT_DYNAMICS_WORLD_GRAVITY; -extern const float DEFAULT_DYNAMICS_WORLD_AIR_DENSITY; -extern const float DEFAULT_DYNAMICS_WORLD_WATER_DENSITY; -extern const float DEFAULT_DYNAMICS_WORLD_WATER_OFFSET; -extern const Vector3 DEFAULT_DYNAMICS_WORLD_WATER_NORMAL; -extern const float DEFAULT_DYNAMICS_WORLD_SCALE; -extern const int DEFAULT_DYNAMICS_WORLD_SUB_STEPS; - -/** - * Simple structure encapsulating the world configuration settings - * This structure is copyable - */ -struct DALI_IMPORT_API DynamicsWorldSettings -{ - DynamicsWorldSettings() - : type( Dali::DynamicsWorldConfig::RIGID ), - gravity( DEFAULT_DYNAMICS_WORLD_GRAVITY ), - airDensity( DEFAULT_DYNAMICS_WORLD_AIR_DENSITY ), - waterDensity( DEFAULT_DYNAMICS_WORLD_WATER_DENSITY ), - waterOffset( DEFAULT_DYNAMICS_WORLD_WATER_OFFSET ), - waterNormal( DEFAULT_DYNAMICS_WORLD_WATER_NORMAL ), - worldScale( DEFAULT_DYNAMICS_WORLD_SCALE ), - subSteps( DEFAULT_DYNAMICS_WORLD_SUB_STEPS ) - { - } - - DynamicsWorldSettings(const DynamicsWorldSettings& rhs) - : type( rhs.type ), - gravity( rhs.gravity ), - airDensity( rhs.airDensity ), - waterDensity( rhs.waterDensity ), - waterOffset( rhs.waterOffset ), - waterNormal( rhs.waterNormal ), - worldScale( rhs.worldScale ), - subSteps( rhs.subSteps ) - { - } - - DynamicsWorldSettings& operator=(const DynamicsWorldSettings& rhs) - { - if( this != &rhs ) - { - type = rhs.type; - gravity = rhs.gravity; - airDensity = rhs.airDensity; - waterDensity = rhs.waterDensity; - waterOffset = rhs.waterOffset; - waterNormal = rhs.waterNormal; - worldScale = rhs.worldScale; - subSteps = rhs.subSteps; - } - return *this; - } - -// Attributes - Dali::DynamicsWorldConfig::WorldType type; ///< Type of dynamics world (Collision, Rigid, Soft) - Vector3 gravity; ///< Direction and force of gravity (valid with rigid and soft simulations) - float airDensity; ///< Density of air (valid with soft simulations) - float waterDensity; ///< Density of water (valid with soft simulations) - float waterOffset; - Vector3 waterNormal; - float worldScale; - int subSteps; -}; // struct DynamicsWorldSettings - -} // namespace Integration - -} // namespace Dali - -#endif // __DALI_INTEGRATION_DYNAMICS_WORLD_SETTINGS_H__ diff --git a/dali/integration-api/file.list b/dali/integration-api/file.list index 4506bde..8158523 100644 --- a/dali/integration-api/file.list +++ b/dali/integration-api/file.list @@ -45,17 +45,6 @@ platform_abstraction_header_files = \ $(platform_abstraction_src_dir)/system-overlay.h \ $(platform_abstraction_src_dir)/lockless-buffer.h -platform_abstraction_dynamics_header_files = \ - $(platform_abstraction_src_dir)/dynamics/dynamics-body-intf.h \ - $(platform_abstraction_src_dir)/dynamics/dynamics-body-settings.h \ - $(platform_abstraction_src_dir)/dynamics/dynamics-collision-data.h \ - $(platform_abstraction_src_dir)/dynamics/dynamics-debug-vertex.h \ - $(platform_abstraction_src_dir)/dynamics/dynamics-factory-intf.h \ - $(platform_abstraction_src_dir)/dynamics/dynamics-joint-intf.h \ - $(platform_abstraction_src_dir)/dynamics/dynamics-shape-intf.h \ - $(platform_abstraction_src_dir)/dynamics/dynamics-world-intf.h \ - $(platform_abstraction_src_dir)/dynamics/dynamics-world-settings.h - platform_abstraction_events_header_files = \ $(platform_abstraction_src_dir)/events/event.h \ $(platform_abstraction_src_dir)/events/gesture-event.h \ diff --git a/dali/integration-api/platform-abstraction.h b/dali/integration-api/platform-abstraction.h index d39fe6c..f2875c5 100644 --- a/dali/integration-api/platform-abstraction.h +++ b/dali/integration-api/platform-abstraction.h @@ -30,9 +30,6 @@ namespace Dali namespace Integration { -class DynamicsFactory; - - /** * PlatformAbstraction is an abstract interface, used by Dali to access platform specific services. * A concrete implementation must be created for each platform, and provided when creating the @@ -227,11 +224,6 @@ public: virtual bool SaveFile(const std::string& filename, std::vector< unsigned char >& buffer) const = 0; /** - * Get a pointer to the DynamicsFactory. - */ - virtual DynamicsFactory* GetDynamicsFactory() = 0; - - /** * Load a shader binary file into a buffer * @param[in] filename The shader binary filename to load * @param[out] buffer A buffer to receive the file. diff --git a/dali/internal/event/actors/actor-impl.cpp b/dali/internal/event/actors/actor-impl.cpp index 63eb572..cb4b4f5 100644 --- a/dali/internal/event/actors/actor-impl.cpp +++ b/dali/internal/event/actors/actor-impl.cpp @@ -54,13 +54,6 @@ #include #include -#ifdef DALI_DYNAMICS_SUPPORT -#include -#include -#include -#include -#endif - using Dali::Internal::SceneGraph::Node; using Dali::Internal::SceneGraph::AnimatableProperty; using Dali::Internal::SceneGraph::PropertyBase; @@ -174,28 +167,6 @@ struct Actor::RelayoutData bool insideRelayout :1; ///< Locking flag to prevent recursive relayouts on size set }; -#ifdef DALI_DYNAMICS_SUPPORT - -// Encapsulate actor related dynamics data -struct DynamicsData -{ - DynamicsData( Actor* slotOwner ) - : slotDelegate( slotOwner ) - { - } - - typedef std::map JointContainer; - typedef std::vector ReferencedJointContainer; - - DynamicsBodyPtr body; - JointContainer joints; - ReferencedJointContainer referencedJoints; - - SlotDelegate< Actor > slotDelegate; -}; - -#endif // DALI_DYNAMICS_SUPPORT - namespace // unnamed namespace { @@ -1485,385 +1456,6 @@ void Actor::RemoveRenderer( unsigned int index ) mAttachment = NULL; } - -#ifdef DALI_DYNAMICS_SUPPORT - -//--------------- Dynamics --------------- - -void Actor::DisableDynamics() -{ - if( NULL != mDynamicsData ) - { - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s- (\"%s\")\n", __PRETTY_FUNCTION__, mName.c_str()); - - // ensure dynamics object are disconnected from scene - DisconnectDynamics(); - - // delete joint owned by this actor - while( !mDynamicsData->joints.empty() ) - { - RemoveDynamicsJoint( mDynamicsData->joints.begin()->second ); - } - - // delete other joints referencing this actor - while( !mDynamicsData->referencedJoints.empty() ) - { - DynamicsJointPtr joint( *(mDynamicsData->referencedJoints.begin()) ); - ActorPtr jointOwner( joint->GetActor( true ) ); - if( jointOwner ) - { - jointOwner->RemoveDynamicsJoint( joint ); - } - else - { - mDynamicsData->referencedJoints.erase( mDynamicsData->referencedJoints.begin() ); - } - } - // delete the DynamicsBody object - mDynamicsData->body.Reset(); - - // Discard Dynamics data structure - delete mDynamicsData; - mDynamicsData = NULL; - } -} - -DynamicsBodyPtr Actor::GetDynamicsBody() const -{ - DynamicsBodyPtr body; - - if( NULL != mDynamicsData ) - { - body = mDynamicsData->body; - } - - return body; -} - -DynamicsBodyPtr Actor::EnableDynamics(DynamicsBodyConfigPtr bodyConfig) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s- (\"%s\")\n", __PRETTY_FUNCTION__, mName.c_str()); - - if( NULL == mDynamicsData ) - { - mDynamicsData = new DynamicsData( this ); - } - - if( !mDynamicsData->body ) - { - mDynamicsData->body = new DynamicsBody(mName, bodyConfig, *this, *(const_cast(mNode)) ); - - if( OnStage() ) - { - DynamicsWorldPtr world( DynamicsWorld::Get() ); - if( world ) - { - if( mParent == world->GetRootActor().Get() ) - { - mDynamicsData->body->Connect( GetEventThreadServices() ); - } - } - } - } - - return mDynamicsData->body; -} - -DynamicsJointPtr Actor::AddDynamicsJoint( ActorPtr attachedActor, const Vector3& offset ) -{ - DALI_ASSERT_ALWAYS( attachedActor && "'attachedActor' must be initialized!" ); - return AddDynamicsJoint( attachedActor, offset, ( GetCurrentPosition() + offset ) - attachedActor->GetCurrentPosition() ); -} - -DynamicsJointPtr Actor::AddDynamicsJoint( ActorPtr attachedActor, const Vector3& offsetA, const Vector3& offsetB ) -{ - DALI_ASSERT_ALWAYS( attachedActor && "'attachedActor' must be initialized!" ); - DALI_ASSERT_ALWAYS( this != attachedActor.Get() && "Cannot create a joint to oneself!" ); - - DynamicsJointPtr joint; - - DynamicsWorldPtr world( DynamicsWorld::Get() ); - - if( world ) - { - if( NULL != mDynamicsData ) - { - DynamicsData::JointContainer::iterator it( mDynamicsData->joints.find( attachedActor.Get() ) ); - - if( mDynamicsData->joints.end() != it ) - { - // use existing joint - joint = it->second; - } - - if( !joint ) - { - DynamicsBodyPtr bodyA( GetDynamicsBody() ); - DynamicsBodyPtr bodyB( attachedActor->GetDynamicsBody() ); - - if( !bodyA ) - { - bodyA = EnableDynamics( new DynamicsBodyConfig ); - } - - if( !bodyB ) - { - bodyB = attachedActor->EnableDynamics( new DynamicsBodyConfig ); - } - - joint = new DynamicsJoint(world, bodyA, bodyB, offsetA, offsetB); - mDynamicsData->joints[ attachedActor.Get() ] = joint; - - if( OnStage() && attachedActor->OnStage() ) - { - joint->Connect( GetEventThreadServices() ); - } - - attachedActor->ReferenceJoint( joint ); - - attachedActor->OnStageSignal().Connect( mDynamicsData->slotDelegate, &Actor::AttachedActorOnStage ); - attachedActor->OffStageSignal().Connect( mDynamicsData->slotDelegate, &Actor::AttachedActorOffStage ); - } - } - } - return joint; -} - -const int Actor::GetNumberOfJoints() const -{ - return static_cast( NULL != mDynamicsData ? mDynamicsData->joints.size() : 0 ); -} - -DynamicsJointPtr Actor::GetDynamicsJointByIndex( const int index ) const -{ - DynamicsJointPtr joint; - - if( NULL != mDynamicsData ) - { - if( index >= 0 && index < static_cast(mDynamicsData->joints.size()) ) - { - DynamicsData::JointContainer::const_iterator it( mDynamicsData->joints.begin() ); - - for( int i = 0; i < index; ++i ) - { - ++it; - } - - joint = it->second; - } - } - - return joint; -} - -DynamicsJointPtr Actor::GetDynamicsJoint( ActorPtr attachedActor ) const -{ - DynamicsJointPtr joint; - - if( NULL != mDynamicsData ) - { - DynamicsData::JointContainer::const_iterator it( mDynamicsData->joints.find( attachedActor.Get() ) ); - - if( mDynamicsData->joints.end() != it ) - { - // use existing joint - joint = it->second; - } - } - - return joint; -} - -void Actor::RemoveDynamicsJoint( DynamicsJointPtr joint ) -{ - if( NULL != mDynamicsData ) - { - DynamicsData::JointContainer::iterator it( mDynamicsData->joints.begin() ); - DynamicsData::JointContainer::iterator endIt( mDynamicsData->joints.end() ); - - for(; it != endIt; ++it ) - { - if( it->second == joint.Get() ) - { - ActorPtr attachedActor( it->first ); - - if( OnStage() && attachedActor && attachedActor->OnStage() ) - { - joint->Disconnect( GetEventThreadServices() ); - } - - if( attachedActor ) - { - attachedActor->ReleaseJoint( joint ); - attachedActor->OnStageSignal().Disconnect( mDynamicsData->slotDelegate, &Actor::AttachedActorOnStage ); - attachedActor->OffStageSignal().Disconnect( mDynamicsData->slotDelegate, &Actor::AttachedActorOffStage ); - } - - mDynamicsData->joints.erase(it); - break; - } - } - } -} - -void Actor::ReferenceJoint( DynamicsJointPtr joint ) -{ - DALI_ASSERT_DEBUG( NULL != mDynamicsData && "Dynamics not enabled on this actor!" ); - - if( NULL != mDynamicsData ) - { - mDynamicsData->referencedJoints.push_back(joint); - } -} - -void Actor::ReleaseJoint( DynamicsJointPtr joint ) -{ - DALI_ASSERT_DEBUG( NULL != mDynamicsData && "Dynamics not enabled on this actor!" ); - - if( NULL != mDynamicsData ) - { - DynamicsData::ReferencedJointContainer::iterator it( std::find( mDynamicsData->referencedJoints.begin(), mDynamicsData->referencedJoints.end(), joint ) ); - - if( it != mDynamicsData->referencedJoints.end() ) - { - mDynamicsData->referencedJoints.erase( it ); - } - } -} - -void Actor::SetDynamicsRoot(bool flag) -{ - if( mIsDynamicsRoot != flag ) - { - mIsDynamicsRoot = flag; - - if( OnStage() && mChildren ) - { - // walk the children connecting or disconnecting any dynamics enabled child from the dynamics simulation - ActorIter end = mChildren->end(); - for( ActorIter iter = mChildren->begin(); iter != end; ++iter ) - { - ActorPtr child = (*iter); - - if( child->GetDynamicsBody() ) - { - if( mIsDynamicsRoot ) - { - child->ConnectDynamics(); - } - else - { - child->DisconnectDynamics(); - } - } - } - } - } -} - -bool Actor::IsDynamicsRoot() const -{ - return mIsDynamicsRoot; -} - -void Actor::AttachedActorOnStage( Dali::Actor actor ) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); - - if( OnStage() ) - { - ActorPtr attachedActor( &GetImplementation(actor) ); - - DALI_ASSERT_DEBUG( NULL != mDynamicsData && "Dynamics not enabled on this actor!" ); - if( NULL != mDynamicsData ) - { - DynamicsData::JointContainer::iterator it( mDynamicsData->joints.find( attachedActor.Get() ) ); - if( mDynamicsData->joints.end() != it ) - { - DynamicsJointPtr joint( it->second ); - joint->Connect( GetEventThreadServices() ); - } - } - } -} - -void Actor::AttachedActorOffStage( Dali::Actor actor ) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); - - if( OnStage() ) - { - ActorPtr attachedActor( &GetImplementation(actor) ); - - DALI_ASSERT_DEBUG( NULL != mDynamicsData && "Dynamics not enabled on this actor!" ); - if( NULL != mDynamicsData ) - { - DynamicsData::JointContainer::iterator it( mDynamicsData->joints.find( attachedActor.Get() ) ); - if( mDynamicsData->joints.end() != it ) - { - DynamicsJointPtr joint( it->second ); - joint->Disconnect( GetEventThreadServices() ); - } - } - } -} - -void Actor::ConnectDynamics() -{ - if( NULL != mDynamicsData && mDynamicsData->body ) - { - if( OnStage() && mParent && mParent->IsDynamicsRoot() ) - { - mDynamicsData->body->Connect( GetEventThreadServices() ); - - // Connect all joints where attachedActor is also on stage - if( !mDynamicsData->joints.empty() ) - { - DynamicsData::JointContainer::iterator it( mDynamicsData->joints.begin() ); - DynamicsData::JointContainer::iterator endIt( mDynamicsData->joints.end() ); - - for(; it != endIt; ++it ) - { - Actor* attachedActor( it->first ); - if( NULL != attachedActor && attachedActor->OnStage() ) - { - DynamicsJointPtr joint( it->second ); - - joint->Connect( GetEventThreadServices() ); - } - } - } - } - } -} - -void Actor::DisconnectDynamics() -{ - if( NULL != mDynamicsData && mDynamicsData->body ) - { - if( OnStage() ) - { - mDynamicsData->body->Disconnect( GetEventThreadServices() ); - - // Disconnect all joints - if( !mDynamicsData->joints.empty() ) - { - DynamicsData::JointContainer::iterator it( mDynamicsData->joints.begin() ); - DynamicsData::JointContainer::iterator endIt( mDynamicsData->joints.end() ); - - for(; it != endIt; ++it ) - { - DynamicsJointPtr joint( it->second ); - - joint->Disconnect( GetEventThreadServices() ); - } - } - } - } -} - -#endif // DALI_DYNAMICS_SUPPORT - void Actor::SetOverlay( bool enable ) { // Setting STENCIL will override OVERLAY @@ -2315,9 +1907,6 @@ Actor::Actor( DerivedType derivedType ) mParentOrigin( NULL ), mAnchorPoint( NULL ), mRelayoutData( NULL ), -#ifdef DALI_DYNAMICS_SUPPORT - mDynamicsData( NULL ), -#endif mGestureData( NULL ), mAttachment(), mTargetSize( 0.0f, 0.0f, 0.0f ), @@ -2328,7 +1917,6 @@ Actor::Actor( DerivedType derivedType ) mIsRenderable( RENDERABLE == derivedType ), mIsLayer( LAYER == derivedType || ROOT_LAYER == derivedType ), mIsOnStage( false ), - mIsDynamicsRoot( false ), mSensitive( true ), mLeaveRequired( false ), mKeyboardFocusable( false ), @@ -2384,11 +1972,6 @@ Actor::~Actor() GetEventThreadServices().UnregisterObject( this ); } -#ifdef DALI_DYNAMICS_SUPPORT - // Cleanup dynamics - delete mDynamicsData; -#endif - // Cleanup optional gesture data delete mGestureData; @@ -2471,14 +2054,6 @@ void Actor::ConnectToSceneGraph( int index ) mAttachment->Connect(); } -#ifdef DALI_DYNAMICS_SUPPORT - // Notify dynamics - if( NULL != mDynamicsData ) - { - ConnectDynamics(); - } -#endif - // Request relayout on all actors that are added to the scenegraph RelayoutRequest(); @@ -2565,14 +2140,6 @@ void Actor::DisconnectFromSceneGraph() { mAttachment->Disconnect(); } - -#ifdef DALI_DYNAMICS_SUPPORT - // Notify dynamics - if( NULL != mDynamicsData ) - { - DisconnectDynamics(); - } -#endif } void Actor::NotifyStageDisconnection() diff --git a/dali/internal/event/actors/actor-impl.h b/dali/internal/event/actors/actor-impl.h index 1b0cd11..d601a20 100644 --- a/dali/internal/event/actors/actor-impl.h +++ b/dali/internal/event/actors/actor-impl.h @@ -36,10 +36,6 @@ #include #include -#ifdef DALI_DYNAMICS_SUPPORT -#include -#endif - namespace Dali { @@ -56,7 +52,6 @@ class ActorGestureData; class Animation; class RenderTask; class Renderer; -struct DynamicsData; typedef std::vector< ActorPtr > ActorContainer; typedef ActorContainer::iterator ActorIter; @@ -1237,93 +1232,8 @@ public: */ void RemoveRenderer( unsigned int index ); -#ifdef DALI_DYNAMICS_SUPPORT - - // Dynamics - - /// @copydoc Dali::Actor::DisableDynamics - void DisableDynamics(); - - /// @copydoc Dali::Actor::EnableDynamics(Dali::DynamicsBodyConfig) - DynamicsBodyPtr EnableDynamics(DynamicsBodyConfigPtr bodyConfig); - - /// @copydoc Dali::Actor::GetDynamicsBody - DynamicsBodyPtr GetDynamicsBody() const; - - /// @copydoc Dali::Actor::AddDynamicsJoint(Dali::Actor,const Vector3&) - DynamicsJointPtr AddDynamicsJoint( ActorPtr attachedActor, const Vector3& offset ); - - /// @copydoc Dali::Actor::AddDynamicsJoint(Dali::Actor,const Vector3&,const Vector3&) - DynamicsJointPtr AddDynamicsJoint( ActorPtr attachedActor, const Vector3& offsetA, const Vector3& offsetB ); - - /// @copydoc Dali::Actor::GetNumberOfJoints - const int GetNumberOfJoints() const; - - /// @copydoc Dali::Actor::GetDynamicsJointByIndex - DynamicsJointPtr GetDynamicsJointByIndex( const int index ) const; - - /// @copydoc Dali::Actor::GetDynamicsJoint - DynamicsJointPtr GetDynamicsJoint( ActorPtr attachedActor ) const; - - /// @copydoc Dali::Actor::RemoveDynamicsJoint - void RemoveDynamicsJoint( DynamicsJointPtr joint ); - - /** - * Hold a reference to a DynamicsJoint - * @param[in] joint The joint - */ - void ReferenceJoint( DynamicsJointPtr joint ); - - /** - * Release a reference to a DynamicsJoint - * @param[in] joint The joint - */ - void ReleaseJoint( DynamicsJointPtr joint ); - - /** - * Set this actor to be the root actor in the dynamics simulation - * All children of the actor are added/removed from the simulation. - * @param[in] flag When true sets this actor to be the simulation world root actor and - * if OnStage() all dynamics enabled child actors are added to the simulation, - * when false stops this actor being the simulation root and if OnStage() all - * dynamics enabled child actors are removed from the simulation. - */ - void SetDynamicsRoot(bool flag); - -private: - /** - * Check if this actor is the root actor in the dynamics simulation - * @return true if this is the dynamics root actor. - */ - bool IsDynamicsRoot() const; - - /** - * Add actor to the dynamics simulation - * Invoked when the actor is staged, or it's parent becomes the simulation root - */ - void ConnectDynamics(); - - /** - * Remove actor from the dynamics simulation - * Invoked when the actor is unstaged, or it's parent stops being the the simulation root - */ - void DisconnectDynamics(); - - /** - * An actor in a DynamicsJoint relationship has been staged - * @param[in] actor The actor passed into AddDynamicsJoint() - */ - void AttachedActorOnStage( Dali::Actor actor ); - - /** - * An actor in a DynamicsJoint relationship has been unstaged - * @param[in] actor The actor passed into AddDynamicsJoint() - */ - void AttachedActorOffStage( Dali::Actor actor ); - -#endif // DALI_DYNAMICS_SUPPORT - public: + /** * Converts screen coordinates into the actor's coordinate system. * @note The actor coordinates are relative to the top-left (0.0, 0.0, 0.5) @@ -1885,10 +1795,6 @@ protected: struct RelayoutData; RelayoutData* mRelayoutData; ///< Struct to hold optional collection of relayout variables -#ifdef DALI_DYNAMICS_SUPPORT - DynamicsData* mDynamicsData; ///< optional physics data -#endif - ActorGestureData* mGestureData; ///< Optional Gesture data. Only created when actor requires gestures ActorAttachmentPtr mAttachment; ///< Optional referenced attachment @@ -1912,7 +1818,6 @@ protected: const bool mIsRenderable : 1; ///< Flag to identify that this is a renderable actor const bool mIsLayer : 1; ///< Flag to identify that this is a layer bool mIsOnStage : 1; ///< Flag to identify whether the actor is on-stage - bool mIsDynamicsRoot : 1; ///< Flag to identify if this is the dynamics world root bool mSensitive : 1; ///< Whether the actor emits touch event signals bool mLeaveRequired : 1; ///< Whether a touch event signal is emitted when the a touch leaves the actor's bounds bool mKeyboardFocusable : 1; ///< Whether the actor should be focusable by keyboard navigation diff --git a/dali/internal/event/common/thread-local-storage.cpp b/dali/internal/event/common/thread-local-storage.cpp index 9286f45..ee99ba8 100644 --- a/dali/internal/event/common/thread-local-storage.cpp +++ b/dali/internal/event/common/thread-local-storage.cpp @@ -35,13 +35,9 @@ __thread ThreadLocalStorage* threadLocal = NULL; ThreadLocalStorage::ThreadLocalStorage(Core* core) : mCore( core ) -#ifdef DALI_DYNAMICS_SUPPORT -, mDynamicsWorldInstance( NULL ) -#endif { DALI_ASSERT_ALWAYS( threadLocal == NULL && "Cannot create more than one ThreadLocalStorage object" ); - // reset is used to store a new value associated with this thread threadLocal = this; } @@ -51,12 +47,6 @@ ThreadLocalStorage::~ThreadLocalStorage() void ThreadLocalStorage::Remove() { -#ifdef DALI_DYNAMICS_SUPPORT - if( mDynamicsWorldInstance ) - { - mDynamicsWorldInstance.Reset(); - } -#endif threadLocal = NULL; } @@ -78,18 +68,6 @@ ThreadLocalStorage* ThreadLocalStorage::GetInternal() return threadLocal; } -#ifdef DALI_DYNAMICS_SUPPORT -Dali::Internal::DynamicsWorldPtr ThreadLocalStorage::GetDynamicsWorldInstance() -{ - if( !mDynamicsWorldInstance ) - { - // Create the instance if it doesn't exist. - mDynamicsWorldInstance = DynamicsWorld::New(); - } - return mDynamicsWorldInstance; -} -#endif - Dali::Integration::PlatformAbstraction& ThreadLocalStorage::GetPlatformAbstraction() { return mCore->GetPlatform(); diff --git a/dali/internal/event/common/thread-local-storage.h b/dali/internal/event/common/thread-local-storage.h index ad6b92e..73a4021 100644 --- a/dali/internal/event/common/thread-local-storage.h +++ b/dali/internal/event/common/thread-local-storage.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_THREAD_LOCAL_STORAGE_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2015 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,9 +20,6 @@ // INTERNAL INCLUDES #include -#ifdef DALI_DYNAMICS_SUPPORT -#include -#endif namespace Dali { @@ -101,14 +98,6 @@ public: */ Dali::Integration::PlatformAbstraction& GetPlatformAbstraction(); -#ifdef DALI_DYNAMICS_SUPPORT - /** - * Get DynamicsWorld instance - * @return A pointer to the current DynamicsWorld. - */ - Dali::Internal::DynamicsWorldPtr GetDynamicsWorldInstance(); -#endif - /** * Retrieve the update manager * @return reference to update manager @@ -166,9 +155,6 @@ public: private: Core* mCore; ///< reference to core -#ifdef DALI_DYNAMICS_SUPPORT - Dali::Internal::DynamicsWorldPtr mDynamicsWorldInstance; ///< Instance of DynamicsWorld (This does not need to be in core) -#endif }; diff --git a/dali/internal/event/dynamics/dynamics-body-config-impl.cpp b/dali/internal/event/dynamics/dynamics-body-config-impl.cpp deleted file mode 100644 index f6eb8c6..0000000 --- a/dali/internal/event/dynamics/dynamics-body-config-impl.cpp +++ /dev/null @@ -1,269 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// EXTERNAL HEADERS - -// INTERNAL HEADERS -#include -#include -#include -#include -#include -#include -#include -#include - -namespace Dali -{ - -namespace Integration -{ - -const float DEFAULT_DYNAMICS_BODY_MASS(1.0f); -const float DEFAULT_DYNAMICS_BODY_ELASTICITY(0.85f); -const float DEFAULT_DYNAMICS_BODY_FRICTION(0.5f); -const float DEFAULT_DYNAMICS_BODY_LINEAR_DAMPING(0.0f); -const float DEFAULT_DYNAMICS_BODY_ANGULAR_DAMPING(0.0f); -const float DEFAULT_DYNAMICS_BODY_LINEAR_SLEEP_VELOCITY(80.0f); // Assumes default world unit of 1/100 -const float DEFAULT_DYNAMICS_BODY_ANGULAR_SLEEP_VELOCITY(1.0f); -const float DEFAULT_DYNAMICS_LINEAR_STIFFNESS(1.0f); -const float DEFAULT_DYNAMICS_ANCHOR_HARDNESS(0.7f); - -} // namespace Integration - -namespace Internal -{ - -DynamicsBodyConfig::DynamicsBodyConfig() -: mSettings(NULL) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); - - mSettings = new Integration::DynamicsBodySettings; - mShape = new DynamicsCubeShape( Vector3::ONE); -} - -DynamicsBodyConfig::~DynamicsBodyConfig() -{ - delete mSettings; -} - -void DynamicsBodyConfig::SetType( const Dali::DynamicsBodyConfig::BodyType type ) -{ - mSettings->type = type; -} - -Dali::DynamicsBodyConfig::BodyType DynamicsBodyConfig::GetType() const -{ - return mSettings->type; -} - -void DynamicsBodyConfig::SetShape( const Dali::DynamicsShape::ShapeType type, const Vector3& dimensions ) -{ - switch( type ) - { - case Dali::DynamicsShape::CAPSULE: - { - mShape = new DynamicsCapsuleShape(dimensions.x, dimensions.y); - break; - } - case Dali::DynamicsShape::CONE: - { - mShape = new DynamicsConeShape(dimensions.x, dimensions.y); - break; - } - case Dali::DynamicsShape::CUBE: - { - mShape = new DynamicsCubeShape(dimensions); - break; - } - case Dali::DynamicsShape::CYLINDER: - { - mShape = new DynamicsCylinderShape(dimensions.x, dimensions.y); - break; - } - case Dali::DynamicsShape::SPHERE: - { - mShape = new DynamicsSphereShape(dimensions.x); - break; - } - default: - { - DALI_ASSERT_DEBUG(0 && "Unknown shape type" ); - break; - } - } -} - -void DynamicsBodyConfig::SetShape( DynamicsShapePtr shape ) -{ - mShape = shape; -} - -DynamicsShapePtr DynamicsBodyConfig::GetShape() const -{ - return mShape; -} - -void DynamicsBodyConfig::SetMass( const float mass ) -{ - mSettings->mass = mass; -} - -float DynamicsBodyConfig::GetMass() const -{ - return mSettings->mass; -} - -float DynamicsBodyConfig::GetElasticity() const -{ - return mSettings->elasticity; -} - -void DynamicsBodyConfig::SetElasticity(const float elasticity) -{ - mSettings->elasticity = elasticity; -} - -float DynamicsBodyConfig::GetFriction() const -{ - return mSettings->friction; -} - -void DynamicsBodyConfig::SetFriction(const float friction) -{ - mSettings->friction = Clamp(friction, 0.0f, 1.0f); -} - -float DynamicsBodyConfig::GetLinearDamping() const -{ - return mSettings->linearDamping; -} - -void DynamicsBodyConfig::SetLinearDamping( const float damping ) -{ - mSettings->linearDamping = Clamp(damping, 0.0f, 1.0f); -} - -float DynamicsBodyConfig::GetAngularDamping() const -{ - return mSettings->angularDamping; -} - -void DynamicsBodyConfig::SetAngularDamping(const float damping) -{ - mSettings->angularDamping = Clamp(damping, 0.0f, 1.0f); -} - -float DynamicsBodyConfig::GetLinearSleepVelocity() const -{ - return mSettings->linearSleepVelocity; -} - -void DynamicsBodyConfig::SetLinearSleepVelocity( const float sleepVelocity ) -{ - mSettings->linearSleepVelocity = sleepVelocity; -} - -float DynamicsBodyConfig::GetAngularSleepVelocity() const -{ - return mSettings->angularSleepVelocity; -} - -void DynamicsBodyConfig::SetAngularSleepVelocity(const float sleepVelocity) -{ - mSettings->angularSleepVelocity = sleepVelocity; -} - -short int DynamicsBodyConfig::GetCollisionGroup() const -{ - return mSettings->collisionGroup; -} - -void DynamicsBodyConfig::SetCollisionGroup(const short int collisionGroup) -{ - mSettings->collisionGroup = collisionGroup; - mSettings->isCollisionFilterSet = true; -} - -short int DynamicsBodyConfig::GetCollisionMask() const -{ - return mSettings->collisionMask; -} - -void DynamicsBodyConfig::SetCollisionMask(const short int collisionMask) -{ - mSettings->collisionMask = collisionMask; - mSettings->isCollisionFilterSet = true; -} - -bool DynamicsBodyConfig::IsCollisionFilterSet() const -{ - return mSettings->isCollisionFilterSet; -} - -float DynamicsBodyConfig::GetStiffness() const -{ - return mSettings->linearStiffness; -} - -void DynamicsBodyConfig::SetStiffness( const float stiffness ) -{ - mSettings->linearStiffness = stiffness; -} - -float DynamicsBodyConfig::GetAnchorHardness() const -{ - return mSettings->anchorHardness; -} - -void DynamicsBodyConfig::SetAnchorHardness(const float hardness) -{ - mSettings->anchorHardness = Clamp(hardness, 0.0f, 1.0f); -} - -float DynamicsBodyConfig::GetVolumeConservation() const -{ - return mSettings->volumeConservation; -} - -void DynamicsBodyConfig::SetVolumeConservation(const float conservation) -{ - mSettings->volumeConservation = conservation; -} - -float DynamicsBodyConfig::GetShapeConservation() const -{ - return mSettings->shapeConservation; -} - -void DynamicsBodyConfig::SetShapeConservation(const float conservation) -{ - mSettings->shapeConservation = conservation; -} - -Integration::DynamicsBodySettings* DynamicsBodyConfig::GetSettings() const -{ - return mSettings; -} - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/event/dynamics/dynamics-body-config-impl.h b/dali/internal/event/dynamics/dynamics-body-config-impl.h deleted file mode 100644 index cad5c50..0000000 --- a/dali/internal/event/dynamics/dynamics-body-config-impl.h +++ /dev/null @@ -1,194 +0,0 @@ -#ifndef __DYNAMICS_BODY_CONFIG_IMPL_H__ -#define __DYNAMICS_BODY_CONFIG_IMPL_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// BASE CLASS HEADER -#include - -// INTERNAL HEADERS -#include -#include -#include - -namespace Dali -{ - -namespace Integration -{ - -struct DynamicsBodySettings; - -} // namespace Integration - -namespace Internal -{ - -/// @copydoc Dali::DynamicsBodyConfig -class DynamicsBodyConfig : public BaseObject -{ -public: - /** - * Constructor. - */ - DynamicsBodyConfig(); - -protected: - /** - * Destructor. - * A reference counted object may only be deleted by calling Unreference() - */ - virtual ~DynamicsBodyConfig(); - -private: - // unimplemented copy constructor and assignment operator - DynamicsBodyConfig(const DynamicsBodyConfig&); - DynamicsBodyConfig& operator=(const DynamicsBodyConfig&); - - // Methods -public: - /// @copydoc Dali::DynamicsBodyConfig::SetType - void SetType( const Dali::DynamicsBodyConfig::BodyType type ); - - /// @copydoc Dali::DynamicsBodyConfig::GetType - Dali::DynamicsBodyConfig::BodyType GetType() const; - - /// @copydoc Dali::DynamicsBodyConfig::SetShape(const Dali::DynamicsShape::ShapeType,const Dali::Vector3&) - void SetShape( const Dali::DynamicsShape::ShapeType type, const Vector3& dimensions ); - - /// @copydoc Dali::DynamicsBodyConfig::SetShape(Dali::DynamicsShape) - void SetShape( DynamicsShapePtr shape ); - - /// @copydoc Dali::DynamicsBodyConfig::GetShape - DynamicsShapePtr GetShape() const; - - /// @copydoc Dali::DynamicsBodyConfig::SetMass - void SetMass( const float mass ); - - /// @copydoc Dali::DynamicsBodyConfig::GetMass - float GetMass() const; - - /// @copydoc Dali::DynamicsBodyConfig::GetElasticity - float GetElasticity() const; - - /// @copydoc Dali::DynamicsBodyConfig::SetElasticity - void SetElasticity(const float elasticity); - - /// @copydoc Dali::DynamicsBodyConfig::GetFriction - float GetFriction() const; - - /// @copydoc Dali::DynamicsBodyConfig::SetFriction - void SetFriction(const float friction); - - /// @copydoc Dali::DynamicsBodyConfig::GetLinearDamping - float GetLinearDamping() const; - - /// @copydoc Dali::DynamicsBodyConfig::SetLinearDamping - void SetLinearDamping( const float damping ); - - /// @copydoc Dali::DynamicsBodyConfig::GetAngularDamping - float GetAngularDamping() const; - - /// @copydoc Dali::DynamicsBodyConfig::SetAngularDamping - void SetAngularDamping(const float damping); - - /// @copydoc Dali::DynamicsBodyConfig::GetLinearSleepVelocity - float GetLinearSleepVelocity() const; - - /// @copydoc Dali::DynamicsBodyConfig::SetLinearSleepVelocity - void SetLinearSleepVelocity(const float sleepVelocity); - - /// @copydoc Dali::DynamicsBodyConfig::GetAngularSleepVelocity - float GetAngularSleepVelocity() const; - - /// @copydoc Dali::DynamicsBodyConfig::SetAngularSleepVelocity - void SetAngularSleepVelocity(const float sleepVelocity); - - /// @copydoc Dali::DynamicsBodyConfig::GetCollisionGroup - short int GetCollisionGroup() const; - - /// @copydoc Dali::DynamicsBodyConfig::SetCollisionGroup - void SetCollisionGroup(const short int collisionGroup); - - /// @copydoc Dali::DynamicsBodyConfig::GetCollisionMask - short int GetCollisionMask() const; - - /// @copydoc Dali::DynamicsBodyConfig::SetCollisionMask - void SetCollisionMask(const short int collisionMask); - - /** - * Has the collision filter been modified - * @return true if the collision filter been modified, otherwise false. - */ - bool IsCollisionFilterSet() const; - - /// @copydoc Dali::DynamicsBodyConfig::GetStiffness - float GetStiffness() const; - - /// @copydoc Dali::DynamicsBodyConfig::SetStiffness - void SetStiffness( const float stiffness ); - - /// @copydoc Dali::DynamicsBodyConfig::GetAnchorHardness - float GetAnchorHardness() const; - - /// @copydoc Dali::DynamicsBodyConfig::SetAnchorHardness - void SetAnchorHardness(const float hardness); - - /// @copydoc Dali::DynamicsBodyConfig::GetVolumeConservation - float GetVolumeConservation() const; - - /// @copydoc Dali::DynamicsBodyConfig::SetVolumeConservation - void SetVolumeConservation(const float conservation); - - /// @copydoc Dali::DynamicsBodyConfig::GetShapeConservation - float GetShapeConservation() const; - - /// @copydoc Dali::DynamicsBodyConfig::SetShapeConservation - void SetShapeConservation(const float conservation); - - Integration::DynamicsBodySettings* GetSettings() const; -private: - Integration::DynamicsBodySettings* mSettings; - DynamicsShapePtr mShape; -}; // class DynamicsBodyConfig - -} // namespace Internal - -// Helpers for public-api forwarding methods - -inline Internal::DynamicsBodyConfig& GetImplementation(DynamicsBodyConfig& object) -{ - DALI_ASSERT_ALWAYS(object && "DynamicsBodyConfig object is uninitialized!"); - - BaseObject& handle = object.GetBaseObject(); - - return static_cast(handle); -} - -inline const Internal::DynamicsBodyConfig& GetImplementation(const DynamicsBodyConfig& object) -{ - DALI_ASSERT_ALWAYS(object && "DynamicsBodyConfig object is uninitialized!"); - - const BaseObject& handle = object.GetBaseObject(); - - return static_cast(handle); -} - -} // namespace Dali - -#endif // __DYNAMICS_BODY_CONFIG_IMPL_H__ diff --git a/dali/internal/event/dynamics/dynamics-body-impl.cpp b/dali/internal/event/dynamics/dynamics-body-impl.cpp deleted file mode 100644 index 8576694..0000000 --- a/dali/internal/event/dynamics/dynamics-body-impl.cpp +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// EXTERNAL HEADERS - -// PUBLIC HEADERS -#include - -// INTERNAL HEADERS -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -DynamicsBody::DynamicsBody(const std::string& name, DynamicsBodyConfigPtr config, Actor& actor, SceneGraph::Node& node ) -: mDynamicsBody(NULL), - mName(name), - mMass(0.0f), - mElasticity(0.0f), - mKinematic(false), - mSleepEnabled(true), - mActor(actor) -{ - DALI_ASSERT_DEBUG(config); - - StagePtr stage( Stage::GetCurrent() ); - DynamicsWorldPtr world( DynamicsWorld::Get() ); - - mDynamicsBody = new SceneGraph::DynamicsBody( *(world->GetSceneObject()), node ); - - mShape = config->GetShape(); - - Integration::DynamicsBodySettings* settings( new Integration::DynamicsBodySettings(*config->GetSettings()) ); // copy settings - SceneGraph::DynamicsShape* sceneShape( mShape->GetSceneObject() ); - InitializeDynamicsBodyMessage( *stage, *mDynamicsBody, settings, *sceneShape ); - - SetMass( config->GetMass() ); - SetElasticity( config->GetElasticity() ); - - short int collisionGroup( config->GetCollisionGroup() ); - short int collisionMask( config->GetCollisionMask() ); - if( !config->IsCollisionFilterSet() ) - { - if( EqualsZero( config->GetMass() ) ) - { - // static body and default collision filter has not been overwritten - collisionGroup = Dali::DynamicsBodyConfig::COLLISION_FILTER_STATIC; - collisionMask = Dali::DynamicsBodyConfig::COLLISION_FILTER_ALL ^ Dali::DynamicsBodyConfig::COLLISION_FILTER_STATIC; - } - } - - SetCollisionGroupMessage( *stage, *mDynamicsBody, collisionGroup ); - SetCollisionMaskMessage( *stage, *mDynamicsBody, collisionMask ); - - world->MapActor(mDynamicsBody, actor); -} - -DynamicsBody::~DynamicsBody() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - %s\n", __PRETTY_FUNCTION__, mName.c_str()); - - if( Stage::IsInstalled() ) - { - DeleteBodyMessage( *( Stage::GetCurrent() ), *(GetSceneObject()) ); - - DynamicsWorldPtr world( DynamicsWorld::Get() ); - - if( world ) - { - world->UnmapActor(mDynamicsBody); - } - } - - mShape.Reset(); -} - -const std::string& DynamicsBody::GetName() const -{ - return mName; -} - -float DynamicsBody::GetMass() const -{ - if( IsKinematic() ) - { - return 0.0f; - } - - return mMass; -} - -void DynamicsBody::SetMass(const float mass) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - Mass:%f\n", __PRETTY_FUNCTION__, mass); - - if( fabsf(mMass - mass) >= GetRangedEpsilon(mMass, mass) ) - { - mMass = mass; - if( !IsKinematic() ) - { - SetMassMessage( *( Stage::GetCurrent() ), *(GetSceneObject()), mMass ); - } - } -} - -float DynamicsBody::GetElasticity() const -{ - return mElasticity; -} - -void DynamicsBody::SetElasticity(const float elasticity) -{ - if( fabsf(mElasticity - elasticity) >= GetRangedEpsilon(mElasticity, elasticity) ) - { - mElasticity = elasticity; - SetElasticityMessage( *( Stage::GetCurrent() ), *(GetSceneObject()), mElasticity ); - } -} - -void DynamicsBody::SetLinearVelocity(const Vector3& velocity) -{ - SetLinearVelocityMessage( *( Stage::GetCurrent() ), *(GetSceneObject()), velocity ); -} - -Vector3 DynamicsBody::GetCurrentLinearVelocity() const -{ - return GetSceneObject()->GetLinearVelocity( Stage::GetCurrent()->GetEventBufferIndex() ); -} - -void DynamicsBody::SetAngularVelocity(const Vector3& velocity) -{ - SetAngularVelocityMessage( *( Stage::GetCurrent() ), *(GetSceneObject()), velocity ); -} - -Vector3 DynamicsBody::GetCurrentAngularVelocity() const -{ - return GetSceneObject()->GetAngularVelocity( Stage::GetCurrent()->GetEventBufferIndex() ); -} - -void DynamicsBody::SetKinematic( const bool flag ) -{ - if( mKinematic != flag ) - { - // kinematic objects have zero mass - if( flag && ( ! EqualsZero( mMass ) ) ) - { - SetMassMessage( *( Stage::GetCurrent() ), *(GetSceneObject()), 0.0f ); - } - - mKinematic = flag; - SetKinematicMessage( *( Stage::GetCurrent() ), *(GetSceneObject()), flag ); - - if( !flag && ( ! EqualsZero( mMass ) ) ) - { - SetMassMessage( *( Stage::GetCurrent() ), *(GetSceneObject()), mMass ); - } - - if( !flag ) - { - SetSleepEnabledMessage( *( Stage::GetCurrent() ), *(GetSceneObject()), mSleepEnabled ); - } - } -} - -bool DynamicsBody::IsKinematic() const -{ - return mKinematic; -} - -void DynamicsBody::SetSleepEnabled( const bool flag ) -{ - if( mSleepEnabled != flag ) - { - mSleepEnabled = flag; - - if( !IsKinematic() ) - { - SetSleepEnabledMessage( *( Stage::GetCurrent() ), *(GetSceneObject()), flag ); - } - } -} - -bool DynamicsBody::GetSleepEnabled() const -{ - return mSleepEnabled; -} - -void DynamicsBody::WakeUp() -{ - WakeUpMessage( *( Stage::GetCurrent() ), *(GetSceneObject()) ); -} - -void DynamicsBody::AddAnchor(const unsigned int index, DynamicsBodyPtr body, const bool collisions) -{ - AddAnchorMessage( *( Stage::GetCurrent() ), *(GetSceneObject()), index, *(body->GetSceneObject()), collisions ); -} - -void DynamicsBody::ConserveVolume(const bool flag) -{ - ConserveVolumeMessage( *( Stage::GetCurrent() ), *(GetSceneObject()), flag ); -} - -void DynamicsBody::ConserveShape(const bool flag) -{ - ConserveShapeMessage( *( Stage::GetCurrent() ), *(GetSceneObject()), flag ); -} - -Actor& DynamicsBody::GetActor() const -{ - return mActor; -} - -void DynamicsBody::Connect( EventThreadServices& eventThreadServices ) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - %s\n", __PRETTY_FUNCTION__, mName.c_str()); - - ConnectMessage( eventThreadServices, *(GetSceneObject()) ); -} - -void DynamicsBody::Disconnect( EventThreadServices& eventThreadServices ) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - %s\n", __PRETTY_FUNCTION__, mName.c_str()); - - if( eventThreadServices.IsCoreRunning() ) - { - DisconnectMessage( eventThreadServices, *(GetSceneObject()) ); - } -} - - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/event/dynamics/dynamics-body-impl.h b/dali/internal/event/dynamics/dynamics-body-impl.h deleted file mode 100644 index 69b56f7..0000000 --- a/dali/internal/event/dynamics/dynamics-body-impl.h +++ /dev/null @@ -1,193 +0,0 @@ -#ifndef __DYNAMICS_BODY_IMPL_H__ -#define __DYNAMICS_BODY_IMPL_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// INTERNAL INCLUDES -#include -#include -#include - - -namespace Dali -{ - -namespace Internal -{ - -namespace SceneGraph -{ - -class DynamicsBody; -class Node; - -} // namespace SceneGraph - -class Stage; -class Actor; - -typedef IntrusivePtr ActorPtr; - -/// @copydoc Dali::DynamicsBody -class DynamicsBody : public BaseObject -{ -public: - /** - * Constructor. - * @param[in] name The name for this body/ - * @param[in] config DynamicsBody configuration data - * @param[in] actor The actor for this DynamicsBody - */ - DynamicsBody(const std::string& name, DynamicsBodyConfigPtr config, Actor& actor, SceneGraph::Node& node ); - -protected: - /** - * Destructor. - * A reference counted object may only be deleted by calling Unreference() - */ - virtual ~DynamicsBody(); - -private: - // unimplemented copy constructor and assignment operator - DynamicsBody(const DynamicsBody&); - DynamicsBody& operator=(const DynamicsBody&); - - // Methods -public: - /// @copydoc Dali::DynamicsBody::GetName - const std::string& GetName() const; - - /// Get the actor for this DynamicsBody - Actor& GetActor() const; - - /// @copydoc Dali::DynamicsBody::GetMass - float GetMass() const; - - /** - * Set the mass - * @param[in] mass The mass - */ - void SetMass(const float mass); - - /// @copydoc Dali::DynamicsBody::GetElasticity - float GetElasticity() const; - - /** - * Set the elasticity - * @param[in] elasticity The elasticity - */ - void SetElasticity(const float elasticity); - - /// @copydoc Dali::DynamicsBody::SetKinematic - void SetKinematic( const bool flag ); - - /// @copydoc Dali::DynamicsBody::IsKinematic - bool IsKinematic() const; - - /// @copydoc Dali::DynamicsBody::SetSleepEnabled - void SetSleepEnabled( const bool flag ); - - /// @copydoc Dali::DynamicsBody::GetSleepEnabled - bool GetSleepEnabled() const; - - /// @copydoc Dali::DynamicsBody::WakeUp - void WakeUp(); - - /// @copydoc Dali::DynamicsBody::SetLinearVelocity - void SetLinearVelocity(const Vector3& velocity); - - /// @copydoc Dali::DynamicsBody::GetCurrentLinearVelocity - Vector3 GetCurrentLinearVelocity() const; - - /// @copydoc Dali::DynamicsBody::SetAngularVelocity - void SetAngularVelocity(const Vector3& velocity); - - /// @copydoc Dali::DynamicsBody::GetCurrentAngularVelocity - Vector3 GetCurrentAngularVelocity() const; - - /// @copydoc Dali::DynamicsBody::AddAnchor - void AddAnchor(const unsigned int index, DynamicsBodyPtr body, const bool collisions); - - /// @copydoc Dali::DynamicsBody::ConserveVolume - void ConserveVolume(const bool flag); - - /// @copydoc Dali::DynamicsBody::ConserveShape - void ConserveShape(const bool flag); - - /** - * Called when the associated actor is added to the stage - * @param[in] eventThreadServices Object that can send messages to scene graph - */ - void Connect( EventThreadServices& eventThreadServices ); - - /** - * Called when the associated actor is removed from the stage - * @param[in] eventThreadServices Object that can send messages to scene graph - */ - void Disconnect( EventThreadServices& eventThreadServices ); - - SceneGraph::DynamicsBody* GetSceneObject() - { - return mDynamicsBody; - } - - const SceneGraph::DynamicsBody* GetSceneObject() const - { - return mDynamicsBody; - } - -private: - SceneGraph::DynamicsBody* mDynamicsBody; - - std::string mName; - float mMass; - float mElasticity; - bool mKinematic; - bool mSleepEnabled; - DynamicsShapePtr mShape; - Actor& mActor; -}; // class DynamicsBody - -} // namespace Internal - -// Helpers for public-api forwarding methods - -inline Internal::DynamicsBody& GetImplementation(DynamicsBody& object) -{ - DALI_ASSERT_ALWAYS(object && "DynamicsBody object is uninitialized!"); - - BaseObject& handle = object.GetBaseObject(); - - return static_cast(handle); -} - -inline const Internal::DynamicsBody& GetImplementation(const DynamicsBody& object) -{ - DALI_ASSERT_ALWAYS(object && "DynamicsBody object is uninitialized!"); - - const BaseObject& handle = object.GetBaseObject(); - - return static_cast(handle); -} - -} // namespace Dali - -#endif // __DYNAMICS_BODY_IMPL_H__ diff --git a/dali/internal/event/dynamics/dynamics-capsule-shape-impl.cpp b/dali/internal/event/dynamics/dynamics-capsule-shape-impl.cpp deleted file mode 100644 index 0b860b2..0000000 --- a/dali/internal/event/dynamics/dynamics-capsule-shape-impl.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// EXTERNAL HEADERS - -// INTERNAL HEADERS -#include -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -DynamicsCapsuleShape::DynamicsCapsuleShape(const float radius, const float length) -: DynamicsShape(Dali::DynamicsShape::CAPSULE) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (radius:%.1f length:%.1f)\n", __PRETTY_FUNCTION__, radius, length); - - DynamicsWorldPtr world( DynamicsWorld::Get() ); - DALI_ASSERT_ALWAYS( world && "No Dynamics World !"); - - SceneGraph::DynamicsCapsuleShape* capsuleShape = new SceneGraph::DynamicsCapsuleShape( *world->GetSceneObject() ); - mDynamicsShape = capsuleShape; - - // Queue a message to ensure the underlying dynamics object is created in the update thread - InitializeDynamicsCapsuleShapeMessage( *Stage::GetCurrent(), *capsuleShape, radius, length ); -} - -DynamicsCapsuleShape::~DynamicsCapsuleShape() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); -} - -Vector3 DynamicsCapsuleShape::GetAABB() const -{ - return Vector3(); -} - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/event/dynamics/dynamics-capsule-shape-impl.h b/dali/internal/event/dynamics/dynamics-capsule-shape-impl.h deleted file mode 100644 index 51ea9a3..0000000 --- a/dali/internal/event/dynamics/dynamics-capsule-shape-impl.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef __DYNAMICS_CAPSULE_SHAPE_IMPL_H__ -#define __DYNAMICS_CAPSULE_SHAPE_IMPL_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// BASE CLASS HEADERS -#include - -// INTERNAL HEADERS -#include - -namespace Dali -{ - -namespace Internal -{ - -/** - * A capsule shape. - * A cylinder capped with half spheres. - */ -class DynamicsCapsuleShape : public DynamicsShape -{ -public: - /** - * Constructor. - * @copydoc Dali::DynamicsShape::NewCapsule - */ - DynamicsCapsuleShape(const float radius, const float length); - -protected: - /** - * Destructor. - * A reference counted object may only be deleted by calling Unreference() - */ - virtual ~DynamicsCapsuleShape(); - -private: - // unimplemented copy constructor and assignment operator - DynamicsCapsuleShape(const DynamicsCapsuleShape&); - DynamicsCapsuleShape& operator=(const DynamicsCapsuleShape&); - -public: - /** - * Get an axis aligned bounding box for this shape - * @return An axis aligned bounding box for this shape - */ - virtual Vector3 GetAABB() const; -}; // class DynamicsCapsuleShape - -} // namespace Internal - -} // namespace Dali - -#endif // __DYNAMICS_CAPSULE_SHAPE_IMPL_H__ diff --git a/dali/internal/event/dynamics/dynamics-collision-impl.cpp b/dali/internal/event/dynamics/dynamics-collision-impl.cpp deleted file mode 100644 index 013029c..0000000 --- a/dali/internal/event/dynamics/dynamics-collision-impl.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL HEADERS - -// CLASS HEADER -#include - -// INTERNAL HEADERS -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -DynamicsCollision::DynamicsCollision() -: mImpact(0.0f) -{ -} - -DynamicsCollision::~DynamicsCollision() -{ -} - -ActorPtr DynamicsCollision::GetActorA() -{ - return mActorA; -} - -void DynamicsCollision::SetActorA(ActorPtr actor) -{ - mActorA = actor; -} - -ActorPtr DynamicsCollision::GetActorB() -{ - return mActorB; -} - -void DynamicsCollision::SetActorB(ActorPtr actor) -{ - mActorB = actor; -} - -float DynamicsCollision::GetImpactForce() const -{ - return mImpact; -} - -void DynamicsCollision::SetImpactForce(const float impact) -{ - mImpact = impact; -} - -Vector3 DynamicsCollision::GetPointOnA() const -{ - return mPointA; -} - -void DynamicsCollision::SetPointOnA(const Vector3 point) -{ - mPointA = point; -} - -Vector3 DynamicsCollision::GetPointOnB() const -{ - return mPointB; -} - -void DynamicsCollision::SetPointOnB(const Vector3 point) -{ - mPointB = point; -} - -Vector3 DynamicsCollision::GetNormal() const -{ - return mNormal; -} - -void DynamicsCollision::SetNormal(const Vector3 normal) -{ - mNormal = normal; -} - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/event/dynamics/dynamics-collision-impl.h b/dali/internal/event/dynamics/dynamics-collision-impl.h deleted file mode 100644 index d667a67..0000000 --- a/dali/internal/event/dynamics/dynamics-collision-impl.h +++ /dev/null @@ -1,149 +0,0 @@ -#ifndef __DALI_DYNAMICS_COLLISION_IMPL_H__ -#define __DALI_DYNAMICS_COLLISION_IMPL_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// BASE CLASS HEADER -#include - -// INTERNAL HEADERS -#include -#include -#include - -namespace Dali -{ - -struct Vector3; - -namespace Internal -{ - -/** - * Contains information about a collision between two actors - */ -class DynamicsCollision : public BaseObject -{ -public: - /** - * Constructor. - */ - DynamicsCollision(); - -protected: - /** - * Destructor. - * A reference counted object may only be deleted by calling Unreference() - */ - virtual ~DynamicsCollision(); - -private: - // unimplemented copy constructor and assignment operator - DynamicsCollision(const DynamicsCollision&); - DynamicsCollision& operator=(const DynamicsCollision&); - - // Methods -public: - /// @copydoc Dali::DynamicsCollision::GetActorA - ActorPtr GetActorA(); - - /** - * Set first actor in collision - * @param[in] actor First Actor in collision - */ - void SetActorA(ActorPtr actor); - - /// @copydoc Dali::DynamicsCollision::GetActorB - ActorPtr GetActorB(); - - /** - * Set second actor in collision - * @param[in] actor Second Actor in collision - */ - void SetActorB(ActorPtr actor); - - /// @copydoc Dali::DynamicsCollision::GetImpactForce - float GetImpactForce() const; - - /** - * Set impact force - * @param[in] impact The impact force (0 on dispersal) - */ - void SetImpactForce(const float impact); - - /// @copydoc Dali::DynamicsCollision::GetPointOnA - Vector3 GetPointOnA() const; - - /** - * Set the contact point on first Actor - * @param[in] point The contact point on the first Actor - */ - void SetPointOnA(const Vector3 point); - - /// @copydoc Dali::DynamicsCollision::GetPointOnB - Vector3 GetPointOnB() const; - - /** - * Set the contact point on second Actor - * @param[in] point The contact point on the second Actor - */ - void SetPointOnB(const Vector3 point); - - /// @copydoc Dali::DynamicsCollision::GetNormal - Vector3 GetNormal() const; - - /** - * Set the contact normal - * @param[in] normal The contact normal - */ - void SetNormal(const Vector3 normal); - -private: - ActorPtr mActorA; - ActorPtr mActorB; - Vector3 mPointA; - Vector3 mPointB; - Vector3 mNormal; - float mImpact; -}; // class DynamicsCollision - -} // namespace Internal - -// Helpers for public-api forwarding methods - -inline Internal::DynamicsCollision& GetImplementation(DynamicsCollision& object) -{ - DALI_ASSERT_ALWAYS(object && "DynamicsCollision object is uninitialized!"); - - BaseObject& handle = object.GetBaseObject(); - - return static_cast(handle); -} - -inline const Internal::DynamicsCollision& GetImplementation(const DynamicsCollision& object) -{ - DALI_ASSERT_ALWAYS(object && "DynamicsCollision object is uninitialized!"); - - const BaseObject& handle = object.GetBaseObject(); - - return static_cast(handle); -} - -} // namespace Dali - -#endif /* __DALI_DYNAMICS_COLLISION_IMPL_H__ */ diff --git a/dali/internal/event/dynamics/dynamics-collision-notifier.h b/dali/internal/event/dynamics/dynamics-collision-notifier.h deleted file mode 100644 index 695f853..0000000 --- a/dali/internal/event/dynamics/dynamics-collision-notifier.h +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef __DALI_INTERNAL_EVENTS_DYNAMICS_COLLISION_NOTIFIER_H__ -#define __DALI_INTERNAL_EVENTS_DYNAMICS_COLLISION_NOTIFIER_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// INTERNAL INCLUDES -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace SceneGraph -{ -struct DynamicsCollisionData; -} // namespace SceneGraph - -/** - * Interface used by the update-thread to trigger collision event signals. - */ -class DynamicsCollisionNotifier -{ -public: - - /** - * Virtual destructor. - */ - virtual ~DynamicsCollisionNotifier() - { - } - - /** - * Invoked when the simulation detects a new collision between two bodies. - * @param[in] collisionData Contains information about the colliding bodies, their - * points of contact, and impact magnitude - */ - virtual void CollisionImpact( SceneGraph::DynamicsCollisionData* collisionData ); - - /** - * Invoked when the simulation detects two bodies already in collision scraping against each other. - * @param[in] collisionData Contains information about the colliding bodies, their - * points of contact, and impact magnitude - */ - virtual void CollisionScrape( SceneGraph::DynamicsCollisionData* collisionData ); - - /** - * Invoked when the simulation detects two previously colliding bodies moving apart. - * @param[in] collisionData Contains information about the colliding bodies. - */ - virtual void CollisionDisperse( SceneGraph::DynamicsCollisionData* collisionData ); -}; - -inline MessageBase* CollisionImpactMessage( DynamicsCollisionNotifier& dynamicsNotifier, SceneGraph::DynamicsCollisionData* collisionData ) -{ - return new MessageValue1< DynamicsWorld, SceneGraph::DynamicsCollisionData* >( &dynamicsNotifier, &DynamicsCollisionNotifier::CollisionImpact, collisionData ); -} - -inline MessageBase* CollisionScrapeMessage( DynamicsCollisionNotifier& dynamicsNotifier, SceneGraph::DynamicsCollisionData* collisionData ) -{ - return new MessageValue1< DynamicsWorld, SceneGraph::DynamicsCollisionData* >( &dynamicsNotifier, &DynamicsCollisionNotifier::CollisionScrape, collisionData ); -} - -inline MessageBase* CollisionDisperseMessage( DynamicsCollisionNotifier& dynamicsNotifier, SceneGraph::DynamicsCollisionData* collisionData ) -{ - return new MessageValue1< DynamicsWorld, SceneGraph::DynamicsCollisionData* >( &dynamicsNotifier, &DynamicsCollisionNotifier::CollisionDisperse, collisionData ); -} - -} // namespace Internal - -} // namespace Dali - -#endif // __DALI_INTERNAL_EVENTS_DYNAMICS_COLLISION_NOTIFIER_H__ - diff --git a/dali/internal/event/dynamics/dynamics-cone-shape-impl.cpp b/dali/internal/event/dynamics/dynamics-cone-shape-impl.cpp deleted file mode 100644 index 0b46380..0000000 --- a/dali/internal/event/dynamics/dynamics-cone-shape-impl.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// EXTERNAL HEADERS - -// INTERNAL HEADERS -#include -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -DynamicsConeShape::DynamicsConeShape(const float radius, const float length) -: DynamicsShape(Dali::DynamicsShape::CONE) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (radius:%.1f length:%.1f)\n", __PRETTY_FUNCTION__, radius, length); - - DynamicsWorldPtr world( DynamicsWorld::Get() ); - DALI_ASSERT_ALWAYS( world && "No Dynamics World !"); - - SceneGraph::DynamicsConeShape* coneShape = new SceneGraph::DynamicsConeShape( *world->GetSceneObject() ); - mDynamicsShape = coneShape; - - // Queue a message to ensure the underlying dynamics object is created in the update thread - InitializeDynamicsConeShapeMessage( *Stage::GetCurrent(), *coneShape, radius, length ); -} - -DynamicsConeShape::~DynamicsConeShape() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); -} - -Vector3 DynamicsConeShape::GetAABB() const -{ - return Vector3(); -} - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/event/dynamics/dynamics-cone-shape-impl.h b/dali/internal/event/dynamics/dynamics-cone-shape-impl.h deleted file mode 100644 index 068c926..0000000 --- a/dali/internal/event/dynamics/dynamics-cone-shape-impl.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef __DYNAMICS_CONE_SHAPE_IMPL_H__ -#define __DYNAMICS_CONE_SHAPE_IMPL_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// BASE CLASS HEADERS -#include - -// INTERNAL HEADERS -#include - -namespace Dali -{ - -namespace Internal -{ - -/** - * A cone. - */ -class DynamicsConeShape : public DynamicsShape -{ -public: - /** - * Constructor. - * @copydoc Dali::DynamicsShape::NewCone - */ - DynamicsConeShape(const float radius, const float length); - -protected: - /** - * Destructor. - * A reference counted object may only be deleted by calling Unreference() - */ - virtual ~DynamicsConeShape(); - -private: - // unimplemented copy constructor and assignment operator - DynamicsConeShape(const DynamicsConeShape&); - DynamicsConeShape& operator=(const DynamicsConeShape&); - -public: - /** - * Get an axis aligned bounding box for this shape - * @return An axis aligned bounding box for this shape - */ - virtual Vector3 GetAABB() const; -}; // class DynamicsConeShape - -} // namespace Internal - -} // namespace Dali - -#endif // __DYNAMICS_CONE_SHAPE_IMPL_H__ diff --git a/dali/internal/event/dynamics/dynamics-cube-shape-impl.cpp b/dali/internal/event/dynamics/dynamics-cube-shape-impl.cpp deleted file mode 100644 index 8a7d40c..0000000 --- a/dali/internal/event/dynamics/dynamics-cube-shape-impl.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// EXTERNAL HEADERS - -// INTERNAL HEADERS -#include -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -DynamicsCubeShape::DynamicsCubeShape(const Vector3& dimensions) -: DynamicsShape(Dali::DynamicsShape::CUBE) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (dimensions[%1.02f %1.02f %1.02f])\n", __PRETTY_FUNCTION__, dimensions.x, dimensions.y, dimensions.z); - - DynamicsWorldPtr world( DynamicsWorld::Get() ); - DALI_ASSERT_ALWAYS( world && "No Dynamics World !"); - - SceneGraph::DynamicsCubeShape* cubeShape = new SceneGraph::DynamicsCubeShape( *world->GetSceneObject() ); - mDynamicsShape = cubeShape; - - // Queue a message to ensure the underlying dynamics object is created in the update thread - InitializeDynamicsCubeShapeMessage( *Stage::GetCurrent(), *cubeShape, dimensions ); -} - -DynamicsCubeShape::~DynamicsCubeShape() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); -} - -Vector3 DynamicsCubeShape::GetAABB() const -{ - return Vector3(); -} - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/event/dynamics/dynamics-cube-shape-impl.h b/dali/internal/event/dynamics/dynamics-cube-shape-impl.h deleted file mode 100644 index 46a6613..0000000 --- a/dali/internal/event/dynamics/dynamics-cube-shape-impl.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef __DYNAMICS_CUBE_SHAPE_IMPL_H__ -#define __DYNAMICS_CUBE_SHAPE_IMPL_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// BASE CLASS HEADERS -#include - -// INTERNAL HEADERS -#include - -namespace Dali -{ - -namespace Internal -{ - -/** - * A cube - */ -class DynamicsCubeShape : public DynamicsShape -{ -public: - /** - * Constructor. - * @copydoc Dali::DynamicsShape::NewCube - */ - DynamicsCubeShape(const Vector3& dimensions); - -protected: - /** - * Destructor. - * A reference counted object may only be deleted by calling Unreference() - */ - virtual ~DynamicsCubeShape(); - -private: - // unimplemented copy constructor and assignment operator - DynamicsCubeShape(const DynamicsCubeShape&); - DynamicsCubeShape& operator=(const DynamicsCubeShape&); - -public: - /** - * Get an axis aligned bounding box for this shape - * @return An axis aligned bounding box for this shape - */ - virtual Vector3 GetAABB() const; -}; // class DynamicsCubeShape - -} // namespace Internal - -} // namespace Dali - -#endif // __DYNAMICS_CUBE_SHAPE_IMPL_H__ diff --git a/dali/internal/event/dynamics/dynamics-cylinder-shape-impl.cpp b/dali/internal/event/dynamics/dynamics-cylinder-shape-impl.cpp deleted file mode 100644 index ab99873..0000000 --- a/dali/internal/event/dynamics/dynamics-cylinder-shape-impl.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// EXTERNAL HEADERS - -// INTERNAL HEADERS -#include -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -DynamicsCylinderShape::DynamicsCylinderShape(const float radius, const float length) -: DynamicsShape(Dali::DynamicsShape::CYLINDER) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (radius:%.1f length:%.1f)\n", __PRETTY_FUNCTION__, radius, length); - - DynamicsWorldPtr world( DynamicsWorld::Get() ); - DALI_ASSERT_ALWAYS( world && "No Dynamics World !"); - - SceneGraph::DynamicsCylinderShape* cylinderShape = new SceneGraph::DynamicsCylinderShape( *world->GetSceneObject() ); - mDynamicsShape = cylinderShape; - - // Queue a message to ensure the underlying dynamics object is created in the update thread - InitializeDynamicsCylinderShapeMessage( *Stage::GetCurrent(), *cylinderShape, radius, length ); -} - -DynamicsCylinderShape::~DynamicsCylinderShape() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); -} - -Vector3 DynamicsCylinderShape::GetAABB() const -{ - return Vector3(); -} - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/event/dynamics/dynamics-cylinder-shape-impl.h b/dali/internal/event/dynamics/dynamics-cylinder-shape-impl.h deleted file mode 100644 index 0db3d68..0000000 --- a/dali/internal/event/dynamics/dynamics-cylinder-shape-impl.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef __DYNAMICS_CYLINDER_SHAPE_IMPL_H__ -#define __DYNAMICS_CYLINDER_SHAPE_IMPL_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// BASE CLASS HEADERS -#include - -// INTERNAL HEADERS -#include - -namespace Dali -{ - -namespace Internal -{ - -/** - * A cylinder - */ -class DynamicsCylinderShape : public DynamicsShape -{ -public: - /** - * Constructor - * @copydoc Dali::DynamicsShape::NewCylinder - */ - DynamicsCylinderShape(const float radius, const float length); - -protected: - /** - * Destructor. - * A reference counted object may only be deleted by calling Unreference() - */ - virtual ~DynamicsCylinderShape(); - -private: - // unimplemented copy constructor and assignment operator - DynamicsCylinderShape(const DynamicsCylinderShape&); - DynamicsCylinderShape& operator=(const DynamicsCylinderShape&); - -public: - /** - * Get an axis aligned bounding box for this shape - * @return An axis aligned bounding box for this shape - */ - virtual Vector3 GetAABB() const; -}; // class DynamicsCylinderShape - -} // namespace Internal - -} // namespace Dali - -#endif // __DYNAMICS_CYLINDER_SHAPE_IMPL_H__ diff --git a/dali/internal/event/dynamics/dynamics-declarations.h b/dali/internal/event/dynamics/dynamics-declarations.h deleted file mode 100644 index b60c233..0000000 --- a/dali/internal/event/dynamics/dynamics-declarations.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef __DYNAMICS_DECLARATIONS_H__ -#define __DYNAMICS_DECLARATIONS_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// INTERNAL HEADERS -#include - -namespace Dali -{ - -namespace Integration -{ - -struct DynamicsBodySettings; -struct DynamicsWorldSettings; - -} // namespace Integration -namespace Internal -{ - -class DynamicsNotifier; - -class DynamicsBody; -typedef IntrusivePtr DynamicsBodyPtr; - -class DynamicsBodyConfig; -typedef IntrusivePtr DynamicsBodyConfigPtr; - -class DynamicsCollision; -typedef IntrusivePtr DynamicsCollisionPtr; - -class DynamicsJoint; -typedef IntrusivePtr DynamicsJointPtr; - -class DynamicsSliderJoint; -typedef IntrusivePtr DynamicsSliderJointPtr; - -class DynamicsUniversalJoint; -typedef IntrusivePtr DynamicsUniversalJointPtr; - -class DynamicsShape; -typedef IntrusivePtr DynamicsShapePtr; - -class DynamicsCapsuleShape; -typedef IntrusivePtr DynamicsCapsuleShapePtr; - -class DynamicsConeShape; -typedef IntrusivePtr DynamicsConeShapePtr; - -class DynamicsCubeShape; -typedef IntrusivePtr DynamicsCubeShapePtr; - -class DynamicsCylinderShape; -typedef IntrusivePtr DynamicsCylinderShapePtr; - -class DynamicsSphereShape; -typedef IntrusivePtr DynamicsSphereShapePtr; - -class DynamicsWorld; -typedef IntrusivePtr DynamicsWorldPtr; - -class DynamicsWorldConfig; -typedef IntrusivePtr DynamicsWorldConfigPtr; - -struct DynamicsWorldSettings; - -} // namespace Internal - -} // namespace Dali - -#endif // __DYNAMICS_DECLARATIONS_H__ diff --git a/dali/internal/event/dynamics/dynamics-joint-impl.cpp b/dali/internal/event/dynamics/dynamics-joint-impl.cpp deleted file mode 100644 index 3f09ff6..0000000 --- a/dali/internal/event/dynamics/dynamics-joint-impl.cpp +++ /dev/null @@ -1,336 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// EXTERNAL HEADERS - -// INTERNAL HEADERS -#include -#include -#include -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -DynamicsJoint::DynamicsJoint(DynamicsWorldPtr world, DynamicsBodyPtr bodyA, DynamicsBodyPtr bodyB, const Vector3& offsetA, const Vector3& offsetB ) -: mDynamicsJoint(NULL), - mInitialized(false), - mBodyA(bodyA), - mBodyB(bodyB), - mOffsetA(offsetA), - mOffsetB(offsetB), - mSpringEnabled(0), - mMotorEnabled(0) -{ - for( unsigned int i = 0; i < RotationAxis; ++i ) - { - mTranslationLowerLimit[i] = 0.0f; - mTranslationUpperLimit[i] = 0.0f; - mRotationLowerLimit[i] = 0.0f; - mRotationUpperLimit[i] = 0.0f; - } - - for( unsigned int i = 0; i < MaxAxis; ++i ) - { - mSpringStiffness[i] = 0.0f; - mSpringDamping[i] = 0.5f; - mSpringCenterPoint[i] = 0.0f; - mMotorVelocity[i] = 0.0f; - mMotorForce[i] = 0.0f; - } - - mDynamicsJoint = new SceneGraph::DynamicsJoint( *(world->GetSceneObject()) ); -} - -DynamicsJoint::~DynamicsJoint() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); - - if( Stage::IsInstalled() ) - { - DeleteJointMessage( *( Stage::GetCurrent() ), *(GetSceneObject()) ); - } -} - -void DynamicsJoint::SetLinearLimit(const int axisIndex, const float lowerLimit, const float upperLimit) -{ - bool valueChanged(false); - - int bit(1 << 0); - for( unsigned int i = 0; i < RotationAxis; ++i) - { - if( (bit & axisIndex) ) - { - if( fabsf(lowerLimit - mTranslationLowerLimit[i]) >= GetRangedEpsilon(lowerLimit, mTranslationLowerLimit[i]) || - fabsf(upperLimit - mTranslationUpperLimit[i]) >= GetRangedEpsilon(upperLimit, mTranslationUpperLimit[i]) ) - { - mTranslationLowerLimit[i] = lowerLimit; - mTranslationUpperLimit[i] = upperLimit; - - valueChanged = true; - } - } - bit <<= 1; - } - - if( valueChanged ) - { - SetLimitMessage( *( Stage::GetCurrent() ), *(GetSceneObject()), axisIndex, lowerLimit, upperLimit ); - } -} - -void DynamicsJoint::SetAngularLimit(const int axisIndex, const Radian& lowerLimit, const Radian& upperLimit) -{ - bool valueChanged(false); - - int bit(1 << RotationAxis); - for( unsigned int i = 0; i < RotationAxis; ++i) - { - if( (bit & axisIndex) ) - { - if( ( ! Equals( lowerLimit, mRotationLowerLimit[i] ) ) || ( ! Equals( upperLimit, mRotationUpperLimit[i] ) ) ) - { - mRotationLowerLimit[i] = lowerLimit; - mRotationUpperLimit[i] = upperLimit; - - valueChanged = true; - } - } - bit <<= 1; - } - - if( valueChanged ) - { - SetLimitMessage( *( Stage::GetCurrent() ), *(GetSceneObject()), axisIndex, lowerLimit, upperLimit ); - } -} - -void DynamicsJoint::EnableSpring(const int axisIndex, const bool flag) -{ - int valueChanged(0); - - int bit(1 << 0); - for( unsigned int i = 0; i < MaxAxis; ++i) - { - if( (bit & axisIndex) && (flag != (mSpringEnabled & bit)) ) - { - if( flag ) - { - mSpringEnabled |= bit; - } - else - { - mSpringEnabled &= ~bit; - } - - valueChanged |= bit; - } - bit <<= 1; - } - - if( 0 != valueChanged ) - { - SetEnableSpringMessage( *( Stage::GetCurrent() ), *(GetSceneObject()), valueChanged, flag ); - } -} - -void DynamicsJoint::DynamicsJoint::SetSpringStiffness(const int axisIndex, const float stiffness) -{ - int valueChanged(0); - - int bit(1 << 0); - for( unsigned int i = 0; i < MaxAxis; ++i) - { - if( (bit & axisIndex) && fabsf(stiffness - mSpringStiffness[i]) >= GetRangedEpsilon(stiffness, mSpringStiffness[i]) ) - { - mSpringStiffness[i] = stiffness; - - valueChanged |= bit; - } - bit <<= 1; - } - - if( 0 != valueChanged ) - { - SetSpringStiffnessMessage( *( Stage::GetCurrent() ), *(GetSceneObject()), valueChanged, stiffness ); - } -} - -void DynamicsJoint::SetSpringDamping(const int axisIndex, const float damping) -{ - const float clampedDamping( Clamp(damping, 0.0f, 1.0f) ); - - int valueChanged(0); - - int bit(1 << 0); - for( unsigned int i = 0; i < MaxAxis; ++i) - { - if( (bit & axisIndex) && fabsf(clampedDamping - mSpringDamping[i]) >= GetRangedEpsilon(clampedDamping, mSpringDamping[i]) ) - { - mSpringDamping[i] = clampedDamping; - - valueChanged |= bit; - } - bit <<= 1; - } - - if( 0 != valueChanged ) - { - SetSpringDampingMessage( *( Stage::GetCurrent() ), *(GetSceneObject()), valueChanged, clampedDamping ); - } -} - -void DynamicsJoint::DynamicsJoint::SetSpringCenterPoint(const int axisIndex, const float ratio) -{ - int valueChanged(0); - - int bit(1 << 0); - for( unsigned int i = 0; i < MaxAxis; ++i) - { - if( (bit & axisIndex) && fabsf(ratio - mSpringCenterPoint[i]) >= GetRangedEpsilon(ratio, mSpringCenterPoint[i]) ) - { - mSpringCenterPoint[i] = ratio; - - valueChanged |= bit; - } - bit <<= 1; - } - - if( 0 != valueChanged ) - { - SetSpringCenterPointMessage( *( Stage::GetCurrent() ), *(GetSceneObject()), valueChanged, ratio ); - } -} - -void DynamicsJoint::EnableMotor(const int axisIndex, const bool flag) -{ - bool valueChanged(false); - - int bit(1 << 0); - for( unsigned int i = 0; i < MaxAxis; ++i) - { - if( (bit & axisIndex) && (flag != (mMotorEnabled & bit)) ) - { - if( flag ) - { - mMotorEnabled |= bit; - } - else - { - mMotorEnabled &= ~bit; - } - valueChanged = true; - } - bit <<= 1; - } - - if( valueChanged ) - { - SetEnableMotorMessage( *( Stage::GetCurrent() ), *(GetSceneObject()), axisIndex, flag ); - } -} - -void DynamicsJoint::SetMotorVelocity(const int axisIndex, const float velocity) -{ - bool valueChanged(false); - - int bit(1 << 0); - for( unsigned int i = 0; i < MaxAxis; ++i) - { - if( (bit & axisIndex) && fabsf(velocity - mMotorVelocity[i]) >= GetRangedEpsilon(velocity, mMotorVelocity[i]) ) - { - mMotorVelocity[i] = velocity; - - valueChanged = true; - } - bit <<= 1; - } - - if( valueChanged ) - { - SetMotorVelocityMessage( *( Stage::GetCurrent() ), *(GetSceneObject()), axisIndex, velocity ); - } -} - -void DynamicsJoint::SetMotorForce(const int axisIndex, const float force) -{ - bool valueChanged(false); - - int bit(1 << 0); - for( unsigned int i = 0; i < MaxAxis; ++i) - { - if( (bit & axisIndex) && fabsf(force - mMotorForce[i]) >= GetRangedEpsilon(force, mMotorForce[i]) ) - { - mMotorForce[i] = force; - - valueChanged = true; - } - bit <<= 1; - } - - if( valueChanged ) - { - SetMotorForceMessage( *( Stage::GetCurrent() ), *(GetSceneObject()), axisIndex, force ); - } -} - -ActorPtr DynamicsJoint::GetActor( const bool first ) const -{ - DynamicsBodyPtr body( first ? mBodyA : mBodyB ); - - return DynamicsWorld::Get()->GetMappedActor( body->GetSceneObject() ); -} - -void DynamicsJoint::Connect( EventThreadServices& eventThreadServices ) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); - - if( !mInitialized ) - { - InitializeDynamicsJointMessage( eventThreadServices, *mDynamicsJoint, *(mBodyA->GetSceneObject()), *(mBodyB->GetSceneObject()), mOffsetA, mOffsetB ); - mInitialized = true; - } - - ConnectJointMessage( eventThreadServices, *(GetSceneObject()) ); -} - -void DynamicsJoint::Disconnect( EventThreadServices& eventThreadServices ) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); - - if( eventThreadServices.IsCoreRunning() ) - { - DisconnectJointMessage( eventThreadServices, *(GetSceneObject()) ); - } -} - -SceneGraph::DynamicsJoint* DynamicsJoint::GetSceneObject() const -{ - return mDynamicsJoint; -} - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/event/dynamics/dynamics-joint-impl.h b/dali/internal/event/dynamics/dynamics-joint-impl.h deleted file mode 100644 index e6a89cf..0000000 --- a/dali/internal/event/dynamics/dynamics-joint-impl.h +++ /dev/null @@ -1,165 +0,0 @@ -#ifndef __DYNAMICS_JOINT_IMPL_H__ -#define __DYNAMICS_JOINT_IMPL_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// BASE CLASS HEADER -#include - -// INTERNAL HEADERS -#include -#include -#include - -namespace Dali -{ - -class Quaternion; -struct Vector3; - -namespace Internal -{ -class EventThreadServices; - -namespace SceneGraph -{ -class DynamicsJoint; -class Node; -} // namespace SceneGraph - -class Actor; -class DynamicsJoint; -class Stage; - -/// @copydoc Dali::DynamicsJoint -class DynamicsJoint : public BaseObject -{ -public: - /** - * Constructor. - * @copydoc Dali::DynamicsJoint::New - */ - DynamicsJoint(DynamicsWorldPtr world, DynamicsBodyPtr bodyA, DynamicsBodyPtr bodyB, const Vector3& offsetA, const Vector3& offsetB); - -protected: - /** - * Destructor. - * A reference counted object may only be deleted by calling Unreference() - */ - virtual ~DynamicsJoint(); - -private: - // unimplemented copy constructor and assignment operator - DynamicsJoint(const DynamicsJoint&); - DynamicsJoint& operator=(const DynamicsJoint&); - - // Methods -public: - /// @copydoc Dali::DynamicsJoint::SetLinearLimit - void SetLinearLimit(const int axisIndex, const float lowerLimit, const float upperLimit); - - /// @copydoc Dali::DynamicsJoint::SetAngularLimit - void SetAngularLimit(const int axisIndex, const Radian& lowerLimit, const Radian& upperLimit); - - /// @copydoc Dali::DynamicsJoint::EnableSpring - void EnableSpring(const int axisIndex, const bool flag); - - /// @copydoc Dali::DynamicsJoint::SetSpringStiffness - void SetSpringStiffness(const int axisIndex, const float stiffness); - - /// @copydoc Dali::DynamicsJoint::SetSpringDamping - void SetSpringDamping(const int axisIndex, const float damping); - - /// @copydoc Dali::DynamicsJoint::SetSpringCenterPoint - void SetSpringCenterPoint(const int axisIndex, const float ratio); - - /// @copydoc Dali::DynamicsJoint::EnableMotor - void EnableMotor(const int axisIndex, const bool flag); - - /// @copydoc Dali::DynamicsJoint::SetMotorVelocity - void SetMotorVelocity(const int axisIndex, const float velocity); - - /// @copydoc Dali::DynamicsJoint::SetMotorForce - void SetMotorForce(const int axisIndex, const float force); - - /// @copydoc Dali::DynamicsJoint::GetActor - ActorPtr GetActor( const bool first ) const; - - /** - * Called when the associated actor is added to the stage - * @param[in] eventThreadServices Object that can send messages to scene graph - */ - void Connect( EventThreadServices& eventThreadServices ); - - /** - * Called when the associated actor is removed from the stage - * @param[in] eventThreadServices Object that can send messages to scene graph - */ - void Disconnect( EventThreadServices& eventThreadServices ); - - SceneGraph::DynamicsJoint* GetSceneObject() const; - -public: - static const unsigned int MaxAxis = 6; - static const unsigned int RotationAxis = 3; - -protected: - SceneGraph::DynamicsJoint* mDynamicsJoint; - bool mInitialized; - DynamicsBodyPtr mBodyA; - DynamicsBodyPtr mBodyB; - Vector3 mOffsetA; - Vector3 mOffsetB; - float mTranslationLowerLimit[RotationAxis]; - float mTranslationUpperLimit[RotationAxis]; - float mRotationLowerLimit[RotationAxis]; - float mRotationUpperLimit[RotationAxis]; - unsigned int mSpringEnabled; - float mSpringStiffness[MaxAxis]; - float mSpringDamping[MaxAxis]; - float mSpringCenterPoint[MaxAxis]; - unsigned int mMotorEnabled; - float mMotorVelocity[MaxAxis]; - float mMotorForce[MaxAxis]; -}; // class DynamicsJoint - -} // namespace Internal - -// Helpers for public-api forwarding methods - -inline Internal::DynamicsJoint& GetImplementation(DynamicsJoint& object) -{ - DALI_ASSERT_ALWAYS(object && "DynamicsJoint object is uninitialized!"); - - Dali::RefObject& handle = object.GetBaseObject(); - - return static_cast(handle); -} - -inline const Internal::DynamicsJoint& GetImplementation(const DynamicsJoint& object) -{ - DALI_ASSERT_ALWAYS(object && "DynamicsJoint object is uninitialized!"); - - const Dali::RefObject& handle = object.GetBaseObject(); - - return static_cast(handle); -} - -} // namespace Dali - -#endif // __DYNAMICS_JOINT_IMPL_H__ diff --git a/dali/internal/event/dynamics/dynamics-notifier.h b/dali/internal/event/dynamics/dynamics-notifier.h deleted file mode 100644 index 0076321..0000000 --- a/dali/internal/event/dynamics/dynamics-notifier.h +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef __DALI_INTERNAL_EVENT_DYNAMICS_NOTIFIER_H__ -#define __DALI_INTERNAL_EVENT_DYNAMICS_NOTIFIER_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// INTERNAL INCLUDES -#include - -namespace Dali -{ - -namespace Integration -{ - -struct DynamicsCollisionData; - -} // namespace Integration - -namespace Internal -{ - -/** - * Interface used by the update-thread to trigger collision event signals. - */ -class DynamicsNotifier -{ -public: - - /** - * Constructor. - */ - DynamicsNotifier() - { - } - - /** - * Virtual destructor. - */ - virtual ~DynamicsNotifier() - { - } - - /** - * Invoked when the simulation detects a new collision between two bodies. - * @param[in] collisionData Contains information about the colliding bodies, their - * points of contact, and impact magnitude - */ - virtual void CollisionImpact( Integration::DynamicsCollisionData* collisionData ) = 0; - - /** - * Invoked when the simulation detects two bodies already in collision scraping against each other. - * @param[in] collisionData Contains information about the colliding bodies, their - * points of contact, and impact magnitude - */ - virtual void CollisionScrape( Integration::DynamicsCollisionData* collisionData ) = 0; - - /** - * Invoked when the simulation detects two previously colliding bodies moving apart. - * @param[in] collisionData Contains information about the colliding bodies. - */ - virtual void CollisionDisperse( Integration::DynamicsCollisionData* collisionData ) = 0; -}; // class DynamicsNotifier - -inline MessageBase* CollisionImpactMessage( DynamicsNotifier& dynamicsNotifier, Integration::DynamicsCollisionData* collisionData ) -{ - return new MessageValue1< DynamicsNotifier, Integration::DynamicsCollisionData* >( &dynamicsNotifier, &DynamicsNotifier::CollisionImpact, collisionData ); -} - -inline MessageBase* CollisionScrapeMessage( DynamicsNotifier& dynamicsNotifier, Integration::DynamicsCollisionData* collisionData ) -{ - return new MessageValue1< DynamicsNotifier, Integration::DynamicsCollisionData* >( &dynamicsNotifier, &DynamicsNotifier::CollisionScrape, collisionData ); -} - -inline MessageBase* CollisionDisperseMessage( DynamicsNotifier& dynamicsNotifier, Integration::DynamicsCollisionData* collisionData ) -{ - return new MessageValue1< DynamicsNotifier, Integration::DynamicsCollisionData* >( &dynamicsNotifier, &DynamicsNotifier::CollisionDisperse, collisionData ); -} - -} // namespace Internal - -} // namespace Dali - -#endif // __DALI_INTERNAL_EVENT_DYNAMICS_NOTIFIER_H__ diff --git a/dali/internal/event/dynamics/dynamics-shape-impl.cpp b/dali/internal/event/dynamics/dynamics-shape-impl.cpp deleted file mode 100644 index 071ea88..0000000 --- a/dali/internal/event/dynamics/dynamics-shape-impl.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// INTERNAL HEADERS -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - - -DynamicsShape::DynamicsShape(const Dali::DynamicsShape::ShapeType type) -: mType(type), - mDynamicsShape(NULL) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (type: %d)\n", __PRETTY_FUNCTION__, static_cast(type)); -} - -DynamicsShape::~DynamicsShape() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); - if( mDynamicsShape && Stage::IsInstalled() ) - { - DeleteShapeMessage( *( Stage::GetCurrent() ), *mDynamicsShape ); - } -} - -const Dali::DynamicsShape::ShapeType DynamicsShape::GetType() const -{ - return mType; -} - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/event/dynamics/dynamics-shape-impl.h b/dali/internal/event/dynamics/dynamics-shape-impl.h deleted file mode 100644 index 61dc35f..0000000 --- a/dali/internal/event/dynamics/dynamics-shape-impl.h +++ /dev/null @@ -1,112 +0,0 @@ -#ifndef __DYNAMICS_SHAPE_IMPL_H__ -#define __DYNAMICS_SHAPE_IMPL_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL HEADERS -#include - -// BASE CLASS HEADERS -#include -#include - -// INTERNAL HEADERS -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace SceneGraph -{ -class DynamicsShape; -} // namespace SceneGraph - -class DynamicsShape; -typedef IntrusivePtr< DynamicsShape > DynamicsShapePtr; - -/// @copydoc Dali::DynamicsShape -class DynamicsShape : public BaseObject -{ -public: - /** - * Constructor - * @param[in] type The type of shape. One of Dali::DynamicsShape::ShapeType enumeration. - */ - DynamicsShape(Dali::DynamicsShape::ShapeType type); - -protected: - /** - * Destructor - * A reference counted object may only be deleted by calling Unreference() - */ - virtual ~DynamicsShape(); - -public: - /** - * Get an axis aligned bounding box for this shape - * @return An axis aligned bounding box for this shape - */ - virtual Vector3 GetAABB() const = 0; - - /// @copydoc Dali::DynamicsShape::GetType - const Dali::DynamicsShape::ShapeType GetType() const; - - SceneGraph::DynamicsShape* GetSceneObject() const - { - return mDynamicsShape; - } - -private: - // unimplemented copy constructor and assignment operator - DynamicsShape(const DynamicsShape&); - DynamicsShape& operator=(const DynamicsShape&); - - // Attributes -protected: - Dali::DynamicsShape::ShapeType mType; - SceneGraph::DynamicsShape* mDynamicsShape; -}; // class DynamicsShape - -} // namespace Internal - -inline Internal::DynamicsShape& GetImplementation(DynamicsShape& object) -{ - DALI_ASSERT_ALWAYS(object && "DynamicsShape object is uninitialized!"); - - Dali::RefObject& handle = object.GetBaseObject(); - - return static_cast(handle); -} - -inline const Internal::DynamicsShape& GetImplementation(const DynamicsShape& object) -{ - DALI_ASSERT_ALWAYS(object && "DynamicsShape object is uninitialized!"); - - const Dali::RefObject& handle = object.GetBaseObject(); - - return static_cast(handle); -} - -} // namespace Dali - -#endif // __COLLISION_SHAPE_IMPL_H__ diff --git a/dali/internal/event/dynamics/dynamics-slider-joint-impl.cpp b/dali/internal/event/dynamics/dynamics-slider-joint-impl.cpp deleted file mode 100644 index 9bcf8ca..0000000 --- a/dali/internal/event/dynamics/dynamics-slider-joint-impl.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// EXTERNAL HEADERS - -// INTERNAL HEADERS -#include -#include -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -DynamicsSliderJoint::DynamicsSliderJoint(DynamicsWorldPtr world, - DynamicsBodyPtr bodyA, DynamicsBodyPtr bodyB, - const Vector3& pointA, const Vector3& pointB, const Vector3& axis, - const float translationLowerLimit, const float translationUpperLimit, - const Radian& rotationLowerLimit, const Radian& rotationUpperLimit ) -: DynamicsJoint(Dali::DynamicsJoint::SLIDER), - mTranslationLowerLimit(1.0f), - mTranslationUpperLimit(-1.0f), - mRotationLowerLimit(0.0f), - mRotationUpperLimit(0.0f) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (\"%s\", \"%s\")\n", - __PRETTY_FUNCTION__, bodyA->GetName().c_str(), (bodyB) ? bodyB->GetName().c_str() : "FIXED" ); - - SceneGraph::DynamicsSliderJoint* joint( new SceneGraph::DynamicsSliderJoint( *(world->GetSceneObject()) ) ); - mDynamicsJoint = joint; - - SceneGraph::DynamicsBody* bA(bodyA->GetSceneObject()); - SceneGraph::DynamicsBody* bB(!bodyB ? NULL : bodyB->GetSceneObject() ); - - Stage::GetCurrent().QueueMessage( InitializeDynamicsSliderJointMessage(*joint, *bA, bB, pointA, pointB, axis) ); - - SetTranslationLowerLimit(translationLowerLimit); - SetTranslationUpperLimit(translationUpperLimit); - SetRotationLowerLimit(rotationLowerLimit); - SetRotationUpperLimit(rotationUpperLimit); -} - -DynamicsSliderJoint::~DynamicsSliderJoint() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); -} - -float DynamicsSliderJoint::GetTranslationLowerLimit() const -{ - return mTranslationLowerLimit; -} - -void DynamicsSliderJoint::SetTranslationLowerLimit( const float limit ) -{ - if( mTranslationLowerLimit != limit ) - { - mTranslationLowerLimit = limit; - - Stage::GetCurrent().QueueMessage( SetTranslationLowerLimitMessage( *(GetSceneObject()), limit ) ); - } -} - -float DynamicsSliderJoint::GetTranslationUpperLimit() const -{ - return mTranslationUpperLimit; -} - -void DynamicsSliderJoint::SetTranslationUpperLimit( const float limit ) -{ - if( mTranslationUpperLimit != limit ) - { - mTranslationUpperLimit = limit; - - Stage::GetCurrent().QueueMessage( SetTranslationUpperLimitMessage( *(GetSceneObject()), limit ) ); - } -} - -Radian DynamicsSliderJoint::GetRotationLowerLimit() const -{ - return mRotationLowerLimit; -} - -void DynamicsSliderJoint::SetRotationLowerLimit( const Radian& limit ) -{ - if( mRotationLowerLimit != limit ) - { - mRotationLowerLimit = limit; - - Stage::GetCurrent().QueueMessage( SetRotationLowerLimitMessage( *(GetSceneObject()), limit ) ); - } -} - -Radian DynamicsSliderJoint::GetRotationUpperLimit() const -{ - return mRotationUpperLimit; -} - -void DynamicsSliderJoint::SetRotationUpperLimit( const Radian& limit ) -{ - if( mRotationUpperLimit != limit ) - { - mRotationUpperLimit = limit; - - Stage::GetCurrent().QueueMessage( SetRotationUpperLimitMessage( *(GetSceneObject()), limit ) ); - } -} - -SceneGraph::DynamicsSliderJoint* DynamicsSliderJoint::GetSceneObject() const -{ - return static_cast(DynamicsJoint::GetSceneObject()); -} - - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/event/dynamics/dynamics-slider-joint-impl.h b/dali/internal/event/dynamics/dynamics-slider-joint-impl.h deleted file mode 100644 index 1212007..0000000 --- a/dali/internal/event/dynamics/dynamics-slider-joint-impl.h +++ /dev/null @@ -1,105 +0,0 @@ -#ifndef __DYNAMICS_SLIDER_JOINT_IMPL_H__ -#define __DYNAMICS_SLIDER_JOINT_IMPL_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// BASE CLASS HEADER -#include - -// INTERNAL HEADERS -#include - -namespace Dali -{ - -struct Degree; -struct Vector3; - -namespace Internal -{ - -namespace SceneGraph -{ -class DynamicsSliderJoint; -} // namespace SceneGraph - -class DynamicsSliderJoint : public DynamicsJoint -{ -public: - /** - * Constructor. - * @copydoc Dali::DynamicsJoint::NewSlider - */ - DynamicsSliderJoint(DynamicsWorldPtr world, - DynamicsBodyPtr bodyA, DynamicsBodyPtr bodyB, - const Vector3& pointA, const Vector3& pointB, const Vector3& axis, - const float translationLowerLimit, const float translationUpperLimit, - const Radian& rotationLowerLimit, const Radian& rotationUpperLimit ); - -protected: - /** - * Destructor. - * A reference counted object may only be deleted by calling Unreference() - */ - virtual ~DynamicsSliderJoint(); - -private: - // unimplemented copy constructor and assignment operator - DynamicsSliderJoint(const DynamicsSliderJoint&); - DynamicsSliderJoint& operator=(const DynamicsSliderJoint&); - - // Methods -public: - /// @copydoc Dali::DynamicsSliderJoint::GetTranslationLowerLimit - float GetTranslationLowerLimit() const; - - /// @copydoc Dali::DynamicsSliderJoint::SetTranslationLowerLimit - void SetTranslationLowerLimit( const float limit ); - - /// @copydoc Dali::DynamicsSliderJoint::GetTranslationUpperLimit - float GetTranslationUpperLimit() const; - - /// @copydoc Dali::DynamicsSliderJoint::SetTranslationUpperLimit - void SetTranslationUpperLimit( const float limit ); - - /// @copydoc Dali::DynamicsSliderJoint::GetRotationLowerLimit - Radian GetRotationLowerLimit() const; - - /// @copydoc Dali::DynamicsSliderJoint::SetRotationLowerLimit - void SetRotationLowerLimit( const Radian& limit ); - - /// @copydoc Dali::DynamicsSliderJoint::GetRotationUpperLimit - Radian GetRotationUpperLimit() const; - - /// @copydoc Dali::DynamicsSliderJoint::SetRotationUpperLimit - void SetRotationUpperLimit( const Radian& limit ); - - SceneGraph::DynamicsSliderJoint* GetSceneObject() const; - -private: - float mTranslationLowerLimit; - float mTranslationUpperLimit; - Radian mRotationLowerLimit; - Radian mRotationUpperLimit; -}; // class DynamicsSliderJoint - -} // namespace Internal - -} // namespace Dali - -#endif // __DYNAMICS_SLIDER_JOINT_IMPL_H__ diff --git a/dali/internal/event/dynamics/dynamics-sphere-shape-impl.cpp b/dali/internal/event/dynamics/dynamics-sphere-shape-impl.cpp deleted file mode 100644 index 8267cf9..0000000 --- a/dali/internal/event/dynamics/dynamics-sphere-shape-impl.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// INTERNAL HEADERS -#include -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -DynamicsSphereShape::DynamicsSphereShape(const float radius) -: DynamicsShape(Dali::DynamicsShape::SPHERE) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (radius: %f)\n", __PRETTY_FUNCTION__, radius); - - DynamicsWorldPtr world( DynamicsWorld::Get() ); - DALI_ASSERT_ALWAYS( world && "No Dynamics World !"); - - SceneGraph::DynamicsSphereShape* sphereShape = new SceneGraph::DynamicsSphereShape( *world->GetSceneObject() ); - mDynamicsShape = sphereShape; - - // Queue a message to ensure the underlying dynamics object is created in the update thread - InitializeDynamicsSphereShapeMessage( *Stage::GetCurrent(), *sphereShape, radius ); -} - -DynamicsSphereShape::~DynamicsSphereShape() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); -} - -Vector3 DynamicsSphereShape::GetAABB() const -{ - return Vector3(); -} - - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/event/dynamics/dynamics-sphere-shape-impl.h b/dali/internal/event/dynamics/dynamics-sphere-shape-impl.h deleted file mode 100644 index 0662f55..0000000 --- a/dali/internal/event/dynamics/dynamics-sphere-shape-impl.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef __DYNAMICS_SPHERE_SHAPE_IMPL_H_ -#define __DYNAMICS_SPHERE_SHAPE_IMPL_H_ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// BASE CLASS HEADERS -#include - -// INTERNAL HEADERS -#include - -namespace Dali -{ - -namespace Internal -{ - -/** - * A sphere - */ -class DynamicsSphereShape : public DynamicsShape -{ -public: - /** - * Constructor - * @copydoc Dali::DynamicsShape::NewSphere - */ - DynamicsSphereShape(const float radius); - -protected: - /** - * Destructor - * A reference counted object may only be deleted by calling Unreference() - */ - virtual ~DynamicsSphereShape(); - -private: - // unimplemented copy constructor and assignment operator - DynamicsSphereShape(const DynamicsSphereShape&); - DynamicsSphereShape& operator=(const DynamicsSphereShape&); - -public: - /** - * Get an axis aligned bounding box for this shape - * @return An axis aligned bounding box for this shape - */ - virtual Vector3 GetAABB() const; -}; // class DynamicsSphereShape - -} // namespace Internal - -} // namespace Dali - -#endif /* __DYNAMICS_SPHERE_SHAPE_IMPL_H_ */ diff --git a/dali/internal/event/dynamics/dynamics-universal-joint-impl.cpp b/dali/internal/event/dynamics/dynamics-universal-joint-impl.cpp deleted file mode 100644 index 438e233..0000000 --- a/dali/internal/event/dynamics/dynamics-universal-joint-impl.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// EXTERNAL HEADERS - -// INTERNAL HEADERS -#include -#include -#include -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -DynamicsUniversalJoint::DynamicsUniversalJoint(DynamicsWorldPtr world, - DynamicsBodyPtr bodyA, DynamicsBodyPtr bodyB, - const Vector3& pointA, const Quaternion& orientationA, - const Vector3& pointB, const Quaternion& orientationB ) -: DynamicsJoint(Dali::DynamicsJoint::UNIVERSAL), - mTranslationLowerLimit(Vector3::ZERO), - mTranslationUpperLimit(Vector3::ZERO), - mRotationLowerLimit(Vector3::ONE), - mRotationUpperLimit(-Vector3::ONE) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); - - SceneGraph::DynamicsUniversalJoint* univeralJoint( new SceneGraph::DynamicsUniversalJoint(*(world->GetSceneObject())) ); - mDynamicsJoint = univeralJoint; - - Stage::GetCurrent().QueueMessage( InitializeDynamicsUniversalJointMessage(*univeralJoint, - *(bodyA->GetSceneObject()), *(bodyB->GetSceneObject()), - pointA, orientationA, pointB, orientationB) ); -} - -DynamicsUniversalJoint::~DynamicsUniversalJoint() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); -} - -Vector3 DynamicsUniversalJoint::GetTranslationLowerLimit() const -{ - return mTranslationLowerLimit; -} - -void DynamicsUniversalJoint::SetTranslationLowerLimit( const Vector3& limit ) -{ - if( mTranslationLowerLimit != limit ) - { - mTranslationLowerLimit = limit; - - Stage::GetCurrent().QueueMessage( SetTranslationLowerLimitMessage( *(GetSceneObject()), limit ) ); - } -} - -Vector3 DynamicsUniversalJoint::GetTranslationUpperLimit() const -{ - return mTranslationUpperLimit; -} - -void DynamicsUniversalJoint::SetTranslationUpperLimit( const Vector3& limit ) -{ - if( mTranslationUpperLimit != limit ) - { - mTranslationUpperLimit = limit; - - Stage::GetCurrent().QueueMessage( SetTranslationUpperLimitMessage( *(GetSceneObject()), limit ) ); - } -} - -Vector3 DynamicsUniversalJoint::GetRotationLowerLimit() const -{ - return mRotationLowerLimit; -} - -void DynamicsUniversalJoint::SetRotationLowerLimit( const Vector3& limit ) -{ - if( mRotationLowerLimit != limit ) - { - mRotationLowerLimit = limit; - - Stage::GetCurrent().QueueMessage( SetRotationLowerLimitMessage( *(GetSceneObject()), limit ) ); - } -} - -Vector3 DynamicsUniversalJoint::GetRotationUpperLimit() const -{ - return mRotationUpperLimit; -} - -void DynamicsUniversalJoint::SetRotationUpperLimit( const Vector3& limit ) -{ - if( mRotationUpperLimit != limit ) - { - mRotationUpperLimit = limit; - - Stage::GetCurrent().QueueMessage( SetRotationUpperLimitMessage( *(GetSceneObject()), limit ) ); - } -} - -void DynamicsJoint::EnableSpring(const int index, const bool flag) -{ -} - -void DynamicsJoint::SetStiffness(const int index, const float stiffness) -{ -} - -void DynamicsJoint::SetCenterPoint(const int index, const float ratio) -{ -} - -void EnableMotor(const int index, const bool flag) -{ -} - -void SetMotorVelocity(const int index, const float velocity) -{ -} - -void SetMotorForce(const int index, const float force) -{ -} - - -SceneGraph::DynamicsUniversalJoint* DynamicsUniversalJoint::GetSceneObject() const -{ - return static_cast(DynamicsJoint::GetSceneObject()); -} - - - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/event/dynamics/dynamics-universal-joint-impl.h b/dali/internal/event/dynamics/dynamics-universal-joint-impl.h deleted file mode 100644 index 6623312..0000000 --- a/dali/internal/event/dynamics/dynamics-universal-joint-impl.h +++ /dev/null @@ -1,106 +0,0 @@ -#ifndef __DYNAMICS_UNIVERSAL_JOINT_IMPL_H__ -#define __DYNAMICS_UNIVERSAL_JOINT_IMPL_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// BASE CLASS HEADER -#include - -// INTERNAL HEADERS -#include - -namespace Dali -{ - -class Quaternion; -struct Vector3; - -namespace Internal -{ - -namespace SceneGraph -{ -class DynamicsUniversalJoint; -} // namespace SceneGraph - -/// @copydoc Dali::DynamicsUniversalJoint -class DynamicsUniversalJoint : public DynamicsJoint -{ -public: - - /** - * Constructor. - * @copydoc Dali::DynamicsJoint::NewUniversal - */ - DynamicsUniversalJoint(DynamicsWorldPtr world, - DynamicsBodyPtr bodyA, DynamicsBodyPtr bodyB, - const Vector3& pointA, const Quaternion& orientationA, - const Vector3& pointB, const Quaternion& orientationB ); - -protected: - /** - * Destructor. - * A reference counted object may only be deleted by calling Unreference() - */ - virtual ~DynamicsUniversalJoint(); - -private: - // unimplemented copy constructor and assignment operator - DynamicsUniversalJoint(const DynamicsUniversalJoint&); - DynamicsUniversalJoint& operator=(const DynamicsUniversalJoint&); - - // Methods -public: - /// @copydoc Dali::DynamicsJoint::GetTranslationLowerLimit - Vector3 GetTranslationLowerLimit() const; - - /// @copydoc Dali::DynamicsJoint::SetTranslationLowerLimit - void SetTranslationLowerLimit( const Vector3& limit ); - - /// @copydoc Dali::DynamicsJoint::GetTranslationUpperLimit - Vector3 GetTranslationUpperLimit() const; - - /// @copydoc Dali::DynamicsJoint::SetTranslationUpperLimit - void SetTranslationUpperLimit( const Vector3& limit ); - - /// @copydoc Dali::DynamicsJoint::GetRotationLowerLimit - Vector3 GetRotationLowerLimit() const; - - /// @copydoc Dali::DynamicsJoint::SetRotationLowerLimit - void SetRotationLowerLimit( const Vector3& limit ); - - /// @copydoc Dali::DynamicsJoint::GetRotationUpperLimit - Vector3 GetRotationUpperLimit() const; - - /// @copydoc Dali::DynamicsJoint::SetRotationUpperLimit - void SetRotationUpperLimit( const Vector3& limit ); - - SceneGraph::DynamicsUniversalJoint* GetSceneObject() const; - -private: - Vector3 mTranslationLowerLimit; - Vector3 mTranslationUpperLimit; - Vector3 mRotationLowerLimit; - Vector3 mRotationUpperLimit; -}; // class DynamicsUniversalJoint - -} // namespace Internal - -} // namespace Dali - -#endif // __DYNAMICS_UNIVERSAL_JOINT_IMPL_H__ diff --git a/dali/internal/event/dynamics/dynamics-world-config-impl.cpp b/dali/internal/event/dynamics/dynamics-world-config-impl.cpp deleted file mode 100644 index 5fa90fd..0000000 --- a/dali/internal/event/dynamics/dynamics-world-config-impl.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// EXTERNAL HEADERS - -// INTERNAL HEADERS -#include -#include - -namespace Dali -{ - -namespace Integration -{ - -const Vector3 DEFAULT_DYNAMICS_WORLD_GRAVITY(0.0f, 10.0f, 0.0f); -const float DEFAULT_DYNAMICS_WORLD_AIR_DENSITY(1.2f); -const float DEFAULT_DYNAMICS_WORLD_WATER_DENSITY(0.0f); -const float DEFAULT_DYNAMICS_WORLD_WATER_OFFSET(0.0f); -const Vector3 DEFAULT_DYNAMICS_WORLD_WATER_NORMAL(0.0f, 0.0f, 0.0f); -const float DEFAULT_DYNAMICS_WORLD_SCALE(1.0f/100.0f); -const int DEFAULT_DYNAMICS_WORLD_SUB_STEPS(1); - -} // namespace Integration - -namespace Internal -{ - -DynamicsWorldConfig::DynamicsWorldConfig() -: mSettings(NULL) -{ - mSettings = new Integration::DynamicsWorldSettings; -} - -DynamicsWorldConfig::~DynamicsWorldConfig() -{ - delete mSettings; -} - -void DynamicsWorldConfig::SetType( const Dali::DynamicsWorldConfig::WorldType type ) -{ - mSettings->type = type; -} - -Dali::DynamicsWorldConfig::WorldType DynamicsWorldConfig::GetType() const -{ - return mSettings->type; -} - -void DynamicsWorldConfig::SetGravity( const Vector3& gravity ) -{ - mSettings->gravity = gravity; -} - -const Vector3& DynamicsWorldConfig::GetGravity() const -{ - return mSettings->gravity; -} - -void DynamicsWorldConfig::SetUnit(const float unit) -{ - mSettings->worldScale = unit; -} - -const float DynamicsWorldConfig::GetUnit() const -{ - return mSettings->worldScale; -} - -void DynamicsWorldConfig::SetSimulationSubSteps( const int subSteps) -{ - mSettings->subSteps = subSteps; -} - -const int DynamicsWorldConfig::GetSimulationSubSteps() const -{ - return mSettings->subSteps; -} - -Integration::DynamicsWorldSettings* DynamicsWorldConfig::GetSettings() const -{ - return mSettings; -} - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/event/dynamics/dynamics-world-config-impl.h b/dali/internal/event/dynamics/dynamics-world-config-impl.h deleted file mode 100644 index ba352ab..0000000 --- a/dali/internal/event/dynamics/dynamics-world-config-impl.h +++ /dev/null @@ -1,117 +0,0 @@ -#ifndef __DYNAMICS_WORLD_CONFIG_IMPL_H__ -#define __DYNAMICS_WORLD_CONFIG_IMPL_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// BASE CLASS HEADER -#include - -// INTERNAL HEADERS -#include -#include - -namespace Dali -{ - -namespace Integration -{ - -struct DynamicsWorldSettings; - -} // namespace Integration - -namespace Internal -{ -/// @copydoc Dali::DynamicsWorldConfig -class DynamicsWorldConfig : public BaseObject -{ -public: - /** - * Constructor. - */ - DynamicsWorldConfig(); - -protected: - /** - * Destructor. - * A reference counted object may only be deleted by calling Unreference() - */ - virtual ~DynamicsWorldConfig(); - -private: - // unimplemented copy constructor and assignment operator - DynamicsWorldConfig(const DynamicsWorldConfig&); - DynamicsWorldConfig& operator=(const DynamicsWorldConfig&); - - // Methods -public: - /// @copydoc Dali::DynamicsWorldConfig::SetType - void SetType( const Dali::DynamicsWorldConfig::WorldType type ); - - /// @copydoc Dali::DynamicsWorldConfig::GetType - Dali::DynamicsWorldConfig::WorldType GetType() const; - - /// @copydoc Dali::DynamicsWorldConfig::SetGravity - void SetGravity( const Vector3& gravity ); - - /// @copydoc Dali::DynamicsWorldConfig::GetGravity - const Vector3& GetGravity() const; - - /// @copydoc Dali::DynamicsWorldConfig::SetUnit - void SetUnit(const float unit); - - /// @copydoc Dali::DynamicsWorldConfig::GetUnit - const float GetUnit() const; - - /// @copydoc Dali::DynamicsWorldConfig::SetSimulationSubSteps - void SetSimulationSubSteps( const int subSteps); - - /// @copydoc Dali::DynamicsWorldConfig::GetSimulationSubSteps - const int GetSimulationSubSteps() const; - - Integration::DynamicsWorldSettings* GetSettings() const; - -private: - Integration::DynamicsWorldSettings* mSettings; -}; // class DynamicsWorldConfig - -} // namespace Internal - -// Helpers for public-api forwarding methods - -inline Internal::DynamicsWorldConfig& GetImplementation(DynamicsWorldConfig& object) -{ - DALI_ASSERT_ALWAYS(object && "DynamicsWorldConfig object is uninitialized!"); - - Dali::RefObject& handle = object.GetBaseObject(); - - return static_cast(handle); -} - -inline const Internal::DynamicsWorldConfig& GetImplementation(const DynamicsWorldConfig& object) -{ - DALI_ASSERT_ALWAYS(object && "DynamicsWorldConfig object is uninitialized!"); - - const Dali::RefObject& handle = object.GetBaseObject(); - - return static_cast(handle); -} - -} // namespace Dali - -#endif // __DYNAMICS_WORLD_CONFIG_IMPL_H__ diff --git a/dali/internal/event/dynamics/dynamics-world-impl.cpp b/dali/internal/event/dynamics/dynamics-world-impl.cpp deleted file mode 100644 index 6c8056f..0000000 --- a/dali/internal/event/dynamics/dynamics-world-impl.cpp +++ /dev/null @@ -1,384 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// EXTERNAL INCLUDES -#include - -// INTERNAL INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace -{ - -// Signals - -const char* const SIGNAL_COLLISION = "collision"; - -BaseHandle Create() -{ - DynamicsWorldPtr p = DynamicsWorld::Get(); - return Dali::DynamicsWorld( p.Get() ); -} - -TypeRegistration mType( typeid(Dali::DynamicsWorld), typeid(Dali::Handle), Create ); - -SignalConnectorType signalConnector1( mType, SIGNAL_COLLISION, &DynamicsWorld::DoConnectSignal ); - -} // unnamed namespace - -DynamicsWorldPtr DynamicsWorld::New() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); - - DynamicsWorldPtr dynamicsWorld( new DynamicsWorld( "DefaultWorld" ) ); - - return dynamicsWorld; -} - -DynamicsWorld::DynamicsWorld(const std::string& name) -: mDebugMode(0), - mDynamicsWorld(NULL), - mUnit(1.0f), - mSlotDelegate(this) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (\"%s\")\n", __PRETTY_FUNCTION__, name.c_str()); -} - -DynamicsWorldPtr DynamicsWorld::GetInstance( DynamicsWorldConfigPtr configuration ) -{ - Dali::Integration::DynamicsFactory* dynamicsFactoryInstance = ThreadLocalStorage::Get().GetPlatformAbstraction().GetDynamicsFactory(); - Dali::Internal::DynamicsWorldPtr dynamicsWorldInstance = ThreadLocalStorage::Get().GetDynamicsWorldInstance(); - - if( dynamicsFactoryInstance && dynamicsWorldInstance ) - { - if( dynamicsFactoryInstance->InitializeDynamics( *( configuration->GetSettings() ) ) ) - { - StagePtr stage = Stage::GetCurrent(); - if( stage != NULL ) - { - dynamicsWorldInstance->Initialize( *stage, *dynamicsFactoryInstance, configuration ); - } - } - } - - return dynamicsWorldInstance; -} - -DynamicsWorldPtr DynamicsWorld::Get() -{ - return ThreadLocalStorage::Get().GetDynamicsWorldInstance(); -} - -void DynamicsWorld::DestroyInstance() -{ - Dali::Internal::DynamicsWorldPtr dynamicsWorldInstance = ThreadLocalStorage::Get().GetDynamicsWorldInstance(); - - if( dynamicsWorldInstance ) - { - StagePtr stage = Stage::GetCurrent(); - if( stage ) - { - dynamicsWorldInstance->Terminate( *stage ); - } - dynamicsWorldInstance.Reset(); - } -} - -void DynamicsWorld::Initialize(Stage& stage, Integration::DynamicsFactory& dynamicsFactory, DynamicsWorldConfigPtr config) -{ - mDynamicsWorld = new SceneGraph::DynamicsWorld( *this, - stage.GetNotificationManager(), - dynamicsFactory ); - - Integration::DynamicsWorldSettings* worldSettings( new Integration::DynamicsWorldSettings(*config->GetSettings()) ); - InitializeDynamicsWorldMessage( stage.GetUpdateManager(), mDynamicsWorld, worldSettings ); - - mGravity = config->GetGravity(); -} - -void DynamicsWorld::Terminate(Stage& stage) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); - - if( stage.IsInstalled() ) - { - while( !mBodies.empty() ) - { - ActorPtr actor( mBodies.begin()->second ); - if( actor ) - { - actor->DisableDynamics(); - } - } - - TerminateDynamicsWorldMessage( stage.GetUpdateManager() ); - } -} - -DynamicsWorld::~DynamicsWorld() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); -} - -bool DynamicsWorld::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ) -{ - bool connected( true ); - DynamicsWorld* world = dynamic_cast(object); - - if( 0 == strcmp( signalName.c_str(), SIGNAL_COLLISION ) ) - { - world->CollisionSignal().Connect( tracker, functor ); - } - else - { - // signalName does not match any signal - connected = false; - } - - return connected; -} - -void DynamicsWorld::SetGravity(const Vector3& gravity) -{ - if( gravity != mGravity ) - { - mGravity = gravity; - - SetGravityMessage( *( Stage::GetCurrent() ), *mDynamicsWorld, mGravity ); - } -} - -const Vector3& DynamicsWorld::GetGravity() const -{ - return mGravity; -} - -int DynamicsWorld::GetDebugDrawMode() const -{ - return mDebugMode; -} - -void DynamicsWorld::SetDebugDrawMode(const int mode) -{ - if( mDebugMode != mode ) - { - mDebugMode = mode; - } -} - -void DynamicsWorld::SetRootActor(ActorPtr rootActor) -{ - if( rootActor != mRootActor ) - { - if( mRootActor ) - { - mRootActor->SetDynamicsRoot(false); - - mRootActor->OnStageSignal().Disconnect( mSlotDelegate, &DynamicsWorld::RootOnStage ); - mRootActor->OffStageSignal().Disconnect( mSlotDelegate, &DynamicsWorld::RootOffStage ); - } - - mRootActor = rootActor; - - if( mRootActor ) - { - if( mRootActor->OnStage() ) - { - SetRootActorMessage( *( Stage::GetCurrent() ), *mDynamicsWorld, static_cast(mRootActor->GetSceneObject()) ); - } - - mRootActor->OnStageSignal().Connect( mSlotDelegate, &DynamicsWorld::RootOnStage ); - mRootActor->OffStageSignal().Connect( mSlotDelegate, &DynamicsWorld::RootOffStage ); - - mRootActor->SetDynamicsRoot(true); - } - } -} - -ActorPtr DynamicsWorld::GetRootActor() const -{ - return mRootActor; -} - -void DynamicsWorld::RootOnStage( Dali::Actor actor ) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); - - SetRootActorMessage( *( Stage::GetCurrent() ), *mDynamicsWorld, static_cast(mRootActor->GetSceneObject()) ); -} - -void DynamicsWorld::RootOffStage( Dali::Actor actor ) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); - - SetRootActorMessage( *( Stage::GetCurrent() ), *mDynamicsWorld, static_cast(NULL) ); -} - -Dali::DynamicsWorld::CollisionSignalType& DynamicsWorld::CollisionSignal() -{ - return mCollisionSignal; -} - -void DynamicsWorld::CollisionImpact( Integration::DynamicsCollisionData* collisionData ) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); - - DALI_ASSERT_DEBUG(collisionData->mBodyA); - DALI_ASSERT_DEBUG(collisionData->mBodyB); - - if ( !mCollisionSignal.Empty() ) - { - BodyContainer::iterator it = mBodies.begin(); - BodyContainer::iterator endIt = mBodies.end(); - - for( ; it != endIt; ++it ) - { - if( it->first->GetBody() == collisionData->mBodyA ) - { - BodyContainer::iterator it2 = mBodies.begin(); - for( ; it2 != endIt; ++it2 ) - { - if( it2->first->GetBody() == collisionData->mBodyB ) - { - ActorPtr actorA( (*it).second ); - ActorPtr actorB( (*it2).second ); - - DynamicsCollisionPtr collision( new DynamicsCollision ); - collision->SetActorA(actorA); - collision->SetActorB(actorB); - collision->SetPointOnA(collisionData->mPointOnA); - collision->SetPointOnB(collisionData->mPointOnB); - collision->SetNormal(collisionData->mNormal); - collision->SetImpactForce(collisionData->mImpact); - - Dali::DynamicsCollision collisionHandle( collision.Get() ); - Dali::DynamicsWorld worldHandle( this ); - - mCollisionSignal.Emit( worldHandle, collisionHandle ); - - break; - } - } - - break; - } - } - } - - delete collisionData; -} - -void DynamicsWorld::CollisionScrape( Integration::DynamicsCollisionData* collisionData ) -{ - // TODO: scrape/rub collision detection -} - -void DynamicsWorld::CollisionDisperse( Integration::DynamicsCollisionData* collisionData ) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); - - DALI_ASSERT_DEBUG(collisionData->mBodyA); - DALI_ASSERT_DEBUG(collisionData->mBodyB); - - if ( !mCollisionSignal.Empty() ) - { - BodyContainer::iterator it = mBodies.begin(); - BodyContainer::iterator endIt = mBodies.end(); - - for( ; it != endIt; ++it ) - { - if( it->first->GetBody() == collisionData->mBodyA ) - { - BodyContainer::iterator it2 = mBodies.begin(); - for( ; it2 != endIt; ++it2 ) - { - if( it2->first->GetBody() == collisionData->mBodyB ) - { - ActorPtr actorA( (*it).second ); - ActorPtr actorB( (*it2).second ); - - DynamicsCollisionPtr collision( new DynamicsCollision ); - collision->SetActorA(actorA); - collision->SetActorB(actorB); - collision->SetImpactForce(0.0f); - - Dali::DynamicsCollision collisionHandle( collision.Get() ); - Dali::DynamicsWorld worldHandle( this ); - - mCollisionSignal.Emit( worldHandle, collisionHandle ); - - break; - } - } - - break; - } - } - } - - delete collisionData; -} - -void DynamicsWorld::MapActor(SceneGraph::DynamicsBody* sceneObject, Actor& actor) -{ - mBodies[sceneObject] = &actor; -} - -void DynamicsWorld::UnmapActor(SceneGraph::DynamicsBody* sceneObject) -{ - mBodies.erase(sceneObject); -} - -ActorPtr DynamicsWorld::GetMappedActor(SceneGraph::DynamicsBody* sceneObject) const -{ - ActorPtr actor; - - BodyContainer::const_iterator it = mBodies.find( sceneObject ); - if( it != mBodies.end() ) - { - actor = it->second; - } - - return actor; -} - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/event/dynamics/dynamics-world-impl.h b/dali/internal/event/dynamics/dynamics-world-impl.h deleted file mode 100644 index 1817c49..0000000 --- a/dali/internal/event/dynamics/dynamics-world-impl.h +++ /dev/null @@ -1,251 +0,0 @@ -#ifndef __DYNAMICS_WORLD_IMPL_H__ -#define __DYNAMICS_WORLD_IMPL_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// INTERNAL HEADERS -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace Dali -{ - -namespace Integration -{ - -struct DynamicsCollisionData; -class DynamicsBody; -class DynamicsFactory; - -} // namespace Integration - -namespace Internal -{ - -class Stage; - -namespace SceneGraph -{ -struct DynamicsCollisionData; -class DynamicsBody; -class DynamicsWorld; -} // namespace SceneGraph - -/// @copydoc Dali::DynamicsWorld -class DynamicsWorld : public BaseObject, public Dali::Internal::DynamicsNotifier -{ -public: - static DynamicsWorldPtr New(); - -public: - /** - * Constructor. - * @param[in] name A name for the world - */ - DynamicsWorld(const std::string& name); - -protected: - /** - * Destructor. - * A reference counted object may only be deleted by calling Unreference() - */ - virtual ~DynamicsWorld(); - -private: - // unimplemented copy constructor and assignment operator - DynamicsWorld(const DynamicsWorld&); - DynamicsWorld& operator=(const DynamicsWorld&); - -public: - - /** - * @copydoc Dali::DynamicsWorld::GetInstance() - */ - static DynamicsWorldPtr GetInstance( DynamicsWorldConfigPtr configuration ); - - /** - * @copydoc Dali::DynamicsWorld::Get() - */ - static DynamicsWorldPtr Get(); - - /** - * @copydoc Dali::DynamicsWorld::DestroyInstance() - */ - static void DestroyInstance(); - - /** - * Gets the instance of the Dynamics Notifier, if created with GetInstance(). - * - * @return The DynamicsNotifier instance. - */ - static DynamicsNotifier& GetNotifier(); - - /** - * Connects a callback function with the object's signals. - * @param[in] object The object providing the signal. - * @param[in] tracker Used to disconnect the signal. - * @param[in] signalName The signal to connect to. - * @param[in] functor A newly allocated FunctorDelegate. - * @return True if the signal was connected. - * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor. - */ - static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ); - - /** - * Initializes the simulation - * @param[in] stage A reference to the stage. - * @param[in] dynamicsFactory A reference to the factory object which creates instances of dynamics objects - * @param[in] config Configuration parameters for the world - */ - void Initialize(Stage& stage, Integration::DynamicsFactory& dynamicsFactory, DynamicsWorldConfigPtr config); - - /** - * Terminate the simulation, sends a message to UpdateManager - * @param[in] stage A reference to the stage. - */ - void Terminate(Stage& stage); - - // Methods -public: - /// @copydoc Dali::SetGravity - void SetGravity(const Vector3& gravity); - - /// @copydoc Dali::GetGravity - const Vector3& GetGravity() const; - - /// @copydoc Dali::DynamicsWorld::CollisionSignal - Dali::DynamicsWorld::CollisionSignalType& CollisionSignal(); - - /// @copydoc Dali::DynamicsWorld::GetDebugDrawMode - int GetDebugDrawMode() const; - - /// @copydoc Dali::DynamicsWorld::SetDebugDrawMode - void SetDebugDrawMode(const int mode); - - /// @copydoc Dali::DynamicsWorld::SetRootActor - void SetRootActor(ActorPtr actor); - - /// @copydoc Dali::DynamicsWorld::GetRootActor - ActorPtr GetRootActor() const; - - SceneGraph::DynamicsWorld* GetSceneObject() const - { - return mDynamicsWorld; - } - -private: - /** - * Callback, invoked when the Actor set in SetWorldRoot() is added to the scene graph - * @param actor A handle to the root actor. - */ - void RootOnStage( Dali::Actor actor ); - - /** - * Callback, invoked when the Actor set in SetWorldRoot() is removed from the scene graph - * @param actor A handle to the root actor. - */ - void RootOffStage( Dali::Actor actor ); - -public: - - // From DynamicsCollisionNotifier - - /** - * @copydoc DynamicsNotifier::CollisionImpact - */ - void CollisionImpact( Integration::DynamicsCollisionData* collisionData ); - - /** - * @copydoc DynamicsNotifier::CollisionScrape - */ - void CollisionScrape( Integration::DynamicsCollisionData* collisionData ); - - /** - * @copydoc DynamicsNotifier::CollisionDisperse - */ - void CollisionDisperse( Integration::DynamicsCollisionData* collisionData ); - - void MapActor(SceneGraph::DynamicsBody* sceneObject, Actor& actor); - void UnmapActor(SceneGraph::DynamicsBody* sceneObject); - ActorPtr GetMappedActor(SceneGraph::DynamicsBody* sceneObject) const; - -private: - typedef std::map< SceneGraph::DynamicsBody*, Actor* > BodyContainer; - - int mDebugMode; - SceneGraph::DynamicsWorld* mDynamicsWorld; - Vector3 mGravity; ///< World gravity - float mUnit; - BodyContainer mBodies; - ActorPtr mRootActor; - - Dali::DynamicsWorld::CollisionSignalType mCollisionSignal; - - SlotDelegate< DynamicsWorld > mSlotDelegate; -}; - -// Message helpers - -inline MessageBase* CollisionImpactMessage( DynamicsWorld& dynamicsWorld, Integration::DynamicsCollisionData* collisionData ) -{ - return new MessageValue1< DynamicsWorld, Integration::DynamicsCollisionData* >( &dynamicsWorld, &DynamicsWorld::CollisionImpact, collisionData ); -} - -inline MessageBase* CollisionScrapeMessage( DynamicsWorld& dynamicsWorld, Integration::DynamicsCollisionData* collisionData ) -{ - return new MessageValue1< DynamicsWorld, Integration::DynamicsCollisionData* >( &dynamicsWorld, &DynamicsWorld::CollisionScrape, collisionData ); -} - -inline MessageBase* CollisionDisperseMessage( DynamicsWorld& dynamicsWorld, Integration::DynamicsCollisionData* collisionData ) -{ - return new MessageValue1< DynamicsWorld, Integration::DynamicsCollisionData* >( &dynamicsWorld, &DynamicsWorld::CollisionDisperse, collisionData ); -} - -} // namespace Internal - -// Helpers for public-api forwarding methods - -inline Internal::DynamicsWorld& GetImplementation(DynamicsWorld& object) -{ - DALI_ASSERT_ALWAYS(object && "DynamicsWorld object is uninitialized!"); - - Dali::RefObject& handle = object.GetBaseObject(); - - return static_cast(handle); -} - -inline const Internal::DynamicsWorld& GetImplementation(const DynamicsWorld& object) -{ - DALI_ASSERT_ALWAYS(object && "DynamicsWorld object is uninitialized!"); - - const Dali::RefObject& handle = object.GetBaseObject(); - - return static_cast(handle); -} - -} // namespace Dali - -#endif // __DYNAMICS_WORLD_IMPL_H__ diff --git a/dali/internal/file.list b/dali/internal/file.list index 7321856..3587766 100644 --- a/dali/internal/file.list +++ b/dali/internal/file.list @@ -174,26 +174,3 @@ internal_src_files = \ $(internal_src_dir)/update/resources/resource-tracker.cpp \ $(internal_src_dir)/update/resources/sync-resource-tracker.cpp \ $(internal_src_dir)/update/resources/complete-status-manager.cpp - -internal_dynamics_src_files = \ - $(internal_src_dir)/event/dynamics/dynamics-body-config-impl.cpp \ - $(internal_src_dir)/event/dynamics/dynamics-body-impl.cpp \ - $(internal_src_dir)/event/dynamics/dynamics-capsule-shape-impl.cpp \ - $(internal_src_dir)/event/dynamics/dynamics-collision-impl.cpp \ - $(internal_src_dir)/event/dynamics/dynamics-cone-shape-impl.cpp \ - $(internal_src_dir)/event/dynamics/dynamics-cube-shape-impl.cpp \ - $(internal_src_dir)/event/dynamics/dynamics-cylinder-shape-impl.cpp \ - $(internal_src_dir)/event/dynamics/dynamics-joint-impl.cpp \ - $(internal_src_dir)/event/dynamics/dynamics-shape-impl.cpp \ - $(internal_src_dir)/event/dynamics/dynamics-sphere-shape-impl.cpp \ - $(internal_src_dir)/event/dynamics/dynamics-world-config-impl.cpp \ - $(internal_src_dir)/event/dynamics/dynamics-world-impl.cpp \ - $(internal_src_dir)/update/dynamics/scene-graph-dynamics-body.cpp \ - $(internal_src_dir)/update/dynamics/scene-graph-dynamics-capsule-shape.cpp \ - $(internal_src_dir)/update/dynamics/scene-graph-dynamics-cone-shape.cpp \ - $(internal_src_dir)/update/dynamics/scene-graph-dynamics-cube-shape.cpp \ - $(internal_src_dir)/update/dynamics/scene-graph-dynamics-cylinder-shape.cpp \ - $(internal_src_dir)/update/dynamics/scene-graph-dynamics-joint.cpp \ - $(internal_src_dir)/update/dynamics/scene-graph-dynamics-shape.cpp \ - $(internal_src_dir)/update/dynamics/scene-graph-dynamics-sphere-shape.cpp \ - $(internal_src_dir)/update/dynamics/scene-graph-dynamics-world.cpp diff --git a/dali/internal/update/dynamics/scene-graph-dynamics-body.cpp b/dali/internal/update/dynamics/scene-graph-dynamics-body.cpp deleted file mode 100644 index cb6bcac..0000000 --- a/dali/internal/update/dynamics/scene-graph-dynamics-body.cpp +++ /dev/null @@ -1,327 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// INTERNAL HEADERS -#include -#include -#include -#include -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace SceneGraph -{ - -DynamicsBody::DynamicsBody(DynamicsWorld& world, Node& node ) -: mBody(NULL), - mNode(node), - mWorld(world), - mLinearVelocity(), - mAngularVelocity() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); -} - -DynamicsBody::~DynamicsBody() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__ ); - - delete mBody; -} - - -void DynamicsBody::Initialize( Integration::DynamicsBodySettings* settings, DynamicsShape* shape ) -{ - DALI_ASSERT_DEBUG( shape && "NULL shape passed into DynamicsBody" ); - - mBody = mWorld.GetDynamicsFactory().CreateDynamicsBody(); - - if( Dali::DynamicsBodyConfig::SOFT == settings->type ) - { - // @todo Create a mesh from the dynamics body. - } - - Vector3 position; - Quaternion rotation; - GetNodePositionAndRotation( position, rotation ); - mBody->Initialize( *settings, shape->GetShape(), mWorld.GetDynamicsWorld(), position, rotation ); - delete settings; -} - -void DynamicsBody::SetMass(const float mass) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - mass:%.2f\n", __PRETTY_FUNCTION__, mass); - - mBody->SetMass( mass ); -} - -void DynamicsBody::SetElasticity(const float elasticity) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - elasticity:%.1f\n", __PRETTY_FUNCTION__, elasticity); - - mBody->SetElasticity( elasticity ); -} - -void DynamicsBody::SetLinearVelocity(const Vector3& velocity) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (velocity:%f %f %f)\n", __PRETTY_FUNCTION__, velocity.x, velocity.y, velocity.z); - - mBody->SetLinearVelocity( velocity / mWorld.GetWorldScale() ); - mLinearVelocity[ mWorld.GetBufferIndex() ] = velocity; -} - -Vector3 DynamicsBody::GetLinearVelocity( BufferIndex bufferIndex ) const -{ - const Vector3& velocity( mLinearVelocity[ bufferIndex ] ); - - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (velocity:%f %f %f)\n", __PRETTY_FUNCTION__, - velocity.x, velocity.y, velocity.z); - - return velocity; -} - -void DynamicsBody::SetAngularVelocity(const Vector3& velocity) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (velocity:%f %f %f)\n", __PRETTY_FUNCTION__, velocity.x, velocity.y, velocity.z); - - mBody->SetAngularVelocity( velocity ); - - mAngularVelocity[ mWorld.GetBufferIndex() ] = velocity; -} - -Vector3 DynamicsBody::GetAngularVelocity( BufferIndex bufferIndex ) const -{ - const Vector3& velocity( mAngularVelocity[ bufferIndex ] ); - - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (velocity:%f %f %f)\n", __PRETTY_FUNCTION__, - velocity.x, velocity.y, velocity.z); - - return velocity; -} - -void DynamicsBody::SetKinematic(const bool flag) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - %s\n", __PRETTY_FUNCTION__, flag ? "true" : "false" ); - - mBody->SetKinematic( flag ); -} - -bool DynamicsBody::IsKinematic() const -{ - return mBody->IsKinematic(); -} - -void DynamicsBody::SetSleepEnabled( const bool flag) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - %s\n", __PRETTY_FUNCTION__, flag ? "true" : "false" ); - - mBody->SetSleepEnabled( flag ); -} - -void DynamicsBody::WakeUp() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); - - mBody->WakeUp(); -} - -void DynamicsBody::AddAnchor( const unsigned int index, const DynamicsBody* anchorBody, const bool collisions ) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (index: %d)\n", __PRETTY_FUNCTION__, index); - DALI_ASSERT_DEBUG( NULL != mBody ); - DALI_ASSERT_DEBUG( Dali::DynamicsBodyConfig::SOFT == mBody->GetType() ); - DALI_ASSERT_DEBUG( NULL != anchorBody && NULL != anchorBody->mBody ); - DALI_ASSERT_DEBUG( Dali::DynamicsBodyConfig::RIGID == anchorBody->GetType() ); - - mBody->AddAnchor( index, anchorBody->GetBody(), collisions ); -} - -void DynamicsBody::ConserveVolume( const bool flag ) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (%s)\n", __PRETTY_FUNCTION__, flag ? "yes" : "no" ); - - mBody->ConserveVolume( flag ); -} - -void DynamicsBody::ConserveShape( const bool flag ) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (%s)\n", __PRETTY_FUNCTION__, flag ? "yes" : "no" ); - - mBody->ConserveShape( flag ); -} - -short int DynamicsBody::GetCollisionGroup() const -{ - return mBody->GetCollisionGroup(); -} - -void DynamicsBody::SetCollisionGroup( const short int collisionGroup ) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (0x%04X)\n", __PRETTY_FUNCTION__, collisionGroup ); - mBody->SetCollisionGroup( collisionGroup ); -} - -short int DynamicsBody::GetCollisionMask() const -{ - return mBody->GetCollisionMask(); -} - -void DynamicsBody::SetCollisionMask( const short int collisionMask ) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (0x%04X)\n", __PRETTY_FUNCTION__, collisionMask ); - mBody->SetCollisionMask( collisionMask ); -} - -int DynamicsBody::GetType() const -{ - return mBody->GetType(); -} - -Integration::DynamicsBody* DynamicsBody::GetBody() const -{ - return mBody; -} - -void DynamicsBody::Connect() -{ - int bodyType( mBody->GetType() ); - if( Dali::DynamicsBodyConfig::RIGID == bodyType ) - { -// SetMotionState(); - } - else if( Dali::DynamicsBodyConfig::SOFT == bodyType ) - { - /* - * Soft body vertices get local transformation applied twice due to - * physics engine directly transforming all the points in a soft body's mesh - * then the vertices getting the transformation applied again in the shader - */ - mNode.SetInhibitLocalTransform(true); - } - - RefreshDynamics(); - - mWorld.AddBody(*this); -} - -void DynamicsBody::Disconnect() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::General, "%s (body: %p)\n", __PRETTY_FUNCTION__, mBody); - - if( Dali::DynamicsBodyConfig::SOFT == GetType() ) - { - /* - * Soft body vertices get local transformation applied twice due to - * physics engine directly transforming all the points in a soft body's mesh - * then the vertices getting the transformation applied again in the shader - */ - mNode.SetInhibitLocalTransform(false); - } - - mWorld.RemoveBody(*this); -} - -void DynamicsBody::Delete() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::General, "%s (body: %p)\n", __PRETTY_FUNCTION__, mBody); - - mWorld.DeleteBody(*this); -} - -void DynamicsBody::SetMotionState() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); -} - -void DynamicsBody::GetNodePositionAndRotation(Vector3& position, Quaternion& rotation) -{ - const BufferIndex bufferIndex = mWorld.GetBufferIndex(); - position = mNode.GetPosition(bufferIndex) / mWorld.GetWorldScale(); - rotation = mNode.GetOrientation(bufferIndex); -} - -void DynamicsBody::SetNodePositionAndRotation(const Vector3& position, const Quaternion& rotation) -{ - const Vector3 scaledPosition(position * mWorld.GetWorldScale()); - - const BufferIndex bufferIndex( mWorld.GetBufferIndex() ); - mNode.BakePosition(bufferIndex, scaledPosition); - mNode.BakeOrientation(bufferIndex, rotation); - - if( Dali::DynamicsBodyConfig::RIGID == mBody->GetType() ) - { - mLinearVelocity[bufferIndex] = mBody->GetLinearVelocity(); - mAngularVelocity[bufferIndex] = mBody->GetAngularVelocity(); - } -} - -void DynamicsBody::RefreshDynamics() -{ - // get node's world position and rotation - Vector3 position; - Quaternion rotation; - GetNodePositionAndRotation(position, rotation); - - mBody->SetTransform( position, rotation ); -} - -bool DynamicsBody::RefreshNode(BufferIndex updateBufferIndex) -{ - // get updated parameters - if( Dali::DynamicsBodyConfig::SOFT == mBody->GetType() ) - { - RefreshMesh(updateBufferIndex); - } - else - { - if( !mBody->IsKinematic() ) - { - // get updated parameters - Vector3 position; - Quaternion rotation; - mBody->GetTransform( position, rotation ); - SetNodePositionAndRotation( position, rotation ); - } - } - - // TODO: Add activation state change notification - // interrogate dynamics body for it's activation state - bool activationState( mBody->IsActive() ); - - return activationState; -} - -void DynamicsBody::RefreshMesh(BufferIndex updateBufferIndex) -{ - ///@todo Update the mesh from the dynamics body. -} - -} // namespace SceneGraph - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/update/dynamics/scene-graph-dynamics-body.h b/dali/internal/update/dynamics/scene-graph-dynamics-body.h deleted file mode 100644 index e8cf495..0000000 --- a/dali/internal/update/dynamics/scene-graph-dynamics-body.h +++ /dev/null @@ -1,371 +0,0 @@ -#ifndef __SCENE_GRAPH_DYNAMICS_BODY_H__ -#define __SCENE_GRAPH_DYNAMICS_BODY_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// INTERNAL INCLUDES -#include -#include -#include -#include -#include -#include - -namespace Dali -{ - -class MeshData; -class Quaternion; - -namespace Integration -{ - -class DynamicsBody; -struct DynamicsBodySettings; - -} // namespace Integration - -namespace Internal -{ - -namespace SceneGraph -{ - -class Node; -class DynamicsBody; -class DynamicsShape; -class DynamicsWorld; - -/** - * @copydoc Dali::DynamicsBody - */ -class DynamicsBody -{ -public: - /** - * Constructor. - * @param[in] world The object encapsulation the simulation world. - */ - DynamicsBody(DynamicsWorld& world, Node& node); - - /** - * Destructor. - */ - virtual ~DynamicsBody(); - - /** - * Initialize the body - * @param[in] settings Configuration parameters for the new body - */ - void Initialize(Integration::DynamicsBodySettings* settings, DynamicsShape* shape); - - /** - * Set the mass - * @param[in] mass The new mass for the body - */ - void SetMass( float mass ); - - ///@ copydoc Dali::DynamicsBody::SetElasticity - void SetElasticity( float elasticity ); - - /// @copydoc Dali::DynamicsBody::SetLinearVelocity - void SetLinearVelocity( const Vector3& velocity ); - - /** - * @copydoc Dali::DynamicsBody::SetLinearVelocity - * @param[in] bufferIndex Double buffered data index - */ - Vector3 GetLinearVelocity( BufferIndex bufferIndex ) const; - - /// @copydoc Dali::DynamicsBody::SetAngularVelocity - void SetAngularVelocity( const Vector3& velocity ); - - /** - * @copydoc Dali::DynamicsBody::SetLinearVelocity - * @param[in] bufferIndex Double buffered data index - */ - Vector3 GetAngularVelocity( BufferIndex bufferIndex ) const; - - /// @copydoc Dali::DynamicsBody::SetKinematic - void SetKinematic( bool flag ); - - /// @copydoc Dali::DynamicsBody::IsKinematic - bool IsKinematic() const; - - /// @copydoc Dali::DynamicsBody::SetSleepEnabled - void SetSleepEnabled( bool flag ); - - /// @copydoc Dali::DynamicsBody::WakeUp - void WakeUp(); - - /// @copydoc Dali::DynamicsBody::AddAnchor - void AddAnchor( unsigned int index, const DynamicsBody* anchorBody, bool collisions ); - - /// @copydoc Dali::DynamicsBody::ConserveVolume - void ConserveVolume( bool flag ); - - /// @copydoc Dali::DynamicsBody::ConserveShape - void ConserveShape( bool flag ); - - /// @copydoc Dali::DynamicsBody::GetCollisionGroup - short int GetCollisionGroup() const; - - /// @copydoc Dali::DynamicsBody::SetCollisionGroup - void SetCollisionGroup( short int collisionGroup ); - - /// @copydoc Dali::DynamicsBody::GetCollisionMask - short int GetCollisionMask() const; - - /// @copydoc Dali::DynamicsBody::SetCollisionMask - void SetCollisionMask( short int collisionMask ); - - int GetType() const; - - /** - * Get a pointer to the physics body object. - * @return A pointer to the physics body object. - */ - Integration::DynamicsBody* GetBody() const; - - /** - * Add and connect DynamicsBody to DynamicsWorld - */ - void Connect(); - - /** - * Disconnect DynamicsBody from DynamicsWorld - */ - void Disconnect(); - - /** - * Delete DynamicsBody from DynamicsWorld - */ - void Delete(); - - /** - * TODO comment us - */ - void SetMotionState(); - void GetNodePositionAndRotation(Vector3& position, Quaternion& rotation); - void SetNodePositionAndRotation(const Vector3& position, const Quaternion& rotation); - void RefreshDynamics(); - bool RefreshNode(BufferIndex updateBufferIndex); - void RefreshMesh(BufferIndex updateBufferIndex); - -private: - // unimplemented copy constructor and assignment operator - DynamicsBody(const DynamicsBody&); - DynamicsBody& operator=(const DynamicsBody&); - -public: - Dali::Integration::DynamicsBody* mBody; - -private: - Node& mNode; // weak reference to the Node - DynamicsWorld& mWorld; - - DoubleBuffered mLinearVelocity; - DoubleBuffered mAngularVelocity; - -}; // class DynamicsBody - -// Messages for DynamicsBody - -inline void InitializeDynamicsBodyMessage( EventThreadServices& eventThreadServices, const DynamicsBody& body, Integration::DynamicsBodySettings* settings, const DynamicsShape& shape ) -{ - typedef MessageValue2< DynamicsBody, Integration::DynamicsBodySettings*, DynamicsShape* > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &body, &DynamicsBody::Initialize, settings, &const_cast(shape) ); -} - -inline void SetMassMessage( EventThreadServices& eventThreadServices, const DynamicsBody& body, float mass ) -{ - typedef MessageValue1< DynamicsBody, float > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &body, &DynamicsBody::SetMass, mass ); -} - -inline void SetElasticityMessage( EventThreadServices& eventThreadServices, const DynamicsBody& body, float elasticity ) -{ - typedef MessageValue1< DynamicsBody, float > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &body, &DynamicsBody::SetElasticity, elasticity ); -} - -inline void SetLinearVelocityMessage( EventThreadServices& eventThreadServices, const DynamicsBody& body, const Vector3& velocity ) -{ - typedef MessageValue1< DynamicsBody, Vector3 > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &body, &DynamicsBody::SetLinearVelocity, velocity ); -} - -inline void SetAngularVelocityMessage( EventThreadServices& eventThreadServices, const DynamicsBody& body, const Vector3& velocity ) -{ - typedef MessageValue1< DynamicsBody, Vector3 > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &body, &DynamicsBody::SetAngularVelocity, velocity ); -} - -inline void SetKinematicMessage( EventThreadServices& eventThreadServices, const DynamicsBody& body, bool flag ) -{ - typedef MessageValue1< DynamicsBody, bool > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &body, &DynamicsBody::SetKinematic, flag ); -} - -inline void SetSleepEnabledMessage( EventThreadServices& eventThreadServices, const DynamicsBody& body, bool flag ) -{ - typedef MessageValue1< DynamicsBody, bool > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &body, &DynamicsBody::SetSleepEnabled, flag ); -} - -inline void WakeUpMessage( EventThreadServices& eventThreadServices, const DynamicsBody& body ) -{ - typedef Message< DynamicsBody > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &body, &DynamicsBody::WakeUp ); -} - -inline void AddAnchorMessage( EventThreadServices& eventThreadServices, const DynamicsBody& body, unsigned int index, const DynamicsBody& anchorBody, bool collisions ) -{ - typedef MessageValue3< DynamicsBody, unsigned int, const DynamicsBody*, bool > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &body, &DynamicsBody::AddAnchor, index, &anchorBody, collisions ); -} - -inline void ConserveVolumeMessage( EventThreadServices& eventThreadServices, const DynamicsBody& body, bool flag ) -{ - typedef MessageValue1< DynamicsBody, bool > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &body, &DynamicsBody::ConserveVolume, flag ); -} - -inline void ConserveShapeMessage( EventThreadServices& eventThreadServices, const DynamicsBody& body, bool flag ) -{ - typedef MessageValue1< DynamicsBody, bool > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &body, &DynamicsBody::ConserveShape, flag ); -} - -inline void SetCollisionGroupMessage( EventThreadServices& eventThreadServices, const DynamicsBody& body, short int collisionGroup ) -{ - typedef MessageValue1< DynamicsBody, short int > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &body, &DynamicsBody::SetCollisionGroup, collisionGroup ); -} - -inline void SetCollisionMaskMessage( EventThreadServices& eventThreadServices, const DynamicsBody& body, short int collisionMask ) -{ - typedef MessageValue1< DynamicsBody, short int > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &body, &DynamicsBody::SetCollisionMask, collisionMask ); -} - -inline void ConnectMessage( EventThreadServices& eventThreadServices, const DynamicsBody& body ) -{ - typedef Message< DynamicsBody > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &body, &DynamicsBody::Connect ); -} - -inline void DisconnectMessage( EventThreadServices& eventThreadServices, const DynamicsBody& body ) -{ - typedef Message< DynamicsBody > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &body, &DynamicsBody::Disconnect ); -} - -inline void DeleteBodyMessage( EventThreadServices& eventThreadServices, const DynamicsBody& body ) -{ - typedef Message< DynamicsBody > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &body, &DynamicsBody::Delete ); -} - -} // namespace SceneGraph - -} // namespace Internal - -} // namespace Dali - -#endif // __SCENE_GRAPH_DYNAMICS_BODY_H__ diff --git a/dali/internal/update/dynamics/scene-graph-dynamics-capsule-shape.cpp b/dali/internal/update/dynamics/scene-graph-dynamics-capsule-shape.cpp deleted file mode 100644 index 5dccf7f..0000000 --- a/dali/internal/update/dynamics/scene-graph-dynamics-capsule-shape.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// INTERNAL HEADERS -#include -#include -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace SceneGraph -{ - -DynamicsCapsuleShape::DynamicsCapsuleShape(DynamicsWorld& world) -: DynamicsShape(world) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); -} - -DynamicsCapsuleShape::~DynamicsCapsuleShape() -{ -} - -void DynamicsCapsuleShape::Initialize(const float radius, const float length) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (radius: %.1f length: %.1f)\n", __PRETTY_FUNCTION__, radius, length); - - mShape = mWorld.GetDynamicsFactory().CreateDynamicsShape(); - - const float worldScale((1.0f / mWorld.GetWorldScale()) ); - mShape->Initialize( Dali::DynamicsShape::CAPSULE, Vector3( radius * worldScale, length * worldScale, 0.0f ) ); - - DynamicsShape::Initialize(); -} - -} // namespace SceneGraph - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/update/dynamics/scene-graph-dynamics-capsule-shape.h b/dali/internal/update/dynamics/scene-graph-dynamics-capsule-shape.h deleted file mode 100644 index 113921d..0000000 --- a/dali/internal/update/dynamics/scene-graph-dynamics-capsule-shape.h +++ /dev/null @@ -1,88 +0,0 @@ -#ifndef __SCENE_GRAPH_DYNAMICS_CAPSULE_SHAPE_H__ -#define __SCENE_GRAPH_DYNAMICS_CAPSULE_SHAPE_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADERS -#include - -// INTERNAL INCLUDES -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace SceneGraph -{ - -class DynamicsWorld; - -class DynamicsCapsuleShape : public DynamicsShape -{ -public: - - /** - * Constructor. - * @param[in] world The dynamics world object - */ - DynamicsCapsuleShape(DynamicsWorld& world); - - /** - * Destructor. - */ - virtual ~DynamicsCapsuleShape(); - - /** - * Initialize the capsule. - * @param[in] radius The radius of the capsule. - * @param[in] length The length of the capsule. - */ - void Initialize( float radius, float length ); - -private: - // unimplemented copy constructor and assignment operator - DynamicsCapsuleShape(const DynamicsCapsuleShape&); - DynamicsCapsuleShape& operator=(const DynamicsCapsuleShape&); - -}; // class DynamicsCapsuleShape - -// Messages for DynamicsCapsuleShape - -inline void InitializeDynamicsCapsuleShapeMessage( EventThreadServices& eventThreadServices, const DynamicsCapsuleShape& shape, const float radius, const float length ) -{ - typedef MessageValue2< DynamicsCapsuleShape, float, float > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &shape, &DynamicsCapsuleShape::Initialize, radius, length ); -} - -} // namespace SceneGraph - -} // namespace Internal - -} // namespace Dali - -#endif // __SCENE_GRAPH_DYNAMICS_CAPSULE_SHAPE_H__ diff --git a/dali/internal/update/dynamics/scene-graph-dynamics-collision-data.h b/dali/internal/update/dynamics/scene-graph-dynamics-collision-data.h deleted file mode 100644 index e482a76..0000000 --- a/dali/internal/update/dynamics/scene-graph-dynamics-collision-data.h +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef __SCENE_GRAPH_DYNAMICS_COLLISION_DATA_H__ -#define __SCENE_GRAPH_DYNAMICS_COLLISION_DATA_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// BASE CLASS HEADER - -// INTERNAL HEADERS -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace SceneGraph -{ - -struct DynamicsCollisionData -{ -public: - DynamicsCollisionData(DynamicsBody* bodyA, DynamicsBody* bodyB, const Vector3& pointOnA, const Vector3& pointOnB, const Vector3& normal, const float impact) - : mBodyA(bodyA), - mBodyB(bodyB), - mPointOnA(pointOnA), - mPointOnB(pointOnB), - mNormal(normal), - mImpact(impact) - { - } - - DynamicsCollisionData(const DynamicsCollisionData& rhs) - : mBodyA(rhs.mBodyA), - mBodyB(rhs.mBodyB), - mPointOnA(rhs.mPointOnA), - mPointOnB(rhs.mPointOnB), - mNormal(rhs.mNormal), - mImpact(rhs.mImpact) - { - } - - DynamicsCollisionData() - : mBodyA(NULL), - mBodyB(NULL), - mImpact(0.0f) - { - } - - ~DynamicsCollisionData() - { - } - - DynamicsCollisionData& operator=(const DynamicsCollisionData& rhs) - { - if( this != &rhs ) - { - mBodyA = rhs.mBodyA; - mBodyB = rhs.mBodyB; - mPointOnA = rhs.mPointOnA; - mPointOnB = rhs.mPointOnB; - mNormal = rhs.mNormal; - mImpact = rhs.mImpact; - } - return *this; - } - - DynamicsBody* mBodyA; - DynamicsBody* mBodyB; - Vector3 mPointOnA; - Vector3 mPointOnB; - Vector3 mNormal; - float mImpact; -}; // DynamicsCollisionData - -} // namespace SceneGraph - -} // namespace Internal - -} // namespace Dali - -#endif // __SCENE_GRAPH_DYNAMICS_COLLISION_DATA_H__ diff --git a/dali/internal/update/dynamics/scene-graph-dynamics-cone-shape.cpp b/dali/internal/update/dynamics/scene-graph-dynamics-cone-shape.cpp deleted file mode 100644 index 2b5c79f..0000000 --- a/dali/internal/update/dynamics/scene-graph-dynamics-cone-shape.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -// TODO: Change this to use #pragma GCC diagnostic push / pop when the compiler is updated to 4.6.0+ -#include - -// INTERNAL HEADERS -#include -#include -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace SceneGraph -{ - -DynamicsConeShape::DynamicsConeShape(DynamicsWorld& world) -: DynamicsShape(world) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); -} - -DynamicsConeShape::~DynamicsConeShape() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); -} - -void DynamicsConeShape::Initialize(const float radius, const float length) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (radius: %.1f length: %.1f)\n", __PRETTY_FUNCTION__, radius, length); - - mShape = mWorld.GetDynamicsFactory().CreateDynamicsShape(); - const float worldScale((1.0f / mWorld.GetWorldScale()) ); - mShape->Initialize( Dali::DynamicsShape::CONE, Vector3( radius * worldScale, length * worldScale, 0.0f ) ); -// const float worldScale(1.0f / mWorld.GetWorldScale()); -// mShape = new btConeShape(radius * worldScale, length * worldScale); - - DynamicsShape::Initialize(); -} - -} // namespace SceneGraph - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/update/dynamics/scene-graph-dynamics-cone-shape.h b/dali/internal/update/dynamics/scene-graph-dynamics-cone-shape.h deleted file mode 100644 index 20e2dfb..0000000 --- a/dali/internal/update/dynamics/scene-graph-dynamics-cone-shape.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef __SCENE_GRAPH_DYNAMICS_CONE_SHAPE_H__ -#define __SCENE_GRAPH_DYNAMICS_CONE_SHAPE_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADERS -#include - -// INTERNAL INCLUDES -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace SceneGraph -{ - -class DynamicsWorld; - -class DynamicsConeShape : public DynamicsShape -{ -public: - /** - * Constructor. - * @param[in] world The dynamics world object - */ - DynamicsConeShape(DynamicsWorld& world); - - /** - * Destructor. - */ - virtual ~DynamicsConeShape(); - - /** - * Constructor. - * @param[in] radius The radius of the cone. - * @param[in] length The length of the cone. - */ - void Initialize( float radius, float length ); - -private: - // unimplemented copy constructor and assignment operator - DynamicsConeShape(const DynamicsConeShape&); - DynamicsConeShape& operator=(const DynamicsConeShape&); - -}; // class DynamicsConeShape - -// Messages for DynamicsConeShape - -inline void InitializeDynamicsConeShapeMessage( EventThreadServices& eventThreadServices, const DynamicsConeShape& shape, const float radius, const float length ) -{ - typedef MessageValue2< DynamicsConeShape, float, float > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &shape, &DynamicsConeShape::Initialize, radius, length ); -} - -} // namespace SceneGraph - -} // namespace Internal - -} // namespace Dali - -#endif // __SCENE_GRAPH_DYNAMICS_CONE_SHAPE_H__ diff --git a/dali/internal/update/dynamics/scene-graph-dynamics-cube-shape.cpp b/dali/internal/update/dynamics/scene-graph-dynamics-cube-shape.cpp deleted file mode 100644 index 5309284..0000000 --- a/dali/internal/update/dynamics/scene-graph-dynamics-cube-shape.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// INTERNAL HEADERS -#include -#include -#include -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace SceneGraph -{ - -DynamicsCubeShape::DynamicsCubeShape(DynamicsWorld& world) -: DynamicsShape(world) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); -} - -DynamicsCubeShape::~DynamicsCubeShape() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); -} - -void DynamicsCubeShape::Initialize(const Vector3& dimensions) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::General, "%s - (dimensions(%.1f %.1f, %.1f))\n", __PRETTY_FUNCTION__, dimensions.width, dimensions.height, dimensions.depth); - - mShape = mWorld.GetDynamicsFactory().CreateDynamicsShape(); - - mShape->Initialize( Dali::DynamicsShape::CUBE, (dimensions * 0.5f) / mWorld.GetWorldScale() ); - - DynamicsShape::Initialize(); -} - -} // namespace SceneGraph - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/update/dynamics/scene-graph-dynamics-cube-shape.h b/dali/internal/update/dynamics/scene-graph-dynamics-cube-shape.h deleted file mode 100644 index 9dc9c01..0000000 --- a/dali/internal/update/dynamics/scene-graph-dynamics-cube-shape.h +++ /dev/null @@ -1,88 +0,0 @@ -#ifndef __SCENE_GRAPH_DYNAMICS_CUBE_SHAPE_H__ -#define __SCENE_GRAPH_DYNAMICS_CUBE_SHAPE_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADERS -#include - -// INTERNAL INCLUDES -#include -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace SceneGraph -{ - -class DynamicsWorld; - -class DynamicsCubeShape : public DynamicsShape -{ -public: - /** - * Constructor. - * @param[in] world The dynamics world object - */ - DynamicsCubeShape(DynamicsWorld& world); - - /** - * Destructor. - */ - virtual ~DynamicsCubeShape(); - - /** - * Initialize the cube. - * @param[in] world The dynamics world object - * @param[in] dimensions A Vector3 detailing the width, height and depth of the cube. - */ - void Initialize(const Vector3& dimensions); - -private: - // unimplemented copy constructor and assignment operator - DynamicsCubeShape(const DynamicsCubeShape&); - DynamicsCubeShape& operator=(const DynamicsCubeShape&); - -}; // class DynamicsCubeShape - -// Messages for DynamicsCubeShape - -inline void InitializeDynamicsCubeShapeMessage( EventThreadServices& eventThreadServices, const DynamicsCubeShape& shape, const Vector3& dimensions ) -{ - typedef MessageValue1< DynamicsCubeShape, Vector3 > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &shape, &DynamicsCubeShape::Initialize, dimensions ); -} - -} // namespace SceneGraph - -} // namespace Internal - -} // namespace Dali - -#endif // __SCENE_GRAPH_DYNAMICS_CUBE_SHAPE_H__ diff --git a/dali/internal/update/dynamics/scene-graph-dynamics-cylinder-shape.cpp b/dali/internal/update/dynamics/scene-graph-dynamics-cylinder-shape.cpp deleted file mode 100644 index 1be88c2..0000000 --- a/dali/internal/update/dynamics/scene-graph-dynamics-cylinder-shape.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// INTERNAL HEADERS -#include -#include -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace SceneGraph -{ - -DynamicsCylinderShape::DynamicsCylinderShape(DynamicsWorld& world) -: DynamicsShape(world) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); -} - -DynamicsCylinderShape::~DynamicsCylinderShape() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); -} - -void DynamicsCylinderShape::Initialize(const float radius, const float length) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (radius: %.1f length: %.1f)\n", __PRETTY_FUNCTION__, radius, length); - - mShape = mWorld.GetDynamicsFactory().CreateDynamicsShape(); - const float worldScale((1.0f / mWorld.GetWorldScale()) ); - mShape->Initialize( Dali::DynamicsShape::CYLINDER, Vector3( radius * worldScale, length * worldScale, 0.0f ) ); - - DynamicsShape::Initialize(); -} - - -} // namespace SceneGraph - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/update/dynamics/scene-graph-dynamics-cylinder-shape.h b/dali/internal/update/dynamics/scene-graph-dynamics-cylinder-shape.h deleted file mode 100644 index 0438f03..0000000 --- a/dali/internal/update/dynamics/scene-graph-dynamics-cylinder-shape.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef __SCENE_GRAPH_DYNAMICS_CYLINDER_SHAPE_H__ -#define __SCENE_GRAPH_DYNAMICS_CYLINDER_SHAPE_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADERS -#include - -// INTERNAL INCLUDES -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace SceneGraph -{ - -class DynamicsWorld; - -class DynamicsCylinderShape : public DynamicsShape -{ -public: - /** - * Constructor. - * @param[in] world The dynamics world object - */ - DynamicsCylinderShape(DynamicsWorld& world); - - /** - * Destructor. - */ - virtual ~DynamicsCylinderShape(); - - /** - * Initialize the cylinder. - * @param[in] radius The radius of the cylinder. - * @param[in] length The length of the cylinder. - */ - void Initialize( float radius, float length ); - -private: - // unimplemented copy constructor and assignment operator - DynamicsCylinderShape(const DynamicsCylinderShape&); - DynamicsCylinderShape& operator=(const DynamicsCylinderShape&); - -}; // class DynamicsCylinderShape - -// Messages for DynamicsCylinderShape - -inline void InitializeDynamicsCylinderShapeMessage( EventThreadServices& eventThreadServices, const DynamicsCylinderShape& shape, const float radius, const float length ) -{ - typedef MessageValue2< DynamicsCylinderShape, float, float > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &shape, &DynamicsCylinderShape::Initialize, radius, length ); -} - -} // namespace SceneGraph - -} // namespace Internal - -} // namespace Dali - -#endif // __SCENE_GRAPH_DYNAMICS_CYLINDER_SHAPE_H__ diff --git a/dali/internal/update/dynamics/scene-graph-dynamics-joint.cpp b/dali/internal/update/dynamics/scene-graph-dynamics-joint.cpp deleted file mode 100644 index bf1de71..0000000 --- a/dali/internal/update/dynamics/scene-graph-dynamics-joint.cpp +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// INTERNAL HEADERS -#include -#include -#include -#include -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace SceneGraph -{ - -DynamicsJoint::DynamicsJoint(DynamicsWorld& world) -: mWorld( world ), - mJoint(NULL) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); -} - -DynamicsJoint::~DynamicsJoint() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); - - delete mJoint; -} - -void DynamicsJoint::Initialize( DynamicsBody* bodyA, DynamicsBody* bodyB, const Vector3& offsetA, const Vector3& offsetB) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - offsetA[%f %f %f] offsetB[%f %f %f]\n", __PRETTY_FUNCTION__, - offsetA.x, offsetA.y, offsetA.z, - offsetB.x, offsetB.y, offsetB.z); - DALI_ASSERT_DEBUG( bodyA && bodyB && "null bodies passed in to joint initialization" ); - DALI_ASSERT_DEBUG( NULL != bodyA->mBody ); - DALI_ASSERT_DEBUG( NULL != bodyB->mBody ); - - const float worldScaleReciprocal(1.0f / mWorld.GetWorldScale()); - Vector3 bodyAPosition; - Quaternion bodyARotation; - Vector3 bodyBPosition; - Quaternion bodyBRotation; - - mJoint = mWorld.GetDynamicsFactory().CreateDynamicsJoint(); - - bodyA->RefreshDynamics(); - bodyB->RefreshDynamics(); - - bodyA->GetNodePositionAndRotation( bodyAPosition, bodyARotation ); - bodyB->GetNodePositionAndRotation( bodyBPosition, bodyBRotation ); - - mJoint->Initialize( bodyA->GetBody(), bodyAPosition, bodyARotation, offsetA * worldScaleReciprocal, - bodyB->GetBody(), bodyBPosition, bodyBRotation, offsetB * worldScaleReciprocal ); -} - -void DynamicsJoint::SetLimit(const int axisIndex, const float lowerLimit, const float upperLimit) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (axisIndex: 0x%x lowerLimit:%f upperLimit: %f)\n", __PRETTY_FUNCTION__, axisIndex, lowerLimit, upperLimit); - - const float worldScaleReciprocal(1.0f / mWorld.GetWorldScale()); - const float scaledLowerLimit(lowerLimit * worldScaleReciprocal); - const float scaledUpperLimit(upperLimit * worldScaleReciprocal); - - int bit(1 << 0); - for( unsigned int i = 0; i < Dali::Internal::DynamicsJoint::MaxAxis; ++i ) - { - if( bit & axisIndex ) - { - if( i < Dali::Internal::DynamicsJoint::RotationAxis ) - { - mJoint->SetLimit( i, scaledLowerLimit, scaledUpperLimit ); - } - else - { - mJoint->SetLimit( i, lowerLimit, upperLimit ); - } - } - bit <<= 1; - } -} - -void DynamicsJoint::EnableSpring(const int axisIndex, const bool flag) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (axisIndex: 0x%x, %s)\n", __PRETTY_FUNCTION__, axisIndex, (flag ? "On" : "Off") ); - - int bit(1 << 0); - for( unsigned int i = 0; i < Dali::Internal::DynamicsJoint::MaxAxis; ++i ) - { - if( bit & axisIndex ) - { - mJoint->EnableSpring( i, flag ); - } - bit <<= 1; - } -} - -void DynamicsJoint::DynamicsJoint::SetSpringStiffness(const int axisIndex, const float stiffness) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (axisIndex: 0x%x, %f)\n", __PRETTY_FUNCTION__, axisIndex, stiffness ); - - int bit(1 << 0); - for( unsigned int i = 0; i < Dali::Internal::DynamicsJoint::MaxAxis; ++i ) - { - if( bit & axisIndex ) - { - mJoint->SetSpringStiffness( i, stiffness ); - } - bit <<= 1; - } -} - -void DynamicsJoint::DynamicsJoint::SetSpringDamping(const int axisIndex, const float damping) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (axisIndex: 0x%x, %f)\n", __PRETTY_FUNCTION__, axisIndex, damping ); - - int bit(1 << 0); - for( unsigned int i = 0; i < Dali::Internal::DynamicsJoint::MaxAxis; ++i ) - { - if( bit & axisIndex ) - { - mJoint->SetSpringDamping( i, damping ); - } - bit <<= 1; - } -} - -void DynamicsJoint::DynamicsJoint::SetSpringCenterPoint(const int axisIndex, const float ratio) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (axisIndex: 0x%x, %f)\n", __PRETTY_FUNCTION__, axisIndex, ratio ); - - int bit(1 << 0); - for( unsigned int i = 0; i < Dali::Internal::DynamicsJoint::MaxAxis; ++i ) - { - if( bit & axisIndex ) - { - mJoint->SetSpringCenterPoint( i, ratio ); - } - bit <<= 1; - } -} - -void DynamicsJoint::EnableMotor(const int axisIndex, const bool flag) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (axisIndex: 0x%x, %s)\n", __PRETTY_FUNCTION__, axisIndex, (flag ? "On" : "Off") ); - - int bit(1 << 0); - for( unsigned int i = 0; i < Dali::Internal::DynamicsJoint::MaxAxis; ++i ) - { - if( bit & axisIndex ) - { - mJoint->EnableMotor( i, flag ); - } - bit <<= 1; - } -} - -void DynamicsJoint::SetMotorVelocity(const int axisIndex, const float velocity) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Concise, "%s - (axisIndex: 0x%x, velocity: %f)\n", __PRETTY_FUNCTION__, axisIndex, velocity ); - - const float scaledVelocity( velocity / mWorld.GetWorldScale() ); - - int bit(1 << 0); - for( unsigned int i = 0; i < Dali::Internal::DynamicsJoint::MaxAxis; ++i ) - { - if( bit & axisIndex ) - { - if( i < Dali::Internal::DynamicsJoint::RotationAxis ) - { - mJoint->SetMotorVelocity( i, scaledVelocity ); - } - else - { - mJoint->SetMotorVelocity( i, velocity ); - } - } - bit <<= 1; - } -} - -void DynamicsJoint::SetMotorForce(const int axisIndex, const float force) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Concise, "%s - (axisIndex: 0x%x, velocity: %f)\n", __PRETTY_FUNCTION__, axisIndex, force ); - - int bit(1 << 0); - for( unsigned int i = 0; i < Dali::Internal::DynamicsJoint::MaxAxis; ++i ) - { - if( bit & axisIndex ) - { - mJoint->SetMotorForce( i, force ); - } - bit <<= 1; - } -} - -void DynamicsJoint::Connect() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s)\n", __PRETTY_FUNCTION__); - - mWorld.AddJoint(*this); -} - -void DynamicsJoint::Disconnect() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); - - mWorld.RemoveJoint(*this); -} - -void DynamicsJoint::Delete() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); - - mWorld.DeleteJoint(*this); -} - -Integration::DynamicsJoint* DynamicsJoint::GetJoint() const -{ - return mJoint; -} - -} // namespace SceneGraph - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/update/dynamics/scene-graph-dynamics-joint.h b/dali/internal/update/dynamics/scene-graph-dynamics-joint.h deleted file mode 100644 index 4871434..0000000 --- a/dali/internal/update/dynamics/scene-graph-dynamics-joint.h +++ /dev/null @@ -1,254 +0,0 @@ -#ifndef __SCENE_GRAPH_DYNAMICS_JOINT_H__ -#define __SCENE_GRAPH_DYNAMICS_JOINT_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include - -// INTERNAL INCLUDES -#include -#include -#include -#include -#include - -class btGeneric6DofSpringConstraint; - -namespace Dali -{ - -namespace Integration -{ - -class DynamicsJoint; - -} // namespace Integration - -namespace Internal -{ - -namespace SceneGraph -{ - -class DynamicsBody; -class DynamicsWorld; -class Node; - -class DynamicsJoint -{ -public: - /** - * Constructor. - */ - DynamicsJoint(DynamicsWorld& world); - - /** - * Destructor. - */ - virtual ~DynamicsJoint(); - -private: - // unimplemented copy constructor and assignment operator - DynamicsJoint(const DynamicsJoint&); - DynamicsJoint& operator=(const DynamicsJoint&); - -public: - - void Initialize( DynamicsBody* bodyA, DynamicsBody* bodyB, const Vector3& offsetA, const Vector3& offsetB ); - - // @copydoc Dali::Internal::DynamicsJoint::SetLimit - void SetLimit( int axisIndex, float lowerLimit, float upperLimit ); - - /// @copydoc Dali::Internal::DynamicsJoint::EnableSpring - void EnableSpring( int axisIndex, bool flag ); - - /// @copydoc Dali::Internal::DynamicsJoint::SetSpringStiffness - void SetSpringStiffness( int axisIndex, float stiffness ); - - /// @copydoc Dali::Internal::DynamicsJoint::SetSpringDamping - void SetSpringDamping( int axisIndex, float damping ); - - /// @copydoc Dali::Internal::DynamicsJoint::SetSpringCenterPoint - void SetSpringCenterPoint( int axisIndex, float ratio ); - - /// @copydoc Dali::Internal::DynamicsJoint::EnableMotor - void EnableMotor( int axisIndex, bool flag ); - - /// @copydoc Dali::Internal::DynamicsJoint::SetMotorVelocity - void SetMotorVelocity( int axisIndex, float velocity ); - - /// @copydoc Dali::Internal::DynamicsJoint::SetMotorForce - void SetMotorForce( int axisIndex, float force ); - - void Connect(); - void Disconnect(); - void Delete(); - - Integration::DynamicsJoint* GetJoint() const; - -private: - DynamicsWorld& mWorld; - Integration::DynamicsJoint* mJoint; -}; // class DynamicsJoint - -// Messages for DynamicsJoint - -inline void InitializeDynamicsJointMessage( EventThreadServices& eventThreadServices, const DynamicsJoint& joint, const DynamicsBody& bodyA, const DynamicsBody& bodyB, const Vector3& offsetA , const Vector3& offsetB ) -{ - typedef MessageValue4< DynamicsJoint, DynamicsBody*, DynamicsBody*, Vector3, Vector3 > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &joint, &DynamicsJoint::Initialize, - const_cast( &bodyA ), - const_cast( &bodyB ), - offsetA, - offsetB ); -} - -inline void SetLimitMessage( EventThreadServices& eventThreadServices, const DynamicsJoint& joint, int axisIndex, float lowerLimit, float upperLimit ) -{ - typedef MessageValue3< DynamicsJoint, int, float, float > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &joint, &DynamicsJoint::SetLimit, axisIndex, lowerLimit, upperLimit ); -} - -inline void SetEnableSpringMessage( EventThreadServices& eventThreadServices, const DynamicsJoint& joint, int axisIndex, bool flag ) -{ - typedef MessageValue2< DynamicsJoint, int, bool > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &joint, &DynamicsJoint::EnableSpring, axisIndex, flag ); -} - -inline void SetSpringStiffnessMessage( EventThreadServices& eventThreadServices, const DynamicsJoint& joint, int axisIndex, float stiffness ) -{ - typedef MessageValue2< DynamicsJoint, int, float > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &joint, &DynamicsJoint::SetSpringStiffness, axisIndex, stiffness ); -} - -inline void SetSpringDampingMessage( EventThreadServices& eventThreadServices, const DynamicsJoint& joint, int axisIndex, float damping ) -{ - typedef MessageValue2< DynamicsJoint, int, float > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &joint, &DynamicsJoint::SetSpringDamping, axisIndex, damping ); -} - -inline void SetSpringCenterPointMessage( EventThreadServices& eventThreadServices, const DynamicsJoint& joint, int axisIndex, float ratio ) -{ - typedef MessageValue2< DynamicsJoint, int, float > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &joint, &DynamicsJoint::SetSpringCenterPoint, axisIndex, ratio ); -} - -inline void SetEnableMotorMessage( EventThreadServices& eventThreadServices, const DynamicsJoint& joint, int axisIndex, bool flag ) -{ - typedef MessageValue2< DynamicsJoint, int, bool > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &joint, &DynamicsJoint::EnableMotor, axisIndex, flag ); -} - -inline void SetMotorVelocityMessage( EventThreadServices& eventThreadServices, const DynamicsJoint& joint, int axisIndex, float velocity ) -{ - typedef MessageValue2< DynamicsJoint, int, float > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &joint, &DynamicsJoint::SetMotorVelocity, axisIndex, velocity ); -} - -inline void SetMotorForceMessage( EventThreadServices& eventThreadServices, const DynamicsJoint& joint, int axisIndex, float force ) -{ - typedef MessageValue2< DynamicsJoint, int, float > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &joint, &DynamicsJoint::SetMotorForce, axisIndex, force ); -} - -inline void ConnectJointMessage( EventThreadServices& eventThreadServices, const DynamicsJoint& joint ) -{ - typedef Message< DynamicsJoint > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &joint, &DynamicsJoint::Connect ); -} - -inline void DisconnectJointMessage( EventThreadServices& eventThreadServices, const DynamicsJoint& joint ) -{ - typedef Message< DynamicsJoint > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &joint, &DynamicsJoint::Disconnect ); -} - -inline void DeleteJointMessage( EventThreadServices& eventThreadServices, const DynamicsJoint& joint ) -{ - typedef Message< DynamicsJoint > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &joint, &DynamicsJoint::Delete ); -} - -} // namespace SceneGraph - -} // namespace Internal - -} // namespace Dali - -#endif // __SCENE_GRAPH_DYNAMICS_JOINT_H__ diff --git a/dali/internal/update/dynamics/scene-graph-dynamics-motion-state.cpp b/dali/internal/update/dynamics/scene-graph-dynamics-motion-state.cpp deleted file mode 100644 index 7815132..0000000 --- a/dali/internal/update/dynamics/scene-graph-dynamics-motion-state.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// INTERNAL HEADERS -#include -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace SceneGraph -{ - -DynamicsMotionState::DynamicsMotionState(DynamicsBody& dynamicsBody) -: mDynamicsBody(dynamicsBody) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); -} - -DynamicsMotionState::~DynamicsMotionState() -{ -} - -void DynamicsMotionState::getWorldTransform(btTransform& transform) const -{ -// DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); - - // get node's world position and rotation - Vector3 position; - Quaternion rotation; - Vector3 axis; - float angle( 0.0f ); - - mDynamicsBody.GetNodePositionAndRotation(position, rotation); - rotation.ToAxisAngle( axis, angle ); - - // modify parameters - transform.setIdentity(); - transform.setOrigin(btVector3(position.x, position.y, position.z)); - if( axis != Vector3::ZERO ) - { - transform.setRotation( btQuaternion(btVector3(axis.x, axis.y, axis.z), btScalar(angle)) ); - } -} - -void DynamicsMotionState::setWorldTransform(const btTransform& transform) -{ -// DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); - - // get updated parameters - const btVector3& origin( transform.getOrigin() ); - const btQuaternion rotation( transform.getRotation() ); - const btVector3& axis( rotation.getAxis() ); - const btScalar& angle( rotation.getAngle() ); - - Vector3 newPosition( origin.x(), origin.y(), origin.z() ); - const Vector3 newAxis( axis.x(), axis.y(), axis.z() ); - Quaternion newRotation( float(angle), newAxis ); - - // set the nodes updated params - mDynamicsBody.SetNodePositionAndRotation( newPosition, newRotation ); -} - -} // namespace SceneGraph - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/update/dynamics/scene-graph-dynamics-motion-state.h b/dali/internal/update/dynamics/scene-graph-dynamics-motion-state.h deleted file mode 100644 index 7768d78..0000000 --- a/dali/internal/update/dynamics/scene-graph-dynamics-motion-state.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef __SCENE_GRAPH_DYNAMICS_MOTION_STATE_H__ -#define __SCENE_GRAPH_DYNAMICS_MOTION_STATE_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -namespace Dali -{ - -namespace Internal -{ - -namespace SceneGraph -{ - -class DynamicsBody; - -/** - * The DynamicsMotionState class allows the dynamics engine to synchronize and interpolate - * the updated world transforms with Dali. - * Only really useful for kinematic objects. - */ -class DynamicsMotionState -{ -public: - /** - * Constructor. - * @param[in] dynamicsBody The DynamicsBody synchronized with this MotionState - */ - DynamicsMotionState(DynamicsBody& dynamicsBody); - - /** - * Destructor - */ - virtual ~DynamicsMotionState(); - - /** - * Called by the Dynamics Engine to update it's copy of the body's position/orientation - * @param[out] transform The matrix the body's position/orientation will be copied to. - */ - virtual void getWorldTransform(btTransform& transform) const; - - /** - * Called by the Dynamics Engine to update our copy the body's position/orientation - * @param[in] transform The body's position/orientation as calculated by the Dynamics engine. - */ - virtual void setWorldTransform(const btTransform& transform); - -protected: - DynamicsBody& mDynamicsBody; ///< The DynamicsBody -}; // class DynamicsMotionState - -} // namespace SceneGraph - -} // namespace Internal - -} // namespace Dali - -#endif // __SCENE_GRAPH_DYNAMICS_MOTION_STATE_H__ diff --git a/dali/internal/update/dynamics/scene-graph-dynamics-shape.cpp b/dali/internal/update/dynamics/scene-graph-dynamics-shape.cpp deleted file mode 100644 index f27fff1..0000000 --- a/dali/internal/update/dynamics/scene-graph-dynamics-shape.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// INTERNAL HEADERS -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace SceneGraph -{ - -DynamicsShape::DynamicsShape(DynamicsWorld& world) -: mShape(NULL), - mWorld(world) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); -} - -DynamicsShape::~DynamicsShape() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); - - delete mShape; -} - -void DynamicsShape::Initialize() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); - - mWorld.AddShape( *this ); -} - -void DynamicsShape::Delete() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); - - mWorld.DeleteShape( *this ); -} - -Integration::DynamicsShape* DynamicsShape::GetShape() const -{ - return mShape; -} - -} // namespace SceneGraph - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/update/dynamics/scene-graph-dynamics-shape.h b/dali/internal/update/dynamics/scene-graph-dynamics-shape.h deleted file mode 100644 index 6195936..0000000 --- a/dali/internal/update/dynamics/scene-graph-dynamics-shape.h +++ /dev/null @@ -1,100 +0,0 @@ -#ifndef __SCENE_GRAPH_DYNAMICS_SHAPE_H__ -#define __SCENE_GRAPH_DYNAMICS_SHAPE_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include - -// INTERNAL INCLUDES -#include -#include -#include - -namespace Dali -{ - -namespace Integration -{ - -class DynamicsShape; - -} // namespace Integration - -namespace Internal -{ - -namespace SceneGraph -{ - -class DynamicsWorld; - -class DynamicsShape -{ -public: - /** - * Constructor. - */ - DynamicsShape(DynamicsWorld& world); - - /** - * Destructor. - */ - virtual ~DynamicsShape(); - - /** - * Initialize shape, and add it to the world's shape container - */ - void Initialize(); - - /** - * Remove from world's shape container - */ - void Delete(); - - Integration::DynamicsShape* GetShape() const; - -private: - // unimplemented copy constructor and assignment operator - DynamicsShape(const DynamicsShape&); - DynamicsShape& operator=(const DynamicsShape&); - -protected: - Integration::DynamicsShape* mShape; - DynamicsWorld& mWorld; - -}; // class DynamicsCubeShape - -inline void DeleteShapeMessage( EventThreadServices& eventThreadServices, const DynamicsShape& shape ) -{ - typedef Message< DynamicsShape > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &shape, &DynamicsShape::Delete ); -} - -} // namespace SceneGraph - -} // namespace Internal - -} // namespace Dali - -#endif // __SCENE_GRAPH_DYNAMICS_SHAPE_H__ diff --git a/dali/internal/update/dynamics/scene-graph-dynamics-sphere-shape.cpp b/dali/internal/update/dynamics/scene-graph-dynamics-sphere-shape.cpp deleted file mode 100644 index 87af890..0000000 --- a/dali/internal/update/dynamics/scene-graph-dynamics-sphere-shape.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// INTERNAL HEADERS -#include -#include -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace SceneGraph -{ - -DynamicsSphereShape::DynamicsSphereShape(DynamicsWorld& world) -: DynamicsShape(world) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); -} - -DynamicsSphereShape::~DynamicsSphereShape() -{ -} - -void DynamicsSphereShape::Initialize(const float radius) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - (radius %.1f)\n", __PRETTY_FUNCTION__, radius); - - mShape = mWorld.GetDynamicsFactory().CreateDynamicsShape(); - - const float worldScale((1.0f / mWorld.GetWorldScale()) ); - mShape->Initialize( Dali::DynamicsShape::SPHERE, Vector3(radius * worldScale, 0.0f, 0.0f) ); - - DynamicsShape::Initialize(); -} - -} // namespace SceneGraph - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/update/dynamics/scene-graph-dynamics-sphere-shape.h b/dali/internal/update/dynamics/scene-graph-dynamics-sphere-shape.h deleted file mode 100644 index 5877b68..0000000 --- a/dali/internal/update/dynamics/scene-graph-dynamics-sphere-shape.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef __SCENE_GRAPH_DYNAMICS_SPHERE_SHAPE_H__ -#define __SCENE_GRAPH_DYNAMICS_SPHERE_SHAPE_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADERS -#include - -// INTERNAL INCLUDES -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -namespace SceneGraph -{ - -class DynamicsWorld; - -class DynamicsSphereShape : public DynamicsShape -{ -public: - /** - * Constructor. - * @param[in] world The dynamics world object - */ - DynamicsSphereShape(DynamicsWorld& world); - - /** - * Destructor. - */ - virtual ~DynamicsSphereShape(); - - /** - * Initialize the sphere. - * @param[in] radius The radius of the sphere. - */ - void Initialize( float radius ); - -private: - // unimplemented copy constructor and assignment operator - DynamicsSphereShape(const DynamicsSphereShape&); - DynamicsSphereShape& operator=(const DynamicsSphereShape&); - -}; // class DynamicsSphereShape - -// Messages for DynamicsSphereShape - -inline void InitializeDynamicsSphereShapeMessage( EventThreadServices& eventThreadServices, const DynamicsSphereShape& shape, const float radius ) -{ - typedef MessageValue1< DynamicsSphereShape, float > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &shape, &DynamicsSphereShape::Initialize, radius ); -} - -} // namespace SceneGraph - -} // namespace Internal - -} // namespace Dali - -#endif // __SCENE_GRAPH_DYNAMICS_SPHERE_SHAPE_H__ diff --git a/dali/internal/update/dynamics/scene-graph-dynamics-world.cpp b/dali/internal/update/dynamics/scene-graph-dynamics-world.cpp deleted file mode 100644 index 48cfca7..0000000 --- a/dali/internal/update/dynamics/scene-graph-dynamics-world.cpp +++ /dev/null @@ -1,416 +0,0 @@ -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// EXTERNAL HEADERS -#include - -// INTERNAL HEADERS -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace Dali -{ -namespace Internal -{ -namespace SceneGraph -{ - -DynamicsWorld::DynamicsWorld(DynamicsNotifier& dynamicsNotifier, - NotificationManager& notificationManager, - Integration::DynamicsFactory& dynamicsFactory ) -: mDynamicsNotifier(dynamicsNotifier), - mNotificationManager(notificationManager), - mSceneController(NULL), - mBuffers(NULL), - mDynamicsFactory(dynamicsFactory), - mDynamicsWorld(NULL), - mSettings(NULL) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); -} - -DynamicsWorld::~DynamicsWorld() -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); - - { // clean up joints - mDiscardedJoints.Clear(); - mInactiveJoints.Clear(); - - DynamicsJointContainer::Iterator it( mJoints.Begin() ); - DynamicsJointContainer::Iterator endIt( mJoints.End() ); - for( ; it != endIt; ++it) - { - // remove from simulation - mDynamicsWorld->RemoveJoint( (*it)->GetJoint() ); - } - mJoints.Clear(); - } - - { // clean up bodies - mDiscardedBodies.Clear(); - mInactiveBodies.Clear(); - DynamicsBodyContainer::Iterator it( mBodies.Begin() ); - DynamicsBodyContainer::Iterator endIt( mBodies.End() ); - for( ; it != endIt; ++it) - { - // remove from simulation - mDynamicsWorld->RemoveBody( (*it)->GetBody() ); - } - mBodies.Clear(); - } - - { // clean up shapes - mDiscardedShapes.Clear(); - mShapes.Clear(); - } - - // Destroy simulation - delete mDynamicsWorld; - delete mSettings; - - // Unload shared object library - mDynamicsFactory.TerminateDynamics(); -} - -void DynamicsWorld::Initialize(SceneController* sceneController, Integration::DynamicsWorldSettings* worldSettings, const SceneGraphBuffers* buffers ) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::General, "%s\n", __PRETTY_FUNCTION__); - - mSettings = worldSettings; // take ownership of the DynamicsWorldSettings object - - mDynamicsWorld = mDynamicsFactory.CreateDynamicsWorld(); - mDynamicsWorld->Initialize( *mSettings ); - - mSceneController = sceneController; - mBuffers = buffers; -} - -void DynamicsWorld::AddBody(DynamicsBody& body) -{ - // Assert to catch multiple adds - DALI_ASSERT_DEBUG(std::find(mBodies.Begin(), mBodies.End(), &body) == mBodies.End()); - - // remove from inactive bodies container - DynamicsBodyContainer::Iterator iter = std::find(mInactiveBodies.Begin(), mInactiveBodies.End(), &body); - if( iter != mInactiveBodies.End() ) - { - mInactiveBodies.Release(iter); - } - - mDynamicsWorld->AddBody( body.GetBody() ); - - mBodies.PushBack(&body); - - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::General, "%s - (Bodies: %d)\n", __PRETTY_FUNCTION__, (int)(mBodies.Count() + mInactiveBodies.Count()) ); -} - -void DynamicsWorld::RemoveBody(DynamicsBody& body) -{ - DynamicsBodyContainer::Iterator iter = std::find(mBodies.Begin(), mBodies.End(), &body); - DALI_ASSERT_DEBUG(iter != mBodies.End()); - - mDynamicsWorld->RemoveBody( body.GetBody() ); - - // Add to inactive container - mInactiveBodies.PushBack(*iter); - - // Remove from active container - mBodies.Release(iter); - - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::General, "%s - (Bodies: %d)\n", __PRETTY_FUNCTION__, (int)(mBodies.Count() + mInactiveBodies.Count()) ); -} - -void DynamicsWorld::DeleteBody(DynamicsBody& body) -{ - // Assert the body is not in the active bodies container - DALI_ASSERT_DEBUG(std::find(mBodies.Begin(), mBodies.End(), &body) == mBodies.End()); - - // Assert the body is in the inactive bodies container - DynamicsBodyContainer::Iterator iter = std::find(mInactiveBodies.Begin(), mInactiveBodies.End(), &body); - DALI_ASSERT_DEBUG(iter != mInactiveBodies.End()); - - // Add body to be discarded container - mDiscardedBodies.PushBack(&body); - - // Remove from inactive container - mInactiveBodies.Release(iter); - - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::General, "%s - (Bodies: %d)\n", __PRETTY_FUNCTION__, (int)(mBodies.Count() + mInactiveBodies.Count()) ); -} - -void DynamicsWorld::AddJoint(DynamicsJoint& joint) -{ - // Assert to catch multiple adds - DALI_ASSERT_DEBUG(std::find(mJoints.Begin(), mJoints.End(), &joint) == mJoints.End()); - - // remove from inactive joint container - DynamicsJointContainer::Iterator iter = std::find(mInactiveJoints.Begin(), mInactiveJoints.End(), &joint); - if( iter != mInactiveJoints.End() ) - { - mInactiveJoints.Release(iter); - } - - // Add to simulation - mDynamicsWorld->AddJoint( joint.GetJoint() ); - - // Add to active container - mJoints.PushBack(&joint); - - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::General, "%s - (Joints: %d)\n", __PRETTY_FUNCTION__, (int)(mJoints.Count() + mInactiveJoints.Count())); -} - -void DynamicsWorld::RemoveJoint(DynamicsJoint& joint) -{ - // Assert joint is in active queue - DynamicsJointContainer::Iterator iter = std::find(mJoints.Begin(), mJoints.End(), &joint); - DALI_ASSERT_DEBUG(iter != mJoints.End()); - - // remove from simulation - mDynamicsWorld->RemoveJoint( joint.GetJoint() ); - - // Add to inactive container - mInactiveJoints.PushBack(*iter); - - // Remove from active container - mJoints.Release(iter); - - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::General, "%s - (Joints: %d)\n", __PRETTY_FUNCTION__, (int)(mJoints.Count() + mInactiveJoints.Count())); -} - -void DynamicsWorld::DeleteJoint(DynamicsJoint& joint) -{ - // Assert the joint is not in the active joints container - DALI_ASSERT_DEBUG(std::find(mJoints.Begin(), mJoints.End(), &joint) == mJoints.End()); - - // Assert the joint is in the inactive container - DynamicsJointContainer::Iterator iter = std::find(mInactiveJoints.Begin(), mInactiveJoints.End(), &joint); - DALI_ASSERT_DEBUG(iter != mInactiveJoints.End()); - - // add to discarded container - mDiscardedJoints.PushBack(&joint); - - // remove from inactive container - mInactiveJoints.Release(iter); - - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::General, "%s - (Joints: %d)\n", __PRETTY_FUNCTION__, (int)(mJoints.Count() + mInactiveJoints.Count())); -} - -void DynamicsWorld::AddShape(DynamicsShape& shape) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); - - // Assert to catch multiple adds - DALI_ASSERT_DEBUG(std::find(mShapes.Begin(), mShapes.End(), &shape) == mShapes.End()); - - // Add to active container - mShapes.PushBack(&shape); -} - -void DynamicsWorld::DeleteShape(DynamicsShape& shape) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s\n", __PRETTY_FUNCTION__); - - // Assert the shape is in the container - DynamicsShapeContainer::Iterator iter = std::find(mShapes.Begin(), mShapes.End(), &shape); - DALI_ASSERT_DEBUG(iter != mShapes.End()); - - // add to discarded container - mDiscardedShapes.PushBack(&shape); - - // remove from container - mShapes.Release(iter); -} - -void DynamicsWorld::SetGravity( const Vector3& gravity ) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s - gravity(%f %f %f)\n", __PRETTY_FUNCTION__, - gravity.x, gravity.y, gravity.z); - - mDynamicsWorld->SetGravity( gravity ); -} - -BufferIndex DynamicsWorld::GetBufferIndex() const -{ - return mBuffers->GetUpdateBufferIndex(); -} - -Integration::DynamicsFactory& DynamicsWorld::GetDynamicsFactory() -{ - return mDynamicsFactory; -} - -Integration::DynamicsWorld& DynamicsWorld::GetDynamicsWorld() -{ - return *mDynamicsWorld; -} - -bool DynamicsWorld::Update( float elapsedSeconds ) -{ - bool anyPositionChanged( false ); - - if( mNode ) - { - PreSimulationStep(); - - mDynamicsWorld->Update( elapsedSeconds ); - - anyPositionChanged = PostSimulationStep(); - - if( anyPositionChanged ) - { - CheckForCollisions(); - } - } - - return anyPositionChanged; -} - -void DynamicsWorld::PreSimulationStep() -{ - DynamicsBodyContainer::Iterator it = mBodies.Begin(); - DynamicsBodyContainer::Iterator end_it = mBodies.End(); - - for( ; it != end_it; ++it ) - { - DynamicsBody* body(*it); - if( Dali::DynamicsBodyConfig::RIGID == body->GetType() ) - { - if( body->IsKinematic() ) - { - body->RefreshDynamics(); - } - } - } -} - -bool DynamicsWorld::PostSimulationStep() -{ - bool anyPositionChanged(false); - - DynamicsBodyContainer::Iterator it = mBodies.Begin(); - DynamicsBodyContainer::Iterator end_it = mBodies.End(); - - for( ; it != end_it; ++it ) - { - DynamicsBody* body(*it); - anyPositionChanged |= body->RefreshNode( GetBufferIndex() ); - } - - // clean up discarded objects - mDiscardedJoints.Clear(); - mDiscardedBodies.Clear(); - mDiscardedShapes.Clear(); - - return anyPositionChanged; -} - - -// TODO: This needs to be totally rewritten and rationalized -// 1) Keep track of contact points between objects -// 2) Signal new collision between objects (impact) -// 3) Signal added contact points between already colliding objects (crumple) -// 4) Signal contact points that are moving (scraping) -// 5) Signal objects that are no longer colliding (disperse) -void DynamicsWorld::CheckForCollisions() -{ - Integration::CollisionDataContainer newContacts; - - mDynamicsWorld->CheckForCollisions( newContacts ); - - const float worldScale( GetWorldScale()); - - /* Check for added contacts ... */ - Integration::CollisionDataContainer::iterator it; - if( !newContacts.empty() ) - { - for( it = newContacts.begin(); it != newContacts.end(); ++it ) - { - if( mContacts.find( (*it).first ) == mContacts.end() ) - { - // signal new collision - Integration::DynamicsCollisionData& data = (*it).second; - - DALI_ASSERT_DEBUG(NULL != data.mBodyA); - DALI_ASSERT_DEBUG(NULL != data.mBodyB); - - data.mPointOnA *= worldScale; - data.mPointOnB *= worldScale; - - mNotificationManager.QueueMessage( CollisionImpactMessage( mDynamicsNotifier, new Integration::DynamicsCollisionData(data) ) ); - } - else - { - // Remove to filter no more active contacts - mContacts.erase( (*it).first ); - } - } - } - - /* ... and removed contacts */ - if (!mContacts.empty()) - { - for (it = mContacts.begin(); it != mContacts.end(); ++it) - { - // signal end of collision - Integration::DynamicsCollisionData& data = (*it).second; - - DALI_ASSERT_DEBUG(NULL != data.mBodyA); - DALI_ASSERT_DEBUG(NULL != data.mBodyB); - - mNotificationManager.QueueMessage( CollisionDisperseMessage( mDynamicsNotifier, new Integration::DynamicsCollisionData(data) ) ); - } - mContacts.clear(); - } - - // store current/active contacts - mContacts = newContacts; -} - -void DynamicsWorld::SetNode(Node* node) -{ - DALI_LOG_INFO(Debug::Filter::gDynamics, Debug::Verbose, "%s (node:%p)\n", __PRETTY_FUNCTION__, node); - mNode = node; -} - -/// @copydoc Dali::DynamicsWorld::GetWorldScale -float DynamicsWorld::GetWorldScale() const -{ - return 1.0f / mSettings->worldScale; -} - -} // namespace SceneGraph - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/update/dynamics/scene-graph-dynamics-world.h b/dali/internal/update/dynamics/scene-graph-dynamics-world.h deleted file mode 100644 index 3eb8c3b..0000000 --- a/dali/internal/update/dynamics/scene-graph-dynamics-world.h +++ /dev/null @@ -1,231 +0,0 @@ -#ifndef __SCENE_GRAPH_DYNAMICS_WORLD_H__ -#define __SCENE_GRAPH_DYNAMICS_WORLD_H__ - -/* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// INTERNAL INCLUDES -#include -#include -#include -#include -#include -#include -#include -#include - -namespace Dali -{ - -class Matrix; - -namespace Integration -{ - -struct DynamicsCollisionData; -class DynamicsFactory; -class DynamicsWorld; -struct DynamicsWorldSettings; - -typedef std::map CollisionDataContainer; - -} // namespace Integration - -namespace Internal -{ - -class NotificationManager; -class DynamicsWorldConfig; - -namespace SceneGraph -{ - -class Node; -class Shader; -struct DynamicsCollisionData; -class DynamicsBody; -class DynamicsJoint; -class DynamicsShape; -class SceneController; - -class DynamicsWorld -{ -public: - - /** - * Constructor. - * @param[in] dynamicsNotifier Notification object for dynamics events - * @param[in] notificationManager The notification manager - * @param[in] dynamicsFactory A reference to the factory object which creates instances of dynamics objects - */ - DynamicsWorld(DynamicsNotifier& dynamicsNotifier, - NotificationManager& notificationManager, - Integration::DynamicsFactory& dynamicsFactory ); - - /** - * Destructor. - */ - virtual ~DynamicsWorld(); - - /** - * Initialize a dynamics world - * @param[in] sceneController Allows access to the render message queue - * @param[in] worldSettings The configuration for the new DynamicsWorld - */ - void Initialize(SceneController* sceneController, Integration::DynamicsWorldSettings* worldSettings, const SceneGraphBuffers* buffers); - - void AddBody(DynamicsBody& body); - void RemoveBody(DynamicsBody& body); - void DeleteBody(DynamicsBody& body); - - void AddJoint(DynamicsJoint& joint); - void RemoveJoint(DynamicsJoint& joint); - void DeleteJoint(DynamicsJoint& joint); - - void AddShape(DynamicsShape& shape); - void DeleteShape(DynamicsShape& shape); - - /// @copydoc Dali::DynamicsWorld::SetGravity - void SetGravity( const Vector3& gravity ); - - /** - * Step the simulation and check for collisions - * @param[in] elapsedSeconds Time in seconds since last invocation - * @return true if any body was translated or rotated - */ - bool Update( float elapsedSeconds ); - - /** - * Update the simulation positions from the corresponding node position - */ - void PreSimulationStep(); - - /** - * Update the node position from the corresponding simulation position - * @return true if any body was translated or rotated - */ - bool PostSimulationStep(); - - /** - * Check for collisions between simulation objects - */ - void CheckForCollisions(); - - /** - * Set the root node for the simulation - * @param[in] node The root node - */ - void SetNode(Node* node); - - /** - * Set the world scale - * @param[in] scale The world scale - */ - void SetWorldScale( const float scale ); - - /** - * Get the world scale - * @return The world scale - */ - float GetWorldScale() const; - - /** - * Get the current update buffer index - * @return The index to the current update buffer for double buffer values - */ - BufferIndex GetBufferIndex() const; - - /** - * Get the dynamics factory object - * @return The dynamics factory object - */ - Integration::DynamicsFactory& GetDynamicsFactory(); - - /** - * Get the dynamics world object - * @return The dynamics world object - */ - Integration::DynamicsWorld& GetDynamicsWorld(); - -private: - - // unimplemented copy constructor and assignment operator - DynamicsWorld(const DynamicsWorld&); - DynamicsWorld& operator=(const DynamicsWorld&); - -private: - - typedef OwnerContainer< DynamicsBody* > DynamicsBodyContainer; - typedef OwnerContainer< DynamicsJoint* > DynamicsJointContainer; - typedef OwnerContainer< DynamicsShape* > DynamicsShapeContainer; - - DynamicsBodyContainer mBodies; // container of active DynamicsBodies - DynamicsBodyContainer mInactiveBodies; // container of discarded DynamicsBodies - DynamicsBodyContainer mDiscardedBodies; // container of discarded DynamicsBodies - - DynamicsJointContainer mJoints; // container of active DynamicsJoints - DynamicsJointContainer mInactiveJoints; // container of inactive DynamicsJoints - DynamicsJointContainer mDiscardedJoints; // container of discarded DynamicsJoints - - DynamicsShapeContainer mShapes; // container of DynamicsShapes - DynamicsShapeContainer mDiscardedShapes; // container of discarded DynamicsShapes - - DynamicsNotifier& mDynamicsNotifier; - NotificationManager& mNotificationManager; - - Node* mNode; - SceneController* mSceneController; - const SceneGraphBuffers* mBuffers; - - Integration::DynamicsFactory& mDynamicsFactory; - Integration::DynamicsWorld* mDynamicsWorld; - Integration::DynamicsWorldSettings* mSettings; - Integration::CollisionDataContainer mContacts; - -}; - -// Messages for DynamicsWorld - -inline void SetGravityMessage( EventThreadServices& eventThreadServices, const DynamicsWorld& world, const Vector3& gravity ) -{ - typedef MessageValue1< DynamicsWorld, Vector3 > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &world, &DynamicsWorld::SetGravity, gravity ); -} - -inline void SetRootActorMessage( EventThreadServices& eventThreadServices, const DynamicsWorld& world, const Node* node ) -{ - typedef MessageValue1< DynamicsWorld, Node* > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &world, &DynamicsWorld::SetNode, const_cast(node) ); -} - -} // namespace SceneGraph - -} // namespace Internal - -} // namespace Dali - -#endif // __SCENE_GRAPH_DYNAMICS_WORLD_H__ diff --git a/dali/internal/update/manager/update-manager.cpp b/dali/internal/update/manager/update-manager.cpp index 9daa1c5..866f4bc 100644 --- a/dali/internal/update/manager/update-manager.cpp +++ b/dali/internal/update/manager/update-manager.cpp @@ -71,11 +71,6 @@ #include #include -#ifdef DALI_DYNAMICS_SUPPORT -#include -#include -#endif - // Un-comment to enable node tree debug logging //#define NODE_TREE_LOGGING 1 @@ -181,7 +176,6 @@ struct UpdateManager::Impl samplers( sceneGraphBuffers, discardQueue ), propertyBuffers( sceneGraphBuffers, discardQueue ), messageQueue( renderController, sceneGraphBuffers ), - dynamicsChanged( false ), keepRenderingSeconds( 0.0f ), animationFinishedDuringUpdate( false ), nodeDirtyFlags( TransformFlag ), // set to TransformFlag to ensure full update the first time through Update() @@ -282,11 +276,6 @@ struct UpdateManager::Impl MessageQueue messageQueue; ///< The messages queued from the event-thread -#ifdef DALI_DYNAMICS_SUPPORT - OwnerPointer dynamicsWorld; ///< Wrapper for dynamics simulation -#endif - bool dynamicsChanged; ///< This is set to true if an object is changed in the dynamics simulation tick - float keepRenderingSeconds; ///< Set via Dali::Stage::KeepRendering bool animationFinishedDuringUpdate; ///< Flag whether any animations finished during the Update() @@ -976,7 +965,6 @@ unsigned int UpdateManager::Update( float elapsedSeconds, const bool updateScene = // The scene-graph requires an update if.. (mImpl->nodeDirtyFlags & RenderableUpdateFlags) || // ..nodes were dirty in previous frame OR IsAnimationRunning() || // ..at least one animation is running OR - mImpl->dynamicsChanged || // ..there was a change in the dynamics simulation OR mImpl->messageQueue.IsSceneUpdateRequired() || // ..a message that modifies the scene graph node tree is queued OR resourceChanged || // ..one or more resources were updated/changed OR gestureUpdated; // ..a gesture property was updated @@ -1006,27 +994,18 @@ unsigned int UpdateManager::Update( float elapsedSeconds, // 8) Apply Constraints ApplyConstraints(); -#ifdef DALI_DYNAMICS_SUPPORT - // 9) Update dynamics simulation - mImpl->dynamicsChanged = false; - if( mImpl->dynamicsWorld ) - { - mImpl->dynamicsChanged = mImpl->dynamicsWorld->Update( elapsedSeconds ); - } -#endif - - // 10) Check Property Notifications + // 9) Check Property Notifications ProcessPropertyNotifications(); - // 11) Clear the lists of renderable-attachments from the previous update + // 10) Clear the lists of renderable-attachments from the previous update ClearRenderables( mImpl->sortedLayers ); ClearRenderables( mImpl->systemLevelSortedLayers ); - // 12) Update node hierarchy and perform sorting / culling. + // 11) Update node hierarchy and perform sorting / culling. // This will populate each Layer with a list of renderers which are ready. UpdateNodes(); - // 13) Prepare for the next render + // 12) Prepare for the next render PERF_MONITOR_START(PerformanceMonitor::PREPARE_RENDERABLES); PrepareRenderables( bufferIndex, mImpl->sortedLayers ); @@ -1147,11 +1126,6 @@ unsigned int UpdateManager::KeepUpdatingCheck( float elapsedSeconds ) const keepUpdatingRequest |= KeepUpdating::ANIMATIONS_RUNNING; } - if ( mImpl->dynamicsChanged ) - { - keepUpdatingRequest |= KeepUpdating::DYNAMICS_CHANGED; - } - if ( mImpl->renderTaskWaiting ) { keepUpdatingRequest |= KeepUpdating::RENDER_TASK_SYNC; @@ -1200,21 +1174,6 @@ void UpdateManager::SetLayerDepths( const SortedLayerPointers& layers, bool syst } } -#ifdef DALI_DYNAMICS_SUPPORT - -void UpdateManager::InitializeDynamicsWorld( SceneGraph::DynamicsWorld* dynamicsWorld, Integration::DynamicsWorldSettings* worldSettings ) -{ - dynamicsWorld->Initialize( mImpl->sceneController, worldSettings, &mSceneGraphBuffers ); - mImpl->dynamicsWorld = dynamicsWorld; -} - -void UpdateManager::TerminateDynamicsWorld() -{ - mImpl->dynamicsWorld.Reset(); -} - -#endif // DALI_DYNAMICS_SUPPORT - } // namespace SceneGraph } // namespace Internal diff --git a/dali/internal/update/manager/update-manager.h b/dali/internal/update/manager/update-manager.h index f38dfb3..1f6e632 100644 --- a/dali/internal/update/manager/update-manager.h +++ b/dali/internal/update/manager/update-manager.h @@ -44,7 +44,6 @@ namespace Integration { class GlSyncAbstraction; class RenderController; -struct DynamicsWorldSettings; } // namespace Integration @@ -52,7 +51,6 @@ namespace Internal { class PropertyNotifier; -struct DynamicsWorldSettings; class NotificationManager; class CompleteNotificationInterface; class ResourceManager; @@ -71,7 +69,6 @@ class PanGesture; class RenderManager; class RenderTaskList; class RenderQueue; -class DynamicsWorld; class TextureCache; class Geometry; class PropertyBuffer; @@ -400,23 +397,6 @@ public: */ void SetLayerDepths( const std::vector< Layer* >& layers, bool systemLevel ); -#ifdef DALI_DYNAMICS_SUPPORT - - /** - * Initialize the dynamics world - * @param[in] world The dynamics world - * @param[in] worldSettings The dynamics world settings - * @param[in] debugShader The shader used for rendering dynamics debug information - */ - void InitializeDynamicsWorld( DynamicsWorld* world, Integration::DynamicsWorldSettings* worldSettings ); - - /** - * Terminate the dynamics world - */ - void TerminateDynamicsWorld(); - -#endif // DALI_DYNAMICS_SUPPORT - private: // Undefined @@ -811,34 +791,6 @@ inline void RemoveGestureMessage( UpdateManager& manager, PanGesture* gesture ) new (slot) LocalType( &manager, &UpdateManager::RemoveGesture, gesture ); } -#ifdef DALI_DYNAMICS_SUPPORT - -// Dynamics messages -inline void InitializeDynamicsWorldMessage( UpdateManager& manager, DynamicsWorld* dynamicsworld, Integration::DynamicsWorldSettings* worldSettings ) -{ - typedef MessageValue2< UpdateManager, DynamicsWorld*, Integration::DynamicsWorldSettings* > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &manager, &UpdateManager::InitializeDynamicsWorld, dynamicsworld, worldSettings ); -} - -inline void TerminateDynamicsWorldMessage(UpdateManager& manager) -{ - typedef Message< UpdateManager > LocalType; - - // Reserve some memory inside the message queue - unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &manager, &UpdateManager::TerminateDynamicsWorld ); -} - -#endif // DALI_DYNAMICS_SUPPORT - - template< typename T > inline void AddMessage( UpdateManager& manager, ObjectOwnerContainer& owner, T& object ) { -- 2.7.4