Commit 540ef035 authored by 16이상민's avatar 16이상민

Refactoring class 'TrackInfo'

parent 8d2a3d7c
This diff is collapsed.
fileFormatVersion: 2
guid: 927664c416bad5248b093f481aeb9dcf
timeCreated: 1515565475
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: a83a7fa7a4f7f6b4382c0b23b43fe313
timeCreated: 1515566013
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
using Windows.Kinect; using Windows.Kinect;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System; using System;
using System.Collections;
using System.Linq; using System.Linq;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -20,6 +19,13 @@ public class CoordinateMapperManager : MonoBehaviour ...@@ -20,6 +19,13 @@ public class CoordinateMapperManager : MonoBehaviour
Texture2D _ColorRGBX; Texture2D _ColorRGBX;
// In play mode, GUI for Null frame should show when Kinect cannot access.
// In play mode, GUI for FPS always show.
// In play mode, ColorTexture should not be null value.
// In play mode, BodyIndexBuffer should not be null value.
// In play mode, DepthCoordinates should not be null value.
// In play mode, BodyBuffer should not be null value.
public Texture2D ColorTexture public Texture2D ColorTexture
{ get { return _ColorRGBX; } } { get { return _ColorRGBX; } }
public byte[] BodyIndexBuffer public byte[] BodyIndexBuffer
......
...@@ -9,8 +9,10 @@ public class CoordinateMapperView : MonoBehaviour ...@@ -9,8 +9,10 @@ public class CoordinateMapperView : MonoBehaviour
private DepthSpacePoint[] DepthPoints; private DepthSpacePoint[] DepthPoints;
private byte[] BodyIndexPoints; private byte[] BodyIndexPoints;
void Start () // In play mode, texture of gameobject should be same as texture which made by shader when after update.
void Start ()
{ {
CoordinateMapperManager CoordinateMapperManager = GameObject.Find("Managers").GetComponent<CoordinateMapperManager>(); CoordinateMapperManager CoordinateMapperManager = GameObject.Find("Managers").GetComponent<CoordinateMapperManager>();
......
...@@ -6,42 +6,44 @@ using Windows.Kinect; ...@@ -6,42 +6,44 @@ using Windows.Kinect;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System; using System;
namespace Assets.Script.Tests class CoordinateMapperViewTests
{ {
class CoordinateMapperViewTests // A UnityTest behaves like a coroutine in PlayMode
// and allows you to yield null to skip a frame in EditMode
[UnityTest]
public IEnumerator MainTexture_Equal_Texture_Generate_By_Shader_When_After_Update()
{ {
[Test] yield return null;
public void CoordinateMapperViewTestsSimplePasses()
{ GameManager.Instance.SceneTransition("InGame");
// Use the Assert class to test conditions.
} yield return null;
// A UnityTest behaves like a coroutine in PlayMode var Managers = GameObject.Find("Managers");
// and allows you to yield null to skip a frame in EditMode
[UnityTest] var CoordinateMapperManager = Managers.GetComponent<CoordinateMapperManager>();
public IEnumerator CoordinateMapperViewTestsWithEnumeratorPasses()
{ var tmpObj = GameObject.CreatePrimitive(PrimitiveType.Plane);
var CoordinateMapperManager = GameObject.Find("Managers").GetComponent<CoordinateMapperManager>(); tmpObj.GetComponent<Renderer>().material = Resources.Load("GreenScreen/GreenScreen.mat", typeof(Material)) as Material;
var tmpObj = GameObject.CreatePrimitive(PrimitiveType.Plane); tmpObj.GetComponent<Renderer>().material.SetTexture("_MainTex", CoordinateMapperManager.ColorTexture);
tmpObj.GetComponent<Renderer>().material = Resources.Load("GreenScreen/GreenScreen.mat", typeof(Material)) as Material;
var DepthPoints = CoordinateMapperManager.DepthCoordinates;
tmpObj.GetComponent<Renderer>().material.SetTexture("_MainTex", CoordinateMapperManager.ColorTexture); var DepthBuffer = new ComputeBuffer(DepthPoints.Length, sizeof(float) * 2);
tmpObj.GetComponent<Renderer>().material.SetBuffer("depthCoordinates", DepthBuffer);
var DepthPoints = CoordinateMapperManager.DepthCoordinates;
var DepthBuffer = new ComputeBuffer(DepthPoints.Length, sizeof(float) * 2); var BodyIndexPoints = CoordinateMapperManager.BodyIndexBuffer;
tmpObj.GetComponent<Renderer>().material.SetBuffer("depthCoordinates", DepthBuffer); var BodyIndexBuffer = new ComputeBuffer(BodyIndexPoints.Length, sizeof(float));
tmpObj.GetComponent<Renderer>().material.SetBuffer("bodyIndexBuffer", BodyIndexBuffer);
var BodyIndexPoints = CoordinateMapperManager.BodyIndexBuffer;
var BodyIndexBuffer = new ComputeBuffer(BodyIndexPoints.Length, sizeof(float)); var CoordinateMapperView = GameObject.Find("CoordinateMapView");
tmpObj.GetComponent<Renderer>().material.SetBuffer("bodyIndexBuffer", BodyIndexBuffer); // Use the Assert class to test conditions.
// yield to skip a frame
var CoordinateMapperView = GameObject.Find("CoordinateMapView"); yield return null;
// Use the Assert class to test conditions.
// yield to skip a frame var expected = tmpObj.GetComponent<Renderer>().material.mainTexture;
yield return null; var actual = CoordinateMapperView.GetComponent<Renderer>().material.mainTexture;
Assert.AreEqual(tmpObj.GetComponent<Renderer>().material.mainTexture, CoordinateMapperView.GetComponent<Renderer>().material.mainTexture, "CoordinateMapperViewTest Failed."); Assert.AreEqual(expected, actual, "texture of gameobject should be same as texture which made by shader.");
}
} }
} }
This diff is collapsed.
...@@ -81,13 +81,7 @@ public class TrackManager : MonoBehaviour { ...@@ -81,13 +81,7 @@ public class TrackManager : MonoBehaviour {
void LoadTracks() void LoadTracks()
{ {
var files = new DirectoryInfo("Assets/Tracks").GetFiles("*.bpe", SearchOption.AllDirectories); foreach (TrackInfo track in LoadTrackInfos())
List<TrackInfo> tracks = files.Select(s => new TrackInfo(s)).ToList();
while (tracks.Count() < 5)
tracks.AddRange(tracks);
foreach (TrackInfo track in tracks)
{ {
var trackItem = Instantiate(trackItemPrefab, trackList.transform); var trackItem = Instantiate(trackItemPrefab, trackList.transform);
...@@ -95,6 +89,17 @@ public class TrackManager : MonoBehaviour { ...@@ -95,6 +89,17 @@ public class TrackManager : MonoBehaviour {
} }
} }
List<TrackInfo> LoadTrackInfos()
{
var files = new DirectoryInfo("Assets/Tracks").GetFiles("*.bpe", SearchOption.AllDirectories);
var tracks = files.Select(s => new TrackInfo(s)).ToList();
while (tracks.Count() < 5)
tracks.AddRange(tracks);
return tracks;
}
public void StartTrack() public void StartTrack()
{ {
// TODO: disable start button if nothing selected // TODO: disable start button if nothing selected
......
...@@ -67,7 +67,7 @@ PlayerSettings: ...@@ -67,7 +67,7 @@ PlayerSettings:
defaultIsFullScreen: 1 defaultIsFullScreen: 1
defaultIsNativeResolution: 1 defaultIsNativeResolution: 1
macRetinaSupport: 1 macRetinaSupport: 1
runInBackground: 0 runInBackground: 1
captureSingleScreen: 0 captureSingleScreen: 0
muteOtherAudioSources: 0 muteOtherAudioSources: 0
Prepare IOS For Recording: 0 Prepare IOS For Recording: 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment