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
public class AsyncError { | |
public string Message { get; private set; } | |
public AsyncError(string _message) { | |
Message = _message; | |
} | |
} |
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
// Copy that into MeshPlayground | |
// http://grifdail.fr/MeshPlayground/ | |
var box = new Box(1); | |
const sphereVolume = (radius, center) => (x,y,z) => sqrt((x-center.x)*(x-center.x)+(y-center.y)*(y-center.y)+(z-center.z)*(z-center.z))<radius; | |
const mainSphere = sphereVolume(0.4, Vector3.one().scale(0.5)); | |
const holeSphere = sphereVolume(0.7, Vector3.one().scale(1)); | |
const holeSphere2 = sphereVolume(0.3, new Vector3(0.3,0.3,0.6)); |
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
// Pico 8 colors for processing | |
color BLACK = #000000; | |
color DARK_BLUE = #1D2B53; | |
color DARK_PURPLE = #7E2553; | |
color DARK_GREEN = #008751; | |
color BROWN = #AB5236; | |
color DARK_GRAY = #5F574F; | |
color LIGHT_GRAY = #C2C3C7; | |
color WHITE = #FFF1E8; |
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
//very inneficient | |
PVector[] PoissonDiskGenerate(int count, PVector range, int sample) { | |
PVector[] list = new PVector[count]; | |
for(int i =0; i<count; i++) { | |
PVector[] samples = new PVector[sample]; | |
float[] distances = new float[sample]; | |
for(int j = 0; j<sample; j++) { | |
PVector newPoint = new PVector(random(range.x), random(range.y)); | |
samples[j] = newPoint; | |
//Get the distance to the nearest point |
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
class TextureGradient { | |
public color[] pixels; | |
TextureGradient(String name) { | |
PImage background = loadImage(name); | |
background.loadPixels(); | |
pixels = background.pixels; | |
} | |
color get(float t) { |
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 UnityEngine; | |
using UnityEditor; | |
using System.Collections; | |
public class PyramidGenerator : ScriptableWizard | |
{ | |
public int size = 4; | |
public bool flat = true; |
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
/* | |
Input.jump = { | |
key: 32//Space | |
gamepad: 0// A button on as XBOX360 gamepad | |
} | |
dont forget to call | |
Input.update(); | |
at the end of each frame. |
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 RayCastCamera(fov,resolution) { | |
this.fov = fov; | |
this.resolution = resolution; //How Many ray should we cast and draw; | |
} | |
RayCastCamera.prototype.render = function(map, pos, angle, walls) { | |
ctx.fillStyle = "black"; | |
ctx.fillRect(0,0,width,height*0.5); //The Top of the Screen is black | |
ctx.fillStyle = "grey"; | |
ctx.fillRect(0,height*0.5,width,height*0.5); // The bottom is grey |
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
var gulp = require('gulp'), | |
babel = require('gulp-babel'), | |
livereload = require('gulp-livereload'), | |
http = require('http'), | |
st = require('st'), | |
transform = require('vinyl-transform'), | |
browserify = require('browserify'); | |
gulp.task('js', ["es6"],function() { |
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 UnityEngine; | |
using System.Collections; | |
public class CameraControl : MonoBehaviour { | |
public float translateScale = 20; | |
public float rotateScale = 1; | |
public float zoomScale = 100; | |
private Vector3 _lastHitPoint; |