[page:Mesh] →

镜头光晕([name])

创建一个模拟追踪着灯光的镜头光晕。 [name] can only be used when setting the *alpha* context parameter of [page:WebGLRenderer] to *true*.

代码示例

const light = new THREE.PointLight( 0xffffff, 1.5, 2000 ); const textureLoader = new THREE.TextureLoader(); const textureFlare0 = textureLoader.load( "textures/lensflare/lensflare0.png" ); const textureFlare1 = textureLoader.load( "textures/lensflare/lensflare2.png" ); const textureFlare2 = textureLoader.load( "textures/lensflare/lensflare3.png" ); const lensflare = new Lensflare(); lensflare.addElement( new LensflareElement( textureFlare0, 512, 0 ) ); lensflare.addElement( new LensflareElement( textureFlare1, 512, 0 ) ); lensflare.addElement( new LensflareElement( textureFlare2, 60, 0.6 ) ); light.add( lensflare );

例子

[example:webgl_lensflares WebGL / lensflares]

Constructor

LensflareElement( [param:Texture texture], [param:Float size], [param:Float distance], [param:Color color] )

[page:Texture texture] - 用于光晕的THREE.Texture(贴图)
[page:Float size] - (可选)光晕尺寸(单位为像素)
[page:Float distance] - (可选)和光源的距离值在0到1之间(值为0时在光源的位置)
[page:Color color] - (可选)光晕的([page:Color])颜色

属性

请参阅其基类[page:Mesh]来了解共有属性。

源代码

[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/objects/Lensflare.js examples/jsm/objects/Lensflare.js]