[NUI.Scene3D] Add Shadow for a Directional Light
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Scene3D / src / internal / CameraBindableProperty.cs
1 /*
2  * Copyright(c) 2022 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 using System.ComponentModel;
19 using Tizen.NUI.Binding;
20
21 namespace Tizen.NUI.Scene3D
22 {
23     public partial class Camera
24     {
25         /// <summary>
26         /// ProjectionModeProperty
27         /// </summary>
28         internal static readonly BindableProperty ProjectionProperty = BindableProperty.Create(nameof(ProjectionMode), typeof(ProjectionModeType), typeof(Tizen.NUI.Scene3D.Camera), ProjectionModeType.Perspective, propertyChanged: (bindable, oldValue, newValue) =>
29         {
30             var instance = (Tizen.NUI.Scene3D.Camera)bindable;
31             if (newValue != null)
32             {
33                 instance.InternalProjectionMode = (ProjectionModeType)newValue;
34             }
35         },
36         defaultValueCreator: (bindable) =>
37         {
38             var instance = (Tizen.NUI.Scene3D.Camera)bindable;
39             return instance.InternalProjectionMode;
40         });
41
42         /// <summary>
43         /// ProjectionDirectionProperty
44         /// </summary>
45         internal static readonly BindableProperty ProjectionDirectionProperty = BindableProperty.Create(nameof(ProjectionDirection), typeof(ProjectionDirectionType), typeof(Tizen.NUI.Scene3D.Camera), ProjectionDirectionType.Vertical, propertyChanged: (bindable, oldValue, newValue) =>
46         {
47             var instance = (Tizen.NUI.Scene3D.Camera)bindable;
48             if (newValue != null)
49             {
50                 // Keep previous orthographicSize.
51                 float orthographicSize = instance.OrthographicSize;
52                 instance.InternalProjectionDirection = (ProjectionDirectionType)newValue;
53
54                 // Recalculate orthographicSize by changed direction.
55                 instance.OrthographicSize = orthographicSize;
56             }
57         },
58         defaultValueCreator: (bindable) =>
59         {
60             var instance = (Tizen.NUI.Scene3D.Camera)bindable;
61             return instance.InternalProjectionDirection;
62         });
63
64         /// <summary>
65         /// FieldOfViewProperty
66         /// </summary>
67         internal static readonly BindableProperty FieldOfViewProperty = BindableProperty.Create(nameof(FieldOfView), typeof(float), typeof(Tizen.NUI.Scene3D.Camera), default(float), propertyChanged: (bindable, oldValue, newValue) =>
68         {
69             var instance = (Tizen.NUI.Scene3D.Camera)bindable;
70             if (newValue != null)
71             {
72                 instance.InternalFieldOfView = (float)newValue;
73             }
74         },
75         defaultValueCreator: (bindable) =>
76         {
77             var instance = (Tizen.NUI.Scene3D.Camera)bindable;
78             return instance.InternalFieldOfView;
79         });
80
81         /// <summary>
82         /// OrthographicSizeProperty
83         /// </summary>
84         internal static readonly BindableProperty OrthographicSizeProperty = BindableProperty.Create(nameof(OrthographicSize), typeof(float), typeof(Tizen.NUI.Scene3D.Camera), default(float), propertyChanged: (bindable, oldValue, newValue) =>
85         {
86             var instance = (Tizen.NUI.Scene3D.Camera)bindable;
87             if (newValue != null)
88             {
89                 instance.InternalOrthographicSize = (float)newValue;
90             }
91         },
92         defaultValueCreator: (bindable) =>
93         {
94             var instance = (Tizen.NUI.Scene3D.Camera)bindable;
95             return instance.InternalOrthographicSize;
96         });
97
98         /// <summary>
99         /// AspectRatioProperty
100         /// </summary>
101         internal static readonly BindableProperty AspectRatioProperty = BindableProperty.Create(nameof(AspectRatio), typeof(float), typeof(Tizen.NUI.Scene3D.Camera), default(float), propertyChanged: (bindable, oldValue, newValue) =>
102         {
103             var instance = (Tizen.NUI.Scene3D.Camera)bindable;
104             if (newValue != null)
105             {
106                 instance.InternalAspectRatio = (float)newValue;
107             }
108         },
109         defaultValueCreator: (bindable) =>
110         {
111             var instance = (Tizen.NUI.Scene3D.Camera)bindable;
112             return instance.InternalAspectRatio;
113         });
114
115         /// <summary>
116         /// NearPlaneDistanceProperty
117         /// </summary>
118         internal static readonly BindableProperty NearPlaneDistanceProperty = BindableProperty.Create(nameof(NearPlaneDistance), typeof(float), typeof(Tizen.NUI.Scene3D.Camera), default(float), propertyChanged: (bindable, oldValue, newValue) =>
119         {
120             var instance = (Tizen.NUI.Scene3D.Camera)bindable;
121             if (newValue != null)
122             {
123                 instance.InternalNearPlaneDistance = (float)newValue;
124             }
125         },
126         defaultValueCreator: (bindable) =>
127         {
128             var instance = (Tizen.NUI.Scene3D.Camera)bindable;
129             return instance.InternalNearPlaneDistance;
130         });
131
132         /// <summary>
133         /// FarPlaneDistanceProperty
134         /// </summary>
135         internal static readonly BindableProperty FarPlaneDistanceProperty = BindableProperty.Create(nameof(FarPlaneDistance), typeof(float), typeof(Tizen.NUI.Scene3D.Camera), default(float), propertyChanged: (bindable, oldValue, newValue) =>
136         {
137             var instance = (Tizen.NUI.Scene3D.Camera)bindable;
138             if (newValue != null)
139             {
140                 instance.InternalFarPlaneDistance = (float)newValue;
141             }
142         },
143         defaultValueCreator: (bindable) =>
144         {
145             var instance = (Tizen.NUI.Scene3D.Camera)bindable;
146             return instance.InternalFarPlaneDistance;
147         });
148
149         /// <summary>
150         /// LeftPlaneDistanceProperty
151         /// </summary>
152         internal static readonly BindableProperty LeftPlaneDistanceProperty = BindableProperty.Create(nameof(LeftPlaneDistance), typeof(float), typeof(Tizen.NUI.Scene3D.Camera), default(float), propertyChanged: (bindable, oldValue, newValue) =>
153         {
154             var instance = (Tizen.NUI.Scene3D.Camera)bindable;
155             if (newValue != null)
156             {
157                 instance.InternalLeftPlaneDistance = (float)newValue;
158             }
159         },
160         defaultValueCreator: (bindable) =>
161         {
162             var instance = (Tizen.NUI.Scene3D.Camera)bindable;
163             return instance.InternalLeftPlaneDistance;
164         });
165
166         /// <summary>
167         /// RightPlaneDistanceProperty
168         /// </summary>
169         internal static readonly BindableProperty RightPlaneDistanceProperty = BindableProperty.Create(nameof(RightPlaneDistance), typeof(float), typeof(Tizen.NUI.Scene3D.Camera), default(float), propertyChanged: (bindable, oldValue, newValue) =>
170         {
171             var instance = (Tizen.NUI.Scene3D.Camera)bindable;
172             if (newValue != null)
173             {
174                 instance.InternalRightPlaneDistance = (float)newValue;
175             }
176         },
177         defaultValueCreator: (bindable) =>
178         {
179             var instance = (Tizen.NUI.Scene3D.Camera)bindable;
180             return instance.InternalRightPlaneDistance;
181         });
182
183         /// <summary>
184         /// TopPlaneDistanceProperty
185         /// </summary>
186         internal static readonly BindableProperty TopPlaneDistanceProperty = BindableProperty.Create(nameof(TopPlaneDistance), typeof(float), typeof(Tizen.NUI.Scene3D.Camera), default(float), propertyChanged: (bindable, oldValue, newValue) =>
187         {
188             var instance = (Tizen.NUI.Scene3D.Camera)bindable;
189             if (newValue != null)
190             {
191                 instance.InternalTopPlaneDistance = (float)newValue;
192             }
193         },
194         defaultValueCreator: (bindable) =>
195         {
196             var instance = (Tizen.NUI.Scene3D.Camera)bindable;
197             return instance.InternalTopPlaneDistance;
198         });
199
200         /// <summary>
201         /// BottomPlaneDistanceProperty
202         /// </summary>
203         internal static readonly BindableProperty BottomPlaneDistanceProperty = BindableProperty.Create(nameof(BottomPlaneDistance), typeof(float), typeof(Tizen.NUI.Scene3D.Camera), default(float), propertyChanged: (bindable, oldValue, newValue) =>
204         {
205             var instance = (Tizen.NUI.Scene3D.Camera)bindable;
206             if (newValue != null)
207             {
208                 instance.InternalBottomPlaneDistance = (float)newValue;
209             }
210         },
211         defaultValueCreator: (bindable) =>
212         {
213             var instance = (Tizen.NUI.Scene3D.Camera)bindable;
214             return instance.InternalBottomPlaneDistance;
215         });
216
217         /// <summary>
218         /// InvertYAxisProperty
219         /// </summary>
220         internal static readonly BindableProperty InvertYAxisProperty = BindableProperty.Create(nameof(InvertYAxis), typeof(bool), typeof(Tizen.NUI.Scene3D.Camera), false, propertyChanged: (bindable, oldValue, newValue) =>
221         {
222             var instance = (Tizen.NUI.Scene3D.Camera)bindable;
223             if (newValue != null)
224             {
225                 instance.InternalInvertYAxis = (bool)newValue;
226             }
227         },
228         defaultValueCreator: (bindable) =>
229         {
230             var instance = (Tizen.NUI.Scene3D.Camera)bindable;
231             return instance.InternalInvertYAxis;
232         });
233     }
234 }