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
--- build/three.js 2013-04-29 12:12:34.237944000 +0200 | |
+++ /home/lmg/js/three.js 2013-04-29 13:00:24.276532000 +0200 | |
@@ -35281,18 +35281,14 @@ | |
_gl.clearColor( 1, 1, 1, 1 ); | |
_gl.disable( _gl.BLEND ); | |
- _gl.enable( _gl.CULL_FACE ); | |
- _gl.frontFace( _gl.CCW ); | |
- | |
- if ( _renderer.shadowMapCullFace === THREE.CullFaceFront ) { |
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
// invert U coordinate | |
for( var li in geometry.faceVertexUvs ) | |
for( var fi in geometry.faceVertexUvs[li] ) | |
for( var vi in geometry.faceVertexUvs[li][fi] ) | |
geometry.faceVertexUvs[li][fi][vi].x = 1.0 - geometry.faceVertexUvs[li][fi][vi].x; |
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
// object with shader paths (optinally nested, for better structure) | |
// the paths get replaced with the actual file content. | |
var shaders = { | |
atmoVert: 'glsl/atmo.vert.c', | |
car: { | |
vert: 'glsl/car.vert.c', | |
frag: 'glsl/car.frag.c' | |
} | |
}; |
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
/** | |
* cheap require (using jquery) | |
* loads a script (or scripts, if given an array) and executes it | |
* callbacks for progress and success | |
* won't load a script twice if already loaded (or failed) | |
* @param files | |
* @param callbackProgress | |
* @param callbackSuccess | |
*/ | |
function require(files, callbackProgress, callbackSuccess) { |
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 render() { | |
var t = new Date().getTime() / 1000; // unixtime | |
var dt = clock.getDelta(); | |
dispatchSceneGraphEvent(scene, {type: 'preRender', t: t, dt: dt}); | |
renderer.clear(true, true, true); | |
renderer.render(scene, camera); | |
} |
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 img = document.createElement('img'); | |
img.src = renderer.domElement.toDataURL('image/png'); | |
img.onload = function() { | |
var canvas = document.createElement('canvas'); | |
canvas.width = renderer.domElement.width; | |
canvas.height = renderer.domElement.height; | |
var ctx = canvas.getContext('2d'); | |
ctx.drawImage(img, 0, 0, img.naturalWidth, img.naturalHeight, 0, 0, canvas.width, canvas.height); | |
var imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); | |
} |
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
/** | |
* create a geometry suitable for a THREE.Line of type THREE.LineStrip from a sphere | |
* thereby not displaying triangle-edges of a sphere wireframe. | |
* @param {THREE.SphereGeometry} geoSphere | |
* @returns {THREE.Geometry} | |
*/ | |
function lineStripGeometryFromSphereGeometry(geoSphere) { | |
var geoLine = new THREE.Geometry(), | |
w = geoSphere.widthSegments, h = geoSphere.heightSegments, | |
x, y; |
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
uniforms.time = { type: 'f', get value() { return performance.now()/1000 } }; |
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
/** | |
* hexagon geometry - evenly subdivided | |
* @param radius | |
* @param {int=} segments - subdivisions | |
* @param {Number=} theta - default "pointy top" (Math.PI/2 for "flat top") | |
* @constructor | |
* @author lmg / https://github.com/kishalmi | |
*/ | |
THREE.HexGeometry = function (radius, segments, theta) { |
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
/** | |
* split a (loaded) model into mesh parts by material index | |
* @param {THREE.Geometry} geometry | |
* @param {Array<THREE.Material>} materials | |
* @returns {Array<THREE.Mesh>} | |
*/ | |
var splitByMaterial = function(geometry,materials) { | |
var parts = [], | |
geo, vMap, iMat, | |
addPart = function() { |
OlderNewer