diff --git a/UnityProject/.idea/.idea.UnityProject/.idea/contentModel.xml b/UnityProject/.idea/.idea.UnityProject/.idea/contentModel.xml
index 6e32ea3..dbe187f 100644
--- a/UnityProject/.idea/.idea.UnityProject/.idea/contentModel.xml
+++ b/UnityProject/.idea/.idea.UnityProject/.idea/contentModel.xml
@@ -20,10 +20,11 @@
+
-
+
diff --git a/UnityProject/.idea/.idea.UnityProject/.idea/workspace.xml b/UnityProject/.idea/.idea.UnityProject/.idea/workspace.xml
index 4106a1d..20328df 100644
--- a/UnityProject/.idea/.idea.UnityProject/.idea/workspace.xml
+++ b/UnityProject/.idea/.idea.UnityProject/.idea/workspace.xml
@@ -2,34 +2,17 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
@@ -39,44 +22,11 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -111,33 +61,35 @@
-
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -145,35 +97,35 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -182,13 +134,14 @@
-
-
+
+
-
-
-
-
+
+
+
+
+
@@ -197,21 +150,37 @@
-
-
+
+
-
-
-
-
-
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -226,14 +195,13 @@
-
-
+
+
-
-
-
-
-
+
+
+
+
@@ -246,21 +214,24 @@
+
+
+
-
+
@@ -281,21 +252,24 @@
-
+
+
+
-
+
+
-
+
@@ -311,6 +285,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -343,6 +327,12 @@
+
+
+
+
+
+
@@ -353,11 +343,11 @@
-
-
+
+
@@ -411,11 +401,12 @@
1562417892841
+
-
+
@@ -427,12 +418,13 @@
-
+
+
-
-
+
+
-
+
@@ -445,21 +437,32 @@
-
+
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
@@ -482,20 +485,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -671,10 +662,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -724,10 +761,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
@@ -758,7 +809,42 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -769,161 +855,80 @@
-
+
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
+
+
-
-
-
-
-
+
+
+
+
+
+
diff --git a/UnityProject/Assembly-CSharp-Editor.csproj b/UnityProject/Assembly-CSharp-Editor.csproj
index efe33ef..26fb39b 100644
--- a/UnityProject/Assembly-CSharp-Editor.csproj
+++ b/UnityProject/Assembly-CSharp-Editor.csproj
@@ -321,6 +321,9 @@
C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/Plugins/System.Threading.Tasks.Extensions.dll
+
+ C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/Plugins/Editor/JetBrains/JetBrains.Rider.Unity.Editor.Plugin.Repacked.dll
+
C:/Users/chikashi/Development/Soundvision/UnityProject/Library/PackageCache/com.unity.ads@2.0.8/Editor/UnityEditor.Advertisements.dll
@@ -336,9 +339,6 @@
C:/Users/chikashi/Development/Soundvision/UnityProject/Library/PackageCache/com.unity.purchasing@2.0.3/Editor/UnityEditor.Purchasing.dll
-
- C:/Users/chikashi/Development/Soundvision/UnityProject/Assets/Plugins/Editor/JetBrains/JetBrains.Rider.Unity.Editor.Plugin.Repacked.dll
-
C:/Program Files/UnityLTS/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/mscorlib.dll
diff --git a/UnityProject/Assembly-CSharp.csproj b/UnityProject/Assembly-CSharp.csproj
index 3943c50..5ca29b7 100644
--- a/UnityProject/Assembly-CSharp.csproj
+++ b/UnityProject/Assembly-CSharp.csproj
@@ -60,8 +60,9 @@
+
-
+
diff --git a/UnityProject/Assets/Scenes/MainScene.unity b/UnityProject/Assets/Scenes/MainScene.unity
index ece5f8f..0c0fe55 100644
--- a/UnityProject/Assets/Scenes/MainScene.unity
+++ b/UnityProject/Assets/Scenes/MainScene.unity
@@ -181,6 +181,49 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
+--- !u!1 &437875427
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 437875429}
+ - component: {fileID: 437875428}
+ m_Layer: 0
+ m_Name: Main
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!114 &437875428
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 437875427}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 5b54a31bc1a14c1abb51fe86c56c6227, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+--- !u!4 &437875429
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 437875427}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 3
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &534669902
GameObject:
m_ObjectHideFlags: 0
diff --git a/UnityProject/Assets/Scripts/VideoInput/ComponentFactory.cs b/UnityProject/Assets/Scripts/VideoInput/ComponentFactory.cs
index f85c9ec..c3d26d3 100644
--- a/UnityProject/Assets/Scripts/VideoInput/ComponentFactory.cs
+++ b/UnityProject/Assets/Scripts/VideoInput/ComponentFactory.cs
@@ -1,12 +1,6 @@
namespace VideoInput
{
- public interface IComponentFactory
- {
- IKinectSensor CreateKinectSensor();
- IInfraredCamera CreateInfraredCamera();
- }
-
- public class ComponentFactory : IComponentFactory
+ public class ComponentFactory
{
public IKinectSensor CreateKinectSensor()
{
diff --git a/UnityProject/Assets/Scripts/VideoInput/Editor/UnitTest/ComponentFactoryTestCase.cs b/UnityProject/Assets/Scripts/VideoInput/Editor/UnitTest/ComponentFactoryTestCase.cs
index e382976..6804c49 100644
--- a/UnityProject/Assets/Scripts/VideoInput/Editor/UnitTest/ComponentFactoryTestCase.cs
+++ b/UnityProject/Assets/Scripts/VideoInput/Editor/UnitTest/ComponentFactoryTestCase.cs
@@ -2,7 +2,7 @@
namespace VideoInput.Editor.UnitTest
{
- public class UnitTest_ComponentFactory
+ public class UnitTestComponentFactory
{
[Test]
public void CreateKinectSensor()
diff --git a/UnityProject/Assets/Scripts/VideoInput/Editor/UnitTest/KinectSensorTestCase.cs b/UnityProject/Assets/Scripts/VideoInput/Editor/UnitTest/KinectSensorTestCase.cs
index a88750a..0bf11be 100644
--- a/UnityProject/Assets/Scripts/VideoInput/Editor/UnitTest/KinectSensorTestCase.cs
+++ b/UnityProject/Assets/Scripts/VideoInput/Editor/UnitTest/KinectSensorTestCase.cs
@@ -4,7 +4,7 @@ using NSubstitute;
namespace VideoInput.Editor.UnitTest
{
[TestFixture]
- public class UnitTest_KinectSensor
+ public class UnitTestKinectSensor
{
private IInfraredCamera infraredCameraMock_;
@@ -20,5 +20,14 @@ namespace VideoInput.Editor.UnitTest
var kinectSensor = new KinectSensor(infraredCameraMock_);
Assert.AreSame(infraredCameraMock_, kinectSensor.InfraredCamera);
}
+
+ [Test]
+ public void Update()
+ {
+ var kinectSensor = new KinectSensor(infraredCameraMock_);
+ kinectSensor.Update();
+
+ infraredCameraMock_.Received(1).Update();
+ }
}
}
\ No newline at end of file
diff --git a/UnityProject/Assets/Scripts/VideoInput/InfraredCamera.cs b/UnityProject/Assets/Scripts/VideoInput/InfraredCamera.cs
index 1f94b46..9566907 100644
--- a/UnityProject/Assets/Scripts/VideoInput/InfraredCamera.cs
+++ b/UnityProject/Assets/Scripts/VideoInput/InfraredCamera.cs
@@ -7,6 +7,8 @@ namespace VideoInput
public interface IInfraredCamera
{
Texture2D Data { get; }
+
+ void Update();
}
public class InfraredCamera : IInfraredCamera
@@ -15,8 +17,7 @@ namespace VideoInput
private Windows.Kinect.KinectSensor sensor_;
private readonly InfraredFrameReader reader_;
- private readonly ushort[] irData_;
- private readonly byte[] rawData_;
+ private readonly ushort [] irData_;
public InfraredCamera()
{
@@ -30,37 +31,27 @@ namespace VideoInput
var frameDesc = sensor_.InfraredFrameSource.FrameDescription;
irData_ = new ushort[frameDesc.LengthInPixels];
- rawData_ = new byte[frameDesc.LengthInPixels * 4];
- Data = new Texture2D(frameDesc.Width, frameDesc.Height, TextureFormat.BGRA32, false);
+
+ Data = new Texture2D(frameDesc.Width, frameDesc.Height, TextureFormat.R8, false);
if (!sensor_.IsOpen)
sensor_.Open();
}
- void Update()
+ public void Update()
{
if (reader_ == null)
throw new IOException("Kinect reader not opened");
var frame = reader_.AcquireLatestFrame();
- if (frame == null)
- return;
+ if (frame == null) return;
frame.CopyFrameDataToArray(irData_);
+ var rawTextureData = Data.GetRawTextureData();
+ for (var i = 0; i < irData_.Length; i++)
+ rawTextureData[i] = (byte)(irData_[i] >> 8);
- var index = 0;
- foreach(var ir in irData_)
- {
- var intensity = (byte)(ir >> 8);
- rawData_[index++] = intensity;
- rawData_[index++] = intensity;
- rawData_[index++] = intensity;
- rawData_[index++] = 255; // Alpha
- }
-
- Data.LoadRawTextureData(rawData_);
Data.Apply();
-
frame.Dispose();
}
}
diff --git a/UnityProject/Assets/Scripts/VideoInput/KinectManager.cs b/UnityProject/Assets/Scripts/VideoInput/KinectManager.cs
new file mode 100644
index 0000000..5b4a35e
--- /dev/null
+++ b/UnityProject/Assets/Scripts/VideoInput/KinectManager.cs
@@ -0,0 +1,22 @@
+using UnityEngine;
+
+namespace VideoInput
+{
+ public class KinectManager : MonoBehaviour
+ {
+ public IKinectSensor KinectSensor { get; private set; }
+
+ private void Start()
+ {
+ var componentFactory = new ComponentFactory();
+ KinectSensor = componentFactory.CreateKinectSensor();
+ }
+
+ private void Update()
+ {
+ KinectSensor.Update();
+ }
+ }
+}
+
+
diff --git a/UnityProject/Assets/Scripts/VideoInput/KinectSensor.cs b/UnityProject/Assets/Scripts/VideoInput/KinectSensor.cs
index 5b4ec04..6348b6d 100644
--- a/UnityProject/Assets/Scripts/VideoInput/KinectSensor.cs
+++ b/UnityProject/Assets/Scripts/VideoInput/KinectSensor.cs
@@ -3,6 +3,7 @@ namespace VideoInput
public interface IKinectSensor
{
IInfraredCamera InfraredCamera { get; }
+ void Update();
}
public class KinectSensor : IKinectSensor
@@ -14,5 +15,9 @@ namespace VideoInput
InfraredCamera = infraredCamera;
}
+ public void Update()
+ {
+ InfraredCamera.Update();
+ }
}
}
\ No newline at end of file
diff --git a/UnityProject/Assets/Scripts/VideoInput/PointCloud.cs b/UnityProject/Assets/Scripts/Visualizer/PointCloud.cs
similarity index 100%
rename from UnityProject/Assets/Scripts/VideoInput/PointCloud.cs
rename to UnityProject/Assets/Scripts/Visualizer/PointCloud.cs
diff --git a/UnityProject/Assets/Scripts/VideoInput/PointCloud.cs.meta b/UnityProject/Assets/Scripts/Visualizer/PointCloud.cs.meta
similarity index 100%
rename from UnityProject/Assets/Scripts/VideoInput/PointCloud.cs.meta
rename to UnityProject/Assets/Scripts/Visualizer/PointCloud.cs.meta
diff --git a/UnityProject/Assets/ThridParty/KinectView/Scripts/BodySourceView.cs b/UnityProject/Assets/ThridParty/KinectView/Scripts/BodySourceView.cs
index 71eac3d..16ed241 100644
--- a/UnityProject/Assets/ThridParty/KinectView/Scripts/BodySourceView.cs
+++ b/UnityProject/Assets/ThridParty/KinectView/Scripts/BodySourceView.cs
@@ -3,6 +3,9 @@ using System.Collections;
using System.Collections.Generic;
using Kinect = Windows.Kinect;
+#pragma warning disable 618
+
+
public class BodySourceView : MonoBehaviour
{
public Material BoneMaterial;
@@ -177,3 +180,5 @@ public class BodySourceView : MonoBehaviour
return new Vector3(joint.Position.X * 10, joint.Position.Y * 10, joint.Position.Z * 10);
}
}
+
+#pragma warning restore 618