ebiten/examples/shader/crt_go.go
2022-03-10 00:02:07 +09:00

6 lines
1.8 KiB
Go

// Code generated by file2byteslice. DO NOT EDIT.
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")