[dali_1.0.5] Merge branch 'tizen' 25/26325/1
authorLee Morgan <Lee.morgan@partner.samsung.com>
Wed, 20 Aug 2014 14:07:49 +0000 (15:07 +0100)
committerLee Morgan <Lee.morgan@partner.samsung.com>
Wed, 20 Aug 2014 14:07:53 +0000 (15:07 +0100)
Change-Id: I01b742a6830b11215f770b15213a37f4435aa210
Signed-off-by: Lee Morgan <Lee.morgan@partner.samsung.com>
23 files changed:
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-style-monitor.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-timer.h
base/dali-toolkit/internal/builder/builder-impl.cpp
base/dali-toolkit/internal/controls/text-input/text-input-decorator-impl.cpp
base/dali-toolkit/internal/controls/text-input/text-input-impl.cpp
docs/content/images/viewing-modes/google-cardboard.png [new file with mode: 0644]
docs/content/images/viewing-modes/stereo-projection.png [new file with mode: 0755]
docs/content/main-page.h
docs/content/programming-guide/viewing-modes.h [new file with mode: 0644]
optional/dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.cpp
optional/dali-toolkit/internal/controls/image-view/image-view-impl.cpp
optional/dali-toolkit/internal/controls/page-turn-view/page-turn-landscape-view-impl.cpp
optional/dali-toolkit/internal/controls/page-turn-view/page-turn-landscape-view-impl.h
optional/dali-toolkit/internal/controls/page-turn-view/page-turn-portrait-view-impl.cpp
optional/dali-toolkit/internal/controls/page-turn-view/page-turn-portrait-view-impl.h
optional/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp
optional/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.h
optional/dali-toolkit/public-api/dali-toolkit-version.cpp
optional/dali-toolkit/public-api/shader-effects/motion-blur-effect.cpp
optional/dali-toolkit/public-api/shader-effects/motion-blur-effect.h
optional/dali-toolkit/public-api/shader-effects/motion-stretch-effect.cpp
optional/dali-toolkit/public-api/shader-effects/motion-stretch-effect.h
packaging/dali-toolkit.spec

index 1537e05..3876b2f 100644 (file)
@@ -51,7 +51,6 @@ public: // Creation & Destruction
   static StyleMonitor Get();
   ~StyleMonitor();
   static StyleMonitor DownCast( BaseHandle handle );
-  using BaseHandle::operator=;
 
 public: // Style Information
   std::string GetDefaultFontFamily() const;
index 8f23022..c479fb8 100644 (file)
@@ -47,7 +47,6 @@ public:
   Timer& operator=( const Timer& timer );
   ~Timer();
   static Timer DownCast( BaseHandle handle );
-  using BaseHandle::operator=;
   void Start();
   void Stop();
   void SetInterval( unsigned int milliSec );
index 917eadf..544c428 100644 (file)
@@ -253,12 +253,15 @@ void Builder::SetProperties( const TreeNode& node, Handle& handle, const Replace
       // special field 'effect' references the shader effect instances
       if(key == "effect")
       {
-        Actor actor = Actor::DownCast(handle);
-        OptionalString s = constant.IsString( keyChild.second );
-        if(actor && s)
+        RenderableActor actor = RenderableActor::DownCast(handle);
+        if( actor )
         {
-          ShaderEffect e = GetShaderEffect(*s, constant);
-          actor.SetShaderEffect(e);
+          OptionalString str = constant.IsString( keyChild.second );
+          if( str )
+          {
+            ShaderEffect effect = GetShaderEffect( *str, constant );
+            actor.SetShaderEffect(effect);
+          }
         }
         else
         {
@@ -274,7 +277,7 @@ void Builder::SetProperties( const TreeNode& node, Handle& handle, const Replace
 
       if( Property::INVALID_INDEX == index )
       {
-        Actor actor = Actor::DownCast(propertyObject);
+        RenderableActor actor = RenderableActor::DownCast(handle);
         if( actor )
         {
           if( ShaderEffect effect = actor.GetShaderEffect() )
index ed639e2..901e96c 100644 (file)
@@ -691,7 +691,6 @@ void Decorator::CreateHighlight( Actor parent )
   {
     mHighlightMeshActor = MeshActor::New( mTextHighlight.CreateHighLightMesh() );
     mHighlightMeshActor.SetName( "HighlightMeshActor" );
-    mHighlightMeshActor.SetInheritShaderEffect( false );
     mHighlightMeshActor.SetAffectedByLighting(false);
     parent.Add( mHighlightMeshActor );
   }
index da3443f..7a0729c 100644 (file)
@@ -4741,7 +4741,6 @@ void TextInput::CreateHighlight()
 
     mHighlightMeshActor = MeshActor::New( mHighlightMesh );
     mHighlightMeshActor.SetName( "HighlightMeshActor" );
-    mHighlightMeshActor.SetInheritShaderEffect( false );
     mHighlightMeshActor.SetParentOrigin( ParentOrigin::TOP_LEFT );
     mHighlightMeshActor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
     mHighlightMeshActor.SetPosition( 0.0f, 0.0f, DISPLAYED_HIGHLIGHT_Z_OFFSET );
diff --git a/docs/content/images/viewing-modes/google-cardboard.png b/docs/content/images/viewing-modes/google-cardboard.png
new file mode 100644 (file)
index 0000000..b931339
Binary files /dev/null and b/docs/content/images/viewing-modes/google-cardboard.png differ
diff --git a/docs/content/images/viewing-modes/stereo-projection.png b/docs/content/images/viewing-modes/stereo-projection.png
new file mode 100755 (executable)
index 0000000..b012524
Binary files /dev/null and b/docs/content/images/viewing-modes/stereo-projection.png differ
index 564590c..53851e3 100644 (file)
@@ -57,6 +57,9 @@
  * - \link boost-library Boost Library \endlink
  * - \link boost-function Boost function usage \endlink
  *
+ * \section Rendering
+ * - \link viewing-modes Viewing modes \endlink
+ *
  * \section Profiling
  * - \link resource-tracking Resource Tracking \endlink
  * - \link performance-profiling Performance Profiling \endlink
diff --git a/docs/content/programming-guide/viewing-modes.h b/docs/content/programming-guide/viewing-modes.h
new file mode 100644 (file)
index 0000000..f2cad16
--- /dev/null
@@ -0,0 +1,44 @@
+/*! \page viewing-modes Viewing modes
+ *
+ *
+ * <h2 class="pg">Introduction</h2>
+ *
+ * DALi supports multiple viewing modes: <br>
+* <ul>
+*  <li>MONO <br>
+*  <li>STEREO_HORIZONTAL <br>
+*  <li>STEREO_VERTICAL <br>
+* </ul>
+* MONO is the default viewing mode. When using MONO mode, only one image of the scene is produced in every update. In this  setup, DALi will create a default render task, which will render everything added to the stage root layer, and one default camera for that render task.<br><br>
+* STEREO_HORIZONTAL and STEREO_VERTICAL allow the application to produce stereo images. Stereo rendering techniques produce two images of the scene with an slight offset between them which will be presented to the left and the right eye independently. In this setup, DALi will create two additional render tasks, one for the right eye and one for the left, each with it's own camera. Those cameras will be parented to the default camera. The method to generate the projection transformation for each camera is known as "parallel axis asymmetric frustum perspective projection" and is illustrated in the image below.<br><br>
+
+* \image html viewing-modes/stereo-projection.png
+
+* <br>The separation between the two cameras is configurable, but, typically, it should range between 50 and 70 millimeters. Too large a separation can be hard to resolve and is known as hyperstereo. The convergence plane for both frustums is the 2D plane, so, the projection of anything lying in the 2D plane will be coincident for both left and right eyes, hence zero parallax. Objects that lie in front of the projection plane will appear to be in front of the screen and object behind the projection plane will appear to be "into" the screen. Object behind the projection plane ( positive parallax ) are easier to look and minimises eye strain.<br>
+
+ * In order to view stereoscopic images correctly, each image must be presented to each eye independently. There exist devices in the market for this, like head-mounted displays, which is a display device, worn in the head, that have two small displays, one for each eye. A cheaper alternative to this often expensive devices is Google's cardboard viewer.<br>
+ * \image html viewing-modes/google-cardboard.png
+ *<br>With Google cardboard, or some similar device, you can transform your phone into a basic virtual reality headset.
+ *
+ * <h2 class="pg">Stereoscopic rendering in DALi</h2>
+ * STEREO_HORIZONTAL mode will present the left image on the top half of the screen and the right image on the bottom half. It is intended  to be used in landspace orientation, so the images are rotated 90 degrees counterclockwise. STEREO_VERTICAL mode, on the other hand, will render the left image on the left half of the screen and the right image on the right side.<br><br>
+*
+*To define the viewing mode to be used, applications can use the function Dali::Application::SetViewMode defined in the Application class, passing as the parameter which mode to use. It is possible for an application to query which view mode is being used by calling the funcion Dali::Application::GetViewMode. To define the separation between the left and right cameras, the application can use the function Dali::Application::SetStereoBase, passing as a parameter the distance in millimeters. This distance can be queried using Dali::Application::GetStereoBase.<br>
+*It is also possible to set the viewing mode and offset at initialization time using two command-line arguments for this purpose: --view-mode ( or -v ) and 0 for MONO, 1 for STEREO_HORIZONTAL, 2 for STEREO_VERTICAL, and --stereo-base ( or --s ) and the separation in millimeters.<br><br>
+
+* <h2 class="pg">Considerations</h2>
+*There are a some restrictions to be aware of when writing stereoscopic applications using DALi.
+
+<ul>
+*  <li>When stereo mode is selected, the default's render task source actor will be set to an uninitialized actor so it doesn't render anything. Changing the default's render task source actor later on will produce undesired results, as you, typically, do not want to see anything rendered by the default camera when stereo mode is on.<br>
+
+*  <li>Stereo cameras are parented to the default camera, so if the application need to change camera position or orientation it will need to change the default camera transformation. The handle to the default camera can be obtained form the default render task as shown below.<br>
+ * @code
+ * Dali::RenderTask defaultRenderTask = Dali::Stage::GetCurrent().GetRenderTaskList().GetTask(0);
+ * Dali::CameraActor defaultCamera = defaultRenderTask.GetCameraActor();
+ * @endcode
+
+*  <li>Stereo render tasks will render everything added to the stage's root layer. If the application need to render any object hierarchy to an off-screen buffer, it will have to set the exclusive flag on that render task so stereo tasks doesn't render that particular subtree. To set the exclusive flag in a render task, the application can call the method Dali::RenderTask::SetExclusive defined in the render task.<br>
+*</ul>
+ *
+ */
index 92dca9f..cad5080 100644 (file)
@@ -203,10 +203,16 @@ void BubbleEmitter::SetBubbleDensity( unsigned int density )
 // clear the resources created for the off screen rendering
 void BubbleEmitter::OnRenderFinished(RenderTask& source)
 {
-  Actor sourceActor =  source.GetSourceActor();
-  sourceActor.RemoveShaderEffect();
+  Actor sourceActor = source.GetSourceActor();
+  if( sourceActor )
+  {
+    RenderableActor renderable = RenderableActor::DownCast( sourceActor );
+    if( renderable )
+    {
+      renderable.RemoveShaderEffect();
+    }
+  }
   Stage::GetCurrent().Remove(sourceActor);
-  sourceActor.Reset();
   Stage::GetCurrent().GetRenderTaskList().RemoveTask(source);
 }
 
index a7becfc..2601644 100644 (file)
@@ -176,7 +176,7 @@ void ImageView::SetImageDistanceField(const std::string& filename)
   mImageActor.SetImage( image );
 
   DistanceFieldEffect effect = DistanceFieldEffect::New();
-  Self().SetShaderEffect( effect );
+  mImageActor.SetShaderEffect( effect );
 }
 
 void ImageView::SetImage(Image image)
index ed81ebf..d4beab2 100644 (file)
@@ -123,7 +123,7 @@ void PageTurnLandscapeView::SetPanActor( const Vector2& panPosition )
   }
 }
 
-void PageTurnLandscapeView::SetSpineEffect(Actor actor, bool isLeftSide)
+void PageTurnLandscapeView::SetSpineEffect(ImageActor actor, bool isLeftSide)
 {
   if(isLeftSide)
   {
index f908141..0e9c635 100644 (file)
@@ -83,7 +83,7 @@ protected: // From PageTurnView
   /**
    * @copydoc PageTurnView::SetSpineEffect
    */
-  virtual void SetSpineEffect(Actor actor, bool isLeftSide);
+  virtual void SetSpineEffect(ImageActor actor, bool isLeftSide);
 
 private:
 
index 95a6708..5f169bb 100644 (file)
@@ -93,7 +93,7 @@ void PageTurnPortraitView::SetPanActor( const Vector2& panPosition )
   }
 }
 
-void PageTurnPortraitView::SetSpineEffect(Actor actor, bool isLeftSide)
+void PageTurnPortraitView::SetSpineEffect(ImageActor actor, bool isLeftSide)
 {
   if(isLeftSide)
   {
@@ -111,7 +111,7 @@ void PageTurnPortraitView::OnPossibleOutwardsFlick( const Vector2& panPosition,
   // There is previous page and an outwards flick is detected
   if( mCurrentPageIndex > 0 && gestureSpeed > GESTURE_SPEED_THRESHOLD && offset.x > fabs( offset.y ))
   {
-    Actor actor = mPageActors[ (mCurrentPageIndex-1) % NUMBER_OF_CACHED_PAGES ];
+    ImageActor actor = mPageActors[ (mCurrentPageIndex-1) % NUMBER_OF_CACHED_PAGES ];
     if(actor.GetParent() != mRootOnScreen)
     {
       return;
index 16abf9b..cc2e5ec 100644 (file)
@@ -82,7 +82,7 @@ protected: // From PageTurnView
   /**
    * @copydoc PageTurnView::SetSpineEffect
    */
-  virtual void SetSpineEffect(Actor actor, bool isLeftSide);
+  virtual void SetSpineEffect(ImageActor actor, bool isLeftSide);
 
   /**
    * @copydoc PageTurnView::OnPossibleOutwardsFlick
index 83006d4..edac01e 100644 (file)
@@ -917,7 +917,7 @@ void PageTurnView::PanFinished( const Vector2& gesturePosition, float gestureSpe
 
   mPagePanFinishedSignal.Emit( handle );
 
-  Actor actor = mPanActor;
+  ImageActor actor = mPanActor;
   if(mPress)
   {
     if(!mConstraints) // if with constraints, the pan finished position is near spine, set up an animation to turn the page over
@@ -977,7 +977,7 @@ void PageTurnView::PanFinished( const Vector2& gesturePosition, float gestureSpe
 
 void PageTurnView::TurnedOver( Animation& animation )
 {
-  Actor actor = mAnimationActorPair[animation];
+  ImageActor actor = mAnimationActorPair[animation];
   mIsTurnBack[actor] = !mIsTurnBack[actor];
   actor.RemoveConstraints();
   mRootOnScreen.Add(actor);
@@ -996,7 +996,7 @@ void PageTurnView::TurnedOver( Animation& animation )
 
 void PageTurnView::SliddenBack( Animation& animation )
 {
-  Actor actor = mAnimationActorPair[animation];
+  ImageActor actor = mAnimationActorPair[animation];
   mRootOnScreen.Add(actor);
   int index = mAnimationIndexPair[animation];
   mIsSliding[index] = false;
@@ -1026,14 +1026,9 @@ void PageTurnView::OrganizePageDepth()
   }
 }
 
-void PageTurnView::SetShaderEffect( Actor actor, ShaderEffect shaderEffect )
+void PageTurnView::SetShaderEffect( ImageActor actor, ShaderEffect shaderEffect )
 {
-  actor.SetShaderEffect( shaderEffect );
-
-  if( actor.GetChildCount() > 0 )
-  {
-    actor.GetChildAt( 0 ).SetShaderEffect(shaderEffect);
-  }
+  SetShaderEffectRecursively( actor, shaderEffect );
 }
 
 Toolkit::PageTurnView::PageTurnSignal& PageTurnView::PageTurnStartedSignal()
index f549dca..2e3f856 100644 (file)
@@ -134,7 +134,7 @@ protected:
    * @param[in] actor The actor which the shader effect would be applied onto
    * @param[in] shaderEffect The shader effect to be set to the actor
    */
-  void SetShaderEffect( Actor actor, ShaderEffect shaderEffect );
+  void SetShaderEffect( ImageActor actor, ShaderEffect shaderEffect );
 
 private:
 
@@ -253,7 +253,7 @@ private: // implemented differently by PageTurnLandscapeView and PageTurnPortrai
    * @param[in] actor The current page actor
    * @param[in] isLeftSide Which side the current page is located
    */
-  virtual void SetSpineEffect(Actor actor, bool isLeftSide) = 0;
+  virtual void SetSpineEffect(ImageActor actor, bool isLeftSide) = 0;
 
   /**
    * This method is called when pan finished to detect outwards flick
@@ -327,8 +327,8 @@ protected:
 
   std::vector<ImageActor>        mPageActors;              ///< The vector of pages on stage
   int                            mCurrentPageIndex;        ///< The index of the current page, between 0 ~ mTotalPageCount-1
-  std::map<Actor,bool>           mIsTurnBack;              ///< The map to keep track the page actor's turning direction
-  std::map<Animation, Actor>     mAnimationActorPair;      ///< The map to keep track which page actor is the animation act on
+  std::map<ImageActor,bool>      mIsTurnBack;              ///< The map to keep track the page actor's turning direction
+  std::map<Animation,ImageActor> mAnimationActorPair;      ///< The map to keep track which page actor is the animation act on
   std::map<Animation, int>       mAnimationIndexPair;      ///< The map to keep track which PageTurnEffect, PanDisplacementProperty, CurrentCenterProperty is used for the animation
   int                            mIndex;                   ///< The index to keep track which PageTurnEffect, PanDisplacementProperty, CurrentCenterProperty is used for the current panning page
   std::vector<bool>              mIsAnimating;             ///< The boolean vector to keep track which PageTurnEffect, PanDisplacementProperty, CurrentCenterProperty is available for using
index b6f38c0..297aeb4 100644 (file)
@@ -31,7 +31,7 @@ namespace Toolkit
 
 const unsigned int TOOLKIT_MAJOR_VERSION = 1;
 const unsigned int TOOLKIT_MINOR_VERSION = 0;
-const unsigned int TOOLKIT_MICRO_VERSION = 4;
+const unsigned int TOOLKIT_MICRO_VERSION = 5;
 const char * const TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index 830accc..b6268bd 100644 (file)
@@ -74,15 +74,15 @@ MotionBlurEffect::~MotionBlurEffect()
 {
 }
 
-MotionBlurEffect MotionBlurEffect::Apply( Actor handle )
+MotionBlurEffect MotionBlurEffect::Apply( RenderableActor renderable )
 {
   MotionBlurEffect newEffect = New( MOTION_BLUR_NUM_SAMPLES );
-  handle.SetShaderEffect( newEffect );
+  renderable.SetShaderEffect( newEffect );
 
   Property::Index uModelProperty = newEffect.GetPropertyIndex( MOTION_BLUR_MODEL_LASTFRAME );
 
   Constraint constraint = Constraint::New<Matrix>( uModelProperty,
-                                                   Source( handle, Actor::WORLD_MATRIX ),
+                                                   Source( renderable, Actor::WORLD_MATRIX ),
                                                    EqualToConstraint() );
 
   // and set up constraint.
@@ -95,7 +95,7 @@ MotionBlurEffect MotionBlurEffect::New()
   return New( MOTION_BLUR_NUM_SAMPLES );
 }
 
-MotionBlurEffect MotionBlurEffect::New( const unsigned int numBlurSamples )
+MotionBlurEffect MotionBlurEffect::New( unsigned int numBlurSamples )
 {
   // Dali vertexSource prefix for reference:
   // precision highp float;
index 053531b..d9a5b09 100644 (file)
@@ -75,18 +75,20 @@ public:
    * Create a  MotionBlurEffect and attach it to the specified actor
    * The number of texture samples taken along the motion velocity vector of the
    * actor, producing the blur, is set to a default of 8.
+   * @param renderable actor to apply the effect to
    * @return A handle to a newly allocated Dali resource.
    */
-  static MotionBlurEffect Apply( Actor handle );
+  static MotionBlurEffect Apply( RenderableActor renderable );
 
   /**
    * Create an initialized MotionBlurEffect
    * @param numBlurSamples The number of texture samples taken along the motion
    * velocity vector of the actor, producing the blur. A higher number gives a
    * smoother blur but costs more in terms of performance.
+   * @param numBlurSamples to have
    * @return A handle to a newly allocated Dali resource.
    */
-  static MotionBlurEffect New( const unsigned int numBlurSamples );
+  static MotionBlurEffect New( unsigned int numBlurSamples );
 
   /**
    * Set texcoord scale property. This scales the offset for texture samples
index 3834f40..ffc068b 100644 (file)
@@ -88,15 +88,15 @@ MotionStretchEffect::~MotionStretchEffect()
 {
 }
 
-MotionStretchEffect MotionStretchEffect::Apply( Actor handle )
+MotionStretchEffect MotionStretchEffect::Apply( RenderableActor renderable )
 {
   MotionStretchEffect newEffect = New();
-  handle.SetShaderEffect( newEffect );
+  renderable.SetShaderEffect( newEffect );
 
   Property::Index uModelProperty = newEffect.GetPropertyIndex( MOTION_STRETCH_MODELVIEW_LASTFRAME );
 
   Constraint constraint = Constraint::New<Matrix>( uModelProperty,
-                                                   Source( handle, Actor::WORLD_MATRIX ),
+                                                   Source( renderable, Actor::WORLD_MATRIX ),
                                                    EqualToConstraint() );
 
   // and set up constraint.
index e097748..ceef5ad 100644 (file)
@@ -70,9 +70,10 @@ public:
 
   /**
    * Create a  MotionStretchEffect and attach it to the specified actor
+   * @param renderable actor to apply the effect to
    * @return A handle to a newly allocated Dali resource.
    */
-  static MotionStretchEffect Apply( Actor handle );
+  static MotionStretchEffect Apply( RenderableActor renderable );
 
   /**
    * Set geometry stretch factor property. This scales the amount the geometry
index aec438c..f730f3d 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali-toolkit
 Summary:    The OpenGLES Canvas Core Library Toolkit
-Version:    1.0.4
+Version:    1.0.5
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0