Add SetResolution method to SceneView
[platform/core/uifw/dali-csharp-binder.git] / dali-csharp-binder / dali-scene3d / scene-view-wrap.cpp
1 /*
2  * Copyright (c) 2023 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 // EXTERNAL INCLUDES
19 #include <dali-scene3d/public-api/controls/scene-view/scene-view.h>
20
21 // INTERNAL INCLUDES
22 #include <dali-csharp-binder/common/common.h>
23
24 #ifdef __cplusplus
25 extern "C"
26 {
27 #endif
28   SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_SceneView_New_SWIG_0()
29   {
30     Dali::Scene3D::SceneView result;
31     {
32       try
33       {
34         result = Dali::Scene3D::SceneView::New();
35       }
36       CALL_CATCH_EXCEPTION(0);
37     }
38
39     return new Dali::Scene3D::SceneView((const Dali::Scene3D::SceneView &)result);
40   }
41
42   SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_new_SceneView_SWIG_0()
43   {
44     Dali::Scene3D::SceneView *result = 0;
45
46     {
47       try
48       {
49         result = (Dali::Scene3D::SceneView *)new Dali::Scene3D::SceneView();
50       }
51       CALL_CATCH_EXCEPTION(0);
52     }
53
54     return (void *)result;
55   }
56
57   SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_new_SceneView_SWIG_1(void *csSceneView)
58   {
59     Dali::Scene3D::SceneView *sceneView = (Dali::Scene3D::SceneView *)csSceneView;
60     Dali::Scene3D::SceneView *result = 0;
61
62     if (!sceneView)
63     {
64       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Dali::Scene3D::SceneView const & type is null", 0);
65       return 0;
66     }
67     {
68       try
69       {
70         result = (Dali::Scene3D::SceneView *)new Dali::Scene3D::SceneView((Dali::Scene3D::SceneView const &)*sceneView);
71       }
72       CALL_CATCH_EXCEPTION(0);
73     }
74
75     return (void *)result;
76   }
77
78   SWIGEXPORT void SWIGSTDCALL CSharp_Dali_delete_SceneView(void *csSceneView)
79   {
80     Dali::Scene3D::SceneView *sceneView = (Dali::Scene3D::SceneView *)csSceneView;
81     {
82       try
83       {
84         delete sceneView;
85       }
86       CALL_CATCH_EXCEPTION();
87     }
88   }
89
90   SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_SceneView_Assign(void *csDestination, void *csSource)
91   {
92     Dali::Scene3D::SceneView *destination = (Dali::Scene3D::SceneView *)csDestination;
93     Dali::Scene3D::SceneView *source = (Dali::Scene3D::SceneView *)csSource;
94     Dali::Scene3D::SceneView *result = 0;
95
96     if (!source)
97     {
98       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Dali::Scene3D::SceneView const & type is null", 0);
99       return 0;
100     }
101     {
102       try
103       {
104         result = (Dali::Scene3D::SceneView *)&(destination)->operator=((Dali::Scene3D::SceneView const &)*source);
105       }
106       CALL_CATCH_EXCEPTION(0);
107     }
108
109     return (void *)result;
110   }
111
112   SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_SceneView_DownCast(void *csHandle)
113   {
114     Dali::BaseHandle *handle = (Dali::BaseHandle *)csHandle;
115     Dali::Scene3D::SceneView result;
116
117     if (!handle)
118     {
119       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::SceneView", 0);
120       return 0;
121     }
122     {
123       try
124       {
125         result = Dali::Scene3D::SceneView::DownCast(*handle);
126       }
127       CALL_CATCH_EXCEPTION(0);
128     }
129
130     return new Dali::Scene3D::SceneView((const Dali::Scene3D::SceneView &)result);
131   }
132
133   SWIGEXPORT void SWIGSTDCALL CSharp_Dali_SceneView_AddCamera(void *csSceneView, void *csCamera)
134   {
135     Dali::Scene3D::SceneView *sceneView = (Dali::Scene3D::SceneView *)csSceneView;
136     Dali::CameraActor *cameraActor = (Dali::CameraActor *)csCamera;
137
138     if (!sceneView)
139     {
140       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::SceneView", 0);
141       return;
142     }
143     if (!cameraActor)
144     {
145       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::CameraActor", 0);
146       return;
147     }
148     {
149       try
150       {
151         sceneView->AddCamera(*cameraActor);
152       }
153       CALL_CATCH_EXCEPTION();
154     }
155   }
156
157   SWIGEXPORT void SWIGSTDCALL CSharp_Dali_SceneView_RemoveCamera(void *csSceneView, void *csCamera)
158   {
159     Dali::Scene3D::SceneView *sceneView = (Dali::Scene3D::SceneView *)csSceneView;
160     Dali::CameraActor *cameraActor = (Dali::CameraActor *)csCamera;
161
162     if (!sceneView)
163     {
164       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::SceneView", 0);
165       return;
166     }
167     if (!cameraActor)
168     {
169       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::CameraActor", 0);
170       return;
171     }
172     {
173       try
174       {
175         sceneView->RemoveCamera(*cameraActor);
176       }
177       CALL_CATCH_EXCEPTION();
178     }
179   }
180
181   SWIGEXPORT uint32_t SWIGSTDCALL CSharp_Dali_SceneView_GetCameraCount(void *csSceneView)
182   {
183     Dali::Scene3D::SceneView *sceneView = (Dali::Scene3D::SceneView *)csSceneView;
184     uint32_t result = 0;
185
186     if (!sceneView)
187     {
188       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::SceneView", 0);
189       return 0;
190     }
191     {
192       try
193       {
194         result = sceneView->GetCameraCount();
195       }
196       CALL_CATCH_EXCEPTION(0);
197     }
198     return result;
199   }
200
201   SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_SceneView_GetSelectedCamera(void *csSceneView)
202   {
203     Dali::Scene3D::SceneView *sceneView = (Dali::Scene3D::SceneView *)csSceneView;
204     Dali::CameraActor cameraActor;
205
206     if (!sceneView)
207     {
208       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::SceneView", 0);
209       return 0;
210     }
211     {
212       try
213       {
214         cameraActor = sceneView->GetSelectedCamera();
215       }
216       CALL_CATCH_EXCEPTION(0);
217     }
218     Dali::CameraActor *result = new Dali::CameraActor((const Dali::CameraActor &)cameraActor);
219     return result;
220   }
221
222   SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_SceneView_GetCamera_0(void *csSceneView, uint32_t index)
223   {
224     Dali::Scene3D::SceneView *sceneView = (Dali::Scene3D::SceneView *)csSceneView;
225     Dali::CameraActor cameraActor;
226
227     if (!sceneView)
228     {
229       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::SceneView", 0);
230       return 0;
231     }
232     {
233       try
234       {
235         cameraActor = sceneView->GetCamera(index);
236       }
237       CALL_CATCH_EXCEPTION(0);
238     }
239     Dali::CameraActor *result = new Dali::CameraActor((const Dali::CameraActor &)cameraActor);
240     return result;
241   }
242
243   SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_SceneView_GetCamera_1(void *csSceneView, char *name)
244   {
245     Dali::Scene3D::SceneView *sceneView = (Dali::Scene3D::SceneView *)csSceneView;
246     Dali::CameraActor cameraActor;
247
248     if (!sceneView)
249     {
250       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::SceneView", 0);
251       return 0;
252     }
253     {
254       try
255       {
256         cameraActor = sceneView->GetCamera(std::string(name));
257       }
258       CALL_CATCH_EXCEPTION(0);
259     }
260     Dali::CameraActor *result = new Dali::CameraActor((const Dali::CameraActor &)cameraActor);
261     return result;
262   }
263
264   SWIGEXPORT void SWIGSTDCALL CSharp_Dali_SceneView_SelectCamera_0(void *csSceneView, uint32_t index)
265   {
266     Dali::Scene3D::SceneView *sceneView = (Dali::Scene3D::SceneView *)csSceneView;
267
268     if (!sceneView)
269     {
270       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::SceneView", 0);
271       return;
272     }
273     {
274       try
275       {
276         sceneView->SelectCamera(index);
277       }
278       CALL_CATCH_EXCEPTION();
279     }
280   }
281
282   SWIGEXPORT void SWIGSTDCALL CSharp_Dali_SceneView_SelectCamera_1(void *csSceneView, char *name)
283   {
284     Dali::Scene3D::SceneView *sceneView = (Dali::Scene3D::SceneView *)csSceneView;
285
286     if (!sceneView)
287     {
288       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::SceneView", 0);
289       return;
290     }
291     {
292       try
293       {
294         sceneView->SelectCamera(std::string(name));
295       }
296       CALL_CATCH_EXCEPTION();
297     }
298   }
299
300   SWIGEXPORT void SWIGSTDCALL CSharp_Dali_SceneView_SetImageBasedLightSource(void *csSceneView, char *diffuseUrl, char *specularUrl, float scaleFactor)
301   {
302     Dali::Scene3D::SceneView *sceneView = (Dali::Scene3D::SceneView *)csSceneView;
303
304     if (!sceneView)
305     {
306       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::SceneView", 0);
307       return;
308     }
309     {
310       try
311       {
312         sceneView->SetImageBasedLightSource(std::string(diffuseUrl), std::string(specularUrl), scaleFactor);
313       }
314       CALL_CATCH_EXCEPTION();
315     }
316   }
317
318   SWIGEXPORT void SWIGSTDCALL CSharp_Dali_SceneView_SetImageBasedLightScaleFactor(void *csSceneView, float scaleFactor)
319   {
320     Dali::Scene3D::SceneView *sceneView = (Dali::Scene3D::SceneView *)csSceneView;
321
322     if (!sceneView)
323     {
324       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::SceneView", 0);
325       return;
326     }
327     {
328       try
329       {
330         sceneView->SetImageBasedLightScaleFactor(scaleFactor);
331       }
332       CALL_CATCH_EXCEPTION();
333     }
334   }
335
336   SWIGEXPORT float SWIGSTDCALL CSharp_Dali_SceneView_GetImageBasedLightScaleFactor(void *csSceneView)
337   {
338     Dali::Scene3D::SceneView *sceneView = (Dali::Scene3D::SceneView *)csSceneView;
339     float scaleFactor = 1.0f;
340
341     if (!sceneView)
342     {
343       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::ModelView", 0);
344       return scaleFactor;
345     }
346     {
347       try
348       {
349         scaleFactor = sceneView->GetImageBasedLightScaleFactor();
350       }
351       CALL_CATCH_EXCEPTION(0.0f);
352     }
353     return scaleFactor;
354   }
355
356   SWIGEXPORT void SWIGSTDCALL CSharp_Dali_SceneView_UseFramebuffer(void *csSceneView, bool useFramebuffer)
357   {
358     Dali::Scene3D::SceneView *sceneView = (Dali::Scene3D::SceneView *)csSceneView;
359
360     if (!sceneView)
361     {
362       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::SceneView", 0);
363       return;
364     }
365     {
366       try
367       {
368         sceneView->UseFramebuffer(useFramebuffer);
369       }
370       CALL_CATCH_EXCEPTION();
371     }
372   }
373
374   SWIGEXPORT bool SWIGSTDCALL CSharp_Dali_SceneView_IsUsingFramebuffer(void *csSceneView)
375   {
376     Dali::Scene3D::SceneView *sceneView = (Dali::Scene3D::SceneView *)csSceneView;
377     bool result = false;
378
379     if (!sceneView)
380     {
381       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::SceneView", 0);
382       return false;
383     }
384     {
385       try
386       {
387         result = sceneView->IsUsingFramebuffer();
388       }
389       CALL_CATCH_EXCEPTION(0);
390     }
391     return result;
392   }
393
394   SWIGEXPORT void SWIGSTDCALL CSharp_Dali_SceneView_SetResolution(void *csSceneView, uint32_t width, uint32_t height)
395   {
396     Dali::Scene3D::SceneView *sceneView = (Dali::Scene3D::SceneView *)csSceneView;
397
398     if (!sceneView)
399     {
400       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::SceneView", 0);
401       return;
402     }
403     {
404       try
405       {
406         sceneView->SetResolution(width, height);
407       }
408       CALL_CATCH_EXCEPTION();
409     }
410   }
411
412   SWIGEXPORT uint32_t SWIGSTDCALL CSharp_Dali_SceneView_GetResolutionWidth(void *csSceneView)
413   {
414     Dali::Scene3D::SceneView *sceneView = (Dali::Scene3D::SceneView *)csSceneView;
415     uint32_t result = 0u;
416
417     if (!sceneView)
418     {
419       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::SceneView", 0);
420       return 0;
421     }
422     {
423       try
424       {
425         result = static_cast<uint32_t>(sceneView->GetResolutionWidth());
426       }
427       CALL_CATCH_EXCEPTION(0);
428     }
429     return result;
430   }
431
432   SWIGEXPORT uint32_t SWIGSTDCALL CSharp_Dali_SceneView_GetResolutionHeight(void *csSceneView)
433   {
434     Dali::Scene3D::SceneView *sceneView = (Dali::Scene3D::SceneView *)csSceneView;
435     uint32_t result = 0u;
436
437     if (!sceneView)
438     {
439       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::SceneView", 0);
440       return 0;
441     }
442     {
443       try
444       {
445         result = static_cast<uint32_t>(sceneView->GetResolutionHeight());
446       }
447       CALL_CATCH_EXCEPTION(0);
448     }
449     return result;
450   }
451
452   SWIGEXPORT void SWIGSTDCALL CSharp_Dali_SceneView_ResetResolution(void *csSceneView)
453   {
454     Dali::Scene3D::SceneView *sceneView = (Dali::Scene3D::SceneView *)csSceneView;
455
456     if (!sceneView)
457     {
458       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::SceneView", 0);
459       return;
460     }
461     {
462       try
463       {
464         sceneView->ResetResolution();
465       }
466       CALL_CATCH_EXCEPTION();
467     }
468   }
469
470   SWIGEXPORT void SWIGSTDCALL CSharp_Dali_SceneView_SetFramebufferMultiSamplingLevel(void *csSceneView, uint32_t multiSamplingLevel)
471   {
472     Dali::Scene3D::SceneView *sceneView = (Dali::Scene3D::SceneView *)csSceneView;
473
474     if (!sceneView)
475     {
476       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::SceneView", 0);
477       return;
478     }
479     {
480       try
481       {
482         sceneView->SetFramebufferMultiSamplingLevel(static_cast<uint8_t>(multiSamplingLevel));
483       }
484       CALL_CATCH_EXCEPTION();
485     }
486   }
487
488   SWIGEXPORT uint32_t SWIGSTDCALL CSharp_Dali_SceneView_GetFramebufferMultiSamplingLevel(void *csSceneView)
489   {
490     Dali::Scene3D::SceneView *sceneView = (Dali::Scene3D::SceneView *)csSceneView;
491     uint32_t result = 0u;
492
493     if (!sceneView)
494     {
495       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::SceneView", 0);
496       return 0;
497     }
498     {
499       try
500       {
501         result = static_cast<uint32_t>(sceneView->GetFramebufferMultiSamplingLevel());
502       }
503       CALL_CATCH_EXCEPTION(0);
504     }
505     return result;
506   }
507
508   SWIGEXPORT void SWIGSTDCALL CSharp_Dali_SceneView_SetSkybox(void *csSceneView, char *skyboxUrl)
509   {
510     Dali::Scene3D::SceneView *sceneView = (Dali::Scene3D::SceneView *)csSceneView;
511
512     if (!sceneView)
513     {
514       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::SceneView", 0);
515       return;
516     }
517     if (!skyboxUrl)
518     {
519       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null string", 0);
520       return;
521     }
522     {
523       try
524       {
525         sceneView->SetSkybox(std::string(skyboxUrl));
526       }
527       CALL_CATCH_EXCEPTION();
528     }
529     return;
530   }
531
532   SWIGEXPORT void SWIGSTDCALL CSharp_Dali_SceneView_SetSkyboxEnvironmentMapType(void *csSceneView, int skyboxEnvironmentMapType)
533   {
534     Dali::Scene3D::SceneView *sceneView = (Dali::Scene3D::SceneView *)csSceneView;
535
536     if (!sceneView)
537     {
538       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::SceneView", 0);
539       return;
540     }
541     {
542       try
543       {
544         sceneView->SetSkyboxEnvironmentMapType((Dali::Scene3D::EnvironmentMapType)skyboxEnvironmentMapType);
545       }
546       CALL_CATCH_EXCEPTION();
547     }
548     return;
549   }
550
551   SWIGEXPORT void SWIGSTDCALL CSharp_Dali_SceneView_SetSkyboxIntensity(void *csSceneView, float intensity)
552   {
553     Dali::Scene3D::SceneView *sceneView = (Dali::Scene3D::SceneView *)csSceneView;
554
555     if (!sceneView)
556     {
557       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::SceneView", 0);
558       return;
559     }
560     {
561       try
562       {
563         sceneView->SetSkyboxIntensity(intensity);
564       }
565       CALL_CATCH_EXCEPTION();
566     }
567     return;
568   }
569
570   SWIGEXPORT float SWIGSTDCALL CSharp_Dali_SceneView_GetSkyboxIntensity(void *csSceneView)
571   {
572     Dali::Scene3D::SceneView *sceneView = (Dali::Scene3D::SceneView *)csSceneView;
573     float intensity = 1.0f;
574
575     if (!sceneView)
576     {
577       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::SceneView", 0);
578       return intensity;
579     }
580     {
581       try
582       {
583         intensity = sceneView->GetSkyboxIntensity();
584       }
585       CALL_CATCH_EXCEPTION(0.0f);
586     }
587     return intensity;
588   }
589
590   SWIGEXPORT void SWIGSTDCALL CSharp_Dali_SceneView_SetSkyboxOrientation(void *csSceneView, void *csOrientation)
591   {
592     Dali::Scene3D::SceneView *sceneView = (Dali::Scene3D::SceneView *)csSceneView;
593     Dali::Quaternion *orientation = (Dali::Quaternion *)csOrientation;
594
595     if (!sceneView)
596     {
597       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::SceneView", 0);
598       return;
599     }
600     if (!orientation)
601     {
602       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Quaternion", 0);
603       return;
604     }
605     {
606       try
607       {
608         sceneView->SetSkyboxOrientation(*orientation);
609       }
610       CALL_CATCH_EXCEPTION();
611     }
612     return;
613   }
614
615   SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_SceneView_GetSkyboxOrientation(void *csSceneView)
616   {
617     Dali::Scene3D::SceneView *sceneView = (Dali::Scene3D::SceneView *)csSceneView;
618     Dali::Quaternion orientation;
619
620     if (!sceneView)
621     {
622       SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::SceneView", 0);
623       return 0;
624     }
625     {
626       try
627       {
628         orientation = sceneView->GetSkyboxOrientation();
629       }
630       CALL_CATCH_EXCEPTION(0);
631     }
632     Dali::Quaternion *result = new Dali::Quaternion((const Dali::Quaternion &)orientation);
633     return result;
634   }
635
636 #ifdef __cplusplus
637 }
638 #endif