From 353791221593707c7b7a308a49a4236d05899166 Mon Sep 17 00:00:00 2001 From: David Steele Date: Thu, 15 Sep 2016 12:58:03 +0100 Subject: [PATCH] Changed the shadow/lights example defaults Updated the defaults on the shadow / light example to first move the light, rather than panning the scene. Updated the intial orientations to look better. Change-Id: I8eceb5f536a75fef5e6881987452efb53af6e544 Signed-off-by: David Steele --- com.samsung.dali-demo.xml | 2 +- demo/dali-demo.cpp | 2 +- .../shadows-and-lights-example.cpp} | 56 +++++++++++----------- 3 files changed, 30 insertions(+), 30 deletions(-) rename examples/{shadow-bone-lighting/shadow-bone-lighting-example.cpp => shadows-and-lights/shadows-and-lights-example.cpp} (95%) diff --git a/com.samsung.dali-demo.xml b/com.samsung.dali-demo.xml index 4a58819..b7980de 100644 --- a/com.samsung.dali-demo.xml +++ b/com.samsung.dali-demo.xml @@ -64,7 +64,7 @@ - + diff --git a/demo/dali-demo.cpp b/demo/dali-demo.cpp index f413590..408eb58 100644 --- a/demo/dali-demo.cpp +++ b/demo/dali-demo.cpp @@ -48,7 +48,7 @@ int DALI_EXPORT_API main(int argc, char **argv) demo.AddExample(Example("page-turn-view.example", DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW)); demo.AddExample(Example("refraction-effect.example", DALI_DEMO_STR_TITLE_REFRACTION)); demo.AddExample(Example("scroll-view.example", DALI_DEMO_STR_TITLE_SCROLL_VIEW)); - demo.AddExample(Example("shadow-bone-lighting.example", DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS)); + demo.AddExample(Example("shadows-and-lights.example", DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS)); demo.AddExample(Example("builder.example", DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI)); demo.AddExample(Example("image-scaling-and-filtering.example", DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING)); demo.AddExample(Example("image-scaling-irregular-grid.example", DALI_DEMO_STR_TITLE_IMAGE_SCALING)); diff --git a/examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp b/examples/shadows-and-lights/shadows-and-lights-example.cpp similarity index 95% rename from examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp rename to examples/shadows-and-lights/shadows-and-lights-example.cpp index 72b6fa1..4ae5877 100644 --- a/examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp +++ b/examples/shadows-and-lights/shadows-and-lights-example.cpp @@ -35,7 +35,7 @@ const char* BACKGROUND_IMAGE( DEMO_IMAGE_DIR "background-default.png" ); const char* TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" ); const char* APPLICATION_TITLE_PAN_LIGHT( "Lighting: Pan Light" ); -const char* APPLICATION_TITLE_PAN_OBJECT( "Lighting: Rotate Object" ); +const char* APPLICATION_TITLE_ROTATE_OBJECT( "Lighting: Rotate Object" ); const char* APPLICATION_TITLE_PAN_SCENE( "Lighting: Pan Scene" ); const char* APPLICATION_TITLE_ROTATE_SCENE( "Lighting: Rotate Scene" ); const char* CHANGE_EFFECT_IMAGE( DEMO_IMAGE_DIR "icon-change.png" ); @@ -60,8 +60,8 @@ const Vector2 DEFAULT_STAGE_SIZE( 480.0f, 800.0f ); const float X_ROTATION_DISPLACEMENT_FACTOR = 60.f; const float Y_ROTATION_DISPLACEMENT_FACTOR = 60.f; -const float LIGHT_PAN_X_DISPLACEMENT_FACTOR = 180.f; -const float LIGHT_PAN_Y_DISPLACEMENT_FACTOR = 180.f; +const float LIGHT_PAN_X_DISPLACEMENT_FACTOR = 1/360.f; +const float LIGHT_PAN_Y_DISPLACEMENT_FACTOR = 1/360.f; } @@ -81,16 +81,16 @@ public: TestApp(Application &app) : mApp(app), mPaused(false), - mTranslation(Vector3::ZERO), - mSceneYRotation( Dali::ANGLE_30 * 0.5f ), - mSceneXRotation( Dali::ANGLE_30 ), - mLightYRotation(0.0f), - mLightXRotation(0.0f), - mObjectYRotation(0.0f), + mTranslation(22.0f, -1.0f, 0.0f), + mSceneXRotation( Degree(-6.0f) ), // Initial values give a reasonable off-straight view. + mSceneYRotation( Degree(20.0f) ), + mLightXRotation( Degree(-1.5f) ), + mLightYRotation( Degree(-9.5f) ), mObjectXRotation(0.0f), - mPinchScale(0.5f), - mScaleAtPinchStart(0.5f), - mPanState(PAN_SCENE) + mObjectYRotation(0.0f), + mPinchScale(0.6f), + mScaleAtPinchStart(0.6f), + mPanState(PAN_LIGHT) { app.InitSignal().Connect(this, &TestApp::Create); app.TerminateSignal().Connect(this, &TestApp::Terminate); @@ -157,7 +157,7 @@ public: toolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter ); // Set Title text - mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_SCENE) ); + mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_LIGHT) ); //Add a reset button Toolkit::PushButton resetButton = Toolkit::PushButton::New(); @@ -167,7 +167,7 @@ public: toolBar.AddControl( resetButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING ); // Setup - mView.SetPosition(Vector3(0.0f, 0.0f, -50)); + mView.SetPosition(Vector3(0.0f, 0.0f, 0.0f)); mContents.SetBehavior(Layer::LAYER_3D); mContents.SetPosition(mTranslation); @@ -324,9 +324,9 @@ public: { case PAN_LIGHT: { - mLightXRotation = mLightXRotation - gesture.displacement.y / LIGHT_PAN_X_DISPLACEMENT_FACTOR; // X displacement rotates around Y axis + mLightXRotation = mLightXRotation - gesture.displacement.y * LIGHT_PAN_X_DISPLACEMENT_FACTOR; // X displacement rotates around Y axis mLightXRotation = Clamp(mLightXRotation, -Dali::ANGLE_45, Dali::ANGLE_45 ); - mLightYRotation = mLightYRotation + gesture.displacement.x / LIGHT_PAN_Y_DISPLACEMENT_FACTOR; // Y displacement rotates around X axis + mLightYRotation = mLightYRotation + gesture.displacement.x * LIGHT_PAN_Y_DISPLACEMENT_FACTOR; // Y displacement rotates around X axis mLightYRotation = Clamp(mLightYRotation, -Dali::ANGLE_45, Dali::ANGLE_45 ); mLightAnchor.SetOrientation( CalculateWorldRotation( mLightXRotation, mLightYRotation ) ); break; @@ -407,22 +407,22 @@ public: { switch(mPanState) { - case PAN_SCENE: - mPanState = ROTATE_SCENE; - mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_ROTATE_SCENE) ); - break; - case ROTATE_SCENE: - mPanState = PAN_LIGHT; - mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_LIGHT) ); - break; case PAN_LIGHT: mPanState = ROTATE_OBJECT; - mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_OBJECT) ); + mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_ROTATE_OBJECT) ); break; case ROTATE_OBJECT: + mPanState = ROTATE_SCENE; + mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_ROTATE_SCENE) ); + break; + case ROTATE_SCENE: mPanState = PAN_SCENE; mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_SCENE) ); break; + case PAN_SCENE: + mPanState = PAN_LIGHT; + mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_LIGHT) ); + break; default: break; } @@ -464,12 +464,12 @@ private: PinchGestureDetector mPinchGestureDetector; TapGestureDetector mTapGestureDetector; Vector3 mTranslation; - Radian mSceneYRotation; Radian mSceneXRotation; - Radian mLightYRotation; + Radian mSceneYRotation; Radian mLightXRotation; - Radian mObjectYRotation; + Radian mLightYRotation; Radian mObjectXRotation; + Radian mObjectYRotation; float mPinchScale; float mScaleAtPinchStart; -- 2.7.4