Set MeshViewer as the projection matrix reference

- Resize layerRenderRatioSlider on BoundsChanged
This commit is contained in:
John Lewin 2018-02-20 15:23:55 -08:00
parent f40dabbac3
commit 93b580c89a
4 changed files with 12 additions and 11 deletions

View file

@ -62,6 +62,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
private UndoBuffer undoBuffer;
private LightingData lighting = new LightingData();
private GuiWidget renderSource;
public InteractionLayer(WorldView world, UndoBuffer undoBuffer, InteractiveScene scene)
{
@ -73,6 +74,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
internal void SetRenderTarget(GuiWidget renderSource)
{
this.renderSource = renderSource;
renderSource.AfterDraw += RenderSource_DrawExtra;
}
@ -80,7 +82,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
if (DoOpenGlDrawing)
{
SetGlContext(this.World, this.TransformToScreenSpace(LocalBounds), lighting);
SetGlContext(this.World, renderSource.TransformToScreenSpace(renderSource.LocalBounds), lighting);
OnDrawGlContent(e);
UnsetGlContext();
}

View file

@ -95,12 +95,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
this.printerTabPage = printerTabBase as PrinterTabPage;
this.printer = printer;
trackballTumbleWidget = new TrackballTumbleWidget(sceneContext.World)
{
TransformState = TrackBallController.MouseDownType.Rotation
};
trackballTumbleWidget.AnchorAll();
this.InteractionLayer = new InteractionLayer(this.World, scene.UndoBuffer, scene)
{
Name = "InteractionLayer",
@ -126,6 +120,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
meshViewerWidget.AnchorAll();
this.AddChild(meshViewerWidget);
trackballTumbleWidget = new TrackballTumbleWidget(sceneContext.World, meshViewerWidget)
{
TransformState = TrackBallController.MouseDownType.Rotation
};
trackballTumbleWidget.AnchorAll();
// TumbleWidget
this.InteractionLayer.AddChild(trackballTumbleWidget);