Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View thorikawa's full-sized avatar

Takahiro "Poly" Horikawa thorikawa

View GitHub Profile
@thorikawa
thorikawa / MobileARShadow.shader
Created January 13, 2022 06:48
透明だけど影を落とすシェーダー
//This is based on a shader from https://alastaira.wordpress.com/2014/12/30/adding-shadows-to-a-unity-vertexfragment-shader-in-7-easy-steps/
Shader "Custom/MobileARShadow"
{
SubShader {
Pass {
Tags { "LightMode" = "ForwardBase" "RenderType"="Opaque" "Queue"="Geometry+1" "ForceNoShadowCasting"="True" }
LOD 150
Blend Zero SrcColor
import os
import sys
dir = sys.argv[1]
up = int(sys.argv[2])
print(dir)
print(up)
for i in range(up):
@thorikawa
thorikawa / Vortices.shader
Created June 8, 2021 18:21
Repeat vortices by ray-marching technique.
Shader "Unlit/Vortices"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Loop ("Loop", Range(1, 100)) = 30
_Color ("Color", Color) = (0.5, 0.5, 0.5, 1.0)
_R1 ("Radius1", Float) = 10.0
_R2 ("Radius2", Float) = 2.0
}
@thorikawa
thorikawa / ARCameraBackground.cs
Created November 5, 2020 15:51
Modified version of ARFoundation 4.1.0 preview9's ARCameraBackground to fix an issue where changes to the CustomMaterial or useCustomMaterial values were not reflected after ARCameraBackground was once set up
using AOT;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine.Rendering;
using UnityEngine.Serialization;
namespace UnityEngine.XR.ARFoundation
{
/// <summary>
@thorikawa
thorikawa / ARCameraBackground.cs
Last active June 17, 2020 12:34
Modified version of ARFoundation 4.0.0 preview3's ARCameraBackground to fix an issue where changes to the CustomMaterial or useCustomMaterial values were not reflected after ARCameraBackground was once set up
using AOT;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine.Rendering;
using UnityEngine.Serialization;
namespace UnityEngine.XR.ARFoundation
{
/// <summary>
static char* getDisplayName(CGDirectDisplayID displayID)
{
io_iterator_t it;
io_service_t service;
CFDictionaryRef info;
if (IOServiceGetMatchingServices(kIOMasterPortDefault,
IOServiceMatching("IODisplayConnect"),
&it) != 0)
{
@thorikawa
thorikawa / LastingStateDetector.cs
Created August 20, 2018 09:11
Unityで状態管理を行うための汎用クラス
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
public delegate void OnStateIsLasting(LastingStateDetector sender, float lastingTime);
public delegate void OnStateEnter(LastingStateDetector sender);
public class LastingStateDetector
{
from PIL import Image, ImageDraw
im = Image.new('RGB', (500, 300), (128, 128, 128))
draw = ImageDraw.Draw(im)
im.save('test.jpg', quality=95)
R_STEP = 4
r = 4
RADIAN_STEP = math.pi * 137.5 / 180.0
@thorikawa
thorikawa / TS3633-CM1.lbr
Last active September 8, 2017 12:59
Eagle Cad Library for Triad’s TS3633-CM1 https://www.triadsemi.com/product/ts3633-cm1/
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE eagle SYSTEM "eagle.dtd">
<eagle version="8.3.0">
<drawing>
<settings>
<setting alwaysvectorfont="no"/>
<setting verticaltext="up"/>
</settings>
<grid distance="0.1" unitdist="inch" unit="inch" style="lines" multiple="1" display="no" altdistance="0.01" altunitdist="inch" altunit="inch"/>
<layers>
@thorikawa
thorikawa / varspeedservoslave.ino
Created February 28, 2017 05:04
Arduino sketch for nanabo
#include <VarSpeedServoSam.h>
VarSpeedServoSam servos[4];
int MAX_SPEED = 50;
int PIN_NO[] = {2, 3, 4, 5};
int MAX_DEGREE[] = {110, 110, 120, 100};
int MIN_DEGREE[] = {70, 90, 80, 80};
int INITIAL_DEGREE[] = {90, 90, 90, 90};
int flag, sid, degree, speed;