diff --git a/Assets/uHomography/Scenes/uHomography.unity b/Assets/uHomography/Scenes/uHomography.unity index 8a49241..dccfbc1 100644 --- a/Assets/uHomography/Scenes/uHomography.unity +++ b/Assets/uHomography/Scenes/uHomography.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.4465934, g: 0.49642956, b: 0.5748249, a: 1} + m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1} --- !u!157 &3 LightmapSettings: m_ObjectHideFlags: 0 @@ -387,6 +387,46 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: camera: {fileID: 1921056250} +--- !u!1 &598281487 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 598281489} + - component: {fileID: 598281488} + m_Layer: 0 + m_Name: Convert Point Test + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &598281488 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 598281487} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 681abd389192d894a9c4156e4eff91cb, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &598281489 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 598281487} + 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: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!21 &853359849 Material: serializedVersion: 6 @@ -512,8 +552,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 2a1e8ea765ed549d193c5b4495319ee4, type: 3} m_Name: m_EditorClassIdentifier: - showHandles: 1 - toggleKey: 32 + handleToggleKey: 0 layer: 31 uiCamera: {fileID: 1921056250} shader: {fileID: 4800000, guid: c6971acbaaa734de18fa0ab8403a8dca, type: 3} diff --git a/Assets/uHomography/Scripts/Homography.cs b/Assets/uHomography/Scripts/Homography.cs index bb577b6..0084916 100644 --- a/Assets/uHomography/Scripts/Homography.cs +++ b/Assets/uHomography/Scripts/Homography.cs @@ -211,6 +211,22 @@ void OnRenderImage(RenderTexture source, RenderTexture destination) material.SetFloatArray("_InvHomography", invHomography_); Graphics.Blit(source, destination, material); } + + public Vector2 GetHomographyPosition(Vector2 pos) + { + float s = homography_[6] * pos.x + homography_[7] * pos.y + homography_[8]; + float x = (homography_[0] * pos.x + homography_[1] * pos.y + homography_[2]) / s; + float y = (homography_[3] * pos.x + homography_[4] * pos.y + homography_[5]) / s; + return new Vector2(x, y); + } + + public Vector2 GetInverseHomographyPosition(Vector2 pos) + { + float s = invHomography_[6] * pos.x + invHomography_[7] * pos.y + invHomography_[8]; + float x = (invHomography_[0] * pos.x + invHomography_[1] * pos.y + invHomography_[2]) / s; + float y = (invHomography_[3] * pos.x + invHomography_[4] * pos.y + invHomography_[5]) / s; + return new Vector2(x, y); + } } } \ No newline at end of file diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index e2f5bd6..fd37049 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1 +1 @@ -m_EditorVersion: 2017.1.0b6 +m_EditorVersion: 2017.1.0b5