2017-06-21 23:26:20 -07:00
|
|
|
|
/*
|
2019-01-30 08:08:24 -08:00
|
|
|
|
Copyright (c) 2019, Lars Brubaker
|
2017-06-21 23:26:20 -07:00
|
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
|
|
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
|
|
|
|
|
|
|
|
1. Redistributions of source code must retain the above copyright notice, this
|
|
|
|
|
|
list of conditions and the following disclaimer.
|
|
|
|
|
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
|
|
this list of conditions and the following disclaimer in the documentation
|
|
|
|
|
|
and/or other materials provided with the distribution.
|
|
|
|
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
|
|
|
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
|
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
|
|
|
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
|
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
|
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
|
|
|
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
|
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
|
|
|
|
The views and conclusions contained in the software and documentation are those
|
|
|
|
|
|
of the authors and should not be interpreted as representing official policies,
|
|
|
|
|
|
either expressed or implied, of the FreeBSD Project.
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2017-07-18 18:15:10 -07:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
using System.Linq;
|
2019-05-04 08:35:43 -07:00
|
|
|
|
using System.Threading;
|
|
|
|
|
|
using System.Threading.Tasks;
|
2017-06-21 23:26:20 -07:00
|
|
|
|
using MatterHackers.Agg;
|
2018-01-23 13:48:21 -08:00
|
|
|
|
using MatterHackers.Agg.Image;
|
2017-06-21 23:26:20 -07:00
|
|
|
|
using MatterHackers.Agg.UI;
|
|
|
|
|
|
using MatterHackers.DataConverters3D;
|
2018-12-21 08:27:40 -08:00
|
|
|
|
using MatterHackers.MatterControl.DesignTools;
|
2018-06-05 13:38:25 -07:00
|
|
|
|
using MatterHackers.MatterControl.PartPreviewWindow.View3D;
|
2019-01-31 07:33:42 -08:00
|
|
|
|
using MatterHackers.MeshVisualizer;
|
2017-06-21 23:26:20 -07:00
|
|
|
|
using MatterHackers.PolygonMesh;
|
|
|
|
|
|
using MatterHackers.RenderOpenGl;
|
|
|
|
|
|
using MatterHackers.RenderOpenGl.OpenGl;
|
|
|
|
|
|
using MatterHackers.VectorMath;
|
|
|
|
|
|
|
2019-01-31 07:33:42 -08:00
|
|
|
|
namespace MatterHackers.MatterControl.PartPreviewWindow
|
2017-06-21 23:26:20 -07:00
|
|
|
|
{
|
2019-02-13 10:26:02 -08:00
|
|
|
|
public class Object3DView
|
|
|
|
|
|
{
|
|
|
|
|
|
public Color Color { get; set; }
|
2018-02-02 18:19:23 -08:00
|
|
|
|
|
2019-02-13 10:26:02 -08:00
|
|
|
|
public IObject3D Object3D { get; }
|
2018-02-02 18:19:23 -08:00
|
|
|
|
|
2019-02-13 10:26:02 -08:00
|
|
|
|
public Object3DView(IObject3D source, Color color)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Object3D = source;
|
|
|
|
|
|
this.Color = color;
|
2018-02-02 18:19:23 -08:00
|
|
|
|
|
2019-02-13 10:26:02 -08:00
|
|
|
|
if (source is Object3D object3D
|
|
|
|
|
|
&& color != source.Color
|
2020-11-17 07:55:49 -08:00
|
|
|
|
&& color.alpha < 255
|
|
|
|
|
|
&& color.alpha > 0)
|
2019-02-13 10:26:02 -08:00
|
|
|
|
{
|
|
|
|
|
|
object3D.EnsureTransparentSorting();
|
2018-02-02 18:19:23 -08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-06-21 23:26:20 -07:00
|
|
|
|
}
|
2017-11-28 15:34:49 -08:00
|
|
|
|
}
|