This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public event System.Action<int> OnJoin; | |
void Init(){ | |
this.OnJoin += JoinAction; | |
} | |
void JoinAction(int id){ | |
list.Add(id); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using System.Collections; | |
public class BakeTransformToMesh | |
{ | |
[MenuItem("sugi.cho/Mesh/Bake Transform")] | |
public static void BakeTransform () | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using System.Collections; | |
public class CreateTex3D : EditorWindow | |
{ | |
[MenuItem("sugi.cho/Window/CreatePerlin3DTexture")] | |
public static void Init () | |
{ | |
EditorWindow window = EditorWindow.GetWindow (typeof(CreateTex3D)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Custom/QuaternionTest" { | |
Properties { | |
_AX("axis", Vector) = (0,0,0,0) | |
_TH("theta", Float) = 0 | |
} | |
CGINCLUDE | |
#include "UnityCG.cginc" | |
#define PI 3.1416 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Quaternion multiplication. | |
// http://mathworld.wolfram.com/Quaternion.html | |
float4 qmul(float4 q1, float4 q2) | |
{ | |
return float4( | |
q2.xyz * q1.w + q1.xyz * q2.w + cross(q1.xyz, q2.xyz), | |
q1.w * q2.w - dot(q1.xyz, q2.xyz) | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
void Test(string t){ | |
Debug.Log(t); | |
} | |
void Main(){ | |
Action<string> a = Test; | |
a("test"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
v2f vert(Input v) { | |
float4 posWorld = mul(_Object2World, v.vertex); | |
posWorld.xyz += _POS; | |
v2f o; | |
o.vertex = mul(UNITY_MATRIX_P, mul(UNITY_MATRIX_V, posWorld)); | |
o.uv = v.uv; | |
return o; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Custom/FragmentLit" { | |
CGINCLUDE | |
#include "UnityCG.cginc" | |
sampler2D _MainTex; | |
fixed4 _Color; | |
struct v2f { | |
float4 pos : SV_POSITION; | |
fixed4 color : COLOR; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class SetCamRect : MonoBehaviour | |
{ | |
public Camera[] cams; | |
string | |
propRectMinX = "RectMinX", | |
propRectMinY = "RectMinY", | |
propRectMaxX = "RectMaxX", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void GetBlurTex(RenderTexture targetTexture, int iteration, int ds){ | |
RenderTexture rt = targetTexture; | |
float | |
widthMod = 1f / (1f * (1 << ds)); | |
int | |
rtW = rt.width, | |
rtH = rt.height; | |
for(int i = 0; i < iteration; i++){ | |
float iterationOffs = (float)i; |