- const float cameraPosConstraintScale( 0.5f / tanf(ARBITRARY_FIELD_OF_VIEW * 0.5f) );
-
- // Create and place a camera for the children render, corresponding to its render target size
- mCameraForChildren.SetFieldOfView(ARBITRARY_FIELD_OF_VIEW);
- // TODO: how do we pick a reasonable value for near clip? Needs to relate to normal camera the user renders with, but we don't have a handle on it
- mCameraForChildren.SetNearClippingPlane(1.0f);
- mCameraForChildren.SetAspectRatio(mTargetSize.width / mTargetSize.height);
- mCameraForChildren.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor
- mCameraForChildren.SetPosition(0.0f, 0.0f, mTargetSize.height * cameraPosConstraintScale);
- mCameraForChildren.SetRotation(Quaternion(M_PI, Vector3::YAXIS));
-
- // Children render camera must move when EffectsView object is resized.
- // This is since we cannot change render target size - so we need to remap the child actors' rendering
- // accordingly so they still exactly fill the render target.
- // Note that this means the effective resolution of the child render changes as the EffectsView object
- // changes size, this is the trade off for not being able to modify render target size
- // Change camera z position based on EffectsView actor height
- mCameraForChildren.RemoveConstraints();
- mCameraForChildren.ApplyConstraint( Constraint::New<float>( Actor::POSITION_Z, ParentSource( Actor::SIZE_HEIGHT ), RelativeToConstraintFloat(cameraPosConstraintScale) ) );
+ if( !mCameraForChildren )
+ {
+ // Create a camera for the children render, corresponding to its render target size
+ mCameraForChildren = CameraActor::New(mTargetSize);
+ mCameraForChildren.SetParentOrigin(ParentOrigin::CENTER);
+ mCameraForChildren.SetInvertYAxis( true );
+ Self().Add( mCameraForChildren );
+ }
+ else
+ {
+ // place the camera for the children render, corresponding to its render target size
+ const float cameraPosScale( 0.5f / tanf(ARBITRARY_FIELD_OF_VIEW * 0.5f) );
+ mCameraForChildren.SetFieldOfView(ARBITRARY_FIELD_OF_VIEW);
+ mCameraForChildren.SetNearClippingPlane(1.0f);
+ mCameraForChildren.SetAspectRatio(mTargetSize.width / mTargetSize.height);
+ mCameraForChildren.SetType(Dali::Camera::FREE_LOOK); // camera orientation based solely on actor
+ mCameraForChildren.SetPosition(0.0f, 0.0f, mTargetSize.height * cameraPosScale);
+ mCameraForChildren.SetZ( mTargetSize.height * cameraPosScale );
+ }