コード例 #1
0
        /// <summary>
        /// Update the <see cref="Box"/> value on the basis of data read from a shader.
        /// </summary>
        /// <param name="dirty">The boundaries of the modified area in cells.</param>
        /// <param name="smallHeightData"></param>
        public void Clean(ref Box2i dirty, float[] smallHeightData)
        {
            if (dirty.Min.X > pBox.Max.X || dirty.Min.Y > pBox.Max.Z || dirty.Max.X <= pBox.Min.X || dirty.Max.Y <= pBox.Min.Z)
            {
                return;
            }

            if (IsLeaf)
            {
                var    offset = (VertexCorner.X + VertexCorner.Y * (Terrain.BlockSize / 16)) * 2;
                double min = smallHeightData[offset + 0], max = smallHeightData[offset + 1];

                pBox.Min.Y = min;
                pBox.Max.Y = max;
            }
            else
            {
                ChildTopLeft.Clean(ref dirty, smallHeightData);
                ChildTopRight.Clean(ref dirty, smallHeightData);
                ChildBottomLeft.Clean(ref dirty, smallHeightData);
                ChildBottomRight.Clean(ref dirty, smallHeightData);

                pBox.Min.Y = Math.Min(Math.Min(ChildTopLeft.pBox.Min.Y, ChildTopRight.pBox.Min.Y), Math.Min(ChildBottomLeft.pBox.Min.Y, ChildBottomRight.pBox.Min.Y));
                pBox.Max.Y = Math.Max(Math.Max(ChildTopLeft.pBox.Max.Y, ChildTopRight.pBox.Max.Y), Math.Max(ChildBottomLeft.pBox.Max.Y, ChildBottomRight.pBox.Max.Y));
            }
        }
コード例 #2
0
ファイル: Textbox.cs プロジェクト: avghdev/space-station-14
        public override void Update(float frameTime)
        {
            var boundsLeft  = _textboxLeft.GetLocalBounds();
            var boundsMain  = _textboxMain.GetLocalBounds();
            var boundsRight = _textboxRight.GetLocalBounds();

            _clientAreaLeft = Box2i.FromDimensions(Position, new Vector2i((int)boundsLeft.Width, (int)boundsLeft.Height));

            _clientAreaMain = Box2i.FromDimensions(_clientAreaLeft.Right, Position.Y,
                                                   Width, (int)boundsMain.Height);
            _clientAreaRight = Box2i.FromDimensions(_clientAreaMain.Right, Position.Y,
                                                    (int)boundsRight.Width, (int)boundsRight.Height);
            ClientArea = Box2i.FromDimensions(Position,
                                              new Vector2i(_clientAreaLeft.Width + _clientAreaMain.Width + _clientAreaRight.Width,
                                                           Math.Max(Math.Max(_clientAreaLeft.Height, _clientAreaRight.Height),
                                                                    _clientAreaMain.Height)));
            Label.Position = new Vector2i(_clientAreaLeft.Right,
                                          Position.Y + (int)(ClientArea.Height / 2f) - (int)(Label.Height / 2f));

            if (Focus)
            {
                blinkCount += 1 * frameTime;
                if (blinkCount > 0.50f)
                {
                    blinkCount = 0;
                }
            }
        }
コード例 #3
0
        public override void Update(float frameTime)
        {
            if (disposing || !IsVisible())
            {
                return;
            }
            base.Update(frameTime);
            if (title == null || gradient == null)
            {
                return;
            }
            int y_pos = ClientArea.Top - (2 * titleBuffer) - title.ClientArea.Height + 1;

            title.Position = new Vector2i(ClientArea.Left + 3, y_pos + titleBuffer);
            titleArea      = Box2i.FromDimensions(ClientArea.Left, y_pos, ClientArea.Width, title.ClientArea.Height + (2 * titleBuffer));
            title.Update(frameTime);
            closeButton.Position = new Vector2i(titleArea.Right - 5 - closeButton.ClientArea.Width,
                                                titleArea.Top + (int)(titleArea.Height / 2f) -
                                                (int)(closeButton.ClientArea.Height / 2f));
            gradient.ClientArea = titleArea;
            gradient.Color1     = TitleColor1;
            gradient.Color2     = TitleColor2;
            gradient.Update(frameTime);
            closeButton.Update(frameTime);
        }
コード例 #4
0
ファイル: Monitors.cs プロジェクト: yigitmertcan/opentk
        /// <summary>
        /// Find the monitor a window is in.
        /// </summary>
        /// <param name="window">The window to find.</param>
        /// <returns>The window the monitor was found in.</returns>
        /// <remarks>
        /// This function searches for the window by finding which monitor has the largest
        /// intersection area with the given monitor.
        /// </remarks>
        public static unsafe MonitorHandle GetMonitorFromWindow(Window *window)
        {
            if (!CheckCache())
            {
                throw new Exception("This method can only be called from the main GLFW thread.");
            }

            Box2i windowArea;
            {
                int windowX, windowY, windowWidth, windowHeight;
                GLFW.GetWindowPos(window, out windowX, out windowY);
                GLFW.GetWindowSize(window, out windowWidth, out windowHeight);
                windowArea = new Box2i(windowX, windowY, windowX + windowWidth, windowY + windowHeight);
            }

            int selectedIndex = 0;

            for (int i = 0; i < _monitorInfos.Count; i++)
            {
                if (
                    GetRectangleIntersectionArea(_monitorInfos[i].ClientArea, windowArea) >
                    GetRectangleIntersectionArea(_monitorInfos[selectedIndex].ClientArea, windowArea)
                    )
                {
                    selectedIndex = i;
                }
            }

            return(_monitorInfos[selectedIndex].Handle);
        }
コード例 #5
0
ファイル: MonitorInfo.cs プロジェクト: yigitmertcan/opentk
        /// <summary>
        /// Queries GLFW to get the client area of the monitor.
        /// </summary>
        private unsafe void GetClientArea()
        {
            GLFW.GetMonitorPos(HandleAsPtr, out int x, out int y);
            var videoMode = GLFW.GetVideoMode(HandleAsPtr);

            ClientArea = new Box2i(x, y, x + videoMode->Width, y + videoMode->Height);
        }
コード例 #6
0
ファイル: TerrainEditor.cs プロジェクト: layshua/Alexandria
        void ProcessHeight(string techniqueName, Box2i modified)
        {
            Texture2D heightTexture = TerrainBlock.AllocateHeightBackBuffer();

            ProcessTarget(heightTexture, techniqueName);
            TerrainBlock.DirtyBackBufferHeightTexture(heightTexture, modified);
        }
コード例 #7
0
        public override void Update(float frameTime)
        {
            if (Disposing || !Visible)
            {
                return;
            }

            Container.Update(frameTime);
            var bounds = Container.GetShrinkBounds(false);

            bounds = new Box2i(Container.Position, bounds.BottomRight); // screen to local size
            float maxX = bounds.Width;
            float maxY = bounds.Height;

            ScrollbarH.Max     = (int)maxX - ClientArea.Width + (maxY > _clippingRi.Height ? ScrollbarV.ClientArea.Width : 0);
            ScrollbarH.Visible = maxX > _clippingRi.Width;

            ScrollbarV.Max     = (int)maxY - ClientArea.Height + (maxX > _clippingRi.Height ? ScrollbarH.ClientArea.Height : 0);
            ScrollbarV.Visible = maxY > _clippingRi.Height;

            ScrollbarH.Update(frameTime);
            ScrollbarV.Update(frameTime);

            var xOff = ScrollbarH.Visible ? ScrollbarH.Value * -1 : 0;
            var yOff = ScrollbarV.Visible ? ScrollbarV.Value * -1 : 0;

            Container.ScrollOffset = new Vector2i((int)xOff, (int)yOff);
        }
コード例 #8
0
ファイル: Scrollbar.cs プロジェクト: avghdev/space-station-14
        public override void Update(float frameTime)
        {
            if (!IsVisible())
            {
                return;
            }
            base.Update(frameTime);
            var bounds = scrollbarButton.GetLocalBounds();

            if (Horizontal)
            {
                ClientArea       = Box2i.FromDimensions(Position, new Vector2i(size, (int)bounds.Height));
                clientAreaButton = Box2i.FromDimensions(Position.X + currentPos, Position.Y,
                                                        (int)bounds.Width, (int)bounds.Height);
                actualSize = size - (int)bounds.Width;
            }
            else
            {
                ClientArea       = Box2i.FromDimensions(Position, new Vector2i((int)bounds.Width, size));
                clientAreaButton = Box2i.FromDimensions(Position.X, Position.Y + currentPos,
                                                        (int)bounds.Width, (int)bounds.Height);
                actualSize = size - (int)bounds.Height;
            }

            stepSize  = (float)max / actualSize;
            actualVal = Math.Max(0, Math.Min((int)Math.Round(currentPos * stepSize), max));

            if (ValueChanged != null && RaiseEvent) //This is a bit ugly.
            {
                RaiseEvent = false;
                ValueChanged((int)actualVal);
            }
        }
コード例 #9
0
ファイル: Window.cs プロジェクト: ARDScott/space-station-14
        public override void Update(float frameTime)
        {
            if (Disposing || !Visible)
            {
                return;
            }
            base.Update(frameTime);
            if (title == null || gradient == null)
            {
                return;
            }

            var y_pos = ClientArea.Top - 2 * titleBuffer - title.ClientArea.Height + 1;

            title.LocalPosition = Position + new Vector2i(ClientArea.Left + 3, y_pos + titleBuffer);
            titleArea           = Box2i.FromDimensions(ClientArea.Left, y_pos, ClientArea.Width, title.ClientArea.Height + 2 * titleBuffer);
            title.DoLayout();
            title.Update(frameTime);

            closeButton.LocalPosition = Position + new Vector2i(titleArea.Right - 5 - closeButton.ClientArea.Width,
                                                                titleArea.Top + (int)(titleArea.Height / 2f) -
                                                                (int)(closeButton.ClientArea.Height / 2f));
            closeButton.DoLayout();
            gradient.ClientArea = titleArea;
            gradient.Color1     = TitleColor1;
            gradient.Color2     = TitleColor2;
            gradient.Update(frameTime);
            closeButton.Update(frameTime);
        }
コード例 #10
0
        protected override void Draw(DrawingHandle handle)
        {
            if (!TryGetHands(out IHandsComponent hands))
            {
                return;
            }

            var leftActive = hands.ActiveIndex == "left";

            handle.DrawStyleBox(handBox, leftActive ? handL : handR);
            handle.DrawStyleBox(inactiveHandBox, leftActive ? handR : handL);

            if (LeftHand.Entity != null && LeftHand.HeldSprite != null)
            {
                var bounds = LeftHand.HeldSprite.Size;
                handle.DrawTextureRect(LeftHand.HeldSprite,
                                       Box2i.FromDimensions(handL.Left + (int)(handL.Width / 2f - bounds.X / 2f),
                                                            handL.Top + (int)(handL.Height / 2f - bounds.Y / 2f),
                                                            (int)bounds.X, (int)bounds.Y), tile: false);
            }

            if (RightHand.Entity != null && RightHand.HeldSprite != null)
            {
                var bounds = RightHand.HeldSprite.Size;
                handle.DrawTextureRect(RightHand.HeldSprite,
                                       Box2i.FromDimensions(handR.Left + (int)(handR.Width / 2f - bounds.Y / 2f),
                                                            handR.Top + (int)(handR.Height / 2f - bounds.Y / 2f),
                                                            (int)bounds.X, (int)bounds.Y), tile: false);
            }
        }
コード例 #11
0
        /// <summary>
        /// Signals that the window is now loaded, which means we can load our graphics now.
        /// </summary>
        protected override void OnLoad()
        {
            base.OnLoad();
            MasterRenderer.Load();

            if (Settings.UseSystemUIScaling)
            {
                if (TryGetCurrentMonitorDpi(out float hdpi, out _))
                {
                    Settings.UIScaling = hdpi / 100;
                }
                else
                {
                    Log.WriteInfo("Failed to fetch system dpi scaling.");
                }
            }

            controller = new ImGuiController(ClientSize.X, ClientSize.Y);
            controller.SetScale(Settings.UIScaling);
            window = new ImGuiWindow(this, controller);

            var minimum = ClientRectangle.Min;

            ClientRectangle = new Box2i(minimum.X, minimum.Y, Settings.GraphWidth + minimum.X, Settings.GraphHeight + minimum.Y);

            IsLoaded = true;
        }
コード例 #12
0
        public void DirtyBackBufferHeightTexture(Texture2D newHeightTexture, Box2i modified)
        {
            if (newHeightTexture == null)
            {
                throw new ArgumentNullException("newHeightTexture");
            }

            throw new NotImplementedException();

            /*if (modified.IsEmpty)
             * {
             *      Terrain.RenderTargetCache.ReturnToPool(newHeightTexture);
             *      return;
             * }
             *
             * var heightLayerComponent = Terrain.GetComponent<HeightTerrainComponent>();
             * if (heightLayerComponent != null)
             *      heightLayerComponent.SetTexture(this, newHeightTexture);
             * else
             * {
             *      Terrain.RenderTargetCache.ReturnToPool(heightTexture);
             *      heightTexture = newHeightTexture;
             *      //Terrain.RenderTargetCache.ReturnToPool(newHeightTexture);
             * }
             *
             * var fullArea = new Rectangle(0, 0, terrain.BlockSize, terrain.BlockSize);
             * Rectangle.Intersect(ref modified, ref fullArea, out modified);
             * if (DirtyTreeArea == null)
             *      DirtyTreeArea = modified;
             * else
             *      DirtyTreeArea = Rectangle.Union(DirtyTreeArea.Value, modified);*/
        }
コード例 #13
0
 Box2 TranslateBox(Box2i value)
 {
     return(new Box2(
                value.Min.X / 1024F + offset,
                (value.Min.Y + offset * 1024F) / height,
                value.Max.X / 1024F - offset,
                (value.Max.Y - offset * 1024F) / height));
 }
コード例 #14
0
 public override void Update(float frameTime)
 {
     Text.Text     = Math.Round(percent * 100).ToString() + "%";
     Text.Position = new Vector2i(Position.X + (int)(Size.X / 2f - Text.Width / 2f),
                                  Position.Y + (int)(Size.Y / 2f - Text.Height / 2f));
     ClientArea = Box2i.FromDimensions(Position, Size);
     Value++;
 }
コード例 #15
0
 public override void Update(float frameTime)
 {
     if (drawingSprite != null)
     {
         var bounds = drawingSprite.GetLocalBounds();
         ClientArea = Box2i.FromDimensions(Position, new Vector2i((int)bounds.Width, (int)bounds.Height));
     }
 }
コード例 #16
0
        /// <summary>
        /// Transforms a rectangle from the screen (pixel) space, to world (tile) space.
        /// </summary>
        public static Box2 ScreenToWorld(Box2i rect)
        {
            var center = Window.Camera.Position;

            return(new Box2(
                       ((Vector2)rect.TopLeft - Window.Viewport.Size / 2) / Window.Camera.PixelsPerMeter + center,
                       ((Vector2)rect.BottomRight - Window.Viewport.Size / 2) / Window.Camera.PixelsPerMeter + center
                       ));
        }
コード例 #17
0
        public void Render(FrameEventArgs e)
        {
            _background.SetTransformToRect(Box2i.FromDimensions(0, 0, (int)CluwneLib.Screen.Size.X, (int)CluwneLib.Screen.Size.Y));
            _background.Draw();

            _ticketBg.SetTransformToRect(_boundingArea);
            _ticketBg.Draw();
            UserInterfaceManager.Render(e);
        }
コード例 #18
0
        /// <summary>
        /// Transforms a rectangle from the screen (pixel) space, to world (tile) space.
        /// </summary>
        public static Box2 ScreenToWorld(Box2i rect)
        {
            var center = WorldCenter;

            return(new Box2(
                       ((Vector2)rect.TopLeft - ScreenViewportSize / 2) / TileSize + center,
                       ((Vector2)rect.BottomRight - ScreenViewportSize / 2) / TileSize + center
                       ));
        }
コード例 #19
0
        /// <inheritdoc />
        protected override void OnCalcRect()
        {
            // ugh...
            ScrollbarH.BarLength = ScrollbarV.Visible ? Size.X - ScrollbarV.ClientArea.Width : Size.X;
            ScrollbarV.BarLength = ScrollbarH.Visible ? Size.Y - ScrollbarH.ClientArea.Height : Size.Y;
            ScrollbarH.BarLength = ScrollbarV.Visible ? Size.X - ScrollbarV.ClientArea.Width : Size.X;

            ClientArea = Box2i.FromDimensions(new Vector2i(), Size);
        }
コード例 #20
0
        public static float Min(this IReadOnlyImageFloat <MonoImageType> @this, Box2i box)
        {
            Vector2i minLocation;
            float    answer;

            @this.FindMinimum(box, out minLocation, out answer);

            return(answer);
        }
コード例 #21
0
ファイル: Checkbox.cs プロジェクト: avghdev/space-station-14
        public Checkbox(IResourceCache resourceCache)
        {
            _resourceCache = resourceCache;
            checkbox       = _resourceCache.GetSprite("checkbox0");
            checkboxCheck  = _resourceCache.GetSprite("checkbox1");

            ClientArea = Box2i.FromDimensions(Position,
                                              new Vector2i((int)checkbox.GetLocalBounds().Width, (int)checkbox.GetLocalBounds().Height));
            Update(0);
        }
コード例 #22
0
        protected override void OnCalcRect()
        {
            ClientArea = Box2i.FromDimensions(Position, new Vector2i(Size.X, Size.Y));

            foreach (var kvTab in _tabs)
            {
                kvTab.Key.DoLayout();
                kvTab.Value.DoLayout();
            }
        }
コード例 #23
0
        public override void Update(float frameTime)
        {
            var slotBounds = handSlot.LocalBounds;
            var width      = (int)((slotBounds.Width * 2) + spacing);
            var height     = (int)slotBounds.Height;

            Position   = new Vector2i((int)(CluwneLib.Window.Viewport.Width - width) / 2, (int)CluwneLib.Window.Viewport.Height - height - 10);
            handL      = Box2i.FromDimensions(Position.X, Position.Y, (int)slotBounds.Width, (int)slotBounds.Height);
            handR      = Box2i.FromDimensions(Position.X + (int)slotBounds.Width + spacing, Position.Y, (int)slotBounds.Width, (int)slotBounds.Height);
            ClientArea = Box2i.FromDimensions(Position.X, Position.Y, width, (int)slotBounds.Height);
        }
コード例 #24
0
        public ReadOnlyImageView(IReadOnlyImage <UType, TDepth> image, Box2i roi, int channel = 0)
        {
            _image = image;

            _viewTopLeft    = roi.MinCorner;
            _viewDimensions = roi.Dimensions;
            _viewStep       = new Vector2i(1, 1);
            _viewChannel    = channel;

            _step = image.Step;
        }
コード例 #25
0
        public override void Update(float frameTime)
        {
            base.Update(frameTime);
            var bounds = _iconSprite.GetLocalBounds();

            ClientArea          = Box2i.FromDimensions(Position.X, Position.Y, (int)Size.X, (int)Size.Y);
            _textLabel.Position = new Vector2i(ClientArea.Left + (int)bounds.Width + 6,
                                               ClientArea.Top + (int)(ClientArea.Height / 2f) -
                                               (int)(_textLabel.ClientArea.Height / 2f));
            _textLabel.Update(frameTime);
        }
コード例 #26
0
        /// <inheritdoc />
        protected override void OnCalcRect()
        {
            var listboxLeftBounds  = _listboxLeft.LocalBounds;
            var listboxMainBounds  = _listboxMain.LocalBounds;
            var listboxRightBounds = _listboxRight.LocalBounds;

            _clientAreaLeft  = Box2i.FromDimensions(new Vector2i(), new Vector2i((int)listboxLeftBounds.Width, (int)listboxLeftBounds.Height));
            _clientAreaMain  = Box2i.FromDimensions(_clientAreaLeft.Right, 0, _width, (int)listboxMainBounds.Height);
            _clientAreaRight = Box2i.FromDimensions(new Vector2i(_clientAreaMain.Right, 0), new Vector2i((int)listboxRightBounds.Width, (int)listboxRightBounds.Height));

            _clientArea = Box2i.FromDimensions(new Vector2i(), new Vector2i(_clientAreaLeft.Width + _clientAreaMain.Width + _clientAreaRight.Width, Math.Max(Math.Max(_clientAreaLeft.Height, _clientAreaRight.Height), _clientAreaMain.Height)));
        }
コード例 #27
0
ファイル: Box2i_Test.cs プロジェクト: yyzl123/RobustToolbox
        public void Box2iUnion()
        {
            var boxOne = new Box2i(-1, -1, 1, 1);
            var boxTwo = new Box2i(0, 0, 2, 2);

            var result = boxOne.Union(boxTwo);

            Assert.That(result.Left, Is.EqualTo(-1));
            Assert.That(result.Bottom, Is.EqualTo(-1));
            Assert.That(result.Right, Is.EqualTo(2));
            Assert.That(result.Top, Is.EqualTo(2));
        }
コード例 #28
0
        public void SetSubmatrix(int row, int col, OMatrix matrix)
        {
            var box1 = new Box2i(col, row, matrix.ColumnCount, matrix.RowCount);
            var box2 = new Box2i(row, col, matrix.RowCount, matrix.ColumnCount);

            if (!Box2i.Intersection(box1, box2).IsEmpty)
            {
                throw new ArgumentException("To preserve symmetry, submatrix should not intersect its own transpose");
            }

            _data.SetSubMatrix(row, matrix.RowCount, col, matrix.ColumnCount, ((BaseMatrix)matrix.Value).Data);
            _data.SetSubMatrix(col, matrix.ColumnCount, row, matrix.RowCount, ((BaseMatrix)matrix.Value).Data.Transpose());
        }
コード例 #29
0
        public override void Render()
        {
            base.Render();
            var bounds   = _iconSprite.GetLocalBounds();
            var iconRect = Box2i.FromDimensions(ClientArea.Left + 3,
                                                ClientArea.Top + (int)(ClientArea.Height / 2f) - (int)(bounds.Height / 2f),
                                                (int)bounds.Width, (int)bounds.Height);

            CluwneLib.drawRectangle(ClientArea.Left, ClientArea.Top, ClientArea.Width, ClientArea.Height, _currentColor);
            _textLabel.Render();
            _iconSprite.SetTransformToRect(iconRect);
            _iconSprite.Draw();
        }
コード例 #30
0
        public ContextMenu(IEntity entity, Vector2 creationPos, IResourceCache resourceCache,
                           IUserInterfaceManager userInterfaceManager, bool showExamine = true)
        {
            _owningEntity         = entity;
            _resourceCache        = resourceCache;
            _userInterfaceManager = userInterfaceManager;

            var entries = new List <ContextMenuEntry>();
            var replies = new List <ComponentReplyMessage>();

            entity.SendMessage(this, ComponentMessageType.ContextGetEntries, replies);

            if (replies.Any())
            {
                entries =
                    (List <ContextMenuEntry>)
                    replies.First(x => x.MessageType == ComponentMessageType.ContextGetEntries).ParamsList[0];
            }

            if (showExamine)
            {
                var examineButton =
                    new ContextMenuButton(
                        new ContextMenuEntry
                {
                    ComponentMessage = "examine", EntryName = "Examine", IconName = "context_eye"
                }, _buttonSize,
                        _resourceCache);
                examineButton.Selected += ContextSelected;
                _buttons.Add(examineButton);
                examineButton.Update(0);
            }

            foreach (ContextMenuEntry entry in entries)
            {
                var newButton = new ContextMenuButton(entry, _buttonSize, _resourceCache);
                newButton.Selected += ContextSelected;
                _buttons.Add(newButton);
                newButton.Update(0);
            }

            float currY = creationPos.Y;

            foreach (ContextMenuButton button in _buttons)
            {
                button.Position = new Vector2i((int)creationPos.X, (int)currY);
                currY          += _buttonSize.Y;
            }
            ClientArea = Box2i.FromDimensions((int)creationPos.X, (int)creationPos.Y, (int)_buttonSize.X,
                                              _buttons.Count() * (int)_buttonSize.Y);
        }
コード例 #31
0
ファイル: GL.gen.cs プロジェクト: nicolas-repiquet/Granite
 public static void CompressedTexSubImage2D(uint target, int level, Box2i imagePosition, uint format, int imageSize, System.IntPtr data)
 {
     m_CompressedTexSubImage2D_1(target, level, imagePosition, format, imageSize, data);
     if(m_debug) CheckError("CompressedTexSubImage2D");
 }
コード例 #32
0
ファイル: GL.gen.cs プロジェクト: nicolas-repiquet/Granite
 public static void Viewport(Box2i dimensions)
 {
     m_Viewport_1(dimensions);
     if(m_debug) CheckError("Viewport");
 }
コード例 #33
0
        public void DirtyBackBufferHeightTexture(Texture2D newHeightTexture, Box2i modified)
        {
            if (newHeightTexture == null)
                throw new ArgumentNullException("newHeightTexture");

            throw new NotImplementedException();
            /*if (modified.IsEmpty)
            {
                Terrain.RenderTargetCache.ReturnToPool(newHeightTexture);
                return;
            }

            var heightLayerComponent = Terrain.GetComponent<HeightTerrainComponent>();
            if (heightLayerComponent != null)
                heightLayerComponent.SetTexture(this, newHeightTexture);
            else
            {
                Terrain.RenderTargetCache.ReturnToPool(heightTexture);
                heightTexture = newHeightTexture;
                //Terrain.RenderTargetCache.ReturnToPool(newHeightTexture);
            }

            var fullArea = new Rectangle(0, 0, terrain.BlockSize, terrain.BlockSize);
            Rectangle.Intersect(ref modified, ref fullArea, out modified);
            if (DirtyTreeArea == null)
                DirtyTreeArea = modified;
            else
                DirtyTreeArea = Rectangle.Union(DirtyTreeArea.Value, modified);*/
        }
コード例 #34
0
ファイル: Glyph.cs プロジェクト: nicolas-repiquet/Granite
 public GlyphInfo(char character, Box2i textureBox)
 {
     m_character = character;
     m_textureBox = textureBox;
 }
コード例 #35
0
 void ProcessHeight(string techniqueName, Box2i modified)
 {
     Texture2D heightTexture = TerrainBlock.AllocateHeightBackBuffer();
     ProcessTarget(heightTexture, techniqueName);
     TerrainBlock.DirtyBackBufferHeightTexture(heightTexture, modified);
 }
コード例 #36
0
        public Sprite AddSprite(string name, Box2i coordinates)
        {
            var tw = (float)Texture.Size.X;
            var th = (float)Texture.Size.Y;

            var sprite = new Sprite(
                this,
                name,
                coordinates.Size,
                new Box2(
                    coordinates.Position.X / tw,
                    coordinates.Position.Y / th,
                    coordinates.Size.X / tw,
                    coordinates.Size.Y / th
            ));

            m_sprites.Add(sprite.Name, sprite);
            return sprite;
        }
コード例 #37
0
 public override void OnHeightModified(PlanarTerrainBlock block, ref Box2i area)
 {
     base.OnHeightModified(block, ref area);
     RecreateNormalMap(block);
 }
コード例 #38
0
ファイル: GL.gen.cs プロジェクト: nicolas-repiquet/Granite
 public static void CopyTexImage2D(uint target, int level, uint internalformat, Box2i image, int border)
 {
     m_CopyTexImage2D_2(target, level, internalformat, image, border);
     if(m_debug) CheckError("CopyTexImage2D");
 }
コード例 #39
0
 /// <summary>
 /// The terrain's heightmap has been modified and its changes have been accepted into the core.
 /// This is then called on each attached module to give it an opportunity to affect it.
 /// </summary>
 /// <param name="area"></param>
 public virtual void OnHeightModified(PlanarTerrainBlock block, ref Box2i area)
 {
 }