@@ -30,7 +30,7 @@ class FunkinShader extends FlxRuntimeShader implements IHScriptCustomBehaviour {
3030 public var onGLUpdate : FlxTypedSignal <Void -> Void > = new FlxTypedSignal <Void -> Void >();
3131
3232 public function new (? fragmentSource : String , ? vertexSource : String , ? version : String ) {
33- super (fragmentSource , vertexSource , version );
33+ super (fragmentSource , vertexSource , version ?? ( fragmentSource != null || vertexSource != null ? Flags . DEFAULT_GLSL_VERSION : null ) );
3434 }
3535
3636 public static function fromFile (fragmentPath : String , ? vertexPath : String , ? version : String ): FunkinShader {
@@ -44,7 +44,9 @@ class FunkinShader extends FlxRuntimeShader implements IHScriptCustomBehaviour {
4444 else vertexPath = fragmentPath .substr (0 , idx );
4545 }
4646
47- _fromFile (FlxRuntimeShader ._getPath (fragmentPath , false ), FlxRuntimeShader ._getPath (vertexPath , true ), version );
47+ fragmentPath = FlxRuntimeShader ._getPath (fragmentPath , false );
48+ vertexPath = FlxRuntimeShader ._getPath (vertexPath , true );
49+ _fromFile (fragmentPath , vertexPath , version ?? (fragmentPath != null || vertexPath != null ? Flags .DEFAULT_GLSL_VERSION : null ));
4850
4951 return this ;
5052 }
@@ -156,6 +158,18 @@ class FunkinShader extends FlxRuntimeShader implements IHScriptCustomBehaviour {
156158 private static var FRAGMENT_SHADER = 0 ;
157159 private static var VERTEX_SHADER = 1 ;
158160
161+ public var fileName (get , set ): String ;
162+ inline function get_fileName (): String return _fragmentFilePath ?? _vertexFilePath ?? " FunkinShader" ;
163+ inline function set_fileName (v : String ): String return _fragmentFilePath = _vertexFilePath = v ;
164+
165+ public var fragFileName (get , set ): String ;
166+ inline function get_fragFileName (): String return _fragmentFilePath ?? " FunkinShader" ;
167+ inline function set_fragFileName (v : String ): String return _fragmentFilePath = v ;
168+
169+ public var vertFileName (get , set ): String ;
170+ inline function get_vertFileName (): String return _vertexFilePath ?? " FunkinShader" ;
171+ inline function set_vertFileName (v : String ): String return _vertexFilePath = v ;
172+
159173 public var glslVer (get , set ): String ;
160174 inline function get_glslVer (): String return glVersion ;
161175 inline function set_glslVer (v : String ): String return glVersion = v ;
@@ -168,17 +182,7 @@ class FunkinShader extends FlxRuntimeShader implements IHScriptCustomBehaviour {
168182 inline function get_glRawVertexSource (): String return __glVertexSourceRaw ;
169183 inline function set_glRawVertexSource (v : String ): String return __glVertexSourceRaw = v ;
170184
171- public var fileName (get , set ): String ;
172- inline function get_fileName (): String return _fragmentFilePath ?? _vertexFilePath ?? " FunkinShader" ;
173- inline function set_fileName (v : String ): String return _fragmentFilePath = _vertexFilePath = v ;
174-
175- public var fragFileName (get , set ): String ;
176- inline function get_fragFileName (): String return _fragmentFilePath ?? " FunkinShader" ;
177- inline function set_fragFileName (v : String ): String return _fragmentFilePath = v ;
178-
179- public var vertFileName (get , set ): String ;
180- inline function get_vertFileName (): String return _vertexFilePath ?? " FunkinShader" ;
181- inline function set_vertFileName (v : String ): String return _vertexFilePath = v ;
185+ function thisHasField (v : String ): Bool return __thisHasField (v );
182186
183187 function registerParameter (name : String , type : String , isUniform : Bool ) {
184188 __registerParameter (name , Shader .getParameterTypeFromGLSL (type , false ), StringTools .startsWith (type , " sampler" ), 1 , null , isUniform , null );
0 commit comments