Ejemplo n.º 1
0
        public InteractionLayer(ISceneContext sceneContext, ThemeConfig theme, EditorType editorType = EditorType.Part)
        {
            this.sceneContext = sceneContext;
            this.EditorMode   = editorType;
            this.theme        = theme;

            scene = sceneContext.Scene;

            gCodeMeshColor = new Color(theme.PrimaryAccentColor, 35);

            BuildVolumeColor = new ColorF(.2, .8, .3, .2).ToColor();

            floorDrawable = new FloorDrawable(editorType, sceneContext, this.BuildVolumeColor, theme);

            if (ViewOnlyTexture == null)
            {
                // TODO: What is the ViewOnlyTexture???
                UiThread.RunOnIdle(() =>
                {
                    ViewOnlyTexture = new ImageBuffer(32, 32, 32);
                    var graphics2D  = ViewOnlyTexture.NewGraphics2D();
                    graphics2D.Clear(Color.White);
                    graphics2D.FillRectangle(0, 0, ViewOnlyTexture.Width / 2, ViewOnlyTexture.Height, Color.LightGray);
                    // request the texture so we can set it to repeat
                    var plugin = ImageGlPlugin.GetImageGlPlugin(ViewOnlyTexture, true, true, false);
                });
            }

            iavMappings.Add(typeof(ImageObject3D), new List <InteractionVolume> {
                new MoveInZControl(this)
            });

            // Register listeners
            sceneContext.Scene.SelectionChanged += this.Scene_SelectionChanged;
        }
        public Object3DControlsLayer(ISceneContext sceneContext, ThemeConfig theme, EditorType editorType = EditorType.Part)
        {
            this.sceneContext = sceneContext;
            this.EditorMode   = editorType;

            scene = sceneContext.Scene;

            gCodeMeshColor = new Color(theme.PrimaryAccentColor, 35);

            BuildVolumeColor = new ColorF(.2, .8, .3, .2).ToColor();

            floorDrawable = new FloorDrawable(editorType, sceneContext, this.BuildVolumeColor, theme);

            if (viewOnlyTexture == null)
            {
                // TODO: What is the ViewOnlyTexture???
                UiThread.RunOnIdle(() =>
                {
                    viewOnlyTexture = new ImageBuffer(32, 32, 32);
                    var graphics2D  = viewOnlyTexture.NewGraphics2D();
                    graphics2D.Clear(Color.White);
                    graphics2D.FillRectangle(0, 0, viewOnlyTexture.Width / 2, viewOnlyTexture.Height, Color.LightGray);
                    // request the texture so we can set it to repeat
                    ImageGlPlugin.GetImageGlPlugin(viewOnlyTexture, true, true, false);
                });
            }

            // Register listeners
            sceneContext.Scene.SelectionChanged += this.Scene_SelectionChanged;
            if (sceneContext.Printer != null)
            {
                sceneContext.Printer.Settings.SettingChanged += this.Settings_SettingChanged;
            }
        }