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 @@
using Windows.Kinect;
using System.Runtime.InteropServices;
using System;
using System.Collections;
using System.Linq;
using System.Collections.Generic;
......@@ -20,6 +19,13 @@ public class CoordinateMapperManager : MonoBehaviour
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
{ get { return _ColorRGBX; } }
public byte[] BodyIndexBuffer
......
......@@ -9,8 +9,10 @@ public class CoordinateMapperView : MonoBehaviour
private DepthSpacePoint[] DepthPoints;
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>();
......
......@@ -6,42 +6,44 @@ using Windows.Kinect;
using System.Runtime.InteropServices;
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]
public void CoordinateMapperViewTestsSimplePasses()
{
// Use the Assert class to test conditions.
}
// A UnityTest behaves like a coroutine in PlayMode
// and allows you to yield null to skip a frame in EditMode
[UnityTest]
public IEnumerator CoordinateMapperViewTestsWithEnumeratorPasses()
{
var CoordinateMapperManager = GameObject.Find("Managers").GetComponent<CoordinateMapperManager>();
var tmpObj = GameObject.CreatePrimitive(PrimitiveType.Plane);
tmpObj.GetComponent<Renderer>().material = Resources.Load("GreenScreen/GreenScreen.mat", typeof(Material)) as Material;
tmpObj.GetComponent<Renderer>().material.SetTexture("_MainTex", CoordinateMapperManager.ColorTexture);
var DepthPoints = CoordinateMapperManager.DepthCoordinates;
var DepthBuffer = new ComputeBuffer(DepthPoints.Length, sizeof(float) * 2);
tmpObj.GetComponent<Renderer>().material.SetBuffer("depthCoordinates", DepthBuffer);
var BodyIndexPoints = CoordinateMapperManager.BodyIndexBuffer;
var BodyIndexBuffer = new ComputeBuffer(BodyIndexPoints.Length, sizeof(float));
tmpObj.GetComponent<Renderer>().material.SetBuffer("bodyIndexBuffer", BodyIndexBuffer);
var CoordinateMapperView = GameObject.Find("CoordinateMapView");
// Use the Assert class to test conditions.
// yield to skip a frame
yield return null;
Assert.AreEqual(tmpObj.GetComponent<Renderer>().material.mainTexture, CoordinateMapperView.GetComponent<Renderer>().material.mainTexture, "CoordinateMapperViewTest Failed.");
}
yield return null;
GameManager.Instance.SceneTransition("InGame");
yield return null;
var Managers = GameObject.Find("Managers");
var CoordinateMapperManager = Managers.GetComponent<CoordinateMapperManager>();
var tmpObj = GameObject.CreatePrimitive(PrimitiveType.Plane);
tmpObj.GetComponent<Renderer>().material = Resources.Load("GreenScreen/GreenScreen.mat", typeof(Material)) as Material;
tmpObj.GetComponent<Renderer>().material.SetTexture("_MainTex", CoordinateMapperManager.ColorTexture);
var DepthPoints = CoordinateMapperManager.DepthCoordinates;
var DepthBuffer = new ComputeBuffer(DepthPoints.Length, sizeof(float) * 2);
tmpObj.GetComponent<Renderer>().material.SetBuffer("depthCoordinates", DepthBuffer);
var BodyIndexPoints = CoordinateMapperManager.BodyIndexBuffer;
var BodyIndexBuffer = new ComputeBuffer(BodyIndexPoints.Length, sizeof(float));
tmpObj.GetComponent<Renderer>().material.SetBuffer("bodyIndexBuffer", BodyIndexBuffer);
var CoordinateMapperView = GameObject.Find("CoordinateMapView");
// Use the Assert class to test conditions.
// yield to skip a frame
yield return null;
var expected = tmpObj.GetComponent<Renderer>().material.mainTexture;
var actual = CoordinateMapperView.GetComponent<Renderer>().material.mainTexture;
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 {
void LoadTracks()
{
var files = new DirectoryInfo("Assets/Tracks").GetFiles("*.bpe", SearchOption.AllDirectories);
List<TrackInfo> tracks = files.Select(s => new TrackInfo(s)).ToList();
while (tracks.Count() < 5)
tracks.AddRange(tracks);
foreach (TrackInfo track in tracks)
foreach (TrackInfo track in LoadTrackInfos())
{
var trackItem = Instantiate(trackItemPrefab, trackList.transform);
......@@ -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()
{
// TODO: disable start button if nothing selected
......
......@@ -67,7 +67,7 @@ PlayerSettings:
defaultIsFullScreen: 1
defaultIsNativeResolution: 1
macRetinaSupport: 1
runInBackground: 0
runInBackground: 1
captureSingleScreen: 0
muteOtherAudioSources: 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