IsmAvatar / LateralGM

A free Game Maker source file editor
http://lateralgm.org/
Other
95 stars 25 forks source link

New Shader Template #544

Closed RobertBColton closed 3 years ago

RobertBColton commented 3 years ago

Idea here is simple, provide an actual template of source code when a new shader is created. GameMaker Studio has always done this and I think it's a good idea. It helps novice users pick up shaders easier by giving them a working one out of the box without having to scrape for the details alone. It also saves advanced users some time by not having them write the same basic outline for every new shader.

A couple of critical decisions were made here. The first is that I decided to put the shader template in a separate file in the jar rather than inlined in the Java class source. This way users can override it themselves. I made the static class variables public so plugins can also override the template to provide a shader that better matches their runtime. The template uses tabs, since JoshEdit has an option to convert those to spaces, so it can accommodate both. Finally, the shader template is a GLSLES version 100 shader since it's the lowest common denominator for cross-platform development. GameMaker Studio made the same decision and is probably transpiling from GLSLES, and that's why we should target it.