Facepunch/garrysmod-requests

Add mesh.Position(x, y, z) and mesh.Normal(x, y, z) overload

Jaffies opened this issue · 1 comments

Basically, this overload should use bare numbers as 3 integers, instead of vectors.
It would be good, because the original source function (meshBuilder.Position3f, meshBuilder.Normal3f) uses 3 numbers, not vectors.
Better for performance too, you do not need to create a lot of vectors. Just use numbers, as they are easier.
Example of new code

hook.Add('HUDPaint', 'test', function()
    render.SetColorMaterial()
    mesh.Begin(MATERIAL_LINE_LOOP, 3)
        mesh.Color(255, 255, 255, 255)
        mesh.Position(0, 0, 0)

        mesh.AdvanceVertex()

        mesh.Color(255, 0, 0, 255)
        mesh.Position(100, 64, 0)

        mesh.AdvanceVertex()

        mesh.Color(0, 0, 255, 255)
        mesh.Position(64, 90, 0)

        mesh.AdvanceVertex()
    mesh.End()
end)

Done for the following:

  • mesh.Position
  • mesh.Normal
  • mesh.TangentS
  • mesh.TangentT

Keep in mind overloading like this incurs a performance penalty for both, number only and vector inputs.