Skip to content

DrawLineにおいて、線分でないと描画ができない。(バグ) #217

@smk7758

Description

@smk7758

version: 6.1.2
DrawLineは「線を描画します」(DrawLine() | Interface IGraphics | GameCanvas)という基本的な関数ですが、線分を描画するのみで「直線」を描画することができません。
ソースコードを確認すると、線分を弾いているようです。
// todo: 直線の描画と書くのであれば、少なくともドキュメントにDrawLineは線分しか書けないことを明記すること、および単にImplementErrorを出すのではなく、たとえば、NotImplementedException("The line must be line segment.")と書くべきです。

        public void DrawLine(in GcLine line)
        {
            if (!m_IsInit || line.IsZero()) return;

            if (!line.IsSegment())
            {
                // todo: 直線の描画
                throw new System.NotImplementedException();
            }

            var s = new float2(line.Length, line.Length);
            var mtx = GcAffine.FromTRS(line.Origin, line.Radian(), s).Mul(m_CurrentMatrix);

            var mesh = m_MeshPool.GetOrCreate();
            var lineWidth = math.max(m_CurrentStyle.LineWidth, m_PixelSizeMin);
            if (TrySetupMeshAsLine(mesh, m_CurrentStyle.LineCap, lineWidth, mtx))
            {
                DrawMeshDirect(mesh, m_CurrentStyle.Color);
            }
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions