Skip to content

Commit

Permalink
Run code formatter.
Browse files Browse the repository at this point in the history
  • Loading branch information
stramit committed May 24, 2018
1 parent d7793e9 commit 6b6f3e5
Show file tree
Hide file tree
Showing 498 changed files with 10,577 additions and 10,610 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
Expand All @@ -8,14 +8,14 @@
/// This script forces all textures in the folder 'ImageTemplates' to have no compression, meaning import times will be much faster, especially when switching platforms
/// </summary>

public class TemplatePreprocessor : AssetPostprocessor {

void OnPreprocessTexture()
{
if (assetPath.Contains("ImageTemplates"))
{
TextureImporter textureImporter = (TextureImporter)assetImporter;
textureImporter.textureCompression = TextureImporterCompression.Uncompressed;
}
}
public class TemplatePreprocessor : AssetPostprocessor
{
void OnPreprocessTexture()
{
if (assetPath.Contains("ImageTemplates"))
{
TextureImporter textureImporter = (TextureImporter)assetImporter;
textureImporter.textureCompression = TextureImporterCompression.Uncompressed;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Shader "GraphicTests/ComparerShader"
{
Properties
{
Properties
{
_MainTex("Texture", 2D) = "white" {}
_CompareTex("Texture", 2D) = "white" {}
[Enum(Red, 0, Green, 1, Blue, 2, Color, 3, Greyscale, 4, Heatmap, 5)]
Expand All @@ -10,33 +10,33 @@ Shader "GraphicTests/ComparerShader"
_Split("Split", Range(0,1)) = 0.5
_ResultSplit ("Result Split", Range(0,1)) = 0.1
_LineWidth("Line Width", float) = 0.001
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100

Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100

Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag

#pragma multi_compile Compare_RGB Compare_Lab Compare_Jab

#include "UnityCG.cginc"
#include "UnityCG.cginc"

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

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

sampler2D _MainTex;
sampler2D _CompareTex;
Expand All @@ -46,14 +46,14 @@ Shader "GraphicTests/ComparerShader"
float _CorrectGamma = 0;

float _Split, _ResultSplit, _LineWidth;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
return o;
}

v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
return o;
}

// Folowing color conversion code source : https://github.com/nschloe/colorio

Expand Down Expand Up @@ -154,9 +154,9 @@ Shader "GraphicTests/ComparerShader"
200. * (XYZ2LabFunc(xyz.y / yn) - XYZ2LabFunc(xyz.z / zn))
);
}
fixed4 frag (v2f i) : SV_Target
{

fixed4 frag (v2f i) : SV_Target
{
fixed4 c1 = tex2D(_MainTex, i.uv);
float2 uv2 = i.uv;
if (_FlipV2 > 0) uv2.y = 1 - uv2.y;
Expand Down Expand Up @@ -237,8 +237,8 @@ Shader "GraphicTests/ComparerShader"
o.rgb = pow(o.rgb, 0.4545454545);

return o;
}
ENDCG
}
}
}
ENDCG
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections;
using System.Collections;
using UnityEngine;

public class Boomerang : MonoBehaviour
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

[ExecuteInEditMode]
public class AutoSizeGrid : MonoBehaviour {
public class AutoSizeGrid : MonoBehaviour
{
public GridLayoutGroup layout;
public bool dynamic = false;
private int rows = 2;
private int columns = 2;

public GridLayoutGroup layout;
public bool dynamic = false;
private int rows = 2;
private int columns = 2;
// Use this for initialization
void Start()
{
SetCellSize();
}

// Use this for initialization
void Start () {
SetCellSize ();
}

// Update is called once per frame
void Update () {
#if UNITY_EDITOR
SetCellSize ();
#else
if(dynamic){
SetCellSize ();
}
#endif
}

void SetCellSize(){
Vector2 vec = new Vector2 (Screen.width / columns, Screen.height / rows);
layout.cellSize = vec / transform.parent.localScale.x;
}
// Update is called once per frame
void Update()
{
#if UNITY_EDITOR
SetCellSize();
#else
if (dynamic)
{
SetCellSize();
}
#endif
}

void SetCellSize()
{
Vector2 vec = new Vector2(Screen.width / columns, Screen.height / rows);
layout.cellSize = vec / transform.parent.localScale.x;
}
}
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
using System;
using System;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;

[Serializable]
[PostProcess(typeof(HalfToneOpaqueRenderer), PostProcessEvent.BeforeStack, "Custom/LWtest/Haltone Opaque")]
public sealed class HalfToneOpaque : PostProcessEffectSettings {
[Range(-2f, 2f), Tooltip("Pattern Midpoint")]
public FloatParameter midpoint = new FloatParameter{ value = 0f };
[Range(0.001f, 0.1f), Tooltip("Pattern Scale")]
public FloatParameter scale = new FloatParameter{ value = 0.025f };
[Range(1, 10), Tooltip("Steps")]
public IntParameter steps = new IntParameter{ value = 4};
public TextureParameter pattern = new TextureParameter{ value = null};
public sealed class HalfToneOpaque : PostProcessEffectSettings
{
[Range(-2f, 2f), Tooltip("Pattern Midpoint")]
public FloatParameter midpoint = new FloatParameter { value = 0f };
[Range(0.001f, 0.1f), Tooltip("Pattern Scale")]
public FloatParameter scale = new FloatParameter { value = 0.025f };
[Range(1, 10), Tooltip("Steps")]
public IntParameter steps = new IntParameter { value = 4};
public TextureParameter pattern = new TextureParameter { value = null};
}

public sealed class HalfToneOpaqueRenderer : PostProcessEffectRenderer<HalfToneOpaque> {

public override void Render(PostProcessRenderContext context){
var sheet = context.propertySheets.Get(Shader.Find("Hidden/Custom/LWtest/HalftoneOpaque"));
sheet.properties.SetTexture ("_Pattern", settings.pattern);
sheet.properties.SetFloat("_Blend", settings.midpoint);
sheet.properties.SetFloat("_Scale", settings.scale);
sheet.properties.SetFloat("_Steps", settings.steps);
context.command.BlitFullscreenTriangle(context.source, context.destination, sheet, 0);
}

public sealed class HalfToneOpaqueRenderer : PostProcessEffectRenderer<HalfToneOpaque>
{
public override void Render(PostProcessRenderContext context)
{
var sheet = context.propertySheets.Get(Shader.Find("Hidden/Custom/LWtest/HalftoneOpaque"));
sheet.properties.SetTexture("_Pattern", settings.pattern);
sheet.properties.SetFloat("_Blend", settings.midpoint);
sheet.properties.SetFloat("_Scale", settings.scale);
sheet.properties.SetFloat("_Steps", settings.steps);
context.command.BlitFullscreenTriangle(context.source, context.destination, sheet, 0);
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Shader "Hidden/Custom/LWtest/HalftoneOpaque"
Shader "Hidden/Custom/LWtest/HalftoneOpaque"
{
Properties
{
_Pattern ("Pattern", 2D) = "grey" {}
[IntRange]_Steps ("Steps", Range(1, 10)) = 4
}
HLSLINCLUDE
Properties
{
_Pattern ("Pattern", 2D) = "grey" {}
[IntRange]_Steps ("Steps", Range(1, 10)) = 4
}
HLSLINCLUDE

#include "../../../../../../../PostProcessing/PostProcessing/Shaders/StdLib.hlsl"

Expand All @@ -21,7 +21,7 @@

float4 Frag(VaryingsDefault i) : SV_Target
{

float4 color = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord);
float luminance = 1 + dot(color.rgb, float3(0.2126729, 0.7151522, 0.0721750)) * 0.25;
float3 pattern = SAMPLE_TEXTURE2D(_Pattern, sampler_Pattern, i.texcoord * (_ScreenParams.xy * _Scale * luminance)).rgb;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
using System;
using System;
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;

[Serializable]
[PostProcess(typeof(InvertOpaqueRenderer), PostProcessEvent.BeforeTransparent, "Custom/LWtest/Invert Opaque")]
public sealed class InvertOpaque : PostProcessEffectSettings {
public sealed class InvertOpaque : PostProcessEffectSettings
{
public BoolParameter enable = new BoolParameter();
}

public sealed class InvertOpaqueRenderer : PostProcessEffectRenderer<InvertOpaque> {

public override void Render(PostProcessRenderContext context){
var sheet = context.propertySheets.Get(Shader.Find("Hidden/Custom/LWtest/InvertOpaque"));
context.command.BlitFullscreenTriangle(context.source, context.destination, sheet, 0);
}

public sealed class InvertOpaqueRenderer : PostProcessEffectRenderer<InvertOpaque>
{
public override void Render(PostProcessRenderContext context)
{
var sheet = context.propertySheets.Get(Shader.Find("Hidden/Custom/LWtest/InvertOpaque"));
context.command.BlitFullscreenTriangle(context.source, context.destination, sheet, 0);
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Shader "Hidden/Custom/LWtest/InvertOpaque"
Shader "Hidden/Custom/LWtest/InvertOpaque"
{
HLSLINCLUDE
HLSLINCLUDE

#include "//Assets/PostProcessing/PostProcessing/Shaders/StdLib.hlsl"

TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex);

float4 Frag(VaryingsDefault i) : SV_Target
{

float4 color = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord);
return float4(1-color.rgb, color.a);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[ExecuteInEditMode]
public class PlaySystems : MonoBehaviour {

public class PlaySystems : MonoBehaviour
{
public ParticleSystem[] particleSystems;
[Range(0, 1)]
[Range(0, 1)]
public float simPoint = 0.5f;
void OnEnable () {
foreach(ParticleSystem ps in particleSystems){
void OnEnable()
{
foreach (ParticleSystem ps in particleSystems)
{
if (ps != null)
{
float life = ps.main.duration * simPoint;
ps.Simulate(life, true, true, false);
}
}
}
}

void OnDisable()
void OnDisable()
{
foreach (ParticleSystem ps in particleSystems)
{
if(ps != null)
ps.Stop();
if (ps != null)
ps.Stop();
}
}
}
Loading

0 comments on commit 6b6f3e5

Please sign in to comment.