//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
//**************** Copyright (c) 2016 Marko Pintera (marko.pintera@gmail.com). All rights reserved. **********************//
using bs;
namespace bs.Editor
{
/** @addtogroup Gizmos
* @{
*/
///
/// Handles drawing of gizmos for the component.
///
internal class ReflectionProbeGizmos
{
///
/// Draws the reflection probe shape.
///
/// Reflection probe to draw gizmos for.
[DrawGizmo(DrawGizmoFlags.Selected)]
private static void Draw(ReflectionProbe reflProbe)
{
Vector3 position = reflProbe.SceneObject.Position;
Gizmos.Color = Color.Yellow;
switch (reflProbe.Type)
{
case ReflectionProbeType.Box:
SceneObject so = reflProbe.SceneObject;
Gizmos.Transform = Matrix4.TRS(so.Position, so.Rotation, Vector3.One);
Vector3 scaledExtents = reflProbe.Extents * so.Scale;
Gizmos.DrawWireCube(Vector3.Zero, scaledExtents);
break;
case ReflectionProbeType.Sphere:
Gizmos.DrawWireSphere(position, reflProbe.Radius);
break;
}
}
///
/// Draws reflection probe icon in scene view.
///
/// Reflection probe to draw the icon for.
[DrawGizmo(DrawGizmoFlags.NotSelected | DrawGizmoFlags.Pickable)]
private static void DrawIcon(ReflectionProbe reflProbe)
{
Gizmos.DrawIcon(reflProbe.SceneObject.Position,
EditorBuiltin.GetSceneViewIcon(SceneViewIcon.ReflectionProbe), false);
}
}
/** @} */
}