public void RenderBorderBack(ISquare square) { if (_glUtils.DrawQuad(_frameBuffer, square, _quad)) { return; } float width = _settings.VirtualResolution.Width; float height = _settings.VirtualResolution.Height; IGLColor color = IsSelected ? _selectedColor : _color; IGLColor foldColor = IsSelected ? _selectedFoldColor : _foldColor; float foldHeight = height * (1f / 5f); PointF foldBottom = new PointF(width / 2f, foldHeight); _frameBuffer = _glUtils.BeginFrameBuffer(square, _settings); _glUtils.DrawQuad(0, new Vector3(0, height, 0), new Vector3(width, height, 0), new Vector3(), new Vector3(width, 0, 0), color, color, color, color); _glUtils.DrawTriangle(0, new GLVertex[] { new GLVertex(new Vector2(), _emptyVector, foldColor), new GLVertex(foldBottom.ToVector2(), _emptyVector, foldColor), new GLVertex(new Vector2(width, 0), _emptyVector, foldColor) }); _frameBuffer.End(); _glUtils.DrawQuad(_frameBuffer, square, _quad); }
public void RenderBorderBack(ISquare square) { if (_glUtils.DrawQuad(_frameBuffer, square, _quad)) { return; } float width = _settings.VirtualResolution.Width; float height = _settings.VirtualResolution.Height; float foldWidth = (width) * (1f / 5f); float foldHeight = (height) * (1f / 5f); IGLColor color = IsSelected ? _selectedColor : _color; IGLColor foldColor = IsSelected ? _selectedFoldColor : _foldColor; Vector3 foldBottomLeft = new Vector3(width - foldWidth, foldHeight, 0); Vector3 foldTopLeft = new Vector3(width - foldWidth, 0, 0); Vector3 foldTopRight = new Vector3(width, foldHeight, 0); _frameBuffer = _glUtils.BeginFrameBuffer(square, _settings); _glUtils.DrawQuad(0, new Vector3(0f, height, 0), new Vector3(width - foldWidth, height, 0), new Vector3(), foldTopLeft, color, color, color, color); _glUtils.DrawQuad(0, new Vector3(width - foldWidth, height, 0), new Vector3(width, height, 0), foldBottomLeft, foldTopRight, color, color, color, color); _glUtils.DrawTriangle(0, new GLVertex[] { new GLVertex(foldBottomLeft.Xy, _emptyVector, foldColor), new GLVertex(foldTopLeft.Xy, _emptyVector, foldColor), new GLVertex(foldTopRight.Xy, _emptyVector, foldColor) }); _frameBuffer.End(); _glUtils.DrawQuad(_frameBuffer, square, _quad); }
public void Render(IObject obj, IViewport viewport) { ISprite sprite = obj.Animation?.Sprite; if (sprite == null || sprite.Image == null) { return; } var boundingBoxes = obj.GetBoundingBoxes(viewport); if (boundingBoxes == null || !boundingBoxes.RenderBox.IsValid) { return; } ITexture texture = _textures.GetOrAdd(sprite.Image.ID, _createTextureFunc); _colorAdjusters[0] = sprite; _colorAdjusters[1] = obj; IGLColor color = _colorBuilder.Build(_colorAdjusters); IBorderStyle border = obj.Border; AGSBoundingBox borderBox = _emptySquare; if (!obj.Visible) { return; } if (border != null) { if (boundingBoxes.RenderBox.BottomLeft.X > boundingBoxes.RenderBox.BottomRight.X) { borderBox = boundingBoxes.RenderBox.FlipHorizontal(); } else { borderBox = boundingBoxes.RenderBox; } border.RenderBorderBack(borderBox); } _renderer.Render(texture.ID, boundingBoxes, color); border?.RenderBorderFront(borderBox); if (obj.DebugDrawPivot) { IObject parent = obj.TreeNode.Parent; float x = obj.X; float y = obj.Y; while (parent != null) { x += (parent.X - parent.Width * parent.Pivot.X); y += (parent.Y - parent.Height * parent.Pivot.Y); parent = parent.TreeNode.Parent; } _glUtils.DrawCross(x - viewport.X, y - viewport.Y, 10, 10, 1f, 1f, 1f, 1f); } }
public void DrawQuad(int texture, Vector3 bottomLeft, Vector3 bottomRight, Vector3 topLeft, Vector3 topRight, IGLColor color, FourCorners <Vector2> texturePos) { GLVertex[] vertices = new GLVertex[] { new GLVertex(bottomLeft.Xy, texturePos.BottomLeft, color), new GLVertex(bottomRight.Xy, texturePos.BottomRight, color), new GLVertex(topRight.Xy, texturePos.TopRight, color), new GLVertex(topLeft.Xy, texturePos.TopLeft, color) }; DrawQuad(texture, vertices); }
public void DrawQuad(int texture, AGSBoundingBox box, IGLColor color, FourCorners <Vector2> texturePos) { _quad[0] = new GLVertex(box.BottomLeft.Xy, texturePos.BottomLeft, color); _quad[1] = new GLVertex(box.BottomRight.Xy, texturePos.BottomRight, color); _quad[2] = new GLVertex(box.TopRight.Xy, texturePos.TopRight, color); _quad[3] = new GLVertex(box.TopLeft.Xy, texturePos.TopLeft, color); DrawQuad(texture, _quad); }
private GLColor getColor(IGLColor color1, IGLColor color2, float fraction) { float r = color1.R + ((color2.R - color1.R) * fraction); float g = color1.G + ((color2.G - color1.G) * fraction); float b = color1.B + ((color2.B - color1.B) * fraction); float a = color1.A + ((color2.A - color1.A) * fraction); return(new GLColor(r, g, b, a)); }
public XIcon(IGLUtils glUtils, IRuntimeSettings settings, float lineWidth, float padding, Color?color) { _glUtils = glUtils; _settings = settings; color = color ?? Colors.Red; _color = color.Value.ToGLColor(); _lineWidth = lineWidth; _padding = padding; }
public void DrawQuad(int texture, Vector3 bottomLeft, Vector3 bottomRight, Vector3 topLeft, Vector3 topRight, IGLColor bottomLeftColor, IGLColor bottomRightColor, IGLColor topLeftColor, IGLColor topRightColor) { GLVertex[] vertices = new GLVertex[] { new GLVertex(bottomLeft.Xy, _bottomLeft, bottomLeftColor), new GLVertex(bottomRight.Xy, _bottomRight, bottomRightColor), new GLVertex(topRight.Xy, _topRight, topRightColor), new GLVertex(topLeft.Xy, _topLeft, topLeftColor) }; DrawQuad(texture, vertices); }
public void Render(int texture, IGLBoundingBox boundingBox, IGLColor color) { Vector3 bottomLeft = boundingBox.BottomLeft; Vector3 topLeft = boundingBox.TopLeft; Vector3 bottomRight = boundingBox.BottomRight; Vector3 topRight = boundingBox.TopRight; _glUtils.DrawQuad(texture, bottomLeft, bottomRight, topLeft, topRight, color.R, color.G, color.B, color.A); }
public void Render(int texture, IGLBoundingBox boundingBox, IGLColor color) { Vector3 bottomLeft = boundingBox.BottomLeft; Vector3 topLeft = boundingBox.TopLeft; Vector3 bottomRight = boundingBox.BottomRight; Vector3 topRight = boundingBox.TopRight; _glUtils.DrawQuad (texture, bottomLeft, bottomRight, topLeft, topRight, color.R, color.G, color.B, color.A); }
public void DrawQuad(int texture, Vector3 bottomLeft, Vector3 bottomRight, Vector3 topLeft, Vector3 topRight, IGLColor bottomLeftColor, IGLColor bottomRightColor, IGLColor topLeftColor, IGLColor topRightColor) { _quad[0] = new GLVertex(bottomLeft.Xy, _bottomLeft, bottomLeftColor); _quad[1] = new GLVertex(bottomRight.Xy, _bottomRight, bottomRightColor); _quad[2] = new GLVertex(topRight.Xy, _topRight, topRightColor); _quad[3] = new GLVertex(topLeft.Xy, _topLeft, topLeftColor); DrawQuad(texture, _quad); }
public FolderIcon(IGLUtils glUtils, IRuntimeSettings settings, Color?color = null, Color?foldColor = null, Color?selectedColor = null, Color?selectedFoldColor = null) { _glUtils = glUtils; _settings = settings; _color = (color ?? (Color?)Colors.Gold).Value.ToGLColor(); _foldColor = (foldColor ?? (Color?)Colors.DarkGoldenrod).Value.ToGLColor(); _selectedColor = (selectedColor ?? (Color?)Colors.DeepSkyBlue).Value.ToGLColor(); _selectedFoldColor = (selectedFoldColor ?? (Color?)Colors.Blue).Value.ToGLColor(); }
public FileIcon(IGLUtils glUtils, IRuntimeSettings settings, Color?color = null, Color?foldColor = null, Color?selecedColor = null, Color?selectedFoldColor = null) { _glUtils = glUtils; _settings = settings; _color = (color ?? (Color?)Colors.OldLace).Value.ToGLColor(); _foldColor = (foldColor ?? (Color?)Colors.Gray).Value.ToGLColor(); _selectedColor = (selecedColor ?? (Color?)Colors.DeepSkyBlue).Value.ToGLColor(); _selectedFoldColor = (selectedFoldColor ?? (Color?)Colors.Blue).Value.ToGLColor(); }
public void Render(int texture, AGSBoundingBoxes boundingBoxes, IGLColor color) { if (boundingBoxes.TextureBox == null) { _glUtils.DrawQuad(texture, boundingBoxes.RenderBox, color.R, color.G, color.B, color.A); } else { _glUtils.DrawQuad(texture, boundingBoxes.RenderBox, color, boundingBoxes.TextureBox); } }
public void Render(IObject obj, IViewport viewport) { if (!TextBackgroundVisible && !TextVisible) { return; } if (!obj.Visible || _usedTextBoundingBoxes == null) { return; } PointF resolutionFactor; Size resolution; PointF textScaleFactor = new PointF(GLText.TextResolutionFactorX, GLText.TextResolutionFactorY); AGSModelMatrixComponent.GetVirtualResolution(false, _virtualResolution, obj, textScaleFactor, out resolutionFactor, out resolution); if (!resolutionFactor.Equals(textScaleFactor)) { resolutionFactor = AGSModelMatrixComponent.NoScaling; } if (TextBackgroundVisible) { _bgRenderer.Render(obj, viewport); } if (TextVisible && Text != "") { _glTextHitTest.Refresh(); if (!string.IsNullOrEmpty(Text)) { _glUtils.AdjustResolution(resolution.Width, resolution.Height); } IGLColor color = _colorBuilder.Build(Colors.White); var cropInfo = _usedTextBoundingBoxes.RenderBox.Crop(BoundingBoxType.Render, CustomTextCrop ?? obj.GetComponent <ICropSelfComponent>(), AGSModelMatrixComponent.NoScaling); if (cropInfo.Equals(_defaultCrop)) { return; } _afterCropTextBoundingBoxes.RenderBox = cropInfo.BoundingBox; _afterCropTextBoundingBoxes.TextureBox = cropInfo.TextureBox; _textureRenderer.Render(_glTextHitTest.Texture, _afterCropTextBoundingBoxes, color); } }
public void Render(IObject obj, IViewport viewport) { if (getAutoFit() == AutoFit.LabelShouldFitText) { _glUtils.AdjustResolution(GLText.TextResolutionWidth, GLText.TextResolutionHeight); } _bgRenderer.Render(obj, viewport); if (TextVisible && Text != "") { if (!string.IsNullOrEmpty(Text)) { _glUtils.AdjustResolution(GLText.TextResolutionWidth, GLText.TextResolutionHeight); } IGLColor color = _colorBuilder.Build(Colors.White); _textureRenderer.Render(_glText.Texture, _usedTextBoundingBoxes.RenderBox, color); } }
public AGSSlicedImageBorder(IGLUtils glUtils) { _glUtils = glUtils; _white = Colors.White.ToGLColor(); }
public void DrawQuad(int texture, Vector3 bottomLeft, Vector3 bottomRight, Vector3 topLeft, Vector3 topRight, IGLColor bottomLeftColor, IGLColor bottomRightColor, IGLColor topLeftColor, IGLColor topRightColor) { texture = getTexture(texture); _graphics.BindTexture2D(texture); GLVertex[] vertices = new GLVertex[]{ new GLVertex(bottomLeft.Xy, _bottomLeft, bottomLeftColor), new GLVertex(bottomRight.Xy, _bottomRight, bottomRightColor), new GLVertex(topRight.Xy, _topRight, topRightColor), new GLVertex(topLeft.Xy, _topLeft, topLeftColor)}; drawVertices(vertices); }
private GLColor getColor(IGLColor color1, IGLColor color2, float fraction) { float r = color1.R + ((color2.R - color1.R) * fraction); float g = color1.G + ((color2.G - color1.G) * fraction); float b = color1.B + ((color2.B - color1.B) * fraction); float a = color1.A + ((color2.A - color1.A) * fraction); return new GLColor (r, g, b, a); }
public void Render(IObject obj, IViewport viewport) { if (obj.Animation == null) { return; } ISprite sprite = obj.Animation.Sprite; if (sprite == null || sprite.Image == null) { return; } var layerViewport = _layerViewports.GetViewport(obj.RenderLayer.Z); var gameResolution = AGSGame.Game.Settings.VirtualResolution; var resolution = obj.RenderLayer.IndependentResolution ?? gameResolution; bool resolutionMatches = resolution.Equals(gameResolution); var viewportMatrix = obj.IgnoreViewport ? Matrix4.Identity : layerViewport.GetMatrix(viewport, obj.RenderLayer.ParallaxSpeed); var modelMatrices = obj.GetModelMatrices(); _matrices.ModelMatrix = modelMatrices.InVirtualResolutionMatrix; _matrices.ViewportMatrix = viewportMatrix; _boundingBoxBuilder.Build(BoundingBoxes, sprite.Image.Width, sprite.Image.Height, _matrices, resolutionMatches, true); IGLBoundingBox hitTestBox = BoundingBoxes.HitTestBox; if (!resolutionMatches) { _matrices.ModelMatrix = modelMatrices.InObjResolutionMatrix; _boundingBoxBuilder.Build(BoundingBoxes, sprite.Image.Width, sprite.Image.Height, _matrices, true, false); } IGLBoundingBox renderBox = BoundingBoxes.RenderBox; ITexture texture = _textures.GetOrAdd(sprite.Image.ID, () => createNewTexture(sprite.Image.ID)); IGLColor color = _colorBuilder.Build(sprite, obj); IBorderStyle border = obj.Border; ISquare renderSquare = null; if (border != null) { renderSquare = renderBox.ToSquare(); border.RenderBorderBack(renderSquare); } _renderer.Render(texture.ID, renderBox, color); Vector3 bottomLeft = hitTestBox.BottomLeft; Vector3 topLeft = hitTestBox.TopLeft; Vector3 bottomRight = hitTestBox.BottomRight; Vector3 topRight = hitTestBox.TopRight; AGSSquare square = new AGSSquare(new PointF(bottomLeft.X, bottomLeft.Y), new PointF(bottomRight.X, bottomRight.Y), new PointF(topLeft.X, topLeft.Y), new PointF(topRight.X, topRight.Y)); obj.BoundingBox = square; if (border != null) { border.RenderBorderFront(renderSquare); } if (obj.DebugDrawAnchor) { IObject parent = obj.TreeNode.Parent; float x = obj.X; float y = obj.Y; while (parent != null) { x += (parent.X - parent.Width * parent.Anchor.X); y += (parent.Y - parent.Height * parent.Anchor.Y); parent = parent.TreeNode.Parent; } _glUtils.DrawCross(x - viewport.X, y - viewport.Y, 10, 10, 1f, 1f, 1f, 1f); } }
public GLVertex(Vector2 position, Vector2 texCoord, IGLColor color) : this(position, texCoord, color.R, color.G, color.B, color.A) { }
public void DrawQuad(int texture, Vector3 bottomLeft, Vector3 bottomRight, Vector3 topLeft, Vector3 topRight, IGLColor color, FourCorners<Vector2> texturePos) { texture = getTexture(texture); _graphics.BindTexture2D (texture); GLVertex[] vertices = new GLVertex[]{ new GLVertex(bottomLeft.Xy, texturePos.BottomLeft, color), new GLVertex(bottomRight.Xy, texturePos.BottomRight, color), new GLVertex(topRight.Xy, texturePos.TopRight, color), new GLVertex(topLeft.Xy, texturePos.TopLeft, color)}; drawVertices(vertices); }