Skip to content

Instantly share code, notes, and snippets.

@kasari
kasari / MeshInfoWindow.cs
Created December 22, 2023 09:14
Unity editor extension to create a list of meshes on a Scene and sort them by number of vertices or triangles
using System.Linq;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
public class MeshInfoWindow : EditorWindow
{
private enum TableSortState
{
None,
@kasari
kasari / brainfuck.rs
Created June 19, 2021 03:58
Brainf*ck interpreter in Rust
use std::io::Read;
use std::num::Wrapping;
#[derive(Debug, Copy, Clone, PartialEq)]
pub enum Token {
Plus,
Minus,
Gt,
Lt,
LBracket,
@kasari
kasari / Undersea_volumetric_for_twigl_geekerMRT.frag
Last active August 8, 2020 02:06
純粋なVolumetricが重すぎて敗北したのでポスプロで実装したバージョン(Twigl の geeker(MRT)で動作します)
// https://www.shadertoy.com/view/4sfGzS
float hash(vec3 p) // replace this by something better
{
p = fract( p*0.3183099+.1 );
p *= 17.0;
return fract( p.x*p.y*p.z*(p.x+p.y+p.z) );
}
float noise( in vec3 x )
{
@kasari
kasari / electro_world.rb
Created November 17, 2019 01:01
[Sonic Pi] Perfume - Electro World
use_bpm 145
live_loop :chord do
use_synth :piano
use_synth_defaults attack: 0.01, sustain: 8.0, decay: 0.1, amp: 1.0
use_transpose +12
with_fx :reverb, room: 1.0, amp: 1.0 do
with_fx :distortion, distort: 0.7 do
with_fx :nrlpf do
play ([:G2,:D3,:G3])
@kasari
kasari / PostProcess-HeightFog.shader
Created November 3, 2019 09:20
[Unity] Post Process Height Fog
Shader "PostProcess/HeightFog"
{
Properties
{
[HideInInspector] _MainTex ("Texture", 2D) = "white" {}
_FogColor ("FogColor", Color) = (1,1,1,1)
_FogDensity ("FogDensity", Range(0,1)) = 0.2
_FogHeight ("FogHeight", float) = 5.0
}
SubShader
@kasari
kasari / DepthScan.cs
Created November 3, 2019 07:49
[Unity] Post Process Scan Effect
using UnityEngine;
public class DepthScan : MonoBehaviour
{
[SerializeField] private Camera cam;
[SerializeField] private Material mat;
[SerializeField] private float scanSpeed = 80f;
private float scanDistance;
@kasari
kasari / timer.go
Last active February 22, 2019 09:24
雑に実行時間を計測したいときのスニペット
package main
import (
"fmt"
"time"
)
func main() {
timer := func(tag string) func() {
start := time.Now()
@kasari
kasari / DualGrabbable.cs
Last active January 1, 2019 12:53
両手によるtransform操作コンポーネント for VIVE Input Utility
using UnityEngine;
using HTC.UnityPlugin.ColliderEvent;
using HTC.UnityPlugin.Utility;
public class DualGrabbable : MonoBehaviour
, IColliderEventDragStartHandler
, IColliderEventDragUpdateHandler
, IColliderEventDragEndHandler
{
public class Grabber
package main
import (
"image"
"gocv.io/x/gocv"
)
func main() {
webcam, err := gocv.OpenVideoCapture(0)
@kasari
kasari / auto_kujibiki.rb
Created March 4, 2018 07:58
くじ引きサイクルでクルクルするのに疲れたときに使うスクリプト
TOP_RIGHT = {x: 1130, y: 530}
def diff(x, y)
return "#{TOP_RIGHT[:x] + x},#{TOP_RIGHT[:y] + y}"
end
PRE_PROCESS = [
"c:#{diff(0,0)}",
"c:#{diff(0,0)}",
"c:#{diff(0,0)}",