HDAdditionalLightData [ ] m_AdditionalLightDatas ;
AdditionalShadowData [ ] m_AdditionalShaodowDatas ;
// Used to detect if the scale have been changed via the transform component
Vector3 m_OldLightSize ;
bool m_UpdateEmissiveMesh ;
protected override void OnEnable ( )
{
base . OnEnable ( ) ;
m_SerializedAdditionalShadowData . ApplyModifiedProperties ( ) ;
m_SerializedAdditionalLightData . ApplyModifiedProperties ( ) ;
settings . ApplyModifiedProperties ( ) ;
if ( m_UpdateEmissiveMesh )
UpdateEmissiveMesh ( ) ;
}
void DrawFoldout ( SerializedProperty foldoutProperty , string title , Action func )
if ( EditorGUI . EndChangeCheck ( ) )
{
UpdateLightIntensity ( ) ;
UpdateEmissiveMesh ( ) ;
m_UpdateEmissiveMesh = true ;
( ( Light ) target ) . SetLightDirty ( ) ; // Should be apply only to parameter that's affect GI, but make the code cleaner
}
}
GameObject lightGameObject = lightData . gameObject ;
MeshRenderer emissiveMeshRenderer = lightData . GetComponent < MeshRenderer > ( ) ;
MeshFilter emissiveMeshFilter = lightData . GetComponent < MeshFilter > ( ) ;
Light light = lightGameObject . GetComponent < Light > ( ) ;
bool showEmissiveMesh = IsAreaLightShape ( m_LightShape ) & & m_LightShape ! = LightShape . Line & & m_AdditionalLightData . showEmissiveMesh . boolValue ;
}
float areaLightIntensity = 0 ;
lightGameObject . transform . localScale = new Vector3 ( m_Additiona lL ightData. shapeWidth . floatValue , m_Additiona lL ightData. shapeHeight . floatValue , 0 ) ;
lightGameObject . transform . localScale = new Vector3 ( lightData . shapeWidth , lightData . shapeHeight , 0 ) ;
settings . intensity . floatValue ,
m_Additiona lL ightData. shapeWidth . floatValue ,
m_Additiona lL ightData. shapeHeight . floatValue ) ;
light . intensity ,
lightData . shapeWidth ,
lightData . shapeHeight ) ;
break ;
default :
break ;
emissiveMeshRenderer . material = new Material ( Shader . Find ( "HDRenderPipeline/Unlit" ) ) ;
emissiveMeshRenderer . sharedMaterial . SetColor ( "_UnlitColor" , Color . black ) ;
emissiveMeshRenderer . sharedMaterial . SetColor ( "_EmissiveColor" , settings . color . colorValue * areaLightIntensity ) ;
emissiveMeshRenderer . sharedMaterial . SetColor ( "_EmissiveColor" , light . color * areaLightIntensity ) ;
}
}
// Early exit if the light type is not an area
if ( ! IsAreaLightShape ( m_LightShape ) | | target = = null )
if ( ! IsAreaLightShape ( m_LightShape ) | | target = = null | | targets . Length > 1 )
if ( lightSize = = m_OldLightSize )
return ;
switch ( m_LightShape )
{
case LightShape . Rectangle :
default :
break ;
}
UpdateLightIntensity ( ) ;
m_UpdateEmissiveMesh = true ;
m_OldLightSize = lightSize ;
}
// Caution: this function must match the one in HDAdditionalLightData.ConvertPhysicalLightIntensityToLightIntensity - any change need to be replicated
EditorGUI . BeginChangeCheck ( ) ;
settings . DrawColor ( ) ;
if ( EditorGUI . EndChangeCheck ( ) )
UpdateEmissiveMesh ( ) ;
m_UpdateEmissiveMesh = true ;
EditorGUI . BeginChangeCheck ( ) ;
if ( EditorGUI . EndChangeCheck ( ) )
{
UpdateLightIntensity ( ) ;
UpdateEmissiveMesh ( ) ;
m_UpdateEmissiveMesh = true ;
}
settings . DrawBounceIntensity ( ) ;
if ( IsAreaLightShape ( m_LightShape ) )
{
EditorGUI . BeginChangeCheck ( ) ;
EditorGUILayout . PropertyField ( m_AdditionalLightData . showEmissiveMesh ) ;
EditorGUILayout . PropertyField ( m_AdditionalLightData . showEmissiveMesh , s_Styles . showEmissiveMesh ) ;
UpdateEmissiveMesh ( ) ;
m_UpdateEmissiveMesh = true ;
}
if ( m_AdditionalLightData . showAdditionalSettings . boolValue )