-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor Shader Metadata Handling and Improve Readability. #442
Conversation
@EliteMasterEric can you take a look at this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good with this PR except for the one issue I mentioned.
Thanks! |
Oh hey, @MAJigsaw77 can I get a basic example of what a simple FlxRuntimeShader extending class will look like, after this change? |
package;
import flixel.addons.display.FlxRuntimeShader;
class Chrome extends FlxRuntimeShader
{
@:glFragmentSource('
#pragma header
uniform float rOffset;
uniform float gOffset;
uniform float bOffset;
void main(void)
{
vec4 toUse = flixel_texture2D(bitmap, openfl_TextureCoordv);
toUse.r = flixel_texture2D(bitmap, openfl_TextureCoordv.st - vec2(rOffset, 0.0)).r;
toUse.g = flixel_texture2D(bitmap, openfl_TextureCoordv.st - vec2(gOffset, 0.0)).g;
toUse.b = flixel_texture2D(bitmap, openfl_TextureCoordv.st - vec2(bOffset, 0.0)).b;
gl_FragColor = toUse;
}')
public function new():Void
{
super();
}
} There isn't much of a difference except the fact that I'll use @:glFragmentSource from the extended class as the default values. |
It should work like extending FlxGraphicShader in a way. |
Thanks, again! I assume the old version would require more gl tags? |
Before this pr, it couldn't work like extending FlxGraphicShader but now it will as shown in example. |
FlxRuntimeShaderMacro
to dynamically retrieve shader metadata values, removing the need to manually copy strings from the original classes.toString
function inFlxRuntimeShader
for easier debugging.FlxRuntimeShader
methods for improved clarity and readability.