namespace UnityEditor.Experimental.Rendering.HDPipeline
{
using _ = CoreEditorUtils ;
//Skin
internal static Color k_GizmoThemeColorProjectionFace = new Color ( 0 x00 / 2 5 5f , 0 xE5 / 2 5 5f , 0 xFF / 2 5 5f , 0 x20 / 2 5 5f ) ;
internal static Color k_GizmoThemeColorDisabled = new Color ( 0 x99 / 2 5 5f , 0 x89 / 2 5 5f , 0 x59 / 2 5 5f , 0 x10 / 2 5 5f ) ;
internal static Color k_GizmoThemeColorDisabledFace = new Color ( 0 x99 / 2 5 5f , 0 x89 / 2 5 5f , 0 x59 / 2 5 5f , 0 x10 / 2 5 5f ) ;
//internal static Color k_GizmoThemeColorProjectionFace = new Color(0x00 / 255f, 0xE5 / 255f, 0xFF / 255f, 0x20 / 255f);
//internal static Color k_GizmoThemeColorDisabled = new Color(0x99 / 255f, 0x89 / 255f, 0x59 / 255f, 0x10 / 255f);
//internal static Color k_GizmoThemeColorDisabledFace = new Color(0x99 / 255f, 0x89 / 255f, 0x59 / 255f, 0x10 / 255f);
internal static GUIContent shapeContent = CoreEditorUtils . GetContent ( "Shape|The shape of the Proxy.\nInfinite is compatible with any kind of InfluenceShape." ) ;
internal static GUIContent boxSizeContent = CoreEditorUtils . GetContent ( "Box Size|The size of the box." ) ;
internal static GUIContent sphereRadiusContent = CoreEditorUtils . GetContent ( "Sphere Radius|The radius of the sphere." ) ;
//logic
public static readonly CED . IDrawer SectionShapeBox = CED . Action ( Drawer_SectionShapeBox ) ;
public static readonly CED . IDrawer SectionShapeSphere = CED . Action ( Drawer_SectionShapeSphere ) ;
) ;
}
public BoxBoundsHandle boxProjectionHandle = new BoxBoundsHandle ( ) ;
public SphereBoundsHandle sphereProjectionHandle = new SphereBoundsHandle ( ) ;
public ProxyVolumeUI ( )
: base ( k_ShapeCount )
{
return m_AnimBools [ ( int ) shapeType ] ;
}
//gizmo
public static void DrawGizmos ( Transform transform , ProxyVolume proxyVolume )
{
switch ( proxyVolume . shape )
{
case ProxyShape . Box :
Gizmos_Box ( transform , proxyVolume ) ;
break ;
case ProxyShape . Sphere :
Gizmos_Sphere ( transform , proxyVolume ) ;
break ;
}
}
static void Gizmos_Sphere ( Transform t , ProxyVolume d )
{
var mat = Gizmos . matrix ;
Color col = Gizmos . color ;
Gizmos . matrix = t . localToWorldMatrix ;
Gizmos . color = k_GizmoThemeColorProjection ;
Gizmos . DrawWireSphere ( Vector3 . zero , d . sphereRadius ) ;
Gizmos . color = col ;
Gizmos . matrix = mat ;
}
static void Gizmos_Box ( Transform t , ProxyVolume d )
{
var mat = Gizmos . matrix ;
Color col = Gizmos . color ;
Gizmos . matrix = t . localToWorldMatrix ;
Gizmos . color = k_GizmoThemeColorProjection ;
Gizmos . DrawWireCube ( Vector3 . zero , d . boxSize ) ;
Gizmos . color = col ;
Gizmos . matrix = mat ;
}
//handles
public BoxBoundsHandle boxProjectionHandle = new BoxBoundsHandle ( ) ;
public SphereBoundsHandle sphereProjectionHandle = new SphereBoundsHandle ( ) ;
EditorGUILayout . PropertyField ( d . shape , _ . GetContent ( "Shape Type" ) ) ;
EditorGUILayout . PropertyField ( d . shape , shapeContent ) ;
EditorGUILayout . PropertyField ( d . boxSize , _ . GetContent ( "Box Size" ) ) ;
EditorGUILayout . PropertyField ( d . boxSize , boxSizeContent ) ;
EditorGUILayout . PropertyField ( d . sphereRadius , _ . GetContent ( "Sphere Radius" ) ) ;
EditorGUILayout . PropertyField ( d . sphereRadius , sphereRadiusContent ) ;
}
public static void DrawHandles_EditBase ( Transform transform , ProxyVolume proxyVolume , ProxyVolumeUI ui , Object sourceAsset )
Handles_EditBase_Sphere ( transform , proxyVolume , ui , sourceAsset ) ;
break ;
}
}
public static void DrawHandles_EditNone ( Transform transform , ProxyVolume proxyVolume , ProxyVolumeUI ui , Object sourceAsset )
{
}
static void Handles_EditBase_Sphere ( Transform transform , ProxyVolume proxyVolume , ProxyVolumeUI s , Object sourceAsset )
Matrix4x4 mat = Matrix4x4 . TRS ( transform . position , transform . rotation , Vector3 . one ) ;
var mat = Handles . matrix ;
Handles . matrix = Matrix4x4 . TRS ( transform . position , transform . rotation , Vector3 . one ) ;
Handles . color = k_GizmoThemeColorProjection ;
s . sphereProjectionHandle . DrawHandle ( ) ;
using ( new Handles . DrawingScope ( k_GizmoThemeColorProjection , mat ) )
{
s . sphereProjectionHandle . DrawHandle ( ) ;
}
if ( EditorGUI . EndChangeCheck ( ) )
{
Undo . RecordObject ( sourceAsset , "Modified Projection Volume" ) ;
EditorUtility . SetDirty ( sourceAsset ) ;
}
Handles . matrix = mat ;
}
static void Handles_EditBase_Box ( Transform transform , ProxyVolume proxyVolume , ProxyVolumeUI s , Object sourceAsset )
var mat = Handles . matrix ;
Handles . matrix = Matrix4x4 . TRS ( transform . position , transform . rotation , Vector3 . one ) ;
Matrix4x4 mat = Matrix4x4 . TRS ( transform . position , transform . rotation , Vector3 . one ) ;
Handles . color = k_GizmoThemeColorProjection ;
s . boxProjectionHandle . DrawHandle ( ) ;
using ( new Handles . DrawingScope ( k_GizmoThemeColorProjection , mat ) )
{
s . boxProjectionHandle . DrawHandle ( ) ;
}
if ( EditorGUI . EndChangeCheck ( ) )
{
Undo . RecordObject ( sourceAsset , "Modified Projection Volume AABB" ) ;
EditorUtility . SetDirty ( sourceAsset ) ;
}
Handles . matrix = mat ;
}
public static void DrawGizmos_EditNone ( Transform transform , ProxyVolume proxyVolume , ProxyVolumeUI ui , Object sourceAsset )
{
switch ( proxyVolume . shape )
{
case ProxyShape . Box :
Gizmos_EditNone_Box ( transform , proxyVolume , ui , sourceAsset ) ;
break ;
case ProxyShape . Sphere :
Gizmos_EditNone_Sphere ( transform , proxyVolume , ui , sourceAsset ) ;
break ;
}
}
static void Gizmos_EditNone_Sphere ( Transform t , ProxyVolume d , ProxyVolumeUI s , Object o )
{
var mat = Gizmos . matrix ;
Gizmos . matrix = Matrix4x4 . TRS ( t . position , t . rotation , Vector3 . one ) ;
Gizmos . color = k_GizmoThemeColorProjection ;
Gizmos . DrawWireSphere ( Vector3 . zero , d . sphereRadius ) ;
Gizmos . matrix = mat ;
}
static void Gizmos_EditNone_Box ( Transform t , ProxyVolume d , ProxyVolumeUI s , Object o )
{
var mat = Gizmos . matrix ;
Gizmos . matrix = Matrix4x4 . TRS ( t . position , t . rotation , Vector3 . one ) ;
Gizmos . color = k_GizmoThemeColorProjection ;
Gizmos . DrawWireCube ( Vector3 . zero , d . boxSize ) ;
Gizmos . matrix = mat ;
}
}
}