Buckets:
| import SpotLightNode from './SpotLightNode.js'; | |
| import { texture } from '../accessors/TextureNode.js'; | |
| import { vec2 } from '../tsl/TSLBase.js'; | |
| /** | |
| * An IES version of the default spot light node. | |
| * | |
| * @augments SpotLightNode | |
| */ | |
| class IESSpotLightNode extends SpotLightNode { | |
| static get type() { | |
| return 'IESSpotLightNode'; | |
| } | |
| /** | |
| * Overwrites the default implementation to compute an IES conform spot attenuation. | |
| * | |
| * @param {Node<float>} angleCosine - The angle to compute the spot attenuation for. | |
| * @return {Node<float>} The spot attenuation. | |
| */ | |
| getSpotAttenuation( angleCosine ) { | |
| const iesMap = this.light.iesMap; | |
| let spotAttenuation = null; | |
| if ( iesMap && iesMap.isTexture === true ) { | |
| const angle = angleCosine.acos().mul( 1.0 / Math.PI ); | |
| spotAttenuation = texture( iesMap, vec2( angle, 0 ), 0 ).r; | |
| } else { | |
| spotAttenuation = super.getSpotAttenuation( angleCosine ); | |
| } | |
| return spotAttenuation; | |
| } | |
| } | |
| export default IESSpotLightNode; | |
Xet Storage Details
- Size:
- 996 Bytes
- Xet hash:
- 5e6d474fdd18febe2dee50f1904c001e684e6fd75ddbe86da8bd1beb8e05c85b
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.