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 5f88652ab4d9023d8f31a46ef789de513f788307..f485ea44923f051d4511ddaa7597683a46f87766 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);
-  mCameraActor.SetInvertYAxis(false);
   Stage::GetCurrent().Add(mCameraActor);
 }
 
index bd44d959ed4ef580fa6100b874190a2125bd1355..bb5790297c8f038531c185fa9b813c1c652f4e42 100644 (file)
@@ -59,9 +59,9 @@ struct CameraActorPositionConstraint
   {
     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;
index 078be1cacf5310dfe8e9879dcf2b1fb8a9e95911..17f859a4665977efd9b6f13ebe3f6a70e64550ee 100644 (file)
@@ -350,7 +350,6 @@ void PageTurnView::SetupRenderTasks()
   mCameraActor.SetParentOrigin(ParentOrigin::CENTER);
   mCameraActor.SetPositionInheritanceMode( DONT_INHERIT_POSITION );
   mCameraActor.SetInheritScale( false );
-  mCameraActor.SetInvertYAxis(false);
   Self().Add(mCameraActor);
 
   RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
index fbc2e1c7b5e0cf91edc4efe5c83b9f6de3fc228e..23d709cb7a72a222aa2cc88d68aa6c7ea0ff0cd1 100644 (file)
@@ -237,12 +237,13 @@ void ShadowView::OnInitialize()
 
   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.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,
index aa30efdf6a1b6fdf06251805c73176ccc0d6d30b..4488b2f2b19790a81b710ca2c8a92ae2ef39108c 100644 (file)
@@ -702,6 +702,7 @@ void TextView::SetSnapshotModeEnabled( bool enable )
       Actor self = Self();
       self.Add( mOffscreenRootActor );
       self.Add( mOffscreenImageActor );
+      mOffscreenImageActor.SetScale(Vector3(1.f, -1.f, 1.f));
     }
     else
     {
@@ -1467,13 +1468,11 @@ void TextView::ProcessSnapshot( const Size& textViewSize )
           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
-
-          // 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.
index c6119f61b34455060e8e873f0034fbeb2c5821d1..6707ae57e460eb955ba84a4ee61652735cc53a56 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"
-              "    world.z += cs * uRadius;\n"
+              "    world.z -= cs * uRadius;\n"
               "    gl_Position = uProjection * world;\n"
               "    \n"
               "    vTexCoord = aTexCoord;\n"