Skip to content

Instantly share code, notes, and snippets.

@satori99
satori99 / flag.json
Last active August 29, 2015 14:09
Flag.json (BufferGeometry w/ Morph Animation)
{
"metadata": {
"type": "Object",
"version": 4.3,
"generator": "Blender Three.js Object Exporter"
},
"materials": [{
"name": "FlagMaterial",
"type": "MeshPhongMaterial",
"uuid": "066f0672-aae2-58a9-8d6b-71f9df941403",
@satori99
satori99 / rc4.js
Last active August 29, 2015 14:24
A seedable psuedo-random number generator for browser use
(function(){
/**
* rc4.js - A fast seedable psuedo-random number generator
* @public
* @class
* @param {string} [seed] - seed. IF specified, the first 256 chars will
* be used to seed the RC4 PRNG, otherwise a random character
* string will used.
* @example
@satori99
satori99 / prng.js
Created September 9, 2015 02:20
Replaces Math.random() with a seedable pseudo-random number function
/*
* A seedable (deterministic) psuedo-random number generator
*
* This script replaces native Math.random() with a deterministic psuedo-random
* number generator. It also adds a static method to reset the prng stream and
* optionally set a new seed string.
*
* @function random
* @memberof Math
* @description Generates a deterministic psuedo-random number between zero and one
@satori99
satori99 / cube.json
Last active November 6, 2015 12:21
BufferGeometry Cube with MultiMaterial faces
{
"metadata": {
"version": 4.3,
"type": "Object",
"description": "BufferGeometry Cube Mesh with 6 Materials"
},
"object": {
"uuid": "89529CC6-CBAC-412F-AFD1-FEEAE785BA19",
"name": "Cube",
"type": "Mesh",
import bpy
arm = bpy.data.objects["Armature"]
bones = set(b.name for b in arm.data.bones if b.use_deform)
for action in bpy.data.actions:
supported = not bool(set(g.name for g in action.groups).difference(bones))
print("arm '%s' can be animated by action '%s' %s" % (arm.name, action.name, supported))
@satori99
satori99 / DefaultMan.json
Last active December 15, 2015 08:12
Default makehuman mesh in THree.js Object Format 4
This file has been truncated, but you can view the full file.
{
"metadata": {
"name": "Default MakeHuman Mesh",
"type": "Object",
"version": 4.4,
"description": "This is a MakeHuman mesh, animated in Blender, and rendered with Three.js",
"_objects": 25,
"_skeletons": 1,
"_geometries": 20,
"_materials": 10,
@satori99
satori99 / skinned_cube.json
Last active January 20, 2016 23:41
Animated Skinned Indexed BufferGeometry example
{
"metadata": {
"name": "Scene",
"type": "Object",
"version": 4.4
},
"object": {
"uuid": "d39bc990-9ccd-5e37-aa40-de2cff47cedb",
"name": "Scene",
"type": "Scene",
@satori99
satori99 / scene-a.json
Created August 17, 2016 12:43
Test scenes
{
"metadata": {
"name": "Scene A",
"type": "Object",
"version": 4.4
},
"object": {
},
"materials": [
@satori99
satori99 / three.js
Last active August 18, 2016 00:42
three.js cubetexture test build
This file has been truncated, but you can view the full file.
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.THREE = global.THREE || {})));
}(this, (function (exports) { 'use strict';
// Polyfills
if ( Number.EPSILON === undefined ) {
if ( group.userData.bones !== undefined ) {
armature = group
var bones = createBones( armature, group.userData.bones )
armature.updateMatrixWorld()
armature.userData.skeleton = new THREE.Skeleton( bones, undefined, true )