Class SceneView

Definition

Namespace:
Tizen.NUI.Scene3D
Assembly:
Tizen.NUI.Scene3D.dll
API Level:
10

SceneView is a Class to show multiple 3D objects in a single 2D screen. Each SceneView has its own 3D space, and 3D objects added to SceneView are positioned in the space. SceneView uses left-handed coordinate system same as NUI. X as right, Y as down, and Z as forward.

SceneView has internal root container to control inner rendering process like depth test. When a View is added to the SceneView with Add(View) method, it is actually added on the root container. Therefore, the added Views exist in the sub tree of SceneView, but are not direct children. The sub tree of Views will be rendered with the SceneView's own Camera.

SceneView has one built-in camera by default. The default Camera is not removed by using RemoveCamera(Camera) method. GetCamera(UInt32) method with index "0" returns the default camera, and the minimum value returned by GetCameraCount() method is 1.

SceneView also provides multiple Camera and one of them can be used to render multiple objects. AddCamera(Camera), RemoveCamera(Camera), GetCamera(UInt32), and SelectCamera(UInt32) are methods to manage Cameras of the SceneView. User can place multiple cameras in a scene to display the entire scene or to display individual objects. User can use the SelectCamera(UInt32) method to select the currently required camera.

When the SceneView's size changes, some camera properties that depend on its size may also change. The changing properties are as follows: AspectRatio, LeftPlaneDistance, RightPlaneDistance, TopPlaneDistance, and BottomPlaneDistance. The Camera's FieldOfView is vertical fov. The horizontal fov is updated internally according to the SceneView size.

The SetImageBasedLightSource(String, String, Single) method sets the same IBL to all Model objects added to the SceneView. For the IBL, two cube map textures(diffuse and specular) are required. SceneView supports 4 types layout for Cube Map: Vertical/Horizontal Cross layouts, and Vertical/Horizontal Array layouts. And also, ktx format with cube map is supported. If a model already has an IBL, it is batch overridden with the IBL of the SceneView. If the SceneView has IBL, the IBL of newly added models is also overridden.

The IBL textures start to be loaded asynchronously when SetImageBasedLightSource(String, String, Single) method is called. ResourcesLoaded signal notifies that the loading of the IBL resources have been completed.

If FBO is used, the rendering result of SceneView is drawn on the FBO and it is mapped on the plane of the SceneView. It could decreases performance slightly, but it is useful to show SceneView according to the rendering order with other Views.

And since SceneView is a View, it can be placed together with other 2D UI components in the NUI window.

C#
Copy
public class SceneView : View, IDynamicResourceHandler, IElement, INameScope, IElementController, System.IDisposable, IResourcesProvider
Inheritance
Implements

Constructors

View Source

SceneView()

Create an initialized SceneView.

Declaration
C#
Copy
public SceneView()
API Level: 10
View Source

SceneView(SceneView)

Copy constructor.

Declaration
C#
Copy
public SceneView(SceneView sceneView)
Parameters
Type Name Description
SceneView sceneView

The source object.

API Level: 10

Properties

View Source

FramebufferMultiSamplingLevel

Set/Get the Framebuffer's MultiSamplingLevel. Only has effects if UseFramebuffer is true, and Framebuffer MultiSampling is supported. Default is 0.

Declaration
C#
Copy
public uint FramebufferMultiSamplingLevel { get; set; }
Property Value
Type Description
UInt32
Remarks

Getter didn't consider Framebuffer MultiSampling is supported or not.

View Source

ImageBasedLightScaleFactor

Set/Get the ImageBasedLight ScaleFactor. Scale factor controls light source intensity in [0.0f, 1.0f]

Declaration
C#
Copy
public float ImageBasedLightScaleFactor { get; set; }
Property Value
Type Description
Single
API Level: 10
View Source

SkyboxIntensity

Set/Get Skybox intensity. The skybox intensity is multiplied to the color of skybox texture. Default value is 1.0f.

Declaration
C#
Copy
public float SkyboxIntensity { get; set; }
Property Value
Type Description
Single
View Source

SkyboxOrientation

Set/Get angle of orientation of the skybox. If orientation is set, the skybox will be rotate by the Radian orientation along YAxis. Default value is 0.0f.

Declaration
C#
Copy
public Rotation SkyboxOrientation { get; set; }
Property Value
Type Description
Rotation
View Source

SkyboxUrl

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.

Declaration
C#
Copy
public string SkyboxUrl { get; set; }
Property Value
Type Description
String
View Source

UseFramebuffer

Set/Get the UseFramebuffer. If this property is true, rendering result of SceneView is drawn on FBO and it is mapping on this SceneView plane. If this property is false, each item in SceneView is rendered on window directly. Default is false.

Declaration
C#
Copy
public bool UseFramebuffer { get; set; }
Property Value
Type Description
Boolean
Remarks

If UseFramebuffer is true, it could decrease performance but entire rendering order is satisfied. If UseFramebuffer is false, the performance becomes better but SceneView is rendered on the top of the other 2D components regardless tree order.

Methods

View Source

AddCamera(Camera)

Adds a Camera to the SceneView at the end of the camera list of SceneView. The Camera can be used as a selected camera to render the scene by using SelectCamera(UInt32) or SelectCamera(String)

Declaration
C#
Copy
public void AddCamera(Camera camera)
Parameters
Type Name Description
Camera camera

Camera added on this SceneView.

Remarks

Some properties of the Camera will be change depending on the Size of this SceneView. Those properties are as follows: AspectRatio, LeftPlaneDistance, RightPlaneDistance, TopPlaneDistance, and BottomPlaneDistance.

The FieldOfView of Camera is for vertical fov. When the size of the SceneView is changed, the vertical fov is maintained and the horizontal fov is automatically calculated according to the SceneView's AspectRatio.

API Level: 10
View Source

CameraTransition(String, Int32, AlphaFunction)

Starts camera transition from currently selected camera to a camera of input name. Camera Position, Orientation and FieldOfView are smoothly animated.

Declaration
C#
Copy
public void CameraTransition(string name, int durationMilliSeconds, AlphaFunction alphaFunction = null)
Parameters
Type Name Description
String name

string keyword of destination Camera of Camera transition.

Int32 durationMilliSeconds

The duration in milliseconds.

AlphaFunction alphaFunction

The alpha function to apply.

Remarks

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.

API Level: 10
View Source

CameraTransition(UInt32, Int32, AlphaFunction)

Starts camera transition from currently selected camera to a camera of index. Camera Position, Orientation and FieldOfView are smoothly animated.

Declaration
C#
Copy
public void CameraTransition(uint index, int durationMilliSeconds, AlphaFunction alphaFunction = null)
Parameters
Type Name Description
UInt32 index

Index of destination Camera of Camera transition.

Int32 durationMilliSeconds

The duration in milliseconds.

AlphaFunction alphaFunction

The alpha function to apply.

Remarks

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.

API Level: 10
View Source

GetCamera(String)

Retrieves a Camera of the input name.

Declaration
C#
Copy
public Camera GetCamera(string name)
Parameters
Type Name Description
String name

string keyword of Camera to be retrieved.

Returns
Type Description
Camera

Camera that has the name as a View.Name property

API Level: 10
View Source

GetCamera(UInt32)

Retrieves a Camera of the index.

Declaration
C#
Copy
public Camera GetCamera(uint index)
Parameters
Type Name Description
UInt32 index

Index of Camera to be retrieved.

Returns
Type Description
Camera

Camera of the index.

API Level: 10
View Source

GetCameraCount()

Retrieves the number of cameras.

Declaration
C#
Copy
public uint GetCameraCount()
Returns
Type Description
UInt32

The number of Cameras.

API Level: 10
View Source

GetSelectedCamera()

Retrieves selected Camera.

Declaration
C#
Copy
public Camera GetSelectedCamera()
Returns
Type Description
Camera

Camera currently used in SceneView as a selected Camera.

API Level: 10
View Source

ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef)

Release swigCPtr.

Declaration
C#
Copy
protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
Parameters
Type Name Description
System.Runtime.InteropServices.HandleRef swigCPtr
View Source

RemoveCamera(Camera)

Removes a Camera from this SceneView. If removed Camera is selected Camera, first camera in the list becomes the selected Camera.

Declaration
C#
Copy
public void RemoveCamera(Camera camera)
Parameters
Type Name Description
Camera camera

camera Camera to be removed from this Camera.

Remarks

When Camera.Dispose() is called, the NUI object is disposed, but camera information is maintained internally. Therefore, even if Camera.Dispose() is called, RemoveCamera() or RemoveCamera() methods can be used. If RemoveCamera() is called too, all information is deleted together.

API Level: 10
View Source

SelectCamera(String)

Makes SceneView use a Camera of a name as a selected camera.

Declaration
C#
Copy
public void SelectCamera(string name)
Parameters
Type Name Description
String name

string keyword of Camera to be used as a selected camera.

API Level: 10
View Source

SelectCamera(UInt32)

Makes SceneView use a Camera of index as a selected camera.

Declaration
C#
Copy
public void SelectCamera(uint index)
Parameters
Type Name Description
UInt32 index

Index of Camera to be used as a selected camera.

API Level: 10
View Source

SetImageBasedLightSource(String, String, Single)

Changes Image Based Light as the input textures.

Declaration
C#
Copy
public void SetImageBasedLightSource(string diffuseUrl, string specularUrl, float scaleFactor = 1F)
Parameters
Type Name Description
String diffuseUrl

The path of Cube map image that can be used as a diffuse IBL source.

String specularUrl

The path of Cube map image that can be used as a specular IBL source.

Single scaleFactor

Scale factor that controls light source intensity in [0.0f, 1.0f]. Default value is 1.0f.

Remarks

http://tizen.org/privilege/mediastorage for local files in media storage. http://tizen.org/privilege/externalstorage for local files in external storage.

API Level: 10

Events

View Source

CameraTransitionFinished

An event emitted when Camera Transition is finished.

Declaration
C#
Copy
public event EventHandler CameraTransitionFinished
Event Type
Type Description
EventHandler

Implements

Extension Methods