diff --git a/examples/shader/chromaticaberration_go.go b/examples/shader/chromaticaberration_go.go index 6f72eddbc..821e5a457 100644 --- a/examples/shader/chromaticaberration_go.go +++ b/examples/shader/chromaticaberration_go.go @@ -5,4 +5,4 @@ package main -var chromaticaberration_go = []byte("// Copyright 2020 The Ebiten Authors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// +build ignore\n\npackage main\n\nvar Time float\nvar Cursor vec2\nvar ScreenSize vec2\n\nfunc Fragment(position vec4, texCoord vec2, color vec4) vec4 {\n\tcenter := ScreenSize / 2\n\tamount := (center - Cursor) / 10 / imageSrcTextureSize()\n\tvar clr vec3\n\tclr.r = imageSrc2At(texCoord + amount).r\n\tclr.g = imageSrc2UnsafeAt(texCoord).g\n\tclr.b = imageSrc2At(texCoord - amount).b\n\treturn vec4(clr, 1.0)\n}\n") +var chromaticaberration_go = []byte("// Copyright 2020 The Ebiten Authors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n//go:build ignore\n// +build ignore\n\npackage main\n\nvar Time float\nvar Cursor vec2\nvar ScreenSize vec2\n\nfunc Fragment(position vec4, texCoord vec2, color vec4) vec4 {\n\tcenter := ScreenSize / 2\n\tamount := (center - Cursor) / 10 / imageSrcTextureSize()\n\tvar clr vec3\n\tclr.r = imageSrc2At(texCoord + amount).r\n\tclr.g = imageSrc2UnsafeAt(texCoord).g\n\tclr.b = imageSrc2At(texCoord - amount).b\n\treturn vec4(clr, 1.0)\n}\n") diff --git a/examples/shader/crt.go b/examples/shader/crt.go index 7c5035b51..72ce64fce 100644 --- a/examples/shader/crt.go +++ b/examples/shader/crt.go @@ -46,7 +46,10 @@ func Fragment(position vec4, texCoord vec2, color vec4) vec4 { Y := f.y * f.y YY := Y * Y whichmask := fract(pos.x * -0.4999) - mask := 1.0 + float(whichmask < 0.5)*-MASK_DARK + mask := 1.0 + if whichmask < 0.5 { + mask -= MASK_DARK + } clr := imageSrc2At(p*size + origin).rgb scanLineWeight := (BRIGHTBOOST - LOWLUMSCAN*(Y-2.05*YY)) diff --git a/examples/shader/crt_go.go b/examples/shader/crt_go.go index 1d5e0d436..6c37a603c 100644 --- a/examples/shader/crt_go.go +++ b/examples/shader/crt_go.go @@ -1,5 +1,8 @@ // Code generated by file2byteslice. DO NOT EDIT. +//go:build example +// +build example + package main -var crt_go = []byte("// Copyright 2022 The Ebiten Authors\r\n//\r\n// Licensed under the Apache License, Version 2.0 (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.apache.org/licenses/LICENSE-2.0\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n\r\n//go:build ignore\r\n// +build ignore\r\n\r\npackage main\r\n\r\nvar Time float\r\nvar Cursor vec2\r\nvar ScreenSize vec2\r\n\r\nfunc Fragment(position vec4, texCoord vec2, color vec4) vec4 {\r\n\tconst (\r\n\t\tBLURSCALEX = 0.45\r\n\t\tLOWLUMSCAN = 5.0\r\n\t\tHILUMSCAN = 10.0\r\n\t\tBRIGHTBOOST = 1.25\r\n\t\tMASK_DARK = 0.25\r\n\t\tMASK_FADE = 0.8\r\n\t)\r\n\r\n\tpos := texCoord\r\n\torigin, size := imageDstRegionOnTexture()\r\n\tpos -= origin\r\n\tpos /= size\r\n\r\n\tmaskFade := 0.3333 * MASK_FADE\r\n\tinvDims := 1.0 / imageDstTextureSize().xy\r\n\tp := pos * imageDstTextureSize()\r\n\ti := floor(p) + 0.50\r\n\tf := p - i\r\n\tp = (i + 4.0*f*f*f) * invDims\r\n\tp.x = mix(p.x, pos.x, BLURSCALEX)\r\n\tY := f.y * f.y\r\n\tYY := Y * Y\r\n\twhichmask := fract(pos.x * -0.4999)\r\n\tmask := 1.0 + float(whichmask < 0.5)*-MASK_DARK\r\n\r\n\tclr := imageSrc2At(p*size + origin).rgb\r\n\tscanLineWeight := (BRIGHTBOOST - LOWLUMSCAN*(Y-2.05*YY))\r\n\tscanLineWeightB := 1.0 - HILUMSCAN*(YY-2.8*YY*Y)\r\n\r\n\treturn vec4(clr.rgb*mix(scanLineWeight*mask, scanLineWeightB, dot(clr.rgb, vec3(maskFade))), 1.0)\r\n}\r\n") +var crt_go = []byte("// Copyright 2022 The Ebiten Authors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n//go:build ignore\n// +build ignore\n\npackage main\n\nvar Time float\nvar Cursor vec2\nvar ScreenSize vec2\n\nfunc Fragment(position vec4, texCoord vec2, color vec4) vec4 {\n\tconst (\n\t\tBLURSCALEX = 0.45\n\t\tLOWLUMSCAN = 5.0\n\t\tHILUMSCAN = 10.0\n\t\tBRIGHTBOOST = 1.25\n\t\tMASK_DARK = 0.25\n\t\tMASK_FADE = 0.8\n\t)\n\n\tpos := texCoord\n\torigin, size := imageDstRegionOnTexture()\n\tpos -= origin\n\tpos /= size\n\n\tmaskFade := 0.3333 * MASK_FADE\n\tinvDims := 1.0 / imageDstTextureSize().xy\n\tp := pos * imageDstTextureSize()\n\ti := floor(p) + 0.50\n\tf := p - i\n\tp = (i + 4.0*f*f*f) * invDims\n\tp.x = mix(p.x, pos.x, BLURSCALEX)\n\tY := f.y * f.y\n\tYY := Y * Y\n\twhichmask := fract(pos.x * -0.4999)\n\tmask := 1.0\n\tif whichmask < 0.5 {\n\t\tmask -= MASK_DARK\n\t}\n\n\tclr := imageSrc2At(p*size + origin).rgb\n\tscanLineWeight := (BRIGHTBOOST - LOWLUMSCAN*(Y-2.05*YY))\n\tscanLineWeightB := 1.0 - HILUMSCAN*(YY-2.8*YY*Y)\n\n\treturn vec4(clr.rgb*mix(scanLineWeight*mask, scanLineWeightB, dot(clr.rgb, vec3(maskFade))), 1.0)\n}\n") diff --git a/examples/shader/default_go.go b/examples/shader/default_go.go index 20258ed98..d20f642dc 100644 --- a/examples/shader/default_go.go +++ b/examples/shader/default_go.go @@ -5,4 +5,4 @@ package main -var default_go = []byte("// Copyright 2020 The Ebiten Authors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// +build ignore\n\npackage main\n\nvar Time float\nvar Cursor vec2\nvar ScreenSize vec2\n\nfunc Fragment(position vec4, texCoord vec2, color vec4) vec4 {\n\tpos := position.xy/imageDstTextureSize() + Cursor/ScreenSize/4\n\tclr := 0.0\n\tclr += sin(pos.x*cos(Time/15)*80) + cos(pos.y*cos(Time/15)*10)\n\tclr += sin(pos.y*sin(Time/10)*40) + cos(pos.x*sin(Time/25)*40)\n\tclr += sin(pos.x*sin(Time/5)*10) + sin(pos.y*sin(Time/35)*80)\n\tclr *= sin(Time/10) * 0.5\n\treturn vec4(clr, clr*0.5, sin(clr+Time/3)*0.75, 1)\n}\n") +var default_go = []byte("// Copyright 2020 The Ebiten Authors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n//go:build ignore\n// +build ignore\n\npackage main\n\nvar Time float\nvar Cursor vec2\nvar ScreenSize vec2\n\nfunc Fragment(position vec4, texCoord vec2, color vec4) vec4 {\n\tpos := position.xy/imageDstTextureSize() + Cursor/ScreenSize/4\n\tclr := 0.0\n\tclr += sin(pos.x*cos(Time/15)*80) + cos(pos.y*cos(Time/15)*10)\n\tclr += sin(pos.y*sin(Time/10)*40) + cos(pos.x*sin(Time/25)*40)\n\tclr += sin(pos.x*sin(Time/5)*10) + sin(pos.y*sin(Time/35)*80)\n\tclr *= sin(Time/10) * 0.5\n\treturn vec4(clr, clr*0.5, sin(clr+Time/3)*0.75, 1)\n}\n") diff --git a/examples/shader/dissolve_go.go b/examples/shader/dissolve_go.go index 6d9fff646..1bc89990f 100644 --- a/examples/shader/dissolve_go.go +++ b/examples/shader/dissolve_go.go @@ -5,4 +5,4 @@ package main -var dissolve_go = []byte("// Copyright 2020 The Ebiten Authors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// +build ignore\n\npackage main\n\nvar Time float\nvar Cursor vec2\nvar ScreenSize vec2\n\nfunc Fragment(position vec4, texCoord vec2, color vec4) vec4 {\n\t// Triangle wave to go 0-->1-->0...\n\tlimit := abs(2*fract(Time/3) - 1)\n\tlevel := imageSrc3UnsafeAt(texCoord).x\n\n\t// Add a white border\n\tif limit-0.1 < level && level < limit {\n\t\talpha := imageSrc0UnsafeAt(texCoord).w\n\t\treturn vec4(alpha)\n\t}\n\n\treturn step(limit, level) * imageSrc0UnsafeAt(texCoord)\n}\n") +var dissolve_go = []byte("// Copyright 2020 The Ebiten Authors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n//go:build ignore\n// +build ignore\n\npackage main\n\nvar Time float\nvar Cursor vec2\nvar ScreenSize vec2\n\nfunc Fragment(position vec4, texCoord vec2, color vec4) vec4 {\n\t// Triangle wave to go 0-->1-->0...\n\tlimit := abs(2*fract(Time/3) - 1)\n\tlevel := imageSrc3UnsafeAt(texCoord).x\n\n\t// Add a white border\n\tif limit-0.1 < level && level < limit {\n\t\talpha := imageSrc0UnsafeAt(texCoord).w\n\t\treturn vec4(alpha)\n\t}\n\n\treturn step(limit, level) * imageSrc0UnsafeAt(texCoord)\n}\n") diff --git a/examples/shader/generate.go b/examples/shader/generate.go index 07d5e4e91..245c702cf 100644 --- a/examples/shader/generate.go +++ b/examples/shader/generate.go @@ -24,3 +24,4 @@ package main //go:generate file2byteslice -package=main -input=chromaticaberration.go -output=chromaticaberration_go.go -var=chromaticaberration_go -buildtags=example //go:generate file2byteslice -package=main -input=dissolve.go -output=dissolve_go.go -var=dissolve_go -buildtags=example //go:generate file2byteslice -package=main -input=water.go -output=water_go.go -var=water_go -buildtags=example +//go:generate file2byteslice -package=main -input=crt.go -output=crt_go.go -var=crt_go -buildtags=example diff --git a/examples/shader/lighting_go.go b/examples/shader/lighting_go.go index d768238ff..5f23f09bb 100644 --- a/examples/shader/lighting_go.go +++ b/examples/shader/lighting_go.go @@ -5,4 +5,4 @@ package main -var lighting_go = []byte("// Copyright 2020 The Ebiten Authors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// +build ignore\n\npackage main\n\nvar Time float\nvar Cursor vec2\nvar ScreenSize vec2\n\nfunc Fragment(position vec4, texCoord vec2, color vec4) vec4 {\n\tlightpos := vec3(Cursor, 50)\n\tlightdir := normalize(lightpos - position.xyz)\n\tnormal := normalize(imageSrc1UnsafeAt(texCoord) - 0.5)\n\tconst ambient = 0.25\n\tdiffuse := 0.75 * max(0.0, dot(normal.xyz, lightdir))\n\treturn imageSrc0UnsafeAt(texCoord) * (ambient + diffuse)\n}\n") +var lighting_go = []byte("// Copyright 2020 The Ebiten Authors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n//go:build ignore\n// +build ignore\n\npackage main\n\nvar Time float\nvar Cursor vec2\nvar ScreenSize vec2\n\nfunc Fragment(position vec4, texCoord vec2, color vec4) vec4 {\n\tlightpos := vec3(Cursor, 50)\n\tlightdir := normalize(lightpos - position.xyz)\n\tnormal := normalize(imageSrc1UnsafeAt(texCoord) - 0.5)\n\tconst ambient = 0.25\n\tdiffuse := 0.75 * max(0.0, dot(normal.xyz, lightdir))\n\treturn imageSrc0UnsafeAt(texCoord) * (ambient + diffuse)\n}\n") diff --git a/examples/shader/radialblur_go.go b/examples/shader/radialblur_go.go index c6d9e24a1..b0a9ee7c6 100644 --- a/examples/shader/radialblur_go.go +++ b/examples/shader/radialblur_go.go @@ -5,4 +5,4 @@ package main -var radialblur_go = []byte("// Copyright 2020 The Ebiten Authors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// +build ignore\n\npackage main\n\nvar Time float\nvar Cursor vec2\nvar ScreenSize vec2\n\nfunc Fragment(position vec4, texCoord vec2, color vec4) vec4 {\n\tdir := normalize(position.xy - Cursor)\n\tclr := imageSrc2UnsafeAt(texCoord)\n\n\tsamples := [...]float{\n\t\t-22, -14, -8, -4, -2, 2, 4, 8, 14, 22,\n\t}\n\tsum := clr\n\tfor i := 0; i < len(samples); i++ {\n\t\tpos := texCoord + dir*samples[i]/imageSrcTextureSize()\n\t\tsum += imageSrc2At(pos)\n\t}\n\tsum /= 10 + 1\n\n\tdist := distance(position.xy, Cursor)\n\tt := clamp(dist/256, 0, 1)\n\treturn mix(clr, sum, t)\n}\n") +var radialblur_go = []byte("// Copyright 2020 The Ebiten Authors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n//go:build ignore\n// +build ignore\n\npackage main\n\nvar Time float\nvar Cursor vec2\nvar ScreenSize vec2\n\nfunc Fragment(position vec4, texCoord vec2, color vec4) vec4 {\n\tdir := normalize(position.xy - Cursor)\n\tclr := imageSrc2UnsafeAt(texCoord)\n\n\tsamples := [...]float{\n\t\t-22, -14, -8, -4, -2, 2, 4, 8, 14, 22,\n\t}\n\tsum := clr\n\tfor i := 0; i < len(samples); i++ {\n\t\tpos := texCoord + dir*samples[i]/imageSrcTextureSize()\n\t\tsum += imageSrc2At(pos)\n\t}\n\tsum /= 10 + 1\n\n\tdist := distance(position.xy, Cursor)\n\tt := clamp(dist/256, 0, 1)\n\treturn mix(clr, sum, t)\n}\n") diff --git a/examples/shader/texel_go.go b/examples/shader/texel_go.go index 2e53cb761..3b7ac5151 100644 --- a/examples/shader/texel_go.go +++ b/examples/shader/texel_go.go @@ -5,4 +5,4 @@ package main -var texel_go = []byte("// Copyright 2020 The Ebiten Authors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// +build ignore\n\npackage main\n\nfunc Fragment(position vec4, texCoord vec2, color vec4) vec4 {\n\tpos := position.xy / imageDstTextureSize()\n\torigin, size := imageDstRegionOnTexture()\n\tpos -= origin\n\tpos /= size\n\treturn vec4(pos.x, pos.y, 0, 1)\n}\n") +var texel_go = []byte("// Copyright 2020 The Ebiten Authors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n//go:build ignore\n// +build ignore\n\npackage main\n\nfunc Fragment(position vec4, texCoord vec2, color vec4) vec4 {\n\tpos := position.xy / imageDstTextureSize()\n\torigin, size := imageDstRegionOnTexture()\n\tpos -= origin\n\tpos /= size\n\treturn vec4(pos.x, pos.y, 0, 1)\n}\n") diff --git a/examples/shader/water_go.go b/examples/shader/water_go.go index d394c03b9..04afb5da4 100644 --- a/examples/shader/water_go.go +++ b/examples/shader/water_go.go @@ -5,4 +5,4 @@ package main -var water_go = []byte("// Copyright 2020 The Ebiten Authors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// +build ignore\n\npackage main\n\nvar Time float\nvar Cursor vec2\nvar ScreenSize vec2\n\nfunc Fragment(position vec4, texCoord vec2, color vec4) vec4 {\n\tborder := ScreenSize.y*0.6 + 4*cos(Time*3+texCoord.y*200)\n\tif position.y < border {\n\t\treturn imageSrc2UnsafeAt(texCoord)\n\t}\n\n\tsrcsize := imageSrcTextureSize()\n\trorigin, _ := imageSrcRegionOnTexture()\n\n\txoffset := (4 / srcsize.x) * cos(Time*3+texCoord.y*200)\n\tyoffset := (20 / srcsize.y) * (1.0 + cos(Time*3+texCoord.y*50))\n\tbordertex := border / srcsize.y\n\tclr := imageSrc2At(vec2(\n\t\ttexCoord.x+xoffset,\n\t\t-(texCoord.y+yoffset-rorigin.y)+bordertex*2+rorigin.y,\n\t)).rgb\n\n\toverlay := vec3(0.5, 1, 1)\n\treturn vec4(mix(clr, overlay, 0.25), 1)\n}\n") +var water_go = []byte("// Copyright 2020 The Ebiten Authors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n//go:build ignore\n// +build ignore\n\npackage main\n\nvar Time float\nvar Cursor vec2\nvar ScreenSize vec2\n\nfunc Fragment(position vec4, texCoord vec2, color vec4) vec4 {\n\tborder := ScreenSize.y*0.6 + 4*cos(Time*3+texCoord.y*200)\n\tif position.y < border {\n\t\treturn imageSrc2UnsafeAt(texCoord)\n\t}\n\n\tsrcsize := imageSrcTextureSize()\n\trorigin, _ := imageSrcRegionOnTexture()\n\n\txoffset := (4 / srcsize.x) * cos(Time*3+texCoord.y*200)\n\tyoffset := (20 / srcsize.y) * (1.0 + cos(Time*3+texCoord.y*50))\n\tbordertex := border / srcsize.y\n\tclr := imageSrc2At(vec2(\n\t\ttexCoord.x+xoffset,\n\t\t-(texCoord.y+yoffset-rorigin.y)+bordertex*2+rorigin.y,\n\t)).rgb\n\n\toverlay := vec3(0.5, 1, 1)\n\treturn vec4(mix(clr, overlay, 0.25), 1)\n}\n")