This file contains hidden or 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
| // obj の情報はここに書いてある | |
| // https://ja.wikipedia.org/wiki/Wavefront_.obj%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB | |
| export default async function loadObj(path) { | |
| const response = await fetch(path); | |
| const text = await response.text(); | |
| const lines = text.split('\n'); | |
| // webgl用のデータ群 | |
| const positions = []; |
This file contains hidden or 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
| /** | |
| * usage | |
| * | |
| * const worker = new FunctionWorker(() => { | |
| * self.onmessage = (e) => { | |
| * postMessage(e); | |
| * } | |
| * }); | |
| * | |
| */ |
This file contains hidden or 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
| #!/bin/sh | |
| set -e | |
| PYTHON_MAJOR_VERSION=`python -c 'import sys; print(sys.version_info.major)'` | |
| ABSPATH=$(cd "$(dirname "$0")"; pwd -P) | |
| if [ "$PYTHON_MAJOR_VERSION" = "3" ]; then | |
| cd $ABSPATH | |
| python -m http.server 8000 |
This file contains hidden or 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; | |
| using UnityEngine; | |
| using UnityEditor; | |
| using UnityEditor.Rendering.Universal.ShaderGUI; | |
| class CustomLitShader : BaseShaderGUI | |
| { | |
| // Properties | |
| private LitGUI.LitProperties litProperties; |
This file contains hidden or 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
| // ------------------------------------------------------------------------------ | |
| // | |
| // ディレクトリ以下の画像、もしくは単一ファイルを一括圧縮するバッチスクリプト | |
| // | |
| // usage: | |
| // $ node minify-images.js [src_path] | |
| // | |
| // ------------------------------------------------------------------------------ | |
| const fs = require("fs"); |
This file contains hidden or 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
| type Func = (time: number, deltaTime?: number) => void; | |
| /** | |
| * rafを管理するクラス。実質、singletonとして使う | |
| * | |
| * @class Ticker | |
| */ | |
| class Ticker { | |
| private funcs: Func[]; |
This file contains hidden or 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
| /** | |
| * 強制的にdomのreflowを発火させる | |
| * | |
| * @export | |
| * @param {HTMLElement} dom | |
| */ | |
| export function reflow(dom: HTMLElement) { | |
| // eslint-disable-next-line no-void | |
| void dom.offsetWidth; | |
| } |
This file contains hidden or 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
| /* eslint-disable no-plusplus */ | |
| // ref: | |
| // https://gist.github.com/gre/1650294#gistcomment-3141432 | |
| // no easing, no acceleration | |
| export const linear = (t: number) => { | |
| return t; | |
| }; | |
| // accelerating from zero velocity | |
| export const easeInQuad = (t: number) => { |
This file contains hidden or 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
| import { Howl, HowlOptions } from "howler"; | |
| import { map } from "lodash"; | |
| const caches = new Map<string | string[], Howl>(); | |
| /** | |
| * howlオブジェクトを生成してキャッシュする。。キャッシュの中にあったらキャッシュを返す | |
| * | |
| * @param {HowlOptions} options | |
| * @returns {(Howl | null)} |
This file contains hidden or 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
| /** | |
| * 画像をリサイズする関数 | |
| * | |
| * @export | |
| * @param {string} imageSrc | |
| * @param {(number | null)} [resizeWidth] | |
| * @param {(number | null)} [resizeHeight] | |
| * @returns {Promise<string>} | |
| */ | |
| export default function resizeImage( |