Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
qvaleroo committed Aug 21, 2024
2 parents 99a989c + dd695e9 commit 40d4770
Show file tree
Hide file tree
Showing 47 changed files with 4,084 additions and 147 deletions.
8 changes: 8 additions & 0 deletions package/Assets/Built-in.meta

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

8 changes: 8 additions & 0 deletions package/Assets/Built-in/Materials.meta

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

55 changes: 55 additions & 0 deletions package/Assets/Built-in/Materials/Scenario_Projector Global.mat
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Scenario_Projector Global
m_Shader: {fileID: 4800000, guid: f658d0c4a8aac0543814f6a7b7704767, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- UV2
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _Decal:
m_Texture: {fileID: 2800000, guid: 8da06c97000bd3f4fb2de7f0fbec4993, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _FalloffTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ShadowTex:
m_Texture: {fileID: 2800000, guid: 1c5a069a0ea942f4a880abbccd241434, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _Angle: -1.38
- _Float: 6
- _Offset: 0
- _OffsetFlat: 1.11
- _OffsetXFlat: 1
- _OffsetYFlat: 1
- _ScaleFlat: 2
- _Slider: 1
- _UV2: 1
- _UVSelector: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _Offset: {r: 0, g: 0, b: 0, a: 0}
- _Vector: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []

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

8 changes: 8 additions & 0 deletions package/Assets/Built-in/Shaders.meta

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

59 changes: 59 additions & 0 deletions package/Assets/Built-in/Shaders/Scenario 2UV.shader
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
Shader "Scenario/Unlit/Scenario 2UV"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }

Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag

#include "UnityCG.cginc"

struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float2 uv2 : TEXCOORD2;
};

struct v2f
{
float2 uv : TEXCOORD0;
float2 uv2 : TEXCOORD1;
float4 vertex : SV_POSITION;
};

sampler2D _MainTex;
float4 _MainTex_ST;

v2f vert (appdata v)
{
v2f o;
o.uv2 = v.uv2;

o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
return o;
}

fixed4 frag (v2f i) : SV_Target
{
float4 finalColor;
// Sample UV2 coordinate to determine face
float2 uv2Coord = i.uv2;

// sample the texture
finalColor = tex2D(_MainTex, i.uv2);
return finalColor;
}
ENDCG
}
}
}
9 changes: 9 additions & 0 deletions package/Assets/Built-in/Shaders/Scenario 2UV.shader.meta

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

126 changes: 126 additions & 0 deletions package/Assets/Built-in/Shaders/Scenario Projected Debug.shader
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
Shader "Scenario/Projected Debug"
{
Properties
{
_MainTexFront ("Front Texture", 2D) = "white" {}
_MainTexBack ("Back Texture", 2D) = "white" {}
_MainTexLeft ("Left Texture", 2D) = "white" {}
_MainTexRight ("Right Texture", 2D) = "white" {}
_MainTexTop ("Top Texture", 2D) = "white" {}
_MainTexBottom ("Bottom Texture", 2D) = "white" {}
_MainTexOther ("Other Texture", 2D) = "white" {}
}

SubShader
{
Tags { "RenderType"="Opaque" }

Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"

struct MeshData
{
float4 vertex : POSITION;
float3 normal : NORMAL;
float2 uv: TEXCOORD0;
float2 uv2 : TEXCOORD2;
};

struct v2f
{
float2 uv2 : TEXCOORD11;
float2 uv_MainTexFront : TEXCOORD0;
float2 uv_MainTexBack : TEXCOORD1;
float2 uv_MainTexLeft : TEXCOORD2;
float2 uv_MainTexRight : TEXCOORD3;
float2 uv_MainTexTop : TEXCOORD4;
float2 uv_MainTexBottom : TEXCOORD5;
float2 uv_MainTexOther : TEXCOORD6;
float4 vertex : SV_POSITION;
float3 normal : NORMAL;
};

sampler2D _MainTexFront;
float4 _MainTexFront_ST;

sampler2D _MainTexBack;
float4 _MainTexBack_ST;

sampler2D _MainTexLeft;
float4 _MainTexLeft_ST;

sampler2D _MainTexRight;
float4 _MainTexRight_ST;

sampler2D _MainTexTop;
float4 _MainTexTop_ST;

sampler2D _MainTexBottom;
float4 _MainTexBottom_ST;

sampler2D _MainTexOther;
float4 _MainTexOther_ST;

v2f vert(MeshData v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.normal = v.normal;
o.uv2 = v.uv2;

o.uv_MainTexFront = TRANSFORM_TEX(v.uv, _MainTexFront);
o.uv_MainTexBack = TRANSFORM_TEX(v.uv, _MainTexBack);
o.uv_MainTexLeft = TRANSFORM_TEX(v.uv, _MainTexLeft);
o.uv_MainTexRight = TRANSFORM_TEX(v.uv, _MainTexRight);
o.uv_MainTexTop = TRANSFORM_TEX(v.uv, _MainTexTop);
o.uv_MainTexBottom = TRANSFORM_TEX(v.uv, _MainTexBottom);
o.uv_MainTexOther = TRANSFORM_TEX(v.uv, _MainTexOther);
return o;
}

fixed4 frag(v2f i) : SV_Target
{
fixed4 finalColor;

// Sample UV2 coordinate to determine face
float2 uv2Coord = i.uv2;

fixed4 front = tex2D(_MainTexFront, i.uv_MainTexFront);
fixed4 back = tex2D(_MainTexBack, i.uv_MainTexBack);
fixed4 left = tex2D(_MainTexLeft, i.uv_MainTexLeft);
fixed4 right = tex2D(_MainTexRight, i.uv_MainTexRight);
fixed4 top = tex2D(_MainTexTop, i.uv_MainTexTop);
fixed4 bottom = tex2D(_MainTexBottom, i.uv_MainTexBottom);
fixed4 other = tex2D(_MainTexOther, i.uv_MainTexOther);

// Determine which face the fragment belongs to based on UV2 coordinate
if (uv2Coord.x < 0.333 && uv2Coord.y < 0.333)
finalColor = top;
else if (uv2Coord.x < 0.666 && uv2Coord.y < 0.333)
finalColor = front;
else if (uv2Coord.x < 1.0 && uv2Coord.y < 0.333)
finalColor = left;
else if (uv2Coord.x < 0.333 && uv2Coord.y < 0.666)
finalColor = bottom;
else if (uv2Coord.x < 0.666 && uv2Coord.y < 0.666)
finalColor = back;
else if (uv2Coord.x < 1.0 && uv2Coord.y < 0.666)
finalColor = right;
/*else if (uv2Coord.x < 0.333 && uv2Coord.y < 1.0)
finalColor = float4(1, 0, 1, 0);
else if (uv2Coord.x < 0.666 && uv2Coord.y < 1.0)
finalColor = float4(1, 1, 1, 0);*/
else
finalColor = other;

return finalColor;
}
ENDCG
}
}
FallBack "Diffuse"
}

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

Loading

0 comments on commit 40d4770

Please sign in to comment.