예제 #1
0
        public override void RenderShape(VisionViewBase view, ShapeRenderMode mode)
        {
            base.RenderShape(view, mode);

            if (this.Visible == true)
            {
                uint iColor = VisionColors.RGBA(0, 255, 255, 255);

                view.RenderRectangle2D(0, 0, ResolutionX * _editScale, ResolutionY * _editScale, iColor, 1.0f);
            }
        }
예제 #2
0
파일: HotSpot2D.cs 프로젝트: swordlegend/2d
        public override void RenderHotSpot(VisionViewBase view, ShapeRenderMode mode)
        {
            base.RenderHotSpot(view, mode);
            if (!OnScreen)
            {
                return;
            }

            Vector2F center2d = Sprite.CenterPosition;

            view.RenderRectangle2D(
                center2d.X - 5, center2d.Y - 5,
                center2d.X + 5, center2d.Y + 5,
                VisionColors.RGBA(0, 255, 0, 255), 1.0f);
        }
예제 #3
0
        /// <summary>
        /// Overridden function to set all shape's properties (color, ...) on the engine instance
        /// </summary>
        public override void SetEngineInstanceBaseProperties()
        {
            base.SetEngineInstanceBaseProperties();
            if (_engineInstance == null)
            {
                return;
            }

            EngineProjector.SetTexture(_textureFile);
            EngineProjector.SetTransparency(_transp);
            EngineProjector.SetConeAngles(_fConeAngleX, _fConeAngleY);
            EngineProjector.SetLength(_fLength * UniformScaling);
            EngineProjector.SetFadeOutRange(_fFadeOutDist * UniformScaling);
            EngineProjector.SetColor(VisionColors.RGBA(_color.R, _color.G, _color.B, _iIntensity));
            EngineProjector.SetLightmapped(_bLightmapped);
            EngineProjector.SetGeometryTypeMask(_geomTypeFilter);
            EngineProjector.SetFarClipDistance(_fFarClipDistance);
            EngineProjector.SetInfluenceBitmask((uint)_iInfluenceBitmask);
            EngineProjector.SetCustomShaderEffect(_shaderFX);
        }
예제 #4
0
        public void RenderSelection(VisionViewBase view, ShapeRenderMode mode)
        {
            if (!Valid)
            {
                return;
            }
            uint iColor = VisionColors.RGBA(50, 20, 150, 50);

            /*
             * Vector3F v0 = new Vector3F(WorldSpaceExtent.X1, WorldSpaceExtent.Y1, DisplayZ);
             * Vector3F v1 = new Vector3F(WorldSpaceExtent.X2, WorldSpaceExtent.Y1, DisplayZ);
             * Vector3F v2 = new Vector3F(WorldSpaceExtent.X1, WorldSpaceExtent.Y2, DisplayZ);
             * Vector3F v3 = new Vector3F(WorldSpaceExtent.X2, WorldSpaceExtent.Y2, DisplayZ);
             *
             * view.RenderSolidTriangle(v0, v1, v2, iColor);
             * view.RenderSolidTriangle(v1, v3, v2, iColor);
             */
            float       fMin      = DisplayZ - EditorManager.Settings.MaxPickingDistance;
            BoundingBox renderBox = new BoundingBox(WorldSpaceExtent.X1, WorldSpaceExtent.Y1, fMin, WorldSpaceExtent.X2, WorldSpaceExtent.Y2, DisplayZ);

            view.RenderSolidBox(renderBox, iColor);
        }
예제 #5
0
        /// <summary>
        /// Overridden render function: Let the engine instance render itself and render a box
        /// </summary>
        /// <param name="view"></param>
        /// <param name="mode"></param>
        public override void RenderShape(VisionViewBase view, ShapeRenderMode mode)
        {
            //    EngineNode.RenderShape(view, mode);
            base.RenderShape(view, mode);

            if (this.Selected == true)
            {
                uint iColor = VisionColors.RGBA(0, 0, 255, 255);

                float fScaleX = UIEditorMessageService.GetInstance().GetResolutionScaleX();
                float fScaleY = UIEditorMessageService.GetInstance().GetResolutionScaleY();

                float fScreenPosX = PosX;
                float fScreenPosY = PosY;

                if (Parent != null && Parent is UIShapeBase)
                {
                    fScreenPosX += ((UIShapeBase)Parent).PosX;
                    fScreenPosY += ((UIShapeBase)Parent).PosY;
                }

                view.RenderRectangle2D(fScreenPosX * fScaleX, fScreenPosY * fScaleY, (fScreenPosX + SizeX) * fScaleX, (fScreenPosY + SizeY) * fScaleY, iColor, 1.0f);
            }
        }
예제 #6
0
 public AdjustPasteSizeHotspot(TerrainSelectionShape selShape)
     : base(selShape, @"textures\fit_to_size32.png", VisionColors.RGBA(230, 230, 230, 255), VisionColors.White, 16.0f)
 {
     this.ToolTipText = "Take the selection size from the clipboard data (same size in world units)";
 }
예제 #7
0
 public PasteSelectionHotspot(TerrainSelectionShape selShape)
     : base(selShape, @"textures\paste32.png", VisionColors.RGBA(230, 230, 230, 255), VisionColors.White, 16.0f)
 {
     this.ToolTipText = "Pastes the current clipboard content into this selection (uses scaling)";
 }
예제 #8
0
 public CopySelectionHotspot(TerrainSelectionShape selShape)
     : base(selShape, @"textures\copy32.png", VisionColors.RGBA(230, 230, 230, 255), VisionColors.White, 16.0f)
 {
     this.ToolTipText = "Copies the current selection into the clipboard";
 }
예제 #9
0
        /// <summary>
        /// Overridden function
        /// </summary>
        public override void OnSelected()
        {
            base.OnSelected();

            // start button
            _hotSpotStartEvent             = new HotSpotPlayButton(this, @"textures\Media_play.TGA", VisionColors.RGBA(200, 200, 200, 255), VisionColors.White, 15.0f);
            _hotSpotStartEvent.ToolTipText = "Start event";
            _hotSpotStartEvent.Set2DOffset(0.0f, 30.0f);
            EditorManager.ActiveView.HotSpots.Add(_hotSpotStartEvent);

            // Update the engine instance, in order to offer stolen info-only events the possibility to convert into a playable event instance. Thus hotspot button
            // will be always available for all event instances. Please note: All stolen event instances, which have a "Max playbacks behavior" without failing
            // (1 = steal oldest, 2 = steal newest, 3 = steal quietest), will not recover. This is absolute necessary, in order to avoid an endless cycle of stealing
            // and recovering of such event instances, as none of the requests for a not info-only event will fail. Thus for these events, the hotspot button will
            // not be available.
            EngineFmodEvent.Update();

            UpdateHotspotVisibility();
        }
예제 #10
0
        /// <summary>
        /// Overridable that is called when the mouse cursor moves in the view
        /// </summary>
        /// <param name="e">Mouse event arguments directly passed through</param>
        /// <param name="eKeyMod">Key modifier bitmask (Shift, Alt, ...)</param>
        /// <param name="iOldX">Previous screen x position</param>
        /// <param name="iOldY">Previous screen y position</param>
        /// <returns>return true to redraw the view immediately</returns>
        public override bool OnMouseMove(MouseEventArgs e, KeyModifier eKeyMod, int iOldX, int iOldY)
        {
            if (Dragmode == MOUSE_MODE.UI_AREA_SELECT)
            {
                View.RenderRectangle2D(m_MouseDownPoint.X, m_MouseDownPoint.Y, e.X, e.Y, VisionColors.RGBA(255, 255, 255, 255), 1.0f);
            }
            else if (eKeyMod == KeyModifier.Ctrl)
            {
            }
            else
            {
                if (m_selectedShapeList.Count > 0)
                {
                    if (Dragmode == MOUSE_MODE.UI_MOVE || Dragmode == MOUSE_MODE.UI_COPY)
                    {
                        // this.MoveUIShape(m_selectedShape, e.X, e.Y);
                        foreach (UIShapeBase shape in m_selectedShapeList)
                        {
                            this.MoveUIShapeDelta(shape, e.X - iOldX, e.Y - iOldY);
                        }
                    }
                    else if (Dragmode == MOUSE_MODE.UI_SIZE)
                    {
                        foreach (UIShapeBase shape in m_selectedShapeList)
                        {
                            Rectangle2D newRect = new Rectangle2D();

                            float fDeltaX = (e.X - iOldX);
                            float fDeltaY = (e.Y - iOldY);

                            if (View.Cursor == Cursors.PanNW)
                            {
                                newRect.Add(shape.ScreenBound.X2, shape.ScreenBound.Y2);
                                newRect.Add(shape.ScreenBound.X1 + fDeltaX, shape.ScreenBound.Y1 + fDeltaY);

                                newRect.Validate();
                                shape.ScreenBound = newRect;
                            }
                            else if (View.Cursor == Cursors.PanSW)
                            {
                                newRect.Add(shape.ScreenBound.X2, shape.ScreenBound.Y1);
                                newRect.Add(shape.ScreenBound.X1 + fDeltaX, shape.ScreenBound.Y2 + fDeltaY);

                                newRect.Validate();
                                shape.ScreenBound = newRect;
                            }
                            else if (View.Cursor == Cursors.PanNE)
                            {
                                newRect.Add(shape.ScreenBound.X1, shape.ScreenBound.Y2);
                                newRect.Add(shape.ScreenBound.X2 + fDeltaX, shape.ScreenBound.Y1 + fDeltaY);

                                newRect.Validate();
                                shape.ScreenBound = newRect;
                            }
                            else if (View.Cursor == Cursors.PanSE)
                            {
                                newRect.Add(shape.ScreenBound.X1, shape.ScreenBound.Y1);
                                newRect.Add(shape.ScreenBound.X2 + fDeltaX, shape.ScreenBound.Y2 + fDeltaY);

                                newRect.Validate();
                                shape.ScreenBound = newRect;
                            }
                        }
                    }
                }
                else
                {
                }

                if (Dragmode == MOUSE_MODE.UI_NONE)
                {
                    UIShapeBase tempShape = this.GetUIShapeFromSelection(e.X, e.Y);


                    if (tempShape == null)
                    {
                        View.Cursor = Cursors.Default;
                    }
                    else
                    {
                        int         margin     = 15;
                        Rectangle2D mouseBound = new Rectangle2D();

                        mouseBound.Add(e.X - margin, e.Y - margin);
                        mouseBound.Add(e.X + margin, e.Y + margin);


                        float fX1 = tempShape.ScreenBound.X1;
                        float fY1 = tempShape.ScreenBound.Y1;
                        float fX2 = tempShape.ScreenBound.X2;
                        float fY2 = tempShape.ScreenBound.Y2;

                        if (mouseBound.IsInside(fX1, fY1))
                        {
                            View.Cursor = Cursors.PanNW;
                        }
                        else if (mouseBound.IsInside(fX1, fY2))
                        {
                            View.Cursor = Cursors.PanSW;
                        }
                        else if (mouseBound.IsInside(fX2, fY1))
                        {
                            View.Cursor = Cursors.PanNE;
                        }
                        else if (mouseBound.IsInside(fX2, fY2))
                        {
                            View.Cursor = Cursors.PanSE;
                        }
                        else if (tempShape is UIShapeDialog)      // 다이얼로그는 사이즈조정밖에 안됨
                        {
                            View.Cursor = Cursors.Arrow;
                        }
                        else
                        {
                            View.Cursor = Cursors.SizeAll;
                        }
                    }
                }
            }

            return(false);
        }
예제 #11
0
        /// <summary>
        /// Overridden function
        /// </summary>
        public override void OnSelected()
        {
            base.OnSelected();

            System.Diagnostics.Debug.Assert(_hotSpotVolume == null);

            // hotspot for sound volume
            _hotSpotVolume = new HotSpotDistance(this, @"textures\Hotspot_V.tga", VisionColors.Cyan, HotSpotBase.PickType.Square, 10.0f);
            _hotSpotVolume.DisplayScaling = 100.0f;
            _hotSpotVolume.StartDistance  = Volume;
            _hotSpotVolume.Axis           = this.ZAxis;
            _hotSpotVolume.ToolTipText    = "Volume";
            _hotSpotVolume.SetRange(0.0f, 1.0f);
            EditorManager.ActiveView.HotSpots.Add(_hotSpotVolume);

            // hotspots for distance fading
            _hotSpotFadeMin = new HotSpotDistance(this, @"textures\Hotspot_D.tga", VisionColors.Blue, HotSpotBase.PickType.Square, 4.0f);
            _hotSpotFadeMin.StartDistance  = MinDistance;
            _hotSpotFadeMin.Axis           = this.XAxis;
            _hotSpotFadeMin.DisplayScaling = UniformScaling;
            _hotSpotFadeMin.ToolTipText    = "min distance";
            EditorManager.ActiveView.HotSpots.Add(_hotSpotFadeMin);
            _hotSpotFadeMax = new HotSpotDistance(this, @"textures\Hotspot_D.tga", VisionColors.Blue, HotSpotBase.PickType.Square, 4.0f);
            _hotSpotFadeMax.StartDistance  = MaxDistance;
            _hotSpotFadeMax.Axis           = this.XAxis;
            _hotSpotFadeMax.DisplayScaling = UniformScaling;
            _hotSpotFadeMax.ToolTipText    = "max distance";
            EditorManager.ActiveView.HotSpots.Add(_hotSpotFadeMax);

            // hotspots for cone angles
            _hotSpotOuterCone             = new HotSpotConeAngle(this, @"textures\Hotspot_A.tga", VisionColors.Red, HotSpotBase.PickType.Square, 4.0f);
            _hotSpotOuterCone.Distance    = 120.0f * EditorManager.Settings.GlobalUnitScaling;
            _hotSpotOuterCone.StartAngle  = this.ConeOutside;
            _hotSpotOuterCone.ToolTipText = "Outer cone angle";
            EditorManager.ActiveView.HotSpots.Add(_hotSpotOuterCone);
            _hotSpotInnerCone             = new HotSpotConeAngle(this, @"textures\Hotspot_A.tga", VisionColors.Red, HotSpotBase.PickType.Square, 4.0f);
            _hotSpotInnerCone.Distance    = 100.0f * EditorManager.Settings.GlobalUnitScaling;
            _hotSpotInnerCone.StartAngle  = this.ConeInside;
            _hotSpotInnerCone.ToolTipText = "Inner cone angle";
            EditorManager.ActiveView.HotSpots.Add(_hotSpotInnerCone);

            // hotspot for playing sound
            _hotSpotPlaySound             = new HotSpotPlayButton(this, @"textures\Media_play.TGA", VisionColors.RGBA(200, 200, 200, 255), VisionColors.White, 15.0f);
            _hotSpotPlaySound.ToolTipText = "Play sound";
            _hotSpotPlaySound.Set2DOffset(0.0f, 30.0f);
            EditorManager.ActiveView.HotSpots.Add(_hotSpotPlaySound);

            UpdateHotspotVisibility();
        }
예제 #12
0
 /// <summary>
 /// constructor
 /// </summary>
 /// <param name="owner">the owning CustomVolumeShape</param>
 /// <param name="insert">at which place to insert</param>
 public HotSpotAddVolumeVertex(CustomVolumeShape owner, int insert)
     : base(owner, @"Textures\Hotspot_add.dds", VisionColors.RGBA(255, 255, 255, 180), VisionColors.White, 8.0f)
 {
     _insert = insert;
 }