three.js HemisphereLight

2023-02-16 17:42 更新

光源直接放置于場景之上,光照顏色從天空光線顏色漸變到地面光線顏色。

半球光不能投射陰影。

代碼示例

const light = new THREE.HemisphereLight( 0xffffbb, 0x080820, 1 );
scene.add( light );

例子

animation / skinning / blending

lights / hemisphere

controls / pointerlock

loader / collada / kinematics

loader / stl

構(gòu)造器(Constructor)

HemisphereLight( skyColor : Integer, groundColor : Integer, intensity : Float )

skyColor - (可選參數(shù)) 天空中發(fā)出光線的顏色。 缺省值 0xffffff。
groundColor - (可選參數(shù)) 地面發(fā)出光線的顏色。 缺省值 0xffffff。
intensity - (可選參數(shù)) 光照強度。 缺省值 1。

創(chuàng)建一個半球光。

屬性(Properties)

公共屬性請查看基類Light。

.castShadow : Boolean

該參數(shù)在構(gòu)造時被設(shè)置為 undefined 因為半球光不能投射陰影。

.color : Float

在構(gòu)造時傳遞的天空發(fā)出光線的顏色。 默認會創(chuàng)建 Color 并設(shè)置為白色(0xffffff)。

.groundColor : Float

在構(gòu)造時傳遞的地面發(fā)出光線的顏色。 默認會創(chuàng)建 Color 并設(shè)置為白色(0xffffff)。

.isHemisphereLight : Boolean

只讀標(biāo)志,用于檢查給定對象是否為 HemisphereLight 類型。

.position : Vector3

假如這個值設(shè)置等于 Object3D.DefaultUp (0, 1, 0),那么光線將會從上往下照射。

方法(Methods)

公共方法請查看基類 Light。

.copy ( source : HemisphereLight ) : this

從source復(fù)制 color, intensity 和 groundColor 的值到當(dāng)前半球光對象中。

源碼

src/lights/HemisphereLight.js


以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號