public MeshViewerWidget(double bedXSize, double bedYSize, double scale)
        {
            ShowWireFrame = false;
            RenderBed = true;
            PartColor = RGBA_Bytes.White;

            this.partScale = scale;
            trackballTumbleWidget = new TrackballTumbleWidget();
            trackballTumbleWidget.DrawRotationHelperCircle = false;
            trackballTumbleWidget.DrawGlContent += trackballTumbleWidget_DrawGlContent;

            AddChild(trackballTumbleWidget);

            CreateBedGridImage((int)(bedXSize / 10), (int)(bedYSize / 10));

            printerBed = PlatonicSolids.CreateCube(bedXSize, bedYSize, 2);
            Face face = printerBed.Faces[0];
            {
                FaceData faceData = new FaceData();
                faceData.Textures.Add(bedCentimeterGridImage);
                face.Data = faceData;
                foreach (FaceEdge faceEdge in face.FaceEdgeIterator())
                {
                    FaceEdgeData edgeUV = new FaceEdgeData();
                    edgeUV.TextureUV.Add(new Vector2((bedXSize / 2 + faceEdge.vertex.Position.x) / bedXSize,
                        (bedYSize / 2 + faceEdge.vertex.Position.y) / bedYSize));
                    faceEdge.Data = edgeUV;
                }
            }

            foreach (Vertex vertex in printerBed.Vertices)
            {
                vertex.Position = vertex.Position - new Vector3(0, 0, 1);
            }

            trackballTumbleWidget.AnchorAll();
        }
		public MeshViewerWidget(Vector3 displayVolume, Vector2 bedCenter, BedShape bedShape, string startingTextMessage = "")
		{
			RenderType = RenderTypes.Shaded;
			RenderBed = true;
			RenderBuildVolume = false;
			//SetMaterialColor(1, RGBA_Bytes.LightGray, RGBA_Bytes.White);
			BedColor = new RGBA_Floats(.8, .8, .8, .7).GetAsRGBA_Bytes();
			BuildVolumeColor = new RGBA_Floats(.2, .8, .3, .2).GetAsRGBA_Bytes();

			trackballTumbleWidget = new TrackballTumbleWidget();
			trackballTumbleWidget.DrawRotationHelperCircle = false;
			trackballTumbleWidget.DrawGlContent += trackballTumbleWidget_DrawGlContent;
			trackballTumbleWidget.TransformState = TrackBallController.MouseDownType.Rotation;

			AddChild(trackballTumbleWidget);

			CreatePrintBed(displayVolume, bedCenter, bedShape);

			trackballTumbleWidget.AnchorAll();

			partProcessingInfo = new PartProcessingInfo(startingTextMessage);

			GuiWidget labelContainer = new GuiWidget();
			labelContainer.AnchorAll();
			labelContainer.AddChild(partProcessingInfo);
			labelContainer.Selectable = false;

			this.AddChild(labelContainer);
		}
Beispiel #3
0
		public RayTraceWidget(int width = 200, int height = 200)
		{
			trackballTumbleWidget = new TrackballTumbleWidget();
			trackballTumbleWidget.DoOpenGlDrawing = false;
			trackballTumbleWidget.DrawRotationHelperCircle = false;
			//trackballTumbleWidget.DrawGlContent += trackballTumbleWidget_DrawGlContent;
			trackballTumbleWidget.TransformState = TrackBallController.MouseDownType.Rotation;

			AddChild(trackballTumbleWidget);

			totalTime.Start();

			CreateScene();
			LocalBounds = new RectangleDouble(0, 0, width, height);

			trackballTumbleWidget.TrackBallController.Scale = .03;

			trackballTumbleWidget.TrackBallController.Rotate(Quaternion.FromEulerAngles(new Vector3(0, 0, MathHelper.Tau / 16)));
			trackballTumbleWidget.TrackBallController.Rotate(Quaternion.FromEulerAngles(new Vector3(-MathHelper.Tau * .19, 0, 0)));
			trackballTumbleWidget.AnchorAll();
		}