Fix issues related with cameras. 66/17766/2
authorFrancisco Santos <f1.santos@samsung.com>
Mon, 10 Mar 2014 10:55:14 +0000 (10:55 +0000)
committerFrancisco Santos <f1.santos@samsung.com>
Mon, 10 Mar 2014 13:07:49 +0000 (13:07 +0000)
Fixed shader effects that were doing calculations in view space.
Fixed controls that were using FREE_LOOK camera without orienting it.

Change-Id: Ib7330adf9a1344b03583c2cb6a9ef958df5d28b4
Signed-off-by: Francisco Santos <f1.santos@samsung.com>
dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.cpp
dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp
dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp
dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp
dali-toolkit/internal/controls/text-view/text-view-impl.cpp
dali-toolkit/public-api/shader-effects/carousel-effect.cpp

index 5f88652..f485ea4 100644 (file)
@@ -127,7 +127,6 @@ void BubbleEmitter::OnInitialize()
   // Create a cameraActor for the off screen render task.
   mCameraActor = CameraActor::New(mMovementArea);
   mCameraActor.SetParentOrigin(ParentOrigin::CENTER);
   // Create a cameraActor for the off screen render task.
   mCameraActor = CameraActor::New(mMovementArea);
   mCameraActor.SetParentOrigin(ParentOrigin::CENTER);
-  mCameraActor.SetInvertYAxis(false);
   Stage::GetCurrent().Add(mCameraActor);
 }
 
   Stage::GetCurrent().Add(mCameraActor);
 }
 
index bd44d95..bb57902 100644 (file)
@@ -59,9 +59,9 @@ struct CameraActorPositionConstraint
   {
     const Vector3& sourcePosition = sourcePositionProperty.GetVector3();
 
   {
     const Vector3& sourcePosition = sourcePositionProperty.GetVector3();
 
-    return Vector3(sourcePosition.x + mStageSize.x * 0.5f,
-                     -sourcePosition.y + mStageSize.y * 0.5f,
-                     sourcePosition.z + mDefaultCameraDistance);
+    return Vector3( sourcePosition.x + mStageSize.x * 0.5f,
+                    sourcePosition.y + mStageSize.y * 0.5f,
+                    sourcePosition.z + mDefaultCameraDistance);
   }
 
   Vector2 mStageSize;
   }
 
   Vector2 mStageSize;
index 078be1c..17f859a 100644 (file)
@@ -350,7 +350,6 @@ void PageTurnView::SetupRenderTasks()
   mCameraActor.SetParentOrigin(ParentOrigin::CENTER);
   mCameraActor.SetPositionInheritanceMode( DONT_INHERIT_POSITION );
   mCameraActor.SetInheritScale( false );
   mCameraActor.SetParentOrigin(ParentOrigin::CENTER);
   mCameraActor.SetPositionInheritanceMode( DONT_INHERIT_POSITION );
   mCameraActor.SetInheritScale( false );
-  mCameraActor.SetInvertYAxis(false);
   Self().Add(mCameraActor);
 
   RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
   Self().Add(mCameraActor);
 
   RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
index fbc2e1c..23d709c 100644 (file)
@@ -237,12 +237,13 @@ void ShadowView::OnInitialize()
 
   Vector2 stageSize = Stage::GetCurrent().GetSize();
   mCameraActor = CameraActor::New(stageSize);
 
   Vector2 stageSize = Stage::GetCurrent().GetSize();
   mCameraActor = CameraActor::New(stageSize);
+
   mCameraActor.SetParentOrigin( ParentOrigin::CENTER );
 
   // Target is constrained to point at the shadow plane origin
   mCameraActor.SetNearClippingPlane( 1.0f );
   mCameraActor.SetType( Dali::Camera::FREE_LOOK ); // Camera orientation constrained to point at shadow plane world position
   mCameraActor.SetParentOrigin( ParentOrigin::CENTER );
 
   // Target is constrained to point at the shadow plane origin
   mCameraActor.SetNearClippingPlane( 1.0f );
   mCameraActor.SetType( Dali::Camera::FREE_LOOK ); // Camera orientation constrained to point at shadow plane world position
-  mCameraActor.SetInvertYAxis(false);
+  mCameraActor.SetRotation(Radian(Degree(180)), Vector3::YAXIS);
   mCameraActor.SetPosition(DEFAULT_LIGHT_POSITION);
 
   mShadowRenderShader = ShaderEffect::New( RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE,
   mCameraActor.SetPosition(DEFAULT_LIGHT_POSITION);
 
   mShadowRenderShader = ShaderEffect::New( RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE,
index aa30efd..4488b2f 100644 (file)
@@ -702,6 +702,7 @@ void TextView::SetSnapshotModeEnabled( bool enable )
       Actor self = Self();
       self.Add( mOffscreenRootActor );
       self.Add( mOffscreenImageActor );
       Actor self = Self();
       self.Add( mOffscreenRootActor );
       self.Add( mOffscreenImageActor );
+      mOffscreenImageActor.SetScale(Vector3(1.f, -1.f, 1.f));
     }
     else
     {
     }
     else
     {
@@ -1467,13 +1468,11 @@ void TextView::ProcessSnapshot( const Size& textViewSize )
           mOffscreenCameraActor = CameraActor::New();
           mOffscreenCameraActor.SetParentOrigin( ParentOrigin::CENTER );
           mOffscreenCameraActor.SetAnchorPoint( AnchorPoint::CENTER );
           mOffscreenCameraActor = CameraActor::New();
           mOffscreenCameraActor.SetParentOrigin( ParentOrigin::CENTER );
           mOffscreenCameraActor.SetAnchorPoint( AnchorPoint::CENTER );
+          mOffscreenCameraActor.SetRotation(Degree(180.f), Vector3::YAXIS);
 
           mOffscreenCameraActor.SetType( Dali::Camera::FREE_LOOK ); // Inherits position from the offscreen root actor.
 
           mOffscreenRootActor.Add( mOffscreenCameraActor ); // camera to shoot the offscreen text
 
           mOffscreenCameraActor.SetType( Dali::Camera::FREE_LOOK ); // Inherits position from the offscreen root actor.
 
           mOffscreenRootActor.Add( mOffscreenCameraActor ); // camera to shoot the offscreen text
-
-          // Images are expected to be from top to bottom, but OpenGL buffers are bottom to top
-          mOffscreenCameraActor.SetInvertYAxis( false );
         }
 
         // Calculate camera parameters for current text size.
         }
 
         // Calculate camera parameters for current text size.
index c6119f6..6707ae5 100644 (file)
@@ -60,7 +60,7 @@ CarouselEffect CarouselEffect::New()
               "    vec2 d = (world.xy - uCenter) * uAnglePerUnit;\n"
               "    float a = length(d);\n"
               "    float cs = cos(radians(a));\n"
               "    vec2 d = (world.xy - uCenter) * uAnglePerUnit;\n"
               "    float a = length(d);\n"
               "    float cs = cos(radians(a));\n"
-              "    world.z += cs * uRadius;\n"
+              "    world.z -= cs * uRadius;\n"
               "    gl_Position = uProjection * world;\n"
               "    \n"
               "    vTexCoord = aTexCoord;\n"
               "    gl_Position = uProjection * world;\n"
               "    \n"
               "    vTexCoord = aTexCoord;\n"