Orthographic projection mode with dynamic near/far.
This commit is contained in:
parent
0834aff9f4
commit
e7947a2fd2
70 changed files with 2548 additions and 244 deletions
|
|
@ -146,16 +146,22 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
Object3DControlContext.GuiSurface.BeforeDraw += Object3DControl_BeforeDraw;
|
||||
}
|
||||
|
||||
public override void Draw(DrawGlContentEventArgs e)
|
||||
bool ShouldDrawScaleControls()
|
||||
{
|
||||
bool shouldDrawScaleControls = true;
|
||||
var selectedItem = RootSelection;
|
||||
|
||||
if (Object3DControlContext.SelectedObject3DControl != null
|
||||
&& Object3DControlContext.SelectedObject3DControl as ScaleMatrixTopControl == null)
|
||||
{
|
||||
shouldDrawScaleControls = false;
|
||||
}
|
||||
return shouldDrawScaleControls;
|
||||
}
|
||||
|
||||
public override void Draw(DrawGlContentEventArgs e)
|
||||
{
|
||||
bool shouldDrawScaleControls = ShouldDrawScaleControls();
|
||||
var selectedItem = RootSelection;
|
||||
|
||||
if (selectedItem != null)
|
||||
{
|
||||
|
|
@ -205,6 +211,31 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
base.Draw(e);
|
||||
}
|
||||
|
||||
public override AxisAlignedBoundingBox GetWorldspaceAABB()
|
||||
{
|
||||
AxisAlignedBoundingBox box = AxisAlignedBoundingBox.Empty();
|
||||
|
||||
bool shouldDrawScaleControls = ShouldDrawScaleControls();
|
||||
var selectedItem = RootSelection;
|
||||
|
||||
if (selectedItem != null)
|
||||
{
|
||||
if (shouldDrawScaleControls)
|
||||
{
|
||||
box = AxisAlignedBoundingBox.Union(box, topScaleMesh.GetAxisAlignedBoundingBox().NewTransformed(TotalTransform));
|
||||
}
|
||||
|
||||
Vector3 topPosition = GetTopPosition(selectedItem);
|
||||
var bottomPosition = topPosition;
|
||||
var originalSelectedBounds = selectedItem.GetAxisAlignedBoundingBox();
|
||||
bottomPosition.Z = originalSelectedBounds.MinXYZ.Z;
|
||||
box.ExpandToInclude(topPosition);
|
||||
box.ExpandToInclude(bottomPosition);
|
||||
}
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
public Vector3 GetTopPosition(IObject3D selectedItem)
|
||||
{
|
||||
AxisAlignedBoundingBox originalSelectedBounds = selectedItem.GetAxisAlignedBoundingBox();
|
||||
|
|
@ -250,7 +281,7 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
|
||||
if (MouseDownOnControl)
|
||||
{
|
||||
IntersectInfo info = hitPlane.GetClosestIntersection(mouseEvent3D.MouseRay);
|
||||
IntersectInfo info = hitPlane.GetClosestIntersectionWithinRayDistanceRange(mouseEvent3D.MouseRay);
|
||||
|
||||
if (info != null
|
||||
&& selectedItem != null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue