Skip to content

Commit

Permalink
initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
hecomi committed Sep 3, 2017
0 parents commit 4a69af5
Show file tree
Hide file tree
Showing 35 changed files with 3,089 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Unity3D temporary directories
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/

# Autogenerated VS/MD solution and project files
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj

# Unity3D generated meta files
*.pidb.meta

# Unity3D Generated File On Crash Reports
sysinfo.txt

# Others
.DS_Store
.vscode
9 changes: 9 additions & 0 deletions Assets/uHomography.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Assets/uHomography/Resources.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Assets/uHomography/Resources/uHomography.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Assets/uHomography/Resources/uHomography/Prefabs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

112 changes: 112 additions & 0 deletions Assets/uHomography/Resources/uHomography/Prefabs/Vertex.prefab
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 1454010770895572}
m_IsPrefabParent: 1
--- !u!1 &1454010770895572
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 4837753712413324}
- component: {fileID: 212771237704114300}
- component: {fileID: 114636275816296490}
- component: {fileID: 58022710649544966}
m_Layer: 0
m_Name: Vertex
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4837753712413324
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1454010770895572}
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: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!58 &58022710649544966
CircleCollider2D:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1454010770895572}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0, y: 0}
serializedVersion: 2
m_Radius: 0.1
--- !u!114 &114636275816296490
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1454010770895572}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 05fa5a760429d4ac988832138f7b3748, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!212 &212771237704114300
SpriteRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1454010770895572}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 10913, guid: 0000000000000000f000000000000000, type: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 0.2, y: 0.2}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Assets/uHomography/Sahders.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

103 changes: 103 additions & 0 deletions Assets/uHomography/Sahders/Homography.shader
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
Shader "uHomography/Homography"
{

Properties
{
_MainTex ("Texture", 2D) = "white" {}
}

CGINCLUDE

#include "UnityCG.cginc"

struct appdata_clear
{
float4 vertex : POSITION;
};

struct v2f_clear
{
float4 vertex : SV_POSITION;
};

struct appdata_homography
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};

struct v2f_homography
{
float2 screenPos : TEXCOORD1;
float4 vertex : SV_POSITION;
};

sampler2D _MainTex;
float4 _MainTex_ST;
float _Homography[9];
float _InvHomography[9];

v2f_clear vert_clear(appdata_clear v)
{
v2f_clear o;
o.vertex = UnityObjectToClipPos(v.vertex);
return o;
}

fixed4 frag_clear(appdata_clear i) : SV_Target
{
return 0;
}

v2f_homography vert_homography(appdata_homography v)
{
v2f_homography o;

float4 p = v.vertex;
float s = _Homography[6] * p.x + _Homography[7] * p.y + _Homography[8];
float x = (_Homography[0] * p.x + _Homography[1] * p.y + _Homography[2]) / s;
float y = (_Homography[3] * p.x + _Homography[4] * p.y + _Homography[5]) / s;
o.vertex = float4(2 * (x - 0.5), 2 * (y - 0.5), 0, 1);
o.screenPos = float2(o.vertex.x, o.vertex.y);

return o;
}

fixed4 frag_homography(v2f_homography i) : SV_Target
{
float2 p = (i.screenPos + 1.0) * 0.5;
float s = _InvHomography[6] * p.x + _InvHomography[7] * p.y + _InvHomography[8];
float u = (_InvHomography[0] * p.x + _InvHomography[1] * p.y + _InvHomography[2]) / s;
float v = (_InvHomography[3] * p.x + _InvHomography[4] * p.y + _InvHomography[5]) / s;
float2 uv = float2(u, v);
return tex2D(_MainTex, uv);
}

ENDCG

SubShader
{
Blend Off
ZTest Always
ZWrite Off
Cull Off
Lighting Off

Pass
{
CGPROGRAM
#pragma vertex vert_clear
#pragma fragment frag_clear
ENDCG
}

Pass
{
CGPROGRAM
#pragma vertex vert_homography
#pragma fragment frag_homography
ENDCG
}
}

}
9 changes: 9 additions & 0 deletions Assets/uHomography/Sahders/Homography.shader.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Assets/uHomography/Scenes.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4a69af5

Please sign in to comment.