add unit tests for kinect related classse

This commit is contained in:
Chikashi Miyama 2019-07-07 00:17:26 +02:00
parent 5524d6a817
commit 1b4866e74e
36 changed files with 1312 additions and 287 deletions

View file

@ -1,20 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ContentModelStore"> <component name="ContentModelStore">
<e p="C:\Users\chikashi\.Rider2018.2\system\extResources" t="IncludeRecursive" /> <e p="C:\Users\chikashi\.Rider2019.1\system\extResources" t="IncludeRecursive" />
<e p="C:\Users\chikashi\.Rider2018.2\system\resharper-host\local\Transient\ReSharperHost\v182\SolutionCaches\_UnityProject.1346624737.00" t="ExcludeRecursive" /> <e p="C:\Users\chikashi\.Rider2019.1\system\resharper-host\local\Transient\ReSharperHost\v191\SolutionCaches\_UnityProject.1346624737.00" t="ExcludeRecursive" />
<e p="C:\Users\chikashi\Development\Soundvision\UnityProject" t="IncludeRecursive"> <e p="C:\Users\chikashi\Development\Soundvision\UnityProject" t="IncludeRecursive">
<e p="Assembly-CSharp-Editor.csproj" t="IncludeRecursive" /> <e p="Assembly-CSharp-Editor.csproj" t="IncludeRecursive" />
<e p="Assembly-CSharp.csproj" t="IncludeRecursive" /> <e p="Assembly-CSharp.csproj" t="IncludeRecursive" />
<e p="Assets" t="Include"> <e p="Assets" t="Include">
<e p="Scripts" t="Include"> <e p="Scripts" t="Include">
<e p="PdConnection" t="Include"> <e p="PdConnection" t="Include">
<e p="PdBuffer.cs" t="Include" /> <e p="PdArray.cs" t="Include" />
<e p="PdBufferTest.cs" t="Include" />
</e> </e>
<e p="UnitTest" t="Include"> <e p="VideoInput" t="Include">
<e p="SimpleTest.cs" t="Include" /> <e p="ComponentFactory.cs" t="Include" />
<e p="UnitTest.asmdef" t="Include" /> <e p="Editor" t="Include">
<e p="UnitTest" t="Include">
<e p="ComponentFactoryTestCase.cs" t="Include" />
<e p="KinectSensorTestCase.cs" t="Include" />
</e>
</e>
<e p="InfraredCamera.cs" t="Include" />
<e p="KinectSensor.cs" t="Include" />
<e p="PointCloud.cs" t="Include" />
</e>
<e p="Visualizer" t="Include">
<e p="WaveformVisualizer.cs" t="Include" />
</e> </e>
</e> </e>
<e p="ThridParty" t="Include"> <e p="ThridParty" t="Include">
@ -130,13 +140,9 @@
</e> </e>
</e> </e>
</e> </e>
<e p="Library" t="ExcludeRecursive" />
<e p="obj" t="ExcludeRecursive" /> <e p="obj" t="ExcludeRecursive" />
<e p="packages" t="ExcludeRecursive" /> <e p="packages" t="ExcludeRecursive" />
<e p="Temp" t="ExcludeRecursive"> <e p="Temp\bin" t="ExcludeRecursive" />
<e p="bin" t="ExcludeRecursive" />
</e>
<e p="UnitTest.csproj" t="IncludeRecursive" />
<e p="UnityProject.sln" t="IncludeFlat" /> <e p="UnityProject.sln" t="IncludeFlat" />
</e> </e>
</component> </component>

View file

@ -2,7 +2,21 @@
<project version="4"> <project version="4">
<component name="ContentModelUserStore"> <component name="ContentModelUserStore">
<attachedFolders /> <attachedFolders />
<explicitIncludes /> <explicitIncludes>
<explicitExcludes /> <Path>Library/PackageCache/com.unity.ads@2.0.8</Path>
<Path>Library/PackageCache/com.unity.analytics@3.2.2</Path>
<Path>Library/PackageCache/com.unity.collab-proxy@1.2.15</Path>
<Path>Library/PackageCache/com.unity.package-manager-ui@2.0.7</Path>
<Path>Library/PackageCache/com.unity.purchasing@2.0.3</Path>
<Path>Library/PackageCache/com.unity.textmeshpro@1.4.1</Path>
<Path>Packages</Path>
<Path>ProjectSettings</Path>
</explicitIncludes>
<explicitExcludes>
<Path>.idea</Path>
<Path>Library</Path>
<Path>Temp</Path>
<Path>obj</Path>
</explicitExcludes>
</component> </component>
</project> </project>

File diff suppressed because it is too large Load diff

View file

@ -3,6 +3,9 @@
<PropertyGroup> <PropertyGroup>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<ProjectTypeGuids>{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<_TargetFrameworkDirectories>non_empty_path_generated_by_rider_editor_plugin</_TargetFrameworkDirectories>
<_FullFrameworkReferenceAssemblyPaths>non_empty_path_generated_by_rider_editor_plugin</_FullFrameworkReferenceAssemblyPaths>
<DisableHandlePackageFileConflicts>true</DisableHandlePackageFileConflicts>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -54,6 +57,8 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Assets\Scripts\VideoInput\Editor\UnitTest\ComponentFactoryTestCase.cs" />
<Compile Include="Assets\Scripts\VideoInput\Editor\UnitTest\KinectSensorTestCase.cs" />
<Compile Include="Assets\ThridParty\Editor\KinectCopyPluginDataHelper.cs" /> <Compile Include="Assets\ThridParty\Editor\KinectCopyPluginDataHelper.cs" />
<Reference Include="Unity.TextMeshPro.Editor"> <Reference Include="Unity.TextMeshPro.Editor">
<HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/ScriptAssemblies/Unity.TextMeshPro.Editor.dll</HintPath> <HintPath>C:/Users/chikashi/Development/Soundvision/UnityProject/Library/ScriptAssemblies/Unity.TextMeshPro.Editor.dll</HintPath>

View file

@ -3,6 +3,9 @@
<PropertyGroup> <PropertyGroup>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<ProjectTypeGuids>{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<_TargetFrameworkDirectories>non_empty_path_generated_by_rider_editor_plugin</_TargetFrameworkDirectories>
<_FullFrameworkReferenceAssemblyPaths>non_empty_path_generated_by_rider_editor_plugin</_FullFrameworkReferenceAssemblyPaths>
<DisableHandlePackageFileConflicts>true</DisableHandlePackageFileConflicts>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -54,8 +57,12 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Assets\Scripts\PdConnection\PdBuffer.cs" /> <Compile Include="Assets\Scripts\PdConnection\PdArray.cs" />
<Compile Include="Assets\Scripts\PdConnection\PdBufferTest.cs" /> <Compile Include="Assets\Scripts\VideoInput\ComponentFactory.cs" />
<Compile Include="Assets\Scripts\VideoInput\InfraredCamera.cs" />
<Compile Include="Assets\Scripts\VideoInput\KinectSensor.cs" />
<Compile Include="Assets\Scripts\VideoInput\PointCloud.cs" />
<Compile Include="Assets\Scripts\Visualizer\WaveformVisualizer.cs" />
<Compile Include="Assets\ThridParty\KinectScript\CameraIntrinsics.cs" /> <Compile Include="Assets\ThridParty\KinectScript\CameraIntrinsics.cs" />
<Compile Include="Assets\ThridParty\KinectScript\CollectionMap.cs" /> <Compile Include="Assets\ThridParty\KinectScript\CollectionMap.cs" />
<Compile Include="Assets\ThridParty\KinectScript\EventPump.cs" /> <Compile Include="Assets\ThridParty\KinectScript\EventPump.cs" />

View file

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: dd84b1e282004314588e2eaef1f6b744 guid: 9f16a4c44650ece4c8e87b08e3259733
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View file

@ -0,0 +1,84 @@
%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: WaveformColor
m_Shader: {fileID: 10755, 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:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _ColorMask: 15
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Stencil: 0
- _StencilComp: 8
- _StencilOp: 0
- _StencilReadMask: 255
- _StencilWriteMask: 255
- _UVSec: 0
- _UseUIAlphaClip: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c2b99e39490af5447b84f39e91ab012b
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -263,7 +263,7 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1880183155 --- !u!1 &1641055256
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
@ -271,50 +271,34 @@ GameObject:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 1880183159} - component: {fileID: 1641055258}
- component: {fileID: 1880183158} - component: {fileID: 1641055257}
- component: {fileID: 1880183157} - component: {fileID: 1641055259}
- component: {fileID: 1880183156}
- component: {fileID: 1880183160}
m_Layer: 0 m_Layer: 0
m_Name: Plane m_Name: Waveform
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 1
--- !u!64 &1880183156 --- !u!120 &1641055257
MeshCollider: LineRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1880183155} m_GameObject: {fileID: 1641055256}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1 m_Enabled: 1
serializedVersion: 3 m_CastShadows: 0
m_Convex: 0 m_ReceiveShadows: 0
m_CookingOptions: 14
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &1880183157
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1880183155}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1 m_DynamicOccludee: 1
m_MotionVectors: 1 m_MotionVectors: 0
m_LightProbeUsage: 1 m_LightProbeUsage: 0
m_ReflectionProbeUsage: 1 m_ReflectionProbeUsage: 0
m_RenderingLayerMask: 1 m_RenderingLayerMask: 1
m_RendererPriority: 0 m_RendererPriority: 0
m_Materials: m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 2100000, guid: c2b99e39490af5447b84f39e91ab012b, type: 2}
m_StaticBatchInfo: m_StaticBatchInfo:
firstSubMesh: 0 firstSubMesh: 0
subMeshCount: 0 subMeshCount: 0
@ -334,37 +318,189 @@ MeshRenderer:
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 0
--- !u!33 &1880183158 m_Positions:
MeshFilter: - {x: 0, y: 0, z: 0}
m_ObjectHideFlags: 0 - {x: 0, y: 0, z: 1}
m_CorrespondingSourceObject: {fileID: 0} - {x: 0, y: 0, z: 1}
m_PrefabInstance: {fileID: 0} - {x: 0, y: 0, z: 1}
m_PrefabAsset: {fileID: 0} - {x: 0, y: 0, z: 1}
m_GameObject: {fileID: 1880183155} - {x: 0, y: 0, z: 1}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} - {x: 0, y: 0, z: 1}
--- !u!4 &1880183159 - {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
- {x: 0, y: 0, z: 1}
m_Parameters:
serializedVersion: 3
widthMultiplier: 1
widthCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0.13559723
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
colorGradient:
serializedVersion: 2
key0: {r: 1, g: 1, b: 1, a: 1}
key1: {r: 1, g: 1, b: 1, a: 1}
key2: {r: 0, g: 0, b: 0, a: 0}
key3: {r: 0, g: 0, b: 0, a: 0}
key4: {r: 0, g: 0, b: 0, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 65535
ctime2: 0
ctime3: 0
ctime4: 0
ctime5: 0
ctime6: 0
ctime7: 0
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_NumColorKeys: 2
m_NumAlphaKeys: 2
numCornerVertices: 0
numCapVertices: 0
alignment: 0
textureMode: 0
shadowBias: 0.5
generateLightingData: 0
m_UseWorldSpace: 1
m_Loop: 0
--- !u!4 &1641055258
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1880183155} m_GameObject: {fileID: 1641055256}
m_LocalRotation: {x: -0.7071068, y: 0, z: 0, w: 0.7071068} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 0.2} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 2 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1880183160 --- !u!114 &1641055259
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1880183155} m_GameObject: {fileID: 1641055256}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 686884c543f60d8478b36eecc0532d11, type: 3} m_Script: {fileID: 11500000, guid: 686884c543f60d8478b36eecc0532d11, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
pdArrayName: testarray
pdArraySize: 100
lineRenderer: {fileID: 1641055257}
scale: 1

View file

@ -3,14 +3,14 @@ using System.IO.MemoryMappedFiles;
namespace PdConnection namespace PdConnection
{ {
public class PdBuffer : IDisposable public class PdArray : IDisposable
{ {
public float[] Data { get; } public float[] Data { get; }
private readonly MemoryMappedFile memoryMappedFile_; private readonly MemoryMappedFile memoryMappedFile_;
private readonly MemoryMappedViewAccessor viewAccessor_; private readonly MemoryMappedViewAccessor viewAccessor_;
public PdBuffer(string name, int size) public PdArray(string name, int size)
{ {
memoryMappedFile_ = MemoryMappedFile.OpenExisting(name); memoryMappedFile_ = MemoryMappedFile.OpenExisting(name);
if (memoryMappedFile_ == null) if (memoryMappedFile_ == null)
@ -27,9 +27,8 @@ namespace PdConnection
public void Dispose() public void Dispose()
{ {
viewAccessor_?.Dispose(); memoryMappedFile_.Dispose();
memoryMappedFile_?.Dispose(); viewAccessor_.Dispose();
} }
} }
} }

View file

@ -1,22 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace PdConnection
{
public class PdBufferTest : MonoBehaviour
{
void Start()
{
var pdBuf = new PdBuffer("testarray", 100);
pdBuf.Update();
foreach(var val in pdBuf.Data)
Debug.Log(val);
}
}
}

View file

@ -1,32 +0,0 @@
using NUnit.Framework;
using NSubstitute;
namespace UnitTests
{
public class SimpleTest
{
[Test]
public void FirstTest()
{
Assert.AreEqual(10, 10);
}
public interface ISomeInterface
{
void doSomething();
}
[Test]
public void FirstMock()
{
var mock = Substitute.For<ISomeInterface>();
mock.doSomething();
mock.Received(1).doSomething();
}
}
}

View file

@ -1,9 +0,0 @@
{
"name": "UnitTest",
"optionalUnityReferences": [
"TestAssemblies"
],
"includePlatforms": [
"Editor"
]
}

View file

@ -1,6 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: d3e3873ca3daaac4f91b7c99dad940c3 guid: e5397a5080f023b4f818cebbacf0d438
AssemblyDefinitionImporter: folderAsset: yes
DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:

View file

@ -0,0 +1,21 @@
namespace VideoInput
{
public interface IComponentFactory
{
IKinectSensor CreateKinectSensor();
IInfraredCamera CreateInfraredCamera();
}
public class ComponentFactory : IComponentFactory
{
public IKinectSensor CreateKinectSensor()
{
return new KinectSensor(CreateInfraredCamera());
}
public IInfraredCamera CreateInfraredCamera()
{
return new InfraredCamera();
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b3510aec53634387bd87c7ebae1d41ae
timeCreated: 1562447022

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 58dd24ba5af4c404589f501152a5f774
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: fc8188340da14e1ab2aca454bb779e56
timeCreated: 1562450252

View file

@ -0,0 +1,24 @@
using NUnit.Framework;
namespace VideoInput.Editor.UnitTest
{
public class UnitTest_ComponentFactory
{
[Test]
public void CreateKinectSensor()
{
var componentFactory = new ComponentFactory();
var kinectSensor = componentFactory.CreateKinectSensor();
Assert.NotNull(kinectSensor);
}
[Test]
public void CreateInfraredCamera()
{
var componentFactory = new ComponentFactory();
var infraredCamera = componentFactory.CreateInfraredCamera();
Assert.NotNull(infraredCamera);
}
}
}

View file

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: cdafcc2692d5b5242b4a0a503324c76e guid: 7e1eccfbf87e70645afd4bef217cc3d0
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2

View file

@ -0,0 +1,24 @@
using NUnit.Framework;
using NSubstitute;
namespace VideoInput.Editor.UnitTest
{
[TestFixture]
public class UnitTest_KinectSensor
{
private IInfraredCamera infraredCameraMock_;
[SetUp]
public void SetUp()
{
infraredCameraMock_ = Substitute.For<IInfraredCamera>();
}
[Test]
public void InfraredCamera()
{
var kinectSensor = new KinectSensor(infraredCameraMock_);
Assert.AreSame(infraredCameraMock_, kinectSensor.InfraredCamera);
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 898dc2d4dc394ea6b80a1cc09d63121c
timeCreated: 1562450837

View file

@ -0,0 +1,68 @@
using System.IO;
using UnityEngine;
using Windows.Kinect;
namespace VideoInput
{
public interface IInfraredCamera
{
Texture2D Data { get; }
}
public class InfraredCamera : IInfraredCamera
{
public Texture2D Data { get; }
private Windows.Kinect.KinectSensor sensor_;
private readonly InfraredFrameReader reader_;
private readonly ushort[] irData_;
private readonly byte[] rawData_;
public InfraredCamera()
{
sensor_ = Windows.Kinect.KinectSensor.GetDefault();
if (sensor_ == null)
{
throw new IOException("cannot find Kinect Sensor ");
}
reader_ = sensor_.InfraredFrameSource.OpenReader();
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);
if (!sensor_.IsOpen)
sensor_.Open();
}
void Update()
{
if (reader_ == null)
throw new IOException("Kinect reader not opened");
var frame = reader_.AcquireLatestFrame();
if (frame == null)
return;
frame.CopyFrameDataToArray(irData_);
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();
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9189f3eb01f76664d9f7c970bbd36e02
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,18 @@
namespace VideoInput
{
public interface IKinectSensor
{
IInfraredCamera InfraredCamera { get; }
}
public class KinectSensor : IKinectSensor
{
public IInfraredCamera InfraredCamera { get; }
public KinectSensor(IInfraredCamera infraredCamera)
{
InfraredCamera = infraredCamera;
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 752e0ad44789447883d4db6794deceb9
timeCreated: 1562446718

View file

@ -0,0 +1,7 @@
namespace VideoInput
{
public class PointCloud
{
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: c0603bf64edb4c8885cefbc40ee206fe
timeCreated: 1562443930

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c80df00cf750cd74d9579afbf5edd3ee
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,31 @@
using UnityEngine;
namespace Visualizer
{
public class WaveformVisualizer : MonoBehaviour
{
#pragma warning disable 649
[SerializeField] private string pdArrayName;
[SerializeField] private int pdArraySize;
[SerializeField] private LineRenderer lineRenderer;
[SerializeField, Range(0f, 10f)] private float scale = 1f;
#pragma warning restore 649
private PdConnection.PdArray pdArray_;
void Start()
{
pdArray_ = new PdConnection.PdArray(pdArrayName, pdArraySize);
}
void Update()
{
pdArray_.Update();
for(var i = 0; i < pdArray_.Data.Length; i++)
{
var posX = (i / 20f) - 0.5f;
lineRenderer.SetPosition(i, new Vector3(posX, pdArray_.Data[i] * scale, 0));
}
}
}
}

View file

@ -4,5 +4,8 @@
EditorBuildSettings: EditorBuildSettings:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
serializedVersion: 2 serializedVersion: 2
m_Scenes: [] m_Scenes:
- enabled: 1
path: Assets/Scenes/MainScene.unity
guid: 7691648eefda79e409f424b413457f14
m_configObjects: {} m_configObjects: {}

View file

@ -3,6 +3,9 @@
<PropertyGroup> <PropertyGroup>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<ProjectTypeGuids>{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<_TargetFrameworkDirectories>non_empty_path_generated_by_rider_editor_plugin</_TargetFrameworkDirectories>
<_FullFrameworkReferenceAssemblyPaths>non_empty_path_generated_by_rider_editor_plugin</_FullFrameworkReferenceAssemblyPaths>
<DisableHandlePackageFileConflicts>true</DisableHandlePackageFileConflicts>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -54,7 +57,7 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Assets\Scripts\UnitTest\SimpleTest.cs" /> <Compile Include="Assets\Scripts\UnitTest\ComponentFactoryTestCase.cs" />
<None Include="Assets\Scripts\UnitTest\UnitTest.asmdef" /> <None Include="Assets\Scripts\UnitTest\UnitTest.asmdef" />
<Reference Include="UnityEngine.AIModule"> <Reference Include="UnityEngine.AIModule">
<HintPath>C:/Program Files/UnityLTS/Editor/Data/Managed/UnityEngine/UnityEngine.AIModule.dll</HintPath> <HintPath>C:/Program Files/UnityLTS/Editor/Data/Managed/UnityEngine/UnityEngine.AIModule.dll</HintPath>

View file

@ -4,8 +4,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp-Editor", "Assembly-CSharp-Editor.csproj", "{3CC9D2C0-C461-07D9-EDF3-4FFB4DE5C299}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp-Editor", "Assembly-CSharp-Editor.csproj", "{3CC9D2C0-C461-07D9-EDF3-4FFB4DE5C299}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTest", "UnitTest.csproj", "{7449DEC9-8E4D-BE43-C884-91467088ABED}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -20,10 +18,6 @@ Global
{3CC9D2C0-C461-07D9-EDF3-4FFB4DE5C299}.Debug|Any CPU.Build.0 = Debug|Any CPU {3CC9D2C0-C461-07D9-EDF3-4FFB4DE5C299}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3CC9D2C0-C461-07D9-EDF3-4FFB4DE5C299}.Release|Any CPU.ActiveCfg = Release|Any CPU {3CC9D2C0-C461-07D9-EDF3-4FFB4DE5C299}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3CC9D2C0-C461-07D9-EDF3-4FFB4DE5C299}.Release|Any CPU.Build.0 = Release|Any CPU {3CC9D2C0-C461-07D9-EDF3-4FFB4DE5C299}.Release|Any CPU.Build.0 = Release|Any CPU
{7449DEC9-8E4D-BE43-C884-91467088ABED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7449DEC9-8E4D-BE43-C884-91467088ABED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7449DEC9-8E4D-BE43-C884-91467088ABED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7449DEC9-8E4D-BE43-C884-91467088ABED}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE