forked from atteneder/glTFast
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(export): Area light's range value is exported accurately in the E…
…ditor (as shown in the inspector). (atteneder#106) * fix: Light.areaSize is not available in builds, so assume default values.
- Loading branch information
Showing
4 changed files
with
90 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// SPDX-FileCopyrightText: 2024 Unity Technologies and the glTFast authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#if USING_HDRP && !UNITY_2023_2_OR_NEWER | ||
|
||
using UnityEngine; | ||
using UnityEngine.Rendering.HighDefinition; | ||
|
||
namespace GLTFast.Export | ||
{ | ||
static class HDAdditionalLightDataExtensions | ||
{ | ||
/// <summary> | ||
/// In older HDRP versions Light.type may not reflect the actual light type. | ||
/// To get the actual light type, the HDAdditionalLightData component has to be queried. | ||
/// </summary> | ||
/// <param name="lightHd">HDRP specific light component.</param> | ||
/// <returns>The HDRP specific light type or null otherwise.</returns> | ||
public static LightType? TryGetLightType(this HDAdditionalLightData lightHd) | ||
{ | ||
switch (lightHd.type) | ||
{ | ||
case HDLightType.Area: | ||
switch (lightHd.areaLightShape) | ||
{ | ||
case AreaLightShape.Rectangle: | ||
return LightType.Rectangle; | ||
case AreaLightShape.Tube: | ||
case AreaLightShape.Disc: | ||
default: | ||
return LightType.Disc; | ||
} | ||
} | ||
|
||
return null; | ||
} | ||
} | ||
} | ||
#endif |
3 changes: 3 additions & 0 deletions
3
Runtime/Scripts/Export/HDAdditionalLightDataExtensions.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.