The THREEg addon is used to create special / extended geometries.
The addon generates non indexed BufferGeometries. This allows an explosion representation.
The first geometry in THREEg is an enlarged sphere. It is made up of eight parts. Multi material is supported.
geometry = new THREE.BufferGeometry();
geometry.createMagicSphere = THREEg.createMagicSphere; // insert the methode from THREEg.js
geometry.createMagicSphere( parameters ); // apply the methode
// mesh
mesh = new THREE.Mesh( geometry, materials );
scene.add( mesh );
Example:
geometry = new THREE.BufferGeometry();
geometry.createMagicSphere = THREEg.createMagicSphere; // insert the methode from THREEg.js
geometry.createMagicSphere( {
equator: 8,
contourmode: 'bezier',
parts: [ 1, 1, 1, 0, 0, 1, 1, 1 ],
radius: function( t ){ return 1.2 * ( 0.3 + Math.abs( Math.sin( 0.4 * t ) ) ) },
pointX: function( t ){ return 0.6 * ( 1 + Math.sin( 0.4 * t) ) },
pointY: function( t ){ return 0.4 * ( 1 + Math.sin( 0.3 * t) ) },
} );
Since there are not as many parameters as THREEf and THREEp, I created a very simple sandbox.
On my side http://sandbox.threejs.hofk.de/ or directly http://sandboxthreeg.threejs.hofk.de/
Here you can add any number of parameter variants if you save the page locally. If you use Firefox, you get the textures locally without any manipulations. It is possible that parameters may still be retrofitted.
Further details are given on GitHub. https://github.com/hofk/THREEg.js
More detailed information unfortunately only in German on
http://xprofan.net/intl/de/php,html,js/3d-grafik-webgl-mit-three-js/?q=94489&pg=-1#94489
The next geometry in THREEg will be a magic box.