C# 클래스 AreaLearningInGameController, project-tango-poc

AreaLearningGUIController is responsible for the main game interaction. This class also takes care of loading / save persistent data(marker), and loop closure handling.
상속: MonoBehaviour, ITangoPose, ITangoEvent
파일 보기 프로젝트 열기: stetro/project-tango-poc 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
m_canvas Canvas
m_markPrefabs GameObject[]
m_pointCloud TangoPointCloud,
m_prefabTouchEffect UnityEngine.RectTransform
m_savingText UnityEngine.UI.Text

공개 메소드들

메소드 설명
OnApplicationPause ( bool pauseStatus ) : void

Applicaiton onPause / onResume callback.

OnGUI ( ) : void

Unity OnGUI function. Mainly for removing markers.

OnTangoDepthAvailable ( TangoUnityDepth tangoDepth ) : void

This is called each time new depth data is available. On the Tango tablet, the depth callback occurs at 5 Hz.

OnTangoEventAvailableEventHandler ( Tango tangoEvent ) : void

This is called each time a Tango event happens.

OnTangoPoseAvailable ( Tango poseData ) : void

OnTangoPoseAvailable event from Tango. In this function, we only listen to the Start-Of-Service with respect to Area-Description frame pair. This pair indicates a relocalization or loop closure event happened, base on that, we either start the initialize the interaction or do a bundle adjustment for all marker position.

Save ( ) : void

Save the game. Save will trigger 3 things: 1. Save the Area Description if the learning mode is on. 2. Bundle adjustment for all markers's position, please see _UpdateMarkersForLoopClosures() function header for more details. 3. Save all markers to xml, save the Area Description if the learning mode is on. 4. Reload the scene.

SetCurrentMarkType ( int type ) : void

Set the marker type.

Start ( ) : void

Unity Start function. We find and assign pose controller and tango applicaiton, and register this class to callback events.

Update ( ) : void

Unity Update function. Mainly handle the touch event and place mark in place.

비공개 메소드들

메소드 설명
_DoSaveCurrentAreaDescription ( ) : IEnumerator

Actually do the Area Description save.

_LoadMarkerFromDisk ( ) : void

Load marker list xml from application storage.

_SaveMarkerToDisk ( ) : void

Write marker list to an xml file stored in application storage.

_UpdateMarkersForLoopClosures ( ) : void

Correct all saved marks when loop closure happens. When Tango Service is in learning mode, the drift will accumulate overtime, but when the system sees a pre-exsiting area, it will do a operation to correct all previously saved poses (the pose you can query with GetPoseAtTime). This operation is called loop closure. When loop closure happens, we will need to re-query all previously saved marker position in order to achieve the best result. This function is doing the querying job based on timestamp.

_WaitForDepthAndFindPlane ( Vector2 touchPosition ) : IEnumerator

Wait for the next depth update, then find the plane at the touch position.

_WorldBoundsToScreen ( Camera cam, Bounds bounds ) : Rect

Convert a 3D bounding box into a 2D Rect.

메소드 상세

OnApplicationPause() 공개 메소드

Applicaiton onPause / onResume callback.
public OnApplicationPause ( bool pauseStatus ) : void
pauseStatus bool true if the application about to pause, otherwise false.
리턴 void

OnGUI() 공개 메소드

Unity OnGUI function. Mainly for removing markers.
public OnGUI ( ) : void
리턴 void

OnTangoDepthAvailable() 공개 메소드

This is called each time new depth data is available. On the Tango tablet, the depth callback occurs at 5 Hz.
public OnTangoDepthAvailable ( TangoUnityDepth tangoDepth ) : void
tangoDepth Tango.TangoUnityDepth Tango depth.
리턴 void

OnTangoEventAvailableEventHandler() 공개 메소드

This is called each time a Tango event happens.
public OnTangoEventAvailableEventHandler ( Tango tangoEvent ) : void
tangoEvent Tango Tango event.
리턴 void

OnTangoPoseAvailable() 공개 메소드

OnTangoPoseAvailable event from Tango. In this function, we only listen to the Start-Of-Service with respect to Area-Description frame pair. This pair indicates a relocalization or loop closure event happened, base on that, we either start the initialize the interaction or do a bundle adjustment for all marker position.
public OnTangoPoseAvailable ( Tango poseData ) : void
poseData Tango Returned pose data from TangoService.
리턴 void

Save() 공개 메소드

Save the game. Save will trigger 3 things: 1. Save the Area Description if the learning mode is on. 2. Bundle adjustment for all markers's position, please see _UpdateMarkersForLoopClosures() function header for more details. 3. Save all markers to xml, save the Area Description if the learning mode is on. 4. Reload the scene.
public Save ( ) : void
리턴 void

SetCurrentMarkType() 공개 메소드

Set the marker type.
public SetCurrentMarkType ( int type ) : void
type int Marker type.
리턴 void

Start() 공개 메소드

Unity Start function. We find and assign pose controller and tango applicaiton, and register this class to callback events.
public Start ( ) : void
리턴 void

Update() 공개 메소드

Unity Update function. Mainly handle the touch event and place mark in place.
public Update ( ) : void
리턴 void

프로퍼티 상세

m_canvas 공개적으로 프로퍼티

The canvas to place 2D game objects under.
public Canvas m_canvas
리턴 Canvas

m_markPrefabs 공개적으로 프로퍼티

Prefabs of different colored markers.
public GameObject[] m_markPrefabs
리턴 GameObject[]

m_pointCloud 공개적으로 프로퍼티

The point cloud object in the scene.
public TangoPointCloud, m_pointCloud
리턴 TangoPointCloud,

m_prefabTouchEffect 공개적으로 프로퍼티

The touch effect to place on taps.
public RectTransform,UnityEngine m_prefabTouchEffect
리턴 UnityEngine.RectTransform

m_savingText 공개적으로 프로퍼티

Saving progress UI text.
public Text,UnityEngine.UI m_savingText
리턴 UnityEngine.UI.Text