#Yeah. In fact: surface.* functions

1 messages · Page 1 of 1 (latest)

placid basin
#

I'm so angry to hear that.

How did you figure that out?

wraith sundial
# placid basin I'm so angry to hear that. How did you figure that out?

Saw that from some dude, then checked surface.* cpp code via some debates with another guy, and found that:
https://github.com/lua9520/source-engine-2018-hl2_src/blob/3bf9df6b2785fa6d951086978a3e66f49427166a/hammer/Render.cpp#L845

GitHub

Leaked TF2 Source Engine source code from ~2018. Thanks Tyler McVicker! (lib, tools/runtime excluded) - lua9520/source-engine-2018-hl2_src

placid basin
#

That's just wild

#

I mean, I guess that makes textured rects make sense

#

They're not re-inventing texturing and such, they're just re-using what's already there

#

A non-stenciled, non-masked, non-image-cornered rounded rectangle is honestly pretty big

#

Especially if it's faster

wraith sundial
#

so you will only make 1 draw call, not 100 for an example

#

and you won't need to make render targets to cache some stuff

placid basin
#

I'm not necessarily suggesting that you take this up as a project, but that sounds exactly like a very valuable library that could be created

wraith sundial
placid basin
#

If it's within the same realm of difficulty/performance, being able to union/intersection shapes would be especially useful

wraith sundial
#

@placid basin

     local rainbowRT = GetRenderTarget('rainbowRT', 256, 256)

    render.PushRenderTarget(rainbowRT)
        render.Clear(0, 0, 0, 0, true, true)
        cam.Start2D()
            local x, y = 256, 256
            render.SetMaterial(Material('vgui/white'))
            mesh.Begin(MATERIAL_QUADS, 1)
                mesh.Color(0, 0, 0, 255)
                mesh.Position(Vector(0, 0))

                mesh.AdvanceVertex()

                mesh.Color(255, 0, 0, 255)
                mesh.Position(Vector(x, 0))

                mesh.AdvanceVertex()

                mesh.Color(255, 255, 0, 255)
                mesh.Position(Vector(x, y))

                mesh.AdvanceVertex()

                mesh.Color(0, 255, 0, 255)
                mesh.Position(Vector(0, y))
                mesh.AdvanceVertex()
            mesh.End()
        cam.End2D()
    render.PopRenderTarget()

here's a gradient material creation. As you see, you could use meshes for gradient creation.

#

But you have to use IMeshes, because they cache meshes to C, so there won't be a C -> Lua overhead, and therefore you will achieve way better performance

placid basin
#

Interesting

#

I should spend some time learning about IMeshes

#

Especially if they can be used for more efficient 2D rendering