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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
python -m SimpleHTTPServer 8080 |
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
var prevModel = null; | |
for (var i = 0; i < numModel; ++i) { | |
var model = models[i]; | |
if (model != prevModel) { | |
gl.useProgram(model.program); | |
model.setupAttr(...); | |
model.setupUniforms(sharedUniforms); | |
} | |
model.setupUniforms(uniqueUniforms); | |
gl.drawElements(model.numVertices); |
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
@echo off | |
setlocal | |
set BAT_DIR=%~dp0 | |
pushd %BAT_DIR% | |
rem --------------------------- | |
rem ~~ | |
rem 2016/xx/xx | |
rem --------------------------- | |
rem ------------- |
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
var material = hit.collider.GetComponent<Renderer>().material; | |
c = material.color; | |
var tex2D = material.mainTexture as Texture2D; | |
if (tex2D != null) { | |
c = c * tex2D.GetPixelBilinear(hit.textureCoord[0], hit.textureCoord[1]); | |
} | |
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 UnityEngine; | |
using System.Collections; | |
public class RayTracer : MonoBehaviour { | |
private Texture2D myCanvas; | |
private Camera mainCamera; | |
// Use this for initialization | |
void Start () { |
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
// c = new Color(1.0f, 1.0f, 1.0f, 1.0f); | |
var material = hit.collider.GetComponent<Renderer>().material; | |
c = material.color; |
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
//---- 各ピクセルの色を,当たったかどうかで変更する ----- | |
var ray = mainCamera.ScreenPointToRay(new Vector3(w, h, 0.0f)); // カメラからのレイの生成 | |
RaycastHit hit; | |
if (Physics.Raycast(ray, out hit)) { | |
c = new Color(1.0f, 1.0f, 1.0f, 1.0f); // 当たった場合は白(当たらない場合は変更なし) | |
} |
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 UnityEngine; | |
using System.Collections; | |
public class RayTracer : MonoBehaviour { | |
private Texture2D myCanvas; | |
// Use this for initialization | |
void Start () { | |
myCanvas = new Texture2D(Screen.width, Screen.height); // ゲーム実行時のスクリーンサイズと同じにしておく |
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 UnityEngine; | |
using System.Collections; | |
// 指定したフレームを任意の解像度で連番PNGに出力するスクリプト for Unity5 | |
// ## メモ: | |
// * モーション付きMMDモデルの再生画像を高解像度でキャプチャして動画を作ります. | |
// * ゲームの解像度と関係なく,指定した解像度の画像を生成できます. | |
// * モーション再生のような自動再生されるようなシーンでしか使えないです.キャプチャしない間のフレームはすごい早く動いちゃいます. | |
// * どの解像度までいけるかは不明です.GPUが確保できるテクスチャサイズに依存するはず. | |
// ## 使い方: |
NewerOlder