View source
class ShaderTemplates
package funkin.backend.shaders
import funkin.backend.shaders.FunkinShader
Static variables
View in GitHub
staticfinalread onlydefaultFragmentSource:String = "#pragma header\r\n\r\nvoid main(void) {\r\n\t#pragma body\r\n}"
View in GitHub
staticfinalread onlydefaultVertexSource:String = "#pragma header\r\n\r\nvoid main(void) {\r\n\t#pragma body\r\n}"
View in GitHub
staticfinalread onlyfragBody:String = "gl_FragColor = flixel_texture2D(bitmap, openfl_TextureCoordv);"
View in GitHub
staticfinalread onlyfragHeader:String = "varying float openfl_Alphav;\r\nvarying vec4 openfl_ColorMultiplierv;\r\nvarying vec4 openfl_ColorOffsetv;\r\nvarying vec2 openfl_TextureCoordv;\r\n\r\nuniform bool openfl_HasColorTransform;\r\nuniform vec2 openfl_TextureSize;\r\nuniform sampler2D bitmap;\r\n\r\nuniform bool hasTransform;\r\nuniform bool hasColorTransform;\r\n\r\nvec4 applyFlixelEffects(vec4 color) {\r\n\tif(!hasTransform) {\r\n\t\treturn color;\r\n\t}\r\n\r\n\tif(color.a == 0.0) {\r\n\t\treturn vec4(0.0, 0.0, 0.0, 0.0);\r\n\t}\r\n\r\n\tif(!hasColorTransform) {\r\n\t\treturn color * openfl_Alphav;\r\n\t}\r\n\r\n\tcolor.rgb = color.rgb / color.a;\r\n\tcolor = clamp(openfl_ColorOffsetv + (color * openfl_ColorMultiplierv), 0.0, 1.0);\r\n\r\n\tif(color.a > 0.0) {\r\n\t\treturn vec4(color.rgb * color.a * openfl_Alphav, color.a * openfl_Alphav);\r\n\t}\r\n\treturn vec4(0.0, 0.0, 0.0, 0.0);\r\n}\r\n\r\nvec4 flixel_texture2D(sampler2D bitmap, vec2 coord) {\r\n\tvec4 color = texture2D(bitmap, coord);\r\n\treturn applyFlixelEffects(color);\r\n}\r\n\r\nuniform vec4 _camSize;\r\n\r\nfloat map(float value, float min1, float max1, float min2, float max2) {\r\n\treturn min2 + (value - min1) * (max2 - min2) / (max1 - min1);\r\n}\r\n\r\nvec2 getCamPos(vec2 pos) {\r\n\tvec4 size = _camSize / vec4(openfl_TextureSize, openfl_TextureSize);\r\n\treturn vec2(map(pos.x, size.x, size.x + size.z, 0.0, 1.0), map(pos.y, size.y, size.y + size.w, 0.0, 1.0));\r\n}\r\nvec2 camToOg(vec2 pos) {\r\n\tvec4 size = _camSize / vec4(openfl_TextureSize, openfl_TextureSize);\r\n\treturn vec2(map(pos.x, 0.0, 1.0, size.x, size.x + size.z), map(pos.y, 0.0, 1.0, size.y, size.y + size.w));\r\n}\r\nvec4 textureCam(sampler2D bitmap, vec2 pos) {\r\n\treturn flixel_texture2D(bitmap, camToOg(pos));\r\n}"
View in GitHub
staticfinalread onlyvertBackCompatVarList:Array<EReg> = [~/attribute float alpha/, ~/attribute vec4 colorMultiplier/, ~/attribute vec4 colorOffset/, ~/uniform bool hasColorTransform/]
View in GitHub
staticfinalread onlyvertBody:String = "openfl_Alphav = openfl_Alpha;\r\nopenfl_TextureCoordv = openfl_TextureCoord;\r\n\r\nif(openfl_HasColorTransform) {\r\n\topenfl_ColorMultiplierv = openfl_ColorMultiplier;\r\n\topenfl_ColorOffsetv = openfl_ColorOffset / 255.0;\r\n}\r\n\r\nopenfl_Alphav = openfl_Alpha * alpha;\r\n\r\nif(hasColorTransform) {\r\n\topenfl_ColorOffsetv = colorOffset / 255.0;\r\n\topenfl_ColorMultiplierv = colorMultiplier;\r\n}\r\n\r\ngl_Position = openfl_Matrix * openfl_Position;"
View in GitHub
staticfinalread onlyvertBodyBackCompat:String = "openfl_Alphav = openfl_Alpha;\r\nopenfl_TextureCoordv = openfl_TextureCoord;\r\n\r\nif(openfl_HasColorTransform) {\r\n\topenfl_ColorMultiplierv = openfl_ColorMultiplier;\r\n\topenfl_ColorOffsetv = openfl_ColorOffset / 255.0;\r\n}\r\n\r\ngl_Position = openfl_Matrix * openfl_Position;"
View in GitHub
staticfinalread onlyvertHeader:String = "attribute float openfl_Alpha;\r\nattribute vec4 openfl_ColorMultiplier;\r\nattribute vec4 openfl_ColorOffset;\r\nattribute vec4 openfl_Position;\r\nattribute vec2 openfl_TextureCoord;\r\n\r\nvarying float openfl_Alphav;\r\nvarying vec4 openfl_ColorMultiplierv;\r\nvarying vec4 openfl_ColorOffsetv;\r\nvarying vec2 openfl_TextureCoordv;\r\n\r\nuniform mat4 openfl_Matrix;\r\nuniform bool openfl_HasColorTransform;\r\nuniform vec2 openfl_TextureSize;\r\n\r\nattribute float alpha;\r\nattribute vec4 colorMultiplier;\r\nattribute vec4 colorOffset;\r\nuniform bool hasColorTransform;"
View in GitHub