2 * Copyright(c) 2023 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 using System.Runtime.InteropServices;
20 using System.ComponentModel;
22 using Tizen.NUI.Binding;
23 using Tizen.NUI.BaseComponents;
25 namespace Tizen.NUI.Scene3D
28 /// This class is to define 3D Light source.
29 /// Currently this Light class supports Directional Light that lights every position from the same direction. (e.g, Sun light)
30 /// If a Light object is added on SceneView, the 3D objects in the SceneView are shined the Light.
31 /// NUI Scene3D limits the maximum enabled light count per each SceneView.
32 /// Currently the maximum number is set to 5, and it can be retrieved by using <see cref="MaximumActivatedLightCount"/>.
33 /// If more than 5 enabled Light objects are added on SceneView, SceneView turns on only 5 lights in the order the lights were added.
34 /// This Light can be added to SceneView directly but also it can be added on other View.
35 /// When a parent actor is added to a SceneView, its Light behaves in the SceneView the same as if it were added directly to the SceneView.
38 /// Light inherits View, so Light color and direction can be controlled by setting View's <see cref="View.Color"/> and <see cref="View.Orientation"/> Property.
39 /// <see cref="View.LookAt(Vector3, Vector3, Vector3, Vector3)"/> method can be used to set light direction easily.
42 /// Default light direction is to Z-axis
46 /// SceneView sceneView = new SceneView();
47 /// Light light = new Light();
48 /// light.Color = Color.Brown;
49 /// light.LookAt(new Vector3(1.0f, 1.0f, 1.0f));
50 /// sceneView.Add(light);
53 [EditorBrowsable(EditorBrowsableState.Never)]
54 public class Light : View
56 internal Light(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
61 /// Create an initialized Light.
63 [EditorBrowsable(EditorBrowsableState.Never)]
64 public Light() : this(Interop.Light.New(), true)
66 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
72 /// <param name="light">Source object to copy.</param>
73 [EditorBrowsable(EditorBrowsableState.Never)]
74 public Light(Light light) : this(Interop.Light.NewLight(Light.getCPtr(light)), true)
76 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
80 /// Maximum Activated Light Count.
81 /// It is possible to add more Lights to the SceneView than the Maximum Activated Light Count,
82 /// but only up to the Maximum Activated Light Count Lights will work.
85 /// This property is read only.
87 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
88 [EditorBrowsable(EditorBrowsableState.Never)]
89 public uint MaximumActivatedLightCount
93 return Interop.Light.GetMaximumEnabledLightCount();
98 /// The Light is turned on when the Light object is added on SceneView and enabled.
99 /// And checks whether this light is enabled or not.
102 /// SceneView can turn on only up to maximum enabled light count that can be retrieved by GetMaximumEnabledLightCount().
104 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
105 [EditorBrowsable(EditorBrowsableState.Never)]
106 public bool IsLightEnabled
111 bool isEnabled = Interop.Light.IsEnabled(SwigCPtr);
112 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
117 Interop.Light.Enable(SwigCPtr, value);
118 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();