private static DrawImageBasedCap ( int controlID, Vector3 position, |
||
controlID | int | |
position | Vector3 | |
rotation | ||
size | float | |
normal | ||
active | ||
Résultat | void |
private static void DrawImageBasedCap(int controlID, Vector3 position, Quaternion rotation, float size, GUIStyle normal, GUIStyle active)
{
if ((Camera.current == null) || (Vector3.Dot(position - Camera.current.transform.position, Camera.current.transform.forward) >= 0f))
{
Vector3 vector = (Vector3) HandleUtility.WorldToGUIPoint(position);
Handles.BeginGUI();
float fixedWidth = normal.fixedWidth;
float fixedHeight = normal.fixedHeight;
Rect rect = new Rect(vector.x - (fixedWidth / 2f), vector.y - (fixedHeight / 2f), fixedWidth, fixedHeight);
if (GUIUtility.hotControl == controlID)
{
active.Draw(rect, GUIContent.none, controlID);
}
else
{
normal.Draw(rect, GUIContent.none, controlID);
}
Handles.EndGUI();
}
}
public static void PivotCap(int controlID, Vector3 position, Quaternion rotation, float size) { if (RectHandles.s_Styles == null) { RectHandles.s_Styles = new RectHandles.Styles(); } RectHandles.DrawImageBasedCap(controlID, position, rotation, size, RectHandles.s_Styles.pivotdot, RectHandles.s_Styles.pivotdotactive); }