Skip to content

Instantly share code, notes, and snippets.

@enjalot
Created April 26, 2013 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enjalot/5469562 to your computer and use it in GitHub Desktop.
Save enjalot/5469562 to your computer and use it in GitHub Desktop.
gnomesayin _wat
{"description":"gnomesayin _wat","endpoint":"","display":"webgl","public":true,"require":[],"fileconfigs":{"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"tough.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":true,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"editor_editor":{"coffee":false,"vim":false,"emacs":false,"width":347,"height":323,"hide":false},"thumbnail":"http://i.imgur.com/8BsdDp9.png"}
// this represents for me the most minimal kind of setup for usable three.js
var container; // , stats;
var camera, cameraControls;
var scene, renderer;
var mesh, light;
var mouseX = 0, mouseY = 0;
//var windowHalfX = window.innerWidth / 2;
//var windowHalfY = window.innerHeight / 2;
init();
function init() {
container = document.getElementById( 'container' );
scene = tributary.scene; //new THREE.Scene();
//camera = new THREE.PerspectiveCamera( 40, window.innerWidth / window.innerHeight, 1, 10000 );
camera = tributary.camera;
camera.position.set(0,0,5);
scene.add( camera );
cameraControls = new THREE.TrackballControls( camera );
light = new THREE.DirectionalLight( 0xffffff );
light.position.set( 0, 0, 1 ).normalize();
scene.add( light );
var loader = new THREE.JSONLoader();
//loader.load( "obj/texturecolors/3d_from_2d_continuation2_sep.js", createScene)
var geometry = loader.createModel(tributary.tough, createScene);
renderer = tributary.renderer // new THREE.WebGLRenderer( { antialias: true } );
//renderer.setSize( window.innerWidth, window.innerHeight );
//container.appendChild( renderer.domElement );
}
function createScene( geometry ) {
//console.log(geometry);
// declaration of materials and then joining them in an array.
var baseMaterial = new THREE.MeshBasicMaterial( {color: 0x34a7ff, wireframe: true});
var wireframeMaterial = new THREE.MeshBasicMaterial( { color: 0xfff890, transparent: true, wireframe: false, opacity: 0.6 } );
var mixMaterial = [baseMaterial, wireframeMaterial];
// necessary to convey to Three that you are in need of a mix material
mesh = new THREE.SceneUtils.createMultiMaterialObject( geometry, mixMaterial );
mesh.rotation.x = 3.141592/2.0;
scene.add( mesh );
}
tributary.run = function(scene, t) {
render();
}
function render() {
cameraControls.update();
renderer.render( scene, camera );
}
{
"metadata" :
{
"formatVersion" : 3,
"generatedBy" : "Blender 2.63 Exporter",
"vertices" : 172,
"faces" : 54,
"normals" : 54,
"colors" : 0,
"uvs" : 172,
"materials" : 1,
"morphTargets" : 0
},
"scale" : 1.000000,
"materials": [ {
"DbgColor" : 15658734,
"DbgIndex" : 0,
"DbgName" : "default",
"vertexColors" : false
}],
"vertices": [-0.770111,0.615778,0.822568,-0.618641,0.495731,0.555974,-1.053200,0.088526,0.359997,0.930079,0.416535,0.748284,0.293798,0.761091,0.349475,-0.445386,0.821402,0.547453,0.440373,0.390948,1.615305,-0.770111,0.615778,0.822568,-0.004091,0.360824,0.506236,-0.618641,0.495731,0.555974,-0.618641,0.495731,0.555974,-0.004091,0.360824,0.506236,0.075330,0.409220,0.493260,-1.053200,0.088526,0.359997,0.158291,0.287156,0.739486,0.068955,0.095870,0.268075,-1.053200,0.088526,0.359997,0.475341,0.894648,-0.106733,-0.595909,0.242798,-0.165487,0.291491,0.704874,0.328389,0.205766,0.167759,-0.050798,-0.530168,0.146604,-0.152338,0.098078,0.215510,-0.262875,0.013929,0.311517,-0.096448,0.475341,0.894648,-0.106733,0.268713,0.524445,-0.213156,0.268713,0.524445,-0.213156,0.286794,0.379045,-0.400546,0.013929,0.311517,-0.096448,0.405146,0.433486,-0.191787,0.286794,0.379045,-0.400546,0.268713,0.524445,-0.213156,0.268713,0.524445,-0.213156,0.475341,0.894648,-0.106733,0.824933,0.210751,-0.252089,0.619030,0.451849,-0.445400,0.824933,0.210751,-0.252089,0.205198,0.051560,-0.494638,1.256379,0.610674,-1.018987,0.793075,0.154078,-0.875759,1.392787,0.404868,-0.837780,1.256379,0.610674,-1.018987,1.392787,0.404868,-0.837780,1.245722,0.341370,-1.149215,1.249486,0.485410,-1.016817,0.988901,0.296293,-1.060242,1.083577,0.139273,-0.937162,0.582478,0.365130,-0.451604,0.205198,0.051560,-0.494638,0.699380,0.159246,-0.671439,0.291491,0.704874,0.328389,1.037415,0.185717,-0.343831,0.475341,0.894648,-0.106733,0.737016,0.336997,-0.633524,0.722903,0.585312,-0.424413,1.037415,0.185717,-0.343831,1.185355,0.141157,-0.856687,1.392787,0.404868,-0.837780,0.793075,0.154078,-0.875759,0.718032,0.249944,-0.537068,1.667994,0.273884,-0.362670,1.981316,0.238419,-0.542907,2.005088,0.136428,-0.631386,1.654385,0.415070,-0.473748,2.068910,0.271851,-0.179840,1.654385,0.415070,-0.473748,1.899484,0.448868,-0.053473,1.443357,0.242796,0.484753,1.899484,0.448868,-0.053473,1.654385,0.415070,-0.473748,1.528159,0.228790,-0.045792,1.585245,0.622640,-0.003622,1.425607,0.480661,-0.430359,1.585245,0.622640,-0.003622,1.672582,0.270639,-0.437363,1.425607,0.480661,-0.430359,1.443357,0.242796,0.484753,1.910774,0.267388,0.149475,1.899484,0.448868,-0.053473,1.500552,-0.073337,0.388114,1.666932,0.146885,0.006740,1.263885,0.133026,-0.260748,2.068910,0.271851,-0.179840,1.569580,0.091437,0.248086,1.946892,0.458336,0.298835,0.613731,-0.083812,-0.362711,0.441160,0.318873,-0.206575,0.733736,0.223274,-0.229316,0.779274,0.249149,-0.270518,1.528159,0.228790,-0.045792,1.573837,0.319444,-0.180144,1.037415,0.185717,-0.343831,0.743218,0.071267,0.027197,0.458525,0.073191,0.254520,0.454740,0.025422,0.408880,0.763100,0.025423,0.711697,0.890911,0.164459,-0.219905,0.872760,0.164459,-0.258074,0.366619,0.229811,0.190874,0.612567,0.316491,0.416311,0.793075,0.154078,-0.875759,0.499995,0.434579,-0.457810,0.722903,0.585312,-0.424413,1.037415,0.185717,-0.343831,1.527066,0.105297,-0.154519,1.541333,0.105297,-0.455724,-0.248240,0.591600,0.584285,-0.466810,0.670229,0.729021,0.440373,0.390948,1.615305,0.951055,0.068337,0.762269,0.293798,0.761091,0.349475,0.930079,0.416535,0.748284,0.286794,0.379045,-0.400546,-0.199761,0.167679,-0.096448,0.013929,0.311517,-0.096448,-0.004091,0.360824,0.506236,0.217243,0.334204,0.513913,-0.595909,0.242798,-0.165487,-0.445386,0.821402,0.547453,-0.770111,0.615778,0.822568,-0.392206,0.620329,0.666667,-0.445386,0.821402,0.547453,-0.523099,0.759317,0.989252,-0.216738,0.569281,0.572404,-0.394318,0.637458,0.715401,-0.523099,0.759317,0.989252,-0.108156,0.332196,0.829865,0.291491,0.704874,0.328389,-0.595909,0.242798,-0.165487,0.217243,0.334204,0.513913,0.274098,0.425032,0.101907,0.710072,0.431508,0.534852,0.517716,0.527231,0.071583,0.127550,0.068337,0.342947,0.951055,0.068337,0.762269,0.342743,0.165781,0.160689,-0.770111,0.615778,0.822568,-0.523099,0.759317,0.989252,-0.392206,0.620329,0.666667,1.037415,0.185717,-0.343831,0.824933,0.210751,-0.252089,0.619030,0.451849,-0.445400,0.722903,0.585312,-0.424413,1.242161,0.312013,-1.285099,0.988901,0.296293,-1.060242,1.249486,0.485410,-1.016817,0.988901,0.296293,-1.060242,1.144798,0.296293,-1.070837,1.151264,0.133266,-1.275781,1.086181,0.280869,-1.342378,1.268433,0.199122,-1.205097,1.088548,0.273791,-1.422853,1.029375,0.475109,-1.455990,1.128785,0.221679,-1.136456,1.120471,0.312013,-1.056249,1.954137,0.312013,-1.332321,1.242161,0.312013,-1.285099,1.088548,0.273791,-1.422853,1.177124,0.208327,-1.244821,1.896365,0.271639,-1.324736,2.027190,0.256253,-1.258973,1.896365,0.271639,-1.324736,1.692991,0.071435,-0.893979,1.838844,0.266146,-1.078714,1.692991,0.071435,-0.893979,2.289975,0.249330,-1.011398,2.074097,0.074165,-1.010438,2.289975,0.249330,-1.011398,2.114547,0.218627,-1.104157,2.289975,0.249330,-1.011398,2.166032,0.071435,-1.045498,1.838844,0.266146,-1.078714],
"morphTargets": [],
"normals": [-0.418043,0.715506,-0.559709,0.240303,0.938810,0.246681,0.178686,0.931150,-0.317759,-0.013550,0.513169,-0.858150,-0.036348,0.928373,-0.369823,-0.520035,0.841334,0.147191,-0.062136,0.966460,0.249153,-0.675924,0.525712,-0.516434,-0.680227,0.545824,-0.489151,0.536546,0.690970,-0.484359,0.067843,0.240455,-0.968261,-0.415937,0.325571,0.849086,-0.271798,0.528153,0.804468,0.874020,0.183020,-0.450056,-0.419446,0.389721,0.819849,-0.384411,0.562944,-0.731620,0.751030,0.427015,0.503555,0.724174,0.467818,-0.506638,0.006256,0.883114,0.469069,0.497604,0.845973,0.191473,0.526048,0.766503,-0.368419,-0.306436,0.946318,0.102603,-0.942381,0.102481,0.318430,0.573229,0.688864,-0.443617,0.394024,0.695883,0.600360,-0.284555,0.878689,0.383251,-0.603656,0.678671,-0.418256,-0.083041,0.424146,-0.901761,-0.341777,0.828791,0.443007,-0.010895,0.993744,0.111087,-0.071993,0.966643,-0.245705,-0.340129,0.652943,-0.676717,0.159215,0.987213,0.007538,0.320719,0.946684,-0.029939,0.530259,-0.002106,-0.847804,-0.532304,0.790826,-0.302011,0.124180,0.952849,-0.276833,0.314310,0.544267,0.777795,0.711875,0.667257,0.218970,0.722953,0.690054,0.032899,-0.601672,0.450606,0.659474,-0.332072,0.886868,0.321116,-0.159185,0.936399,0.312662,-0.197943,0.868435,-0.454482,0.054384,0.429518,0.901395,-0.465133,0.749199,-0.471511,0.576769,0.799036,-0.169866,0.748802,0.662587,0.015351,0.000000,1.000000,0.000000,-0.041597,0.930845,0.362987,-0.086093,0.918363,0.386181,-0.076846,0.715934,0.693899,-0.459731,0.570330,0.680685,0.150121,0.084201,-0.985046],
"colors": [],
"uvs": [[0.954766,0.067545,0.867717,0.040681,0.867857,0.160663,0.000092,0.663595,0.071925,0.900190,0.285224,0.999908,0.285445,0.555742,0.874338,0.950976,0.874004,0.692081,0.820648,0.877378,0.330319,0.483572,0.418486,0.629847,0.410399,0.652144,0.418768,0.314338,0.418768,0.652328,0.285629,0.657352,0.285770,0.999908,0.418952,0.725110,0.536420,0.999908,0.569468,0.725051,0.801094,0.153181,0.739465,0.194873,0.801215,0.377198,0.998898,0.978906,0.998774,0.782507,0.974276,0.908834,0.796647,0.958240,0.735239,0.930605,0.735164,0.999908,0.845326,0.650081,0.796994,0.606636,0.796882,0.662241,0.285445,0.405859,0.181145,0.322892,0.181477,0.555558,0.567536,0.150860,0.567598,0.295666,0.664563,0.186022,0.867717,0.208700,0.933814,0.332545,0.933930,0.160847,0.647886,0.606636,0.647927,0.691896,0.725292,0.650568,0.732083,-0.007285,0.694073,0.057864,0.739281,0.104057,0.919116,0.685449,0.976862,0.640619,0.919080,0.543888,0.734980,0.999908,0.734862,0.692081,0.647886,0.877150,0.087254,0.148829,0.000092,0.145847,0.087170,0.277555,0.797945,0.427780,0.813456,0.377382,0.739465,0.532319,0.813909,0.601357,0.329518,0.159217,0.304877,0.050790,0.287525,0.033506,0.287517,0.157109,0.919080,0.382072,0.919091,0.543704,0.977778,0.412794,0.570165,0.601357,0.664563,0.403431,0.569652,0.295850,0.173430,0.322708,0.285445,0.272475,0.173430,0.178223,0.220374,0.178039,0.285445,0.065577,0.189573,0.065454,0.868047,0.601357,0.918896,0.432471,0.868084,0.382072,0.735164,0.912487,0.820464,0.808613,0.735424,0.692081,0.087941,0.145510,0.087665,0.348039,0.152803,0.273055,0.962263,0.692081,0.874522,0.793432,0.959127,0.800913,0.962385,0.809038,0.974092,0.809222,0.929442,0.823060,0.973636,0.978906,0.545073,0.240952,0.455855,0.308255,0.454845,0.357417,0.545050,0.450217,0.100129,0.351551,0.087907,0.348223,0.087665,0.555558,0.180960,0.542563,0.471410,0.085404,0.420032,0.181611,0.471618,0.240768,0.368231,0.314154,0.418768,0.159401,0.327532,0.159412,0.569652,0.978202,0.647702,0.999908,0.647386,0.601541,0.739281,0.601357,0.739032,0.286552,0.664747,0.526075,0.424500,0.275328,0.418952,0.450217,0.449210,0.398952,0.326801,0.395261,0.285629,0.340634,0.286104,0.652144,0.034962,0.021046,0.077602,0.145663,0.087254,0.020944,0.471802,0.122754,0.545073,0.240768,0.545067,0.085133,0.329838,0.153222,0.418768,0.159217,0.329702,0.042248,0.418952,0.450566,0.484989,0.724867,0.545073,0.450401,0.674855,0.104241,0.697662,0.286368,0.739281,0.135393,0.082295,0.555558,0.082327,0.277739,0.000092,0.527205,0.584476,0.144850,0.664563,0.150676,0.664477,0.048685,0.934182,0.188451,0.934114,0.308810,0.944599,0.332545,0.983656,0.239830,0.796698,0.606636,0.725476,0.682347,0.796573,0.678819,0.824306,0.085674,0.867533,0.065833,0.858094,0.012432,0.824463,-0.004694,0.152803,0.145326,0.129907,0.058748,0.114576,0.029259,0.104785,0.145315,0.867862,0.601357,0.867683,0.332729,0.814094,0.543201,0.814094,0.332545,0.867533,0.297538,0.814176,0.085858,0.999908,0.009647,0.954950,0.009573,0.969135,0.160663,0.874522,0.936976,0.929258,0.989867,0.929144,0.809222,0.854040,0.657682,0.891758,0.606674,0.845510,0.606636,0.739465,0.152997,0.805044,0.150675,0.804886,0.036617]],
"faces": [42,0,1,2,0,0,1,2,0,0,0,43,3,4,5,6,0,3,4,5,6,1,1,1,1,42,7,8,9,0,7,8,9,2,2,2,43,10,11,12,13,0,10,11,12,13,3,3,3,3,42,14,15,16,0,14,15,16,4,4,4,42,17,18,19,0,17,18,19,5,5,5,42,20,22,21,0,20,21,22,6,6,6,42,23,24,25,0,23,24,25,7,7,7,42,26,27,28,0,26,27,28,8,8,8,42,29,30,31,0,29,30,31,9,9,9,42,32,33,34,0,32,33,34,10,10,10,42,35,37,36,0,35,36,37,11,11,11,42,38,39,40,0,38,39,40,12,12,12,42,41,42,43,0,41,42,43,13,13,13,42,44,45,46,0,44,45,46,14,14,14,42,47,49,48,0,47,48,49,15,15,15,42,50,51,52,0,50,51,52,16,16,16,42,53,54,55,0,53,54,55,17,17,17,43,56,57,58,59,0,56,57,58,59,18,18,18,18,43,60,61,62,63,0,60,61,62,63,19,19,19,19,42,64,65,66,0,64,65,66,20,20,20,42,67,68,69,0,67,68,69,21,21,21,42,70,71,72,0,70,71,72,22,22,22,42,73,74,75,0,73,74,75,23,23,23,42,76,77,78,0,76,77,78,24,24,24,42,79,80,81,0,79,80,81,25,25,25,42,82,83,84,0,82,83,84,26,26,26,43,85,86,87,88,0,85,86,87,88,27,27,27,27,42,89,90,91,0,89,90,91,28,28,28,43,92,93,94,95,0,92,93,94,95,29,29,29,29,43,96,97,98,99,0,96,97,98,99,30,30,30,30,42,100,101,102,0,100,101,102,31,31,31,42,103,104,105,0,103,104,105,32,32,32,42,106,107,108,0,106,107,108,33,33,33,42,109,110,111,0,109,110,111,34,34,34,42,112,113,114,0,112,113,114,35,35,35,42,115,116,117,0,115,116,117,36,36,36,42,118,119,120,0,118,119,120,37,37,37,42,121,122,123,0,121,122,123,38,38,38,42,124,125,126,0,124,125,126,39,39,39,42,127,128,129,0,127,128,129,40,40,40,42,130,131,132,0,130,131,132,41,41,41,42,133,134,135,0,133,134,135,42,42,42,42,136,137,138,0,136,137,138,43,43,43,43,139,142,141,140,0,139,140,141,142,44,44,44,44,42,143,144,145,0,143,144,145,45,45,45,43,146,147,148,149,0,146,147,148,149,46,46,46,46,43,150,151,152,153,0,150,151,152,153,47,47,47,47,42,154,155,156,0,154,155,156,48,48,48,42,157,158,159,0,157,158,159,49,49,49,42,160,161,162,0,160,161,162,50,50,50,42,163,164,165,0,163,164,165,51,51,51,42,166,167,168,0,166,167,168,52,52,52,42,169,170,171,0,169,170,171,53,53,53]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment