Showing
142 changed files
with
4890 additions
and
0 deletions
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 | +%YAML 1.1 | ||
2 | +%TAG !u! tag:unity3d.com,2011: | ||
3 | +--- !u!21 &2100000 | ||
4 | +Material: | ||
5 | + serializedVersion: 6 | ||
6 | + m_ObjectHideFlags: 0 | ||
7 | + m_CorrespondingSourceObject: {fileID: 0} | ||
8 | + m_PrefabInstance: {fileID: 0} | ||
9 | + m_PrefabAsset: {fileID: 0} | ||
10 | + m_Name: BoneMaterial | ||
11 | + m_Shader: {fileID: 200, guid: 0000000000000000f000000000000000, type: 0} | ||
12 | + m_ShaderKeywords: | ||
13 | + m_LightmapFlags: 4 | ||
14 | + m_EnableInstancingVariants: 0 | ||
15 | + m_DoubleSidedGI: 0 | ||
16 | + m_CustomRenderQueue: -1 | ||
17 | + stringTagMap: {} | ||
18 | + disabledShaderPasses: [] | ||
19 | + m_SavedProperties: | ||
20 | + serializedVersion: 3 | ||
21 | + m_TexEnvs: | ||
22 | + - _MainTex: | ||
23 | + m_Texture: {fileID: 0} | ||
24 | + m_Scale: {x: 1, y: 1} | ||
25 | + m_Offset: {x: 0, y: 0} | ||
26 | + m_Floats: | ||
27 | + - _InvFade: 1 | ||
28 | + m_Colors: | ||
29 | + - _Color: {r: 1, g: 1, b: 1, a: 1} | ||
30 | + - _TintColor: {r: 0.5, g: 0.5, b: 0.5, a: 0.5} |
1 | +using UnityEngine; | ||
2 | +using System.Collections; | ||
3 | +using Windows.Kinect; | ||
4 | + | ||
5 | +public class BodySourceManager : MonoBehaviour | ||
6 | +{ | ||
7 | + private KinectSensor _Sensor; | ||
8 | + private BodyFrameReader _Reader; | ||
9 | + private Body[] _Data = null; | ||
10 | + | ||
11 | + public Body[] GetData() | ||
12 | + { | ||
13 | + return _Data; | ||
14 | + } | ||
15 | + | ||
16 | + | ||
17 | + void Start () | ||
18 | + { | ||
19 | + _Sensor = KinectSensor.GetDefault(); | ||
20 | + | ||
21 | + if (_Sensor != null) | ||
22 | + { | ||
23 | + _Reader = _Sensor.BodyFrameSource.OpenReader(); | ||
24 | + | ||
25 | + if (!_Sensor.IsOpen) | ||
26 | + { | ||
27 | + _Sensor.Open(); | ||
28 | + } | ||
29 | + } | ||
30 | + } | ||
31 | + | ||
32 | + void Update () | ||
33 | + { | ||
34 | + if (_Reader != null) | ||
35 | + { | ||
36 | + var frame = _Reader.AcquireLatestFrame(); | ||
37 | + if (frame != null) | ||
38 | + { | ||
39 | + if (_Data == null) | ||
40 | + { | ||
41 | + _Data = new Body[_Sensor.BodyFrameSource.BodyCount]; | ||
42 | + } | ||
43 | + | ||
44 | + frame.GetAndRefreshBodyData(_Data); | ||
45 | + | ||
46 | + frame.Dispose(); | ||
47 | + frame = null; | ||
48 | + } | ||
49 | + } | ||
50 | + } | ||
51 | + | ||
52 | + void OnApplicationQuit() | ||
53 | + { | ||
54 | + if (_Reader != null) | ||
55 | + { | ||
56 | + _Reader.Dispose(); | ||
57 | + _Reader = null; | ||
58 | + } | ||
59 | + | ||
60 | + if (_Sensor != null) | ||
61 | + { | ||
62 | + if (_Sensor.IsOpen) | ||
63 | + { | ||
64 | + _Sensor.Close(); | ||
65 | + } | ||
66 | + | ||
67 | + _Sensor = null; | ||
68 | + } | ||
69 | + } | ||
70 | +} |
1 | +using UnityEngine; | ||
2 | +using System.Collections; | ||
3 | +using System.Collections.Generic; | ||
4 | +using Kinect = Windows.Kinect; | ||
5 | + | ||
6 | +public class BodySourceView : MonoBehaviour | ||
7 | +{ | ||
8 | + public Material BoneMaterial; | ||
9 | + public GameObject BodySourceManager; | ||
10 | + | ||
11 | + private Dictionary<ulong, GameObject> _Bodies = new Dictionary<ulong, GameObject>(); | ||
12 | + private BodySourceManager _BodyManager; | ||
13 | + | ||
14 | + private Dictionary<Kinect.JointType, Kinect.JointType> _BoneMap = new Dictionary<Kinect.JointType, Kinect.JointType>() | ||
15 | + { | ||
16 | + { Kinect.JointType.FootLeft, Kinect.JointType.AnkleLeft }, | ||
17 | + { Kinect.JointType.AnkleLeft, Kinect.JointType.KneeLeft }, | ||
18 | + { Kinect.JointType.KneeLeft, Kinect.JointType.HipLeft }, | ||
19 | + { Kinect.JointType.HipLeft, Kinect.JointType.SpineBase }, | ||
20 | + | ||
21 | + { Kinect.JointType.FootRight, Kinect.JointType.AnkleRight }, | ||
22 | + { Kinect.JointType.AnkleRight, Kinect.JointType.KneeRight }, | ||
23 | + { Kinect.JointType.KneeRight, Kinect.JointType.HipRight }, | ||
24 | + { Kinect.JointType.HipRight, Kinect.JointType.SpineBase }, | ||
25 | + | ||
26 | + { Kinect.JointType.HandTipLeft, Kinect.JointType.HandLeft }, | ||
27 | + { Kinect.JointType.ThumbLeft, Kinect.JointType.HandLeft }, | ||
28 | + { Kinect.JointType.HandLeft, Kinect.JointType.WristLeft }, | ||
29 | + { Kinect.JointType.WristLeft, Kinect.JointType.ElbowLeft }, | ||
30 | + { Kinect.JointType.ElbowLeft, Kinect.JointType.ShoulderLeft }, | ||
31 | + { Kinect.JointType.ShoulderLeft, Kinect.JointType.SpineShoulder }, | ||
32 | + | ||
33 | + { Kinect.JointType.HandTipRight, Kinect.JointType.HandRight }, | ||
34 | + { Kinect.JointType.ThumbRight, Kinect.JointType.HandRight }, | ||
35 | + { Kinect.JointType.HandRight, Kinect.JointType.WristRight }, | ||
36 | + { Kinect.JointType.WristRight, Kinect.JointType.ElbowRight }, | ||
37 | + { Kinect.JointType.ElbowRight, Kinect.JointType.ShoulderRight }, | ||
38 | + { Kinect.JointType.ShoulderRight, Kinect.JointType.SpineShoulder }, | ||
39 | + | ||
40 | + { Kinect.JointType.SpineBase, Kinect.JointType.SpineMid }, | ||
41 | + { Kinect.JointType.SpineMid, Kinect.JointType.SpineShoulder }, | ||
42 | + { Kinect.JointType.SpineShoulder, Kinect.JointType.Neck }, | ||
43 | + { Kinect.JointType.Neck, Kinect.JointType.Head }, | ||
44 | + }; | ||
45 | + | ||
46 | + void Update () | ||
47 | + { | ||
48 | + if (BodySourceManager == null) | ||
49 | + { | ||
50 | + return; | ||
51 | + } | ||
52 | + | ||
53 | + _BodyManager = BodySourceManager.GetComponent<BodySourceManager>(); | ||
54 | + if (_BodyManager == null) | ||
55 | + { | ||
56 | + return; | ||
57 | + } | ||
58 | + | ||
59 | + Kinect.Body[] data = _BodyManager.GetData(); | ||
60 | + if (data == null) | ||
61 | + { | ||
62 | + return; | ||
63 | + } | ||
64 | + | ||
65 | + List<ulong> trackedIds = new List<ulong>(); | ||
66 | + foreach(var body in data) | ||
67 | + { | ||
68 | + if (body == null) | ||
69 | + { | ||
70 | + continue; | ||
71 | + } | ||
72 | + | ||
73 | + if(body.IsTracked) | ||
74 | + { | ||
75 | + trackedIds.Add (body.TrackingId); | ||
76 | + } | ||
77 | + } | ||
78 | + | ||
79 | + List<ulong> knownIds = new List<ulong>(_Bodies.Keys); | ||
80 | + | ||
81 | + // First delete untracked bodies | ||
82 | + foreach(ulong trackingId in knownIds) | ||
83 | + { | ||
84 | + if(!trackedIds.Contains(trackingId)) | ||
85 | + { | ||
86 | + Destroy(_Bodies[trackingId]); | ||
87 | + _Bodies.Remove(trackingId); | ||
88 | + } | ||
89 | + } | ||
90 | + | ||
91 | + foreach(var body in data) | ||
92 | + { | ||
93 | + if (body == null) | ||
94 | + { | ||
95 | + continue; | ||
96 | + } | ||
97 | + | ||
98 | + if(body.IsTracked) | ||
99 | + { | ||
100 | + if(!_Bodies.ContainsKey(body.TrackingId)) | ||
101 | + { | ||
102 | + _Bodies[body.TrackingId] = CreateBodyObject(body.TrackingId); | ||
103 | + | ||
104 | + } | ||
105 | + RefreshBodyObject(body, _Bodies[body.TrackingId]); | ||
106 | + } | ||
107 | + } | ||
108 | + } | ||
109 | + | ||
110 | + private GameObject CreateBodyObject(ulong id) | ||
111 | + { | ||
112 | + GameObject body = new GameObject("Body:" + id); | ||
113 | + | ||
114 | + for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++) | ||
115 | + { | ||
116 | + GameObject jointObj = GameObject.CreatePrimitive(PrimitiveType.Cube); | ||
117 | + | ||
118 | + LineRenderer lr = jointObj.AddComponent<LineRenderer>(); | ||
119 | + lr.SetVertexCount(2); | ||
120 | + lr.material = BoneMaterial; | ||
121 | + lr.SetWidth(0.05f, 0.05f); | ||
122 | + | ||
123 | + jointObj.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f); | ||
124 | + jointObj.name = jt.ToString(); | ||
125 | + jointObj.transform.parent = body.transform; | ||
126 | + } | ||
127 | + | ||
128 | + return body; | ||
129 | + } | ||
130 | + | ||
131 | + private void RefreshBodyObject(Kinect.Body body, GameObject bodyObject) | ||
132 | + { | ||
133 | + | ||
134 | + for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++) | ||
135 | + { | ||
136 | + Kinect.Joint sourceJoint = body.Joints[jt]; | ||
137 | + Debug.Log(body.Joints[jt].JointType); | ||
138 | + Debug.Log(sourceJoint.Position.X * 10); | ||
139 | + Debug.Log(sourceJoint.Position.Y * 10); | ||
140 | + Debug.Log(sourceJoint.Position.Z * 10); | ||
141 | + Kinect.Joint? targetJoint = null; | ||
142 | + | ||
143 | + if(_BoneMap.ContainsKey(jt)) | ||
144 | + { | ||
145 | + targetJoint = body.Joints[_BoneMap[jt]]; | ||
146 | + } | ||
147 | + Transform jointObj = bodyObject.transform.Find(jt.ToString()); | ||
148 | + jointObj.localPosition = GetVector3FromJoint(sourceJoint); | ||
149 | + | ||
150 | + LineRenderer lr = jointObj.GetComponent<LineRenderer>(); | ||
151 | + if(targetJoint.HasValue) | ||
152 | + { | ||
153 | + lr.SetPosition(0, jointObj.localPosition); | ||
154 | + lr.SetPosition(1, GetVector3FromJoint(targetJoint.Value)); | ||
155 | + lr.SetColors(GetColorForState (sourceJoint.TrackingState), GetColorForState(targetJoint.Value.TrackingState)); | ||
156 | + } | ||
157 | + else | ||
158 | + { | ||
159 | + lr.enabled = false; | ||
160 | + } | ||
161 | + } | ||
162 | + } | ||
163 | + | ||
164 | + private static Color GetColorForState(Kinect.TrackingState state) | ||
165 | + { | ||
166 | + switch (state) | ||
167 | + { | ||
168 | + case Kinect.TrackingState.Tracked: | ||
169 | + return Color.green; | ||
170 | + | ||
171 | + case Kinect.TrackingState.Inferred: | ||
172 | + return Color.red; | ||
173 | + | ||
174 | + default: | ||
175 | + return Color.black; | ||
176 | + } | ||
177 | + } | ||
178 | + | ||
179 | + private static Vector3 GetVector3FromJoint(Kinect.Joint joint) | ||
180 | + { | ||
181 | + return new Vector3(joint.Position.X * 10, joint.Position.Y * 10, joint.Position.Z * 10); | ||
182 | + } | ||
183 | +} |
1 | +using UnityEngine; | ||
2 | +using System.Collections; | ||
3 | +using Windows.Kinect; | ||
4 | + | ||
5 | +public class ColorSourceManager : MonoBehaviour | ||
6 | +{ | ||
7 | + public int ColorWidth { get; private set; } | ||
8 | + public int ColorHeight { get; private set; } | ||
9 | + | ||
10 | + private KinectSensor _Sensor; | ||
11 | + private ColorFrameReader _Reader; | ||
12 | + private Texture2D _Texture; | ||
13 | + private byte[] _Data; | ||
14 | + | ||
15 | + public Texture2D GetColorTexture() | ||
16 | + { | ||
17 | + return _Texture; | ||
18 | + } | ||
19 | + | ||
20 | + void Start() | ||
21 | + { | ||
22 | + _Sensor = KinectSensor.GetDefault(); | ||
23 | + | ||
24 | + if (_Sensor != null) | ||
25 | + { | ||
26 | + _Reader = _Sensor.ColorFrameSource.OpenReader(); | ||
27 | + | ||
28 | + var frameDesc = _Sensor.ColorFrameSource.CreateFrameDescription(ColorImageFormat.Rgba); | ||
29 | + ColorWidth = frameDesc.Width; | ||
30 | + ColorHeight = frameDesc.Height; | ||
31 | + | ||
32 | + _Texture = new Texture2D(frameDesc.Width, frameDesc.Height, TextureFormat.RGBA32, false); | ||
33 | + _Data = new byte[frameDesc.BytesPerPixel * frameDesc.LengthInPixels]; | ||
34 | + | ||
35 | + if (!_Sensor.IsOpen) | ||
36 | + { | ||
37 | + _Sensor.Open(); | ||
38 | + } | ||
39 | + } | ||
40 | + } | ||
41 | + | ||
42 | + void Update () | ||
43 | + { | ||
44 | + if (_Reader != null) | ||
45 | + { | ||
46 | + var frame = _Reader.AcquireLatestFrame(); | ||
47 | + | ||
48 | + if (frame != null) | ||
49 | + { | ||
50 | + frame.CopyConvertedFrameDataToArray(_Data, ColorImageFormat.Rgba); | ||
51 | + _Texture.LoadRawTextureData(_Data); | ||
52 | + _Texture.Apply(); | ||
53 | + | ||
54 | + frame.Dispose(); | ||
55 | + frame = null; | ||
56 | + } | ||
57 | + } | ||
58 | + } | ||
59 | + | ||
60 | + void OnApplicationQuit() | ||
61 | + { | ||
62 | + if (_Reader != null) | ||
63 | + { | ||
64 | + _Reader.Dispose(); | ||
65 | + _Reader = null; | ||
66 | + } | ||
67 | + | ||
68 | + if (_Sensor != null) | ||
69 | + { | ||
70 | + if (_Sensor.IsOpen) | ||
71 | + { | ||
72 | + _Sensor.Close(); | ||
73 | + } | ||
74 | + | ||
75 | + _Sensor = null; | ||
76 | + } | ||
77 | + } | ||
78 | +} |
1 | +using UnityEngine; | ||
2 | +using System.Collections; | ||
3 | +using Windows.Kinect; | ||
4 | + | ||
5 | +public class ColorSourceView : MonoBehaviour | ||
6 | +{ | ||
7 | + public GameObject ColorSourceManager; | ||
8 | + private ColorSourceManager _ColorManager; | ||
9 | + | ||
10 | + void Start () | ||
11 | + { | ||
12 | + gameObject.GetComponent<Renderer>().material.SetTextureScale("_MainTex", new Vector2(-1, 1)); | ||
13 | + } | ||
14 | + | ||
15 | + void Update() | ||
16 | + { | ||
17 | + if (ColorSourceManager == null) | ||
18 | + { | ||
19 | + return; | ||
20 | + } | ||
21 | + | ||
22 | + _ColorManager = ColorSourceManager.GetComponent<ColorSourceManager>(); | ||
23 | + if (_ColorManager == null) | ||
24 | + { | ||
25 | + return; | ||
26 | + } | ||
27 | + | ||
28 | + gameObject.GetComponent<Renderer>().material.mainTexture = _ColorManager.GetColorTexture(); | ||
29 | + } | ||
30 | +} |
1 | +using UnityEngine; | ||
2 | +using System.Collections; | ||
3 | +using Windows.Kinect; | ||
4 | + | ||
5 | +public class DepthSourceManager : MonoBehaviour | ||
6 | +{ | ||
7 | + private KinectSensor _Sensor; | ||
8 | + private DepthFrameReader _Reader; | ||
9 | + private ushort[] _Data; | ||
10 | + | ||
11 | + public ushort[] GetData() | ||
12 | + { | ||
13 | + return _Data; | ||
14 | + } | ||
15 | + | ||
16 | + void Start () | ||
17 | + { | ||
18 | + _Sensor = KinectSensor.GetDefault(); | ||
19 | + | ||
20 | + if (_Sensor != null) | ||
21 | + { | ||
22 | + _Reader = _Sensor.DepthFrameSource.OpenReader(); | ||
23 | + _Data = new ushort[_Sensor.DepthFrameSource.FrameDescription.LengthInPixels]; | ||
24 | + } | ||
25 | + } | ||
26 | + | ||
27 | + void Update () | ||
28 | + { | ||
29 | + if (_Reader != null) | ||
30 | + { | ||
31 | + var frame = _Reader.AcquireLatestFrame(); | ||
32 | + if (frame != null) | ||
33 | + { | ||
34 | + frame.CopyFrameDataToArray(_Data); | ||
35 | + frame.Dispose(); | ||
36 | + frame = null; | ||
37 | + } | ||
38 | + } | ||
39 | + } | ||
40 | + | ||
41 | + void OnApplicationQuit() | ||
42 | + { | ||
43 | + if (_Reader != null) | ||
44 | + { | ||
45 | + _Reader.Dispose(); | ||
46 | + _Reader = null; | ||
47 | + } | ||
48 | + | ||
49 | + if (_Sensor != null) | ||
50 | + { | ||
51 | + if (_Sensor.IsOpen) | ||
52 | + { | ||
53 | + _Sensor.Close(); | ||
54 | + } | ||
55 | + | ||
56 | + _Sensor = null; | ||
57 | + } | ||
58 | + } | ||
59 | +} |
1 | +using UnityEngine; | ||
2 | +using System.Collections; | ||
3 | +using Windows.Kinect; | ||
4 | + | ||
5 | +public enum DepthViewMode | ||
6 | +{ | ||
7 | + SeparateSourceReaders, | ||
8 | + MultiSourceReader, | ||
9 | +} | ||
10 | + | ||
11 | +public class DepthSourceView : MonoBehaviour | ||
12 | +{ | ||
13 | + public DepthViewMode ViewMode = DepthViewMode.SeparateSourceReaders; | ||
14 | + | ||
15 | + public GameObject ColorSourceManager; | ||
16 | + public GameObject DepthSourceManager; | ||
17 | + public GameObject MultiSourceManager; | ||
18 | + | ||
19 | + private KinectSensor _Sensor; | ||
20 | + private CoordinateMapper _Mapper; | ||
21 | + private Mesh _Mesh; | ||
22 | + private Vector3[] _Vertices; | ||
23 | + private Vector2[] _UV; | ||
24 | + private int[] _Triangles; | ||
25 | + | ||
26 | + // Only works at 4 right now | ||
27 | + private const int _DownsampleSize = 4; | ||
28 | + private const double _DepthScale = 0.1f; | ||
29 | + private const int _Speed = 50; | ||
30 | + | ||
31 | + private MultiSourceManager _MultiManager; | ||
32 | + private ColorSourceManager _ColorManager; | ||
33 | + private DepthSourceManager _DepthManager; | ||
34 | + | ||
35 | + void Start() | ||
36 | + { | ||
37 | + _Sensor = KinectSensor.GetDefault(); | ||
38 | + if (_Sensor != null) | ||
39 | + { | ||
40 | + _Mapper = _Sensor.CoordinateMapper; | ||
41 | + var frameDesc = _Sensor.DepthFrameSource.FrameDescription; | ||
42 | + | ||
43 | + // Downsample to lower resolution | ||
44 | + CreateMesh(frameDesc.Width / _DownsampleSize, frameDesc.Height / _DownsampleSize); | ||
45 | + | ||
46 | + if (!_Sensor.IsOpen) | ||
47 | + { | ||
48 | + _Sensor.Open(); | ||
49 | + } | ||
50 | + } | ||
51 | + } | ||
52 | + | ||
53 | + void CreateMesh(int width, int height) | ||
54 | + { | ||
55 | + _Mesh = new Mesh(); | ||
56 | + GetComponent<MeshFilter>().mesh = _Mesh; | ||
57 | + | ||
58 | + _Vertices = new Vector3[width * height]; | ||
59 | + _UV = new Vector2[width * height]; | ||
60 | + _Triangles = new int[6 * ((width - 1) * (height - 1))]; | ||
61 | + | ||
62 | + int triangleIndex = 0; | ||
63 | + for (int y = 0; y < height; y++) | ||
64 | + { | ||
65 | + for (int x = 0; x < width; x++) | ||
66 | + { | ||
67 | + int index = (y * width) + x; | ||
68 | + | ||
69 | + _Vertices[index] = new Vector3(x, -y, 0); | ||
70 | + _UV[index] = new Vector2(((float)x / (float)width), ((float)y / (float)height)); | ||
71 | + | ||
72 | + // Skip the last row/col | ||
73 | + if (x != (width - 1) && y != (height - 1)) | ||
74 | + { | ||
75 | + int topLeft = index; | ||
76 | + int topRight = topLeft + 1; | ||
77 | + int bottomLeft = topLeft + width; | ||
78 | + int bottomRight = bottomLeft + 1; | ||
79 | + | ||
80 | + _Triangles[triangleIndex++] = topLeft; | ||
81 | + _Triangles[triangleIndex++] = topRight; | ||
82 | + _Triangles[triangleIndex++] = bottomLeft; | ||
83 | + _Triangles[triangleIndex++] = bottomLeft; | ||
84 | + _Triangles[triangleIndex++] = topRight; | ||
85 | + _Triangles[triangleIndex++] = bottomRight; | ||
86 | + } | ||
87 | + } | ||
88 | + } | ||
89 | + | ||
90 | + _Mesh.vertices = _Vertices; | ||
91 | + _Mesh.uv = _UV; | ||
92 | + _Mesh.triangles = _Triangles; | ||
93 | + _Mesh.RecalculateNormals(); | ||
94 | + } | ||
95 | + | ||
96 | + void OnGUI() | ||
97 | + { | ||
98 | + GUI.BeginGroup(new Rect(0, 0, Screen.width, Screen.height)); | ||
99 | + GUI.TextField(new Rect(Screen.width - 250 , 10, 250, 20), "DepthMode: " + ViewMode.ToString()); | ||
100 | + GUI.EndGroup(); | ||
101 | + } | ||
102 | + | ||
103 | + void Update() | ||
104 | + { | ||
105 | + if (_Sensor == null) | ||
106 | + { | ||
107 | + return; | ||
108 | + } | ||
109 | + | ||
110 | + if (Input.GetButtonDown("Fire1")) | ||
111 | + { | ||
112 | + if(ViewMode == DepthViewMode.MultiSourceReader) | ||
113 | + { | ||
114 | + ViewMode = DepthViewMode.SeparateSourceReaders; | ||
115 | + } | ||
116 | + else | ||
117 | + { | ||
118 | + ViewMode = DepthViewMode.MultiSourceReader; | ||
119 | + } | ||
120 | + } | ||
121 | + | ||
122 | + float yVal = Input.GetAxis("Horizontal"); | ||
123 | + float xVal = -Input.GetAxis("Vertical"); | ||
124 | + | ||
125 | + transform.Rotate( | ||
126 | + (xVal * Time.deltaTime * _Speed), | ||
127 | + (yVal * Time.deltaTime * _Speed), | ||
128 | + 0, | ||
129 | + Space.Self); | ||
130 | + | ||
131 | + if (ViewMode == DepthViewMode.SeparateSourceReaders) | ||
132 | + { | ||
133 | + if (ColorSourceManager == null) | ||
134 | + { | ||
135 | + return; | ||
136 | + } | ||
137 | + | ||
138 | + _ColorManager = ColorSourceManager.GetComponent<ColorSourceManager>(); | ||
139 | + if (_ColorManager == null) | ||
140 | + { | ||
141 | + return; | ||
142 | + } | ||
143 | + | ||
144 | + if (DepthSourceManager == null) | ||
145 | + { | ||
146 | + return; | ||
147 | + } | ||
148 | + | ||
149 | + _DepthManager = DepthSourceManager.GetComponent<DepthSourceManager>(); | ||
150 | + if (_DepthManager == null) | ||
151 | + { | ||
152 | + return; | ||
153 | + } | ||
154 | + | ||
155 | + gameObject.GetComponent<Renderer>().material.mainTexture = _ColorManager.GetColorTexture(); | ||
156 | + RefreshData(_DepthManager.GetData(), | ||
157 | + _ColorManager.ColorWidth, | ||
158 | + _ColorManager.ColorHeight); | ||
159 | + } | ||
160 | + else | ||
161 | + { | ||
162 | + if (MultiSourceManager == null) | ||
163 | + { | ||
164 | + return; | ||
165 | + } | ||
166 | + | ||
167 | + _MultiManager = MultiSourceManager.GetComponent<MultiSourceManager>(); | ||
168 | + if (_MultiManager == null) | ||
169 | + { | ||
170 | + return; | ||
171 | + } | ||
172 | + | ||
173 | + gameObject.GetComponent<Renderer>().material.mainTexture = _MultiManager.GetColorTexture(); | ||
174 | + | ||
175 | + RefreshData(_MultiManager.GetDepthData(), | ||
176 | + _MultiManager.ColorWidth, | ||
177 | + _MultiManager.ColorHeight); | ||
178 | + } | ||
179 | + } | ||
180 | + | ||
181 | + private void RefreshData(ushort[] depthData, int colorWidth, int colorHeight) | ||
182 | + { | ||
183 | + var frameDesc = _Sensor.DepthFrameSource.FrameDescription; | ||
184 | + | ||
185 | + ColorSpacePoint[] colorSpace = new ColorSpacePoint[depthData.Length]; | ||
186 | + _Mapper.MapDepthFrameToColorSpace(depthData, colorSpace); | ||
187 | + | ||
188 | + for (int y = 0; y < frameDesc.Height; y += _DownsampleSize) | ||
189 | + { | ||
190 | + for (int x = 0; x < frameDesc.Width; x += _DownsampleSize) | ||
191 | + { | ||
192 | + int indexX = x / _DownsampleSize; | ||
193 | + int indexY = y / _DownsampleSize; | ||
194 | + int smallIndex = (indexY * (frameDesc.Width / _DownsampleSize)) + indexX; | ||
195 | + | ||
196 | + double avg = GetAvg(depthData, x, y, frameDesc.Width, frameDesc.Height); | ||
197 | + | ||
198 | + avg = avg * _DepthScale; | ||
199 | + | ||
200 | + _Vertices[smallIndex].z = (float)avg; | ||
201 | + | ||
202 | + // Update UV mapping with CDRP | ||
203 | + var colorSpacePoint = colorSpace[(y * frameDesc.Width) + x]; | ||
204 | + _UV[smallIndex] = new Vector2(colorSpacePoint.X / colorWidth, colorSpacePoint.Y / colorHeight); | ||
205 | + } | ||
206 | + } | ||
207 | + | ||
208 | + _Mesh.vertices = _Vertices; | ||
209 | + _Mesh.uv = _UV; | ||
210 | + _Mesh.triangles = _Triangles; | ||
211 | + _Mesh.RecalculateNormals(); | ||
212 | + } | ||
213 | + | ||
214 | + private double GetAvg(ushort[] depthData, int x, int y, int width, int height) | ||
215 | + { | ||
216 | + double sum = 0.0; | ||
217 | + | ||
218 | + for (int y1 = y; y1 < y + 4; y1++) | ||
219 | + { | ||
220 | + for (int x1 = x; x1 < x + 4; x1++) | ||
221 | + { | ||
222 | + int fullIndex = (y1 * width) + x1; | ||
223 | + | ||
224 | + if (depthData[fullIndex] == 0) | ||
225 | + sum += 4500; | ||
226 | + else | ||
227 | + sum += depthData[fullIndex]; | ||
228 | + | ||
229 | + } | ||
230 | + } | ||
231 | + | ||
232 | + return sum / 16; | ||
233 | + } | ||
234 | + | ||
235 | + void OnApplicationQuit() | ||
236 | + { | ||
237 | + if (_Mapper != null) | ||
238 | + { | ||
239 | + _Mapper = null; | ||
240 | + } | ||
241 | + | ||
242 | + if (_Sensor != null) | ||
243 | + { | ||
244 | + if (_Sensor.IsOpen) | ||
245 | + { | ||
246 | + _Sensor.Close(); | ||
247 | + } | ||
248 | + | ||
249 | + _Sensor = null; | ||
250 | + } | ||
251 | + } | ||
252 | +} |
1 | +using UnityEngine; | ||
2 | +using System.Collections; | ||
3 | +using Windows.Kinect; | ||
4 | + | ||
5 | +public class InfraredSourceManager : MonoBehaviour | ||
6 | +{ | ||
7 | + private KinectSensor _Sensor; | ||
8 | + private InfraredFrameReader _Reader; | ||
9 | + private ushort[] _Data; | ||
10 | + private byte[] _RawData; | ||
11 | + | ||
12 | + // I'm not sure this makes sense for the Kinect APIs | ||
13 | + // Instead, this logic should be in the VIEW | ||
14 | + private Texture2D _Texture; | ||
15 | + | ||
16 | + public Texture2D GetInfraredTexture() | ||
17 | + { | ||
18 | + return _Texture; | ||
19 | + } | ||
20 | + | ||
21 | + void Start() | ||
22 | + { | ||
23 | + _Sensor = KinectSensor.GetDefault(); | ||
24 | + if (_Sensor != null) | ||
25 | + { | ||
26 | + _Reader = _Sensor.InfraredFrameSource.OpenReader(); | ||
27 | + var frameDesc = _Sensor.InfraredFrameSource.FrameDescription; | ||
28 | + _Data = new ushort[frameDesc.LengthInPixels]; | ||
29 | + _RawData = new byte[frameDesc.LengthInPixels * 4]; | ||
30 | + _Texture = new Texture2D(frameDesc.Width, frameDesc.Height, TextureFormat.BGRA32, false); | ||
31 | + | ||
32 | + if (!_Sensor.IsOpen) | ||
33 | + { | ||
34 | + _Sensor.Open(); | ||
35 | + } | ||
36 | + } | ||
37 | + } | ||
38 | + | ||
39 | + void Update () | ||
40 | + { | ||
41 | + if (_Reader != null) | ||
42 | + { | ||
43 | + var frame = _Reader.AcquireLatestFrame(); | ||
44 | + if (frame != null) | ||
45 | + { | ||
46 | + frame.CopyFrameDataToArray(_Data); | ||
47 | + | ||
48 | + int index = 0; | ||
49 | + foreach(var ir in _Data) | ||
50 | + { | ||
51 | + byte intensity = (byte)(ir >> 8); | ||
52 | + _RawData[index++] = intensity; | ||
53 | + _RawData[index++] = intensity; | ||
54 | + _RawData[index++] = intensity; | ||
55 | + _RawData[index++] = 255; // Alpha | ||
56 | + } | ||
57 | + | ||
58 | + _Texture.LoadRawTextureData(_RawData); | ||
59 | + _Texture.Apply(); | ||
60 | + | ||
61 | + frame.Dispose(); | ||
62 | + frame = null; | ||
63 | + } | ||
64 | + } | ||
65 | + } | ||
66 | + | ||
67 | + void OnApplicationQuit() | ||
68 | + { | ||
69 | + if (_Reader != null) | ||
70 | + { | ||
71 | + _Reader.Dispose(); | ||
72 | + _Reader = null; | ||
73 | + } | ||
74 | + | ||
75 | + if (_Sensor != null) | ||
76 | + { | ||
77 | + if (_Sensor.IsOpen) | ||
78 | + { | ||
79 | + _Sensor.Close(); | ||
80 | + } | ||
81 | + | ||
82 | + _Sensor = null; | ||
83 | + } | ||
84 | + } | ||
85 | +} |
1 | +using UnityEngine; | ||
2 | +using System.Collections; | ||
3 | + | ||
4 | +public class InfraredSourceView : MonoBehaviour | ||
5 | +{ | ||
6 | + public GameObject InfraredSourceManager; | ||
7 | + private InfraredSourceManager _InfraredManager; | ||
8 | + | ||
9 | + void Start () | ||
10 | + { | ||
11 | + gameObject.GetComponent<Renderer>().material.SetTextureScale("_MainTex", new Vector2(-1, 1)); | ||
12 | + } | ||
13 | + | ||
14 | + void Update() | ||
15 | + { | ||
16 | + if (InfraredSourceManager == null) | ||
17 | + { | ||
18 | + return; | ||
19 | + } | ||
20 | + | ||
21 | + _InfraredManager = InfraredSourceManager.GetComponent<InfraredSourceManager>(); | ||
22 | + if (_InfraredManager == null) | ||
23 | + { | ||
24 | + return; | ||
25 | + } | ||
26 | + | ||
27 | + gameObject.GetComponent<Renderer>().material.mainTexture = _InfraredManager.GetInfraredTexture(); | ||
28 | + } | ||
29 | +} |
1 | +using UnityEngine; | ||
2 | +using System.Collections; | ||
3 | +using Windows.Kinect; | ||
4 | + | ||
5 | +public class MultiSourceManager : MonoBehaviour { | ||
6 | + public int ColorWidth { get; private set; } | ||
7 | + public int ColorHeight { get; private set; } | ||
8 | + | ||
9 | + private KinectSensor _Sensor; | ||
10 | + private MultiSourceFrameReader _Reader; | ||
11 | + private Texture2D _ColorTexture; | ||
12 | + private ushort[] _DepthData; | ||
13 | + private byte[] _ColorData; | ||
14 | + | ||
15 | + public Texture2D GetColorTexture() | ||
16 | + { | ||
17 | + return _ColorTexture; | ||
18 | + } | ||
19 | + | ||
20 | + public ushort[] GetDepthData() | ||
21 | + { | ||
22 | + return _DepthData; | ||
23 | + } | ||
24 | + | ||
25 | + void Start () | ||
26 | + { | ||
27 | + _Sensor = KinectSensor.GetDefault(); | ||
28 | + | ||
29 | + if (_Sensor != null) | ||
30 | + { | ||
31 | + _Reader = _Sensor.OpenMultiSourceFrameReader(FrameSourceTypes.Color | FrameSourceTypes.Depth); | ||
32 | + | ||
33 | + var colorFrameDesc = _Sensor.ColorFrameSource.CreateFrameDescription(ColorImageFormat.Rgba); | ||
34 | + ColorWidth = colorFrameDesc.Width; | ||
35 | + ColorHeight = colorFrameDesc.Height; | ||
36 | + | ||
37 | + _ColorTexture = new Texture2D(colorFrameDesc.Width, colorFrameDesc.Height, TextureFormat.RGBA32, false); | ||
38 | + _ColorData = new byte[colorFrameDesc.BytesPerPixel * colorFrameDesc.LengthInPixels]; | ||
39 | + | ||
40 | + var depthFrameDesc = _Sensor.DepthFrameSource.FrameDescription; | ||
41 | + _DepthData = new ushort[depthFrameDesc.LengthInPixels]; | ||
42 | + | ||
43 | + if (!_Sensor.IsOpen) | ||
44 | + { | ||
45 | + _Sensor.Open(); | ||
46 | + } | ||
47 | + } | ||
48 | + } | ||
49 | + | ||
50 | + void Update () | ||
51 | + { | ||
52 | + if (_Reader != null) | ||
53 | + { | ||
54 | + var frame = _Reader.AcquireLatestFrame(); | ||
55 | + if (frame != null) | ||
56 | + { | ||
57 | + var colorFrame = frame.ColorFrameReference.AcquireFrame(); | ||
58 | + if (colorFrame != null) | ||
59 | + { | ||
60 | + var depthFrame = frame.DepthFrameReference.AcquireFrame(); | ||
61 | + if (depthFrame != null) | ||
62 | + { | ||
63 | + colorFrame.CopyConvertedFrameDataToArray(_ColorData, ColorImageFormat.Rgba); | ||
64 | + _ColorTexture.LoadRawTextureData(_ColorData); | ||
65 | + _ColorTexture.Apply(); | ||
66 | + | ||
67 | + depthFrame.CopyFrameDataToArray(_DepthData); | ||
68 | + | ||
69 | + depthFrame.Dispose(); | ||
70 | + depthFrame = null; | ||
71 | + } | ||
72 | + | ||
73 | + colorFrame.Dispose(); | ||
74 | + colorFrame = null; | ||
75 | + } | ||
76 | + | ||
77 | + frame = null; | ||
78 | + } | ||
79 | + } | ||
80 | + } | ||
81 | + | ||
82 | + void OnApplicationQuit() | ||
83 | + { | ||
84 | + if (_Reader != null) | ||
85 | + { | ||
86 | + _Reader.Dispose(); | ||
87 | + _Reader = null; | ||
88 | + } | ||
89 | + | ||
90 | + if (_Sensor != null) | ||
91 | + { | ||
92 | + if (_Sensor.IsOpen) | ||
93 | + { | ||
94 | + _Sensor.Close(); | ||
95 | + } | ||
96 | + | ||
97 | + _Sensor = null; | ||
98 | + } | ||
99 | + } | ||
100 | +} |
No preview for this file type
597 KB
5.28 MB
1.66 MB
1.27 MB
855 KB
3.39 MB
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 | +using System.Collections; | ||
2 | +using System.Collections.Generic; | ||
3 | +using UnityEngine; | ||
4 | +using Windows.Kinect; | ||
5 | + | ||
6 | +public class DetectJoints : MonoBehaviour | ||
7 | +{ | ||
8 | + public GameObject BodySrcManager; | ||
9 | + public JointType TrackedJoint; | ||
10 | + private BodySourceManager bodyManager; | ||
11 | + private Body[] bodies; | ||
12 | + public float multiplier = 10f; | ||
13 | + // Start is called before the first frame update | ||
14 | + void Start() | ||
15 | + { | ||
16 | + if (BodySrcManager == null) | ||
17 | + { | ||
18 | + Debug.Log("Assign Game Object with Body Source Manger"); | ||
19 | + } | ||
20 | + else | ||
21 | + { | ||
22 | + bodyManager = BodySrcManager.GetComponent<BodySourceManager>(); | ||
23 | + } | ||
24 | + } | ||
25 | + | ||
26 | + // Update is called once per frame | ||
27 | + void Update() | ||
28 | + { | ||
29 | + if (bodyManager == null) | ||
30 | + { | ||
31 | + return; | ||
32 | + } | ||
33 | + bodies = bodyManager.GetData(); | ||
34 | + | ||
35 | + if (bodies == null) | ||
36 | + { | ||
37 | + return; | ||
38 | + } | ||
39 | + | ||
40 | + foreach (var body in bodies) | ||
41 | + { | ||
42 | + if (body == null) | ||
43 | + { | ||
44 | + continue; | ||
45 | + | ||
46 | + } | ||
47 | + if (body.IsTracked) | ||
48 | + { | ||
49 | + var pos = body.Joints[TrackedJoint].Position; | ||
50 | + gameObject.transform.position = new Vector3(pos.X*multiplier, pos.Y*multiplier); | ||
51 | + } | ||
52 | + } | ||
53 | + | ||
54 | + } | ||
55 | +} |
sourcecode/capstone/Assets/Script/Move.cs
0 → 100644
1 | +using UnityEngine; | ||
2 | +using System.Collections; | ||
3 | +using System.Collections.Generic; | ||
4 | +using Kinect = Windows.Kinect; | ||
5 | +using System.Runtime.InteropServices; | ||
6 | + | ||
7 | + | ||
8 | + | ||
9 | + | ||
10 | +public class Move : MonoBehaviour | ||
11 | +{ | ||
12 | +// [DllImport("NtKinectDll")] | ||
13 | +// private static extern System.IntPtr getKinect(); | ||
14 | +// [DllImport("NtKinectDll")] | ||
15 | +// private static extern int setSkeleton(System.IntPtr kinect, System.IntPtr data, System.IntPtr state, System.IntPtr id); | ||
16 | + | ||
17 | + int bodyCount = 6; | ||
18 | + int jointCount = 25; | ||
19 | + | ||
20 | + public Material BoneMaterial; | ||
21 | + public GameObject BodySourceManager; | ||
22 | + private Dictionary<ulong, GameObject> _Bodies = new Dictionary<ulong, GameObject>(); | ||
23 | + private BodySourceManager _BodyManager; | ||
24 | + | ||
25 | + public GameObject humanoid; | ||
26 | + CharacterSkeleton skeleton; | ||
27 | + public bool mirror = true; | ||
28 | + public bool move = true; | ||
29 | + private System.IntPtr kinect; | ||
30 | + | ||
31 | + void Start() | ||
32 | + { | ||
33 | + skeleton = new CharacterSkeleton(humanoid); | ||
34 | + } | ||
35 | + | ||
36 | + private Dictionary<Kinect.JointType, Kinect.JointType> _BoneMap = new Dictionary<Kinect.JointType, Kinect.JointType>() | ||
37 | + { | ||
38 | + { Kinect.JointType.FootLeft, Kinect.JointType.AnkleLeft }, | ||
39 | + { Kinect.JointType.AnkleLeft, Kinect.JointType.KneeLeft }, | ||
40 | + { Kinect.JointType.KneeLeft, Kinect.JointType.HipLeft }, | ||
41 | + { Kinect.JointType.HipLeft, Kinect.JointType.SpineBase }, | ||
42 | + | ||
43 | + { Kinect.JointType.FootRight, Kinect.JointType.AnkleRight }, | ||
44 | + { Kinect.JointType.AnkleRight, Kinect.JointType.KneeRight }, | ||
45 | + { Kinect.JointType.KneeRight, Kinect.JointType.HipRight }, | ||
46 | + { Kinect.JointType.HipRight, Kinect.JointType.SpineBase }, | ||
47 | + | ||
48 | + { Kinect.JointType.HandTipLeft, Kinect.JointType.HandLeft }, | ||
49 | + { Kinect.JointType.ThumbLeft, Kinect.JointType.HandLeft }, | ||
50 | + { Kinect.JointType.HandLeft, Kinect.JointType.WristLeft }, | ||
51 | + { Kinect.JointType.WristLeft, Kinect.JointType.ElbowLeft }, | ||
52 | + { Kinect.JointType.ElbowLeft, Kinect.JointType.ShoulderLeft }, | ||
53 | + { Kinect.JointType.ShoulderLeft, Kinect.JointType.SpineShoulder }, | ||
54 | + | ||
55 | + { Kinect.JointType.HandTipRight, Kinect.JointType.HandRight }, | ||
56 | + { Kinect.JointType.ThumbRight, Kinect.JointType.HandRight }, | ||
57 | + { Kinect.JointType.HandRight, Kinect.JointType.WristRight }, | ||
58 | + { Kinect.JointType.WristRight, Kinect.JointType.ElbowRight }, | ||
59 | + { Kinect.JointType.ElbowRight, Kinect.JointType.ShoulderRight }, | ||
60 | + { Kinect.JointType.ShoulderRight, Kinect.JointType.SpineShoulder }, | ||
61 | + | ||
62 | + { Kinect.JointType.SpineBase, Kinect.JointType.SpineMid }, | ||
63 | + { Kinect.JointType.SpineMid, Kinect.JointType.SpineShoulder }, | ||
64 | + { Kinect.JointType.SpineShoulder, Kinect.JointType.Neck }, | ||
65 | + { Kinect.JointType.Neck, Kinect.JointType.Head }, | ||
66 | + }; | ||
67 | + | ||
68 | + void Update() | ||
69 | + { | ||
70 | + float[] data1 = new float[bodyCount * jointCount * 3]; | ||
71 | + int[] state = new int[bodyCount * jointCount]; | ||
72 | + int[] id = new int[bodyCount]; | ||
73 | + GCHandle gch = GCHandle.Alloc(data1, GCHandleType.Pinned); | ||
74 | + GCHandle gch2 = GCHandle.Alloc(state, GCHandleType.Pinned); | ||
75 | + GCHandle gch3 = GCHandle.Alloc(id, GCHandleType.Pinned); | ||
76 | + | ||
77 | + if (BodySourceManager == null) | ||
78 | + { | ||
79 | + return; | ||
80 | + } | ||
81 | + | ||
82 | + _BodyManager = BodySourceManager.GetComponent<BodySourceManager>(); | ||
83 | + if (_BodyManager == null) | ||
84 | + { | ||
85 | + return; | ||
86 | + } | ||
87 | + | ||
88 | + Kinect.Body[] data = _BodyManager.GetData(); | ||
89 | + if (data == null) | ||
90 | + { | ||
91 | + return; | ||
92 | + } | ||
93 | + | ||
94 | + List<ulong> trackedIds = new List<ulong>(); | ||
95 | + foreach (var body in data) | ||
96 | + { | ||
97 | + if (body == null) | ||
98 | + { | ||
99 | + continue; | ||
100 | + } | ||
101 | + | ||
102 | + if (body.IsTracked) | ||
103 | + { | ||
104 | + | ||
105 | + trackedIds.Add(body.TrackingId); | ||
106 | + } | ||
107 | + } | ||
108 | + | ||
109 | + List<ulong> knownIds = new List<ulong>(_Bodies.Keys); | ||
110 | + | ||
111 | + // First delete untracked bodies | ||
112 | + foreach (ulong trackingId in knownIds) | ||
113 | + { | ||
114 | + if (!trackedIds.Contains(trackingId)) | ||
115 | + { | ||
116 | + Destroy(_Bodies[trackingId]); | ||
117 | + _Bodies.Remove(trackingId); | ||
118 | + } | ||
119 | + } | ||
120 | + | ||
121 | + foreach (var body in data) | ||
122 | + { | ||
123 | + if (body == null) | ||
124 | + { | ||
125 | + continue; | ||
126 | + } | ||
127 | + | ||
128 | + if (body.IsTracked) | ||
129 | + { | ||
130 | + if (!_Bodies.ContainsKey(body.TrackingId)) | ||
131 | + { | ||
132 | + | ||
133 | + _Bodies[body.TrackingId] = CreateBodyObject(body.TrackingId); | ||
134 | + | ||
135 | + } | ||
136 | + RefreshBodyObject(body, _Bodies[body.TrackingId]); | ||
137 | + } | ||
138 | + } | ||
139 | + } | ||
140 | + | ||
141 | + private GameObject CreateBodyObject(ulong id) | ||
142 | + { | ||
143 | + | ||
144 | + GameObject body = new GameObject("Body:" + id); | ||
145 | + | ||
146 | + for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++) | ||
147 | + { | ||
148 | + GameObject jointObj = GameObject.CreatePrimitive(PrimitiveType.Cube); | ||
149 | + LineRenderer lr = jointObj.AddComponent<LineRenderer>(); | ||
150 | + lr.SetVertexCount(2); | ||
151 | + lr.material = BoneMaterial; | ||
152 | + lr.SetWidth(0.05f, 0.05f); | ||
153 | + | ||
154 | + jointObj.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f); | ||
155 | + jointObj.name = jt.ToString(); | ||
156 | + jointObj.transform.parent = body.transform; | ||
157 | + } | ||
158 | + | ||
159 | + return body; | ||
160 | + } | ||
161 | + | ||
162 | + private void RefreshBodyObject(Kinect.Body body, GameObject bodyObject) | ||
163 | + { | ||
164 | + float[] data1 = new float[bodyCount * jointCount * 3]; | ||
165 | + int[] state = new int[bodyCount * jointCount]; | ||
166 | + int[] id1 = new int[bodyCount]; | ||
167 | + GCHandle gch = GCHandle.Alloc(data1, GCHandleType.Pinned); | ||
168 | + GCHandle gch2 = GCHandle.Alloc(state, GCHandleType.Pinned); | ||
169 | + GCHandle gch3 = GCHandle.Alloc(id1, GCHandleType.Pinned); | ||
170 | + | ||
171 | + int i = -1; | ||
172 | + | ||
173 | + for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++) | ||
174 | + { | ||
175 | + Kinect.Joint sourceJoint = body.Joints[jt]; | ||
176 | + | ||
177 | + //Debug.Log("body.Joints[jt]"); | ||
178 | + //Debug.Log(body.Joints[jt]); | ||
179 | + //Debug.Log("jt"); | ||
180 | + //Debug.Log(jt); | ||
181 | + //Debug.Log(body.Joints[jt].JointType); | ||
182 | + //Debug.Log(sourceJoint.Position.X * 10); | ||
183 | + //Debug.Log(sourceJoint.Position.Y * 10); | ||
184 | + //Debug.Log(sourceJoint.Position.Z * 10); | ||
185 | + Kinect.Joint? targetJoint = null; | ||
186 | + | ||
187 | + if (_BoneMap.ContainsKey(jt)) | ||
188 | + { | ||
189 | + targetJoint = body.Joints[_BoneMap[jt]]; | ||
190 | + } | ||
191 | + Transform jointObj = bodyObject.transform.Find(jt.ToString()); | ||
192 | + jointObj.localPosition = GetVector3FromJoint(sourceJoint); | ||
193 | + | ||
194 | + //Debug.Log(i); | ||
195 | + | ||
196 | + i++; | ||
197 | + data1[i] = sourceJoint.Position.X; | ||
198 | + i++; | ||
199 | + data1[i] = sourceJoint.Position.Y; | ||
200 | + i++; | ||
201 | + data1[i] = sourceJoint.Position.Z; | ||
202 | + if ((sourceJoint.Position.X + sourceJoint.Position.Y + sourceJoint.Position.Z) != 0) | ||
203 | + { | ||
204 | + state[i - 2] = 1; | ||
205 | + } | ||
206 | + skeleton.dasomset(data1, state, 0, true, true, body.Joints[jt], jointObj); | ||
207 | + | ||
208 | + LineRenderer lr = jointObj.GetComponent<LineRenderer>(); | ||
209 | + if (targetJoint.HasValue) | ||
210 | + { | ||
211 | + //Debug.Log(jointObj.localPosition); | ||
212 | + //Debug.Log(GetVector3FromJoint(targetJoint.Value)); | ||
213 | + lr.SetPosition(0, jointObj.localPosition); | ||
214 | + lr.SetPosition(1, GetVector3FromJoint(targetJoint.Value)); | ||
215 | + lr.SetColors(GetColorForState(sourceJoint.TrackingState), GetColorForState(targetJoint.Value.TrackingState)); | ||
216 | + } | ||
217 | + else | ||
218 | + { | ||
219 | + lr.enabled = false; | ||
220 | + } | ||
221 | + } | ||
222 | + } | ||
223 | + | ||
224 | + private static Color GetColorForState(Kinect.TrackingState state) | ||
225 | + { | ||
226 | + switch (state) | ||
227 | + { | ||
228 | + case Kinect.TrackingState.Tracked: | ||
229 | + return Color.green; | ||
230 | + | ||
231 | + case Kinect.TrackingState.Inferred: | ||
232 | + return Color.red; | ||
233 | + | ||
234 | + default: | ||
235 | + return Color.black; | ||
236 | + } | ||
237 | + } | ||
238 | + | ||
239 | + private static Vector3 GetVector3FromJoint(Kinect.Joint joint) | ||
240 | + { | ||
241 | + return new Vector3(joint.Position.X * 10, joint.Position.Y * 10, joint.Position.Z * 10); | ||
242 | + } | ||
243 | +} |
1 | +using UnityEngine; | ||
2 | +using System.Collections; | ||
3 | +using System.Collections.Generic; | ||
4 | +using Kinect = Windows.Kinect; | ||
5 | +using System.Runtime.InteropServices; | ||
6 | + | ||
7 | +public class MoveTrainee : MonoBehaviour | ||
8 | +{ | ||
9 | + // [DllImport("NtKinectDll")] | ||
10 | + // private static extern System.IntPtr getKinect(); | ||
11 | + // [DllImport("NtKinectDll")] | ||
12 | + // private static extern int setSkeleton(System.IntPtr kinect, System.IntPtr data, System.IntPtr state, System.IntPtr id); | ||
13 | + | ||
14 | + int bodyCount = 6; | ||
15 | + int jointCount = 25; | ||
16 | + | ||
17 | + //public Material BoneMaterial; | ||
18 | + public GameObject BodySourceManager; | ||
19 | + private Dictionary<ulong, GameObject> _Bodies = new Dictionary<ulong, GameObject>(); | ||
20 | + private BodySourceManager _BodyManager; | ||
21 | + | ||
22 | + public GameObject humanoid; | ||
23 | + CharacterSkeleton skeleton; | ||
24 | + public bool mirror = true; | ||
25 | + public bool move = true; | ||
26 | + private System.IntPtr kinect; | ||
27 | + | ||
28 | + void Start() | ||
29 | + { | ||
30 | + skeleton = new CharacterSkeleton(humanoid); | ||
31 | + } | ||
32 | + | ||
33 | + private Dictionary<Kinect.JointType, Kinect.JointType> _BoneMap = new Dictionary<Kinect.JointType, Kinect.JointType>() | ||
34 | + { | ||
35 | + { Kinect.JointType.FootLeft, Kinect.JointType.AnkleLeft }, | ||
36 | + { Kinect.JointType.AnkleLeft, Kinect.JointType.KneeLeft }, | ||
37 | + { Kinect.JointType.KneeLeft, Kinect.JointType.HipLeft }, | ||
38 | + { Kinect.JointType.HipLeft, Kinect.JointType.SpineBase }, | ||
39 | + | ||
40 | + { Kinect.JointType.FootRight, Kinect.JointType.AnkleRight }, | ||
41 | + { Kinect.JointType.AnkleRight, Kinect.JointType.KneeRight }, | ||
42 | + { Kinect.JointType.KneeRight, Kinect.JointType.HipRight }, | ||
43 | + { Kinect.JointType.HipRight, Kinect.JointType.SpineBase }, | ||
44 | + | ||
45 | + { Kinect.JointType.HandTipLeft, Kinect.JointType.HandLeft }, | ||
46 | + { Kinect.JointType.ThumbLeft, Kinect.JointType.HandLeft }, | ||
47 | + { Kinect.JointType.HandLeft, Kinect.JointType.WristLeft }, | ||
48 | + { Kinect.JointType.WristLeft, Kinect.JointType.ElbowLeft }, | ||
49 | + { Kinect.JointType.ElbowLeft, Kinect.JointType.ShoulderLeft }, | ||
50 | + { Kinect.JointType.ShoulderLeft, Kinect.JointType.SpineShoulder }, | ||
51 | + | ||
52 | + { Kinect.JointType.HandTipRight, Kinect.JointType.HandRight }, | ||
53 | + { Kinect.JointType.ThumbRight, Kinect.JointType.HandRight }, | ||
54 | + { Kinect.JointType.HandRight, Kinect.JointType.WristRight }, | ||
55 | + { Kinect.JointType.WristRight, Kinect.JointType.ElbowRight }, | ||
56 | + { Kinect.JointType.ElbowRight, Kinect.JointType.ShoulderRight }, | ||
57 | + { Kinect.JointType.ShoulderRight, Kinect.JointType.SpineShoulder }, | ||
58 | + | ||
59 | + { Kinect.JointType.SpineBase, Kinect.JointType.SpineMid }, | ||
60 | + { Kinect.JointType.SpineMid, Kinect.JointType.SpineShoulder }, | ||
61 | + { Kinect.JointType.SpineShoulder, Kinect.JointType.Neck }, | ||
62 | + { Kinect.JointType.Neck, Kinect.JointType.Head }, | ||
63 | + }; | ||
64 | + | ||
65 | + void Update() | ||
66 | + { | ||
67 | + float[] data1 = new float[bodyCount * jointCount * 3]; | ||
68 | + int[] state = new int[bodyCount * jointCount]; | ||
69 | + int[] id = new int[bodyCount]; | ||
70 | + GCHandle gch = GCHandle.Alloc(data1, GCHandleType.Pinned); | ||
71 | + GCHandle gch2 = GCHandle.Alloc(state, GCHandleType.Pinned); | ||
72 | + GCHandle gch3 = GCHandle.Alloc(id, GCHandleType.Pinned); | ||
73 | + | ||
74 | + if (BodySourceManager == null) | ||
75 | + { | ||
76 | + return; | ||
77 | + } | ||
78 | + | ||
79 | + _BodyManager = BodySourceManager.GetComponent<BodySourceManager>(); | ||
80 | + if (_BodyManager == null) | ||
81 | + { | ||
82 | + return; | ||
83 | + } | ||
84 | + | ||
85 | + Kinect.Body[] data = _BodyManager.GetData(); | ||
86 | + if (data == null) | ||
87 | + { | ||
88 | + return; | ||
89 | + } | ||
90 | + | ||
91 | + List<ulong> trackedIds = new List<ulong>(); | ||
92 | + foreach (var body in data) | ||
93 | + { | ||
94 | + if (body == null) | ||
95 | + { | ||
96 | + continue; | ||
97 | + } | ||
98 | + | ||
99 | + if (body.IsTracked) | ||
100 | + { | ||
101 | + | ||
102 | + trackedIds.Add(body.TrackingId); | ||
103 | + } | ||
104 | + } | ||
105 | + | ||
106 | + List<ulong> knownIds = new List<ulong>(_Bodies.Keys); | ||
107 | + | ||
108 | + // First delete untracked bodies | ||
109 | + foreach (ulong trackingId in knownIds) | ||
110 | + { | ||
111 | + if (!trackedIds.Contains(trackingId)) | ||
112 | + { | ||
113 | + Destroy(_Bodies[trackingId]); | ||
114 | + _Bodies.Remove(trackingId); | ||
115 | + } | ||
116 | + } | ||
117 | + | ||
118 | + foreach (var body in data) | ||
119 | + { | ||
120 | + if (body == null) | ||
121 | + { | ||
122 | + continue; | ||
123 | + } | ||
124 | + | ||
125 | + if (body.IsTracked) | ||
126 | + { | ||
127 | + if (!_Bodies.ContainsKey(body.TrackingId)) | ||
128 | + { | ||
129 | + | ||
130 | + _Bodies[body.TrackingId] = CreateBodyObject(body.TrackingId); | ||
131 | + | ||
132 | + } | ||
133 | + RefreshBodyObject(body, _Bodies[body.TrackingId]); | ||
134 | + } | ||
135 | + } | ||
136 | + } | ||
137 | + | ||
138 | + private GameObject CreateBodyObject(ulong id) | ||
139 | + { | ||
140 | + | ||
141 | + GameObject body = new GameObject("Body:" + id); | ||
142 | + | ||
143 | + for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++) | ||
144 | + { | ||
145 | + GameObject jointObj = GameObject.CreatePrimitive(PrimitiveType.Cube); | ||
146 | + //LineRenderer lr = jointObj.AddComponent<LineRenderer>(); | ||
147 | + //lr.SetVertexCount(2); | ||
148 | + //lr.material = BoneMaterial; | ||
149 | + //lr.SetWidth(0.05f, 0.05f); | ||
150 | + | ||
151 | + jointObj.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f); | ||
152 | + jointObj.name = jt.ToString(); | ||
153 | + jointObj.transform.parent = body.transform; | ||
154 | + } | ||
155 | + | ||
156 | + return body; | ||
157 | + } | ||
158 | + | ||
159 | + private void RefreshBodyObject(Kinect.Body body, GameObject bodyObject) | ||
160 | + { | ||
161 | + float[] data1 = new float[bodyCount * jointCount * 3]; | ||
162 | + int[] state = new int[bodyCount * jointCount]; | ||
163 | + int[] id1 = new int[bodyCount]; | ||
164 | + GCHandle gch = GCHandle.Alloc(data1, GCHandleType.Pinned); | ||
165 | + GCHandle gch2 = GCHandle.Alloc(state, GCHandleType.Pinned); | ||
166 | + GCHandle gch3 = GCHandle.Alloc(id1, GCHandleType.Pinned); | ||
167 | + | ||
168 | + int i = -1; | ||
169 | + | ||
170 | + for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++) | ||
171 | + { | ||
172 | + Kinect.Joint sourceJoint = body.Joints[jt]; | ||
173 | + | ||
174 | + //Debug.Log("body.Joints[jt]"); | ||
175 | + //Debug.Log(body.Joints[jt]); | ||
176 | + //Debug.Log("jt"); | ||
177 | + //Debug.Log(jt); | ||
178 | + //Debug.Log(body.Joints[jt].JointType); | ||
179 | + //Debug.Log(sourceJoint.Position.X * 10); | ||
180 | + //Debug.Log(sourceJoint.Position.Y * 10); | ||
181 | + //Debug.Log(sourceJoint.Position.Z * 10); | ||
182 | + Kinect.Joint? targetJoint = null; | ||
183 | + | ||
184 | + if (_BoneMap.ContainsKey(jt)) | ||
185 | + { | ||
186 | + targetJoint = body.Joints[_BoneMap[jt]]; | ||
187 | + } | ||
188 | + Transform jointObj = bodyObject.transform.Find(jt.ToString()); | ||
189 | + jointObj.localPosition = GetVector3FromJoint(sourceJoint); | ||
190 | + | ||
191 | + //Debug.Log(i); | ||
192 | + | ||
193 | + i++; | ||
194 | + data1[i] = sourceJoint.Position.X; | ||
195 | + i++; | ||
196 | + data1[i] = sourceJoint.Position.Y; | ||
197 | + i++; | ||
198 | + data1[i] = sourceJoint.Position.Z; | ||
199 | + if ((sourceJoint.Position.X + sourceJoint.Position.Y + sourceJoint.Position.Z) != 0) | ||
200 | + { | ||
201 | + state[i - 2] = 1; | ||
202 | + } | ||
203 | + skeleton.dasomset(data1, state, 0, true, true, body.Joints[jt], jointObj); | ||
204 | + | ||
205 | + /* | ||
206 | + LineRenderer lr = jointObj.GetComponent<LineRenderer>(); | ||
207 | + if (targetJoint.HasValue) | ||
208 | + { | ||
209 | + //Debug.Log(jointObj.localPosition); | ||
210 | + //Debug.Log(GetVector3FromJoint(targetJoint.Value)); | ||
211 | + lr.SetPosition(0, jointObj.localPosition); | ||
212 | + lr.SetPosition(1, GetVector3FromJoint(targetJoint.Value)); | ||
213 | + lr.SetColors(GetColorForState(sourceJoint.TrackingState), GetColorForState(targetJoint.Value.TrackingState)); | ||
214 | + } | ||
215 | + else | ||
216 | + { | ||
217 | + lr.enabled = false; | ||
218 | + } | ||
219 | + */ | ||
220 | + } | ||
221 | + } | ||
222 | + | ||
223 | + private static Color GetColorForState(Kinect.TrackingState state) | ||
224 | + { | ||
225 | + switch (state) | ||
226 | + { | ||
227 | + case Kinect.TrackingState.Tracked: | ||
228 | + return Color.green; | ||
229 | + | ||
230 | + case Kinect.TrackingState.Inferred: | ||
231 | + return Color.red; | ||
232 | + | ||
233 | + default: | ||
234 | + return Color.black; | ||
235 | + } | ||
236 | + } | ||
237 | + | ||
238 | + private static Vector3 GetVector3FromJoint(Kinect.Joint joint) | ||
239 | + { | ||
240 | + return new Vector3(joint.Position.X * 10, joint.Position.Y * 10, joint.Position.Z * 10); | ||
241 | + } | ||
242 | +} |
1 | +using UnityEngine; | ||
2 | +using System.Collections; | ||
3 | +using System.Collections.Generic; | ||
4 | +using Kinect = Windows.Kinect; | ||
5 | +using System.Runtime.InteropServices; | ||
6 | + | ||
7 | +public class MoveTraineer : MonoBehaviour | ||
8 | +{ | ||
9 | + int bodyCount = 6; | ||
10 | + int jointCount = 25; | ||
11 | + | ||
12 | + //public Material BoneMaterial; | ||
13 | + public GameObject BodySourceManager; | ||
14 | + private Dictionary<ulong, GameObject> _Bodies = new Dictionary<ulong, GameObject>(); | ||
15 | + private BodySourceManager _BodyManager; | ||
16 | + | ||
17 | + public GameObject humanoid; | ||
18 | + CharacterSkeleton skeleton; | ||
19 | + public bool mirror = true; | ||
20 | + public bool move = true; | ||
21 | + private System.IntPtr kinect; | ||
22 | + | ||
23 | + void Start() | ||
24 | + { | ||
25 | + skeleton = new CharacterSkeleton(humanoid); | ||
26 | + } | ||
27 | + | ||
28 | + private Dictionary<Kinect.JointType, Kinect.JointType> _BoneMap = new Dictionary<Kinect.JointType, Kinect.JointType>() | ||
29 | + { | ||
30 | + { Kinect.JointType.FootLeft, Kinect.JointType.AnkleLeft }, | ||
31 | + { Kinect.JointType.AnkleLeft, Kinect.JointType.KneeLeft }, | ||
32 | + { Kinect.JointType.KneeLeft, Kinect.JointType.HipLeft }, | ||
33 | + { Kinect.JointType.HipLeft, Kinect.JointType.SpineBase }, | ||
34 | + | ||
35 | + { Kinect.JointType.FootRight, Kinect.JointType.AnkleRight }, | ||
36 | + { Kinect.JointType.AnkleRight, Kinect.JointType.KneeRight }, | ||
37 | + { Kinect.JointType.KneeRight, Kinect.JointType.HipRight }, | ||
38 | + { Kinect.JointType.HipRight, Kinect.JointType.SpineBase }, | ||
39 | + | ||
40 | + { Kinect.JointType.HandTipLeft, Kinect.JointType.HandLeft }, | ||
41 | + { Kinect.JointType.ThumbLeft, Kinect.JointType.HandLeft }, | ||
42 | + { Kinect.JointType.HandLeft, Kinect.JointType.WristLeft }, | ||
43 | + { Kinect.JointType.WristLeft, Kinect.JointType.ElbowLeft }, | ||
44 | + { Kinect.JointType.ElbowLeft, Kinect.JointType.ShoulderLeft }, | ||
45 | + { Kinect.JointType.ShoulderLeft, Kinect.JointType.SpineShoulder }, | ||
46 | + | ||
47 | + { Kinect.JointType.HandTipRight, Kinect.JointType.HandRight }, | ||
48 | + { Kinect.JointType.ThumbRight, Kinect.JointType.HandRight }, | ||
49 | + { Kinect.JointType.HandRight, Kinect.JointType.WristRight }, | ||
50 | + { Kinect.JointType.WristRight, Kinect.JointType.ElbowRight }, | ||
51 | + { Kinect.JointType.ElbowRight, Kinect.JointType.ShoulderRight }, | ||
52 | + { Kinect.JointType.ShoulderRight, Kinect.JointType.SpineShoulder }, | ||
53 | + | ||
54 | + { Kinect.JointType.SpineBase, Kinect.JointType.SpineMid }, | ||
55 | + { Kinect.JointType.SpineMid, Kinect.JointType.SpineShoulder }, | ||
56 | + { Kinect.JointType.SpineShoulder, Kinect.JointType.Neck }, | ||
57 | + { Kinect.JointType.Neck, Kinect.JointType.Head }, | ||
58 | + }; | ||
59 | + | ||
60 | + void Update() | ||
61 | + { | ||
62 | + float[] data1 = new float[bodyCount * jointCount * 3]; | ||
63 | + int[] state = new int[bodyCount * jointCount]; | ||
64 | + int[] id = new int[bodyCount]; | ||
65 | + GCHandle gch = GCHandle.Alloc(data1, GCHandleType.Pinned); | ||
66 | + GCHandle gch2 = GCHandle.Alloc(state, GCHandleType.Pinned); | ||
67 | + GCHandle gch3 = GCHandle.Alloc(id, GCHandleType.Pinned); | ||
68 | + | ||
69 | + if (BodySourceManager == null) | ||
70 | + { | ||
71 | + return; | ||
72 | + } | ||
73 | + | ||
74 | + _BodyManager = BodySourceManager.GetComponent<BodySourceManager>(); | ||
75 | + if (_BodyManager == null) | ||
76 | + { | ||
77 | + return; | ||
78 | + } | ||
79 | + | ||
80 | + Kinect.Body[] data = _BodyManager.GetData(); | ||
81 | + if (data == null) | ||
82 | + { | ||
83 | + return; | ||
84 | + } | ||
85 | + | ||
86 | + List<ulong> trackedIds = new List<ulong>(); | ||
87 | + foreach (var body in data) | ||
88 | + { | ||
89 | + if (body == null) | ||
90 | + { | ||
91 | + continue; | ||
92 | + } | ||
93 | + | ||
94 | + if (body.IsTracked) | ||
95 | + { | ||
96 | + | ||
97 | + trackedIds.Add(body.TrackingId); | ||
98 | + } | ||
99 | + } | ||
100 | + | ||
101 | + List<ulong> knownIds = new List<ulong>(_Bodies.Keys); | ||
102 | + | ||
103 | + // First delete untracked bodies | ||
104 | + foreach (ulong trackingId in knownIds) | ||
105 | + { | ||
106 | + if (!trackedIds.Contains(trackingId)) | ||
107 | + { | ||
108 | + Destroy(_Bodies[trackingId]); | ||
109 | + _Bodies.Remove(trackingId); | ||
110 | + } | ||
111 | + } | ||
112 | + | ||
113 | + foreach (var body in data) | ||
114 | + { | ||
115 | + if (body == null) | ||
116 | + { | ||
117 | + continue; | ||
118 | + } | ||
119 | + | ||
120 | + if (body.IsTracked) | ||
121 | + { | ||
122 | + if (!_Bodies.ContainsKey(body.TrackingId)) | ||
123 | + { | ||
124 | + | ||
125 | + _Bodies[body.TrackingId] = CreateBodyObject(body.TrackingId); | ||
126 | + | ||
127 | + } | ||
128 | + RefreshBodyObject(body, _Bodies[body.TrackingId]); | ||
129 | + } | ||
130 | + } | ||
131 | + } | ||
132 | + | ||
133 | + private GameObject CreateBodyObject(ulong id) | ||
134 | + { | ||
135 | + | ||
136 | + GameObject body = new GameObject("Body:" + id); | ||
137 | + | ||
138 | + for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++) | ||
139 | + { | ||
140 | + GameObject jointObj = GameObject.CreatePrimitive(PrimitiveType.Cube); | ||
141 | + //LineRenderer lr = jointObj.AddComponent<LineRenderer>(); | ||
142 | + //lr.SetVertexCount(2); | ||
143 | + //lr.material = BoneMaterial; | ||
144 | + //lr.SetWidth(0.05f, 0.05f); | ||
145 | + | ||
146 | + jointObj.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f); | ||
147 | + jointObj.name = jt.ToString(); | ||
148 | + jointObj.transform.parent = body.transform; | ||
149 | + } | ||
150 | + | ||
151 | + return body; | ||
152 | + } | ||
153 | + | ||
154 | + private void RefreshBodyObject(Kinect.Body body, GameObject bodyObject) | ||
155 | + { | ||
156 | + float[] data1 = new float[bodyCount * jointCount * 3]; | ||
157 | + int[] state = new int[bodyCount * jointCount]; | ||
158 | + int[] id1 = new int[bodyCount]; | ||
159 | + GCHandle gch = GCHandle.Alloc(data1, GCHandleType.Pinned); | ||
160 | + GCHandle gch2 = GCHandle.Alloc(state, GCHandleType.Pinned); | ||
161 | + GCHandle gch3 = GCHandle.Alloc(id1, GCHandleType.Pinned); | ||
162 | + | ||
163 | + int i = -1; | ||
164 | + | ||
165 | + for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++) | ||
166 | + { | ||
167 | + Kinect.Joint sourceJoint = body.Joints[jt]; | ||
168 | + | ||
169 | + //Debug.Log("body.Joints[jt]"); | ||
170 | + //Debug.Log(body.Joints[jt]); | ||
171 | + //Debug.Log("jt"); | ||
172 | + //Debug.Log(jt); | ||
173 | + //Debug.Log(body.Joints[jt].JointType); | ||
174 | + //Debug.Log(sourceJoint.Position.X * 10); | ||
175 | + //Debug.Log(sourceJoint.Position.Y * 10); | ||
176 | + //Debug.Log(sourceJoint.Position.Z * 10); | ||
177 | + Kinect.Joint? targetJoint = null; | ||
178 | + | ||
179 | + if (_BoneMap.ContainsKey(jt)) | ||
180 | + { | ||
181 | + targetJoint = body.Joints[_BoneMap[jt]]; | ||
182 | + } | ||
183 | + Transform jointObj = bodyObject.transform.Find(jt.ToString()); | ||
184 | + jointObj.localPosition = GetVector3FromJoint(sourceJoint); | ||
185 | + | ||
186 | + //Debug.Log(i); | ||
187 | + | ||
188 | + i++; | ||
189 | + data1[i] = sourceJoint.Position.X; | ||
190 | + i++; | ||
191 | + data1[i] = sourceJoint.Position.Y; | ||
192 | + i++; | ||
193 | + data1[i] = sourceJoint.Position.Z; | ||
194 | + if ((sourceJoint.Position.X + sourceJoint.Position.Y + sourceJoint.Position.Z) != 0) | ||
195 | + { | ||
196 | + state[i - 2] = 1; | ||
197 | + } | ||
198 | + skeleton.dasomset(data1, state, 0, true, true, body.Joints[jt], jointObj); | ||
199 | + | ||
200 | + /* | ||
201 | + LineRenderer lr = jointObj.GetComponent<LineRenderer>(); | ||
202 | + if (targetJoint.HasValue) | ||
203 | + { | ||
204 | + //Debug.Log(jointObj.localPosition); | ||
205 | + //Debug.Log(GetVector3FromJoint(targetJoint.Value)); | ||
206 | + lr.SetPosition(0, jointObj.localPosition); | ||
207 | + lr.SetPosition(1, GetVector3FromJoint(targetJoint.Value)); | ||
208 | + lr.SetColors(GetColorForState(sourceJoint.TrackingState), GetColorForState(targetJoint.Value.TrackingState)); | ||
209 | + } | ||
210 | + else | ||
211 | + { | ||
212 | + lr.enabled = false; | ||
213 | + } | ||
214 | + */ | ||
215 | + } | ||
216 | + } | ||
217 | + | ||
218 | + private static Color GetColorForState(Kinect.TrackingState state) | ||
219 | + { | ||
220 | + switch (state) | ||
221 | + { | ||
222 | + case Kinect.TrackingState.Tracked: | ||
223 | + return Color.green; | ||
224 | + | ||
225 | + case Kinect.TrackingState.Inferred: | ||
226 | + return Color.red; | ||
227 | + | ||
228 | + default: | ||
229 | + return Color.black; | ||
230 | + } | ||
231 | + } | ||
232 | + | ||
233 | + private static Vector3 GetVector3FromJoint(Kinect.Joint joint) | ||
234 | + { | ||
235 | + return new Vector3(joint.Position.X * 10, joint.Position.Y * 10, joint.Position.Z * 10); | ||
236 | + } | ||
237 | +} |
sourcecode/capstone/Assets/Script/RigBone.cs
0 → 100644
1 | +using System.Collections; | ||
2 | +using System.Collections.Generic; | ||
3 | +using UnityEngine; | ||
4 | + | ||
5 | +public class RigBone | ||
6 | +{ | ||
7 | + public GameObject gameObject; | ||
8 | + public HumanBodyBones bone; | ||
9 | + public bool isValid; | ||
10 | + public Transform transform | ||
11 | + { | ||
12 | + get { return animator.GetBoneTransform(bone); } | ||
13 | + } | ||
14 | + Animator animator; | ||
15 | + Quaternion savedValue; | ||
16 | + public RigBone(GameObject g, HumanBodyBones b) | ||
17 | + { | ||
18 | + gameObject = g; | ||
19 | + bone = b; | ||
20 | + isValid = false; | ||
21 | + animator = gameObject.GetComponent<Animator>(); | ||
22 | + if (animator == null) | ||
23 | + { | ||
24 | + Debug.Log("no Animator Component"); | ||
25 | + return; | ||
26 | + } | ||
27 | + Avatar avatar = animator.avatar; | ||
28 | + if (avatar == null || !avatar.isHuman || !avatar.isValid) | ||
29 | + { | ||
30 | + Debug.Log("Avatar is not Humanoid or it is not valid"); | ||
31 | + return; | ||
32 | + } | ||
33 | + isValid = true; | ||
34 | + savedValue = animator.GetBoneTransform(bone).localRotation; | ||
35 | + } | ||
36 | + public void set(float a, float x, float y, float z) | ||
37 | + { | ||
38 | + set(Quaternion.AngleAxis(a, new Vector3(x, y, z))); | ||
39 | + } | ||
40 | + public void set(Quaternion q) | ||
41 | + { | ||
42 | + animator.GetBoneTransform(bone).localRotation = q; | ||
43 | + savedValue = q; | ||
44 | + } | ||
45 | + public void mul(float a, float x, float y, float z) | ||
46 | + { | ||
47 | + mul(Quaternion.AngleAxis(a, new Vector3(x, y, z))); | ||
48 | + } | ||
49 | + public void mul(Quaternion q) | ||
50 | + { | ||
51 | + Transform tr = animator.GetBoneTransform(bone); | ||
52 | + tr.localRotation = q * tr.localRotation; | ||
53 | + } | ||
54 | + public void offset(float a, float x, float y, float z) | ||
55 | + { | ||
56 | + offset(Quaternion.AngleAxis(a, new Vector3(x, y, z))); | ||
57 | + } | ||
58 | + public void offset(Quaternion q) | ||
59 | + { | ||
60 | + animator.GetBoneTransform(bone).localRotation = q * savedValue; | ||
61 | + } | ||
62 | + public void changeBone(HumanBodyBones b) | ||
63 | + { | ||
64 | + bone = b; | ||
65 | + savedValue = animator.GetBoneTransform(bone).localRotation; | ||
66 | + } | ||
67 | +} |
1 | +using System.Runtime.InteropServices; | ||
2 | +using System.Collections; | ||
3 | +using System.Collections.Generic; | ||
4 | +using UnityEngine; | ||
5 | +using RootSystem = System; | ||
6 | +using System; | ||
7 | + | ||
8 | +public class RigControl : MonoBehaviour | ||
9 | +{ | ||
10 | + | ||
11 | + //[RootSystem.Runtime.InteropServices.DllImport("NtKinectDll")] | ||
12 | + [DllImport("NtKinectDll", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)] | ||
13 | + public static extern System.IntPtr getKinect(); | ||
14 | + | ||
15 | + [DllImport("NtKinectDll", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)] | ||
16 | + public static extern int setSkeleton(System.IntPtr kinect, System.IntPtr data, System.IntPtr state, System.IntPtr id); | ||
17 | + | ||
18 | + int bodyCount = 6; | ||
19 | + int jointCount = 25; | ||
20 | + private System.IntPtr kinect; | ||
21 | + | ||
22 | + public GameObject humanoid; | ||
23 | + public bool mirror = true; | ||
24 | + public bool move = true; | ||
25 | + CharacterSkeleton skeleton; | ||
26 | + | ||
27 | + void Start() | ||
28 | + { | ||
29 | + kinect = getKinect(); | ||
30 | + skeleton = new CharacterSkeleton(humanoid); | ||
31 | + } | ||
32 | + void Update() | ||
33 | + { | ||
34 | + float[] data = new float[bodyCount * jointCount * 3]; | ||
35 | + int[] state = new int[bodyCount * jointCount]; | ||
36 | + int[] id = new int[bodyCount]; | ||
37 | + GCHandle gch = GCHandle.Alloc(data, GCHandleType.Pinned); | ||
38 | + GCHandle gch2 = GCHandle.Alloc(state, GCHandleType.Pinned); | ||
39 | + GCHandle gch3 = GCHandle.Alloc(id, GCHandleType.Pinned); | ||
40 | + int n = setSkeleton(kinect, gch.AddrOfPinnedObject(), gch2.AddrOfPinnedObject(), gch3.AddrOfPinnedObject()); | ||
41 | + gch.Free(); | ||
42 | + gch2.Free(); | ||
43 | + gch3.Free(); | ||
44 | + if (n > 0) | ||
45 | + { | ||
46 | + skeleton.set(data, state, 0, mirror, move); | ||
47 | + } | ||
48 | + | ||
49 | + } | ||
50 | +} |
1 | +using RootSystem = System; | ||
2 | +using System.Linq; | ||
3 | +using System.Collections.Generic; | ||
4 | +namespace Windows.Kinect | ||
5 | +{ | ||
6 | + // | ||
7 | + // Windows.Kinect.CameraIntrinsics | ||
8 | + // | ||
9 | + [RootSystem.Runtime.InteropServices.StructLayout(RootSystem.Runtime.InteropServices.LayoutKind.Sequential)] | ||
10 | + public struct CameraIntrinsics | ||
11 | + { | ||
12 | + public float FocalLengthX { get; set; } | ||
13 | + public float FocalLengthY { get; set; } | ||
14 | + public float PrincipalPointX { get; set; } | ||
15 | + public float PrincipalPointY { get; set; } | ||
16 | + public float RadialDistortionSecondOrder { get; set; } | ||
17 | + public float RadialDistortionFourthOrder { get; set; } | ||
18 | + public float RadialDistortionSixthOrder { get; set; } | ||
19 | + | ||
20 | + public override int GetHashCode() | ||
21 | + { | ||
22 | + return FocalLengthX.GetHashCode() ^ FocalLengthY.GetHashCode() ^ | ||
23 | + PrincipalPointX.GetHashCode() ^ PrincipalPointY.GetHashCode() ^ | ||
24 | + RadialDistortionSecondOrder.GetHashCode() ^ RadialDistortionFourthOrder.GetHashCode() ^ | ||
25 | + RadialDistortionSixthOrder.GetHashCode(); | ||
26 | + } | ||
27 | + | ||
28 | + public override bool Equals(object obj) | ||
29 | + { | ||
30 | + if (!(obj is CameraIntrinsics)) | ||
31 | + { | ||
32 | + return false; | ||
33 | + } | ||
34 | + | ||
35 | + return this.Equals((CameraIntrinsics)obj); | ||
36 | + } | ||
37 | + | ||
38 | + public bool Equals(CameraIntrinsics obj) | ||
39 | + { | ||
40 | + return FocalLengthX.Equals(obj.FocalLengthX) && FocalLengthY.Equals(obj.FocalLengthY) && | ||
41 | + PrincipalPointX.Equals(obj.PrincipalPointX) && PrincipalPointY.Equals(obj.PrincipalPointY) && | ||
42 | + RadialDistortionSecondOrder.Equals(obj.RadialDistortionSecondOrder) && | ||
43 | + RadialDistortionFourthOrder.Equals(obj.RadialDistortionFourthOrder) && | ||
44 | + RadialDistortionSixthOrder.Equals(obj.RadialDistortionSixthOrder); | ||
45 | + } | ||
46 | + | ||
47 | + public static bool operator ==(CameraIntrinsics a, CameraIntrinsics b) | ||
48 | + { | ||
49 | + return a.Equals(b); | ||
50 | + } | ||
51 | + | ||
52 | + public static bool operator !=(CameraIntrinsics a, CameraIntrinsics b) | ||
53 | + { | ||
54 | + return !(a.Equals(b)); | ||
55 | + } | ||
56 | + } | ||
57 | + | ||
58 | +} |
1 | +using System; | ||
2 | +using System.Collections.Generic; | ||
3 | +using System.Linq; | ||
4 | +using System.Text; | ||
5 | + | ||
6 | +namespace Helper | ||
7 | +{ | ||
8 | + class CollectionMap<TKey, TValue> : Helper.ThreadSafeDictionary<TKey, TValue> where TValue : new() | ||
9 | + { | ||
10 | + public bool TryAddDefault(TKey key) | ||
11 | + { | ||
12 | + lock (_impl) | ||
13 | + { | ||
14 | + if (!_impl.ContainsKey(key)) | ||
15 | + { | ||
16 | + _impl.Add(key, new TValue()); | ||
17 | + return true; | ||
18 | + } | ||
19 | + else | ||
20 | + { | ||
21 | + return false; | ||
22 | + } | ||
23 | + } | ||
24 | + } | ||
25 | + } | ||
26 | +} |
1 | +using UnityEngine; | ||
2 | +using UnityEditor; | ||
3 | +using System; | ||
4 | +using System.Collections.Generic; | ||
5 | +using System.IO; | ||
6 | + | ||
7 | +public static class KinectCopyPluginDataHelper | ||
8 | +{ | ||
9 | + private const string DataDirSuffix = "_Data"; | ||
10 | + private const string PluginsDirName = "Plugins"; | ||
11 | + | ||
12 | + private static Dictionary<BuildTarget, string> TargetToDirName = new Dictionary<BuildTarget, string>() | ||
13 | + { | ||
14 | + {BuildTarget.StandaloneWindows, "x86"}, | ||
15 | + {BuildTarget.StandaloneWindows64, "x86_64"} | ||
16 | + }; | ||
17 | + | ||
18 | + public static void CopyPluginData(BuildTarget target, string buildTargetPath, string subDirToCopy) | ||
19 | + { | ||
20 | + string subDirName; | ||
21 | + if (!TargetToDirName.TryGetValue (target, out subDirName)) | ||
22 | + { | ||
23 | + // No work to do | ||
24 | + return; | ||
25 | + } | ||
26 | + | ||
27 | + // Get Required Paths | ||
28 | + var buildName = Path.GetFileNameWithoutExtension(buildTargetPath); | ||
29 | + var targetDir = Directory.GetParent(buildTargetPath); | ||
30 | + var separator = Path.DirectorySeparatorChar; | ||
31 | + | ||
32 | + var buildDataDir = targetDir.FullName + separator + buildName + DataDirSuffix + separator; | ||
33 | + var tgtPluginsDir = buildDataDir + separator + PluginsDirName + separator + subDirToCopy + separator; | ||
34 | + var srcPluginsDir = Application.dataPath + separator + PluginsDirName + separator + subDirName + separator + subDirToCopy + separator; | ||
35 | + | ||
36 | + CopyAll (new DirectoryInfo (srcPluginsDir), new DirectoryInfo(tgtPluginsDir)); | ||
37 | + } | ||
38 | + | ||
39 | + /// <summary> | ||
40 | + /// Recursive Copy Directory Method | ||
41 | + /// </summary> | ||
42 | + private static void CopyAll(DirectoryInfo source, DirectoryInfo target) | ||
43 | + { | ||
44 | + // Check if the source directory exists, if not, don't do any work. | ||
45 | + if (!Directory.Exists(source.FullName)) | ||
46 | + { | ||
47 | + return; | ||
48 | + } | ||
49 | + | ||
50 | + // Check if the target directory exists, if not, create it. | ||
51 | + if (!Directory.Exists(target.FullName)) | ||
52 | + { | ||
53 | + Directory.CreateDirectory(target.FullName); | ||
54 | + } | ||
55 | + | ||
56 | + // Copy each file into it’s new directory. | ||
57 | + foreach (var fileInfo in source.GetFiles()) | ||
58 | + { | ||
59 | + fileInfo.CopyTo (Path.Combine (target.ToString (), fileInfo.Name), true); | ||
60 | + } | ||
61 | + | ||
62 | + // Copy each subdirectory using recursion. | ||
63 | + foreach (var subDirInfo in source.GetDirectories()) | ||
64 | + { | ||
65 | + DirectoryInfo nextTargetSubDir = target.CreateSubdirectory(subDirInfo.Name); | ||
66 | + CopyAll(subDirInfo, nextTargetSubDir); | ||
67 | + } | ||
68 | + } | ||
69 | + | ||
70 | +} |
1 | +using System; | ||
2 | +using System.Collections.Generic; | ||
3 | +using System.Runtime.InteropServices; | ||
4 | +using System.Linq; | ||
5 | + | ||
6 | +namespace Helper | ||
7 | +{ | ||
8 | + internal class EventPump : UnityEngine.MonoBehaviour | ||
9 | + { | ||
10 | + private static object s_Lock = new object(); | ||
11 | + private Queue<Action> m_Queue = new Queue<Action>(); | ||
12 | + | ||
13 | + public static EventPump Instance | ||
14 | + { | ||
15 | + get; | ||
16 | + private set; | ||
17 | + } | ||
18 | + | ||
19 | + public static void EnsureInitialized() | ||
20 | + { | ||
21 | + try | ||
22 | + { | ||
23 | + if (EventPump.Instance == null) | ||
24 | + { | ||
25 | + lock (s_Lock) | ||
26 | + { | ||
27 | + if (EventPump.Instance == null) | ||
28 | + { | ||
29 | + UnityEngine.GameObject parent = new UnityEngine.GameObject("Kinect Desktop Event Pump"); | ||
30 | + EventPump.Instance = parent.AddComponent<Helper.EventPump>(); | ||
31 | + DontDestroyOnLoad(parent); | ||
32 | + } | ||
33 | + } | ||
34 | + } | ||
35 | + } | ||
36 | + catch | ||
37 | + { | ||
38 | + UnityEngine.Debug.LogError("Events must be registered on the main thread."); | ||
39 | + return; | ||
40 | + } | ||
41 | + } | ||
42 | + | ||
43 | + private void Update() | ||
44 | + { | ||
45 | + lock (m_Queue) | ||
46 | + { | ||
47 | + while (m_Queue.Count > 0) | ||
48 | + { | ||
49 | + var action = m_Queue.Dequeue(); | ||
50 | + try | ||
51 | + { | ||
52 | + action.Invoke(); | ||
53 | + } | ||
54 | + catch { } | ||
55 | + } | ||
56 | + } | ||
57 | + } | ||
58 | + | ||
59 | + private void OnApplicationQuit() | ||
60 | + { | ||
61 | + var sensor = Windows.Kinect.KinectSensor.GetDefault(); | ||
62 | + if (sensor != null && sensor.IsOpen) | ||
63 | + { | ||
64 | + sensor.Close(); | ||
65 | + } | ||
66 | + | ||
67 | + NativeObjectCache.Flush(); | ||
68 | + } | ||
69 | + | ||
70 | + public void Enqueue(Action action) | ||
71 | + { | ||
72 | + lock (m_Queue) | ||
73 | + { | ||
74 | + m_Queue.Enqueue(action); | ||
75 | + } | ||
76 | + } | ||
77 | + } | ||
78 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +using System; | ||
2 | +using System.Runtime.InteropServices; | ||
3 | + | ||
4 | +namespace Helper | ||
5 | +{ | ||
6 | + public static class ExceptionHelper | ||
7 | + { | ||
8 | + private const int E_NOTIMPL = unchecked((int)0x80004001); | ||
9 | + private const int E_OUTOFMEMORY = unchecked((int)0x8007000E); | ||
10 | + private const int E_INVALIDARG = unchecked((int)0x80070057); | ||
11 | + private const int E_POINTER = unchecked((int) 0x80004003); | ||
12 | + private const int E_PENDING = unchecked((int)0x8000000A); | ||
13 | + private const int E_FAIL = unchecked((int)0x80004005); | ||
14 | + | ||
15 | + public static void CheckLastError() | ||
16 | + { | ||
17 | + int hr = Marshal.GetLastWin32Error(); | ||
18 | + | ||
19 | + if ((hr == E_PENDING) || (hr == E_FAIL)) | ||
20 | + { | ||
21 | + // Ignore E_PENDING/E_FAIL - We use this to indicate no pending or missed frames | ||
22 | + return; | ||
23 | + } | ||
24 | + | ||
25 | + if (hr < 0) | ||
26 | + { | ||
27 | + Exception exception = Marshal.GetExceptionForHR(hr); | ||
28 | + string message = string.Format("This API has returned an exception from an HRESULT: 0x{0:X}", hr); | ||
29 | + | ||
30 | + switch (hr) | ||
31 | + { | ||
32 | + case E_NOTIMPL: | ||
33 | + throw new NotImplementedException(message, exception); | ||
34 | + | ||
35 | + case E_OUTOFMEMORY: | ||
36 | + throw new OutOfMemoryException(message, exception); | ||
37 | + | ||
38 | + case E_INVALIDARG: | ||
39 | + throw new ArgumentException(message, exception); | ||
40 | + | ||
41 | + case E_POINTER: | ||
42 | + throw new ArgumentNullException(message, exception); | ||
43 | + | ||
44 | + default: | ||
45 | + throw new InvalidOperationException(message, exception); | ||
46 | + } | ||
47 | + } | ||
48 | + } | ||
49 | + } | ||
50 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +using System; | ||
2 | +using System.Collections.Generic; | ||
3 | +using System.Runtime.InteropServices; | ||
4 | +using System.Linq; | ||
5 | + | ||
6 | +namespace Helper | ||
7 | +{ | ||
8 | + internal interface INativeWrapper | ||
9 | + { | ||
10 | + System.IntPtr nativePtr { get; } | ||
11 | + } | ||
12 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +using RootSystem = System; | ||
2 | +using System; | ||
3 | +using System.Collections.Generic; | ||
4 | +using System.Runtime.InteropServices; | ||
5 | + | ||
6 | +namespace Windows.Kinect | ||
7 | +{ | ||
8 | + // NOTE: This uses an IBuffer under the covers, it is renamed here to give parity to our managed APIs. | ||
9 | + public class KinectBuffer : Helper.INativeWrapper, IDisposable | ||
10 | + { | ||
11 | + internal RootSystem.IntPtr _pNative; | ||
12 | + | ||
13 | + RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } } | ||
14 | + | ||
15 | + // Constructors and Finalizers | ||
16 | + internal KinectBuffer(RootSystem.IntPtr pNative) | ||
17 | + { | ||
18 | + _pNative = pNative; | ||
19 | + Windows_Storage_Streams_IBuffer_AddRefObject(ref _pNative); | ||
20 | + } | ||
21 | + | ||
22 | + ~KinectBuffer() | ||
23 | + { | ||
24 | + Dispose(false); | ||
25 | + } | ||
26 | + | ||
27 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)] | ||
28 | + private static extern void Windows_Storage_Streams_IBuffer_ReleaseObject(ref RootSystem.IntPtr pNative); | ||
29 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)] | ||
30 | + private static extern void Windows_Storage_Streams_IBuffer_AddRefObject(ref RootSystem.IntPtr pNative); | ||
31 | + private void Dispose(bool disposing) | ||
32 | + { | ||
33 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
34 | + { | ||
35 | + return; | ||
36 | + } | ||
37 | + | ||
38 | + Helper.NativeObjectCache.RemoveObject<KinectBuffer>(_pNative); | ||
39 | + | ||
40 | + if (disposing) | ||
41 | + { | ||
42 | + Windows_Storage_Streams_IBuffer_Dispose(_pNative); | ||
43 | + } | ||
44 | + | ||
45 | + Windows_Storage_Streams_IBuffer_ReleaseObject(ref _pNative); | ||
46 | + | ||
47 | + _pNative = RootSystem.IntPtr.Zero; | ||
48 | + } | ||
49 | + | ||
50 | + | ||
51 | + // Public Properties | ||
52 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError = true)] | ||
53 | + private static extern uint Windows_Storage_Streams_IBuffer_get_Capacity(RootSystem.IntPtr pNative); | ||
54 | + public uint Capacity | ||
55 | + { | ||
56 | + get | ||
57 | + { | ||
58 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
59 | + { | ||
60 | + throw new RootSystem.ObjectDisposedException("KinectBuffer"); | ||
61 | + } | ||
62 | + | ||
63 | + uint capacity = Windows_Storage_Streams_IBuffer_get_Capacity(_pNative); | ||
64 | + Helper.ExceptionHelper.CheckLastError(); | ||
65 | + return capacity; | ||
66 | + } | ||
67 | + } | ||
68 | + | ||
69 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError = true)] | ||
70 | + private static extern uint Windows_Storage_Streams_IBuffer_get_Length(RootSystem.IntPtr pNative); | ||
71 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError = true)] | ||
72 | + private static extern void Windows_Storage_Streams_IBuffer_put_Length(RootSystem.IntPtr pNative, uint value); | ||
73 | + public uint Length | ||
74 | + { | ||
75 | + get | ||
76 | + { | ||
77 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
78 | + { | ||
79 | + throw new RootSystem.ObjectDisposedException("KinectBuffer"); | ||
80 | + } | ||
81 | + | ||
82 | + uint length = Windows_Storage_Streams_IBuffer_get_Length(_pNative); | ||
83 | + Helper.ExceptionHelper.CheckLastError(); | ||
84 | + return length; | ||
85 | + } | ||
86 | + set | ||
87 | + { | ||
88 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
89 | + { | ||
90 | + throw new RootSystem.ObjectDisposedException("KinectBuffer"); | ||
91 | + } | ||
92 | + | ||
93 | + Windows_Storage_Streams_IBuffer_put_Length(_pNative, value); | ||
94 | + Helper.ExceptionHelper.CheckLastError(); | ||
95 | + } | ||
96 | + } | ||
97 | + | ||
98 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)] | ||
99 | + private static extern void Windows_Storage_Streams_IBuffer_Dispose(RootSystem.IntPtr pNative); | ||
100 | + // Constructors and Finalizers | ||
101 | + public void Dispose() | ||
102 | + { | ||
103 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
104 | + { | ||
105 | + throw new RootSystem.ObjectDisposedException("KinectBuffer"); | ||
106 | + } | ||
107 | + | ||
108 | + Dispose(true); | ||
109 | + RootSystem.GC.SuppressFinalize(this); | ||
110 | + } | ||
111 | + | ||
112 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError = true)] | ||
113 | + private static extern RootSystem.IntPtr Windows_Storage_Streams_IBuffer_get_UnderlyingBuffer(RootSystem.IntPtr pNative); | ||
114 | + public IntPtr UnderlyingBuffer | ||
115 | + { | ||
116 | + get | ||
117 | + { | ||
118 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
119 | + { | ||
120 | + throw new RootSystem.ObjectDisposedException("KinectBuffer"); | ||
121 | + } | ||
122 | + | ||
123 | + RootSystem.IntPtr value = Windows_Storage_Streams_IBuffer_get_UnderlyingBuffer(_pNative); | ||
124 | + Helper.ExceptionHelper.CheckLastError(); | ||
125 | + return value; | ||
126 | + } | ||
127 | + } | ||
128 | + } | ||
129 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
This diff is collapsed. Click to expand it.
1 | +using System; | ||
2 | +using System.Collections.Generic; | ||
3 | +using System.Runtime.InteropServices; | ||
4 | +using System.Linq; | ||
5 | + | ||
6 | +namespace Helper | ||
7 | +{ | ||
8 | + public static class NativeObjectCache | ||
9 | + { | ||
10 | + private static object _lock = new object(); | ||
11 | + private static Dictionary<Type, Dictionary<IntPtr, WeakReference>> _objectCache = new Dictionary<Type, Dictionary<IntPtr, WeakReference>>(); | ||
12 | + public static void AddObject<T>(IntPtr nativePtr, T obj) where T : class | ||
13 | + { | ||
14 | + lock (_lock) | ||
15 | + { | ||
16 | + Dictionary<IntPtr, WeakReference> objCache = null; | ||
17 | + | ||
18 | + if (!_objectCache.TryGetValue(typeof(T), out objCache) || objCache == null) | ||
19 | + { | ||
20 | + objCache = new Dictionary<IntPtr, WeakReference>(); | ||
21 | + _objectCache[typeof(T)] = objCache; | ||
22 | + } | ||
23 | + | ||
24 | + objCache[nativePtr] = new WeakReference(obj); | ||
25 | + } | ||
26 | + } | ||
27 | + | ||
28 | + public static void Flush() | ||
29 | + { | ||
30 | + lock(_lock) | ||
31 | + { | ||
32 | + foreach (var byType in _objectCache.ToArray()) | ||
33 | + { | ||
34 | + foreach(var kvp in byType.Value.ToArray()) | ||
35 | + { | ||
36 | + IDisposable disp = kvp.Value.Target as IDisposable; | ||
37 | + if(disp != null) | ||
38 | + { | ||
39 | + disp.Dispose(); | ||
40 | + } | ||
41 | + | ||
42 | + } | ||
43 | + } | ||
44 | + } | ||
45 | + } | ||
46 | + | ||
47 | + public static void RemoveObject<T>(IntPtr nativePtr) | ||
48 | + { | ||
49 | + lock (_lock) | ||
50 | + { | ||
51 | + Dictionary<IntPtr, WeakReference> objCache = null; | ||
52 | + | ||
53 | + if (!_objectCache.TryGetValue(typeof(T), out objCache) || objCache == null) | ||
54 | + { | ||
55 | + objCache = new Dictionary<IntPtr, WeakReference>(); | ||
56 | + _objectCache[typeof(T)] = objCache; | ||
57 | + } | ||
58 | + | ||
59 | + if (objCache.ContainsKey(nativePtr)) | ||
60 | + { | ||
61 | + objCache.Remove(nativePtr); | ||
62 | + } | ||
63 | + } | ||
64 | + } | ||
65 | + | ||
66 | + public static T GetObject<T>(IntPtr nativePtr) where T : class | ||
67 | + { | ||
68 | + lock (_lock) | ||
69 | + { | ||
70 | + Dictionary<IntPtr, WeakReference> objCache = null; | ||
71 | + | ||
72 | + if (!_objectCache.TryGetValue(typeof(T), out objCache) || objCache == null) | ||
73 | + { | ||
74 | + objCache = new Dictionary<IntPtr, WeakReference>(); | ||
75 | + _objectCache[typeof(T)] = objCache; | ||
76 | + } | ||
77 | + | ||
78 | + WeakReference reference = null; | ||
79 | + if (objCache.TryGetValue(nativePtr, out reference)) | ||
80 | + { | ||
81 | + if (reference != null) | ||
82 | + { | ||
83 | + T obj = reference.Target as T; | ||
84 | + if (obj != null) | ||
85 | + { | ||
86 | + return (T)obj; | ||
87 | + } | ||
88 | + } | ||
89 | + } | ||
90 | + | ||
91 | + return null; | ||
92 | + } | ||
93 | + } | ||
94 | + | ||
95 | + public static T CreateOrGetObject<T>(IntPtr nativePtr, Func<System.IntPtr,T> create) where T : class | ||
96 | + { | ||
97 | + T outputValue = null; | ||
98 | + | ||
99 | + lock (_lock) | ||
100 | + { | ||
101 | + Dictionary<IntPtr, WeakReference> objCache = null; | ||
102 | + | ||
103 | + if (!_objectCache.TryGetValue(typeof(T), out objCache) || objCache == null) | ||
104 | + { | ||
105 | + objCache = new Dictionary<IntPtr, WeakReference>(); | ||
106 | + _objectCache[typeof(T)] = objCache; | ||
107 | + } | ||
108 | + | ||
109 | + WeakReference reference = null; | ||
110 | + if (objCache.TryGetValue(nativePtr, out reference)) | ||
111 | + { | ||
112 | + if ((reference != null) && reference.IsAlive) | ||
113 | + { | ||
114 | + outputValue = reference.Target as T; | ||
115 | + } | ||
116 | + } | ||
117 | + | ||
118 | + if (outputValue == null) | ||
119 | + { | ||
120 | + if (create != null) | ||
121 | + { | ||
122 | + outputValue = create(nativePtr); | ||
123 | + objCache[nativePtr] = new WeakReference(outputValue); | ||
124 | + } | ||
125 | + else if(typeof(T) == typeof(System.Object)) | ||
126 | + { | ||
127 | + //T is an object, so lets just pass back our IntPtr, which is an object. | ||
128 | + outputValue = (T)(System.Object)nativePtr; | ||
129 | + } | ||
130 | + } | ||
131 | + } | ||
132 | + | ||
133 | + return outputValue; | ||
134 | + } | ||
135 | + } | ||
136 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +using System; | ||
2 | +using System.Collections.Generic; | ||
3 | +using System.Runtime.InteropServices; | ||
4 | +using System.Linq; | ||
5 | + | ||
6 | +namespace Helper | ||
7 | +{ | ||
8 | + public static class NativeWrapper | ||
9 | + { | ||
10 | + public static System.IntPtr GetNativePtr(Object obj) | ||
11 | + { | ||
12 | + if(obj == null) | ||
13 | + { | ||
14 | + return System.IntPtr.Zero; | ||
15 | + } | ||
16 | + | ||
17 | + var nativeWrapperIface = obj as INativeWrapper; | ||
18 | + if(nativeWrapperIface != null) | ||
19 | + { | ||
20 | + return nativeWrapperIface.nativePtr; | ||
21 | + } | ||
22 | + else | ||
23 | + { | ||
24 | + throw new ArgumentException("Object must wrap native type"); | ||
25 | + } | ||
26 | + } | ||
27 | + } | ||
28 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +using System; | ||
2 | +using System.Collections.Generic; | ||
3 | +using System.Runtime.InteropServices; | ||
4 | +using System.Linq; | ||
5 | + | ||
6 | +namespace Helper | ||
7 | +{ | ||
8 | + public class SmartGCHandle : IDisposable | ||
9 | + { | ||
10 | + private GCHandle handle; | ||
11 | + public SmartGCHandle(GCHandle handle) | ||
12 | + { | ||
13 | + this.handle = handle; | ||
14 | + } | ||
15 | + | ||
16 | + ~SmartGCHandle() | ||
17 | + { | ||
18 | + Dispose(false); | ||
19 | + } | ||
20 | + | ||
21 | + public System.IntPtr AddrOfPinnedObject() | ||
22 | + { | ||
23 | + return handle.AddrOfPinnedObject(); | ||
24 | + } | ||
25 | + | ||
26 | + public virtual void Dispose() | ||
27 | + { | ||
28 | + Dispose(true); | ||
29 | + } | ||
30 | + | ||
31 | + protected virtual void Dispose(bool disposing) | ||
32 | + { | ||
33 | + this.handle.Free(); | ||
34 | + } | ||
35 | + | ||
36 | + public static implicit operator GCHandle(SmartGCHandle other) | ||
37 | + { | ||
38 | + | ||
39 | + return other.handle; | ||
40 | + } | ||
41 | + } | ||
42 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +using System; | ||
2 | +using System.Collections.Generic; | ||
3 | +using System.Runtime.InteropServices; | ||
4 | +using System.Linq; | ||
5 | + | ||
6 | +namespace Helper | ||
7 | +{ | ||
8 | + public class ThreadSafeDictionary<TKey, TValue> | ||
9 | + { | ||
10 | + protected readonly Dictionary<TKey, TValue> _impl = new Dictionary<TKey, TValue>(); | ||
11 | + public TValue this[TKey key] | ||
12 | + { | ||
13 | + get | ||
14 | + { | ||
15 | + lock (_impl) | ||
16 | + { | ||
17 | + return _impl[key]; | ||
18 | + } | ||
19 | + } | ||
20 | + set | ||
21 | + { | ||
22 | + lock (_impl) | ||
23 | + { | ||
24 | + _impl[key] = value; | ||
25 | + } | ||
26 | + } | ||
27 | + } | ||
28 | + | ||
29 | + public void Add(TKey key, TValue value) | ||
30 | + { | ||
31 | + lock (_impl) | ||
32 | + { | ||
33 | + _impl.Add(key, value); | ||
34 | + } | ||
35 | + } | ||
36 | + | ||
37 | + public bool TryGetValue(TKey key, out TValue value) | ||
38 | + { | ||
39 | + lock (_impl) | ||
40 | + { | ||
41 | + return _impl.TryGetValue(key, out value); | ||
42 | + } | ||
43 | + } | ||
44 | + | ||
45 | + public bool Remove(TKey key) | ||
46 | + { | ||
47 | + lock (_impl) | ||
48 | + { | ||
49 | + return _impl.Remove(key); | ||
50 | + } | ||
51 | + } | ||
52 | + | ||
53 | + public void Clear() | ||
54 | + { | ||
55 | + lock (_impl) | ||
56 | + { | ||
57 | + _impl.Clear(); | ||
58 | + } | ||
59 | + } | ||
60 | + } | ||
61 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +using RootSystem = System; | ||
2 | +using System.Linq; | ||
3 | +using System.Collections.Generic; | ||
4 | +namespace Windows.Data | ||
5 | +{ | ||
6 | + // | ||
7 | + // Windows.Data.PropertyChangedEventArgs | ||
8 | + // | ||
9 | + public sealed partial class PropertyChangedEventArgs : RootSystem.EventArgs, Helper.INativeWrapper | ||
10 | + | ||
11 | + { | ||
12 | + internal RootSystem.IntPtr _pNative; | ||
13 | + RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } } | ||
14 | + | ||
15 | + // Constructors and Finalizers | ||
16 | + internal PropertyChangedEventArgs(RootSystem.IntPtr pNative) | ||
17 | + { | ||
18 | + _pNative = pNative; | ||
19 | + Windows_Data_PropertyChangedEventArgs_AddRefObject(ref _pNative); | ||
20 | + } | ||
21 | + | ||
22 | + ~PropertyChangedEventArgs() | ||
23 | + { | ||
24 | + Dispose(false); | ||
25 | + } | ||
26 | + | ||
27 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
28 | + private static extern void Windows_Data_PropertyChangedEventArgs_ReleaseObject(ref RootSystem.IntPtr pNative); | ||
29 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
30 | + private static extern void Windows_Data_PropertyChangedEventArgs_AddRefObject(ref RootSystem.IntPtr pNative); | ||
31 | + private void Dispose(bool disposing) | ||
32 | + { | ||
33 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
34 | + { | ||
35 | + return; | ||
36 | + } | ||
37 | + | ||
38 | + __EventCleanup(); | ||
39 | + | ||
40 | + Helper.NativeObjectCache.RemoveObject<PropertyChangedEventArgs>(_pNative); | ||
41 | + Windows_Data_PropertyChangedEventArgs_ReleaseObject(ref _pNative); | ||
42 | + | ||
43 | + _pNative = RootSystem.IntPtr.Zero; | ||
44 | + } | ||
45 | + | ||
46 | + | ||
47 | + // Public Properties | ||
48 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
49 | + private static extern RootSystem.IntPtr Windows_Data_PropertyChangedEventArgs_get_PropertyName(RootSystem.IntPtr pNative); | ||
50 | + public string PropertyName | ||
51 | + { | ||
52 | + get | ||
53 | + { | ||
54 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
55 | + { | ||
56 | + throw new RootSystem.ObjectDisposedException("PropertyChangedEventArgs"); | ||
57 | + } | ||
58 | + | ||
59 | + RootSystem.IntPtr objectPointer = Windows_Data_PropertyChangedEventArgs_get_PropertyName(_pNative); | ||
60 | + Helper.ExceptionHelper.CheckLastError(); | ||
61 | + | ||
62 | + var managedString = RootSystem.Runtime.InteropServices.Marshal.PtrToStringUni(objectPointer); | ||
63 | + RootSystem.Runtime.InteropServices.Marshal.FreeCoTaskMem(objectPointer); | ||
64 | + return managedString; | ||
65 | + } | ||
66 | + } | ||
67 | + | ||
68 | + private void __EventCleanup() | ||
69 | + { | ||
70 | + } | ||
71 | + } | ||
72 | + | ||
73 | +} |
1 | +using RootSystem = System; | ||
2 | +using System.Linq; | ||
3 | +using System.Collections.Generic; | ||
4 | +namespace Windows.Kinect | ||
5 | +{ | ||
6 | + // | ||
7 | + // Windows.Kinect.Activity | ||
8 | + // | ||
9 | + public enum Activity : int | ||
10 | + { | ||
11 | + EyeLeftClosed =0, | ||
12 | + EyeRightClosed =1, | ||
13 | + MouthOpen =2, | ||
14 | + MouthMoved =3, | ||
15 | + LookingAway =4, | ||
16 | + } | ||
17 | + | ||
18 | +} |
This diff is collapsed. Click to expand it.
1 | +using RootSystem = System; | ||
2 | +using System.Linq; | ||
3 | +using System.Collections.Generic; | ||
4 | +namespace Windows.Kinect | ||
5 | +{ | ||
6 | + // | ||
7 | + // Windows.Kinect.AudioBeamFrame | ||
8 | + // | ||
9 | + public sealed partial class AudioBeamFrame : RootSystem.IDisposable, Helper.INativeWrapper | ||
10 | + | ||
11 | + { | ||
12 | + internal RootSystem.IntPtr _pNative; | ||
13 | + RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } } | ||
14 | + | ||
15 | + // Constructors and Finalizers | ||
16 | + internal AudioBeamFrame(RootSystem.IntPtr pNative) | ||
17 | + { | ||
18 | + _pNative = pNative; | ||
19 | + Windows_Kinect_AudioBeamFrame_AddRefObject(ref _pNative); | ||
20 | + } | ||
21 | + | ||
22 | + ~AudioBeamFrame() | ||
23 | + { | ||
24 | + Dispose(false); | ||
25 | + } | ||
26 | + | ||
27 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
28 | + private static extern void Windows_Kinect_AudioBeamFrame_ReleaseObject(ref RootSystem.IntPtr pNative); | ||
29 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
30 | + private static extern void Windows_Kinect_AudioBeamFrame_AddRefObject(ref RootSystem.IntPtr pNative); | ||
31 | + | ||
32 | + // Public Properties | ||
33 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
34 | + private static extern RootSystem.IntPtr Windows_Kinect_AudioBeamFrame_get_AudioBeam(RootSystem.IntPtr pNative); | ||
35 | + public Windows.Kinect.AudioBeam AudioBeam | ||
36 | + { | ||
37 | + get | ||
38 | + { | ||
39 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
40 | + { | ||
41 | + throw new RootSystem.ObjectDisposedException("AudioBeamFrame"); | ||
42 | + } | ||
43 | + | ||
44 | + RootSystem.IntPtr objectPointer = Windows_Kinect_AudioBeamFrame_get_AudioBeam(_pNative); | ||
45 | + Helper.ExceptionHelper.CheckLastError(); | ||
46 | + if (objectPointer == RootSystem.IntPtr.Zero) | ||
47 | + { | ||
48 | + return null; | ||
49 | + } | ||
50 | + | ||
51 | + return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.AudioBeam>(objectPointer, n => new Windows.Kinect.AudioBeam(n)); | ||
52 | + } | ||
53 | + } | ||
54 | + | ||
55 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
56 | + private static extern RootSystem.IntPtr Windows_Kinect_AudioBeamFrame_get_AudioSource(RootSystem.IntPtr pNative); | ||
57 | + public Windows.Kinect.AudioSource AudioSource | ||
58 | + { | ||
59 | + get | ||
60 | + { | ||
61 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
62 | + { | ||
63 | + throw new RootSystem.ObjectDisposedException("AudioBeamFrame"); | ||
64 | + } | ||
65 | + | ||
66 | + RootSystem.IntPtr objectPointer = Windows_Kinect_AudioBeamFrame_get_AudioSource(_pNative); | ||
67 | + Helper.ExceptionHelper.CheckLastError(); | ||
68 | + if (objectPointer == RootSystem.IntPtr.Zero) | ||
69 | + { | ||
70 | + return null; | ||
71 | + } | ||
72 | + | ||
73 | + return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.AudioSource>(objectPointer, n => new Windows.Kinect.AudioSource(n)); | ||
74 | + } | ||
75 | + } | ||
76 | + | ||
77 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
78 | + private static extern long Windows_Kinect_AudioBeamFrame_get_Duration(RootSystem.IntPtr pNative); | ||
79 | + public RootSystem.TimeSpan Duration | ||
80 | + { | ||
81 | + get | ||
82 | + { | ||
83 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
84 | + { | ||
85 | + throw new RootSystem.ObjectDisposedException("AudioBeamFrame"); | ||
86 | + } | ||
87 | + | ||
88 | + return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_AudioBeamFrame_get_Duration(_pNative)); | ||
89 | + } | ||
90 | + } | ||
91 | + | ||
92 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
93 | + private static extern long Windows_Kinect_AudioBeamFrame_get_RelativeTimeStart(RootSystem.IntPtr pNative); | ||
94 | + public RootSystem.TimeSpan RelativeTimeStart | ||
95 | + { | ||
96 | + get | ||
97 | + { | ||
98 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
99 | + { | ||
100 | + throw new RootSystem.ObjectDisposedException("AudioBeamFrame"); | ||
101 | + } | ||
102 | + | ||
103 | + return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_AudioBeamFrame_get_RelativeTimeStart(_pNative)); | ||
104 | + } | ||
105 | + } | ||
106 | + | ||
107 | + | ||
108 | + // Public Methods | ||
109 | + private void __EventCleanup() | ||
110 | + { | ||
111 | + } | ||
112 | + } | ||
113 | + | ||
114 | +} |
sourcecode/capstone/Assets/Standard Assets/Windows/Kinect/AudioBeamFrameArrivedEventArgs.cs
0 → 100644
1 | +using RootSystem = System; | ||
2 | +using System.Linq; | ||
3 | +using System.Collections.Generic; | ||
4 | +namespace Windows.Kinect | ||
5 | +{ | ||
6 | + // | ||
7 | + // Windows.Kinect.AudioBeamFrameArrivedEventArgs | ||
8 | + // | ||
9 | + public sealed partial class AudioBeamFrameArrivedEventArgs : RootSystem.EventArgs, Helper.INativeWrapper | ||
10 | + | ||
11 | + { | ||
12 | + internal RootSystem.IntPtr _pNative; | ||
13 | + RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } } | ||
14 | + | ||
15 | + // Constructors and Finalizers | ||
16 | + internal AudioBeamFrameArrivedEventArgs(RootSystem.IntPtr pNative) | ||
17 | + { | ||
18 | + _pNative = pNative; | ||
19 | + Windows_Kinect_AudioBeamFrameArrivedEventArgs_AddRefObject(ref _pNative); | ||
20 | + } | ||
21 | + | ||
22 | + ~AudioBeamFrameArrivedEventArgs() | ||
23 | + { | ||
24 | + Dispose(false); | ||
25 | + } | ||
26 | + | ||
27 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
28 | + private static extern void Windows_Kinect_AudioBeamFrameArrivedEventArgs_ReleaseObject(ref RootSystem.IntPtr pNative); | ||
29 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
30 | + private static extern void Windows_Kinect_AudioBeamFrameArrivedEventArgs_AddRefObject(ref RootSystem.IntPtr pNative); | ||
31 | + private void Dispose(bool disposing) | ||
32 | + { | ||
33 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
34 | + { | ||
35 | + return; | ||
36 | + } | ||
37 | + | ||
38 | + __EventCleanup(); | ||
39 | + | ||
40 | + Helper.NativeObjectCache.RemoveObject<AudioBeamFrameArrivedEventArgs>(_pNative); | ||
41 | + Windows_Kinect_AudioBeamFrameArrivedEventArgs_ReleaseObject(ref _pNative); | ||
42 | + | ||
43 | + _pNative = RootSystem.IntPtr.Zero; | ||
44 | + } | ||
45 | + | ||
46 | + | ||
47 | + // Public Properties | ||
48 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
49 | + private static extern RootSystem.IntPtr Windows_Kinect_AudioBeamFrameArrivedEventArgs_get_FrameReference(RootSystem.IntPtr pNative); | ||
50 | + public Windows.Kinect.AudioBeamFrameReference FrameReference | ||
51 | + { | ||
52 | + get | ||
53 | + { | ||
54 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
55 | + { | ||
56 | + throw new RootSystem.ObjectDisposedException("AudioBeamFrameArrivedEventArgs"); | ||
57 | + } | ||
58 | + | ||
59 | + RootSystem.IntPtr objectPointer = Windows_Kinect_AudioBeamFrameArrivedEventArgs_get_FrameReference(_pNative); | ||
60 | + Helper.ExceptionHelper.CheckLastError(); | ||
61 | + if (objectPointer == RootSystem.IntPtr.Zero) | ||
62 | + { | ||
63 | + return null; | ||
64 | + } | ||
65 | + | ||
66 | + return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.AudioBeamFrameReference>(objectPointer, n => new Windows.Kinect.AudioBeamFrameReference(n)); | ||
67 | + } | ||
68 | + } | ||
69 | + | ||
70 | + private void __EventCleanup() | ||
71 | + { | ||
72 | + } | ||
73 | + } | ||
74 | + | ||
75 | +} |
1 | +using RootSystem = System; | ||
2 | +using System.Linq; | ||
3 | +using System.Collections.Generic; | ||
4 | +namespace Windows.Kinect | ||
5 | +{ | ||
6 | + // | ||
7 | + // Windows.Kinect.AudioBeamFrameList | ||
8 | + // | ||
9 | + public sealed partial class AudioBeamFrameList : RootSystem.IDisposable, Helper.INativeWrapper | ||
10 | + | ||
11 | + { | ||
12 | + internal RootSystem.IntPtr _pNative; | ||
13 | + RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } } | ||
14 | + | ||
15 | + // Constructors and Finalizers | ||
16 | + internal AudioBeamFrameList(RootSystem.IntPtr pNative) | ||
17 | + { | ||
18 | + _pNative = pNative; | ||
19 | + Windows_Kinect_AudioBeamFrameList_AddRefObject(ref _pNative); | ||
20 | + } | ||
21 | + | ||
22 | + ~AudioBeamFrameList() | ||
23 | + { | ||
24 | + Dispose(false); | ||
25 | + } | ||
26 | + | ||
27 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
28 | + private static extern void Windows_Kinect_AudioBeamFrameList_ReleaseObject(ref RootSystem.IntPtr pNative); | ||
29 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
30 | + private static extern void Windows_Kinect_AudioBeamFrameList_AddRefObject(ref RootSystem.IntPtr pNative); | ||
31 | + private void Dispose(bool disposing) | ||
32 | + { | ||
33 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
34 | + { | ||
35 | + return; | ||
36 | + } | ||
37 | + | ||
38 | + __EventCleanup(); | ||
39 | + | ||
40 | + Helper.NativeObjectCache.RemoveObject<AudioBeamFrameList>(_pNative); | ||
41 | + | ||
42 | + if (disposing) | ||
43 | + { | ||
44 | + Windows_Kinect_AudioBeamFrameList_Dispose(_pNative); | ||
45 | + } | ||
46 | + Windows_Kinect_AudioBeamFrameList_ReleaseObject(ref _pNative); | ||
47 | + | ||
48 | + _pNative = RootSystem.IntPtr.Zero; | ||
49 | + } | ||
50 | + | ||
51 | + | ||
52 | + // Public Methods | ||
53 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
54 | + private static extern void Windows_Kinect_AudioBeamFrameList_Dispose(RootSystem.IntPtr pNative); | ||
55 | + public void Dispose() | ||
56 | + { | ||
57 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
58 | + { | ||
59 | + return; | ||
60 | + } | ||
61 | + | ||
62 | + Dispose(true); | ||
63 | + RootSystem.GC.SuppressFinalize(this); | ||
64 | + } | ||
65 | + | ||
66 | + private void __EventCleanup() | ||
67 | + { | ||
68 | + } | ||
69 | + } | ||
70 | + | ||
71 | +} |
This diff is collapsed. Click to expand it.
1 | +using RootSystem = System; | ||
2 | +using System.Linq; | ||
3 | +using System.Collections.Generic; | ||
4 | +namespace Windows.Kinect | ||
5 | +{ | ||
6 | + // | ||
7 | + // Windows.Kinect.AudioBeamFrameReference | ||
8 | + // | ||
9 | + public sealed partial class AudioBeamFrameReference : Helper.INativeWrapper | ||
10 | + | ||
11 | + { | ||
12 | + internal RootSystem.IntPtr _pNative; | ||
13 | + RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } } | ||
14 | + | ||
15 | + // Constructors and Finalizers | ||
16 | + internal AudioBeamFrameReference(RootSystem.IntPtr pNative) | ||
17 | + { | ||
18 | + _pNative = pNative; | ||
19 | + Windows_Kinect_AudioBeamFrameReference_AddRefObject(ref _pNative); | ||
20 | + } | ||
21 | + | ||
22 | + ~AudioBeamFrameReference() | ||
23 | + { | ||
24 | + Dispose(false); | ||
25 | + } | ||
26 | + | ||
27 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
28 | + private static extern void Windows_Kinect_AudioBeamFrameReference_ReleaseObject(ref RootSystem.IntPtr pNative); | ||
29 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
30 | + private static extern void Windows_Kinect_AudioBeamFrameReference_AddRefObject(ref RootSystem.IntPtr pNative); | ||
31 | + private void Dispose(bool disposing) | ||
32 | + { | ||
33 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
34 | + { | ||
35 | + return; | ||
36 | + } | ||
37 | + | ||
38 | + __EventCleanup(); | ||
39 | + | ||
40 | + Helper.NativeObjectCache.RemoveObject<AudioBeamFrameReference>(_pNative); | ||
41 | + Windows_Kinect_AudioBeamFrameReference_ReleaseObject(ref _pNative); | ||
42 | + | ||
43 | + _pNative = RootSystem.IntPtr.Zero; | ||
44 | + } | ||
45 | + | ||
46 | + | ||
47 | + // Public Properties | ||
48 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
49 | + private static extern long Windows_Kinect_AudioBeamFrameReference_get_RelativeTime(RootSystem.IntPtr pNative); | ||
50 | + public RootSystem.TimeSpan RelativeTime | ||
51 | + { | ||
52 | + get | ||
53 | + { | ||
54 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
55 | + { | ||
56 | + throw new RootSystem.ObjectDisposedException("AudioBeamFrameReference"); | ||
57 | + } | ||
58 | + | ||
59 | + return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_AudioBeamFrameReference_get_RelativeTime(_pNative)); | ||
60 | + } | ||
61 | + } | ||
62 | + | ||
63 | + | ||
64 | + // Public Methods | ||
65 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
66 | + private static extern int Windows_Kinect_AudioBeamFrameReference_AcquireBeamFrames_Length(RootSystem.IntPtr pNative); | ||
67 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
68 | + private static extern int Windows_Kinect_AudioBeamFrameReference_AcquireBeamFrames(RootSystem.IntPtr pNative, [RootSystem.Runtime.InteropServices.Out] RootSystem.IntPtr[] outCollection, int outCollectionSize); | ||
69 | + public RootSystem.Collections.Generic.IList<Windows.Kinect.AudioBeamFrame> AcquireBeamFrames() | ||
70 | + { | ||
71 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
72 | + { | ||
73 | + throw new RootSystem.ObjectDisposedException("AudioBeamFrameReference"); | ||
74 | + } | ||
75 | + | ||
76 | + int outCollectionSize = Windows_Kinect_AudioBeamFrameReference_AcquireBeamFrames_Length(_pNative); | ||
77 | + var outCollection = new RootSystem.IntPtr[outCollectionSize]; | ||
78 | + var managedCollection = new Windows.Kinect.AudioBeamFrame[outCollectionSize]; | ||
79 | + | ||
80 | + outCollectionSize = Windows_Kinect_AudioBeamFrameReference_AcquireBeamFrames(_pNative, outCollection, outCollectionSize); | ||
81 | + Helper.ExceptionHelper.CheckLastError(); | ||
82 | + for(int i=0;i<outCollectionSize;i++) | ||
83 | + { | ||
84 | + if(outCollection[i] == RootSystem.IntPtr.Zero) | ||
85 | + { | ||
86 | + continue; | ||
87 | + } | ||
88 | + | ||
89 | + var obj = Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.AudioBeamFrame>(outCollection[i], n => new Windows.Kinect.AudioBeamFrame(n)); | ||
90 | + | ||
91 | + managedCollection[i] = obj; | ||
92 | + } | ||
93 | + return managedCollection; | ||
94 | + } | ||
95 | + | ||
96 | + private void __EventCleanup() | ||
97 | + { | ||
98 | + } | ||
99 | + } | ||
100 | + | ||
101 | +} |
1 | +using RootSystem = System; | ||
2 | +using System.Linq; | ||
3 | +using System.Collections.Generic; | ||
4 | +namespace Windows.Kinect | ||
5 | +{ | ||
6 | + // | ||
7 | + // Windows.Kinect.AudioBeamSubFrame | ||
8 | + // | ||
9 | + public sealed partial class AudioBeamSubFrame : RootSystem.IDisposable, Helper.INativeWrapper | ||
10 | + | ||
11 | + { | ||
12 | + internal RootSystem.IntPtr _pNative; | ||
13 | + RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } } | ||
14 | + | ||
15 | + // Constructors and Finalizers | ||
16 | + internal AudioBeamSubFrame(RootSystem.IntPtr pNative) | ||
17 | + { | ||
18 | + _pNative = pNative; | ||
19 | + Windows_Kinect_AudioBeamSubFrame_AddRefObject(ref _pNative); | ||
20 | + } | ||
21 | + | ||
22 | + ~AudioBeamSubFrame() | ||
23 | + { | ||
24 | + Dispose(false); | ||
25 | + } | ||
26 | + | ||
27 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
28 | + private static extern void Windows_Kinect_AudioBeamSubFrame_ReleaseObject(ref RootSystem.IntPtr pNative); | ||
29 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
30 | + private static extern void Windows_Kinect_AudioBeamSubFrame_AddRefObject(ref RootSystem.IntPtr pNative); | ||
31 | + private void Dispose(bool disposing) | ||
32 | + { | ||
33 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
34 | + { | ||
35 | + return; | ||
36 | + } | ||
37 | + | ||
38 | + __EventCleanup(); | ||
39 | + | ||
40 | + Helper.NativeObjectCache.RemoveObject<AudioBeamSubFrame>(_pNative); | ||
41 | + | ||
42 | + if (disposing) | ||
43 | + { | ||
44 | + Windows_Kinect_AudioBeamSubFrame_Dispose(_pNative); | ||
45 | + } | ||
46 | + Windows_Kinect_AudioBeamSubFrame_ReleaseObject(ref _pNative); | ||
47 | + | ||
48 | + _pNative = RootSystem.IntPtr.Zero; | ||
49 | + } | ||
50 | + | ||
51 | + | ||
52 | + // Public Properties | ||
53 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
54 | + private static extern Windows.Kinect.AudioBeamMode Windows_Kinect_AudioBeamSubFrame_get_AudioBeamMode(RootSystem.IntPtr pNative); | ||
55 | + public Windows.Kinect.AudioBeamMode AudioBeamMode | ||
56 | + { | ||
57 | + get | ||
58 | + { | ||
59 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
60 | + { | ||
61 | + throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame"); | ||
62 | + } | ||
63 | + | ||
64 | + return Windows_Kinect_AudioBeamSubFrame_get_AudioBeamMode(_pNative); | ||
65 | + } | ||
66 | + } | ||
67 | + | ||
68 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
69 | + private static extern int Windows_Kinect_AudioBeamSubFrame_get_AudioBodyCorrelations(RootSystem.IntPtr pNative, [RootSystem.Runtime.InteropServices.Out] RootSystem.IntPtr[] outCollection, int outCollectionSize); | ||
70 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
71 | + private static extern int Windows_Kinect_AudioBeamSubFrame_get_AudioBodyCorrelations_Length(RootSystem.IntPtr pNative); | ||
72 | + public RootSystem.Collections.Generic.IList<Windows.Kinect.AudioBodyCorrelation> AudioBodyCorrelations | ||
73 | + { | ||
74 | + get | ||
75 | + { | ||
76 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
77 | + { | ||
78 | + throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame"); | ||
79 | + } | ||
80 | + | ||
81 | + int outCollectionSize = Windows_Kinect_AudioBeamSubFrame_get_AudioBodyCorrelations_Length(_pNative); | ||
82 | + var outCollection = new RootSystem.IntPtr[outCollectionSize]; | ||
83 | + var managedCollection = new Windows.Kinect.AudioBodyCorrelation[outCollectionSize]; | ||
84 | + | ||
85 | + outCollectionSize = Windows_Kinect_AudioBeamSubFrame_get_AudioBodyCorrelations(_pNative, outCollection, outCollectionSize); | ||
86 | + Helper.ExceptionHelper.CheckLastError(); | ||
87 | + for(int i=0;i<outCollectionSize;i++) | ||
88 | + { | ||
89 | + if(outCollection[i] == RootSystem.IntPtr.Zero) | ||
90 | + { | ||
91 | + continue; | ||
92 | + } | ||
93 | + | ||
94 | + var obj = Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.AudioBodyCorrelation>(outCollection[i], n => new Windows.Kinect.AudioBodyCorrelation(n)); | ||
95 | + | ||
96 | + managedCollection[i] = obj; | ||
97 | + } | ||
98 | + return managedCollection; | ||
99 | + } | ||
100 | + } | ||
101 | + | ||
102 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
103 | + private static extern float Windows_Kinect_AudioBeamSubFrame_get_BeamAngle(RootSystem.IntPtr pNative); | ||
104 | + public float BeamAngle | ||
105 | + { | ||
106 | + get | ||
107 | + { | ||
108 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
109 | + { | ||
110 | + throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame"); | ||
111 | + } | ||
112 | + | ||
113 | + return Windows_Kinect_AudioBeamSubFrame_get_BeamAngle(_pNative); | ||
114 | + } | ||
115 | + } | ||
116 | + | ||
117 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
118 | + private static extern float Windows_Kinect_AudioBeamSubFrame_get_BeamAngleConfidence(RootSystem.IntPtr pNative); | ||
119 | + public float BeamAngleConfidence | ||
120 | + { | ||
121 | + get | ||
122 | + { | ||
123 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
124 | + { | ||
125 | + throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame"); | ||
126 | + } | ||
127 | + | ||
128 | + return Windows_Kinect_AudioBeamSubFrame_get_BeamAngleConfidence(_pNative); | ||
129 | + } | ||
130 | + } | ||
131 | + | ||
132 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
133 | + private static extern long Windows_Kinect_AudioBeamSubFrame_get_Duration(RootSystem.IntPtr pNative); | ||
134 | + public RootSystem.TimeSpan Duration | ||
135 | + { | ||
136 | + get | ||
137 | + { | ||
138 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
139 | + { | ||
140 | + throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame"); | ||
141 | + } | ||
142 | + | ||
143 | + return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_AudioBeamSubFrame_get_Duration(_pNative)); | ||
144 | + } | ||
145 | + } | ||
146 | + | ||
147 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
148 | + private static extern uint Windows_Kinect_AudioBeamSubFrame_get_FrameLengthInBytes(RootSystem.IntPtr pNative); | ||
149 | + public uint FrameLengthInBytes | ||
150 | + { | ||
151 | + get | ||
152 | + { | ||
153 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
154 | + { | ||
155 | + throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame"); | ||
156 | + } | ||
157 | + | ||
158 | + return Windows_Kinect_AudioBeamSubFrame_get_FrameLengthInBytes(_pNative); | ||
159 | + } | ||
160 | + } | ||
161 | + | ||
162 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
163 | + private static extern long Windows_Kinect_AudioBeamSubFrame_get_RelativeTime(RootSystem.IntPtr pNative); | ||
164 | + public RootSystem.TimeSpan RelativeTime | ||
165 | + { | ||
166 | + get | ||
167 | + { | ||
168 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
169 | + { | ||
170 | + throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame"); | ||
171 | + } | ||
172 | + | ||
173 | + return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_AudioBeamSubFrame_get_RelativeTime(_pNative)); | ||
174 | + } | ||
175 | + } | ||
176 | + | ||
177 | + | ||
178 | + // Public Methods | ||
179 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
180 | + private static extern void Windows_Kinect_AudioBeamSubFrame_CopyFrameDataToArray(RootSystem.IntPtr pNative, RootSystem.IntPtr frameData, int frameDataSize); | ||
181 | + public void CopyFrameDataToArray(byte[] frameData) | ||
182 | + { | ||
183 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
184 | + { | ||
185 | + throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame"); | ||
186 | + } | ||
187 | + | ||
188 | + var frameDataSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(frameData, RootSystem.Runtime.InteropServices.GCHandleType.Pinned)); | ||
189 | + var _frameData = frameDataSmartGCHandle.AddrOfPinnedObject(); | ||
190 | + Windows_Kinect_AudioBeamSubFrame_CopyFrameDataToArray(_pNative, _frameData, frameData.Length); | ||
191 | + Helper.ExceptionHelper.CheckLastError(); | ||
192 | + } | ||
193 | + | ||
194 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
195 | + private static extern void Windows_Kinect_AudioBeamSubFrame_Dispose(RootSystem.IntPtr pNative); | ||
196 | + public void Dispose() | ||
197 | + { | ||
198 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
199 | + { | ||
200 | + return; | ||
201 | + } | ||
202 | + | ||
203 | + Dispose(true); | ||
204 | + RootSystem.GC.SuppressFinalize(this); | ||
205 | + } | ||
206 | + | ||
207 | + private void __EventCleanup() | ||
208 | + { | ||
209 | + } | ||
210 | + } | ||
211 | + | ||
212 | +} |
1 | +using RootSystem = System; | ||
2 | +using System.Linq; | ||
3 | +using System.Collections.Generic; | ||
4 | +namespace Windows.Kinect | ||
5 | +{ | ||
6 | + // | ||
7 | + // Windows.Kinect.AudioBodyCorrelation | ||
8 | + // | ||
9 | + public sealed partial class AudioBodyCorrelation : Helper.INativeWrapper | ||
10 | + | ||
11 | + { | ||
12 | + internal RootSystem.IntPtr _pNative; | ||
13 | + RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } } | ||
14 | + | ||
15 | + // Constructors and Finalizers | ||
16 | + internal AudioBodyCorrelation(RootSystem.IntPtr pNative) | ||
17 | + { | ||
18 | + _pNative = pNative; | ||
19 | + Windows_Kinect_AudioBodyCorrelation_AddRefObject(ref _pNative); | ||
20 | + } | ||
21 | + | ||
22 | + ~AudioBodyCorrelation() | ||
23 | + { | ||
24 | + Dispose(false); | ||
25 | + } | ||
26 | + | ||
27 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
28 | + private static extern void Windows_Kinect_AudioBodyCorrelation_ReleaseObject(ref RootSystem.IntPtr pNative); | ||
29 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
30 | + private static extern void Windows_Kinect_AudioBodyCorrelation_AddRefObject(ref RootSystem.IntPtr pNative); | ||
31 | + private void Dispose(bool disposing) | ||
32 | + { | ||
33 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
34 | + { | ||
35 | + return; | ||
36 | + } | ||
37 | + | ||
38 | + __EventCleanup(); | ||
39 | + | ||
40 | + Helper.NativeObjectCache.RemoveObject<AudioBodyCorrelation>(_pNative); | ||
41 | + Windows_Kinect_AudioBodyCorrelation_ReleaseObject(ref _pNative); | ||
42 | + | ||
43 | + _pNative = RootSystem.IntPtr.Zero; | ||
44 | + } | ||
45 | + | ||
46 | + | ||
47 | + // Public Properties | ||
48 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
49 | + private static extern ulong Windows_Kinect_AudioBodyCorrelation_get_BodyTrackingId(RootSystem.IntPtr pNative); | ||
50 | + public ulong BodyTrackingId | ||
51 | + { | ||
52 | + get | ||
53 | + { | ||
54 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
55 | + { | ||
56 | + throw new RootSystem.ObjectDisposedException("AudioBodyCorrelation"); | ||
57 | + } | ||
58 | + | ||
59 | + return Windows_Kinect_AudioBodyCorrelation_get_BodyTrackingId(_pNative); | ||
60 | + } | ||
61 | + } | ||
62 | + | ||
63 | + private void __EventCleanup() | ||
64 | + { | ||
65 | + } | ||
66 | + } | ||
67 | + | ||
68 | +} |
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 | +using RootSystem = System; | ||
2 | +using System.Linq; | ||
3 | +using System.Collections.Generic; | ||
4 | +namespace Windows.Kinect | ||
5 | +{ | ||
6 | + // | ||
7 | + // Windows.Kinect.BodyFrame | ||
8 | + // | ||
9 | + public sealed partial class BodyFrame : RootSystem.IDisposable, Helper.INativeWrapper | ||
10 | + | ||
11 | + { | ||
12 | + internal RootSystem.IntPtr _pNative; | ||
13 | + RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } } | ||
14 | + | ||
15 | + // Constructors and Finalizers | ||
16 | + internal BodyFrame(RootSystem.IntPtr pNative) | ||
17 | + { | ||
18 | + _pNative = pNative; | ||
19 | + Windows_Kinect_BodyFrame_AddRefObject(ref _pNative); | ||
20 | + } | ||
21 | + | ||
22 | + ~BodyFrame() | ||
23 | + { | ||
24 | + Dispose(false); | ||
25 | + } | ||
26 | + | ||
27 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
28 | + private static extern void Windows_Kinect_BodyFrame_ReleaseObject(ref RootSystem.IntPtr pNative); | ||
29 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
30 | + private static extern void Windows_Kinect_BodyFrame_AddRefObject(ref RootSystem.IntPtr pNative); | ||
31 | + private void Dispose(bool disposing) | ||
32 | + { | ||
33 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
34 | + { | ||
35 | + return; | ||
36 | + } | ||
37 | + | ||
38 | + __EventCleanup(); | ||
39 | + | ||
40 | + Helper.NativeObjectCache.RemoveObject<BodyFrame>(_pNative); | ||
41 | + | ||
42 | + if (disposing) | ||
43 | + { | ||
44 | + Windows_Kinect_BodyFrame_Dispose(_pNative); | ||
45 | + } | ||
46 | + Windows_Kinect_BodyFrame_ReleaseObject(ref _pNative); | ||
47 | + | ||
48 | + _pNative = RootSystem.IntPtr.Zero; | ||
49 | + } | ||
50 | + | ||
51 | + | ||
52 | + // Public Properties | ||
53 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
54 | + private static extern int Windows_Kinect_BodyFrame_get_BodyCount(RootSystem.IntPtr pNative); | ||
55 | + public int BodyCount | ||
56 | + { | ||
57 | + get | ||
58 | + { | ||
59 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
60 | + { | ||
61 | + throw new RootSystem.ObjectDisposedException("BodyFrame"); | ||
62 | + } | ||
63 | + | ||
64 | + return Windows_Kinect_BodyFrame_get_BodyCount(_pNative); | ||
65 | + } | ||
66 | + } | ||
67 | + | ||
68 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
69 | + private static extern RootSystem.IntPtr Windows_Kinect_BodyFrame_get_BodyFrameSource(RootSystem.IntPtr pNative); | ||
70 | + public Windows.Kinect.BodyFrameSource BodyFrameSource | ||
71 | + { | ||
72 | + get | ||
73 | + { | ||
74 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
75 | + { | ||
76 | + throw new RootSystem.ObjectDisposedException("BodyFrame"); | ||
77 | + } | ||
78 | + | ||
79 | + RootSystem.IntPtr objectPointer = Windows_Kinect_BodyFrame_get_BodyFrameSource(_pNative); | ||
80 | + Helper.ExceptionHelper.CheckLastError(); | ||
81 | + if (objectPointer == RootSystem.IntPtr.Zero) | ||
82 | + { | ||
83 | + return null; | ||
84 | + } | ||
85 | + | ||
86 | + return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.BodyFrameSource>(objectPointer, n => new Windows.Kinect.BodyFrameSource(n)); | ||
87 | + } | ||
88 | + } | ||
89 | + | ||
90 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
91 | + private static extern RootSystem.IntPtr Windows_Kinect_BodyFrame_get_FloorClipPlane(RootSystem.IntPtr pNative); | ||
92 | + public Windows.Kinect.Vector4 FloorClipPlane | ||
93 | + { | ||
94 | + get | ||
95 | + { | ||
96 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
97 | + { | ||
98 | + throw new RootSystem.ObjectDisposedException("BodyFrame"); | ||
99 | + } | ||
100 | + | ||
101 | + var objectPointer = Windows_Kinect_BodyFrame_get_FloorClipPlane(_pNative); | ||
102 | + Helper.ExceptionHelper.CheckLastError(); | ||
103 | + var obj = (Windows.Kinect.Vector4)RootSystem.Runtime.InteropServices.Marshal.PtrToStructure(objectPointer, typeof(Windows.Kinect.Vector4)); | ||
104 | + Windows.Kinect.KinectUnityAddinUtils.FreeMemory(objectPointer); | ||
105 | + return obj; | ||
106 | + } | ||
107 | + } | ||
108 | + | ||
109 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
110 | + private static extern long Windows_Kinect_BodyFrame_get_RelativeTime(RootSystem.IntPtr pNative); | ||
111 | + public RootSystem.TimeSpan RelativeTime | ||
112 | + { | ||
113 | + get | ||
114 | + { | ||
115 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
116 | + { | ||
117 | + throw new RootSystem.ObjectDisposedException("BodyFrame"); | ||
118 | + } | ||
119 | + | ||
120 | + return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_BodyFrame_get_RelativeTime(_pNative)); | ||
121 | + } | ||
122 | + } | ||
123 | + | ||
124 | + | ||
125 | + // Public Methods | ||
126 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
127 | + private static extern void Windows_Kinect_BodyFrame_Dispose(RootSystem.IntPtr pNative); | ||
128 | + public void Dispose() | ||
129 | + { | ||
130 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
131 | + { | ||
132 | + return; | ||
133 | + } | ||
134 | + | ||
135 | + Dispose(true); | ||
136 | + RootSystem.GC.SuppressFinalize(this); | ||
137 | + } | ||
138 | + | ||
139 | + private void __EventCleanup() | ||
140 | + { | ||
141 | + } | ||
142 | + } | ||
143 | + | ||
144 | +} |
1 | +using RootSystem = System; | ||
2 | +using System.Linq; | ||
3 | +using System.Collections.Generic; | ||
4 | +namespace Windows.Kinect | ||
5 | +{ | ||
6 | + // | ||
7 | + // Windows.Kinect.BodyFrameArrivedEventArgs | ||
8 | + // | ||
9 | + public sealed partial class BodyFrameArrivedEventArgs : RootSystem.EventArgs, Helper.INativeWrapper | ||
10 | + | ||
11 | + { | ||
12 | + internal RootSystem.IntPtr _pNative; | ||
13 | + RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } } | ||
14 | + | ||
15 | + // Constructors and Finalizers | ||
16 | + internal BodyFrameArrivedEventArgs(RootSystem.IntPtr pNative) | ||
17 | + { | ||
18 | + _pNative = pNative; | ||
19 | + Windows_Kinect_BodyFrameArrivedEventArgs_AddRefObject(ref _pNative); | ||
20 | + } | ||
21 | + | ||
22 | + ~BodyFrameArrivedEventArgs() | ||
23 | + { | ||
24 | + Dispose(false); | ||
25 | + } | ||
26 | + | ||
27 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
28 | + private static extern void Windows_Kinect_BodyFrameArrivedEventArgs_ReleaseObject(ref RootSystem.IntPtr pNative); | ||
29 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
30 | + private static extern void Windows_Kinect_BodyFrameArrivedEventArgs_AddRefObject(ref RootSystem.IntPtr pNative); | ||
31 | + private void Dispose(bool disposing) | ||
32 | + { | ||
33 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
34 | + { | ||
35 | + return; | ||
36 | + } | ||
37 | + | ||
38 | + __EventCleanup(); | ||
39 | + | ||
40 | + Helper.NativeObjectCache.RemoveObject<BodyFrameArrivedEventArgs>(_pNative); | ||
41 | + Windows_Kinect_BodyFrameArrivedEventArgs_ReleaseObject(ref _pNative); | ||
42 | + | ||
43 | + _pNative = RootSystem.IntPtr.Zero; | ||
44 | + } | ||
45 | + | ||
46 | + | ||
47 | + // Public Properties | ||
48 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
49 | + private static extern RootSystem.IntPtr Windows_Kinect_BodyFrameArrivedEventArgs_get_FrameReference(RootSystem.IntPtr pNative); | ||
50 | + public Windows.Kinect.BodyFrameReference FrameReference | ||
51 | + { | ||
52 | + get | ||
53 | + { | ||
54 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
55 | + { | ||
56 | + throw new RootSystem.ObjectDisposedException("BodyFrameArrivedEventArgs"); | ||
57 | + } | ||
58 | + | ||
59 | + RootSystem.IntPtr objectPointer = Windows_Kinect_BodyFrameArrivedEventArgs_get_FrameReference(_pNative); | ||
60 | + Helper.ExceptionHelper.CheckLastError(); | ||
61 | + if (objectPointer == RootSystem.IntPtr.Zero) | ||
62 | + { | ||
63 | + return null; | ||
64 | + } | ||
65 | + | ||
66 | + return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.BodyFrameReference>(objectPointer, n => new Windows.Kinect.BodyFrameReference(n)); | ||
67 | + } | ||
68 | + } | ||
69 | + | ||
70 | + private void __EventCleanup() | ||
71 | + { | ||
72 | + } | ||
73 | + } | ||
74 | + | ||
75 | +} |
This diff is collapsed. Click to expand it.
1 | +using RootSystem = System; | ||
2 | +using System.Linq; | ||
3 | +using System.Collections.Generic; | ||
4 | +namespace Windows.Kinect | ||
5 | +{ | ||
6 | + // | ||
7 | + // Windows.Kinect.BodyFrameReference | ||
8 | + // | ||
9 | + public sealed partial class BodyFrameReference : Helper.INativeWrapper | ||
10 | + | ||
11 | + { | ||
12 | + internal RootSystem.IntPtr _pNative; | ||
13 | + RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } } | ||
14 | + | ||
15 | + // Constructors and Finalizers | ||
16 | + internal BodyFrameReference(RootSystem.IntPtr pNative) | ||
17 | + { | ||
18 | + _pNative = pNative; | ||
19 | + Windows_Kinect_BodyFrameReference_AddRefObject(ref _pNative); | ||
20 | + } | ||
21 | + | ||
22 | + ~BodyFrameReference() | ||
23 | + { | ||
24 | + Dispose(false); | ||
25 | + } | ||
26 | + | ||
27 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
28 | + private static extern void Windows_Kinect_BodyFrameReference_ReleaseObject(ref RootSystem.IntPtr pNative); | ||
29 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
30 | + private static extern void Windows_Kinect_BodyFrameReference_AddRefObject(ref RootSystem.IntPtr pNative); | ||
31 | + private void Dispose(bool disposing) | ||
32 | + { | ||
33 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
34 | + { | ||
35 | + return; | ||
36 | + } | ||
37 | + | ||
38 | + __EventCleanup(); | ||
39 | + | ||
40 | + Helper.NativeObjectCache.RemoveObject<BodyFrameReference>(_pNative); | ||
41 | + Windows_Kinect_BodyFrameReference_ReleaseObject(ref _pNative); | ||
42 | + | ||
43 | + _pNative = RootSystem.IntPtr.Zero; | ||
44 | + } | ||
45 | + | ||
46 | + | ||
47 | + // Public Properties | ||
48 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
49 | + private static extern long Windows_Kinect_BodyFrameReference_get_RelativeTime(RootSystem.IntPtr pNative); | ||
50 | + public RootSystem.TimeSpan RelativeTime | ||
51 | + { | ||
52 | + get | ||
53 | + { | ||
54 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
55 | + { | ||
56 | + throw new RootSystem.ObjectDisposedException("BodyFrameReference"); | ||
57 | + } | ||
58 | + | ||
59 | + return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_BodyFrameReference_get_RelativeTime(_pNative)); | ||
60 | + } | ||
61 | + } | ||
62 | + | ||
63 | + | ||
64 | + // Public Methods | ||
65 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
66 | + private static extern RootSystem.IntPtr Windows_Kinect_BodyFrameReference_AcquireFrame(RootSystem.IntPtr pNative); | ||
67 | + public Windows.Kinect.BodyFrame AcquireFrame() | ||
68 | + { | ||
69 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
70 | + { | ||
71 | + throw new RootSystem.ObjectDisposedException("BodyFrameReference"); | ||
72 | + } | ||
73 | + | ||
74 | + RootSystem.IntPtr objectPointer = Windows_Kinect_BodyFrameReference_AcquireFrame(_pNative); | ||
75 | + Helper.ExceptionHelper.CheckLastError(); | ||
76 | + if (objectPointer == RootSystem.IntPtr.Zero) | ||
77 | + { | ||
78 | + return null; | ||
79 | + } | ||
80 | + | ||
81 | + return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.BodyFrame>(objectPointer, n => new Windows.Kinect.BodyFrame(n)); | ||
82 | + } | ||
83 | + | ||
84 | + private void __EventCleanup() | ||
85 | + { | ||
86 | + } | ||
87 | + } | ||
88 | + | ||
89 | +} |
This diff is collapsed. Click to expand it.
1 | +using RootSystem = System; | ||
2 | +using System.Linq; | ||
3 | +using System.Collections.Generic; | ||
4 | +namespace Windows.Kinect | ||
5 | +{ | ||
6 | + // | ||
7 | + // Windows.Kinect.BodyIndexFrame | ||
8 | + // | ||
9 | + public sealed partial class BodyIndexFrame : RootSystem.IDisposable, Helper.INativeWrapper | ||
10 | + | ||
11 | + { | ||
12 | + internal RootSystem.IntPtr _pNative; | ||
13 | + RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } } | ||
14 | + | ||
15 | + // Constructors and Finalizers | ||
16 | + internal BodyIndexFrame(RootSystem.IntPtr pNative) | ||
17 | + { | ||
18 | + _pNative = pNative; | ||
19 | + Windows_Kinect_BodyIndexFrame_AddRefObject(ref _pNative); | ||
20 | + } | ||
21 | + | ||
22 | + ~BodyIndexFrame() | ||
23 | + { | ||
24 | + Dispose(false); | ||
25 | + } | ||
26 | + | ||
27 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
28 | + private static extern void Windows_Kinect_BodyIndexFrame_ReleaseObject(ref RootSystem.IntPtr pNative); | ||
29 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
30 | + private static extern void Windows_Kinect_BodyIndexFrame_AddRefObject(ref RootSystem.IntPtr pNative); | ||
31 | + private void Dispose(bool disposing) | ||
32 | + { | ||
33 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
34 | + { | ||
35 | + return; | ||
36 | + } | ||
37 | + | ||
38 | + __EventCleanup(); | ||
39 | + | ||
40 | + Helper.NativeObjectCache.RemoveObject<BodyIndexFrame>(_pNative); | ||
41 | + | ||
42 | + if (disposing) | ||
43 | + { | ||
44 | + Windows_Kinect_BodyIndexFrame_Dispose(_pNative); | ||
45 | + } | ||
46 | + Windows_Kinect_BodyIndexFrame_ReleaseObject(ref _pNative); | ||
47 | + | ||
48 | + _pNative = RootSystem.IntPtr.Zero; | ||
49 | + } | ||
50 | + | ||
51 | + | ||
52 | + // Public Properties | ||
53 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
54 | + private static extern RootSystem.IntPtr Windows_Kinect_BodyIndexFrame_get_BodyIndexFrameSource(RootSystem.IntPtr pNative); | ||
55 | + public Windows.Kinect.BodyIndexFrameSource BodyIndexFrameSource | ||
56 | + { | ||
57 | + get | ||
58 | + { | ||
59 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
60 | + { | ||
61 | + throw new RootSystem.ObjectDisposedException("BodyIndexFrame"); | ||
62 | + } | ||
63 | + | ||
64 | + RootSystem.IntPtr objectPointer = Windows_Kinect_BodyIndexFrame_get_BodyIndexFrameSource(_pNative); | ||
65 | + Helper.ExceptionHelper.CheckLastError(); | ||
66 | + if (objectPointer == RootSystem.IntPtr.Zero) | ||
67 | + { | ||
68 | + return null; | ||
69 | + } | ||
70 | + | ||
71 | + return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.BodyIndexFrameSource>(objectPointer, n => new Windows.Kinect.BodyIndexFrameSource(n)); | ||
72 | + } | ||
73 | + } | ||
74 | + | ||
75 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
76 | + private static extern RootSystem.IntPtr Windows_Kinect_BodyIndexFrame_get_FrameDescription(RootSystem.IntPtr pNative); | ||
77 | + public Windows.Kinect.FrameDescription FrameDescription | ||
78 | + { | ||
79 | + get | ||
80 | + { | ||
81 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
82 | + { | ||
83 | + throw new RootSystem.ObjectDisposedException("BodyIndexFrame"); | ||
84 | + } | ||
85 | + | ||
86 | + RootSystem.IntPtr objectPointer = Windows_Kinect_BodyIndexFrame_get_FrameDescription(_pNative); | ||
87 | + Helper.ExceptionHelper.CheckLastError(); | ||
88 | + if (objectPointer == RootSystem.IntPtr.Zero) | ||
89 | + { | ||
90 | + return null; | ||
91 | + } | ||
92 | + | ||
93 | + return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.FrameDescription>(objectPointer, n => new Windows.Kinect.FrameDescription(n)); | ||
94 | + } | ||
95 | + } | ||
96 | + | ||
97 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
98 | + private static extern long Windows_Kinect_BodyIndexFrame_get_RelativeTime(RootSystem.IntPtr pNative); | ||
99 | + public RootSystem.TimeSpan RelativeTime | ||
100 | + { | ||
101 | + get | ||
102 | + { | ||
103 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
104 | + { | ||
105 | + throw new RootSystem.ObjectDisposedException("BodyIndexFrame"); | ||
106 | + } | ||
107 | + | ||
108 | + return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_BodyIndexFrame_get_RelativeTime(_pNative)); | ||
109 | + } | ||
110 | + } | ||
111 | + | ||
112 | + | ||
113 | + // Public Methods | ||
114 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
115 | + private static extern void Windows_Kinect_BodyIndexFrame_CopyFrameDataToArray(RootSystem.IntPtr pNative, RootSystem.IntPtr frameData, int frameDataSize); | ||
116 | + public void CopyFrameDataToArray(byte[] frameData) | ||
117 | + { | ||
118 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
119 | + { | ||
120 | + throw new RootSystem.ObjectDisposedException("BodyIndexFrame"); | ||
121 | + } | ||
122 | + | ||
123 | + var frameDataSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(frameData, RootSystem.Runtime.InteropServices.GCHandleType.Pinned)); | ||
124 | + var _frameData = frameDataSmartGCHandle.AddrOfPinnedObject(); | ||
125 | + Windows_Kinect_BodyIndexFrame_CopyFrameDataToArray(_pNative, _frameData, frameData.Length); | ||
126 | + Helper.ExceptionHelper.CheckLastError(); | ||
127 | + } | ||
128 | + | ||
129 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
130 | + private static extern void Windows_Kinect_BodyIndexFrame_Dispose(RootSystem.IntPtr pNative); | ||
131 | + public void Dispose() | ||
132 | + { | ||
133 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
134 | + { | ||
135 | + return; | ||
136 | + } | ||
137 | + | ||
138 | + Dispose(true); | ||
139 | + RootSystem.GC.SuppressFinalize(this); | ||
140 | + } | ||
141 | + | ||
142 | + private void __EventCleanup() | ||
143 | + { | ||
144 | + } | ||
145 | + } | ||
146 | + | ||
147 | +} |
sourcecode/capstone/Assets/Standard Assets/Windows/Kinect/BodyIndexFrameArrivedEventArgs.cs
0 → 100644
1 | +using RootSystem = System; | ||
2 | +using System.Linq; | ||
3 | +using System.Collections.Generic; | ||
4 | +namespace Windows.Kinect | ||
5 | +{ | ||
6 | + // | ||
7 | + // Windows.Kinect.BodyIndexFrameArrivedEventArgs | ||
8 | + // | ||
9 | + public sealed partial class BodyIndexFrameArrivedEventArgs : RootSystem.EventArgs, Helper.INativeWrapper | ||
10 | + | ||
11 | + { | ||
12 | + internal RootSystem.IntPtr _pNative; | ||
13 | + RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } } | ||
14 | + | ||
15 | + // Constructors and Finalizers | ||
16 | + internal BodyIndexFrameArrivedEventArgs(RootSystem.IntPtr pNative) | ||
17 | + { | ||
18 | + _pNative = pNative; | ||
19 | + Windows_Kinect_BodyIndexFrameArrivedEventArgs_AddRefObject(ref _pNative); | ||
20 | + } | ||
21 | + | ||
22 | + ~BodyIndexFrameArrivedEventArgs() | ||
23 | + { | ||
24 | + Dispose(false); | ||
25 | + } | ||
26 | + | ||
27 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
28 | + private static extern void Windows_Kinect_BodyIndexFrameArrivedEventArgs_ReleaseObject(ref RootSystem.IntPtr pNative); | ||
29 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
30 | + private static extern void Windows_Kinect_BodyIndexFrameArrivedEventArgs_AddRefObject(ref RootSystem.IntPtr pNative); | ||
31 | + private void Dispose(bool disposing) | ||
32 | + { | ||
33 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
34 | + { | ||
35 | + return; | ||
36 | + } | ||
37 | + | ||
38 | + __EventCleanup(); | ||
39 | + | ||
40 | + Helper.NativeObjectCache.RemoveObject<BodyIndexFrameArrivedEventArgs>(_pNative); | ||
41 | + Windows_Kinect_BodyIndexFrameArrivedEventArgs_ReleaseObject(ref _pNative); | ||
42 | + | ||
43 | + _pNative = RootSystem.IntPtr.Zero; | ||
44 | + } | ||
45 | + | ||
46 | + | ||
47 | + // Public Properties | ||
48 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
49 | + private static extern RootSystem.IntPtr Windows_Kinect_BodyIndexFrameArrivedEventArgs_get_FrameReference(RootSystem.IntPtr pNative); | ||
50 | + public Windows.Kinect.BodyIndexFrameReference FrameReference | ||
51 | + { | ||
52 | + get | ||
53 | + { | ||
54 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
55 | + { | ||
56 | + throw new RootSystem.ObjectDisposedException("BodyIndexFrameArrivedEventArgs"); | ||
57 | + } | ||
58 | + | ||
59 | + RootSystem.IntPtr objectPointer = Windows_Kinect_BodyIndexFrameArrivedEventArgs_get_FrameReference(_pNative); | ||
60 | + Helper.ExceptionHelper.CheckLastError(); | ||
61 | + if (objectPointer == RootSystem.IntPtr.Zero) | ||
62 | + { | ||
63 | + return null; | ||
64 | + } | ||
65 | + | ||
66 | + return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.BodyIndexFrameReference>(objectPointer, n => new Windows.Kinect.BodyIndexFrameReference(n)); | ||
67 | + } | ||
68 | + } | ||
69 | + | ||
70 | + private void __EventCleanup() | ||
71 | + { | ||
72 | + } | ||
73 | + } | ||
74 | + | ||
75 | +} |
This diff is collapsed. Click to expand it.
1 | +using RootSystem = System; | ||
2 | +using System.Linq; | ||
3 | +using System.Collections.Generic; | ||
4 | +namespace Windows.Kinect | ||
5 | +{ | ||
6 | + // | ||
7 | + // Windows.Kinect.BodyIndexFrameReference | ||
8 | + // | ||
9 | + public sealed partial class BodyIndexFrameReference : Helper.INativeWrapper | ||
10 | + | ||
11 | + { | ||
12 | + internal RootSystem.IntPtr _pNative; | ||
13 | + RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } } | ||
14 | + | ||
15 | + // Constructors and Finalizers | ||
16 | + internal BodyIndexFrameReference(RootSystem.IntPtr pNative) | ||
17 | + { | ||
18 | + _pNative = pNative; | ||
19 | + Windows_Kinect_BodyIndexFrameReference_AddRefObject(ref _pNative); | ||
20 | + } | ||
21 | + | ||
22 | + ~BodyIndexFrameReference() | ||
23 | + { | ||
24 | + Dispose(false); | ||
25 | + } | ||
26 | + | ||
27 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
28 | + private static extern void Windows_Kinect_BodyIndexFrameReference_ReleaseObject(ref RootSystem.IntPtr pNative); | ||
29 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
30 | + private static extern void Windows_Kinect_BodyIndexFrameReference_AddRefObject(ref RootSystem.IntPtr pNative); | ||
31 | + private void Dispose(bool disposing) | ||
32 | + { | ||
33 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
34 | + { | ||
35 | + return; | ||
36 | + } | ||
37 | + | ||
38 | + __EventCleanup(); | ||
39 | + | ||
40 | + Helper.NativeObjectCache.RemoveObject<BodyIndexFrameReference>(_pNative); | ||
41 | + Windows_Kinect_BodyIndexFrameReference_ReleaseObject(ref _pNative); | ||
42 | + | ||
43 | + _pNative = RootSystem.IntPtr.Zero; | ||
44 | + } | ||
45 | + | ||
46 | + | ||
47 | + // Public Properties | ||
48 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
49 | + private static extern long Windows_Kinect_BodyIndexFrameReference_get_RelativeTime(RootSystem.IntPtr pNative); | ||
50 | + public RootSystem.TimeSpan RelativeTime | ||
51 | + { | ||
52 | + get | ||
53 | + { | ||
54 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
55 | + { | ||
56 | + throw new RootSystem.ObjectDisposedException("BodyIndexFrameReference"); | ||
57 | + } | ||
58 | + | ||
59 | + return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_BodyIndexFrameReference_get_RelativeTime(_pNative)); | ||
60 | + } | ||
61 | + } | ||
62 | + | ||
63 | + | ||
64 | + // Public Methods | ||
65 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
66 | + private static extern RootSystem.IntPtr Windows_Kinect_BodyIndexFrameReference_AcquireFrame(RootSystem.IntPtr pNative); | ||
67 | + public Windows.Kinect.BodyIndexFrame AcquireFrame() | ||
68 | + { | ||
69 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
70 | + { | ||
71 | + throw new RootSystem.ObjectDisposedException("BodyIndexFrameReference"); | ||
72 | + } | ||
73 | + | ||
74 | + RootSystem.IntPtr objectPointer = Windows_Kinect_BodyIndexFrameReference_AcquireFrame(_pNative); | ||
75 | + Helper.ExceptionHelper.CheckLastError(); | ||
76 | + if (objectPointer == RootSystem.IntPtr.Zero) | ||
77 | + { | ||
78 | + return null; | ||
79 | + } | ||
80 | + | ||
81 | + return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.BodyIndexFrame>(objectPointer, n => new Windows.Kinect.BodyIndexFrame(n)); | ||
82 | + } | ||
83 | + | ||
84 | + private void __EventCleanup() | ||
85 | + { | ||
86 | + } | ||
87 | + } | ||
88 | + | ||
89 | +} |
This diff is collapsed. Click to expand it.
1 | +using RootSystem = System; | ||
2 | +using System.Linq; | ||
3 | +using System.Collections.Generic; | ||
4 | +namespace Windows.Kinect | ||
5 | +{ | ||
6 | + // | ||
7 | + // Windows.Kinect.CameraSpacePoint | ||
8 | + // | ||
9 | + [RootSystem.Runtime.InteropServices.StructLayout(RootSystem.Runtime.InteropServices.LayoutKind.Sequential)] | ||
10 | + public struct CameraSpacePoint | ||
11 | + { | ||
12 | + public float X { get; set; } | ||
13 | + public float Y { get; set; } | ||
14 | + public float Z { get; set; } | ||
15 | + | ||
16 | + public override int GetHashCode() | ||
17 | + { | ||
18 | + return X.GetHashCode() ^ Y.GetHashCode() ^ Z.GetHashCode(); | ||
19 | + } | ||
20 | + | ||
21 | + public override bool Equals(object obj) | ||
22 | + { | ||
23 | + if (!(obj is CameraSpacePoint)) | ||
24 | + { | ||
25 | + return false; | ||
26 | + } | ||
27 | + | ||
28 | + return this.Equals((CameraSpacePoint)obj); | ||
29 | + } | ||
30 | + | ||
31 | + public bool Equals(CameraSpacePoint obj) | ||
32 | + { | ||
33 | + return X.Equals(obj.X) && Y.Equals(obj.Y) && Z.Equals(obj.Z); | ||
34 | + } | ||
35 | + | ||
36 | + public static bool operator ==(CameraSpacePoint a, CameraSpacePoint b) | ||
37 | + { | ||
38 | + return a.Equals(b); | ||
39 | + } | ||
40 | + | ||
41 | + public static bool operator !=(CameraSpacePoint a, CameraSpacePoint b) | ||
42 | + { | ||
43 | + return !(a.Equals(b)); | ||
44 | + } | ||
45 | + } | ||
46 | + | ||
47 | +} |
1 | +using RootSystem = System; | ||
2 | +using System.Linq; | ||
3 | +using System.Collections.Generic; | ||
4 | +namespace Windows.Kinect | ||
5 | +{ | ||
6 | + // | ||
7 | + // Windows.Kinect.ColorCameraSettings | ||
8 | + // | ||
9 | + public sealed partial class ColorCameraSettings : Helper.INativeWrapper | ||
10 | + | ||
11 | + { | ||
12 | + internal RootSystem.IntPtr _pNative; | ||
13 | + RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } } | ||
14 | + | ||
15 | + // Constructors and Finalizers | ||
16 | + internal ColorCameraSettings(RootSystem.IntPtr pNative) | ||
17 | + { | ||
18 | + _pNative = pNative; | ||
19 | + Windows_Kinect_ColorCameraSettings_AddRefObject(ref _pNative); | ||
20 | + } | ||
21 | + | ||
22 | + ~ColorCameraSettings() | ||
23 | + { | ||
24 | + Dispose(false); | ||
25 | + } | ||
26 | + | ||
27 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
28 | + private static extern void Windows_Kinect_ColorCameraSettings_ReleaseObject(ref RootSystem.IntPtr pNative); | ||
29 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
30 | + private static extern void Windows_Kinect_ColorCameraSettings_AddRefObject(ref RootSystem.IntPtr pNative); | ||
31 | + private void Dispose(bool disposing) | ||
32 | + { | ||
33 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
34 | + { | ||
35 | + return; | ||
36 | + } | ||
37 | + | ||
38 | + __EventCleanup(); | ||
39 | + | ||
40 | + Helper.NativeObjectCache.RemoveObject<ColorCameraSettings>(_pNative); | ||
41 | + Windows_Kinect_ColorCameraSettings_ReleaseObject(ref _pNative); | ||
42 | + | ||
43 | + _pNative = RootSystem.IntPtr.Zero; | ||
44 | + } | ||
45 | + | ||
46 | + | ||
47 | + // Public Properties | ||
48 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
49 | + private static extern long Windows_Kinect_ColorCameraSettings_get_ExposureTime(RootSystem.IntPtr pNative); | ||
50 | + public RootSystem.TimeSpan ExposureTime | ||
51 | + { | ||
52 | + get | ||
53 | + { | ||
54 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
55 | + { | ||
56 | + throw new RootSystem.ObjectDisposedException("ColorCameraSettings"); | ||
57 | + } | ||
58 | + | ||
59 | + return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_ColorCameraSettings_get_ExposureTime(_pNative)); | ||
60 | + } | ||
61 | + } | ||
62 | + | ||
63 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
64 | + private static extern long Windows_Kinect_ColorCameraSettings_get_FrameInterval(RootSystem.IntPtr pNative); | ||
65 | + public RootSystem.TimeSpan FrameInterval | ||
66 | + { | ||
67 | + get | ||
68 | + { | ||
69 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
70 | + { | ||
71 | + throw new RootSystem.ObjectDisposedException("ColorCameraSettings"); | ||
72 | + } | ||
73 | + | ||
74 | + return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_ColorCameraSettings_get_FrameInterval(_pNative)); | ||
75 | + } | ||
76 | + } | ||
77 | + | ||
78 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
79 | + private static extern float Windows_Kinect_ColorCameraSettings_get_Gain(RootSystem.IntPtr pNative); | ||
80 | + public float Gain | ||
81 | + { | ||
82 | + get | ||
83 | + { | ||
84 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
85 | + { | ||
86 | + throw new RootSystem.ObjectDisposedException("ColorCameraSettings"); | ||
87 | + } | ||
88 | + | ||
89 | + return Windows_Kinect_ColorCameraSettings_get_Gain(_pNative); | ||
90 | + } | ||
91 | + } | ||
92 | + | ||
93 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
94 | + private static extern float Windows_Kinect_ColorCameraSettings_get_Gamma(RootSystem.IntPtr pNative); | ||
95 | + public float Gamma | ||
96 | + { | ||
97 | + get | ||
98 | + { | ||
99 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
100 | + { | ||
101 | + throw new RootSystem.ObjectDisposedException("ColorCameraSettings"); | ||
102 | + } | ||
103 | + | ||
104 | + return Windows_Kinect_ColorCameraSettings_get_Gamma(_pNative); | ||
105 | + } | ||
106 | + } | ||
107 | + | ||
108 | + private void __EventCleanup() | ||
109 | + { | ||
110 | + } | ||
111 | + } | ||
112 | + | ||
113 | +} |
1 | +using RootSystem = System; | ||
2 | +using System.Linq; | ||
3 | +using System.Collections.Generic; | ||
4 | +namespace Windows.Kinect | ||
5 | +{ | ||
6 | + // | ||
7 | + // Windows.Kinect.ColorFrame | ||
8 | + // | ||
9 | + public sealed partial class ColorFrame : RootSystem.IDisposable, Helper.INativeWrapper | ||
10 | + | ||
11 | + { | ||
12 | + internal RootSystem.IntPtr _pNative; | ||
13 | + RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } } | ||
14 | + | ||
15 | + // Constructors and Finalizers | ||
16 | + internal ColorFrame(RootSystem.IntPtr pNative) | ||
17 | + { | ||
18 | + _pNative = pNative; | ||
19 | + Windows_Kinect_ColorFrame_AddRefObject(ref _pNative); | ||
20 | + } | ||
21 | + | ||
22 | + ~ColorFrame() | ||
23 | + { | ||
24 | + Dispose(false); | ||
25 | + } | ||
26 | + | ||
27 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
28 | + private static extern void Windows_Kinect_ColorFrame_ReleaseObject(ref RootSystem.IntPtr pNative); | ||
29 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
30 | + private static extern void Windows_Kinect_ColorFrame_AddRefObject(ref RootSystem.IntPtr pNative); | ||
31 | + private void Dispose(bool disposing) | ||
32 | + { | ||
33 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
34 | + { | ||
35 | + return; | ||
36 | + } | ||
37 | + | ||
38 | + __EventCleanup(); | ||
39 | + | ||
40 | + Helper.NativeObjectCache.RemoveObject<ColorFrame>(_pNative); | ||
41 | + | ||
42 | + if (disposing) | ||
43 | + { | ||
44 | + Windows_Kinect_ColorFrame_Dispose(_pNative); | ||
45 | + } | ||
46 | + Windows_Kinect_ColorFrame_ReleaseObject(ref _pNative); | ||
47 | + | ||
48 | + _pNative = RootSystem.IntPtr.Zero; | ||
49 | + } | ||
50 | + | ||
51 | + | ||
52 | + // Public Properties | ||
53 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
54 | + private static extern RootSystem.IntPtr Windows_Kinect_ColorFrame_get_ColorCameraSettings(RootSystem.IntPtr pNative); | ||
55 | + public Windows.Kinect.ColorCameraSettings ColorCameraSettings | ||
56 | + { | ||
57 | + get | ||
58 | + { | ||
59 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
60 | + { | ||
61 | + throw new RootSystem.ObjectDisposedException("ColorFrame"); | ||
62 | + } | ||
63 | + | ||
64 | + RootSystem.IntPtr objectPointer = Windows_Kinect_ColorFrame_get_ColorCameraSettings(_pNative); | ||
65 | + Helper.ExceptionHelper.CheckLastError(); | ||
66 | + if (objectPointer == RootSystem.IntPtr.Zero) | ||
67 | + { | ||
68 | + return null; | ||
69 | + } | ||
70 | + | ||
71 | + return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.ColorCameraSettings>(objectPointer, n => new Windows.Kinect.ColorCameraSettings(n)); | ||
72 | + } | ||
73 | + } | ||
74 | + | ||
75 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
76 | + private static extern RootSystem.IntPtr Windows_Kinect_ColorFrame_get_ColorFrameSource(RootSystem.IntPtr pNative); | ||
77 | + public Windows.Kinect.ColorFrameSource ColorFrameSource | ||
78 | + { | ||
79 | + get | ||
80 | + { | ||
81 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
82 | + { | ||
83 | + throw new RootSystem.ObjectDisposedException("ColorFrame"); | ||
84 | + } | ||
85 | + | ||
86 | + RootSystem.IntPtr objectPointer = Windows_Kinect_ColorFrame_get_ColorFrameSource(_pNative); | ||
87 | + Helper.ExceptionHelper.CheckLastError(); | ||
88 | + if (objectPointer == RootSystem.IntPtr.Zero) | ||
89 | + { | ||
90 | + return null; | ||
91 | + } | ||
92 | + | ||
93 | + return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.ColorFrameSource>(objectPointer, n => new Windows.Kinect.ColorFrameSource(n)); | ||
94 | + } | ||
95 | + } | ||
96 | + | ||
97 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
98 | + private static extern RootSystem.IntPtr Windows_Kinect_ColorFrame_get_FrameDescription(RootSystem.IntPtr pNative); | ||
99 | + public Windows.Kinect.FrameDescription FrameDescription | ||
100 | + { | ||
101 | + get | ||
102 | + { | ||
103 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
104 | + { | ||
105 | + throw new RootSystem.ObjectDisposedException("ColorFrame"); | ||
106 | + } | ||
107 | + | ||
108 | + RootSystem.IntPtr objectPointer = Windows_Kinect_ColorFrame_get_FrameDescription(_pNative); | ||
109 | + Helper.ExceptionHelper.CheckLastError(); | ||
110 | + if (objectPointer == RootSystem.IntPtr.Zero) | ||
111 | + { | ||
112 | + return null; | ||
113 | + } | ||
114 | + | ||
115 | + return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.FrameDescription>(objectPointer, n => new Windows.Kinect.FrameDescription(n)); | ||
116 | + } | ||
117 | + } | ||
118 | + | ||
119 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
120 | + private static extern Windows.Kinect.ColorImageFormat Windows_Kinect_ColorFrame_get_RawColorImageFormat(RootSystem.IntPtr pNative); | ||
121 | + public Windows.Kinect.ColorImageFormat RawColorImageFormat | ||
122 | + { | ||
123 | + get | ||
124 | + { | ||
125 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
126 | + { | ||
127 | + throw new RootSystem.ObjectDisposedException("ColorFrame"); | ||
128 | + } | ||
129 | + | ||
130 | + return Windows_Kinect_ColorFrame_get_RawColorImageFormat(_pNative); | ||
131 | + } | ||
132 | + } | ||
133 | + | ||
134 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
135 | + private static extern long Windows_Kinect_ColorFrame_get_RelativeTime(RootSystem.IntPtr pNative); | ||
136 | + public RootSystem.TimeSpan RelativeTime | ||
137 | + { | ||
138 | + get | ||
139 | + { | ||
140 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
141 | + { | ||
142 | + throw new RootSystem.ObjectDisposedException("ColorFrame"); | ||
143 | + } | ||
144 | + | ||
145 | + return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_ColorFrame_get_RelativeTime(_pNative)); | ||
146 | + } | ||
147 | + } | ||
148 | + | ||
149 | + | ||
150 | + // Public Methods | ||
151 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
152 | + private static extern void Windows_Kinect_ColorFrame_CopyRawFrameDataToArray(RootSystem.IntPtr pNative, RootSystem.IntPtr frameData, int frameDataSize); | ||
153 | + public void CopyRawFrameDataToArray(byte[] frameData) | ||
154 | + { | ||
155 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
156 | + { | ||
157 | + throw new RootSystem.ObjectDisposedException("ColorFrame"); | ||
158 | + } | ||
159 | + | ||
160 | + var frameDataSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(frameData, RootSystem.Runtime.InteropServices.GCHandleType.Pinned)); | ||
161 | + var _frameData = frameDataSmartGCHandle.AddrOfPinnedObject(); | ||
162 | + Windows_Kinect_ColorFrame_CopyRawFrameDataToArray(_pNative, _frameData, frameData.Length); | ||
163 | + Helper.ExceptionHelper.CheckLastError(); | ||
164 | + } | ||
165 | + | ||
166 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
167 | + private static extern void Windows_Kinect_ColorFrame_CopyConvertedFrameDataToArray(RootSystem.IntPtr pNative, RootSystem.IntPtr frameData, int frameDataSize, Windows.Kinect.ColorImageFormat colorFormat); | ||
168 | + public void CopyConvertedFrameDataToArray(byte[] frameData, Windows.Kinect.ColorImageFormat colorFormat) | ||
169 | + { | ||
170 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
171 | + { | ||
172 | + throw new RootSystem.ObjectDisposedException("ColorFrame"); | ||
173 | + } | ||
174 | + | ||
175 | + var frameDataSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(frameData, RootSystem.Runtime.InteropServices.GCHandleType.Pinned)); | ||
176 | + var _frameData = frameDataSmartGCHandle.AddrOfPinnedObject(); | ||
177 | + Windows_Kinect_ColorFrame_CopyConvertedFrameDataToArray(_pNative, _frameData, frameData.Length, colorFormat); | ||
178 | + Helper.ExceptionHelper.CheckLastError(); | ||
179 | + } | ||
180 | + | ||
181 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
182 | + private static extern RootSystem.IntPtr Windows_Kinect_ColorFrame_CreateFrameDescription(RootSystem.IntPtr pNative, Windows.Kinect.ColorImageFormat format); | ||
183 | + public Windows.Kinect.FrameDescription CreateFrameDescription(Windows.Kinect.ColorImageFormat format) | ||
184 | + { | ||
185 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
186 | + { | ||
187 | + throw new RootSystem.ObjectDisposedException("ColorFrame"); | ||
188 | + } | ||
189 | + | ||
190 | + RootSystem.IntPtr objectPointer = Windows_Kinect_ColorFrame_CreateFrameDescription(_pNative, format); | ||
191 | + Helper.ExceptionHelper.CheckLastError(); | ||
192 | + if (objectPointer == RootSystem.IntPtr.Zero) | ||
193 | + { | ||
194 | + return null; | ||
195 | + } | ||
196 | + | ||
197 | + return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.FrameDescription>(objectPointer, n => new Windows.Kinect.FrameDescription(n)); | ||
198 | + } | ||
199 | + | ||
200 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
201 | + private static extern void Windows_Kinect_ColorFrame_Dispose(RootSystem.IntPtr pNative); | ||
202 | + public void Dispose() | ||
203 | + { | ||
204 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
205 | + { | ||
206 | + return; | ||
207 | + } | ||
208 | + | ||
209 | + Dispose(true); | ||
210 | + RootSystem.GC.SuppressFinalize(this); | ||
211 | + } | ||
212 | + | ||
213 | + private void __EventCleanup() | ||
214 | + { | ||
215 | + } | ||
216 | + } | ||
217 | + | ||
218 | +} |
1 | +using RootSystem = System; | ||
2 | +using System.Linq; | ||
3 | +using System.Collections.Generic; | ||
4 | +namespace Windows.Kinect | ||
5 | +{ | ||
6 | + // | ||
7 | + // Windows.Kinect.ColorFrameArrivedEventArgs | ||
8 | + // | ||
9 | + public sealed partial class ColorFrameArrivedEventArgs : RootSystem.EventArgs, Helper.INativeWrapper | ||
10 | + | ||
11 | + { | ||
12 | + internal RootSystem.IntPtr _pNative; | ||
13 | + RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } } | ||
14 | + | ||
15 | + // Constructors and Finalizers | ||
16 | + internal ColorFrameArrivedEventArgs(RootSystem.IntPtr pNative) | ||
17 | + { | ||
18 | + _pNative = pNative; | ||
19 | + Windows_Kinect_ColorFrameArrivedEventArgs_AddRefObject(ref _pNative); | ||
20 | + } | ||
21 | + | ||
22 | + ~ColorFrameArrivedEventArgs() | ||
23 | + { | ||
24 | + Dispose(false); | ||
25 | + } | ||
26 | + | ||
27 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
28 | + private static extern void Windows_Kinect_ColorFrameArrivedEventArgs_ReleaseObject(ref RootSystem.IntPtr pNative); | ||
29 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
30 | + private static extern void Windows_Kinect_ColorFrameArrivedEventArgs_AddRefObject(ref RootSystem.IntPtr pNative); | ||
31 | + private void Dispose(bool disposing) | ||
32 | + { | ||
33 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
34 | + { | ||
35 | + return; | ||
36 | + } | ||
37 | + | ||
38 | + __EventCleanup(); | ||
39 | + | ||
40 | + Helper.NativeObjectCache.RemoveObject<ColorFrameArrivedEventArgs>(_pNative); | ||
41 | + Windows_Kinect_ColorFrameArrivedEventArgs_ReleaseObject(ref _pNative); | ||
42 | + | ||
43 | + _pNative = RootSystem.IntPtr.Zero; | ||
44 | + } | ||
45 | + | ||
46 | + | ||
47 | + // Public Properties | ||
48 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
49 | + private static extern RootSystem.IntPtr Windows_Kinect_ColorFrameArrivedEventArgs_get_FrameReference(RootSystem.IntPtr pNative); | ||
50 | + public Windows.Kinect.ColorFrameReference FrameReference | ||
51 | + { | ||
52 | + get | ||
53 | + { | ||
54 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
55 | + { | ||
56 | + throw new RootSystem.ObjectDisposedException("ColorFrameArrivedEventArgs"); | ||
57 | + } | ||
58 | + | ||
59 | + RootSystem.IntPtr objectPointer = Windows_Kinect_ColorFrameArrivedEventArgs_get_FrameReference(_pNative); | ||
60 | + Helper.ExceptionHelper.CheckLastError(); | ||
61 | + if (objectPointer == RootSystem.IntPtr.Zero) | ||
62 | + { | ||
63 | + return null; | ||
64 | + } | ||
65 | + | ||
66 | + return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.ColorFrameReference>(objectPointer, n => new Windows.Kinect.ColorFrameReference(n)); | ||
67 | + } | ||
68 | + } | ||
69 | + | ||
70 | + private void __EventCleanup() | ||
71 | + { | ||
72 | + } | ||
73 | + } | ||
74 | + | ||
75 | +} |
This diff is collapsed. Click to expand it.
1 | +using RootSystem = System; | ||
2 | +using System.Linq; | ||
3 | +using System.Collections.Generic; | ||
4 | +namespace Windows.Kinect | ||
5 | +{ | ||
6 | + // | ||
7 | + // Windows.Kinect.ColorFrameReference | ||
8 | + // | ||
9 | + public sealed partial class ColorFrameReference : Helper.INativeWrapper | ||
10 | + | ||
11 | + { | ||
12 | + internal RootSystem.IntPtr _pNative; | ||
13 | + RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } } | ||
14 | + | ||
15 | + // Constructors and Finalizers | ||
16 | + internal ColorFrameReference(RootSystem.IntPtr pNative) | ||
17 | + { | ||
18 | + _pNative = pNative; | ||
19 | + Windows_Kinect_ColorFrameReference_AddRefObject(ref _pNative); | ||
20 | + } | ||
21 | + | ||
22 | + ~ColorFrameReference() | ||
23 | + { | ||
24 | + Dispose(false); | ||
25 | + } | ||
26 | + | ||
27 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
28 | + private static extern void Windows_Kinect_ColorFrameReference_ReleaseObject(ref RootSystem.IntPtr pNative); | ||
29 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
30 | + private static extern void Windows_Kinect_ColorFrameReference_AddRefObject(ref RootSystem.IntPtr pNative); | ||
31 | + private void Dispose(bool disposing) | ||
32 | + { | ||
33 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
34 | + { | ||
35 | + return; | ||
36 | + } | ||
37 | + | ||
38 | + __EventCleanup(); | ||
39 | + | ||
40 | + Helper.NativeObjectCache.RemoveObject<ColorFrameReference>(_pNative); | ||
41 | + Windows_Kinect_ColorFrameReference_ReleaseObject(ref _pNative); | ||
42 | + | ||
43 | + _pNative = RootSystem.IntPtr.Zero; | ||
44 | + } | ||
45 | + | ||
46 | + | ||
47 | + // Public Properties | ||
48 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
49 | + private static extern long Windows_Kinect_ColorFrameReference_get_RelativeTime(RootSystem.IntPtr pNative); | ||
50 | + public RootSystem.TimeSpan RelativeTime | ||
51 | + { | ||
52 | + get | ||
53 | + { | ||
54 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
55 | + { | ||
56 | + throw new RootSystem.ObjectDisposedException("ColorFrameReference"); | ||
57 | + } | ||
58 | + | ||
59 | + return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_ColorFrameReference_get_RelativeTime(_pNative)); | ||
60 | + } | ||
61 | + } | ||
62 | + | ||
63 | + | ||
64 | + // Public Methods | ||
65 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
66 | + private static extern RootSystem.IntPtr Windows_Kinect_ColorFrameReference_AcquireFrame(RootSystem.IntPtr pNative); | ||
67 | + public Windows.Kinect.ColorFrame AcquireFrame() | ||
68 | + { | ||
69 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
70 | + { | ||
71 | + throw new RootSystem.ObjectDisposedException("ColorFrameReference"); | ||
72 | + } | ||
73 | + | ||
74 | + RootSystem.IntPtr objectPointer = Windows_Kinect_ColorFrameReference_AcquireFrame(_pNative); | ||
75 | + Helper.ExceptionHelper.CheckLastError(); | ||
76 | + if (objectPointer == RootSystem.IntPtr.Zero) | ||
77 | + { | ||
78 | + return null; | ||
79 | + } | ||
80 | + | ||
81 | + return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.ColorFrame>(objectPointer, n => new Windows.Kinect.ColorFrame(n)); | ||
82 | + } | ||
83 | + | ||
84 | + private void __EventCleanup() | ||
85 | + { | ||
86 | + } | ||
87 | + } | ||
88 | + | ||
89 | +} |
This diff is collapsed. Click to expand it.
1 | +using RootSystem = System; | ||
2 | +using System.Linq; | ||
3 | +using System.Collections.Generic; | ||
4 | +namespace Windows.Kinect | ||
5 | +{ | ||
6 | + // | ||
7 | + // Windows.Kinect.ColorImageFormat | ||
8 | + // | ||
9 | + public enum ColorImageFormat : int | ||
10 | + { | ||
11 | + None =0, | ||
12 | + Rgba =1, | ||
13 | + Yuv =2, | ||
14 | + Bgra =3, | ||
15 | + Bayer =4, | ||
16 | + Yuy2 =5, | ||
17 | + } | ||
18 | + | ||
19 | +} |
1 | +using RootSystem = System; | ||
2 | +using System.Linq; | ||
3 | +using System.Collections.Generic; | ||
4 | +namespace Windows.Kinect | ||
5 | +{ | ||
6 | + // | ||
7 | + // Windows.Kinect.ColorSpacePoint | ||
8 | + // | ||
9 | + [RootSystem.Runtime.InteropServices.StructLayout(RootSystem.Runtime.InteropServices.LayoutKind.Sequential)] | ||
10 | + public struct ColorSpacePoint | ||
11 | + { | ||
12 | + public float X { get; set; } | ||
13 | + public float Y { get; set; } | ||
14 | + | ||
15 | + public override int GetHashCode() | ||
16 | + { | ||
17 | + return X.GetHashCode() ^ Y.GetHashCode(); | ||
18 | + } | ||
19 | + | ||
20 | + public override bool Equals(object obj) | ||
21 | + { | ||
22 | + if (!(obj is ColorSpacePoint)) | ||
23 | + { | ||
24 | + return false; | ||
25 | + } | ||
26 | + | ||
27 | + return this.Equals((ColorSpacePoint)obj); | ||
28 | + } | ||
29 | + | ||
30 | + public bool Equals(ColorSpacePoint obj) | ||
31 | + { | ||
32 | + return X.Equals(obj.X) && Y.Equals(obj.Y); | ||
33 | + } | ||
34 | + | ||
35 | + public static bool operator ==(ColorSpacePoint a, ColorSpacePoint b) | ||
36 | + { | ||
37 | + return a.Equals(b); | ||
38 | + } | ||
39 | + | ||
40 | + public static bool operator !=(ColorSpacePoint a, ColorSpacePoint b) | ||
41 | + { | ||
42 | + return !(a.Equals(b)); | ||
43 | + } | ||
44 | + } | ||
45 | + | ||
46 | +} |
This diff is collapsed. Click to expand it.
sourcecode/capstone/Assets/Standard Assets/Windows/Kinect/CoordinateMappingChangedEventArgs.cs
0 → 100644
1 | +using RootSystem = System; | ||
2 | +using System.Linq; | ||
3 | +using System.Collections.Generic; | ||
4 | +namespace Windows.Kinect | ||
5 | +{ | ||
6 | + // | ||
7 | + // Windows.Kinect.CoordinateMappingChangedEventArgs | ||
8 | + // | ||
9 | + public sealed partial class CoordinateMappingChangedEventArgs : RootSystem.EventArgs, Helper.INativeWrapper | ||
10 | + | ||
11 | + { | ||
12 | + internal RootSystem.IntPtr _pNative; | ||
13 | + RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } } | ||
14 | + | ||
15 | + // Constructors and Finalizers | ||
16 | + internal CoordinateMappingChangedEventArgs(RootSystem.IntPtr pNative) | ||
17 | + { | ||
18 | + _pNative = pNative; | ||
19 | + Windows_Kinect_CoordinateMappingChangedEventArgs_AddRefObject(ref _pNative); | ||
20 | + } | ||
21 | + | ||
22 | + ~CoordinateMappingChangedEventArgs() | ||
23 | + { | ||
24 | + Dispose(false); | ||
25 | + } | ||
26 | + | ||
27 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
28 | + private static extern void Windows_Kinect_CoordinateMappingChangedEventArgs_ReleaseObject(ref RootSystem.IntPtr pNative); | ||
29 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
30 | + private static extern void Windows_Kinect_CoordinateMappingChangedEventArgs_AddRefObject(ref RootSystem.IntPtr pNative); | ||
31 | + private void Dispose(bool disposing) | ||
32 | + { | ||
33 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
34 | + { | ||
35 | + return; | ||
36 | + } | ||
37 | + | ||
38 | + __EventCleanup(); | ||
39 | + | ||
40 | + Helper.NativeObjectCache.RemoveObject<CoordinateMappingChangedEventArgs>(_pNative); | ||
41 | + Windows_Kinect_CoordinateMappingChangedEventArgs_ReleaseObject(ref _pNative); | ||
42 | + | ||
43 | + _pNative = RootSystem.IntPtr.Zero; | ||
44 | + } | ||
45 | + | ||
46 | + private void __EventCleanup() | ||
47 | + { | ||
48 | + } | ||
49 | + } | ||
50 | + | ||
51 | +} |
1 | +using RootSystem = System; | ||
2 | +using System.Linq; | ||
3 | +using System.Collections.Generic; | ||
4 | +namespace Windows.Kinect | ||
5 | +{ | ||
6 | + // | ||
7 | + // Windows.Kinect.DepthFrame | ||
8 | + // | ||
9 | + public sealed partial class DepthFrame : RootSystem.IDisposable, Helper.INativeWrapper | ||
10 | + | ||
11 | + { | ||
12 | + internal RootSystem.IntPtr _pNative; | ||
13 | + RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } } | ||
14 | + | ||
15 | + // Constructors and Finalizers | ||
16 | + internal DepthFrame(RootSystem.IntPtr pNative) | ||
17 | + { | ||
18 | + _pNative = pNative; | ||
19 | + Windows_Kinect_DepthFrame_AddRefObject(ref _pNative); | ||
20 | + } | ||
21 | + | ||
22 | + ~DepthFrame() | ||
23 | + { | ||
24 | + Dispose(false); | ||
25 | + } | ||
26 | + | ||
27 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
28 | + private static extern void Windows_Kinect_DepthFrame_ReleaseObject(ref RootSystem.IntPtr pNative); | ||
29 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
30 | + private static extern void Windows_Kinect_DepthFrame_AddRefObject(ref RootSystem.IntPtr pNative); | ||
31 | + private void Dispose(bool disposing) | ||
32 | + { | ||
33 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
34 | + { | ||
35 | + return; | ||
36 | + } | ||
37 | + | ||
38 | + __EventCleanup(); | ||
39 | + | ||
40 | + Helper.NativeObjectCache.RemoveObject<DepthFrame>(_pNative); | ||
41 | + | ||
42 | + if (disposing) | ||
43 | + { | ||
44 | + Windows_Kinect_DepthFrame_Dispose(_pNative); | ||
45 | + } | ||
46 | + Windows_Kinect_DepthFrame_ReleaseObject(ref _pNative); | ||
47 | + | ||
48 | + _pNative = RootSystem.IntPtr.Zero; | ||
49 | + } | ||
50 | + | ||
51 | + | ||
52 | + // Public Properties | ||
53 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
54 | + private static extern RootSystem.IntPtr Windows_Kinect_DepthFrame_get_DepthFrameSource(RootSystem.IntPtr pNative); | ||
55 | + public Windows.Kinect.DepthFrameSource DepthFrameSource | ||
56 | + { | ||
57 | + get | ||
58 | + { | ||
59 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
60 | + { | ||
61 | + throw new RootSystem.ObjectDisposedException("DepthFrame"); | ||
62 | + } | ||
63 | + | ||
64 | + RootSystem.IntPtr objectPointer = Windows_Kinect_DepthFrame_get_DepthFrameSource(_pNative); | ||
65 | + Helper.ExceptionHelper.CheckLastError(); | ||
66 | + if (objectPointer == RootSystem.IntPtr.Zero) | ||
67 | + { | ||
68 | + return null; | ||
69 | + } | ||
70 | + | ||
71 | + return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.DepthFrameSource>(objectPointer, n => new Windows.Kinect.DepthFrameSource(n)); | ||
72 | + } | ||
73 | + } | ||
74 | + | ||
75 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
76 | + private static extern ushort Windows_Kinect_DepthFrame_get_DepthMaxReliableDistance(RootSystem.IntPtr pNative); | ||
77 | + public ushort DepthMaxReliableDistance | ||
78 | + { | ||
79 | + get | ||
80 | + { | ||
81 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
82 | + { | ||
83 | + throw new RootSystem.ObjectDisposedException("DepthFrame"); | ||
84 | + } | ||
85 | + | ||
86 | + return Windows_Kinect_DepthFrame_get_DepthMaxReliableDistance(_pNative); | ||
87 | + } | ||
88 | + } | ||
89 | + | ||
90 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
91 | + private static extern ushort Windows_Kinect_DepthFrame_get_DepthMinReliableDistance(RootSystem.IntPtr pNative); | ||
92 | + public ushort DepthMinReliableDistance | ||
93 | + { | ||
94 | + get | ||
95 | + { | ||
96 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
97 | + { | ||
98 | + throw new RootSystem.ObjectDisposedException("DepthFrame"); | ||
99 | + } | ||
100 | + | ||
101 | + return Windows_Kinect_DepthFrame_get_DepthMinReliableDistance(_pNative); | ||
102 | + } | ||
103 | + } | ||
104 | + | ||
105 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
106 | + private static extern RootSystem.IntPtr Windows_Kinect_DepthFrame_get_FrameDescription(RootSystem.IntPtr pNative); | ||
107 | + public Windows.Kinect.FrameDescription FrameDescription | ||
108 | + { | ||
109 | + get | ||
110 | + { | ||
111 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
112 | + { | ||
113 | + throw new RootSystem.ObjectDisposedException("DepthFrame"); | ||
114 | + } | ||
115 | + | ||
116 | + RootSystem.IntPtr objectPointer = Windows_Kinect_DepthFrame_get_FrameDescription(_pNative); | ||
117 | + Helper.ExceptionHelper.CheckLastError(); | ||
118 | + if (objectPointer == RootSystem.IntPtr.Zero) | ||
119 | + { | ||
120 | + return null; | ||
121 | + } | ||
122 | + | ||
123 | + return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.FrameDescription>(objectPointer, n => new Windows.Kinect.FrameDescription(n)); | ||
124 | + } | ||
125 | + } | ||
126 | + | ||
127 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
128 | + private static extern long Windows_Kinect_DepthFrame_get_RelativeTime(RootSystem.IntPtr pNative); | ||
129 | + public RootSystem.TimeSpan RelativeTime | ||
130 | + { | ||
131 | + get | ||
132 | + { | ||
133 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
134 | + { | ||
135 | + throw new RootSystem.ObjectDisposedException("DepthFrame"); | ||
136 | + } | ||
137 | + | ||
138 | + return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_DepthFrame_get_RelativeTime(_pNative)); | ||
139 | + } | ||
140 | + } | ||
141 | + | ||
142 | + | ||
143 | + // Public Methods | ||
144 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
145 | + private static extern void Windows_Kinect_DepthFrame_CopyFrameDataToArray(RootSystem.IntPtr pNative, RootSystem.IntPtr frameData, int frameDataSize); | ||
146 | + public void CopyFrameDataToArray(ushort[] frameData) | ||
147 | + { | ||
148 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
149 | + { | ||
150 | + throw new RootSystem.ObjectDisposedException("DepthFrame"); | ||
151 | + } | ||
152 | + | ||
153 | + var frameDataSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(frameData, RootSystem.Runtime.InteropServices.GCHandleType.Pinned)); | ||
154 | + var _frameData = frameDataSmartGCHandle.AddrOfPinnedObject(); | ||
155 | + Windows_Kinect_DepthFrame_CopyFrameDataToArray(_pNative, _frameData, frameData.Length); | ||
156 | + Helper.ExceptionHelper.CheckLastError(); | ||
157 | + } | ||
158 | + | ||
159 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
160 | + private static extern void Windows_Kinect_DepthFrame_Dispose(RootSystem.IntPtr pNative); | ||
161 | + public void Dispose() | ||
162 | + { | ||
163 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
164 | + { | ||
165 | + return; | ||
166 | + } | ||
167 | + | ||
168 | + Dispose(true); | ||
169 | + RootSystem.GC.SuppressFinalize(this); | ||
170 | + } | ||
171 | + | ||
172 | + private void __EventCleanup() | ||
173 | + { | ||
174 | + } | ||
175 | + } | ||
176 | + | ||
177 | +} |
1 | +using RootSystem = System; | ||
2 | +using System.Linq; | ||
3 | +using System.Collections.Generic; | ||
4 | +namespace Windows.Kinect | ||
5 | +{ | ||
6 | + // | ||
7 | + // Windows.Kinect.DepthFrameArrivedEventArgs | ||
8 | + // | ||
9 | + public sealed partial class DepthFrameArrivedEventArgs : RootSystem.EventArgs, Helper.INativeWrapper | ||
10 | + | ||
11 | + { | ||
12 | + internal RootSystem.IntPtr _pNative; | ||
13 | + RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } } | ||
14 | + | ||
15 | + // Constructors and Finalizers | ||
16 | + internal DepthFrameArrivedEventArgs(RootSystem.IntPtr pNative) | ||
17 | + { | ||
18 | + _pNative = pNative; | ||
19 | + Windows_Kinect_DepthFrameArrivedEventArgs_AddRefObject(ref _pNative); | ||
20 | + } | ||
21 | + | ||
22 | + ~DepthFrameArrivedEventArgs() | ||
23 | + { | ||
24 | + Dispose(false); | ||
25 | + } | ||
26 | + | ||
27 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
28 | + private static extern void Windows_Kinect_DepthFrameArrivedEventArgs_ReleaseObject(ref RootSystem.IntPtr pNative); | ||
29 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
30 | + private static extern void Windows_Kinect_DepthFrameArrivedEventArgs_AddRefObject(ref RootSystem.IntPtr pNative); | ||
31 | + private void Dispose(bool disposing) | ||
32 | + { | ||
33 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
34 | + { | ||
35 | + return; | ||
36 | + } | ||
37 | + | ||
38 | + __EventCleanup(); | ||
39 | + | ||
40 | + Helper.NativeObjectCache.RemoveObject<DepthFrameArrivedEventArgs>(_pNative); | ||
41 | + Windows_Kinect_DepthFrameArrivedEventArgs_ReleaseObject(ref _pNative); | ||
42 | + | ||
43 | + _pNative = RootSystem.IntPtr.Zero; | ||
44 | + } | ||
45 | + | ||
46 | + | ||
47 | + // Public Properties | ||
48 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
49 | + private static extern RootSystem.IntPtr Windows_Kinect_DepthFrameArrivedEventArgs_get_FrameReference(RootSystem.IntPtr pNative); | ||
50 | + public Windows.Kinect.DepthFrameReference FrameReference | ||
51 | + { | ||
52 | + get | ||
53 | + { | ||
54 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
55 | + { | ||
56 | + throw new RootSystem.ObjectDisposedException("DepthFrameArrivedEventArgs"); | ||
57 | + } | ||
58 | + | ||
59 | + RootSystem.IntPtr objectPointer = Windows_Kinect_DepthFrameArrivedEventArgs_get_FrameReference(_pNative); | ||
60 | + Helper.ExceptionHelper.CheckLastError(); | ||
61 | + if (objectPointer == RootSystem.IntPtr.Zero) | ||
62 | + { | ||
63 | + return null; | ||
64 | + } | ||
65 | + | ||
66 | + return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.DepthFrameReference>(objectPointer, n => new Windows.Kinect.DepthFrameReference(n)); | ||
67 | + } | ||
68 | + } | ||
69 | + | ||
70 | + private void __EventCleanup() | ||
71 | + { | ||
72 | + } | ||
73 | + } | ||
74 | + | ||
75 | +} |
This diff is collapsed. Click to expand it.
1 | +using RootSystem = System; | ||
2 | +using System.Linq; | ||
3 | +using System.Collections.Generic; | ||
4 | +namespace Windows.Kinect | ||
5 | +{ | ||
6 | + // | ||
7 | + // Windows.Kinect.DepthFrameReference | ||
8 | + // | ||
9 | + public sealed partial class DepthFrameReference : Helper.INativeWrapper | ||
10 | + | ||
11 | + { | ||
12 | + internal RootSystem.IntPtr _pNative; | ||
13 | + RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } } | ||
14 | + | ||
15 | + // Constructors and Finalizers | ||
16 | + internal DepthFrameReference(RootSystem.IntPtr pNative) | ||
17 | + { | ||
18 | + _pNative = pNative; | ||
19 | + Windows_Kinect_DepthFrameReference_AddRefObject(ref _pNative); | ||
20 | + } | ||
21 | + | ||
22 | + ~DepthFrameReference() | ||
23 | + { | ||
24 | + Dispose(false); | ||
25 | + } | ||
26 | + | ||
27 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
28 | + private static extern void Windows_Kinect_DepthFrameReference_ReleaseObject(ref RootSystem.IntPtr pNative); | ||
29 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
30 | + private static extern void Windows_Kinect_DepthFrameReference_AddRefObject(ref RootSystem.IntPtr pNative); | ||
31 | + private void Dispose(bool disposing) | ||
32 | + { | ||
33 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
34 | + { | ||
35 | + return; | ||
36 | + } | ||
37 | + | ||
38 | + __EventCleanup(); | ||
39 | + | ||
40 | + Helper.NativeObjectCache.RemoveObject<DepthFrameReference>(_pNative); | ||
41 | + Windows_Kinect_DepthFrameReference_ReleaseObject(ref _pNative); | ||
42 | + | ||
43 | + _pNative = RootSystem.IntPtr.Zero; | ||
44 | + } | ||
45 | + | ||
46 | + | ||
47 | + // Public Properties | ||
48 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
49 | + private static extern long Windows_Kinect_DepthFrameReference_get_RelativeTime(RootSystem.IntPtr pNative); | ||
50 | + public RootSystem.TimeSpan RelativeTime | ||
51 | + { | ||
52 | + get | ||
53 | + { | ||
54 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
55 | + { | ||
56 | + throw new RootSystem.ObjectDisposedException("DepthFrameReference"); | ||
57 | + } | ||
58 | + | ||
59 | + return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_DepthFrameReference_get_RelativeTime(_pNative)); | ||
60 | + } | ||
61 | + } | ||
62 | + | ||
63 | + | ||
64 | + // Public Methods | ||
65 | + [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)] | ||
66 | + private static extern RootSystem.IntPtr Windows_Kinect_DepthFrameReference_AcquireFrame(RootSystem.IntPtr pNative); | ||
67 | + public Windows.Kinect.DepthFrame AcquireFrame() | ||
68 | + { | ||
69 | + if (_pNative == RootSystem.IntPtr.Zero) | ||
70 | + { | ||
71 | + throw new RootSystem.ObjectDisposedException("DepthFrameReference"); | ||
72 | + } | ||
73 | + | ||
74 | + RootSystem.IntPtr objectPointer = Windows_Kinect_DepthFrameReference_AcquireFrame(_pNative); | ||
75 | + Helper.ExceptionHelper.CheckLastError(); | ||
76 | + if (objectPointer == RootSystem.IntPtr.Zero) | ||
77 | + { | ||
78 | + return null; | ||
79 | + } | ||
80 | + | ||
81 | + return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.DepthFrame>(objectPointer, n => new Windows.Kinect.DepthFrame(n)); | ||
82 | + } | ||
83 | + | ||
84 | + private void __EventCleanup() | ||
85 | + { | ||
86 | + } | ||
87 | + } | ||
88 | + | ||
89 | +} |
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
sourcecode/capstone/Assets/Standard Assets/Windows/Kinect/InfraredFrameArrivedEventArgs.cs
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
sourcecode/capstone/Assets/Standard Assets/Windows/Kinect/LongExposureInfraredFrameReader.cs
0 → 100644
This diff is collapsed. Click to expand it.
sourcecode/capstone/Assets/Standard Assets/Windows/Kinect/LongExposureInfraredFrameReference.cs
0 → 100644
This diff is collapsed. Click to expand it.
sourcecode/capstone/Assets/Standard Assets/Windows/Kinect/LongExposureInfraredFrameSource.cs
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
sourcecode/capstone/Assets/Standard Assets/Windows/Kinect/MultiSourceFrameArrivedEventArgs.cs
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
sourcecode/capstone/NtKinectDll.dll
0 → 100644
No preview for this file type
sourcecode/capstone/Packages/manifest.json
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment