Add item Drawables list

This commit is contained in:
John Lewin 2019-01-31 22:37:52 -08:00
parent 8f58e8e8d4
commit ff7b8e40cf
2 changed files with 13 additions and 13 deletions

View file

@ -82,8 +82,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
floorDrawable = new FloorDrawable(editorType, sceneContext, this.BuildVolumeColor, theme); floorDrawable = new FloorDrawable(editorType, sceneContext, this.BuildVolumeColor, theme);
///////////////////////// this.interactionLayer.DrawGlTransparentContent += Draw_GlTransparentContent;
if (ViewOnlyTexture == null) if (ViewOnlyTexture == null)
{ {
// TODO: What is the ViewOnlyTexture??? // TODO: What is the ViewOnlyTexture???
@ -119,13 +117,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
} }
} }
public override void OnDraw(Graphics2D graphics2D)
{
//RendereSceneTraceData(new DrawEventArgs(graphics2D));
base.OnDraw(graphics2D);
}
public static void RenderBounds(DrawEventArgs e, WorldView World, IEnumerable<BvhIterator> allResults) public static void RenderBounds(DrawEventArgs e, WorldView World, IEnumerable<BvhIterator> allResults)
{ {
foreach (var x in allResults) foreach (var x in allResults)

View file

@ -59,15 +59,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
private BedConfig sceneContext; private BedConfig sceneContext;
private Color debugBorderColor = Color.Green;
private ThemeConfig theme; private ThemeConfig theme;
private FloorDrawable floorDrawable; private FloorDrawable floorDrawable;
private ModelRenderStyle modelRenderStyle = ModelRenderStyle.Wireframe; private ModelRenderStyle modelRenderStyle = ModelRenderStyle.Wireframe;
private long lastSelectionChangedMs; private long lastSelectionChangedMs;
private List<IDrawable> drawables = new List<IDrawable>();
private List<IDrawable> drawables = new List<IDrawable>();
private List<IDrawableItem> itemDrawables = new List<IDrawableItem>();
public bool AllowBedRenderingWhenEmpty { get; set; } public bool AllowBedRenderingWhenEmpty { get; set; }
@ -77,7 +76,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{ {
drawables.Add(new AxisIndicatorDrawable()); drawables.Add(new AxisIndicatorDrawable());
//drawables.Add(new TraceDataDrawable(sceneContext)); //drawables.Add(new TraceDataDrawable(sceneContext));
drawables.Add(new AABBDrawable(sceneContext)); //drawables.Add(new AABBDrawable(sceneContext));
#if DEBUG
itemDrawables.Add(new InspectedItemDrawable(sceneContext));
#endif
base.OnLoad(args); base.OnLoad(args);
} }
@ -308,6 +311,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
RenderSelection(item, frustum, selectionColor); RenderSelection(item, frustum, selectionColor);
} }
// Invoke all item Drawables
foreach(var drawable in itemDrawables)
{
drawable.Draw(this, item, e, Matrix4X4.Identity, this.World);
}
// turn lighting back on after rendering selection outlines // turn lighting back on after rendering selection outlines
GL.Enable(EnableCap.Lighting); GL.Enable(EnableCap.Lighting);
} }