Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

GLTFLight

继承: Resource < RefCounted < Object

代表 GLTF 灯光。

描述

代表由 KHR_lights_punctual GLTF 扩展定义的灯光。

教程

属性

Color

color

Color(1, 1, 1, 1)

float

inner_cone_angle

0.0

float

intensity

1.0

String

light_type

""

float

outer_cone_angle

0.785398

float

range

inf

方法

GLTFLight

from_dictionary ( Dictionary dictionary ) static

GLTFLight

from_node ( Light3D light_node ) static

Dictionary

to_dictionary ( ) const

Light3D

to_node ( ) const


属性说明

Color color = Color(1, 1, 1, 1)

  • void set_color ( Color value )

  • Color get_color ( )

灯的 Color。默认为白色。黑色会导致灯光无效。


float inner_cone_angle = 0.0

  • void set_inner_cone_angle ( float value )

  • float get_inner_cone_angle ( )

聚光灯下圆锥体的内角。必须小于等于外锥角。

在这个角度内,光线处于全亮状态。在内锥角和外锥角之间,存在一个从全亮度到零亮度的过渡。创建 Godot SpotLight3D 时,内外锥角之间的比率将被来计算光的衰减。


float intensity = 1.0

  • void set_intensity ( float value )

  • float get_intensity ( )

光的强度。对于点光和聚光,用烛光(流明/立体光)表示;对于平行光,用勒克斯(流明/平方米)表示。在创建 Godot 灯光时,这个值会被转换为无单位的乘数。


String light_type = ""

  • void set_light_type ( String value )

  • String get_light_type ( )

灯光的类型。Godot接受的值有“point”、“spot”、“directional”,分别对应 Godot 的 OmniLight3DSpotLight3DDirectionalLight3D


float outer_cone_angle = 0.785398

  • void set_outer_cone_angle ( float value )

  • float get_outer_cone_angle ( )

聚光灯下圆锥体的外角。必须大于等于内锥角。

在这个角度,光线会下降到零亮度。在内锥角和外锥角之间,存在一个从全亮度到零亮度的过渡。如果这个角度是一个半圆,那么聚光灯会向所有方向发射。创建一个 Godot SpotLight3D 时,外锥角被用作聚光灯的角度。


float range = inf

  • void set_range ( float value )

  • float get_range ( )

灯光的范围,超过这个范围灯光无效。没有定义范围的 GLTF 灯光的行为与无限范围的物理灯光一样。当创建 Godot 灯光时,范围限制在 4096。


方法说明

GLTFLight from_dictionary ( Dictionary dictionary ) static

通过解析给定的 Dictionary 新建 GLTFLight 实例。


GLTFLight from_node ( Light3D light_node ) static

从给定的 Godot Light3D 节点新建 GLTFLight 实例。


Dictionary to_dictionary ( ) const

将这个 GLTFLight 实例序列化为 Dictionary


Light3D to_node ( ) const

将这个 GLTFLight 实例转换为 Godot Light3D 节点。