Compute rather than move for selection render
- Issue MatterHackers/MCCentral#3344 Won't close if there is a selection on the bed - Issue MatterHackers/MCCentral#3347 Invalidate should not be invoked from Draw
This commit is contained in:
parent
cb1882c709
commit
b8d5b00ad3
1 changed files with 10 additions and 8 deletions
|
|
@ -609,8 +609,6 @@ namespace MatterHackers.MeshVisualizer
|
|||
GL.Disable(EnableCap.Lighting);
|
||||
// Only render back faces
|
||||
GL.CullFace(CullFaceMode.Front);
|
||||
// Expand the object
|
||||
var oldMatrix = item.Matrix;
|
||||
|
||||
var meshBounds = item.Mesh.GetAxisAlignedBoundingBox();
|
||||
var localCenter = meshBounds.Center;
|
||||
|
|
@ -621,20 +619,24 @@ namespace MatterHackers.MeshVisualizer
|
|||
|
||||
var wantMm = pixelsWant * distBetweenPixelsWorldSpace;
|
||||
|
||||
item.ApplyAtBoundsCenter(Matrix4X4.CreateScale(
|
||||
// Create scaled transform for selection
|
||||
var scaledMatrix = Matrix4X4.CreateScale(
|
||||
wantMm.X / item.XSize(),
|
||||
wantMm.Y / item.YSize(),
|
||||
wantMm.Z / item.ZSize()));
|
||||
wantMm.Z / item.ZSize());
|
||||
scaledMatrix = MatterControl.DesignTools.Operations.Object3DExtensions.ApplyAtCenter(item.GetAxisAlignedBoundingBox(Matrix4X4.Identity), item.Matrix, scaledMatrix);
|
||||
|
||||
GLHelper.Render(item.Mesh,
|
||||
var totalSelectionMatrix = scaledMatrix * item.Parent.WorldMatrix();
|
||||
|
||||
// Render
|
||||
GLHelper.Render(item.Mesh,
|
||||
selectionColor,
|
||||
item.WorldMatrix(), RenderTypes.Shaded,
|
||||
item.WorldMatrix() * World.ModelviewMatrix,
|
||||
totalSelectionMatrix, RenderTypes.Shaded,
|
||||
totalSelectionMatrix * World.ModelviewMatrix,
|
||||
darkWireframe);
|
||||
|
||||
// restore settings
|
||||
GL.CullFace(CullFaceMode.Back);
|
||||
item.Matrix = oldMatrix;
|
||||
GL.Enable(EnableCap.Lighting);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue