}
/// <summary>
+ /// An event emitted when Camera Transition is finished.
+ /// </summary>
+ // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler CameraTransitionFinished;
+
+ /// <summary>
/// Set/Get the ImageBasedLight ScaleFactor.
/// Scale factor controls light source intensity in [0.0f, 1.0f]
/// </summary>
}
/// <summary>
+ /// Set/Get the Framebuffer's MultiSamplingLevel.
+ /// Only has effects if UseFramebuffer is true, and Framebuffer MultiSampling is supported.
+ /// Default is 0.
+ /// </summary>
+ /// <remarks>
+ /// Getter didn't consider Framebuffer MultiSampling is supported or not.
+ /// </remarks>
+ // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public uint FramebufferMultiSamplingLevel
+ {
+ set
+ {
+ SetFramebufferMultiSamplingLevel(value);
+ }
+ get
+ {
+ return GetFramebufferMultiSamplingLevel();
+ }
+ }
+
+ /// <summary>
/// Set/Get SkyboxUrl.
/// If SkyboxUrl is set, the cube map image is loaded and skybox is attached on scene.
/// Skybox texture is asynchronously loaded. When loading is finished, ResourcesLoaded is emitted.
/// Camera Position, Orientation and FieldOfView are smoothly animated.
/// </summary>
/// <remarks>
- /// The selected camera is switched when the transition is started.
- /// During camera transition, Selected Camera cannot be changed by using SelectCamera() or CameraTransition() method.
+ /// The selected camera is switched to the Camera of the index when the transition is started.
+ /// During camera transition, Selected Camera should not be changed by using SelectCamera() or CameraTransition() method.
+ /// During camera transition, Camera properties of Selected Camera should not be changed.
/// </remarks>
/// <param name="index"> Index of destination Camera of Camera transition.</param>
/// <param name="durationMilliSeconds">The duration in milliseconds.</param>
/// <since_tizen> 10 </since_tizen>
public void CameraTransition(uint index, int durationMilliSeconds, AlphaFunction alphaFunction = null)
{
- if(inCameraTransition)
+ if(inCameraTransition || GetSelectedCamera() == GetCamera(index))
{
return;
}
SelectCamera(index);
Camera destination = GetSelectedCamera();
CameraTransition(source, destination, durationMilliSeconds, alphaFunction);
- source.Dispose();
- destination.Dispose();
}
/// <summary>
/// Camera Position, Orientation and FieldOfView are smoothly animated.
/// </summary>
/// <remarks>
- /// The selected camera is switched when the transition is started.
- /// During camera transition, Selected Camera cannot be changed by using SelectCamera() or CameraTransition() method.
+ /// The selected camera is switched to the Camera of the input name when the transition is started.
+ /// During camera transition, Selected Camera should not be changed by using SelectCamera() or CameraTransition() method.
+ /// During camera transition, Camera properties of Selected Camera should not be changed.
/// </remarks>
/// <param name="name"> string keyword of destination Camera of Camera transition.</param>
/// <param name="durationMilliSeconds">The duration in milliseconds.</param>
/// <since_tizen> 10 </since_tizen>
public void CameraTransition(string name, int durationMilliSeconds, AlphaFunction alphaFunction = null)
{
- if(inCameraTransition)
+ if(inCameraTransition || GetSelectedCamera() == GetCamera(name))
{
return;
}
SelectCamera(name);
Camera destination = GetSelectedCamera();
CameraTransition(source, destination, durationMilliSeconds, alphaFunction);
- source.Dispose();
- destination.Dispose();
}
/// <summary>
return result;
}
+ internal void SetFramebufferMultiSamplingLevel(uint multiSamplingLevel)
+ {
+ Interop.SceneView.SetFramebufferMultiSamplingLevel(SwigCPtr, multiSamplingLevel);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ internal uint GetFramebufferMultiSamplingLevel()
+ {
+ uint result = Interop.SceneView.GetFramebufferMultiSamplingLevel(SwigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return result;
+ }
+
/// <summary>
/// Set the ImageBasedLight ScaleFactor.
/// </summary>
private Rotation GetSkyboxOrientation()
{
global::System.IntPtr cPtr = Interop.SceneView.GetSkyboxOrientation(SwigCPtr);
- Rotation ret = (cPtr == global::System.IntPtr.Zero) ? null : new Rotation(cPtr, false);
+ Rotation ret = (cPtr == global::System.IntPtr.Zero) ? null : new Rotation(cPtr, true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
Position sourcePosition = sourceCamera.Position;
Rotation sourceOrientation = sourceCamera.Orientation;
- Radian sourceFieldOfView = sourceCamera.FieldOfView;
Position destinationPosition = destinationCamera.Position;
Rotation destinationOrientation = destinationCamera.Orientation;
- Radian destinationFieldOfView = destinationCamera.FieldOfView;
-
- // If ProjectionDirection is not equal, match the value.
- if (sourceCamera.ProjectionDirection != destinationCamera.ProjectionDirection)
- {
- float aspect = destinationCamera.AspectRatio;
- if (destinationCamera.ProjectionDirection == Camera.ProjectionDirectionType.Vertical)
- {
- sourceFieldOfView = Camera.ConvertFovFromHorizontalToVertical(aspect, sourceFieldOfView);
- }
- else
- {
- sourceFieldOfView = Camera.ConvertFovFromVerticalToHorizontal(aspect, sourceFieldOfView);
- }
- }
cameraTransition = new Animation(durationMilliSeconds);
orientationKeyFrames.Add(0.0f, sourceOrientation);
orientationKeyFrames.Add(1.0f, destinationOrientation);
- KeyFrames fieldOfViewKeyFrames = new KeyFrames();
- fieldOfViewKeyFrames.Add(0.0f, sourceFieldOfView.ConvertToFloat());
- fieldOfViewKeyFrames.Add(1.0f, destinationFieldOfView.ConvertToFloat());
-
cameraTransition.AnimateBetween(destinationCamera, "Position", positionKeyFrames, Animation.Interpolation.Linear, alphaFunction);
cameraTransition.AnimateBetween(destinationCamera, "Orientation", orientationKeyFrames, Animation.Interpolation.Linear, alphaFunction);
- cameraTransition.AnimateBetween(destinationCamera, "FieldOfView", fieldOfViewKeyFrames, Animation.Interpolation.Linear, alphaFunction);
+
+ if(destinationCamera.ProjectionMode == Camera.ProjectionModeType.Perspective)
+ {
+ Radian sourceFieldOfView = sourceCamera.FieldOfView;
+ Radian destinationFieldOfView = destinationCamera.FieldOfView;
+
+ // If ProjectionDirection is not equal, match the value.
+ if (sourceCamera.ProjectionDirection != destinationCamera.ProjectionDirection)
+ {
+ float aspect = destinationCamera.AspectRatio;
+ if (destinationCamera.ProjectionDirection == Camera.ProjectionDirectionType.Vertical)
+ {
+ sourceFieldOfView = Camera.ConvertFovFromHorizontalToVertical(aspect, sourceFieldOfView);
+ }
+ else
+ {
+ sourceFieldOfView = Camera.ConvertFovFromVerticalToHorizontal(aspect, sourceFieldOfView);
+ }
+ }
+
+ KeyFrames fieldOfViewKeyFrames = new KeyFrames();
+ fieldOfViewKeyFrames.Add(0.0f, sourceFieldOfView.ConvertToFloat());
+ fieldOfViewKeyFrames.Add(1.0f, destinationFieldOfView.ConvertToFloat());
+ cameraTransition.AnimateBetween(destinationCamera, "FieldOfView", fieldOfViewKeyFrames, Animation.Interpolation.Linear, alphaFunction);
+
+ sourceFieldOfView.Dispose();
+ destinationFieldOfView.Dispose();
+ fieldOfViewKeyFrames.Dispose();
+ }
+ else
+ {
+ float sourceOrthographicSize = sourceCamera.OrthographicSize;
+ float destinationOrthographicSize = destinationCamera.OrthographicSize;
+
+ // If ProjectionDirection is not equal, match the value.
+ if (sourceCamera.ProjectionDirection != destinationCamera.ProjectionDirection)
+ {
+ float aspect = destinationCamera.AspectRatio;
+ if (destinationCamera.ProjectionDirection == Camera.ProjectionDirectionType.Vertical)
+ {
+ sourceOrthographicSize = sourceOrthographicSize / aspect;
+ }
+ else
+ {
+ sourceOrthographicSize = sourceOrthographicSize * aspect;
+ }
+ }
+
+ KeyFrames orthographicSizeKeyFrames = new KeyFrames();
+ orthographicSizeKeyFrames.Add(0.0f, sourceOrthographicSize);
+ orthographicSizeKeyFrames.Add(1.0f, destinationOrthographicSize);
+ cameraTransition.AnimateBetween(destinationCamera, "OrthographicSize", orthographicSizeKeyFrames, Animation.Interpolation.Linear, alphaFunction);
+
+ orthographicSizeKeyFrames.Dispose();
+ }
+
+ float destinationNearPlaneDistance = destinationCamera.NearPlaneDistance;
+ float destinationFarPlaneDistance = destinationCamera.FarPlaneDistance;
+ destinationCamera.NearPlaneDistance = Math.Min(sourceCamera.NearPlaneDistance, destinationCamera.NearPlaneDistance);
+ destinationCamera.FarPlaneDistance = Math.Max(sourceCamera.FarPlaneDistance, destinationCamera.FarPlaneDistance);
cameraTransition.Finished += (s, e) =>
{
+ this.GetSelectedCamera().NearPlaneDistance = destinationNearPlaneDistance;
+ this.GetSelectedCamera().FarPlaneDistance = destinationFarPlaneDistance;
inCameraTransition = false;
+ CameraTransitionFinished?.Invoke(this, EventArgs.Empty);
};
cameraTransition.Play();
- sourceFieldOfView.Dispose();
positionKeyFrames.Dispose();
orientationKeyFrames.Dispose();
- orientationKeyFrames.Dispose();
}
/// <summary>