( position, normal, color )
| 13795 | } |
| 13796 | |
| 13797 | function calculateLight( position, normal, color ) { |
| 13798 | |
| 13799 | for ( var l = 0, ll = _lights.length; l < ll; l ++ ) { |
| 13800 | |
| 13801 | var light = _lights[ l ]; |
| 13802 | |
| 13803 | _lightColor.copy( light.color ); |
| 13804 | |
| 13805 | if ( light instanceof THREE.DirectionalLight ) { |
| 13806 | |
| 13807 | var lightPosition = _vector3.getPositionFromMatrix( light.matrixWorld ).normalize(); |
| 13808 | |
| 13809 | var amount = normal.dot( lightPosition ); |
| 13810 | |
| 13811 | if ( amount <= 0 ) continue; |
| 13812 | |
| 13813 | amount *= light.intensity; |
| 13814 | |
| 13815 | color.add( _lightColor.multiplyScalar( amount ) ); |
| 13816 | |
| 13817 | } else if ( light instanceof THREE.PointLight ) { |
| 13818 | |
| 13819 | var lightPosition = _vector3.getPositionFromMatrix( light.matrixWorld ); |
| 13820 | |
| 13821 | var amount = normal.dot( _vector3.subVectors( lightPosition, position ).normalize() ); |
| 13822 | |
| 13823 | if ( amount <= 0 ) continue; |
| 13824 | |
| 13825 | amount *= light.distance == 0 ? 1 : 1 - Math.min( position.distanceTo( lightPosition ) / light.distance, 1 ); |
| 13826 | |
| 13827 | if ( amount == 0 ) continue; |
| 13828 | |
| 13829 | amount *= light.intensity; |
| 13830 | |
| 13831 | color.add( _lightColor.multiplyScalar( amount ) ); |
| 13832 | |
| 13833 | } |
| 13834 | |
| 13835 | } |
| 13836 | |
| 13837 | } |
| 13838 | |
| 13839 | function renderParticle( v1, element, material ) { |
| 13840 |
no outgoing calls
no test coverage detected