private int CreateTexture(Bitmap bitmap) { var texture = 0; Element3D.CreateTexture(ref texture, bitmap); bitmap.Dispose(); return(texture); }
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 PrinterLogoObjectNode(string texture_name, int ID, Element3D parent, Vector3 position, Vector3 size) : base(ID, parent) { var texture = 0; var bitmap = new Bitmap(texture_name); Element3D.CreateTexture(ref texture, bitmap); bitmap.Dispose(); plate = new FrontFacingPlaneNode(ID, this); logo = new FrontFacingPlaneNode(ID, this); plate.Create(position, size.X, size.Z, 0); plate.Emission = new Color4(0.0f, 0.0f, 0.0f, 0.0f); logo.Create(position, size.X - 1f, size.Z - 1f, texture); logo.Emission = new Color4(1f, 1f, 1f, 1f); }