public static Cube3D operator +(Cube3D cube, Vector3 vector) { Cube3D clone = CloneUtil.CloneDeep(cube); clone.AddWorldOffset(vector); return(clone); }
/// <summary> /// 画bounds /// </summary> /// <param name="bounds"></param> /// <param name="color"></param> /// <param name="duration">持续时间</param> /// <param name="isDepthTest"></param>isDepthTest public static void DebugBounds(Bounds bounds, Color color, float duration = 0, bool isDepthTest = true) { if (!Is_Debug_Enable) { return; } var cube = new Cube3D(bounds.center, bounds.size); cube.GetDrawLineList().ForEach(kv => { DebugLine(kv.Key, kv.Value, color, duration, isDepthTest); }); }
public static void DebugCube(Vector3 min, Vector3 max, Color color, float duration = 0, bool isDepthTest = true) { if (!Is_Debug_Enable) { return; } var cube = new Cube3D((min + max) / 2, (max - min).Abs()); cube.GetDrawLineList().ForEach(kv => { DebugLine(kv.Key, kv.Value, color, duration, isDepthTest); }); }
/// <summary> /// 画bounds /// </summary> /// <param name="bounds"></param> /// <param name="color"></param> public static void HandlesBounds(Bounds bounds, Color color) { if (!Is_Handles_Enable) { return; } using (new HandlesColorScope(color)) { var cube = new Cube3D(bounds.center, bounds.size); cube.GetDrawLineList().ForEach(kv => { HandlesLine(kv.Key, kv.Value, color); }); } }
public static void HandlesCube(Vector3 min, Vector3 max, Color color) { if (!Is_Handles_Enable) { return; } using (new HandlesColorScope(color)) { var cube = new Cube3D((min + max) / 2, (max - min).Abs()); cube.GetDrawLineList().ForEach(kv => { HandlesLine(kv.Key, kv.Value, color); }); } }
/// <summary> /// 画LocalCube /// </summary> /// <param name="matrix"></param> /// <param name="offset"></param> /// <param name="size"></param> /// <param name="color"></param> public static void HandlesLocalCube(Matrix4x4 matrix, Vector3 offset, Vector3 size, Color color) { if (!Is_Handles_Enable) { return; } using (new HandlesColorScope(color)) { var cube = new Cube3D(Vector3.zero, Vector3.one); cube.MultiplyMatrix(Matrix4x4.TRS(offset, Quaternion.identity, size)); cube.PreMultiplyMatrix(matrix); cube.GetDrawLineList().ForEach(kv => { HandlesLine(kv.Key, kv.Value, color); }); } }
/// <summary> /// 画LocalCube /// </summary> /// <param name="transform"></param> /// <param name="offset"></param> /// <param name="size"></param> /// <param name="color"></param> public static void GizmosLocalCube(Transform transform, Vector3 offset, Vector3 size, Color color) { if (!Is_Gizmos_Enable) { return; } using (new GizmosColorScope(color)) { var cube = new Cube3D(Vector3.zero, Vector3.one); cube.MultiplyMatrix(Matrix4x4.TRS(offset, Quaternion.identity, size)); cube.PreMultiplyMatrix(transform.localToWorldMatrix); cube.GetDrawLineList().ForEach(kv => { GizmosLine(kv.Key, kv.Value, color); }); } }
/// <summary> /// 画LocalCube /// </summary> /// <param name="matrix"></param> /// <param name="offset"></param> /// <param name="size"></param> /// <param name="color"></param> /// <param name="duration">持续时间</param> /// <param name="isDepthTest"></param> public static void DebugLocalCube(Matrix4x4 matrix, Vector3 offset, Vector3 size, Color color, float duration = 0, bool isDepthTest = true) { if (!Is_Debug_Enable) { return; } var cube = new Cube3D(Vector3.zero, Vector3.one); cube.MultiplyMatrix(Matrix4x4.TRS(offset, Quaternion.identity, size)); cube.PreMultiplyMatrix(matrix); cube.GetDrawLineList().ForEach(kv => { DebugLine(kv.Key, kv.Value, color, duration, isDepthTest); }); }