[3.x] Fix GLTF light import

This commit is contained in:
Aaron Franke 2021-09-26 15:56:35 -05:00
parent 8fb06b45d1
commit 674cb947ea
No known key found for this signature in database
GPG key ID: 40A1750B977E56BF
2 changed files with 16 additions and 8 deletions

View file

@ -9,17 +9,25 @@
<methods> <methods>
</methods> </methods>
<members> <members>
<member name="color" type="Color" setter="set_color" getter="get_color" default="Color( 0, 0, 0, 1 )"> <member name="color" type="Color" setter="set_color" getter="get_color" default="Color( 1, 1, 1, 1 )">
The [Color] of the light. Defaults to white. A black color causes the light to have no effect.
</member> </member>
<member name="inner_cone_angle" type="float" setter="set_inner_cone_angle" getter="get_inner_cone_angle" default="0.0"> <member name="inner_cone_angle" type="float" setter="set_inner_cone_angle" getter="get_inner_cone_angle" default="0.0">
The inner angle of the cone in a spotlight. Must be less than or equal to the outer cone angle.
Within this angle, the light is at full brightness. Between the inner and outer cone angles, there is a transition from full brightness to zero brightness. When creating a Godot [SpotLight], the ratio between the inner and outer cone angles is used to calculate the attenuation of the light.
</member> </member>
<member name="intensity" type="float" setter="set_intensity" getter="get_intensity" default="0.0"> <member name="intensity" type="float" setter="set_intensity" getter="get_intensity" default="1.0">
The intensity of the light. This is expressed in candelas (lumens per steradian) for point and spot lights, and lux (lumens per m²) for directional lights. When creating a Godot light, this value is converted to a unitless multiplier.
</member> </member>
<member name="outer_cone_angle" type="float" setter="set_outer_cone_angle" getter="get_outer_cone_angle" default="0.0"> <member name="outer_cone_angle" type="float" setter="set_outer_cone_angle" getter="get_outer_cone_angle" default="0.785398">
The outer angle of the cone in a spotlight. Must be greater than or equal to the inner angle.
At this angle, the light drops off to zero brightness. Between the inner and outer cone angles, there is a transition from full brightness to zero brightness. If this angle is a half turn, then the spotlight emits in all directions. When creating a Godot [SpotLight], the outer cone angle is used as the angle of the spotlight.
</member> </member>
<member name="range" type="float" setter="set_range" getter="get_range" default="0.0"> <member name="range" type="float" setter="set_range" getter="get_range" default="inf">
The range of the light, beyond which the light has no effect. GLTF lights with no range defined behave like physical lights (which have infinite range). When creating a Godot light, the range is clamped to 4096.
</member> </member>
<member name="type" type="String" setter="set_type" getter="get_type" default="&quot;&quot;"> <member name="type" type="String" setter="set_type" getter="get_type" default="&quot;&quot;">
The type of the light. The values accepted by Godot are "point", "spot", and "directional", which correspond to Godot's [OmniLight], [SpotLight], and [DirectionalLight] respectively.
</member> </member>
</members> </members>
<constants> <constants>

View file

@ -42,12 +42,12 @@ protected:
static void _bind_methods(); static void _bind_methods();
private: private:
Color color; Color color = Color(1.0f, 1.0f, 1.0f);
float intensity = 0.0f; float intensity = 1.0f;
String type; String type;
float range = 0.0f; float range = INFINITY;
float inner_cone_angle = 0.0f; float inner_cone_angle = 0.0f;
float outer_cone_angle = 0.0f; float outer_cone_angle = Math_TAU / 8.0f;
public: public:
Color get_color(); Color get_color();