- Some utilities:
sudo apt-get install vim tmux git
- Copy/paste from the command line:
sudo apt-get install xclip
class STL | |
class Writer | |
attr_accessor :tris, :size | |
def initialize tris | |
@tris = tris | |
@size = tris.length*50 + 80 + 4 | |
end | |
def write_stl_header f | |
80.times {|n| f << [0].pack("C") } #uint8 |
class Scene | |
attr_accessor :lights, :objects, :camera | |
def initialize | |
@lights = [] | |
@objects = [] | |
end | |
def add_light light | |
@lights.push light | |
end |
var createEngine = require('voxel-engine') | |
var game = createEngine({ | |
generate: function(x, y, z) { | |
if (x*x + y*y + z*z > 20*20) return 0; | |
return Math.floor(Math.random() * 4) + 1; | |
}, | |
texturePath: './', | |
materials: [ 'dirt', 'grass', 'crate', 'brick' ] | |
}); | |
game.appendTo('#container'); |
var createGame = require('voxel-engine') | |
function sphereWorld(x, y, z) { | |
// return the index of the material you want to show up | |
// 0 is air | |
if (x*x + y*y + z*z > 15*15) return 0 | |
return 3 | |
} | |
var game = createGame({ |
var createGame = require('voxel-engine') | |
function sphereWorld(x, y, z) { | |
// return the index of the material you want to show up | |
// 0 is air | |
if (x*x + y*y + z*z > 15*15) return 0 | |
return 3 | |
} | |
var game = createGame({ |
// From http://www.tannerhelland.com/4435/convert-temperature-rgb-algorithm-code/ | |
// Start with a temperature, in Kelvin, somewhere between 1000 and 40000. (Other values may work, | |
// but I can't make any promises about the quality of the algorithm's estimates above 40000 K.) | |
function colorTemperatureToRGB(kelvin){ | |
var temp = kelvin / 100; |
#http://stackoverflow.com/questions/7553726/blender-how-to-export-shape-keys-using-python | |
#and three js blender exporter | |
import bpy | |
import json | |
# monkeypatch the json encoder to truncate floats | |
# http://stackoverflow.com/questions/1447287/format-floats-with-standard-json-module | |
from json import encoder | |
encoder.FLOAT_REPR = lambda o: format(o, '.15g') |
/** | |
* @author qiao / https://github.com/qiao | |
* @author mrdoob / http://mrdoob.com | |
* @author alteredq / http://alteredqualia.com/ | |
* @author WestLangley / http://github.com/WestLangley | |
* | |
* customized for momentum (zoom and phi/delta) by paulkaplan | |
*/ | |
THREE.OrbitControls = function ( object, domElement ) { |
(function($){ | |
$.fn.sortByMeasurement = function(child_type){ | |
var element = this; | |
if(!child_type) child_type = "li"; | |
var SINGLE_REGEX = /\s*(\d*)?([\.\/])?(\d*)\s*([a-zA-z]*)/; |