public PrinterViewSceneGraph(GUIHost host, SettingsManager.GridUnit initialGridUnits, PrinterSizeProfile.CaseType initialCaseType) : base(123456) { RelativeX = 0.0f; RelativeY = 0.0f; RelativeWidth = 1f; RelativeHeight = 1f; ViewPointPos = new M3D.Model.Utils.Vector3(0.0f, 0.0f, 10f); ModelList = new List <ModelTransformPair>(); CameraLookAtPos = new M3D.Model.Utils.Vector3(0.0f, -10f, 0.0f); AddChildElement3D(new LightNode(0, 0, new Vector4(0.0f, 400f, 1000f, 1f), new Color4(0.2f, 0.2f, 0.2f, 1f), new Color4(1f, 1f, 1f, 1f), new Color4(1f, 1f, 1f, 1f))); AddChildElement3D(new LightNode(1, 1, new Vector4(0.0f, 20f, -400f, 1f), new Color4(0.0f, 0.0f, 0.0f, 1f), new Color4(1f, 1f, 1f, 1f), new Color4(0.3f, 0.3f, 0.3f, 1f))); OpenGLCoordinateSystem = new TransformationNode(0, origin) { Rotation = new M3D.Model.Utils.Vector3(-90f, 0.0f, 0.0f) }; AddChildElement3D(OpenGLCoordinateSystem); PrinterTiltTransform = new TransformationNode(0, OpenGLCoordinateSystem); OpenGLCoordinateSystem.AddChildElement(PrinterTiltTransform); PrinterTransformation = new TransformationNode(0, PrinterTiltTransform); PrinterTypeAdjustments = new TransformationNode(3011, PrinterTransformation); var num = 1.1f; PrinterTypeAdjustments.Scale = new M3D.Model.Utils.Vector3(num, num, 1f); PrinterTransformation.AddChildElement(PrinterTypeAdjustments); PrinterModel = new PrinterModelNode(initialCaseType); PrinterTypeAdjustments.AddChildElement(PrinterModel); ObjectToPrinterSpace = new TransformationNode(3005, PrinterTransformation) { Translation = new M3D.Model.Utils.Vector3(0.0f, 0.0f, 0.0f) }; PrinterTransformation.AddChildElement(ObjectToPrinterSpace); GridSizeAdjustments = new TransformationNode(3012, ObjectToPrinterSpace); ObjectToPrinterSpace.AddChildElement(GridSizeAdjustments); Grid = new GridObjectNode(3003, 100f, 100f); Grid.SetUnits(initialGridUnits); Grid.Visible = false; Grid.Emission = new Color4(1f, 1f, 1f, 1f); GridSizeAdjustments.AddChildElement(Grid); var texturedFloorNode = new TexturedFloorNode(3004); var bitmap = new Bitmap(Resources.shadowtexture); var texture = 0; Element3D.CreateTexture(ref texture, bitmap); bitmap.Dispose(); texturedFloorNode.Create(new M3D.Model.Utils.Vector3(0.0f, 0.0f, -76f), 450f, 240f, texture); OpenGLCoordinateSystem.AddChildElement(texturedFloorNode); PrinterTiltTransform.AddChildElement(PrinterTransformation); }
public int AddModel(Graphics.Ext3D.ModelRendering.Model model, out ModelTransformPair modtrans_pair) { modtrans_pair = new ModelTransformPair { modelNode = new Model3DNode(3200) }; modtrans_pair.modelNode.SetModel(model); modtrans_pair.modelNode.Ambient = new Color4(modelColor.R / 4f, modelColor.G / 4f, modelColor.B / 4f, 1f); modtrans_pair.modelNode.Diffuse = modelColor; modtrans_pair.modelNode.Specular = new Color4(0.5f, 0.5f, 0.5f, 1f); modtrans_pair.modelNode.Shininess = 100f; modtrans_pair.transformNode = new TransformationNode(3100, ObjectToPrinterSpace); modtrans_pair.transformNode.AddChildElement(modtrans_pair.modelNode); modtrans_pair.CalculateExtents(); ObjectToPrinterSpace.AddChildElement(modtrans_pair.transformNode); ModelList.Add(modtrans_pair); return(ModelList.Count - 1); }