Skip to content

Commit 0d4441f

Browse files
committed
initial commit
0 parents  commit 0d4441f

File tree

10 files changed

+231
-0
lines changed

10 files changed

+231
-0
lines changed

.gitattributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*.lua text eol=crlf linguist-language=Lua working-tree-encoding=cp932
2+
*.obj text eol=crlf linguist-language=Lua working-tree-encoding=cp932
3+
*.anm text eol=crlf linguist-language=Lua working-tree-encoding=cp932
4+
*.scn text eol=crlf linguist-language=Lua working-tree-encoding=cp932
5+
*.cam text eol=crlf linguist-language=Lua working-tree-encoding=cp932
6+
*.tra text eol=crlf linguist-language=Lua working-tree-encoding=cp932

.github/dependabot.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "github-actions" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "weekly"
12+
timezone: "Asia/Tokyo"
13+
# https://sue445.hatenablog.com/entry/2023/12/15/230043
14+
groups:
15+
artifact-actions:
16+
patterns:
17+
- "actions/upload-artifact"
18+
- "actions/download-artifact"
19+

.github/workflows/releaser.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: releaser
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
releaser:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Chekout repository
11+
uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0
14+
15+
- name: Create Archive
16+
run: |
17+
mv script/* ./
18+
zip RotBlur_M -r LICENSE.txt Readme.md RotBlur_M.anm RotBlur_M.frag RotBlur_M.vert Licenses
19+
20+
- name: Create Release
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
run: |
24+
REV_COUNT=$(git rev-list --count HEAD)
25+
RELEASE_NAME=r${REV_COUNT}
26+
TAG_NAME=r${REV_COUNT}
27+
gh release create "${TAG_NAME}" ${{ github.workspace }}/*.zip -t "${RELEASE_NAME}"

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/*/build/*
2+
compile_flags.txt
3+
/dll_src/*

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Mr-Ojii
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Licenses/GLShaderKit.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 karoterra
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Readme.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# RotBlur_M
2+
AviUtl拡張編集用、GPUを使用した高速回転ブラースクリプト
3+
4+
## 導入方法
5+
1. karoterra氏の[GLShaderKit](https://github.com/karoterra/aviutl-GLShaderKit)を導入
6+
2. exedit.aufと同一ディレクトリにあるscriptフォルダ内、またはそのフォルダの1階層下に`RotBlur_M.anm`,`RotBlur_M.frag`,`RotBlur_M.vert`を配置
7+
8+
## パラメータ説明
9+
### X
10+
回転の中心となるX座標
11+
### Y
12+
回転の中心となるY座標
13+
### amount
14+
回転ブラーの角度
15+
### r_pos
16+
基準座標
17+
### keep_size
18+
サイズを保持したままエフェクトをかけるか
19+
### quality
20+
描画回数 / 2
21+
数字が大きければ大きいほどブラーとしての精度は向上するが、重くなります。
22+
### reload
23+
シェーダーを都度リロードするか
24+
主にデバッグ用なので、オフのままを推奨
25+
### PI
26+
トラックバーのパラメータインジェクション用

script/RotBlur_M.anm

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
--track0:X,-10000,10000,0
2+
--track1:Y,-10000,10000,0
3+
--track2:amount,0,1800,30
4+
--track3:r_pos,-100,100,0
5+
--dialog:keep_size/chk,_1=1;quality,_2=256;reload/chk,_3=0;PI,_0=nil
6+
7+
obj.setanchor("track", 0, "line")
8+
9+
-- 変換もする
10+
_0 = _0 or {}
11+
local x = _0[1] or obj.track0
12+
local y = _0[2] or obj.track1
13+
-- 2方向なのであらかじめ2で割る
14+
local amount = (_0[3] or obj.track2) / 360 * math.pi
15+
-- ティム氏のものと挙動を合わせるためマイナス
16+
local r_pos = (_0[4] or obj.track3) / -100
17+
-- ティム氏のものをexo書き換えで適用しても正常に動作するよう、ckもチェックしておく
18+
local keep_size = (_1 or ck or 1) ~= 0
19+
-- 角度解像度ダウンも疑似的に(計算方法を確認していないため、不正確)
20+
local quality = math.max(math.floor(_2 or (amount * 80 / sdw) or 200), 1)
21+
local reload = (_3 or 0) ~= 0
22+
23+
_0 = nil
24+
_1 = nil
25+
_2 = nil
26+
_3 = nil
27+
28+
local data, w, h
29+
w, h = obj.getpixel()
30+
local r = math.sqrt(w * w + h * h)
31+
if not keep_size then
32+
local addX, addY = math.ceil((r - w) / 2 + 1), math.ceil((r - h) / 2 + 1)
33+
obj.effect("領域拡張", "上", addY, "下", addY, "右", addX, "左", addX)
34+
end
35+
36+
if amount == 0 then
37+
return
38+
end
39+
40+
local GLShaderKit = require "GLShaderKit"
41+
42+
local shader_path = obj.getinfo("script_path").."RotBlur_M.frag"
43+
44+
data, w, h = obj.getpixeldata()
45+
46+
if GLShaderKit.isInitialized() then
47+
GLShaderKit.activate()
48+
GLShaderKit.setPlaneVertex(1)
49+
GLShaderKit.setShader(shader_path, reload)
50+
GLShaderKit.setFloat("resolution", w, h)
51+
GLShaderKit.setFloat("pivot", x + w * 0.5, y + h * 0.5)
52+
GLShaderKit.setFloat("amount", amount)
53+
GLShaderKit.setFloat("rPos", amount * r_pos)
54+
GLShaderKit.setInt("quality", quality)
55+
GLShaderKit.setTexture2D(0, data, w, h)
56+
GLShaderKit.draw("TRIANGLES", data, w, h)
57+
58+
GLShaderKit.deactivate()
59+
else
60+
obj.setfont("MS UI Gothic", obj.track2 + 30)
61+
obj.load("text", "RotBlur_M is not available on this device.\nRotBlur_Mはこのデバイスでは使用できません。")
62+
obj.draw()
63+
end
64+
65+
obj.putpixeldata(data)

script/RotBlur_M.frag

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#version 460 core
2+
3+
in vec2 TexCoord;
4+
5+
layout(location = 0) out vec4 FragColor;
6+
7+
uniform sampler2D texture0;
8+
uniform float amount;
9+
uniform int quality;
10+
uniform vec2 resolution;
11+
uniform vec2 pivot;
12+
uniform float rPos;
13+
14+
mat2 rot_mat(float angle) { return mat2(cos(angle), -sin(angle), sin(angle), cos(angle)); }
15+
16+
void main() {
17+
vec4 color = vec4(0);
18+
float stepAngle = amount / quality;
19+
mat2 rot1 = rot_mat(stepAngle);
20+
mat2 rot2 = rot_mat(-stepAngle);
21+
vec2 uv1 = (TexCoord * resolution - pivot) * rot_mat(rPos);
22+
vec2 uv2 = uv1;
23+
24+
for(int i = 1; i <= quality; i++){
25+
uv1 *= rot1;
26+
color += texture(texture0, clamp((uv1 + pivot) / resolution, 0, 1));
27+
28+
uv2 *= rot2;
29+
color += texture(texture0, clamp((uv2 + pivot) / resolution, 0, 1));
30+
}
31+
FragColor = color / (quality * 2);
32+
}

script/RotBlur_M.vert

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#version 460 core
2+
3+
layout(location = 0) in vec3 iPos;
4+
layout(location = 1) in vec2 iTexCoord;
5+
6+
out vec2 TexCoord;
7+
8+
void main() {
9+
gl_Position = vec4(iPos, 1.0);
10+
TexCoord = iTexCoord;
11+
}

0 commit comments

Comments
 (0)