Skip to content

Instantly share code, notes, and snippets.

@mao-test-h
mao-test-h / DokabenGeometry.shader
Created October 13, 2018 13:11
ジオメトリシェーダ―を用いて形状関係なしに強制的にドカベンロゴに塗り替えるシェーダー
Shader "Unlit/DokabenGeometry"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags
@mao-test-h
mao-test-h / AutoGraphicsEmulatorSetting.cs
Created September 3, 2018 16:47
自動でGraphics Emulationを設定してくれるやつのサンプル。(これはWebGL2.0に自動で設定してくれる)
#if UNITY_EDITOR && UNITY_WEBGL
namespace MyContents.Editor
{
using UnityEngine;
using UnityEditor;
[InitializeOnLoad]
public class EditInitialSetting
{
static EditInitialSetting()
@mao-test-h
mao-test-h / AudioCueSample.cs
Last active August 4, 2018 16:50
Unity用SoundCue(っぽいもの)サンプル
namespace MainContents.AudioUtility
{
using UnityEngine;
// UE4のSoundCueを参考にしたもの。
// 内容的にはAudioClipのラッパー的な立ち位置で、AudioClipを取得する際の振る舞いを実装するもの。
// →例 : ランダムでClipを返すもの、配列に登録したClipを順番に取得など。
// ※本当はinterfaceにしたいけどSerializeFieldで登録する都合上、敢えて基底クラスとする...
public abstract class AudioCue : ScriptableObject
{
@mao-test-h
mao-test-h / CosApproximate.cs
Last active August 1, 2018 17:02
級数展開でcosの近似値を出すテスト
// https://twitter.com/TEST_H_/status/1023975602494169092
using System;
using System.Diagnostics;
namespace MyContents
{
class Test
{
static void Main()
@mao-test-h
mao-test-h / InspectorArraySortTest.cs
Last active July 5, 2018 21:59
【Unity】Inspectorに表示されている配列の要素をソートするサンプル
// Inspectorに表示されている配列の要素をソートするサンプル
namespace MainContents.Test
{
using UnityEngine;
using System.Collections;
[CreateAssetMenu(menuName = "ScriptableObjects/InspectorArraySortTest", fileName = "InspectorArraySortTest")]
public class InspectorArraySortTest : ScriptableObject
{
@mao-test-h
mao-test-h / WorleyNoise.shader
Created April 19, 2018 16:40
ShaderLabでのWorleyNoiseの実装
// 参考サイト
// ・セルラーノイズ
// https://thebookofshaders.com/12/?lan=jp
Shader "Custom/WorleyNoise"
{
CGINCLUDE
#include "UnityCG.cginc"
float2 random2(fixed2 st)
@mao-test-h
mao-test-h / ProcessingClothTest.pde
Created January 17, 2018 16:58
Processingで布っぽいのを実装(Nature of Code : Chapter5参照)
// Nature of Code : Chapter5 参照
import toxi.physics2d.behaviors.*;
import toxi.physics2d.*;
import toxi.geom.*;
import toxi.math.*;
VerletPhysics2D physics;
Blanket blanket;
class Object
{
float _mass;
PVector _location;
PVector _velocity;
PVector _acceleration;
float _G;
Object(float mass, float x, float y)
{
@mao-test-h
mao-test-h / AbeHirosh_HP_Window.cs
Last active September 3, 2019 16:30
阿部寛のホームページを表示するためのEditor拡張 ※Unity2017.2.0p1で動作確認
using System.Reflection;
using UnityEditor;
/// <summary>
/// 阿部寛のホームページを表示するためのEditor拡張
/// </summary>
public static class AbeHirosh_HP_Window
{
[MenuItem(@"Window/阿部寛のホームページ")]
static void Open()
@mao-test-h
mao-test-h / Dokaben-Sprite-Default.shader
Last active October 24, 2017 19:44
ドカベンロゴアニメーションシェーダー ※Unity2017.2.0f3の"Sprites/Default"をベースに作成
// "Sprites/Default"のドカベンロゴアニメーション版
Shader "Dokaben/Sprites/Title-Animation"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
[HideInInspector] _RendererColor ("RendererColor", Color) = (1,1,1,1)