This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> | |
<title>Marker Based AR with AR.js and Three.js</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/110/three.js"></script> | |
<script src="https://raw.githack.com/AR-js-org/AR.js/3.1.0/three.js/build/ar.js"></script> | |
</head> | |
<body style='margin: 0px; overflow: hidden;'> | |
<script> |
This file contains 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.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class CornelBoxGenerator : MonoBehaviour | |
{ | |
static readonly string LeftWallName = "Left Wall"; | |
static readonly string RightWallName = "Right Wall"; | |
static readonly string BottomWallName = "Bottom Wall"; |
This file contains 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
// Please run on p5.js Web Editor or OpenProcessing. | |
// https://editor.p5js.org/ | |
// https://www.openprocessing.org/ | |
function randomInSphere() { | |
const cosTheta = -2.0 * Math.random() + 1.0; | |
const sinTheta = Math.sqrt(1.0 - cosTheta * cosTheta); | |
const phi = 2.0 * Math.PI * Math.random(); | |
const radius = Math.pow(Math.random(), 1.0 / 3.0); | |
return [ |
This file contains 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
// Please run on p5.js Web Editor or OpenProcessing. | |
// https://editor.p5js.org/ | |
// https://www.openprocessing.org/ | |
function randomOnSphere() { | |
const cosTheta = -2.0 * Math.random() + 1.0; | |
const sinTheta = Math.sqrt(1.0 - cosTheta * cosTheta); | |
const phi = 2.0 * Math.PI * Math.random(); | |
return [ | |
sinTheta * Math.cos(phi), |
This file contains 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
// Please run on p5.js Web Editor or OpenProcessing. | |
// https://editor.p5js.org/ | |
// https://www.openprocessing.org/ | |
function randomInCircle() { | |
const theta = 2.0 * Math.PI * Math.random(); | |
const radius = Math.sqrt(Math.random()); | |
return [radius * Math.cos(theta), radius * Math.sin(theta)]; | |
} |
This file contains 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
// Please run on p5.js Web Editor or OpenProcessing. | |
// https://editor.p5js.org/ | |
// https://www.openprocessing.org/ | |
function randomOnCircle() { | |
const theta = 2.0 * Math.PI * Math.random(); | |
return [Math.cos(theta), Math.sin(theta)]; | |
} | |
function setup() { |
This file contains 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
function createShader(gl: WebGL2RenderingContext, source: string, type: GLint): WebGLShader { | |
const shader = gl.createShader(type); | |
gl.shaderSource(shader, source); | |
gl.compileShader(shader); | |
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) { | |
throw new Error(gl.getShaderInfoLog(shader) + source); | |
} | |
return shader; | |
} |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utt-8"> | |
<title>Using ArrayBufferView as Texture in WebGL</title> | |
</head> | |
<body> | |
<canvas id="canvas" width="512" height="512"></canvas> | |
<script defer> |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Sample of Using Integer Buffer in WebGL</title> | |
</head> | |
<body> | |
<canvas id="canvas" width="512" height="512"></canvas> | |
<script defer> |
This file contains 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
function binarysearchMinIndex(array, target, from, to) { | |
while (from !== to) { | |
const middle = from + Math.floor((to - from) / 2); | |
if (array[middle] < target) { | |
from = middle + 1; | |
} else { | |
to = middle; | |
} | |
} |
NewerOlder