Class LODGroupExtensions
Provides methods that help you to work with LOD groups.
Namespace: Unity.Rendering
Syntax
public static class LODGroupExtensions
Methods
CalculateCurrentLODIndex(float4, Single, float3, ref LODGroupExtensions.LODParams)
Calculates the current LOD index.
Declaration
public static int CalculateCurrentLODIndex(float4 lodDistances, float scale, float3 worldReferencePoint, ref LODGroupExtensions.LODParams lodParams)
Parameters
Type | Name | Description |
---|---|---|
float4 | lodDistances | The distances at which to switch between each LOD. |
Single | scale | The current LOD scale. |
float3 | worldReferencePoint | A world-space reference point to base the LOD index calculation on. |
LODGroupExtensions.LODParams | lodParams | The LOD parameters to use. |
Returns
Type | Description |
---|---|
Int32 | Returns the calculated LOD index. |
CalculateCurrentLODMask(float4, Single, float3, ref LODGroupExtensions.LODParams)
Calculates the current LOD mask.
Declaration
public static int CalculateCurrentLODMask(float4 lodDistances, float scale, float3 worldReferencePoint, ref LODGroupExtensions.LODParams lodParams)
Parameters
Type | Name | Description |
---|---|---|
float4 | lodDistances | The distances at which to switch between each LOD. |
Single | scale | Current scale. |
float3 | worldReferencePoint | A world-space reference point to base the LOD index calculation on. |
LODGroupExtensions.LODParams | lodParams | The LOD parameters to use. |
Returns
Type | Description |
---|---|
Int32 | Returns the calculated LOD mask. |
CalculateLODParams(Camera, Single)
Calculates LOD parameters from a camera.
Declaration
public static LODGroupExtensions.LODParams CalculateLODParams(Camera camera, float overrideLODBias = 0F)
Parameters
Type | Name | Description |
---|---|---|
Camera | camera | The camera to calculate LOD parameters from. |
Single | overrideLODBias | An optional LOD bias to apply. |
Returns
Type | Description |
---|---|
LODGroupExtensions.LODParams | Returns the calculated LOD parameters. |
CalculateLODParams(LODParameters, Single)
Calculates LOD parameters from an LODParameters object.
Declaration
public static LODGroupExtensions.LODParams CalculateLODParams(LODParameters parameters, float overrideLODBias = 0F)
Parameters
Type | Name | Description |
---|---|---|
LODParameters | parameters | The LOD parameters to use. |
Single | overrideLODBias | An optional LOD bias to apply. |
Returns
Type | Description |
---|---|
LODGroupExtensions.LODParams | Returns the calculated LOD parameters. |
CalculateLODSwitchDistance(Single, LODGroup, Int32)
Calculates the LOD switch distance for an LOD group.
Declaration
public static float CalculateLODSwitchDistance(float fieldOfView, LODGroup group, int lodIndex)
Parameters
Type | Name | Description |
---|---|---|
Single | fieldOfView | The field of view angle. |
LODGroup | group | The LOD group. |
Int32 | lodIndex | The LOD index to use. |
Returns
Type | Description |
---|---|
Single | Returns the LOD switch distance. |
GetWorldPosition(LODGroup)
Calculates the world position of an LOD group.
Declaration
public static float3 GetWorldPosition(LODGroup group)
Parameters
Type | Name | Description |
---|---|---|
LODGroup | group | The LOD group. |
Returns
Type | Description |
---|---|
float3 | Returns the world position of the LOD group. |
GetWorldSpaceSize(LODGroup)
Calculates the world size of an LOD group.
Declaration
public static float GetWorldSpaceSize(LODGroup lodGroup)
Parameters
Type | Name | Description |
---|---|---|
LODGroup | lodGroup | The LOD group. |
Returns
Type | Description |
---|---|
Single | Returns the calculated world size of the LOD group. |