Commit 353791221593707c7b7a308a49a4236d05899166
1 parent
9cfb6b89
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 <david.steele@samsung.com>
Showing
3 changed files
with
30 additions
and
30 deletions
com.samsung.dali-demo.xml
| @@ -64,7 +64,7 @@ | @@ -64,7 +64,7 @@ | ||
| 64 | <ui-application appid="scroll-view.example" exec="/usr/apps/com.samsung.dali-demo/bin/scroll-view.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | 64 | <ui-application appid="scroll-view.example" exec="/usr/apps/com.samsung.dali-demo/bin/scroll-view.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 65 | <label>Scroll View</label> | 65 | <label>Scroll View</label> |
| 66 | </ui-application> | 66 | </ui-application> |
| 67 | - <ui-application appid="shadow-bone-lighting.example" exec="/usr/apps/com.samsung.dali-demo/bin/shadow-bone-lighting.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | 67 | + <ui-application appid="shadows-and-lights.example" exec="/usr/apps/com.samsung.dali-demo/bin/shadows-and-lights.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
| 68 | <label>Shadows and Lights</label> | 68 | <label>Shadows and Lights</label> |
| 69 | </ui-application> | 69 | </ui-application> |
| 70 | <ui-application appid="dali-builder" exec="/usr/apps/com.samsung.dali-demo/bin/dali-builder" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> | 70 | <ui-application appid="dali-builder" exec="/usr/apps/com.samsung.dali-demo/bin/dali-builder" nodisplay="true" multiple="false" type="c++app" taskmanage="true"> |
demo/dali-demo.cpp
| @@ -48,7 +48,7 @@ int DALI_EXPORT_API main(int argc, char **argv) | @@ -48,7 +48,7 @@ int DALI_EXPORT_API main(int argc, char **argv) | ||
| 48 | demo.AddExample(Example("page-turn-view.example", DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW)); | 48 | demo.AddExample(Example("page-turn-view.example", DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW)); |
| 49 | demo.AddExample(Example("refraction-effect.example", DALI_DEMO_STR_TITLE_REFRACTION)); | 49 | demo.AddExample(Example("refraction-effect.example", DALI_DEMO_STR_TITLE_REFRACTION)); |
| 50 | demo.AddExample(Example("scroll-view.example", DALI_DEMO_STR_TITLE_SCROLL_VIEW)); | 50 | demo.AddExample(Example("scroll-view.example", DALI_DEMO_STR_TITLE_SCROLL_VIEW)); |
| 51 | - demo.AddExample(Example("shadow-bone-lighting.example", DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS)); | 51 | + demo.AddExample(Example("shadows-and-lights.example", DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS)); |
| 52 | demo.AddExample(Example("builder.example", DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI)); | 52 | demo.AddExample(Example("builder.example", DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI)); |
| 53 | demo.AddExample(Example("image-scaling-and-filtering.example", DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING)); | 53 | demo.AddExample(Example("image-scaling-and-filtering.example", DALI_DEMO_STR_TITLE_IMAGE_FITTING_SAMPLING)); |
| 54 | demo.AddExample(Example("image-scaling-irregular-grid.example", DALI_DEMO_STR_TITLE_IMAGE_SCALING)); | 54 | demo.AddExample(Example("image-scaling-irregular-grid.example", DALI_DEMO_STR_TITLE_IMAGE_SCALING)); |
examples/shadow-bone-lighting/shadow-bone-lighting-example.cpp renamed to examples/shadows-and-lights/shadows-and-lights-example.cpp
| @@ -35,7 +35,7 @@ const char* BACKGROUND_IMAGE( DEMO_IMAGE_DIR "background-default.png" ); | @@ -35,7 +35,7 @@ const char* BACKGROUND_IMAGE( DEMO_IMAGE_DIR "background-default.png" ); | ||
| 35 | const char* TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" ); | 35 | const char* TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" ); |
| 36 | 36 | ||
| 37 | const char* APPLICATION_TITLE_PAN_LIGHT( "Lighting: Pan Light" ); | 37 | const char* APPLICATION_TITLE_PAN_LIGHT( "Lighting: Pan Light" ); |
| 38 | -const char* APPLICATION_TITLE_PAN_OBJECT( "Lighting: Rotate Object" ); | 38 | +const char* APPLICATION_TITLE_ROTATE_OBJECT( "Lighting: Rotate Object" ); |
| 39 | const char* APPLICATION_TITLE_PAN_SCENE( "Lighting: Pan Scene" ); | 39 | const char* APPLICATION_TITLE_PAN_SCENE( "Lighting: Pan Scene" ); |
| 40 | const char* APPLICATION_TITLE_ROTATE_SCENE( "Lighting: Rotate Scene" ); | 40 | const char* APPLICATION_TITLE_ROTATE_SCENE( "Lighting: Rotate Scene" ); |
| 41 | const char* CHANGE_EFFECT_IMAGE( DEMO_IMAGE_DIR "icon-change.png" ); | 41 | const char* CHANGE_EFFECT_IMAGE( DEMO_IMAGE_DIR "icon-change.png" ); |
| @@ -60,8 +60,8 @@ const Vector2 DEFAULT_STAGE_SIZE( 480.0f, 800.0f ); | @@ -60,8 +60,8 @@ const Vector2 DEFAULT_STAGE_SIZE( 480.0f, 800.0f ); | ||
| 60 | 60 | ||
| 61 | const float X_ROTATION_DISPLACEMENT_FACTOR = 60.f; | 61 | const float X_ROTATION_DISPLACEMENT_FACTOR = 60.f; |
| 62 | const float Y_ROTATION_DISPLACEMENT_FACTOR = 60.f; | 62 | const float Y_ROTATION_DISPLACEMENT_FACTOR = 60.f; |
| 63 | -const float LIGHT_PAN_X_DISPLACEMENT_FACTOR = 180.f; | ||
| 64 | -const float LIGHT_PAN_Y_DISPLACEMENT_FACTOR = 180.f; | 63 | +const float LIGHT_PAN_X_DISPLACEMENT_FACTOR = 1/360.f; |
| 64 | +const float LIGHT_PAN_Y_DISPLACEMENT_FACTOR = 1/360.f; | ||
| 65 | 65 | ||
| 66 | } | 66 | } |
| 67 | 67 | ||
| @@ -81,16 +81,16 @@ public: | @@ -81,16 +81,16 @@ public: | ||
| 81 | TestApp(Application &app) | 81 | TestApp(Application &app) |
| 82 | : mApp(app), | 82 | : mApp(app), |
| 83 | mPaused(false), | 83 | mPaused(false), |
| 84 | - mTranslation(Vector3::ZERO), | ||
| 85 | - mSceneYRotation( Dali::ANGLE_30 * 0.5f ), | ||
| 86 | - mSceneXRotation( Dali::ANGLE_30 ), | ||
| 87 | - mLightYRotation(0.0f), | ||
| 88 | - mLightXRotation(0.0f), | ||
| 89 | - mObjectYRotation(0.0f), | 84 | + mTranslation(22.0f, -1.0f, 0.0f), |
| 85 | + mSceneXRotation( Degree(-6.0f) ), // Initial values give a reasonable off-straight view. | ||
| 86 | + mSceneYRotation( Degree(20.0f) ), | ||
| 87 | + mLightXRotation( Degree(-1.5f) ), | ||
| 88 | + mLightYRotation( Degree(-9.5f) ), | ||
| 90 | mObjectXRotation(0.0f), | 89 | mObjectXRotation(0.0f), |
| 91 | - mPinchScale(0.5f), | ||
| 92 | - mScaleAtPinchStart(0.5f), | ||
| 93 | - mPanState(PAN_SCENE) | 90 | + mObjectYRotation(0.0f), |
| 91 | + mPinchScale(0.6f), | ||
| 92 | + mScaleAtPinchStart(0.6f), | ||
| 93 | + mPanState(PAN_LIGHT) | ||
| 94 | { | 94 | { |
| 95 | app.InitSignal().Connect(this, &TestApp::Create); | 95 | app.InitSignal().Connect(this, &TestApp::Create); |
| 96 | app.TerminateSignal().Connect(this, &TestApp::Terminate); | 96 | app.TerminateSignal().Connect(this, &TestApp::Terminate); |
| @@ -157,7 +157,7 @@ public: | @@ -157,7 +157,7 @@ public: | ||
| 157 | toolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter ); | 157 | toolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter ); |
| 158 | 158 | ||
| 159 | // Set Title text | 159 | // Set Title text |
| 160 | - mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_SCENE) ); | 160 | + mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_LIGHT) ); |
| 161 | 161 | ||
| 162 | //Add a reset button | 162 | //Add a reset button |
| 163 | Toolkit::PushButton resetButton = Toolkit::PushButton::New(); | 163 | Toolkit::PushButton resetButton = Toolkit::PushButton::New(); |
| @@ -167,7 +167,7 @@ public: | @@ -167,7 +167,7 @@ public: | ||
| 167 | toolBar.AddControl( resetButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING ); | 167 | toolBar.AddControl( resetButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING ); |
| 168 | 168 | ||
| 169 | // Setup | 169 | // Setup |
| 170 | - mView.SetPosition(Vector3(0.0f, 0.0f, -50)); | 170 | + mView.SetPosition(Vector3(0.0f, 0.0f, 0.0f)); |
| 171 | 171 | ||
| 172 | mContents.SetBehavior(Layer::LAYER_3D); | 172 | mContents.SetBehavior(Layer::LAYER_3D); |
| 173 | mContents.SetPosition(mTranslation); | 173 | mContents.SetPosition(mTranslation); |
| @@ -324,9 +324,9 @@ public: | @@ -324,9 +324,9 @@ public: | ||
| 324 | { | 324 | { |
| 325 | case PAN_LIGHT: | 325 | case PAN_LIGHT: |
| 326 | { | 326 | { |
| 327 | - mLightXRotation = mLightXRotation - gesture.displacement.y / LIGHT_PAN_X_DISPLACEMENT_FACTOR; // X displacement rotates around Y axis | 327 | + mLightXRotation = mLightXRotation - gesture.displacement.y * LIGHT_PAN_X_DISPLACEMENT_FACTOR; // X displacement rotates around Y axis |
| 328 | mLightXRotation = Clamp(mLightXRotation, -Dali::ANGLE_45, Dali::ANGLE_45 ); | 328 | mLightXRotation = Clamp(mLightXRotation, -Dali::ANGLE_45, Dali::ANGLE_45 ); |
| 329 | - mLightYRotation = mLightYRotation + gesture.displacement.x / LIGHT_PAN_Y_DISPLACEMENT_FACTOR; // Y displacement rotates around X axis | 329 | + mLightYRotation = mLightYRotation + gesture.displacement.x * LIGHT_PAN_Y_DISPLACEMENT_FACTOR; // Y displacement rotates around X axis |
| 330 | mLightYRotation = Clamp(mLightYRotation, -Dali::ANGLE_45, Dali::ANGLE_45 ); | 330 | mLightYRotation = Clamp(mLightYRotation, -Dali::ANGLE_45, Dali::ANGLE_45 ); |
| 331 | mLightAnchor.SetOrientation( CalculateWorldRotation( mLightXRotation, mLightYRotation ) ); | 331 | mLightAnchor.SetOrientation( CalculateWorldRotation( mLightXRotation, mLightYRotation ) ); |
| 332 | break; | 332 | break; |
| @@ -407,22 +407,22 @@ public: | @@ -407,22 +407,22 @@ public: | ||
| 407 | { | 407 | { |
| 408 | switch(mPanState) | 408 | switch(mPanState) |
| 409 | { | 409 | { |
| 410 | - case PAN_SCENE: | ||
| 411 | - mPanState = ROTATE_SCENE; | ||
| 412 | - mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_ROTATE_SCENE) ); | ||
| 413 | - break; | ||
| 414 | - case ROTATE_SCENE: | ||
| 415 | - mPanState = PAN_LIGHT; | ||
| 416 | - mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_LIGHT) ); | ||
| 417 | - break; | ||
| 418 | case PAN_LIGHT: | 410 | case PAN_LIGHT: |
| 419 | mPanState = ROTATE_OBJECT; | 411 | mPanState = ROTATE_OBJECT; |
| 420 | - mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_OBJECT) ); | 412 | + mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_ROTATE_OBJECT) ); |
| 421 | break; | 413 | break; |
| 422 | case ROTATE_OBJECT: | 414 | case ROTATE_OBJECT: |
| 415 | + mPanState = ROTATE_SCENE; | ||
| 416 | + mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_ROTATE_SCENE) ); | ||
| 417 | + break; | ||
| 418 | + case ROTATE_SCENE: | ||
| 423 | mPanState = PAN_SCENE; | 419 | mPanState = PAN_SCENE; |
| 424 | mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_SCENE) ); | 420 | mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_SCENE) ); |
| 425 | break; | 421 | break; |
| 422 | + case PAN_SCENE: | ||
| 423 | + mPanState = PAN_LIGHT; | ||
| 424 | + mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_PAN_LIGHT) ); | ||
| 425 | + break; | ||
| 426 | default: | 426 | default: |
| 427 | break; | 427 | break; |
| 428 | } | 428 | } |
| @@ -464,12 +464,12 @@ private: | @@ -464,12 +464,12 @@ private: | ||
| 464 | PinchGestureDetector mPinchGestureDetector; | 464 | PinchGestureDetector mPinchGestureDetector; |
| 465 | TapGestureDetector mTapGestureDetector; | 465 | TapGestureDetector mTapGestureDetector; |
| 466 | Vector3 mTranslation; | 466 | Vector3 mTranslation; |
| 467 | - Radian mSceneYRotation; | ||
| 468 | Radian mSceneXRotation; | 467 | Radian mSceneXRotation; |
| 469 | - Radian mLightYRotation; | 468 | + Radian mSceneYRotation; |
| 470 | Radian mLightXRotation; | 469 | Radian mLightXRotation; |
| 471 | - Radian mObjectYRotation; | 470 | + Radian mLightYRotation; |
| 472 | Radian mObjectXRotation; | 471 | Radian mObjectXRotation; |
| 472 | + Radian mObjectYRotation; | ||
| 473 | float mPinchScale; | 473 | float mPinchScale; |
| 474 | float mScaleAtPinchStart; | 474 | float mScaleAtPinchStart; |
| 475 | 475 |