From 84dd1679e3c0ec6eeb7e8077d22ecaf57607be28 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Thu, 17 Nov 2022 22:47:02 +0900 Subject: [PATCH] examples/shader: remove the CRT example for license incompatibility --- examples/shader/crt.go | 59 ------------------------------------- examples/shader/crt_go.go | 8 ----- examples/shader/generate.go | 1 - examples/shader/main.go | 1 - 4 files changed, 69 deletions(-) delete mode 100644 examples/shader/crt.go delete mode 100644 examples/shader/crt_go.go diff --git a/examples/shader/crt.go b/examples/shader/crt.go deleted file mode 100644 index 72ce64fce..000000000 --- a/examples/shader/crt.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2022 The Ebiten Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//go:build ignore -// +build ignore - -package main - -var Time float -var Cursor vec2 -var ScreenSize vec2 - -func Fragment(position vec4, texCoord vec2, color vec4) vec4 { - const ( - BLURSCALEX = 0.45 - LOWLUMSCAN = 5.0 - HILUMSCAN = 10.0 - BRIGHTBOOST = 1.25 - MASK_DARK = 0.25 - MASK_FADE = 0.8 - ) - - pos := texCoord - origin, size := imageDstRegionOnTexture() - pos -= origin - pos /= size - - maskFade := 0.3333 * MASK_FADE - invDims := 1.0 / imageDstTextureSize().xy - p := pos * imageDstTextureSize() - i := floor(p) + 0.50 - f := p - i - p = (i + 4.0*f*f*f) * invDims - p.x = mix(p.x, pos.x, BLURSCALEX) - Y := f.y * f.y - YY := Y * Y - whichmask := fract(pos.x * -0.4999) - mask := 1.0 - if whichmask < 0.5 { - mask -= MASK_DARK - } - - clr := imageSrc2At(p*size + origin).rgb - scanLineWeight := (BRIGHTBOOST - LOWLUMSCAN*(Y-2.05*YY)) - scanLineWeightB := 1.0 - HILUMSCAN*(YY-2.8*YY*Y) - - return vec4(clr.rgb*mix(scanLineWeight*mask, scanLineWeightB, dot(clr.rgb, vec3(maskFade))), 1.0) -} diff --git a/examples/shader/crt_go.go b/examples/shader/crt_go.go deleted file mode 100644 index 6c37a603c..000000000 --- a/examples/shader/crt_go.go +++ /dev/null @@ -1,8 +0,0 @@ -// 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") diff --git a/examples/shader/generate.go b/examples/shader/generate.go index 527b03fda..fd0ef4c41 100644 --- a/examples/shader/generate.go +++ b/examples/shader/generate.go @@ -24,4 +24,3 @@ package main //go:generate go run github.com/hajimehoshi/file2byteslice/cmd/file2byteslice -package=main -input=chromaticaberration.go -output=chromaticaberration_go.go -var=chromaticaberration_go -buildtags=example //go:generate go run github.com/hajimehoshi/file2byteslice/cmd/file2byteslice -package=main -input=dissolve.go -output=dissolve_go.go -var=dissolve_go -buildtags=example //go:generate go run github.com/hajimehoshi/file2byteslice/cmd/file2byteslice -package=main -input=water.go -output=water_go.go -var=water_go -buildtags=example -//go:generate go run github.com/hajimehoshi/file2byteslice/cmd/file2byteslice -package=main -input=crt.go -output=crt_go.go -var=crt_go -buildtags=example diff --git a/examples/shader/main.go b/examples/shader/main.go index 8ef28aa19..c170b261f 100644 --- a/examples/shader/main.go +++ b/examples/shader/main.go @@ -85,7 +85,6 @@ var shaderSrcs = [][]byte{ chromaticaberration_go, dissolve_go, water_go, - crt_go, } type Game struct {