ebiten/examples/shader/crt_go.go

9 lines
1.8 KiB
Go
Raw Normal View History

// Code generated by file2byteslice. DO NOT EDIT.
//go:build example
// +build example
package main
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")