lispysnake / serpent

Cross-platform gaming kit in the D programming language
https://lispysnake.com
zlib License
142 stars 3 forks source link

Set sampling per-texture-basis #18

Open ikeycode opened 4 years ago

ikeycode commented 4 years ago

Right now we set MAG_POINT sampling universally - however this breaks non-pixel-perfect applications when scaling.

See with MAG_POINT BeforeSamplingFix

And without MAG_POINT

AfterSamplingFix

It's a fairly quick fix, bgfx_set_texture should respect texture clamp/sampling via uint32_t.max, and in texture construction we should allow overriding the sampling. Make a clearly documented API on this one to avoid confusion.

ikeycode commented 4 years ago

It should be pointed out that you're kinda stuck with MAG_POINT if using dense tilesheets - and ideally a logical scale should be used with MAG_POINT. This is perfect for 2d pixel art, tiled maps, etc, but not so great for more modern styles.

ikeycode commented 4 years ago

Note both screenshots are at 1920x1080p fullscreen w/ vulkan, logical render size 1366x768.

ikeycode commented 4 years ago

Also we need to stop abusing npow2 textures in our demos. >_>