Last active
June 9, 2018 09:59
-
-
Save spite/9110247 to your computer and use it in GitHub Desktop.
Revisions
-
spite revised this gist
Feb 20, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -31,4 +31,4 @@ m.copy( eyeGeoL.matrixWorld ); m.multiply( camera.matrixWorldInverse ); var i = new THREE.Matrix4().getInverse( m ); eyeGeoL.material.uniforms.myModelViewMatrixInverse.copy( i ); -
spite revised this gist
Feb 20, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -31,4 +31,4 @@ m.copy( eyeGeoL.matrixWorld ); m.multiply( camera.matrixWorldInverse ); var i = new THREE.Matrix4().getInverse( m ); eyeGeoL.material.uniforms.myMovelViewMatrixInverse.copy( i ); -
spite revised this gist
Feb 20, 2014 . 1 changed file with 6 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -6,13 +6,15 @@ /* on Init(); Add this uniform to your uniforms myModelViewMatrixInverse: { type: 'm4', value: new THREE.Matrix4() } */ material = new THREE.ShaderMaterial({ uniforms: uniforms, vertexShader: document.getElementById( 'vertexShader' ).textContent, fragmentShader: document.getElementById( 'fragmentShader' ).textContent } ); -
spite created this gist
Feb 20, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ /* uniform types: https://github.com/mrdoob/three.js/wiki/Uniforms-types THREE.Matrix4: http://threejs.org/docs/#Reference/Math/Matrix4 https://github.com/mrdoob/three.js/issues/1188 */ /* on Init(); */ material = new THREE.ShaderMaterial({ attributes: { myModelViewMatrixInverse: { type: 'm4', value: new THREE.Matrix4() } }, uniforms: uniforms, vertexShader: document.getElementById( 'vertexShader' ).textContent, fragmentShader: document.getElementById( 'fragmentShader' ).textContent } ); eyeGeoL = new THREE.Mesh(geometry, material ); /* on Render(); camera.matrixWorldInverse * object.matrixWorld => modelViewMatrix the order might be wrong, I never get it right at first try */ var m = new THREE.Matrix4(); m.copy( eyeGeoL.matrixWorld ); m.multiply( camera.matrixWorldInverse ); var i = new THREE.Matrix4().getInverse( m ); eyeGeoL.material.attributes.myMovelViewMatrixInverse.copy( i );