고다경
Showing 144 changed files with 4871 additions and 0 deletions
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Uu]ser[Ss]ettings/
# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[Mm]emoryCaptures/
# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta
# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*
# Autogenerated Jetbrains Rider plugin
/[Aa]ssets/Plugins/Editor/JetBrains*
# Visual Studio cache directory
.vs/
# Gradle cache directory
.gradle/
# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db
# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta
# Unity3D generated file on crash reports
sysinfo.txt
# Builds
*.apk
*.unitypackage
# Crashlytics generated file
crashlytics-build.properties
# Packed Addressables
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*
# Temporary auto-generated Android Assets
/[Aa]ssets/[Ss]treamingAssets/aa.meta
/[Aa]ssets/[Ss]treamingAssets/aa/*
\ No newline at end of file
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: BoneMaterial
m_Shader: {fileID: 200, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _InvFade: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _TintColor: {r: 0.5, g: 0.5, b: 0.5, a: 0.5}
using UnityEngine;
using System.Collections;
using Windows.Kinect;
public class BodySourceManager : MonoBehaviour
{
private KinectSensor _Sensor;
private BodyFrameReader _Reader;
private Body[] _Data = null;
public Body[] GetData()
{
return _Data;
}
void Start ()
{
_Sensor = KinectSensor.GetDefault();
if (_Sensor != null)
{
_Reader = _Sensor.BodyFrameSource.OpenReader();
if (!_Sensor.IsOpen)
{
_Sensor.Open();
}
}
}
void Update ()
{
if (_Reader != null)
{
var frame = _Reader.AcquireLatestFrame();
if (frame != null)
{
if (_Data == null)
{
_Data = new Body[_Sensor.BodyFrameSource.BodyCount];
}
frame.GetAndRefreshBodyData(_Data);
frame.Dispose();
frame = null;
}
}
}
void OnApplicationQuit()
{
if (_Reader != null)
{
_Reader.Dispose();
_Reader = null;
}
if (_Sensor != null)
{
if (_Sensor.IsOpen)
{
_Sensor.Close();
}
_Sensor = null;
}
}
}
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Kinect = Windows.Kinect;
public class BodySourceView : MonoBehaviour
{
public Material BoneMaterial;
public GameObject BodySourceManager;
private Dictionary<ulong, GameObject> _Bodies = new Dictionary<ulong, GameObject>();
private BodySourceManager _BodyManager;
private Dictionary<Kinect.JointType, Kinect.JointType> _BoneMap = new Dictionary<Kinect.JointType, Kinect.JointType>()
{
{ Kinect.JointType.FootLeft, Kinect.JointType.AnkleLeft },
{ Kinect.JointType.AnkleLeft, Kinect.JointType.KneeLeft },
{ Kinect.JointType.KneeLeft, Kinect.JointType.HipLeft },
{ Kinect.JointType.HipLeft, Kinect.JointType.SpineBase },
{ Kinect.JointType.FootRight, Kinect.JointType.AnkleRight },
{ Kinect.JointType.AnkleRight, Kinect.JointType.KneeRight },
{ Kinect.JointType.KneeRight, Kinect.JointType.HipRight },
{ Kinect.JointType.HipRight, Kinect.JointType.SpineBase },
{ Kinect.JointType.HandTipLeft, Kinect.JointType.HandLeft },
{ Kinect.JointType.ThumbLeft, Kinect.JointType.HandLeft },
{ Kinect.JointType.HandLeft, Kinect.JointType.WristLeft },
{ Kinect.JointType.WristLeft, Kinect.JointType.ElbowLeft },
{ Kinect.JointType.ElbowLeft, Kinect.JointType.ShoulderLeft },
{ Kinect.JointType.ShoulderLeft, Kinect.JointType.SpineShoulder },
{ Kinect.JointType.HandTipRight, Kinect.JointType.HandRight },
{ Kinect.JointType.ThumbRight, Kinect.JointType.HandRight },
{ Kinect.JointType.HandRight, Kinect.JointType.WristRight },
{ Kinect.JointType.WristRight, Kinect.JointType.ElbowRight },
{ Kinect.JointType.ElbowRight, Kinect.JointType.ShoulderRight },
{ Kinect.JointType.ShoulderRight, Kinect.JointType.SpineShoulder },
{ Kinect.JointType.SpineBase, Kinect.JointType.SpineMid },
{ Kinect.JointType.SpineMid, Kinect.JointType.SpineShoulder },
{ Kinect.JointType.SpineShoulder, Kinect.JointType.Neck },
{ Kinect.JointType.Neck, Kinect.JointType.Head },
};
void Update ()
{
if (BodySourceManager == null)
{
return;
}
_BodyManager = BodySourceManager.GetComponent<BodySourceManager>();
if (_BodyManager == null)
{
return;
}
Kinect.Body[] data = _BodyManager.GetData();
if (data == null)
{
return;
}
List<ulong> trackedIds = new List<ulong>();
foreach(var body in data)
{
if (body == null)
{
continue;
}
if(body.IsTracked)
{
trackedIds.Add (body.TrackingId);
}
}
List<ulong> knownIds = new List<ulong>(_Bodies.Keys);
// First delete untracked bodies
foreach(ulong trackingId in knownIds)
{
if(!trackedIds.Contains(trackingId))
{
Destroy(_Bodies[trackingId]);
_Bodies.Remove(trackingId);
}
}
foreach(var body in data)
{
if (body == null)
{
continue;
}
if(body.IsTracked)
{
if(!_Bodies.ContainsKey(body.TrackingId))
{
_Bodies[body.TrackingId] = CreateBodyObject(body.TrackingId);
}
RefreshBodyObject(body, _Bodies[body.TrackingId]);
}
}
}
private GameObject CreateBodyObject(ulong id)
{
GameObject body = new GameObject("Body:" + id);
for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++)
{
GameObject jointObj = GameObject.CreatePrimitive(PrimitiveType.Cube);
LineRenderer lr = jointObj.AddComponent<LineRenderer>();
lr.SetVertexCount(2);
lr.material = BoneMaterial;
lr.SetWidth(0.05f, 0.05f);
jointObj.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
jointObj.name = jt.ToString();
jointObj.transform.parent = body.transform;
}
return body;
}
private void RefreshBodyObject(Kinect.Body body, GameObject bodyObject)
{
for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++)
{
Kinect.Joint sourceJoint = body.Joints[jt];
Debug.Log(body.Joints[jt].JointType);
Debug.Log(sourceJoint.Position.X * 10);
Debug.Log(sourceJoint.Position.Y * 10);
Debug.Log(sourceJoint.Position.Z * 10);
Kinect.Joint? targetJoint = null;
if(_BoneMap.ContainsKey(jt))
{
targetJoint = body.Joints[_BoneMap[jt]];
}
Transform jointObj = bodyObject.transform.Find(jt.ToString());
jointObj.localPosition = GetVector3FromJoint(sourceJoint);
LineRenderer lr = jointObj.GetComponent<LineRenderer>();
if(targetJoint.HasValue)
{
lr.SetPosition(0, jointObj.localPosition);
lr.SetPosition(1, GetVector3FromJoint(targetJoint.Value));
lr.SetColors(GetColorForState (sourceJoint.TrackingState), GetColorForState(targetJoint.Value.TrackingState));
}
else
{
lr.enabled = false;
}
}
}
private static Color GetColorForState(Kinect.TrackingState state)
{
switch (state)
{
case Kinect.TrackingState.Tracked:
return Color.green;
case Kinect.TrackingState.Inferred:
return Color.red;
default:
return Color.black;
}
}
private static Vector3 GetVector3FromJoint(Kinect.Joint joint)
{
return new Vector3(joint.Position.X * 10, joint.Position.Y * 10, joint.Position.Z * 10);
}
}
using UnityEngine;
using System.Collections;
using Windows.Kinect;
public class ColorSourceManager : MonoBehaviour
{
public int ColorWidth { get; private set; }
public int ColorHeight { get; private set; }
private KinectSensor _Sensor;
private ColorFrameReader _Reader;
private Texture2D _Texture;
private byte[] _Data;
public Texture2D GetColorTexture()
{
return _Texture;
}
void Start()
{
_Sensor = KinectSensor.GetDefault();
if (_Sensor != null)
{
_Reader = _Sensor.ColorFrameSource.OpenReader();
var frameDesc = _Sensor.ColorFrameSource.CreateFrameDescription(ColorImageFormat.Rgba);
ColorWidth = frameDesc.Width;
ColorHeight = frameDesc.Height;
_Texture = new Texture2D(frameDesc.Width, frameDesc.Height, TextureFormat.RGBA32, false);
_Data = new byte[frameDesc.BytesPerPixel * frameDesc.LengthInPixels];
if (!_Sensor.IsOpen)
{
_Sensor.Open();
}
}
}
void Update ()
{
if (_Reader != null)
{
var frame = _Reader.AcquireLatestFrame();
if (frame != null)
{
frame.CopyConvertedFrameDataToArray(_Data, ColorImageFormat.Rgba);
_Texture.LoadRawTextureData(_Data);
_Texture.Apply();
frame.Dispose();
frame = null;
}
}
}
void OnApplicationQuit()
{
if (_Reader != null)
{
_Reader.Dispose();
_Reader = null;
}
if (_Sensor != null)
{
if (_Sensor.IsOpen)
{
_Sensor.Close();
}
_Sensor = null;
}
}
}
using UnityEngine;
using System.Collections;
using Windows.Kinect;
public class ColorSourceView : MonoBehaviour
{
public GameObject ColorSourceManager;
private ColorSourceManager _ColorManager;
void Start ()
{
gameObject.GetComponent<Renderer>().material.SetTextureScale("_MainTex", new Vector2(-1, 1));
}
void Update()
{
if (ColorSourceManager == null)
{
return;
}
_ColorManager = ColorSourceManager.GetComponent<ColorSourceManager>();
if (_ColorManager == null)
{
return;
}
gameObject.GetComponent<Renderer>().material.mainTexture = _ColorManager.GetColorTexture();
}
}
using UnityEngine;
using System.Collections;
using Windows.Kinect;
public class DepthSourceManager : MonoBehaviour
{
private KinectSensor _Sensor;
private DepthFrameReader _Reader;
private ushort[] _Data;
public ushort[] GetData()
{
return _Data;
}
void Start ()
{
_Sensor = KinectSensor.GetDefault();
if (_Sensor != null)
{
_Reader = _Sensor.DepthFrameSource.OpenReader();
_Data = new ushort[_Sensor.DepthFrameSource.FrameDescription.LengthInPixels];
}
}
void Update ()
{
if (_Reader != null)
{
var frame = _Reader.AcquireLatestFrame();
if (frame != null)
{
frame.CopyFrameDataToArray(_Data);
frame.Dispose();
frame = null;
}
}
}
void OnApplicationQuit()
{
if (_Reader != null)
{
_Reader.Dispose();
_Reader = null;
}
if (_Sensor != null)
{
if (_Sensor.IsOpen)
{
_Sensor.Close();
}
_Sensor = null;
}
}
}
using UnityEngine;
using System.Collections;
using Windows.Kinect;
public enum DepthViewMode
{
SeparateSourceReaders,
MultiSourceReader,
}
public class DepthSourceView : MonoBehaviour
{
public DepthViewMode ViewMode = DepthViewMode.SeparateSourceReaders;
public GameObject ColorSourceManager;
public GameObject DepthSourceManager;
public GameObject MultiSourceManager;
private KinectSensor _Sensor;
private CoordinateMapper _Mapper;
private Mesh _Mesh;
private Vector3[] _Vertices;
private Vector2[] _UV;
private int[] _Triangles;
// Only works at 4 right now
private const int _DownsampleSize = 4;
private const double _DepthScale = 0.1f;
private const int _Speed = 50;
private MultiSourceManager _MultiManager;
private ColorSourceManager _ColorManager;
private DepthSourceManager _DepthManager;
void Start()
{
_Sensor = KinectSensor.GetDefault();
if (_Sensor != null)
{
_Mapper = _Sensor.CoordinateMapper;
var frameDesc = _Sensor.DepthFrameSource.FrameDescription;
// Downsample to lower resolution
CreateMesh(frameDesc.Width / _DownsampleSize, frameDesc.Height / _DownsampleSize);
if (!_Sensor.IsOpen)
{
_Sensor.Open();
}
}
}
void CreateMesh(int width, int height)
{
_Mesh = new Mesh();
GetComponent<MeshFilter>().mesh = _Mesh;
_Vertices = new Vector3[width * height];
_UV = new Vector2[width * height];
_Triangles = new int[6 * ((width - 1) * (height - 1))];
int triangleIndex = 0;
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
int index = (y * width) + x;
_Vertices[index] = new Vector3(x, -y, 0);
_UV[index] = new Vector2(((float)x / (float)width), ((float)y / (float)height));
// Skip the last row/col
if (x != (width - 1) && y != (height - 1))
{
int topLeft = index;
int topRight = topLeft + 1;
int bottomLeft = topLeft + width;
int bottomRight = bottomLeft + 1;
_Triangles[triangleIndex++] = topLeft;
_Triangles[triangleIndex++] = topRight;
_Triangles[triangleIndex++] = bottomLeft;
_Triangles[triangleIndex++] = bottomLeft;
_Triangles[triangleIndex++] = topRight;
_Triangles[triangleIndex++] = bottomRight;
}
}
}
_Mesh.vertices = _Vertices;
_Mesh.uv = _UV;
_Mesh.triangles = _Triangles;
_Mesh.RecalculateNormals();
}
void OnGUI()
{
GUI.BeginGroup(new Rect(0, 0, Screen.width, Screen.height));
GUI.TextField(new Rect(Screen.width - 250 , 10, 250, 20), "DepthMode: " + ViewMode.ToString());
GUI.EndGroup();
}
void Update()
{
if (_Sensor == null)
{
return;
}
if (Input.GetButtonDown("Fire1"))
{
if(ViewMode == DepthViewMode.MultiSourceReader)
{
ViewMode = DepthViewMode.SeparateSourceReaders;
}
else
{
ViewMode = DepthViewMode.MultiSourceReader;
}
}
float yVal = Input.GetAxis("Horizontal");
float xVal = -Input.GetAxis("Vertical");
transform.Rotate(
(xVal * Time.deltaTime * _Speed),
(yVal * Time.deltaTime * _Speed),
0,
Space.Self);
if (ViewMode == DepthViewMode.SeparateSourceReaders)
{
if (ColorSourceManager == null)
{
return;
}
_ColorManager = ColorSourceManager.GetComponent<ColorSourceManager>();
if (_ColorManager == null)
{
return;
}
if (DepthSourceManager == null)
{
return;
}
_DepthManager = DepthSourceManager.GetComponent<DepthSourceManager>();
if (_DepthManager == null)
{
return;
}
gameObject.GetComponent<Renderer>().material.mainTexture = _ColorManager.GetColorTexture();
RefreshData(_DepthManager.GetData(),
_ColorManager.ColorWidth,
_ColorManager.ColorHeight);
}
else
{
if (MultiSourceManager == null)
{
return;
}
_MultiManager = MultiSourceManager.GetComponent<MultiSourceManager>();
if (_MultiManager == null)
{
return;
}
gameObject.GetComponent<Renderer>().material.mainTexture = _MultiManager.GetColorTexture();
RefreshData(_MultiManager.GetDepthData(),
_MultiManager.ColorWidth,
_MultiManager.ColorHeight);
}
}
private void RefreshData(ushort[] depthData, int colorWidth, int colorHeight)
{
var frameDesc = _Sensor.DepthFrameSource.FrameDescription;
ColorSpacePoint[] colorSpace = new ColorSpacePoint[depthData.Length];
_Mapper.MapDepthFrameToColorSpace(depthData, colorSpace);
for (int y = 0; y < frameDesc.Height; y += _DownsampleSize)
{
for (int x = 0; x < frameDesc.Width; x += _DownsampleSize)
{
int indexX = x / _DownsampleSize;
int indexY = y / _DownsampleSize;
int smallIndex = (indexY * (frameDesc.Width / _DownsampleSize)) + indexX;
double avg = GetAvg(depthData, x, y, frameDesc.Width, frameDesc.Height);
avg = avg * _DepthScale;
_Vertices[smallIndex].z = (float)avg;
// Update UV mapping with CDRP
var colorSpacePoint = colorSpace[(y * frameDesc.Width) + x];
_UV[smallIndex] = new Vector2(colorSpacePoint.X / colorWidth, colorSpacePoint.Y / colorHeight);
}
}
_Mesh.vertices = _Vertices;
_Mesh.uv = _UV;
_Mesh.triangles = _Triangles;
_Mesh.RecalculateNormals();
}
private double GetAvg(ushort[] depthData, int x, int y, int width, int height)
{
double sum = 0.0;
for (int y1 = y; y1 < y + 4; y1++)
{
for (int x1 = x; x1 < x + 4; x1++)
{
int fullIndex = (y1 * width) + x1;
if (depthData[fullIndex] == 0)
sum += 4500;
else
sum += depthData[fullIndex];
}
}
return sum / 16;
}
void OnApplicationQuit()
{
if (_Mapper != null)
{
_Mapper = null;
}
if (_Sensor != null)
{
if (_Sensor.IsOpen)
{
_Sensor.Close();
}
_Sensor = null;
}
}
}
using UnityEngine;
using System.Collections;
public class DisableOnStart : MonoBehaviour {
// Use this for initialization
void Start ()
{
gameObject.SetActive (false);
}
}
using UnityEngine;
using System.Collections;
using Windows.Kinect;
public class InfraredSourceManager : MonoBehaviour
{
private KinectSensor _Sensor;
private InfraredFrameReader _Reader;
private ushort[] _Data;
private byte[] _RawData;
// I'm not sure this makes sense for the Kinect APIs
// Instead, this logic should be in the VIEW
private Texture2D _Texture;
public Texture2D GetInfraredTexture()
{
return _Texture;
}
void Start()
{
_Sensor = KinectSensor.GetDefault();
if (_Sensor != null)
{
_Reader = _Sensor.InfraredFrameSource.OpenReader();
var frameDesc = _Sensor.InfraredFrameSource.FrameDescription;
_Data = new ushort[frameDesc.LengthInPixels];
_RawData = new byte[frameDesc.LengthInPixels * 4];
_Texture = new Texture2D(frameDesc.Width, frameDesc.Height, TextureFormat.BGRA32, false);
if (!_Sensor.IsOpen)
{
_Sensor.Open();
}
}
}
void Update ()
{
if (_Reader != null)
{
var frame = _Reader.AcquireLatestFrame();
if (frame != null)
{
frame.CopyFrameDataToArray(_Data);
int index = 0;
foreach(var ir in _Data)
{
byte intensity = (byte)(ir >> 8);
_RawData[index++] = intensity;
_RawData[index++] = intensity;
_RawData[index++] = intensity;
_RawData[index++] = 255; // Alpha
}
_Texture.LoadRawTextureData(_RawData);
_Texture.Apply();
frame.Dispose();
frame = null;
}
}
}
void OnApplicationQuit()
{
if (_Reader != null)
{
_Reader.Dispose();
_Reader = null;
}
if (_Sensor != null)
{
if (_Sensor.IsOpen)
{
_Sensor.Close();
}
_Sensor = null;
}
}
}
using UnityEngine;
using System.Collections;
public class InfraredSourceView : MonoBehaviour
{
public GameObject InfraredSourceManager;
private InfraredSourceManager _InfraredManager;
void Start ()
{
gameObject.GetComponent<Renderer>().material.SetTextureScale("_MainTex", new Vector2(-1, 1));
}
void Update()
{
if (InfraredSourceManager == null)
{
return;
}
_InfraredManager = InfraredSourceManager.GetComponent<InfraredSourceManager>();
if (_InfraredManager == null)
{
return;
}
gameObject.GetComponent<Renderer>().material.mainTexture = _InfraredManager.GetInfraredTexture();
}
}
using UnityEngine;
using System.Collections;
using Windows.Kinect;
public class MultiSourceManager : MonoBehaviour {
public int ColorWidth { get; private set; }
public int ColorHeight { get; private set; }
private KinectSensor _Sensor;
private MultiSourceFrameReader _Reader;
private Texture2D _ColorTexture;
private ushort[] _DepthData;
private byte[] _ColorData;
public Texture2D GetColorTexture()
{
return _ColorTexture;
}
public ushort[] GetDepthData()
{
return _DepthData;
}
void Start ()
{
_Sensor = KinectSensor.GetDefault();
if (_Sensor != null)
{
_Reader = _Sensor.OpenMultiSourceFrameReader(FrameSourceTypes.Color | FrameSourceTypes.Depth);
var colorFrameDesc = _Sensor.ColorFrameSource.CreateFrameDescription(ColorImageFormat.Rgba);
ColorWidth = colorFrameDesc.Width;
ColorHeight = colorFrameDesc.Height;
_ColorTexture = new Texture2D(colorFrameDesc.Width, colorFrameDesc.Height, TextureFormat.RGBA32, false);
_ColorData = new byte[colorFrameDesc.BytesPerPixel * colorFrameDesc.LengthInPixels];
var depthFrameDesc = _Sensor.DepthFrameSource.FrameDescription;
_DepthData = new ushort[depthFrameDesc.LengthInPixels];
if (!_Sensor.IsOpen)
{
_Sensor.Open();
}
}
}
void Update ()
{
if (_Reader != null)
{
var frame = _Reader.AcquireLatestFrame();
if (frame != null)
{
var colorFrame = frame.ColorFrameReference.AcquireFrame();
if (colorFrame != null)
{
var depthFrame = frame.DepthFrameReference.AcquireFrame();
if (depthFrame != null)
{
colorFrame.CopyConvertedFrameDataToArray(_ColorData, ColorImageFormat.Rgba);
_ColorTexture.LoadRawTextureData(_ColorData);
_ColorTexture.Apply();
depthFrame.CopyFrameDataToArray(_DepthData);
depthFrame.Dispose();
depthFrame = null;
}
colorFrame.Dispose();
colorFrame = null;
}
frame = null;
}
}
}
void OnApplicationQuit()
{
if (_Reader != null)
{
_Reader.Dispose();
_Reader = null;
}
if (_Sensor != null)
{
if (_Sensor.IsOpen)
{
_Sensor.Close();
}
_Sensor = null;
}
}
}
No preview for this file type
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Windows.Kinect;
public class DetectJoints : MonoBehaviour
{
public GameObject BodySrcManager;
public JointType TrackedJoint;
private BodySourceManager bodyManager;
private Body[] bodies;
public float multiplier = 10f;
// Start is called before the first frame update
void Start()
{
if (BodySrcManager == null)
{
Debug.Log("Assign Game Object with Body Source Manger");
}
else
{
bodyManager = BodySrcManager.GetComponent<BodySourceManager>();
}
}
// Update is called once per frame
void Update()
{
if (bodyManager == null)
{
return;
}
bodies = bodyManager.GetData();
if (bodies == null)
{
return;
}
foreach (var body in bodies)
{
if (body == null)
{
continue;
}
if (body.IsTracked)
{
var pos = body.Joints[TrackedJoint].Position;
gameObject.transform.position = new Vector3(pos.X*multiplier, pos.Y*multiplier);
}
}
}
}
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Kinect = Windows.Kinect;
using System.Runtime.InteropServices;
public class Move : MonoBehaviour
{
// [DllImport("NtKinectDll")]
// private static extern System.IntPtr getKinect();
// [DllImport("NtKinectDll")]
// private static extern int setSkeleton(System.IntPtr kinect, System.IntPtr data, System.IntPtr state, System.IntPtr id);
int bodyCount = 6;
int jointCount = 25;
public Material BoneMaterial;
public GameObject BodySourceManager;
private Dictionary<ulong, GameObject> _Bodies = new Dictionary<ulong, GameObject>();
private BodySourceManager _BodyManager;
public GameObject humanoid;
CharacterSkeleton skeleton;
public bool mirror = true;
public bool move = true;
private System.IntPtr kinect;
void Start()
{
skeleton = new CharacterSkeleton(humanoid);
}
private Dictionary<Kinect.JointType, Kinect.JointType> _BoneMap = new Dictionary<Kinect.JointType, Kinect.JointType>()
{
{ Kinect.JointType.FootLeft, Kinect.JointType.AnkleLeft },
{ Kinect.JointType.AnkleLeft, Kinect.JointType.KneeLeft },
{ Kinect.JointType.KneeLeft, Kinect.JointType.HipLeft },
{ Kinect.JointType.HipLeft, Kinect.JointType.SpineBase },
{ Kinect.JointType.FootRight, Kinect.JointType.AnkleRight },
{ Kinect.JointType.AnkleRight, Kinect.JointType.KneeRight },
{ Kinect.JointType.KneeRight, Kinect.JointType.HipRight },
{ Kinect.JointType.HipRight, Kinect.JointType.SpineBase },
{ Kinect.JointType.HandTipLeft, Kinect.JointType.HandLeft },
{ Kinect.JointType.ThumbLeft, Kinect.JointType.HandLeft },
{ Kinect.JointType.HandLeft, Kinect.JointType.WristLeft },
{ Kinect.JointType.WristLeft, Kinect.JointType.ElbowLeft },
{ Kinect.JointType.ElbowLeft, Kinect.JointType.ShoulderLeft },
{ Kinect.JointType.ShoulderLeft, Kinect.JointType.SpineShoulder },
{ Kinect.JointType.HandTipRight, Kinect.JointType.HandRight },
{ Kinect.JointType.ThumbRight, Kinect.JointType.HandRight },
{ Kinect.JointType.HandRight, Kinect.JointType.WristRight },
{ Kinect.JointType.WristRight, Kinect.JointType.ElbowRight },
{ Kinect.JointType.ElbowRight, Kinect.JointType.ShoulderRight },
{ Kinect.JointType.ShoulderRight, Kinect.JointType.SpineShoulder },
{ Kinect.JointType.SpineBase, Kinect.JointType.SpineMid },
{ Kinect.JointType.SpineMid, Kinect.JointType.SpineShoulder },
{ Kinect.JointType.SpineShoulder, Kinect.JointType.Neck },
{ Kinect.JointType.Neck, Kinect.JointType.Head },
};
void Update()
{
float[] data1 = new float[bodyCount * jointCount * 3];
int[] state = new int[bodyCount * jointCount];
int[] id = new int[bodyCount];
GCHandle gch = GCHandle.Alloc(data1, GCHandleType.Pinned);
GCHandle gch2 = GCHandle.Alloc(state, GCHandleType.Pinned);
GCHandle gch3 = GCHandle.Alloc(id, GCHandleType.Pinned);
if (BodySourceManager == null)
{
return;
}
_BodyManager = BodySourceManager.GetComponent<BodySourceManager>();
if (_BodyManager == null)
{
return;
}
Kinect.Body[] data = _BodyManager.GetData();
if (data == null)
{
return;
}
List<ulong> trackedIds = new List<ulong>();
foreach (var body in data)
{
if (body == null)
{
continue;
}
if (body.IsTracked)
{
trackedIds.Add(body.TrackingId);
}
}
List<ulong> knownIds = new List<ulong>(_Bodies.Keys);
// First delete untracked bodies
foreach (ulong trackingId in knownIds)
{
if (!trackedIds.Contains(trackingId))
{
Destroy(_Bodies[trackingId]);
_Bodies.Remove(trackingId);
}
}
foreach (var body in data)
{
if (body == null)
{
continue;
}
if (body.IsTracked)
{
if (!_Bodies.ContainsKey(body.TrackingId))
{
_Bodies[body.TrackingId] = CreateBodyObject(body.TrackingId);
}
RefreshBodyObject(body, _Bodies[body.TrackingId]);
}
}
}
private GameObject CreateBodyObject(ulong id)
{
GameObject body = new GameObject("Body:" + id);
for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++)
{
GameObject jointObj = GameObject.CreatePrimitive(PrimitiveType.Cube);
LineRenderer lr = jointObj.AddComponent<LineRenderer>();
lr.SetVertexCount(2);
lr.material = BoneMaterial;
lr.SetWidth(0.05f, 0.05f);
jointObj.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
jointObj.name = jt.ToString();
jointObj.transform.parent = body.transform;
}
return body;
}
private void RefreshBodyObject(Kinect.Body body, GameObject bodyObject)
{
float[] data1 = new float[bodyCount * jointCount * 3];
int[] state = new int[bodyCount * jointCount];
int[] id1 = new int[bodyCount];
GCHandle gch = GCHandle.Alloc(data1, GCHandleType.Pinned);
GCHandle gch2 = GCHandle.Alloc(state, GCHandleType.Pinned);
GCHandle gch3 = GCHandle.Alloc(id1, GCHandleType.Pinned);
int i = -1;
for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++)
{
Kinect.Joint sourceJoint = body.Joints[jt];
//Debug.Log("body.Joints[jt]");
//Debug.Log(body.Joints[jt]);
//Debug.Log("jt");
//Debug.Log(jt);
//Debug.Log(body.Joints[jt].JointType);
//Debug.Log(sourceJoint.Position.X * 10);
//Debug.Log(sourceJoint.Position.Y * 10);
//Debug.Log(sourceJoint.Position.Z * 10);
Kinect.Joint? targetJoint = null;
if (_BoneMap.ContainsKey(jt))
{
targetJoint = body.Joints[_BoneMap[jt]];
}
Transform jointObj = bodyObject.transform.Find(jt.ToString());
jointObj.localPosition = GetVector3FromJoint(sourceJoint);
//Debug.Log(i);
i++;
data1[i] = sourceJoint.Position.X;
i++;
data1[i] = sourceJoint.Position.Y;
i++;
data1[i] = sourceJoint.Position.Z;
if ((sourceJoint.Position.X + sourceJoint.Position.Y + sourceJoint.Position.Z) != 0)
{
state[i - 2] = 1;
}
skeleton.dasomset(data1, state, 0, true, true, body.Joints[jt], jointObj);
LineRenderer lr = jointObj.GetComponent<LineRenderer>();
if (targetJoint.HasValue)
{
//Debug.Log(jointObj.localPosition);
//Debug.Log(GetVector3FromJoint(targetJoint.Value));
lr.SetPosition(0, jointObj.localPosition);
lr.SetPosition(1, GetVector3FromJoint(targetJoint.Value));
lr.SetColors(GetColorForState(sourceJoint.TrackingState), GetColorForState(targetJoint.Value.TrackingState));
}
else
{
lr.enabled = false;
}
}
}
private static Color GetColorForState(Kinect.TrackingState state)
{
switch (state)
{
case Kinect.TrackingState.Tracked:
return Color.green;
case Kinect.TrackingState.Inferred:
return Color.red;
default:
return Color.black;
}
}
private static Vector3 GetVector3FromJoint(Kinect.Joint joint)
{
return new Vector3(joint.Position.X * 10, joint.Position.Y * 10, joint.Position.Z * 10);
}
}
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Kinect = Windows.Kinect;
using System.Runtime.InteropServices;
public class MoveTrainee : MonoBehaviour
{
// [DllImport("NtKinectDll")]
// private static extern System.IntPtr getKinect();
// [DllImport("NtKinectDll")]
// private static extern int setSkeleton(System.IntPtr kinect, System.IntPtr data, System.IntPtr state, System.IntPtr id);
int bodyCount = 6;
int jointCount = 25;
//public Material BoneMaterial;
public GameObject BodySourceManager;
private Dictionary<ulong, GameObject> _Bodies = new Dictionary<ulong, GameObject>();
private BodySourceManager _BodyManager;
public GameObject humanoid;
CharacterSkeleton skeleton;
public bool mirror = true;
public bool move = true;
private System.IntPtr kinect;
void Start()
{
skeleton = new CharacterSkeleton(humanoid);
}
private Dictionary<Kinect.JointType, Kinect.JointType> _BoneMap = new Dictionary<Kinect.JointType, Kinect.JointType>()
{
{ Kinect.JointType.FootLeft, Kinect.JointType.AnkleLeft },
{ Kinect.JointType.AnkleLeft, Kinect.JointType.KneeLeft },
{ Kinect.JointType.KneeLeft, Kinect.JointType.HipLeft },
{ Kinect.JointType.HipLeft, Kinect.JointType.SpineBase },
{ Kinect.JointType.FootRight, Kinect.JointType.AnkleRight },
{ Kinect.JointType.AnkleRight, Kinect.JointType.KneeRight },
{ Kinect.JointType.KneeRight, Kinect.JointType.HipRight },
{ Kinect.JointType.HipRight, Kinect.JointType.SpineBase },
{ Kinect.JointType.HandTipLeft, Kinect.JointType.HandLeft },
{ Kinect.JointType.ThumbLeft, Kinect.JointType.HandLeft },
{ Kinect.JointType.HandLeft, Kinect.JointType.WristLeft },
{ Kinect.JointType.WristLeft, Kinect.JointType.ElbowLeft },
{ Kinect.JointType.ElbowLeft, Kinect.JointType.ShoulderLeft },
{ Kinect.JointType.ShoulderLeft, Kinect.JointType.SpineShoulder },
{ Kinect.JointType.HandTipRight, Kinect.JointType.HandRight },
{ Kinect.JointType.ThumbRight, Kinect.JointType.HandRight },
{ Kinect.JointType.HandRight, Kinect.JointType.WristRight },
{ Kinect.JointType.WristRight, Kinect.JointType.ElbowRight },
{ Kinect.JointType.ElbowRight, Kinect.JointType.ShoulderRight },
{ Kinect.JointType.ShoulderRight, Kinect.JointType.SpineShoulder },
{ Kinect.JointType.SpineBase, Kinect.JointType.SpineMid },
{ Kinect.JointType.SpineMid, Kinect.JointType.SpineShoulder },
{ Kinect.JointType.SpineShoulder, Kinect.JointType.Neck },
{ Kinect.JointType.Neck, Kinect.JointType.Head },
};
void Update()
{
float[] data1 = new float[bodyCount * jointCount * 3];
int[] state = new int[bodyCount * jointCount];
int[] id = new int[bodyCount];
GCHandle gch = GCHandle.Alloc(data1, GCHandleType.Pinned);
GCHandle gch2 = GCHandle.Alloc(state, GCHandleType.Pinned);
GCHandle gch3 = GCHandle.Alloc(id, GCHandleType.Pinned);
if (BodySourceManager == null)
{
return;
}
_BodyManager = BodySourceManager.GetComponent<BodySourceManager>();
if (_BodyManager == null)
{
return;
}
Kinect.Body[] data = _BodyManager.GetData();
if (data == null)
{
return;
}
List<ulong> trackedIds = new List<ulong>();
foreach (var body in data)
{
if (body == null)
{
continue;
}
if (body.IsTracked)
{
trackedIds.Add(body.TrackingId);
}
}
List<ulong> knownIds = new List<ulong>(_Bodies.Keys);
// First delete untracked bodies
foreach (ulong trackingId in knownIds)
{
if (!trackedIds.Contains(trackingId))
{
Destroy(_Bodies[trackingId]);
_Bodies.Remove(trackingId);
}
}
foreach (var body in data)
{
if (body == null)
{
continue;
}
if (body.IsTracked)
{
if (!_Bodies.ContainsKey(body.TrackingId))
{
_Bodies[body.TrackingId] = CreateBodyObject(body.TrackingId);
}
RefreshBodyObject(body, _Bodies[body.TrackingId]);
}
}
}
private GameObject CreateBodyObject(ulong id)
{
GameObject body = new GameObject("Body:" + id);
for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++)
{
GameObject jointObj = GameObject.CreatePrimitive(PrimitiveType.Cube);
//LineRenderer lr = jointObj.AddComponent<LineRenderer>();
//lr.SetVertexCount(2);
//lr.material = BoneMaterial;
//lr.SetWidth(0.05f, 0.05f);
jointObj.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
jointObj.name = jt.ToString();
jointObj.transform.parent = body.transform;
}
return body;
}
private void RefreshBodyObject(Kinect.Body body, GameObject bodyObject)
{
float[] data1 = new float[bodyCount * jointCount * 3];
int[] state = new int[bodyCount * jointCount];
int[] id1 = new int[bodyCount];
GCHandle gch = GCHandle.Alloc(data1, GCHandleType.Pinned);
GCHandle gch2 = GCHandle.Alloc(state, GCHandleType.Pinned);
GCHandle gch3 = GCHandle.Alloc(id1, GCHandleType.Pinned);
int i = -1;
for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++)
{
Kinect.Joint sourceJoint = body.Joints[jt];
//Debug.Log("body.Joints[jt]");
//Debug.Log(body.Joints[jt]);
//Debug.Log("jt");
//Debug.Log(jt);
//Debug.Log(body.Joints[jt].JointType);
//Debug.Log(sourceJoint.Position.X * 10);
//Debug.Log(sourceJoint.Position.Y * 10);
//Debug.Log(sourceJoint.Position.Z * 10);
Kinect.Joint? targetJoint = null;
if (_BoneMap.ContainsKey(jt))
{
targetJoint = body.Joints[_BoneMap[jt]];
}
Transform jointObj = bodyObject.transform.Find(jt.ToString());
jointObj.localPosition = GetVector3FromJoint(sourceJoint);
//Debug.Log(i);
i++;
data1[i] = sourceJoint.Position.X;
i++;
data1[i] = sourceJoint.Position.Y;
i++;
data1[i] = sourceJoint.Position.Z;
if ((sourceJoint.Position.X + sourceJoint.Position.Y + sourceJoint.Position.Z) != 0)
{
state[i - 2] = 1;
}
skeleton.dasomset(data1, state, 0, true, true, body.Joints[jt], jointObj);
/*
LineRenderer lr = jointObj.GetComponent<LineRenderer>();
if (targetJoint.HasValue)
{
//Debug.Log(jointObj.localPosition);
//Debug.Log(GetVector3FromJoint(targetJoint.Value));
lr.SetPosition(0, jointObj.localPosition);
lr.SetPosition(1, GetVector3FromJoint(targetJoint.Value));
lr.SetColors(GetColorForState(sourceJoint.TrackingState), GetColorForState(targetJoint.Value.TrackingState));
}
else
{
lr.enabled = false;
}
*/
}
}
private static Color GetColorForState(Kinect.TrackingState state)
{
switch (state)
{
case Kinect.TrackingState.Tracked:
return Color.green;
case Kinect.TrackingState.Inferred:
return Color.red;
default:
return Color.black;
}
}
private static Vector3 GetVector3FromJoint(Kinect.Joint joint)
{
return new Vector3(joint.Position.X * 10, joint.Position.Y * 10, joint.Position.Z * 10);
}
}
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Kinect = Windows.Kinect;
using System.Runtime.InteropServices;
public class MoveTraineer : MonoBehaviour
{
int bodyCount = 6;
int jointCount = 25;
//public Material BoneMaterial;
public GameObject BodySourceManager;
private Dictionary<ulong, GameObject> _Bodies = new Dictionary<ulong, GameObject>();
private BodySourceManager _BodyManager;
public GameObject humanoid;
CharacterSkeleton skeleton;
public bool mirror = true;
public bool move = true;
private System.IntPtr kinect;
void Start()
{
skeleton = new CharacterSkeleton(humanoid);
}
private Dictionary<Kinect.JointType, Kinect.JointType> _BoneMap = new Dictionary<Kinect.JointType, Kinect.JointType>()
{
{ Kinect.JointType.FootLeft, Kinect.JointType.AnkleLeft },
{ Kinect.JointType.AnkleLeft, Kinect.JointType.KneeLeft },
{ Kinect.JointType.KneeLeft, Kinect.JointType.HipLeft },
{ Kinect.JointType.HipLeft, Kinect.JointType.SpineBase },
{ Kinect.JointType.FootRight, Kinect.JointType.AnkleRight },
{ Kinect.JointType.AnkleRight, Kinect.JointType.KneeRight },
{ Kinect.JointType.KneeRight, Kinect.JointType.HipRight },
{ Kinect.JointType.HipRight, Kinect.JointType.SpineBase },
{ Kinect.JointType.HandTipLeft, Kinect.JointType.HandLeft },
{ Kinect.JointType.ThumbLeft, Kinect.JointType.HandLeft },
{ Kinect.JointType.HandLeft, Kinect.JointType.WristLeft },
{ Kinect.JointType.WristLeft, Kinect.JointType.ElbowLeft },
{ Kinect.JointType.ElbowLeft, Kinect.JointType.ShoulderLeft },
{ Kinect.JointType.ShoulderLeft, Kinect.JointType.SpineShoulder },
{ Kinect.JointType.HandTipRight, Kinect.JointType.HandRight },
{ Kinect.JointType.ThumbRight, Kinect.JointType.HandRight },
{ Kinect.JointType.HandRight, Kinect.JointType.WristRight },
{ Kinect.JointType.WristRight, Kinect.JointType.ElbowRight },
{ Kinect.JointType.ElbowRight, Kinect.JointType.ShoulderRight },
{ Kinect.JointType.ShoulderRight, Kinect.JointType.SpineShoulder },
{ Kinect.JointType.SpineBase, Kinect.JointType.SpineMid },
{ Kinect.JointType.SpineMid, Kinect.JointType.SpineShoulder },
{ Kinect.JointType.SpineShoulder, Kinect.JointType.Neck },
{ Kinect.JointType.Neck, Kinect.JointType.Head },
};
void Update()
{
float[] data1 = new float[bodyCount * jointCount * 3];
int[] state = new int[bodyCount * jointCount];
int[] id = new int[bodyCount];
GCHandle gch = GCHandle.Alloc(data1, GCHandleType.Pinned);
GCHandle gch2 = GCHandle.Alloc(state, GCHandleType.Pinned);
GCHandle gch3 = GCHandle.Alloc(id, GCHandleType.Pinned);
if (BodySourceManager == null)
{
return;
}
_BodyManager = BodySourceManager.GetComponent<BodySourceManager>();
if (_BodyManager == null)
{
return;
}
Kinect.Body[] data = _BodyManager.GetData();
if (data == null)
{
return;
}
List<ulong> trackedIds = new List<ulong>();
foreach (var body in data)
{
if (body == null)
{
continue;
}
if (body.IsTracked)
{
trackedIds.Add(body.TrackingId);
}
}
List<ulong> knownIds = new List<ulong>(_Bodies.Keys);
// First delete untracked bodies
foreach (ulong trackingId in knownIds)
{
if (!trackedIds.Contains(trackingId))
{
Destroy(_Bodies[trackingId]);
_Bodies.Remove(trackingId);
}
}
foreach (var body in data)
{
if (body == null)
{
continue;
}
if (body.IsTracked)
{
if (!_Bodies.ContainsKey(body.TrackingId))
{
_Bodies[body.TrackingId] = CreateBodyObject(body.TrackingId);
}
RefreshBodyObject(body, _Bodies[body.TrackingId]);
}
}
}
private GameObject CreateBodyObject(ulong id)
{
GameObject body = new GameObject("Body:" + id);
for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++)
{
GameObject jointObj = GameObject.CreatePrimitive(PrimitiveType.Cube);
//LineRenderer lr = jointObj.AddComponent<LineRenderer>();
//lr.SetVertexCount(2);
//lr.material = BoneMaterial;
//lr.SetWidth(0.05f, 0.05f);
jointObj.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
jointObj.name = jt.ToString();
jointObj.transform.parent = body.transform;
}
return body;
}
private void RefreshBodyObject(Kinect.Body body, GameObject bodyObject)
{
float[] data1 = new float[bodyCount * jointCount * 3];
int[] state = new int[bodyCount * jointCount];
int[] id1 = new int[bodyCount];
GCHandle gch = GCHandle.Alloc(data1, GCHandleType.Pinned);
GCHandle gch2 = GCHandle.Alloc(state, GCHandleType.Pinned);
GCHandle gch3 = GCHandle.Alloc(id1, GCHandleType.Pinned);
int i = -1;
for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++)
{
Kinect.Joint sourceJoint = body.Joints[jt];
//Debug.Log("body.Joints[jt]");
//Debug.Log(body.Joints[jt]);
//Debug.Log("jt");
//Debug.Log(jt);
//Debug.Log(body.Joints[jt].JointType);
//Debug.Log(sourceJoint.Position.X * 10);
//Debug.Log(sourceJoint.Position.Y * 10);
//Debug.Log(sourceJoint.Position.Z * 10);
Kinect.Joint? targetJoint = null;
if (_BoneMap.ContainsKey(jt))
{
targetJoint = body.Joints[_BoneMap[jt]];
}
Transform jointObj = bodyObject.transform.Find(jt.ToString());
jointObj.localPosition = GetVector3FromJoint(sourceJoint);
//Debug.Log(i);
i++;
data1[i] = sourceJoint.Position.X;
i++;
data1[i] = sourceJoint.Position.Y;
i++;
data1[i] = sourceJoint.Position.Z;
if ((sourceJoint.Position.X + sourceJoint.Position.Y + sourceJoint.Position.Z) != 0)
{
state[i - 2] = 1;
}
skeleton.dasomset(data1, state, 0, true, true, body.Joints[jt], jointObj);
/*
LineRenderer lr = jointObj.GetComponent<LineRenderer>();
if (targetJoint.HasValue)
{
//Debug.Log(jointObj.localPosition);
//Debug.Log(GetVector3FromJoint(targetJoint.Value));
lr.SetPosition(0, jointObj.localPosition);
lr.SetPosition(1, GetVector3FromJoint(targetJoint.Value));
lr.SetColors(GetColorForState(sourceJoint.TrackingState), GetColorForState(targetJoint.Value.TrackingState));
}
else
{
lr.enabled = false;
}
*/
}
}
private static Color GetColorForState(Kinect.TrackingState state)
{
switch (state)
{
case Kinect.TrackingState.Tracked:
return Color.green;
case Kinect.TrackingState.Inferred:
return Color.red;
default:
return Color.black;
}
}
private static Vector3 GetVector3FromJoint(Kinect.Joint joint)
{
return new Vector3(joint.Position.X * 10, joint.Position.Y * 10, joint.Position.Z * 10);
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RigBone
{
public GameObject gameObject;
public HumanBodyBones bone;
public bool isValid;
public Transform transform
{
get { return animator.GetBoneTransform(bone); }
}
Animator animator;
Quaternion savedValue;
public RigBone(GameObject g, HumanBodyBones b)
{
gameObject = g;
bone = b;
isValid = false;
animator = gameObject.GetComponent<Animator>();
if (animator == null)
{
Debug.Log("no Animator Component");
return;
}
Avatar avatar = animator.avatar;
if (avatar == null || !avatar.isHuman || !avatar.isValid)
{
Debug.Log("Avatar is not Humanoid or it is not valid");
return;
}
isValid = true;
savedValue = animator.GetBoneTransform(bone).localRotation;
}
public void set(float a, float x, float y, float z)
{
set(Quaternion.AngleAxis(a, new Vector3(x, y, z)));
}
public void set(Quaternion q)
{
animator.GetBoneTransform(bone).localRotation = q;
savedValue = q;
}
public void mul(float a, float x, float y, float z)
{
mul(Quaternion.AngleAxis(a, new Vector3(x, y, z)));
}
public void mul(Quaternion q)
{
Transform tr = animator.GetBoneTransform(bone);
tr.localRotation = q * tr.localRotation;
}
public void offset(float a, float x, float y, float z)
{
offset(Quaternion.AngleAxis(a, new Vector3(x, y, z)));
}
public void offset(Quaternion q)
{
animator.GetBoneTransform(bone).localRotation = q * savedValue;
}
public void changeBone(HumanBodyBones b)
{
bone = b;
savedValue = animator.GetBoneTransform(bone).localRotation;
}
}
using System.Runtime.InteropServices;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using RootSystem = System;
using System;
public class RigControl : MonoBehaviour
{
//[RootSystem.Runtime.InteropServices.DllImport("NtKinectDll")]
[DllImport("NtKinectDll", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
public static extern System.IntPtr getKinect();
[DllImport("NtKinectDll", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
public static extern int setSkeleton(System.IntPtr kinect, System.IntPtr data, System.IntPtr state, System.IntPtr id);
int bodyCount = 6;
int jointCount = 25;
private System.IntPtr kinect;
public GameObject humanoid;
public bool mirror = true;
public bool move = true;
CharacterSkeleton skeleton;
void Start()
{
kinect = getKinect();
skeleton = new CharacterSkeleton(humanoid);
}
void Update()
{
float[] data = new float[bodyCount * jointCount * 3];
int[] state = new int[bodyCount * jointCount];
int[] id = new int[bodyCount];
GCHandle gch = GCHandle.Alloc(data, GCHandleType.Pinned);
GCHandle gch2 = GCHandle.Alloc(state, GCHandleType.Pinned);
GCHandle gch3 = GCHandle.Alloc(id, GCHandleType.Pinned);
int n = setSkeleton(kinect, gch.AddrOfPinnedObject(), gch2.AddrOfPinnedObject(), gch3.AddrOfPinnedObject());
gch.Free();
gch2.Free();
gch3.Free();
if (n > 0)
{
skeleton.set(data, state, 0, mirror, move);
}
}
}
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.CameraIntrinsics
//
[RootSystem.Runtime.InteropServices.StructLayout(RootSystem.Runtime.InteropServices.LayoutKind.Sequential)]
public struct CameraIntrinsics
{
public float FocalLengthX { get; set; }
public float FocalLengthY { get; set; }
public float PrincipalPointX { get; set; }
public float PrincipalPointY { get; set; }
public float RadialDistortionSecondOrder { get; set; }
public float RadialDistortionFourthOrder { get; set; }
public float RadialDistortionSixthOrder { get; set; }
public override int GetHashCode()
{
return FocalLengthX.GetHashCode() ^ FocalLengthY.GetHashCode() ^
PrincipalPointX.GetHashCode() ^ PrincipalPointY.GetHashCode() ^
RadialDistortionSecondOrder.GetHashCode() ^ RadialDistortionFourthOrder.GetHashCode() ^
RadialDistortionSixthOrder.GetHashCode();
}
public override bool Equals(object obj)
{
if (!(obj is CameraIntrinsics))
{
return false;
}
return this.Equals((CameraIntrinsics)obj);
}
public bool Equals(CameraIntrinsics obj)
{
return FocalLengthX.Equals(obj.FocalLengthX) && FocalLengthY.Equals(obj.FocalLengthY) &&
PrincipalPointX.Equals(obj.PrincipalPointX) && PrincipalPointY.Equals(obj.PrincipalPointY) &&
RadialDistortionSecondOrder.Equals(obj.RadialDistortionSecondOrder) &&
RadialDistortionFourthOrder.Equals(obj.RadialDistortionFourthOrder) &&
RadialDistortionSixthOrder.Equals(obj.RadialDistortionSixthOrder);
}
public static bool operator ==(CameraIntrinsics a, CameraIntrinsics b)
{
return a.Equals(b);
}
public static bool operator !=(CameraIntrinsics a, CameraIntrinsics b)
{
return !(a.Equals(b));
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Helper
{
class CollectionMap<TKey, TValue> : Helper.ThreadSafeDictionary<TKey, TValue> where TValue : new()
{
public bool TryAddDefault(TKey key)
{
lock (_impl)
{
if (!_impl.ContainsKey(key))
{
_impl.Add(key, new TValue());
return true;
}
else
{
return false;
}
}
}
}
}
using UnityEngine;
using UnityEditor;
using System;
using System.Collections.Generic;
using System.IO;
public static class KinectCopyPluginDataHelper
{
private const string DataDirSuffix = "_Data";
private const string PluginsDirName = "Plugins";
private static Dictionary<BuildTarget, string> TargetToDirName = new Dictionary<BuildTarget, string>()
{
{BuildTarget.StandaloneWindows, "x86"},
{BuildTarget.StandaloneWindows64, "x86_64"}
};
public static void CopyPluginData(BuildTarget target, string buildTargetPath, string subDirToCopy)
{
string subDirName;
if (!TargetToDirName.TryGetValue (target, out subDirName))
{
// No work to do
return;
}
// Get Required Paths
var buildName = Path.GetFileNameWithoutExtension(buildTargetPath);
var targetDir = Directory.GetParent(buildTargetPath);
var separator = Path.DirectorySeparatorChar;
var buildDataDir = targetDir.FullName + separator + buildName + DataDirSuffix + separator;
var tgtPluginsDir = buildDataDir + separator + PluginsDirName + separator + subDirToCopy + separator;
var srcPluginsDir = Application.dataPath + separator + PluginsDirName + separator + subDirName + separator + subDirToCopy + separator;
CopyAll (new DirectoryInfo (srcPluginsDir), new DirectoryInfo(tgtPluginsDir));
}
/// <summary>
/// Recursive Copy Directory Method
/// </summary>
private static void CopyAll(DirectoryInfo source, DirectoryInfo target)
{
// Check if the source directory exists, if not, don't do any work.
if (!Directory.Exists(source.FullName))
{
return;
}
// Check if the target directory exists, if not, create it.
if (!Directory.Exists(target.FullName))
{
Directory.CreateDirectory(target.FullName);
}
// Copy each file into it’s new directory.
foreach (var fileInfo in source.GetFiles())
{
fileInfo.CopyTo (Path.Combine (target.ToString (), fileInfo.Name), true);
}
// Copy each subdirectory using recursion.
foreach (var subDirInfo in source.GetDirectories())
{
DirectoryInfo nextTargetSubDir = target.CreateSubdirectory(subDirInfo.Name);
CopyAll(subDirInfo, nextTargetSubDir);
}
}
}
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Linq;
namespace Helper
{
internal class EventPump : UnityEngine.MonoBehaviour
{
private static object s_Lock = new object();
private Queue<Action> m_Queue = new Queue<Action>();
public static EventPump Instance
{
get;
private set;
}
public static void EnsureInitialized()
{
try
{
if (EventPump.Instance == null)
{
lock (s_Lock)
{
if (EventPump.Instance == null)
{
UnityEngine.GameObject parent = new UnityEngine.GameObject("Kinect Desktop Event Pump");
EventPump.Instance = parent.AddComponent<Helper.EventPump>();
DontDestroyOnLoad(parent);
}
}
}
}
catch
{
UnityEngine.Debug.LogError("Events must be registered on the main thread.");
return;
}
}
private void Update()
{
lock (m_Queue)
{
while (m_Queue.Count > 0)
{
var action = m_Queue.Dequeue();
try
{
action.Invoke();
}
catch { }
}
}
}
private void OnApplicationQuit()
{
var sensor = Windows.Kinect.KinectSensor.GetDefault();
if (sensor != null && sensor.IsOpen)
{
sensor.Close();
}
NativeObjectCache.Flush();
}
public void Enqueue(Action action)
{
lock (m_Queue)
{
m_Queue.Enqueue(action);
}
}
}
}
\ No newline at end of file
using System;
using System.Runtime.InteropServices;
namespace Helper
{
public static class ExceptionHelper
{
private const int E_NOTIMPL = unchecked((int)0x80004001);
private const int E_OUTOFMEMORY = unchecked((int)0x8007000E);
private const int E_INVALIDARG = unchecked((int)0x80070057);
private const int E_POINTER = unchecked((int) 0x80004003);
private const int E_PENDING = unchecked((int)0x8000000A);
private const int E_FAIL = unchecked((int)0x80004005);
public static void CheckLastError()
{
int hr = Marshal.GetLastWin32Error();
if ((hr == E_PENDING) || (hr == E_FAIL))
{
// Ignore E_PENDING/E_FAIL - We use this to indicate no pending or missed frames
return;
}
if (hr < 0)
{
Exception exception = Marshal.GetExceptionForHR(hr);
string message = string.Format("This API has returned an exception from an HRESULT: 0x{0:X}", hr);
switch (hr)
{
case E_NOTIMPL:
throw new NotImplementedException(message, exception);
case E_OUTOFMEMORY:
throw new OutOfMemoryException(message, exception);
case E_INVALIDARG:
throw new ArgumentException(message, exception);
case E_POINTER:
throw new ArgumentNullException(message, exception);
default:
throw new InvalidOperationException(message, exception);
}
}
}
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Linq;
namespace Helper
{
internal interface INativeWrapper
{
System.IntPtr nativePtr { get; }
}
}
\ No newline at end of file
using RootSystem = System;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace Windows.Kinect
{
// NOTE: This uses an IBuffer under the covers, it is renamed here to give parity to our managed APIs.
public class KinectBuffer : Helper.INativeWrapper, IDisposable
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal KinectBuffer(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Storage_Streams_IBuffer_AddRefObject(ref _pNative);
}
~KinectBuffer()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
private static extern void Windows_Storage_Streams_IBuffer_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
private static extern void Windows_Storage_Streams_IBuffer_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
Helper.NativeObjectCache.RemoveObject<KinectBuffer>(_pNative);
if (disposing)
{
Windows_Storage_Streams_IBuffer_Dispose(_pNative);
}
Windows_Storage_Streams_IBuffer_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError = true)]
private static extern uint Windows_Storage_Streams_IBuffer_get_Capacity(RootSystem.IntPtr pNative);
public uint Capacity
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("KinectBuffer");
}
uint capacity = Windows_Storage_Streams_IBuffer_get_Capacity(_pNative);
Helper.ExceptionHelper.CheckLastError();
return capacity;
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError = true)]
private static extern uint Windows_Storage_Streams_IBuffer_get_Length(RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError = true)]
private static extern void Windows_Storage_Streams_IBuffer_put_Length(RootSystem.IntPtr pNative, uint value);
public uint Length
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("KinectBuffer");
}
uint length = Windows_Storage_Streams_IBuffer_get_Length(_pNative);
Helper.ExceptionHelper.CheckLastError();
return length;
}
set
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("KinectBuffer");
}
Windows_Storage_Streams_IBuffer_put_Length(_pNative, value);
Helper.ExceptionHelper.CheckLastError();
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl)]
private static extern void Windows_Storage_Streams_IBuffer_Dispose(RootSystem.IntPtr pNative);
// Constructors and Finalizers
public void Dispose()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("KinectBuffer");
}
Dispose(true);
RootSystem.GC.SuppressFinalize(this);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention = RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError = true)]
private static extern RootSystem.IntPtr Windows_Storage_Streams_IBuffer_get_UnderlyingBuffer(RootSystem.IntPtr pNative);
public IntPtr UnderlyingBuffer
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("KinectBuffer");
}
RootSystem.IntPtr value = Windows_Storage_Streams_IBuffer_get_UnderlyingBuffer(_pNative);
Helper.ExceptionHelper.CheckLastError();
return value;
}
}
}
}
\ No newline at end of file
This diff is collapsed. Click to expand it.
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Linq;
namespace Helper
{
public static class NativeObjectCache
{
private static object _lock = new object();
private static Dictionary<Type, Dictionary<IntPtr, WeakReference>> _objectCache = new Dictionary<Type, Dictionary<IntPtr, WeakReference>>();
public static void AddObject<T>(IntPtr nativePtr, T obj) where T : class
{
lock (_lock)
{
Dictionary<IntPtr, WeakReference> objCache = null;
if (!_objectCache.TryGetValue(typeof(T), out objCache) || objCache == null)
{
objCache = new Dictionary<IntPtr, WeakReference>();
_objectCache[typeof(T)] = objCache;
}
objCache[nativePtr] = new WeakReference(obj);
}
}
public static void Flush()
{
lock(_lock)
{
foreach (var byType in _objectCache.ToArray())
{
foreach(var kvp in byType.Value.ToArray())
{
IDisposable disp = kvp.Value.Target as IDisposable;
if(disp != null)
{
disp.Dispose();
}
}
}
}
}
public static void RemoveObject<T>(IntPtr nativePtr)
{
lock (_lock)
{
Dictionary<IntPtr, WeakReference> objCache = null;
if (!_objectCache.TryGetValue(typeof(T), out objCache) || objCache == null)
{
objCache = new Dictionary<IntPtr, WeakReference>();
_objectCache[typeof(T)] = objCache;
}
if (objCache.ContainsKey(nativePtr))
{
objCache.Remove(nativePtr);
}
}
}
public static T GetObject<T>(IntPtr nativePtr) where T : class
{
lock (_lock)
{
Dictionary<IntPtr, WeakReference> objCache = null;
if (!_objectCache.TryGetValue(typeof(T), out objCache) || objCache == null)
{
objCache = new Dictionary<IntPtr, WeakReference>();
_objectCache[typeof(T)] = objCache;
}
WeakReference reference = null;
if (objCache.TryGetValue(nativePtr, out reference))
{
if (reference != null)
{
T obj = reference.Target as T;
if (obj != null)
{
return (T)obj;
}
}
}
return null;
}
}
public static T CreateOrGetObject<T>(IntPtr nativePtr, Func<System.IntPtr,T> create) where T : class
{
T outputValue = null;
lock (_lock)
{
Dictionary<IntPtr, WeakReference> objCache = null;
if (!_objectCache.TryGetValue(typeof(T), out objCache) || objCache == null)
{
objCache = new Dictionary<IntPtr, WeakReference>();
_objectCache[typeof(T)] = objCache;
}
WeakReference reference = null;
if (objCache.TryGetValue(nativePtr, out reference))
{
if ((reference != null) && reference.IsAlive)
{
outputValue = reference.Target as T;
}
}
if (outputValue == null)
{
if (create != null)
{
outputValue = create(nativePtr);
objCache[nativePtr] = new WeakReference(outputValue);
}
else if(typeof(T) == typeof(System.Object))
{
//T is an object, so lets just pass back our IntPtr, which is an object.
outputValue = (T)(System.Object)nativePtr;
}
}
}
return outputValue;
}
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Linq;
namespace Helper
{
public static class NativeWrapper
{
public static System.IntPtr GetNativePtr(Object obj)
{
if(obj == null)
{
return System.IntPtr.Zero;
}
var nativeWrapperIface = obj as INativeWrapper;
if(nativeWrapperIface != null)
{
return nativeWrapperIface.nativePtr;
}
else
{
throw new ArgumentException("Object must wrap native type");
}
}
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Linq;
namespace Helper
{
public class SmartGCHandle : IDisposable
{
private GCHandle handle;
public SmartGCHandle(GCHandle handle)
{
this.handle = handle;
}
~SmartGCHandle()
{
Dispose(false);
}
public System.IntPtr AddrOfPinnedObject()
{
return handle.AddrOfPinnedObject();
}
public virtual void Dispose()
{
Dispose(true);
}
protected virtual void Dispose(bool disposing)
{
this.handle.Free();
}
public static implicit operator GCHandle(SmartGCHandle other)
{
return other.handle;
}
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Linq;
namespace Helper
{
public class ThreadSafeDictionary<TKey, TValue>
{
protected readonly Dictionary<TKey, TValue> _impl = new Dictionary<TKey, TValue>();
public TValue this[TKey key]
{
get
{
lock (_impl)
{
return _impl[key];
}
}
set
{
lock (_impl)
{
_impl[key] = value;
}
}
}
public void Add(TKey key, TValue value)
{
lock (_impl)
{
_impl.Add(key, value);
}
}
public bool TryGetValue(TKey key, out TValue value)
{
lock (_impl)
{
return _impl.TryGetValue(key, out value);
}
}
public bool Remove(TKey key)
{
lock (_impl)
{
return _impl.Remove(key);
}
}
public void Clear()
{
lock (_impl)
{
_impl.Clear();
}
}
}
}
\ No newline at end of file
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Data
{
//
// Windows.Data.PropertyChangedEventArgs
//
public sealed partial class PropertyChangedEventArgs : RootSystem.EventArgs, Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal PropertyChangedEventArgs(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Data_PropertyChangedEventArgs_AddRefObject(ref _pNative);
}
~PropertyChangedEventArgs()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Data_PropertyChangedEventArgs_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Data_PropertyChangedEventArgs_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<PropertyChangedEventArgs>(_pNative);
Windows_Data_PropertyChangedEventArgs_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Data_PropertyChangedEventArgs_get_PropertyName(RootSystem.IntPtr pNative);
public string PropertyName
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("PropertyChangedEventArgs");
}
RootSystem.IntPtr objectPointer = Windows_Data_PropertyChangedEventArgs_get_PropertyName(_pNative);
Helper.ExceptionHelper.CheckLastError();
var managedString = RootSystem.Runtime.InteropServices.Marshal.PtrToStringUni(objectPointer);
RootSystem.Runtime.InteropServices.Marshal.FreeCoTaskMem(objectPointer);
return managedString;
}
}
private void __EventCleanup()
{
}
}
}
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.Activity
//
public enum Activity : int
{
EyeLeftClosed =0,
EyeRightClosed =1,
MouthOpen =2,
MouthMoved =3,
LookingAway =4,
}
}
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.Appearance
//
public enum Appearance : int
{
WearingGlasses =0,
}
}
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.AudioBeamFrame
//
public sealed partial class AudioBeamFrame : RootSystem.IDisposable, Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal AudioBeamFrame(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_AudioBeamFrame_AddRefObject(ref _pNative);
}
~AudioBeamFrame()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamFrame_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamFrame_AddRefObject(ref RootSystem.IntPtr pNative);
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_AudioBeamFrame_get_AudioBeam(RootSystem.IntPtr pNative);
public Windows.Kinect.AudioBeam AudioBeam
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamFrame");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_AudioBeamFrame_get_AudioBeam(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.AudioBeam>(objectPointer, n => new Windows.Kinect.AudioBeam(n));
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_AudioBeamFrame_get_AudioSource(RootSystem.IntPtr pNative);
public Windows.Kinect.AudioSource AudioSource
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamFrame");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_AudioBeamFrame_get_AudioSource(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.AudioSource>(objectPointer, n => new Windows.Kinect.AudioSource(n));
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern long Windows_Kinect_AudioBeamFrame_get_Duration(RootSystem.IntPtr pNative);
public RootSystem.TimeSpan Duration
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamFrame");
}
return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_AudioBeamFrame_get_Duration(_pNative));
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern long Windows_Kinect_AudioBeamFrame_get_RelativeTimeStart(RootSystem.IntPtr pNative);
public RootSystem.TimeSpan RelativeTimeStart
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamFrame");
}
return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_AudioBeamFrame_get_RelativeTimeStart(_pNative));
}
}
// Public Methods
private void __EventCleanup()
{
}
}
}
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.AudioBeamFrameArrivedEventArgs
//
public sealed partial class AudioBeamFrameArrivedEventArgs : RootSystem.EventArgs, Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal AudioBeamFrameArrivedEventArgs(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_AudioBeamFrameArrivedEventArgs_AddRefObject(ref _pNative);
}
~AudioBeamFrameArrivedEventArgs()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamFrameArrivedEventArgs_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamFrameArrivedEventArgs_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<AudioBeamFrameArrivedEventArgs>(_pNative);
Windows_Kinect_AudioBeamFrameArrivedEventArgs_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_AudioBeamFrameArrivedEventArgs_get_FrameReference(RootSystem.IntPtr pNative);
public Windows.Kinect.AudioBeamFrameReference FrameReference
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamFrameArrivedEventArgs");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_AudioBeamFrameArrivedEventArgs_get_FrameReference(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.AudioBeamFrameReference>(objectPointer, n => new Windows.Kinect.AudioBeamFrameReference(n));
}
}
private void __EventCleanup()
{
}
}
}
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.AudioBeamFrameList
//
public sealed partial class AudioBeamFrameList : RootSystem.IDisposable, Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal AudioBeamFrameList(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_AudioBeamFrameList_AddRefObject(ref _pNative);
}
~AudioBeamFrameList()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamFrameList_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamFrameList_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<AudioBeamFrameList>(_pNative);
if (disposing)
{
Windows_Kinect_AudioBeamFrameList_Dispose(_pNative);
}
Windows_Kinect_AudioBeamFrameList_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Methods
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamFrameList_Dispose(RootSystem.IntPtr pNative);
public void Dispose()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
Dispose(true);
RootSystem.GC.SuppressFinalize(this);
}
private void __EventCleanup()
{
}
}
}
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.AudioBeamFrameReference
//
public sealed partial class AudioBeamFrameReference : Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal AudioBeamFrameReference(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_AudioBeamFrameReference_AddRefObject(ref _pNative);
}
~AudioBeamFrameReference()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamFrameReference_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamFrameReference_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<AudioBeamFrameReference>(_pNative);
Windows_Kinect_AudioBeamFrameReference_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern long Windows_Kinect_AudioBeamFrameReference_get_RelativeTime(RootSystem.IntPtr pNative);
public RootSystem.TimeSpan RelativeTime
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamFrameReference");
}
return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_AudioBeamFrameReference_get_RelativeTime(_pNative));
}
}
// Public Methods
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern int Windows_Kinect_AudioBeamFrameReference_AcquireBeamFrames_Length(RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern int Windows_Kinect_AudioBeamFrameReference_AcquireBeamFrames(RootSystem.IntPtr pNative, [RootSystem.Runtime.InteropServices.Out] RootSystem.IntPtr[] outCollection, int outCollectionSize);
public RootSystem.Collections.Generic.IList<Windows.Kinect.AudioBeamFrame> AcquireBeamFrames()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamFrameReference");
}
int outCollectionSize = Windows_Kinect_AudioBeamFrameReference_AcquireBeamFrames_Length(_pNative);
var outCollection = new RootSystem.IntPtr[outCollectionSize];
var managedCollection = new Windows.Kinect.AudioBeamFrame[outCollectionSize];
outCollectionSize = Windows_Kinect_AudioBeamFrameReference_AcquireBeamFrames(_pNative, outCollection, outCollectionSize);
Helper.ExceptionHelper.CheckLastError();
for(int i=0;i<outCollectionSize;i++)
{
if(outCollection[i] == RootSystem.IntPtr.Zero)
{
continue;
}
var obj = Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.AudioBeamFrame>(outCollection[i], n => new Windows.Kinect.AudioBeamFrame(n));
managedCollection[i] = obj;
}
return managedCollection;
}
private void __EventCleanup()
{
}
}
}
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.AudioBeamMode
//
public enum AudioBeamMode : int
{
Automatic =0,
Manual =1,
}
}
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.AudioBeamSubFrame
//
public sealed partial class AudioBeamSubFrame : RootSystem.IDisposable, Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal AudioBeamSubFrame(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_AudioBeamSubFrame_AddRefObject(ref _pNative);
}
~AudioBeamSubFrame()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamSubFrame_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamSubFrame_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<AudioBeamSubFrame>(_pNative);
if (disposing)
{
Windows_Kinect_AudioBeamSubFrame_Dispose(_pNative);
}
Windows_Kinect_AudioBeamSubFrame_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern Windows.Kinect.AudioBeamMode Windows_Kinect_AudioBeamSubFrame_get_AudioBeamMode(RootSystem.IntPtr pNative);
public Windows.Kinect.AudioBeamMode AudioBeamMode
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame");
}
return Windows_Kinect_AudioBeamSubFrame_get_AudioBeamMode(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern int Windows_Kinect_AudioBeamSubFrame_get_AudioBodyCorrelations(RootSystem.IntPtr pNative, [RootSystem.Runtime.InteropServices.Out] RootSystem.IntPtr[] outCollection, int outCollectionSize);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern int Windows_Kinect_AudioBeamSubFrame_get_AudioBodyCorrelations_Length(RootSystem.IntPtr pNative);
public RootSystem.Collections.Generic.IList<Windows.Kinect.AudioBodyCorrelation> AudioBodyCorrelations
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame");
}
int outCollectionSize = Windows_Kinect_AudioBeamSubFrame_get_AudioBodyCorrelations_Length(_pNative);
var outCollection = new RootSystem.IntPtr[outCollectionSize];
var managedCollection = new Windows.Kinect.AudioBodyCorrelation[outCollectionSize];
outCollectionSize = Windows_Kinect_AudioBeamSubFrame_get_AudioBodyCorrelations(_pNative, outCollection, outCollectionSize);
Helper.ExceptionHelper.CheckLastError();
for(int i=0;i<outCollectionSize;i++)
{
if(outCollection[i] == RootSystem.IntPtr.Zero)
{
continue;
}
var obj = Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.AudioBodyCorrelation>(outCollection[i], n => new Windows.Kinect.AudioBodyCorrelation(n));
managedCollection[i] = obj;
}
return managedCollection;
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern float Windows_Kinect_AudioBeamSubFrame_get_BeamAngle(RootSystem.IntPtr pNative);
public float BeamAngle
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame");
}
return Windows_Kinect_AudioBeamSubFrame_get_BeamAngle(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern float Windows_Kinect_AudioBeamSubFrame_get_BeamAngleConfidence(RootSystem.IntPtr pNative);
public float BeamAngleConfidence
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame");
}
return Windows_Kinect_AudioBeamSubFrame_get_BeamAngleConfidence(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern long Windows_Kinect_AudioBeamSubFrame_get_Duration(RootSystem.IntPtr pNative);
public RootSystem.TimeSpan Duration
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame");
}
return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_AudioBeamSubFrame_get_Duration(_pNative));
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern uint Windows_Kinect_AudioBeamSubFrame_get_FrameLengthInBytes(RootSystem.IntPtr pNative);
public uint FrameLengthInBytes
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame");
}
return Windows_Kinect_AudioBeamSubFrame_get_FrameLengthInBytes(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern long Windows_Kinect_AudioBeamSubFrame_get_RelativeTime(RootSystem.IntPtr pNative);
public RootSystem.TimeSpan RelativeTime
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame");
}
return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_AudioBeamSubFrame_get_RelativeTime(_pNative));
}
}
// Public Methods
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamSubFrame_CopyFrameDataToArray(RootSystem.IntPtr pNative, RootSystem.IntPtr frameData, int frameDataSize);
public void CopyFrameDataToArray(byte[] frameData)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBeamSubFrame");
}
var frameDataSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(frameData, RootSystem.Runtime.InteropServices.GCHandleType.Pinned));
var _frameData = frameDataSmartGCHandle.AddrOfPinnedObject();
Windows_Kinect_AudioBeamSubFrame_CopyFrameDataToArray(_pNative, _frameData, frameData.Length);
Helper.ExceptionHelper.CheckLastError();
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBeamSubFrame_Dispose(RootSystem.IntPtr pNative);
public void Dispose()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
Dispose(true);
RootSystem.GC.SuppressFinalize(this);
}
private void __EventCleanup()
{
}
}
}
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.AudioBodyCorrelation
//
public sealed partial class AudioBodyCorrelation : Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal AudioBodyCorrelation(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_AudioBodyCorrelation_AddRefObject(ref _pNative);
}
~AudioBodyCorrelation()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBodyCorrelation_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_AudioBodyCorrelation_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<AudioBodyCorrelation>(_pNative);
Windows_Kinect_AudioBodyCorrelation_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern ulong Windows_Kinect_AudioBodyCorrelation_get_BodyTrackingId(RootSystem.IntPtr pNative);
public ulong BodyTrackingId
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("AudioBodyCorrelation");
}
return Windows_Kinect_AudioBodyCorrelation_get_BodyTrackingId(_pNative);
}
}
private void __EventCleanup()
{
}
}
}
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.BodyFrame
//
public sealed partial class BodyFrame : RootSystem.IDisposable, Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal BodyFrame(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_BodyFrame_AddRefObject(ref _pNative);
}
~BodyFrame()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyFrame_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyFrame_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<BodyFrame>(_pNative);
if (disposing)
{
Windows_Kinect_BodyFrame_Dispose(_pNative);
}
Windows_Kinect_BodyFrame_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern int Windows_Kinect_BodyFrame_get_BodyCount(RootSystem.IntPtr pNative);
public int BodyCount
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyFrame");
}
return Windows_Kinect_BodyFrame_get_BodyCount(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_BodyFrame_get_BodyFrameSource(RootSystem.IntPtr pNative);
public Windows.Kinect.BodyFrameSource BodyFrameSource
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyFrame");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_BodyFrame_get_BodyFrameSource(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.BodyFrameSource>(objectPointer, n => new Windows.Kinect.BodyFrameSource(n));
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_BodyFrame_get_FloorClipPlane(RootSystem.IntPtr pNative);
public Windows.Kinect.Vector4 FloorClipPlane
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyFrame");
}
var objectPointer = Windows_Kinect_BodyFrame_get_FloorClipPlane(_pNative);
Helper.ExceptionHelper.CheckLastError();
var obj = (Windows.Kinect.Vector4)RootSystem.Runtime.InteropServices.Marshal.PtrToStructure(objectPointer, typeof(Windows.Kinect.Vector4));
Windows.Kinect.KinectUnityAddinUtils.FreeMemory(objectPointer);
return obj;
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern long Windows_Kinect_BodyFrame_get_RelativeTime(RootSystem.IntPtr pNative);
public RootSystem.TimeSpan RelativeTime
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyFrame");
}
return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_BodyFrame_get_RelativeTime(_pNative));
}
}
// Public Methods
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyFrame_Dispose(RootSystem.IntPtr pNative);
public void Dispose()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
Dispose(true);
RootSystem.GC.SuppressFinalize(this);
}
private void __EventCleanup()
{
}
}
}
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.BodyFrameArrivedEventArgs
//
public sealed partial class BodyFrameArrivedEventArgs : RootSystem.EventArgs, Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal BodyFrameArrivedEventArgs(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_BodyFrameArrivedEventArgs_AddRefObject(ref _pNative);
}
~BodyFrameArrivedEventArgs()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyFrameArrivedEventArgs_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyFrameArrivedEventArgs_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<BodyFrameArrivedEventArgs>(_pNative);
Windows_Kinect_BodyFrameArrivedEventArgs_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_BodyFrameArrivedEventArgs_get_FrameReference(RootSystem.IntPtr pNative);
public Windows.Kinect.BodyFrameReference FrameReference
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyFrameArrivedEventArgs");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_BodyFrameArrivedEventArgs_get_FrameReference(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.BodyFrameReference>(objectPointer, n => new Windows.Kinect.BodyFrameReference(n));
}
}
private void __EventCleanup()
{
}
}
}
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.BodyFrameReference
//
public sealed partial class BodyFrameReference : Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal BodyFrameReference(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_BodyFrameReference_AddRefObject(ref _pNative);
}
~BodyFrameReference()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyFrameReference_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyFrameReference_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<BodyFrameReference>(_pNative);
Windows_Kinect_BodyFrameReference_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern long Windows_Kinect_BodyFrameReference_get_RelativeTime(RootSystem.IntPtr pNative);
public RootSystem.TimeSpan RelativeTime
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyFrameReference");
}
return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_BodyFrameReference_get_RelativeTime(_pNative));
}
}
// Public Methods
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_BodyFrameReference_AcquireFrame(RootSystem.IntPtr pNative);
public Windows.Kinect.BodyFrame AcquireFrame()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyFrameReference");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_BodyFrameReference_AcquireFrame(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.BodyFrame>(objectPointer, n => new Windows.Kinect.BodyFrame(n));
}
private void __EventCleanup()
{
}
}
}
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.BodyIndexFrame
//
public sealed partial class BodyIndexFrame : RootSystem.IDisposable, Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal BodyIndexFrame(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_BodyIndexFrame_AddRefObject(ref _pNative);
}
~BodyIndexFrame()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyIndexFrame_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyIndexFrame_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<BodyIndexFrame>(_pNative);
if (disposing)
{
Windows_Kinect_BodyIndexFrame_Dispose(_pNative);
}
Windows_Kinect_BodyIndexFrame_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_BodyIndexFrame_get_BodyIndexFrameSource(RootSystem.IntPtr pNative);
public Windows.Kinect.BodyIndexFrameSource BodyIndexFrameSource
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyIndexFrame");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_BodyIndexFrame_get_BodyIndexFrameSource(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.BodyIndexFrameSource>(objectPointer, n => new Windows.Kinect.BodyIndexFrameSource(n));
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_BodyIndexFrame_get_FrameDescription(RootSystem.IntPtr pNative);
public Windows.Kinect.FrameDescription FrameDescription
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyIndexFrame");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_BodyIndexFrame_get_FrameDescription(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.FrameDescription>(objectPointer, n => new Windows.Kinect.FrameDescription(n));
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern long Windows_Kinect_BodyIndexFrame_get_RelativeTime(RootSystem.IntPtr pNative);
public RootSystem.TimeSpan RelativeTime
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyIndexFrame");
}
return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_BodyIndexFrame_get_RelativeTime(_pNative));
}
}
// Public Methods
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyIndexFrame_CopyFrameDataToArray(RootSystem.IntPtr pNative, RootSystem.IntPtr frameData, int frameDataSize);
public void CopyFrameDataToArray(byte[] frameData)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyIndexFrame");
}
var frameDataSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(frameData, RootSystem.Runtime.InteropServices.GCHandleType.Pinned));
var _frameData = frameDataSmartGCHandle.AddrOfPinnedObject();
Windows_Kinect_BodyIndexFrame_CopyFrameDataToArray(_pNative, _frameData, frameData.Length);
Helper.ExceptionHelper.CheckLastError();
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyIndexFrame_Dispose(RootSystem.IntPtr pNative);
public void Dispose()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
Dispose(true);
RootSystem.GC.SuppressFinalize(this);
}
private void __EventCleanup()
{
}
}
}
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.BodyIndexFrameArrivedEventArgs
//
public sealed partial class BodyIndexFrameArrivedEventArgs : RootSystem.EventArgs, Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal BodyIndexFrameArrivedEventArgs(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_BodyIndexFrameArrivedEventArgs_AddRefObject(ref _pNative);
}
~BodyIndexFrameArrivedEventArgs()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyIndexFrameArrivedEventArgs_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyIndexFrameArrivedEventArgs_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<BodyIndexFrameArrivedEventArgs>(_pNative);
Windows_Kinect_BodyIndexFrameArrivedEventArgs_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_BodyIndexFrameArrivedEventArgs_get_FrameReference(RootSystem.IntPtr pNative);
public Windows.Kinect.BodyIndexFrameReference FrameReference
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyIndexFrameArrivedEventArgs");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_BodyIndexFrameArrivedEventArgs_get_FrameReference(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.BodyIndexFrameReference>(objectPointer, n => new Windows.Kinect.BodyIndexFrameReference(n));
}
}
private void __EventCleanup()
{
}
}
}
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.BodyIndexFrameReference
//
public sealed partial class BodyIndexFrameReference : Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal BodyIndexFrameReference(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_BodyIndexFrameReference_AddRefObject(ref _pNative);
}
~BodyIndexFrameReference()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyIndexFrameReference_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_BodyIndexFrameReference_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<BodyIndexFrameReference>(_pNative);
Windows_Kinect_BodyIndexFrameReference_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern long Windows_Kinect_BodyIndexFrameReference_get_RelativeTime(RootSystem.IntPtr pNative);
public RootSystem.TimeSpan RelativeTime
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyIndexFrameReference");
}
return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_BodyIndexFrameReference_get_RelativeTime(_pNative));
}
}
// Public Methods
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_BodyIndexFrameReference_AcquireFrame(RootSystem.IntPtr pNative);
public Windows.Kinect.BodyIndexFrame AcquireFrame()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("BodyIndexFrameReference");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_BodyIndexFrameReference_AcquireFrame(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.BodyIndexFrame>(objectPointer, n => new Windows.Kinect.BodyIndexFrame(n));
}
private void __EventCleanup()
{
}
}
}
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.CameraSpacePoint
//
[RootSystem.Runtime.InteropServices.StructLayout(RootSystem.Runtime.InteropServices.LayoutKind.Sequential)]
public struct CameraSpacePoint
{
public float X { get; set; }
public float Y { get; set; }
public float Z { get; set; }
public override int GetHashCode()
{
return X.GetHashCode() ^ Y.GetHashCode() ^ Z.GetHashCode();
}
public override bool Equals(object obj)
{
if (!(obj is CameraSpacePoint))
{
return false;
}
return this.Equals((CameraSpacePoint)obj);
}
public bool Equals(CameraSpacePoint obj)
{
return X.Equals(obj.X) && Y.Equals(obj.Y) && Z.Equals(obj.Z);
}
public static bool operator ==(CameraSpacePoint a, CameraSpacePoint b)
{
return a.Equals(b);
}
public static bool operator !=(CameraSpacePoint a, CameraSpacePoint b)
{
return !(a.Equals(b));
}
}
}
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.ColorCameraSettings
//
public sealed partial class ColorCameraSettings : Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal ColorCameraSettings(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_ColorCameraSettings_AddRefObject(ref _pNative);
}
~ColorCameraSettings()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_ColorCameraSettings_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_ColorCameraSettings_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<ColorCameraSettings>(_pNative);
Windows_Kinect_ColorCameraSettings_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern long Windows_Kinect_ColorCameraSettings_get_ExposureTime(RootSystem.IntPtr pNative);
public RootSystem.TimeSpan ExposureTime
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("ColorCameraSettings");
}
return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_ColorCameraSettings_get_ExposureTime(_pNative));
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern long Windows_Kinect_ColorCameraSettings_get_FrameInterval(RootSystem.IntPtr pNative);
public RootSystem.TimeSpan FrameInterval
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("ColorCameraSettings");
}
return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_ColorCameraSettings_get_FrameInterval(_pNative));
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern float Windows_Kinect_ColorCameraSettings_get_Gain(RootSystem.IntPtr pNative);
public float Gain
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("ColorCameraSettings");
}
return Windows_Kinect_ColorCameraSettings_get_Gain(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern float Windows_Kinect_ColorCameraSettings_get_Gamma(RootSystem.IntPtr pNative);
public float Gamma
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("ColorCameraSettings");
}
return Windows_Kinect_ColorCameraSettings_get_Gamma(_pNative);
}
}
private void __EventCleanup()
{
}
}
}
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.ColorFrame
//
public sealed partial class ColorFrame : RootSystem.IDisposable, Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal ColorFrame(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_ColorFrame_AddRefObject(ref _pNative);
}
~ColorFrame()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_ColorFrame_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_ColorFrame_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<ColorFrame>(_pNative);
if (disposing)
{
Windows_Kinect_ColorFrame_Dispose(_pNative);
}
Windows_Kinect_ColorFrame_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_ColorFrame_get_ColorCameraSettings(RootSystem.IntPtr pNative);
public Windows.Kinect.ColorCameraSettings ColorCameraSettings
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("ColorFrame");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_ColorFrame_get_ColorCameraSettings(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.ColorCameraSettings>(objectPointer, n => new Windows.Kinect.ColorCameraSettings(n));
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_ColorFrame_get_ColorFrameSource(RootSystem.IntPtr pNative);
public Windows.Kinect.ColorFrameSource ColorFrameSource
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("ColorFrame");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_ColorFrame_get_ColorFrameSource(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.ColorFrameSource>(objectPointer, n => new Windows.Kinect.ColorFrameSource(n));
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_ColorFrame_get_FrameDescription(RootSystem.IntPtr pNative);
public Windows.Kinect.FrameDescription FrameDescription
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("ColorFrame");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_ColorFrame_get_FrameDescription(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.FrameDescription>(objectPointer, n => new Windows.Kinect.FrameDescription(n));
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern Windows.Kinect.ColorImageFormat Windows_Kinect_ColorFrame_get_RawColorImageFormat(RootSystem.IntPtr pNative);
public Windows.Kinect.ColorImageFormat RawColorImageFormat
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("ColorFrame");
}
return Windows_Kinect_ColorFrame_get_RawColorImageFormat(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern long Windows_Kinect_ColorFrame_get_RelativeTime(RootSystem.IntPtr pNative);
public RootSystem.TimeSpan RelativeTime
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("ColorFrame");
}
return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_ColorFrame_get_RelativeTime(_pNative));
}
}
// Public Methods
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_ColorFrame_CopyRawFrameDataToArray(RootSystem.IntPtr pNative, RootSystem.IntPtr frameData, int frameDataSize);
public void CopyRawFrameDataToArray(byte[] frameData)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("ColorFrame");
}
var frameDataSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(frameData, RootSystem.Runtime.InteropServices.GCHandleType.Pinned));
var _frameData = frameDataSmartGCHandle.AddrOfPinnedObject();
Windows_Kinect_ColorFrame_CopyRawFrameDataToArray(_pNative, _frameData, frameData.Length);
Helper.ExceptionHelper.CheckLastError();
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_ColorFrame_CopyConvertedFrameDataToArray(RootSystem.IntPtr pNative, RootSystem.IntPtr frameData, int frameDataSize, Windows.Kinect.ColorImageFormat colorFormat);
public void CopyConvertedFrameDataToArray(byte[] frameData, Windows.Kinect.ColorImageFormat colorFormat)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("ColorFrame");
}
var frameDataSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(frameData, RootSystem.Runtime.InteropServices.GCHandleType.Pinned));
var _frameData = frameDataSmartGCHandle.AddrOfPinnedObject();
Windows_Kinect_ColorFrame_CopyConvertedFrameDataToArray(_pNative, _frameData, frameData.Length, colorFormat);
Helper.ExceptionHelper.CheckLastError();
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_ColorFrame_CreateFrameDescription(RootSystem.IntPtr pNative, Windows.Kinect.ColorImageFormat format);
public Windows.Kinect.FrameDescription CreateFrameDescription(Windows.Kinect.ColorImageFormat format)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("ColorFrame");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_ColorFrame_CreateFrameDescription(_pNative, format);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.FrameDescription>(objectPointer, n => new Windows.Kinect.FrameDescription(n));
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_ColorFrame_Dispose(RootSystem.IntPtr pNative);
public void Dispose()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
Dispose(true);
RootSystem.GC.SuppressFinalize(this);
}
private void __EventCleanup()
{
}
}
}
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.ColorFrameArrivedEventArgs
//
public sealed partial class ColorFrameArrivedEventArgs : RootSystem.EventArgs, Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal ColorFrameArrivedEventArgs(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_ColorFrameArrivedEventArgs_AddRefObject(ref _pNative);
}
~ColorFrameArrivedEventArgs()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_ColorFrameArrivedEventArgs_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_ColorFrameArrivedEventArgs_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<ColorFrameArrivedEventArgs>(_pNative);
Windows_Kinect_ColorFrameArrivedEventArgs_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_ColorFrameArrivedEventArgs_get_FrameReference(RootSystem.IntPtr pNative);
public Windows.Kinect.ColorFrameReference FrameReference
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("ColorFrameArrivedEventArgs");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_ColorFrameArrivedEventArgs_get_FrameReference(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.ColorFrameReference>(objectPointer, n => new Windows.Kinect.ColorFrameReference(n));
}
}
private void __EventCleanup()
{
}
}
}
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.ColorFrameReference
//
public sealed partial class ColorFrameReference : Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal ColorFrameReference(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_ColorFrameReference_AddRefObject(ref _pNative);
}
~ColorFrameReference()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_ColorFrameReference_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_ColorFrameReference_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<ColorFrameReference>(_pNative);
Windows_Kinect_ColorFrameReference_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern long Windows_Kinect_ColorFrameReference_get_RelativeTime(RootSystem.IntPtr pNative);
public RootSystem.TimeSpan RelativeTime
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("ColorFrameReference");
}
return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_ColorFrameReference_get_RelativeTime(_pNative));
}
}
// Public Methods
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_ColorFrameReference_AcquireFrame(RootSystem.IntPtr pNative);
public Windows.Kinect.ColorFrame AcquireFrame()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("ColorFrameReference");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_ColorFrameReference_AcquireFrame(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.ColorFrame>(objectPointer, n => new Windows.Kinect.ColorFrame(n));
}
private void __EventCleanup()
{
}
}
}
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.ColorImageFormat
//
public enum ColorImageFormat : int
{
None =0,
Rgba =1,
Yuv =2,
Bgra =3,
Bayer =4,
Yuy2 =5,
}
}
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.ColorSpacePoint
//
[RootSystem.Runtime.InteropServices.StructLayout(RootSystem.Runtime.InteropServices.LayoutKind.Sequential)]
public struct ColorSpacePoint
{
public float X { get; set; }
public float Y { get; set; }
public override int GetHashCode()
{
return X.GetHashCode() ^ Y.GetHashCode();
}
public override bool Equals(object obj)
{
if (!(obj is ColorSpacePoint))
{
return false;
}
return this.Equals((ColorSpacePoint)obj);
}
public bool Equals(ColorSpacePoint obj)
{
return X.Equals(obj.X) && Y.Equals(obj.Y);
}
public static bool operator ==(ColorSpacePoint a, ColorSpacePoint b)
{
return a.Equals(b);
}
public static bool operator !=(ColorSpacePoint a, ColorSpacePoint b)
{
return !(a.Equals(b));
}
}
}
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.CoordinateMappingChangedEventArgs
//
public sealed partial class CoordinateMappingChangedEventArgs : RootSystem.EventArgs, Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal CoordinateMappingChangedEventArgs(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_CoordinateMappingChangedEventArgs_AddRefObject(ref _pNative);
}
~CoordinateMappingChangedEventArgs()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_CoordinateMappingChangedEventArgs_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_CoordinateMappingChangedEventArgs_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<CoordinateMappingChangedEventArgs>(_pNative);
Windows_Kinect_CoordinateMappingChangedEventArgs_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
private void __EventCleanup()
{
}
}
}
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.DepthFrame
//
public sealed partial class DepthFrame : RootSystem.IDisposable, Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal DepthFrame(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_DepthFrame_AddRefObject(ref _pNative);
}
~DepthFrame()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_DepthFrame_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_DepthFrame_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<DepthFrame>(_pNative);
if (disposing)
{
Windows_Kinect_DepthFrame_Dispose(_pNative);
}
Windows_Kinect_DepthFrame_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_DepthFrame_get_DepthFrameSource(RootSystem.IntPtr pNative);
public Windows.Kinect.DepthFrameSource DepthFrameSource
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("DepthFrame");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_DepthFrame_get_DepthFrameSource(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.DepthFrameSource>(objectPointer, n => new Windows.Kinect.DepthFrameSource(n));
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern ushort Windows_Kinect_DepthFrame_get_DepthMaxReliableDistance(RootSystem.IntPtr pNative);
public ushort DepthMaxReliableDistance
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("DepthFrame");
}
return Windows_Kinect_DepthFrame_get_DepthMaxReliableDistance(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern ushort Windows_Kinect_DepthFrame_get_DepthMinReliableDistance(RootSystem.IntPtr pNative);
public ushort DepthMinReliableDistance
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("DepthFrame");
}
return Windows_Kinect_DepthFrame_get_DepthMinReliableDistance(_pNative);
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_DepthFrame_get_FrameDescription(RootSystem.IntPtr pNative);
public Windows.Kinect.FrameDescription FrameDescription
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("DepthFrame");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_DepthFrame_get_FrameDescription(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.FrameDescription>(objectPointer, n => new Windows.Kinect.FrameDescription(n));
}
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern long Windows_Kinect_DepthFrame_get_RelativeTime(RootSystem.IntPtr pNative);
public RootSystem.TimeSpan RelativeTime
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("DepthFrame");
}
return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_DepthFrame_get_RelativeTime(_pNative));
}
}
// Public Methods
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_DepthFrame_CopyFrameDataToArray(RootSystem.IntPtr pNative, RootSystem.IntPtr frameData, int frameDataSize);
public void CopyFrameDataToArray(ushort[] frameData)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("DepthFrame");
}
var frameDataSmartGCHandle = new Helper.SmartGCHandle(RootSystem.Runtime.InteropServices.GCHandle.Alloc(frameData, RootSystem.Runtime.InteropServices.GCHandleType.Pinned));
var _frameData = frameDataSmartGCHandle.AddrOfPinnedObject();
Windows_Kinect_DepthFrame_CopyFrameDataToArray(_pNative, _frameData, frameData.Length);
Helper.ExceptionHelper.CheckLastError();
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_DepthFrame_Dispose(RootSystem.IntPtr pNative);
public void Dispose()
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
Dispose(true);
RootSystem.GC.SuppressFinalize(this);
}
private void __EventCleanup()
{
}
}
}
using RootSystem = System;
using System.Linq;
using System.Collections.Generic;
namespace Windows.Kinect
{
//
// Windows.Kinect.DepthFrameArrivedEventArgs
//
public sealed partial class DepthFrameArrivedEventArgs : RootSystem.EventArgs, Helper.INativeWrapper
{
internal RootSystem.IntPtr _pNative;
RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
// Constructors and Finalizers
internal DepthFrameArrivedEventArgs(RootSystem.IntPtr pNative)
{
_pNative = pNative;
Windows_Kinect_DepthFrameArrivedEventArgs_AddRefObject(ref _pNative);
}
~DepthFrameArrivedEventArgs()
{
Dispose(false);
}
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_DepthFrameArrivedEventArgs_ReleaseObject(ref RootSystem.IntPtr pNative);
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern void Windows_Kinect_DepthFrameArrivedEventArgs_AddRefObject(ref RootSystem.IntPtr pNative);
private void Dispose(bool disposing)
{
if (_pNative == RootSystem.IntPtr.Zero)
{
return;
}
__EventCleanup();
Helper.NativeObjectCache.RemoveObject<DepthFrameArrivedEventArgs>(_pNative);
Windows_Kinect_DepthFrameArrivedEventArgs_ReleaseObject(ref _pNative);
_pNative = RootSystem.IntPtr.Zero;
}
// Public Properties
[RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
private static extern RootSystem.IntPtr Windows_Kinect_DepthFrameArrivedEventArgs_get_FrameReference(RootSystem.IntPtr pNative);
public Windows.Kinect.DepthFrameReference FrameReference
{
get
{
if (_pNative == RootSystem.IntPtr.Zero)
{
throw new RootSystem.ObjectDisposedException("DepthFrameArrivedEventArgs");
}
RootSystem.IntPtr objectPointer = Windows_Kinect_DepthFrameArrivedEventArgs_get_FrameReference(_pNative);
Helper.ExceptionHelper.CheckLastError();
if (objectPointer == RootSystem.IntPtr.Zero)
{
return null;
}
return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.DepthFrameReference>(objectPointer, n => new Windows.Kinect.DepthFrameReference(n));
}
}
private void __EventCleanup()
{
}
}
}
This diff is collapsed. Click to expand it.
No preview for this file type
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.
No preview for this file type