Add scene3d module for csharp binder 28/278428/4
authorXianbing Teng <xb.teng@samsung.com>
Wed, 20 Jul 2022 09:25:38 +0000 (17:25 +0800)
committerXianbing Teng <xb.teng@samsung.com>
Thu, 21 Jul 2022 08:19:44 +0000 (16:19 +0800)
Change-Id: I6d2e9d52b6fc7a4204ead73059c660fe486c0609

.gitignore
build/tizen/CMakeLists.txt
build/tizen/dali-scene3d/CMakeLists.txt [new file with mode: 0755]
build/tizen/dali2-csharp-binder.pc.in
dali-csharp-binder/file.list
dali-csharp-binder/src/model-view-wrap.cpp [new file with mode: 0755]
packaging/dali-csharp-binder.spec

index 15990c5..1666db7 100755 (executable)
@@ -36,4 +36,5 @@ build/tizen/.deps/
 build/tizen/.libs/
 build/tizen/build/
 build/tizen/cmake_install.cmake
+build/tizen/dali-scene3d/cmake_install.cmake
 build/tizen/install_manifest.txt
index cc546b2..f06d08c 100644 (file)
@@ -27,6 +27,7 @@ OPTION(ENABLE_DEBUG              "Enable Debug" OFF)
 OPTION(ENABLE_PROFILE            "Enable Profile" OFF)
 OPTION(ENABLE_TRACE              "Enable Trace" ON)
 OPTION(ENABLE_PKG_CONFIGURE      "Use pkgconfig" ON)
+OPTION(ENABLE_SCENE3D            "Enable scene3d" ON)
 OPTION(ENABLE_RIVE_ANIMATION     "Enable rive animation" OFF)
 OPTION(ENABLE_ECORE_WAYLAND2     "Enable ecore wayland2" OFF)
 
@@ -77,6 +78,7 @@ IF( ENABLE_PKG_CONFIGURE )
   PKG_CHECK_MODULES(DALICORE REQUIRED dali2-core)
   PKG_CHECK_MODULES(DALIADAPTOR REQUIRED dali2-adaptor)
   PKG_CHECK_MODULES(DALITOOLKIT REQUIRED dali2-toolkit)
+  PKG_CHECK_MODULES(DALISCENE3D REQUIRED dali2-scene3d)
 ENDIF()
 
 ADD_DEFINITIONS(-DDALI_PROFILE_WINDOWS)
@@ -86,6 +88,7 @@ IF( WIN32 ) # WIN32 includes x64 as well according to the cmake doc.
   FIND_PACKAGE( dali2-core REQUIRED )
   FIND_PACKAGE( dali2-adaptor REQUIRED )
   FIND_PACKAGE( dali2-toolkit REQUIRED )
+  FIND_PACKAGE( dali2-scene3d REQUIRED )
   FIND_PACKAGE( pthreads REQUIRED )
 ENDIF()
 
@@ -248,5 +251,10 @@ MESSAGE( STATUS "Profile:                       " ${ENABLE_PROFILE} )
 MESSAGE( STATUS "Export all symbols:            " ${ENABLE_EXPORTALL} )
 MESSAGE( STATUS "Trace:                         " ${ENABLE_TRACE} )
 MESSAGE( STATUS "Use pkg configure:             " ${ENABLE_PKG_CONFIGURE} )
+MESSAGE( STATUS "Use scene 3d:                  " ${ENABLE_SCENE3D} )
 MESSAGE( STATUS "CXXFLAGS:                      " ${CMAKE_CXX_FLAGS} )
 MESSAGE( STATUS "LDFLAGS:                       " ${CMAKE_SHARED_LINKER_FLAGS_INIT}${CMAKE_SHARED_LINKER_FLAGS} )
+
+IF( ENABLE_SCENE3D )
+  ADD_SUBDIRECTORY( dali-scene3d )
+ENDIF()
diff --git a/build/tizen/dali-scene3d/CMakeLists.txt b/build/tizen/dali-scene3d/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..c1e0779
--- /dev/null
@@ -0,0 +1,27 @@
+SET(SCENE3D_TARGET dali2-csharp-binder-scene3d)
+
+SET( SCENE3D_SOURCES ${dali_csharp_binder_scene3d_src_files})
+
+ADD_LIBRARY( ${SCENE3D_TARGET} SHARED ${SCENE3D_SOURCES} )
+
+TARGET_LINK_LIBRARIES( ${SCENE3D_TARGET} PUBLIC
+  ${DLOG_LDFLAGS}
+  ${DALICORE_LDFLAGS}
+  ${DALIADAPTOR_LDFLAGS}
+  ${DALITOOLKIT_LDFLAGS}
+  ${DALISCENE3D_LDFLAGS})
+
+TARGET_COMPILE_OPTIONS( ${SCENE3D_TARGET} PUBLIC
+  ${DLOG_CFLAGS}
+  ${DALICORE_CFLAGS}
+  ${DALIADAPTOR_CFLAGS}
+  ${DALITOOLKIT_CFLAGS}
+  ${DALISCENE3D_CFLAGS}
+  ${DALI_PROFILE_CFLAGS}
+  ${SCENE3D_CFLAGS}
+  ${}
+  -I../../../
+  -Wall
+)
+
+INSTALL( TARGETS ${SCENE3D_TARGET} DESTINATION ${LIB_DIR} )
index 652db80..6d6b3dc 100644 (file)
@@ -9,6 +9,6 @@ includedir=@DEV_INCLUDE_PATH@
 Name: DALi C# binder
 Description: DALi C# binder Libaray
 Version: ${apiversion}
-Requires: dali2-core dali2-adaptor dali2-toolkit
+Requires: dali2-core dali2-adaptor dali2-toolkit dali2-scene3d
 Libs: -L${libdir} -ldali2-csharp-binder
 Cflags: -I${includedir}/dali-csharp-binder
index 72a62de..f643b21 100755 (executable)
@@ -82,8 +82,11 @@ SET( dali_csharp_binder_tizen_wearable_src_files
   ${dali_csharp_binder_dir}/src/watch-view-wrap.cpp
 )
 
+# module: scene3d
+SET( dali_csharp_binder_scene3d_src_files
+  ${dali_csharp_binder_dir}/src/model-view-wrap.cpp
+)
+
 SET( dali_csharp_binder_header_files
   ${dali_csharp_binder_dir}/src/common.h
 )
-
-
diff --git a/dali-csharp-binder/src/model-view-wrap.cpp b/dali-csharp-binder/src/model-view-wrap.cpp
new file mode 100755 (executable)
index 0000000..3353c98
--- /dev/null
@@ -0,0 +1,304 @@
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali-scene3d/public-api/controls/model-view/model-view.h>
+
+// INTERNAL INCLUDES
+#include "common.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+  SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_ModelView_New_SWIG_1(char *csModelPath, char *csResourcePath)
+  {
+    Dali::Scene3D::ModelView result;
+
+    if (!csModelPath)
+    {
+      SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
+      return 0;
+    }
+    std::string modelPath(csModelPath);
+
+    if (!csResourcePath)
+    {
+      SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
+      return 0;
+    }
+    std::string resourcePath(csResourcePath);
+
+    {
+      try
+      {
+        result = Dali::Scene3D::ModelView::New(modelPath, resourcePath);
+      }
+      CALL_CATCH_EXCEPTION(0);
+    }
+
+    return new Dali::Scene3D::ModelView((const Dali::Scene3D::ModelView &)result);
+  }
+
+  SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_new_ModelView_SWIG_0()
+  {
+    Dali::Scene3D::ModelView *result = 0;
+
+    {
+      try
+      {
+        result = (Dali::Scene3D::ModelView *)new Dali::Scene3D::ModelView();
+      }
+      CALL_CATCH_EXCEPTION(0);
+    }
+
+    return (void *)result;
+  }
+
+  SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_new_ModelView_SWIG_1(void *csModelView)
+  {
+    Dali::Scene3D::ModelView *modelView = (Dali::Scene3D::ModelView *)csModelView;
+    Dali::Scene3D::ModelView *result = 0;
+
+    if (!modelView)
+    {
+      SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Dali::Scene3D::ModelView const & type is null", 0);
+      return 0;
+    }
+    {
+      try
+      {
+        result = (Dali::Scene3D::ModelView *)new Dali::Scene3D::ModelView((Dali::Scene3D::ModelView const &)*modelView);
+      }
+      CALL_CATCH_EXCEPTION(0);
+    }
+
+    return (void *)result;
+  }
+
+  SWIGEXPORT void SWIGSTDCALL CSharp_Dali_delete_ModelView(void *csModelView)
+  {
+    Dali::Scene3D::ModelView *modelView = (Dali::Scene3D::ModelView *)csModelView;
+    {
+      try
+      {
+        delete modelView;
+      }
+      CALL_CATCH_EXCEPTION();
+    }
+  }
+
+  SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_ModelView_Assign(void *csDestination, void *csSource)
+  {
+    Dali::Scene3D::ModelView *destination = (Dali::Scene3D::ModelView *)csDestination;
+    Dali::Scene3D::ModelView *source = (Dali::Scene3D::ModelView *)csSource;
+    Dali::Scene3D::ModelView *result = 0;
+
+    if (!source)
+    {
+      SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Dali::Scene3D::ModelView const & type is null", 0);
+      return 0;
+    }
+    {
+      try
+      {
+        result = (Dali::Scene3D::ModelView *)&(destination)->operator=((Dali::Scene3D::ModelView const &)*source);
+      }
+      CALL_CATCH_EXCEPTION(0);
+    }
+
+    return (void *)result;
+  }
+
+  SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_ModelView_DownCast(void *csHandle)
+  {
+    Dali::BaseHandle *handle = (Dali::BaseHandle *)csHandle;
+    Dali::Scene3D::ModelView result;
+
+    if (!handle)
+    {
+      SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::ModelView", 0);
+      return 0;
+    }
+    {
+      try
+      {
+        result = Dali::Scene3D::ModelView::DownCast(*handle);
+      }
+      CALL_CATCH_EXCEPTION(0);
+    }
+
+    return new Dali::Scene3D::ModelView((const Dali::Scene3D::ModelView &)result);
+  }
+
+  SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_ModelView_GetModelRoot(void *csModelView)
+  {
+    Dali::Scene3D::ModelView *modelView = (Dali::Scene3D::ModelView *)csModelView;
+    Dali::Actor result;
+
+    if (!modelView)
+    {
+      SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::ModelView", 0);
+      return 0;
+    }
+    {
+      try
+      {
+        result = modelView->GetModelRoot();
+      }
+      CALL_CATCH_EXCEPTION(0);
+    }
+
+    return new Dali::Actor((const Dali::Actor &)result);
+  }
+
+  SWIGEXPORT void SWIGSTDCALL CSharp_Dali_ModelView_FitSize(void *csModelView, bool fit)
+  {
+    Dali::Scene3D::ModelView *modelView = (Dali::Scene3D::ModelView *)csModelView;
+
+    if (!modelView)
+    {
+      SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::ModelView", 0);
+      return;
+    }
+    {
+      try
+      {
+        modelView->FitSize(fit);
+      }
+      CALL_CATCH_EXCEPTION();
+    }
+  }
+
+  SWIGEXPORT void SWIGSTDCALL CSharp_Dali_ModelView_FitCenter(void *csModelView, bool fit)
+  {
+    Dali::Scene3D::ModelView *modelView = (Dali::Scene3D::ModelView *)csModelView;
+
+    if (!modelView)
+    {
+      SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::ModelView", 0);
+      return;
+    }
+    {
+      try
+      {
+        modelView->FitCenter(fit);
+      }
+      CALL_CATCH_EXCEPTION();
+    }
+  }
+
+  SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_ModelView_SetImageBasedLightSource(void *csModelView, char* csDiffuse, char* csSpecular, float scaleFactor)
+  {
+    Dali::Scene3D::ModelView *modelView = (Dali::Scene3D::ModelView *)csModelView;
+
+    if (!modelView)
+    {
+      SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::ModelView", 0);
+      return 0;
+    }
+    if (!csDiffuse) {
+      SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
+      return 0;
+    }
+    std::string diffuse(csDiffuse);
+    if (!csSpecular) {
+      SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
+      return 0;
+    }
+    std::string specular(csSpecular);
+    {
+      try
+      {
+        modelView->SetImageBasedLightSource(diffuse, specular, scaleFactor);
+      }
+      CALL_CATCH_EXCEPTION(0);
+    }
+  }
+
+  SWIGEXPORT unsigned int SWIGSTDCALL CSharp_Dali_ModelView_GetAnimationCount(void *csModelView)
+  {
+    Dali::Scene3D::ModelView *modelView = (Dali::Scene3D::ModelView *)csModelView;
+    unsigned int result;
+
+    if (!modelView)
+    {
+      SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::ModelView", 0);
+      return 0;
+    }
+    {
+      try
+      {
+        result = modelView->GetAnimationCount();
+      }
+      CALL_CATCH_EXCEPTION(0);
+    }
+
+    return result;
+  }
+
+  SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_ModelView_GetAnimation_1(void *csModelView, unsigned int index)
+  {
+    Dali::Scene3D::ModelView *modelView = (Dali::Scene3D::ModelView *)csModelView;
+    Dali::Animation result;
+
+    if (!modelView)
+    {
+      SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::ModelView", 0);
+      return 0;
+    }
+    {
+      try
+      {
+        result = modelView->GetAnimation(index);
+      }
+      CALL_CATCH_EXCEPTION(0);
+    }
+
+    return new Dali::Animation((const Dali::Animation &)result);
+  }
+
+  SWIGEXPORT void *SWIGSTDCALL CSharp_Dali_ModelView_GetAnimation_2(void *csModelView, char * csName)
+  {
+    Dali::Scene3D::ModelView *modelView = (Dali::Scene3D::ModelView *)csModelView;
+    Dali::Animation result;
+
+    if (!modelView)
+    {
+      SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::Scene3D::ModelView", 0);
+      return 0;
+    }
+    if (!csName) {
+      SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
+      return 0;
+    }
+    std::string name(csName);
+    {
+      try
+      {
+        result = modelView->GetAnimation(name);
+      }
+      CALL_CATCH_EXCEPTION(0);
+    }
+
+    return new Dali::Animation((const Dali::Animation &)result);
+  }
+
+#ifdef __cplusplus
+}
+#endif
index 514e91b..18f2fe7 100644 (file)
@@ -47,6 +47,7 @@ BuildRequires: gawk
 BuildRequires: pkgconfig(dali2-core)
 BuildRequires: pkgconfig(dali2-adaptor)
 BuildRequires: pkgconfig(dali2-toolkit)
+BuildRequires: pkgconfig(dali2-scene3d)
 %if "%{_vd_cfg_product_type}" != "AUDIO" && "%{_vd_cfg_product_type}" !="AV"
 %define rive_animation_view 1
 BuildRequires: pkgconfig(dali2-extension-rive-animation-view)
@@ -158,6 +159,18 @@ Requires: %{name} = %{version}-%{release}
 %description devel
 This package includes developer files common to all packages.
 
+
+##############################
+# Dali Scene3D
+##############################
+%package scene3d
+Summary:    build dali csharp binder scene3d
+Group:      System/Libraries
+Requires:   %{name} = %{version}-%{release}
+%description scene3d
+Scene 3D for Dali
+
+
 ##############################
 # Preparation
 ##############################
@@ -219,6 +232,7 @@ cmake_flags+=" -DCMAKE_INSTALL_PREFIX=$PREFIX"
 cmake_flags+=" -DCMAKE_INSTALL_LIBDIR=%{_libdir}"
 cmake_flags+=" -DCMAKE_INSTALL_INCLUDEDIR=%{_includedir}"
 cmake_flags+=" -DENABLE_TIZEN_MAJOR_VERSION=%{tizen_version_major}"
+cmake_flags+=" -DENABLE_SCENE3D=ON"
 
 # Set up the build via Cmake
 #######################################################################
@@ -507,6 +521,13 @@ exit 0
 
 #################################################
 
+%files scene3d
+%manifest dali-csharp-binder.manifest
+%defattr(-,root,root,-)
+%{_libdir}/libdali2-csharp-binder-scene3d.so*
+
+#################################################
+
 # If the profile is selected, the line below is repquired.
 # if common ||"undefined"
 %if "%{?profile}" != "wearable" && "%{?profile}" != "tv" && "%{?profile}" != "ivi" && "%{?profile}" != "mobile"