跳至主要內容

RectAreaLightHelper

yisky小于 1 分钟组件文档组件助手平面光助手RectAreaLightHelper

RectAreaLightHelper——平面光助手,用于模拟平面光(RectAreaLight)的辅助渲染组件,如下图所示:

重要

  • 在添加 RectAreaLightHelper 组件前请务必确保实体已经添加 RectAreaLight 组件;
  • RectAreaLightHelper 组件由 @fantasy3d/addons 包提供。

创建

import { Euler, Vector3 } from 'three';
import { RectAreaLight } from '@fantasy3d/core';
import { RectAreaLightHelper } from '@fantasy3d/addons';

const { rootEntity } = scene;

// 在场景根实体上添加平面光组件
const light = rootEntity.addComponent( RectAreaLight, {

  color: '#ffffff',                                 // 平面光颜色
  intensity: 5.0,                                   // 平面光强度
  width: 30.0,                                      // 平面光区域宽度
  height: 20.0,                                     // 平面光区域高度
  position: new Vector3( 0.0, 40.0, 0.0 ),          // 平面光位置
  rotation: new Euler( -Math.PI * 0.5, 0.0, 0.0 )   // 平面光旋转量

} );

// 添加平面光助手
light.addComponent( RectAreaLightHelper );
上次编辑于: