* limitations under the License.
*
*/
-
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
namespace Tizen.NUI.Scene3D
{
internal static partial class Interop
{
internal static partial class Model
- {
+ {
[global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Model_New_SWIG_0")]
public static extern global::System.IntPtr ModelNew(string modelUrl, string resourcePasth);
[global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Model_LoadFacialAnimation_2")]
public static extern global::System.IntPtr LoadBlendShapeAnimationFromBuffer(global::System.Runtime.InteropServices.HandleRef model, string jsonBuffer, int jsonBufferLength);
+
+ // Signals
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Model_MeshHitSignal_Connect")]
+ public static extern void MeshHitSignalConnect(global::System.Runtime.InteropServices.HandleRef model, global::System.Runtime.InteropServices.HandleRef handler);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_MotionData_MeshHitSignal_Disconnect")]
+ public static extern void MeshHitSignalDisconnect(global::System.Runtime.InteropServices.HandleRef model, global::System.Runtime.InteropServices.HandleRef handler);
}
}
}
*
*/
+using System;
+using System.Runtime.InteropServices;
+
namespace Tizen.NUI.Scene3D
{
internal static partial class Interop
{
internal static partial class ModelNode
{
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct Vec3
+ {
+ internal float x, y, z;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct ElementIndex
+ {
+ internal Int32 index;
+ }
+
[global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Model_Node_New_SWIG_0")]
public static extern global::System.IntPtr ModelNodeNew();
[global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Model_Node_FindChildModelNodeByName")]
public static extern global::System.IntPtr FindChildModelNodeByName(global::System.Runtime.InteropServices.HandleRef model, string nodeName);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Model_Node_GetChildModelNodeCount")]
+ public static extern uint GetChildModelNodeCount(global::System.Runtime.InteropServices.HandleRef model);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_Model_Node_GetChildModelNodeAt")]
+ public static extern global::System.IntPtr GetChildModelNodeAt(global::System.Runtime.InteropServices.HandleRef model, uint index);
+
+ [global::System.Runtime.InteropServices.DllImport(Libraries.Scene3D, EntryPoint = "CSharp_Dali_ModelNode_SetColliderMesh")]
+ public static extern global::System.IntPtr SetColliderMesh(global::System.Runtime.InteropServices.HandleRef modelNode,
+ Vec3[] vPtr,
+ Vec3[] nPtr, int vLength, int[] iPtr, int iLength);
}
}
}
*/
using System;
+using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.ComponentModel;
using Tizen.NUI;
{
Interop.Model.DeleteModel(swigCPtr);
}
+
+
+ private EventHandler<MeshHitEventArgs> meshHitEventHandler;
+ private MeshHitCallbackType meshHitCallback;
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ private delegate void MeshHitCallbackType(IntPtr motionData);
+
+ /// <summary>
+ /// MeshHitEventArgs
+ /// Contains arguments when MeshHitSignal called
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class MeshHitEventArgs : EventArgs
+ {
+ private ModelNode modelNode;
+
+ /// <summary>
+ /// ModelNode that's been hit
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ModelNode ModelNode
+ {
+ get
+ {
+ return modelNode;
+ }
+ set
+ {
+ modelNode = value;
+ }
+ }
+ }
+
+ /// <summary>
+ /// EventHandler event.
+ /// It will be invoked when collider mesh is hit.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler<MeshHitEventArgs> ColliderMeshHitted
+ {
+ add
+ {
+ if (meshHitEventHandler == null)
+ {
+ meshHitCallback = MeshHitCollision;
+ Interop.Model.MeshHitSignalConnect(SwigCPtr, meshHitCallback.ToHandleRef(this));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+ meshHitEventHandler += value;
+ }
+ remove
+ {
+ meshHitEventHandler -= value;
+ if (meshHitEventHandler == null && meshHitCallback != null)
+ {
+ Interop.Model.MeshHitSignalDisconnect(SwigCPtr, meshHitCallback.ToHandleRef(this));
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ meshHitCallback = null;
+ }
+ }
+ }
+
+ private void MeshHitCollision(IntPtr modelNode)
+ {
+ if (meshHitEventHandler != null)
+ {
+ var args = new MeshHitEventArgs();
+ args.ModelNode = new ModelNode(modelNode, false);
+ meshHitEventHandler(this, args);
+ }
+ }
}
}
*/
using System;
+using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.ComponentModel;
using Tizen.NUI;
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
+
+ /// <summary>
+ /// Sets collider mesh on current node
+ /// </summary>
+ /// <param name="vertexList">List of vertices</param>
+ /// <param name="normalList">List of vertex normals</param>
+ /// <param name="indexList">List of mesh indices</param>
+ // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void SetColliderMesh(List<Vector3> vertexList, List<Vector3> normalList, List<int> indexList)
+ {
+ var vertices = new Interop.ModelNode.Vec3[vertexList.Count];
+ var idx = 0;
+ foreach (var vertex in vertexList)
+ {
+ vertices[idx].x = vertex.X;
+ vertices[idx].y = vertex.Y;
+ vertices[idx].z = vertex.Z;
+ ++idx;
+ }
+
+ var normals = new Interop.ModelNode.Vec3[normalList.Count];
+ idx = 0;
+ foreach (var normal in normalList)
+ {
+ normals[idx].x = normal.X;
+ normals[idx].y = normal.Y;
+ normals[idx].z = normal.Z;
+ ++idx;
+ }
+
+ Interop.ModelNode.SetColliderMesh(SwigCPtr,vertices, normals, vertexList.Count, indexList.ToArray(), indexList.Count);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
/// <summary>
/// Gets the number of ModelPrimitive objects in the ModelNode object.