Skip to content

Commit

Permalink
Merge pull request #2 from OZadok/master
Browse files Browse the repository at this point in the history
Renderer Color & free sprite dimensions
  • Loading branch information
penandlim authored Sep 18, 2019
2 parents d8224e7 + 6dedaaf commit 88feab1
Show file tree
Hide file tree
Showing 51 changed files with 219 additions and 75 deletions.
10 changes: 8 additions & 2 deletions John Lim's Blend Modes/Add.shader
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,15 @@ Shader "Blendmodes/Add"
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float4 color : COLOR;
};

struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
float4 color : COLOR;
float2 bguv : TEXCOORD1;
};

sampler2D _MainTex;
Expand All @@ -78,15 +81,18 @@ Shader "Blendmodes/Add"
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
o.color = v.color;
o.bguv = ComputeGrabScreenPos(o.vertex);
return o;
}

fixed4 frag (v2f i) : SV_Target
{
fixed4 mainColor = tex2D(_BackgroundTexture, i.uv);
fixed4 blendColor = tex2D(_MainTex, i.uv);
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
blendColor.xyz += _Tint1.xyz * _Tint1.a;


// perform blend
mainColor.xyz = Add(mainColor.xyz, blendColor.xyz);
mainColor.xyz += _Tint2.xyz * _Tint2.a;
Expand Down
2 changes: 1 addition & 1 deletion John Lim's Blend Modes/Add.shader.meta

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

2 changes: 1 addition & 1 deletion John Lim's Blend Modes/CGIncludes.meta

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

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

10 changes: 8 additions & 2 deletions John Lim's Blend Modes/Color.shader
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,15 @@ Shader "Blendmodes/Color"
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float4 color : COLOR;
};

struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
float4 color : COLOR;
float2 bguv : TEXCOORD1;
};

sampler2D _MainTex;
Expand All @@ -78,15 +81,18 @@ Shader "Blendmodes/Color"
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
o.color = v.color;
o.bguv = ComputeGrabScreenPos(o.vertex);
return o;
}

fixed4 frag (v2f i) : SV_Target
{
fixed4 mainColor = tex2D(_BackgroundTexture, i.uv);
fixed4 blendColor = tex2D(_MainTex, i.uv);
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
blendColor.xyz += _Tint1.xyz * _Tint1.a;


// perform blend
mainColor.xyz = Color(mainColor.xyz, blendColor.xyz);
mainColor.xyz += _Tint2.xyz * _Tint2.a;
Expand Down
2 changes: 1 addition & 1 deletion John Lim's Blend Modes/Color.shader.meta

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

10 changes: 8 additions & 2 deletions John Lim's Blend Modes/ColorBurn.shader
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,15 @@ Shader "Blendmodes/ColorBurn"
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float4 color : COLOR;
};

struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
float4 color : COLOR;
float2 bguv : TEXCOORD1;
};

sampler2D _MainTex;
Expand All @@ -78,15 +81,18 @@ Shader "Blendmodes/ColorBurn"
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
o.color = v.color;
o.bguv = ComputeGrabScreenPos(o.vertex);
return o;
}

fixed4 frag (v2f i) : SV_Target
{
fixed4 mainColor = tex2D(_BackgroundTexture, i.uv);
fixed4 blendColor = tex2D(_MainTex, i.uv);
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
blendColor.xyz += _Tint1.xyz * _Tint1.a;


// perform blend
mainColor.xyz = ColorBurn(mainColor.xyz, blendColor.xyz);
mainColor.xyz += _Tint2.xyz * _Tint2.a;
Expand Down
2 changes: 1 addition & 1 deletion John Lim's Blend Modes/ColorBurn.shader.meta

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

10 changes: 8 additions & 2 deletions John Lim's Blend Modes/ColorDodge.shader
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,15 @@ Shader "Blendmodes/ColorDodge"
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float4 color : COLOR;
};

struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
float4 color : COLOR;
float2 bguv : TEXCOORD1;
};

sampler2D _MainTex;
Expand All @@ -78,15 +81,18 @@ Shader "Blendmodes/ColorDodge"
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
o.color = v.color;
o.bguv = ComputeGrabScreenPos(o.vertex);
return o;
}

fixed4 frag (v2f i) : SV_Target
{
fixed4 mainColor = tex2D(_BackgroundTexture, i.uv);
fixed4 blendColor = tex2D(_MainTex, i.uv);
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
blendColor.xyz += _Tint1.xyz * _Tint1.a;


// perform blend
mainColor.xyz = ColorDodge(mainColor.xyz, blendColor.xyz);
mainColor.xyz += _Tint2.xyz * _Tint2.a;
Expand Down
2 changes: 1 addition & 1 deletion John Lim's Blend Modes/ColorDodge.shader.meta

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

10 changes: 8 additions & 2 deletions John Lim's Blend Modes/DarkerColor.shader
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,15 @@ Shader "Blendmodes/DarkerColor"
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float4 color : COLOR;
};

struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
float4 color : COLOR;
float2 bguv : TEXCOORD1;
};

sampler2D _MainTex;
Expand All @@ -78,15 +81,18 @@ Shader "Blendmodes/DarkerColor"
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
o.color = v.color;
o.bguv = ComputeGrabScreenPos(o.vertex);
return o;
}

fixed4 frag (v2f i) : SV_Target
{
fixed4 mainColor = tex2D(_BackgroundTexture, i.uv);
fixed4 blendColor = tex2D(_MainTex, i.uv);
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
blendColor.xyz += _Tint1.xyz * _Tint1.a;


// perform blend
mainColor.xyz = DarkerColor(mainColor.xyz, blendColor.xyz);
mainColor.xyz += _Tint2.xyz * _Tint2.a;
Expand Down
2 changes: 1 addition & 1 deletion John Lim's Blend Modes/DarkerColor.shader.meta

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

10 changes: 8 additions & 2 deletions John Lim's Blend Modes/Difference.shader
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,15 @@ Shader "Blendmodes/Difference"
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float4 color : COLOR;
};

struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
float4 color : COLOR;
float2 bguv : TEXCOORD1;
};

sampler2D _MainTex;
Expand All @@ -78,15 +81,18 @@ Shader "Blendmodes/Difference"
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
o.color = v.color;
o.bguv = ComputeGrabScreenPos(o.vertex);
return o;
}

fixed4 frag (v2f i) : SV_Target
{
fixed4 mainColor = tex2D(_BackgroundTexture, i.uv);
fixed4 blendColor = tex2D(_MainTex, i.uv);
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
blendColor.xyz += _Tint1.xyz * _Tint1.a;


// perform blend
mainColor.xyz = Difference(mainColor.xyz, blendColor.xyz);
mainColor.xyz += _Tint2.xyz * _Tint2.a;
Expand Down
2 changes: 1 addition & 1 deletion John Lim's Blend Modes/Difference.shader.meta

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

10 changes: 8 additions & 2 deletions John Lim's Blend Modes/Divide.shader
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,15 @@ Shader "Blendmodes/Divide"
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float4 color : COLOR;
};

struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
float4 color : COLOR;
float2 bguv : TEXCOORD1;
};

sampler2D _MainTex;
Expand All @@ -78,15 +81,18 @@ Shader "Blendmodes/Divide"
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
o.color = v.color;
o.bguv = ComputeGrabScreenPos(o.vertex);
return o;
}

fixed4 frag (v2f i) : SV_Target
{
fixed4 mainColor = tex2D(_BackgroundTexture, i.uv);
fixed4 blendColor = tex2D(_MainTex, i.uv);
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
blendColor.xyz += _Tint1.xyz * _Tint1.a;


// perform blend
mainColor.xyz = Divide(mainColor.xyz, blendColor.xyz);
mainColor.xyz += _Tint2.xyz * _Tint2.a;
Expand Down
2 changes: 1 addition & 1 deletion John Lim's Blend Modes/Divide.shader.meta

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

10 changes: 8 additions & 2 deletions John Lim's Blend Modes/Exclusion.shader
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,15 @@ Shader "Blendmodes/Exclusion"
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float4 color : COLOR;
};

struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
float4 color : COLOR;
float2 bguv : TEXCOORD1;
};

sampler2D _MainTex;
Expand All @@ -78,15 +81,18 @@ Shader "Blendmodes/Exclusion"
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
o.color = v.color;
o.bguv = ComputeGrabScreenPos(o.vertex);
return o;
}

fixed4 frag (v2f i) : SV_Target
{
fixed4 mainColor = tex2D(_BackgroundTexture, i.uv);
fixed4 blendColor = tex2D(_MainTex, i.uv);
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
blendColor.xyz += _Tint1.xyz * _Tint1.a;


// perform blend
mainColor.xyz = Exclusion(mainColor.xyz, blendColor.xyz);
mainColor.xyz += _Tint2.xyz * _Tint2.a;
Expand Down
2 changes: 1 addition & 1 deletion John Lim's Blend Modes/Exclusion.shader.meta

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

Loading

0 comments on commit 88feab1

Please sign in to comment.