Porting fragment filter from starling

porting some custom shaders from flash (starling) codebase to openfl (starling). In fact everything goes surprisingly smooth :slight_smile:

But there is one thing that seems to be lost in haxe port. In flash i could overwrite ā€œprogram variant nameā€ in custom FragmentFilter to allow starling to cache program instances
override function get programVariantName():uint

But in haxe this is a property with private getterā€¦ so it can not be overridden.
how i can feed starling with proper mask for custom program?


    /** Override this method if the effect requires a different program depending on the
     *  current settings. Ideally, you do this by creating a bit mask encoding all the options.
     *  This method is called often, so do not allocate any temporary objects when overriding.
     *
     *  @default 0
     */
	public var programVariantName(get, never):UInt;
    private function get_programVariantName():UInt
    {
        return 0;
    }

Hmm. It of course can be overridden. Here you go - or am I missing some point? Tested on HTML5 target. :slight_smile:

class Main extends Sprite {
	public function new() {
		super();

		var foo:Foo = new Foo();
		var bar:Bar = new Bar();

		js.Browser.console.log(foo.bar);
		js.Browser.console.log(bar.bar);
	}
}
package ;
class Bar extends Foo {
	public function new() {
		super();
	}

	override private function get_bar():Int {
		return 1;
	}
}

package ;

class Foo {
	public var bar(get, never):Int;

	public function new() {

	}

	private function get_bar():Int {
		return 0;
	}

}
1 Like

Hm, indeed, simple getter override works as expected, thank you.
Started to learn Haxe not so long ago :slight_smile: