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.
18 #include <dali-physics/public-api/physics-actor.h>
19 #include <dali-physics/public-api/physics-adaptor.h>
20 #include <btBulletDynamicsCommon.h>
23 #include <dali-csharp-binder/common/common.h>
29 using Dali::Toolkit::Physics::PhysicsActor;
30 using Dali::Toolkit::Physics::PhysicsAdaptor;
32 SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_new_PhysicsActor__SWIG_0()
35 PhysicsActor* result = 0;
40 result = (PhysicsActor*)new PhysicsActor();
42 CALL_CATCH_EXCEPTION(0);
45 jresult = (void*)result;
49 SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_PhysicsActor_New(void* csActor, void* csBody, void* csAdaptor)
55 SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "PhysicsActor const & type is null", 0);
60 SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "btRigidBody ptr is null", 0);
65 SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "PhysicsAdaptor const & type is null", 0);
72 // Stack allocate a handle
73 result = PhysicsActor::New(*(Dali::Actor*)(csActor), Dali::Any((btRigidBody*)csBody), *(PhysicsAdaptor*)csAdaptor);
75 CALL_CATCH_EXCEPTION(0);
78 // Heap allocate a handle using copy constructor
79 return new PhysicsActor((const PhysicsActor&)result);
82 SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_PhysicsActor_DownCast(void* csHandle)
84 Dali::BaseHandle* handle = (Dali::BaseHandle*)csHandle;
89 SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null Dali::BaseHandle", 0);
95 result = PhysicsActor::DownCast(*handle);
97 CALL_CATCH_EXCEPTION(0);
99 return new PhysicsActor((const PhysicsActor&)result);
102 SWIGEXPORT void SWIGSTDCALL CSharp_Dali_delete_PhysicsActor(void* csPhysicsActor)
104 PhysicsActor* physicsActor = (PhysicsActor*)csPhysicsActor;
110 CALL_CATCH_EXCEPTION();
114 SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_new_PhysicsActor__SWIG_1(void* csPhysicsActor)
116 PhysicsActor* physicsActor = (PhysicsActor*)csPhysicsActor;
117 PhysicsActor* result = 0;
121 SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "PhysicsActor const & type is null", 0);
127 result = (PhysicsActor*)new PhysicsActor((PhysicsActor const&)*physicsActor);
129 CALL_CATCH_EXCEPTION(0);
132 return (void*)result;
135 SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_PhysicsActor_Assign(void* csDest, void* csSrc)
137 PhysicsActor* dest = (PhysicsActor*)csDest;
138 PhysicsActor* src = (PhysicsActor*)csSrc;
139 PhysicsActor* result = 0;
143 SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "PhysicsActor const & type is null", 0);
149 result = (PhysicsActor*)&(dest)->operator=((PhysicsActor const&)*src);
151 CALL_CATCH_EXCEPTION(0);
154 return (void*)result;
157 SWIGEXPORT unsigned int SWIGSTDCALL CSharp_Dali_PhysicsActor_GetId(void* csActor)
159 PhysicsActor* physicsActor = (PhysicsActor*)csActor;
162 SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "PhysicsActor const & type is null", 0);
165 unsigned int result=0;
169 result = physicsActor->GetId();
171 CALL_CATCH_EXCEPTION(0);
176 SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_PhysicsActor_GetBody(void* csActor)
178 PhysicsActor* physicsActor = (PhysicsActor*)csActor;
181 SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "PhysicsActor const & type is null", 0);
188 result = physicsActor->GetBody();
190 CALL_CATCH_EXCEPTION(0);
192 // Heap allocate a new Any wrapper
193 return new Dali::Any((const Dali::Any&)result);
197 SWIGEXPORT void SWIGSTDCALL CSharp_Dali_PhysicsActor_AsyncSetPhysicsPosition(void* csActor, void* csPosition)
199 PhysicsActor* physicsActor = (PhysicsActor*)csActor;
202 SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "PhysicsActor const & type is null", 0);
207 SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Dali::Vector3 const & type is null", 0);
213 physicsActor->AsyncSetPhysicsPosition(*(Dali::Vector3*)(csPosition));
215 CALL_CATCH_EXCEPTION();
219 SWIGEXPORT void SWIGSTDCALL CSharp_Dali_PhysicsActor_AsyncSetPhysicsRotation(void* csActor, void* csRotation)
221 PhysicsActor* physicsActor = (PhysicsActor*)csActor;
224 SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "PhysicsActor const & type is null", 0);
229 SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Dali::Quaternion const & type is null", 0);
235 physicsActor->AsyncSetPhysicsRotation(*(Dali::Quaternion*)(csRotation));
237 CALL_CATCH_EXCEPTION();
241 SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_PhysicsActor_GetPhysicsPosition(void* csActor)
243 PhysicsActor* physicsActor = (PhysicsActor*)csActor;
246 SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "PhysicsActor const & type is null", 0);
249 Dali::Vector3 result;
253 result = physicsActor->GetPhysicsPosition();
255 CALL_CATCH_EXCEPTION(0);
257 return new Dali::Vector3((const Dali::Vector3&)result);
260 SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_PhysicsActor_GetPhysicsRotation(void* csActor)
262 PhysicsActor* physicsActor = (PhysicsActor*)csActor;
265 SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "PhysicsActor const & type is null", 0);
268 Dali::Quaternion result;
272 result = physicsActor->GetPhysicsRotation();
274 CALL_CATCH_EXCEPTION(0);
276 return new Dali::Quaternion((const Dali::Quaternion&)result);
279 SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_PhysicsActor_GetActorPosition(void* csActor)
281 PhysicsActor* physicsActor = (PhysicsActor*)csActor;
284 SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "PhysicsActor const & type is null", 0);
287 Dali::Vector3 result;
291 result = physicsActor->GetActorPosition();
293 CALL_CATCH_EXCEPTION(0);
295 return new Dali::Vector3((const Dali::Vector3&)result);
298 SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_PhysicsActor_GetActorRotation(void* csActor)
300 PhysicsActor* physicsActor = (PhysicsActor*)csActor;
303 SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "PhysicsActor const & type is null", 0);
306 Dali::Quaternion result;
310 result = physicsActor->GetActorRotation();
312 CALL_CATCH_EXCEPTION(0);
314 return new Dali::Quaternion((const Dali::Quaternion&)result);