コミットを比較

50 コミット
作成者 SHA1 メッセージ 日付
routersys 3f14a41cf2 Gitea Actions のワークフローを直す 2026-11-08 13:06:47 +09:00
routersys d2636381b5 Gitea Actions のワークフローを直す 2026-11-08 10:15:59 +09:00
routersys 936504dfd4 Gitea Actions のワークフローを直す 2026-11-08 09:48:59 +09:00
routersys fc5b3f82ea 過去のタグ用ワークフローを消す 2026-11-08 03:58:18 +09:00
routersys 7d643608b1 Gitea Actions のワークフローを直す 2026-11-08 03:56:27 +09:00
routersys 1c12670944 Gitea Actions の過去のタグ用ワークフローを足す 2026-11-08 01:35:10 +09:00
routersys 4c9b2e616d Gitea Actions の過去のタグ用ワークフローを足す 2026-11-08 01:07:41 +09:00
routersys 9f321268df Gitea Actions の過去のタグ用ワークフローを足す 2026-11-07 22:36:54 +09:00
routersys a1a5cbb16f Gitea Actions のワークフローを直す 2026-11-07 22:08:55 +09:00
routersys aa92ea1214 Gitea Actions のワークフローを足す 2026-11-07 19:31:33 +09:00
routersys 3ff3a0a70d 画像の参照先をGiteaへ移す 2026-11-07 18:22:29 +09:00
routersys 58b53388d5 サブモジュールの参照先をGiteaへ移す 2026-11-07 18:19:48 +09:00
routersys 5929a3d6bf 不具合の報告の説明を送信の上限と項目へ合わせる 2026-11-02 11:35:48 +09:00
routersys d8e3b15b86 サムネイル画像を追加する
リリース / build-and-release (workflow_dispatch) Actions がタグ v1.0.0 のコミットから作成しました
2026-10-31 17:21:53 +09:00
routersys 2d1365fbda READMEと説明書へ遮光がシーンごとに届くことを書く 2026-10-26 08:54:18 +09:00
routersys dca07250d1 遮光をシーンとフレームで照合する 2026-10-26 08:54:18 +09:00
routersys 503ade7091 READMEの作例の説明を簡潔にする 2026-10-26 08:18:40 +09:00
routersys c039c9cb4a READMEへ作例の画像を加える 2026-10-25 21:21:39 +09:00
routersys 0307d7d5f1 同梱する説明書を書く 2026-10-25 20:48:14 +09:00
routersys dd4fe53e64 READMEを書く 2026-10-25 20:48:14 +09:00
routersys cde72340a8 リリースワークフローを加える 2026-10-25 20:48:14 +09:00
routersys 581da7d70d ライセンスの全文を配布物に同梱する 2026-10-25 20:48:14 +09:00
routersys 375f587c0e 基準値を既定の強さと遮光のケースに合わせて書き直す 2026-10-25 20:48:13 +09:00
routersys 51d2a164a2 ハーネスに遮光のケースを加える 2026-10-25 20:48:13 +09:00
routersys 139c353631 光の強さの既定値を150%にして筋を見えやすくする 2026-10-25 20:48:13 +09:00
routersys 58afdfd29c 遮光エフェクトと光の筋の連携の試験を追加する 2026-10-25 20:48:13 +09:00
routersys bc7c5b7670 遮光エフェクトのパラメータの試験を追加する 2026-10-25 20:48:13 +09:00
routersys 72e20fc473 「体積光の遮光」エフェクトを追加する 2026-10-25 20:48:13 +09:00
routersys 0815cddc09 「体積光」へ遮光の番号の項目を加える 2026-10-25 20:48:13 +09:00
routersys 69ca5a1c26 文言の表へ遮光の項目を加える 2026-10-25 20:48:12 +09:00
routersys c195191fe7 光の筋のシェーダーに遮る物の影を加える 2026-10-25 20:48:12 +09:00
routersys 1adff6ba63 光を遮る物を受け渡す登録簿の試験を追加する 2026-10-25 20:48:12 +09:00
routersys f4fbee37c5 光を遮る物を受け渡す登録簿を追加する 2026-10-25 20:48:12 +09:00
routersys 2b8c593a19 光を遮る物の平面と画像上の位置の試験を追加する 2026-10-25 20:48:12 +09:00
routersys 5944629ef6 光を遮る物の平面と画像上の位置を求める処理を追加する 2026-10-25 20:48:12 +09:00
routersys 76e8d965c7 光を遮る物の数と番号の設定値を加える 2026-10-25 20:48:11 +09:00
routersys 6e5172889e 変異試験の並列数と制限時間をGPUに合わせる 2026-10-25 20:48:11 +09:00
routersys b71f075ba0 処理器の試験を追加する 2026-10-25 20:48:11 +09:00
routersys 3a48c29c4d 光の筋を描くカスタムエフェクトの試験を追加する 2026-10-25 20:48:11 +09:00
routersys b21b2de4ff 放射を取り出すカスタムエフェクトの試験を追加する 2026-10-25 20:48:11 +09:00
routersys d6dfb0472d パラメータの試験を追加する 2026-10-25 20:48:11 +09:00
routersys c5d2c47661 光の筋の定数の試験を追加する 2026-10-25 20:48:11 +09:00
routersys cf2e2236ec 光の体積が占める画面の範囲の試験を追加する 2026-10-25 20:48:11 +09:00
routersys 67f993ac7f 光が通る体積の試験を追加する 2026-10-25 20:48:11 +09:00
routersys edd4369e1b 姿勢から画面への射影の試験を追加する 2026-10-25 20:48:10 +09:00
routersys fc150acbf0 設定値の試験を追加する 2026-10-25 20:48:10 +09:00
routersys 644ffe07c7 WPFアプリケーションの外での挙動の試験を追加する 2026-10-25 20:48:10 +09:00
routersys b517e8111f 文言の試験を追加する 2026-10-25 20:48:10 +09:00
routersys 767bc86a1a 試験の土台を追加する 2026-10-25 20:48:10 +09:00
routersys 2de9681dc6 ハーネスのケースと基準値を加える 2026-10-25 20:48:10 +09:00
19個のファイルの変更、802行の追加、101行の削除

検索条件に一致するファイルはありません

+517
ファイルの表示
@@ -0,0 +1,517 @@
name: リリース
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: リリースするタグ
required: true
permissions:
contents: write
jobs:
build-and-release:
runs-on: windows-latest
steps:
- name: ソースコードのチェックアウト
uses: actions/checkout@v7
env:
GIT_CONFIG_COUNT: "2"
GIT_CONFIG_KEY_0: url.https://git.routersys.com/routersys/.insteadOf
GIT_CONFIG_VALUE_0: https://github.com/routersys/
GIT_CONFIG_KEY_1: url.https://git.routersys.com/manju-summoner/YukkuriMovieMaker.Generator.insteadOf
GIT_CONFIG_VALUE_1: https://github.com/manju-summoner/YukkuriMovieMaker.Generator
with:
ref: ${{ inputs.tag || github.ref_name }}
submodules: recursive
fetch-depth: 0
- name: MSBuild のセットアップ
uses: microsoft/setup-msbuild@v3
- name: YMM4 最新リリースの取得と解凍
id: ymm4
shell: pwsh
run: |
$list = 'C:\runner\cache\ymm4\releases.json'
New-Item -ItemType Directory -Force -Path (Split-Path $list) | Out-Null
if (-not (Test-Path $list) -or (Get-Item $list).Length -lt 1000 -or ((Get-Date) - (Get-Item $list).LastWriteTime).TotalHours -gt 6) {
$fetched = $null
for ($attempt = 1; $attempt -le 6 -and -not $fetched; $attempt++) {
try {
$fetched = Invoke-RestMethod -Uri "https://api.github.com/repos/manju-summoner/YukkuriMovieMaker4/releases?per_page=100" `
-Headers @{ "User-Agent" = "VolumetricLight-CI" } -ErrorAction Stop
}
catch {
$message = $_.Exception.Message
Write-Host "リリース一覧の取得に失敗しました($attempt 回目): $($message.Substring(0, [Math]::Min(80, $message.Length)))"
Start-Sleep -Seconds (5 * $attempt)
}
}
if (@($fetched).Count -gt 0) {
$fetched | Select-Object tag_name, published_at, prerelease, draft, assets |
ConvertTo-Json -Depth 6 | Set-Content -Path $list -Encoding UTF8
}
elseif (-not (Test-Path $list)) { throw 'the list of releases could not be fetched' }
else { Write-Host '保存済みのリリース一覧を使います' }
}
$when = [DateTimeOffset](git log -1 --format=%cI)
$releases = @(Get-Content -Raw -Path $list | ConvertFrom-Json | Where-Object { -not $_.draft -and -not $_.prerelease })
$release = $releases | Where-Object { [DateTimeOffset]$_.published_at -le $when } | Select-Object -First 1
if (-not $release) { $release = $releases | Select-Object -Last 1 }
Write-Host "最後のコミット $when に合わせた YMM4: $($release.tag_name)"
$asset = $release.assets | Where-Object { $_.name -like "*_Lite.zip" } | Select-Object -First 1
if (-not $asset) {
$asset = $release.assets | Where-Object { $_.name -like "*.zip" } | Select-Object -First 1
}
Write-Host "ダウンロード対象: $($asset.name)"
$cache = Join-Path 'C:\runner\cache\ymm4' $asset.name
$extracted = "$cache.extracted"
$lock = New-Object System.Threading.Mutex($false, 'Global\ci-ymm4-cache')
[void]$lock.WaitOne()
try {
if (-not (Test-Path "$extracted\.complete")) {
New-Item -ItemType Directory -Force -Path (Split-Path $cache) | Out-Null
Invoke-WebRequest -Uri $asset.browser_download_url -OutFile $cache
Remove-Item -Recurse -Force $extracted -ErrorAction SilentlyContinue
Expand-Archive -Path $cache -DestinationPath $extracted -Force
New-Item -ItemType File -Path "$extracted\.complete" | Out-Null
}
else {
Write-Host "保存済みの YMM4 を使います: $extracted"
}
}
finally {
$lock.ReleaseMutex()
}
$ymm4Dir = (Get-ChildItem -Path $extracted -Recurse -Filter "YukkuriMovieMaker.dll" |
Select-Object -First 1).DirectoryName
Write-Host "YMM4 DLL ディレクトリ: $ymm4Dir"
echo "YMM4_DIR=$ymm4Dir\" >> $env:GITHUB_OUTPUT
- name: タグ名からバージョンを取得
id: version
shell: pwsh
run: |
$tag = "${{ inputs.tag || github.ref_name }}"
echo "TAG=$tag" >> $env:GITHUB_OUTPUT
echo "VERSION=$($tag.TrimStart('v'))" >> $env:GITHUB_OUTPUT
- name: バージョン記載の照合
shell: pwsh
run: |
$tag = "${{ steps.version.outputs.TAG }}"
$version = "${{ steps.version.outputs.VERSION }}"
$problems = @()
$csprojPath = "VolumetricLight/VolumetricLight.csproj"
$csproj = Get-Content $csprojPath -Raw
if (-not $csproj.Contains("<Version>$version</Version>")) {
$current = if ($csproj -match '<Version>([^<]*)</Version>') { $Matches[1] } else { "記載なし" }
$problems += "$csprojPath の <Version> が $current です。$version にしてください。"
}
$readmePath = ".github/Plugin_Readme.txt"
$readme = Get-Content $readmePath -Raw
if (-not $readme.Contains(" 体積光 for YMM4 $tag")) {
$current = if ($readme -match '(?m)^ 体積光 for YMM4 (\S+)') { $Matches[1] } else { "記載なし" }
$problems += "$readmePath の見出しが $current です。$tag にしてください。"
}
if ($problems.Count -eq 0) {
Write-Host "バージョン記載は $tag と一致しています"
exit 0
}
foreach ($problem in $problems) {
Write-Host "::error::$problem"
}
Write-Host "::error::リリースの対象は $tag が指すコミットです。タグを付けた後で main へ訂正を積んでも、その訂正はリリースに入りません。タグを削除し、記載を直したコミットを積んでから付け直してください。"
exit 1
- name: シェーダーのビルド
shell: pwsh
run: |
msbuild VolumetricLight.Shader/VolumetricLight.Shader.vcxproj `
/p:Configuration=Release `
/p:Platform=Win32 `
/nologo
- name: プロジェクトのビルド
shell: pwsh
run: |
$proj = "VolumetricLight/VolumetricLight.csproj"
dotnet build "$proj" `
-c Release `
-p:YMM4DirPath="${{ steps.ymm4.outputs.YMM4_DIR }}" `
-p:SkipPluginDeploy=true
- name: パッケージの作成
id: package
shell: pwsh
run: |
$version = "${{ steps.version.outputs.TAG }}"
$outDir = "VolumetricLight/bin/Release/net10.0-windows10.0.19041.0"
$stageRoot = "stage/VolumetricLight"
$pkgName = "VolumetricLight_$version.ymme"
New-Item -ItemType Directory -Path $stageRoot -Force | Out-Null
New-Item -ItemType Directory -Path "$stageRoot/LICENSE" -Force | Out-Null
$dll = "$outDir/VolumetricLight.dll"
if (-not (Test-Path $dll)) {
Write-Error "ビルド結果に VolumetricLight.dll が見つかりませんでした: $dll"
exit 1
}
Copy-Item $dll "$stageRoot/"
foreach ($lang in @("ar-sa", "en-us", "es-es", "id-id", "ko-kr", "zh-cn", "zh-tw")) {
$src = "$outDir/$lang"
if (Test-Path $src) {
New-Item -ItemType Directory -Path "$stageRoot/$lang" -Force | Out-Null
Copy-Item "$src/*.dll" "$stageRoot/$lang/"
}
}
Copy-Item ".github/LICENSE/*.txt" "$stageRoot/LICENSE/"
Copy-Item ".github/Plugin_Readme.txt" "$stageRoot/Readme.txt"
$readme = Get-Content "$stageRoot/Readme.txt" -Raw
if (-not $readme.Contains(" 体積光 for YMM4 $version")) {
Write-Error "同梱する Readme.txt の見出しが $version と一致しません"
exit 1
}
Compress-Archive -Path "stage/*" -DestinationPath $pkgName -CompressionLevel Optimal
echo "PKG_NAME=$pkgName" >> $env:GITHUB_OUTPUT
- name: 変更履歴の作成
id: changelog
shell: pwsh
env:
GITEA_TOKEN: ${{ github.token }}
TAG: ${{ steps.version.outputs.TAG }}
REPOSITORY: ${{ github.repository }}
SERVER_URL: ${{ github.server_url }}
PACKAGE: ${{ steps.package.outputs.PKG_NAME }}
run: |
$tag = $env:TAG
$repository = $env:REPOSITORY
$server = $env:SERVER_URL
$code = [char]0x60
$fence = [string]::new($code, 3)
$unit = [char]0x1f
$record = [char]0x1e
$previous = ""
$candidates = @(git tag --list "v*" --merged $tag --sort=-creatordate | Where-Object { $_ -ne $tag })
if ($candidates.Count -gt 0) {
$previous = $candidates[0]
}
Write-Host "直前のタグ: $previous"
$range = if ($previous) { "$previous..$tag" } else { $tag }
$log = (@(git log "--format=%H%x1f%s%x1f%an%x1f%ad%x1f%b%x1e" --date=short $range) -join "`n") -split $record
$commits = @()
foreach ($entry in $log) {
if (-not $entry.Trim()) { continue }
$fields = $entry.TrimStart("`n") -split $unit
if ($fields.Count -lt 5) { continue }
$commits += [pscustomobject]@{
Sha = $fields[0]
Subject = $fields[1]
Name = $fields[2]
Date = $fields[3]
Body = $fields[4]
Login = ""
Avatar = ""
}
}
Write-Host "コミット数: $($commits.Count)"
$categories = [ordered]@{
A = @{ Title = "追加"; Symbol = "+"; Items = [System.Collections.Generic.List[pscustomobject]]::new() }
M = @{ Title = "変更"; Symbol = "~"; Items = [System.Collections.Generic.List[pscustomobject]]::new() }
D = @{ Title = "削除"; Symbol = "-"; Items = [System.Collections.Generic.List[pscustomobject]]::new() }
F = @{ Title = "修正"; Symbol = "!"; Items = [System.Collections.Generic.List[pscustomobject]]::new() }
}
foreach ($commit in $commits) {
if (-not $commit.Body) { continue }
foreach ($bodyLine in ($commit.Body -split "`n")) {
$trimmed = $bodyLine.Trim()
if ($trimmed -notmatch '^・(.+)-([AMDF])$') { continue }
$categories[$Matches[2]].Items.Add([pscustomobject]@{ Text = $Matches[1]; Sha = $commit.Sha })
}
}
$pending = [System.Collections.Generic.HashSet[string]]::new()
foreach ($commit in $commits) {
[void]$pending.Add($commit.Sha)
}
$headers = @{ Authorization = "token $env:GITEA_TOKEN" }
$accounts = @{}
$page = 1
while ($pending.Count -gt 0 -and $page -le 20) {
$rows = @()
try {
$rows = @(Invoke-RestMethod -Uri "$server/api/v1/repos/$repository/commits?sha=$tag&limit=50&page=$page&stat=false&verification=false&files=false" -Headers $headers)
}
catch {
Write-Host "コミットの作者を取得できませんでした: $($_.Exception.Message)"
break
}
if ($rows.Count -eq 0) { break }
foreach ($row in $rows) {
if ($pending.Remove($row.sha)) {
$login = ""
$avatar = ""
if ($row.author) {
$login = [string]$row.author.login
$avatar = [string]$row.author.avatar_url
}
$accounts[$row.sha] = @{ Login = $login; Avatar = $avatar }
}
}
if ($rows.Count -lt 50) { break }
$page++
}
foreach ($commit in $commits) {
if ($accounts.ContainsKey($commit.Sha)) {
$commit.Login = $accounts[$commit.Sha].Login
$commit.Avatar = $accounts[$commit.Sha].Avatar
}
}
$emptyTree = "4b825dc642cb6eb9a060e54bf8d69288fbee4904"
$base = if ($previous) { $previous } else { $emptyTree }
$shortstat = (@(git diff --shortstat $base $tag) -join " ")
$changedFiles = 0
$insertions = 0
$deletions = 0
if ($shortstat -match "(\d+) file") { $changedFiles = [int]$Matches[1] }
if ($shortstat -match "(\d+) insertion") { $insertions = [int]$Matches[1] }
if ($shortstat -match "(\d+) deletion") { $deletions = [int]$Matches[1] }
$diffStat = @(git diff --stat $base $tag)
$tagDate = (git log -1 "--format=%ad" --date=short $tag)
$contributors = @($commits |
Group-Object -Property { if ($_.Login) { $_.Login } else { $_.Name } } |
Sort-Object -Property Count -Descending)
function Get-Icon($avatar, $login, $size) {
if (-not $avatar) { return "" }
$sized = if ($avatar.Contains("?")) { "$avatar&s=$($size * 2)" } else { "$avatar" + "?s=$($size * 2)" }
return "<img src=""$sized"" width=""$size"" height=""$size"" alt=""$login""> "
}
$package = Get-Item $env:PACKAGE
$size = [math]::Round($package.Length / 1MB, 2)
$body = [System.Collections.Generic.List[string]]::new()
$body.Add("## 概要")
$body.Add("")
$body.Add("| 項目 | 内容 |")
$body.Add("|---|---|")
$body.Add("| タグ | [$tag]($server/$repository/tree/$tag) |")
$body.Add("| 公開日 | $tagDate |")
if ($previous) {
$body.Add("| 直前のリリース | [$previous]($server/$repository/releases/tag/$previous) |")
}
$body.Add("| コミット数 | $($commits.Count) |")
$body.Add("| 貢献者 | $($contributors.Count) 名 |")
$body.Add("| 変更されたファイル | $changedFiles |")
$body.Add("| 追加された行 | $insertions |")
$body.Add("| 削除された行 | $deletions |")
$hasHighlights = ($categories.Values | ForEach-Object { $_.Items.Count } | Measure-Object -Sum).Sum -gt 0
if ($hasHighlights) {
$body.Add("")
$body.Add("## 主な変更")
foreach ($key in $categories.Keys) {
$category = $categories[$key]
if ($category.Items.Count -eq 0) { continue }
$body.Add("")
$body.Add("### [$($category.Symbol)] $($category.Title)")
$body.Add("")
foreach ($item in $category.Items) {
$short = $item.Sha.Substring(0, 7)
$body.Add("- $($item.Text) ([$code$short$code]($server/$repository/commit/$($item.Sha)))")
}
}
}
$body.Add("")
$body.Add("## ダウンロード")
$body.Add("")
$body.Add("| ファイル | サイズ |")
$body.Add("|---|---|")
$body.Add("| $($package.Name) | $size MB |")
$body.Add("")
$body.Add("## 貢献者")
$body.Add("")
$body.Add("| 貢献者 | コミット数 |")
$body.Add("|---|---|")
foreach ($contributor in $contributors) {
$first = $contributor.Group[0]
if ($first.Login) {
$name = (Get-Icon $first.Avatar $first.Login 40) + "[@$($first.Login)]($server/$($first.Login))"
}
else {
$name = $first.Name
}
$body.Add("| $name | $($contributor.Count) |")
}
$body.Add("")
$body.Add("## 変更履歴")
$body.Add("")
$body.Add("| コミット | 内容 | 貢献者 | 日付 |")
$body.Add("|---|---|---|---|")
$maximumCommits = 300
$listed = 0
foreach ($commit in $commits) {
if ($listed -ge $maximumCommits) { break }
$short = $commit.Sha.Substring(0, 7)
$subject = $commit.Subject -replace '\|', '\|'
if ($commit.Login) {
$author = (Get-Icon $commit.Avatar $commit.Login 20) + "[@$($commit.Login)]($server/$($commit.Login))"
}
else {
$author = $commit.Name
}
$body.Add("| [$code$short$code]($server/$repository/commit/$($commit.Sha)) | $subject | $author | $($commit.Date) |")
$listed++
}
if ($commits.Count -gt $maximumCommits) {
$body.Add("")
$body.Add("残り $($commits.Count - $maximumCommits) 件のコミットは省略しました。")
}
if ($diffStat.Count -gt 0) {
$body.Add("")
$body.Add("## 変更されたファイル")
$body.Add("")
$body.Add("<details>")
$body.Add("<summary>差分の統計</summary>")
$body.Add("")
$body.Add($fence)
$maximumStatLines = 200
$shown = 0
foreach ($line in $diffStat) {
if ($shown -ge $maximumStatLines) { break }
$body.Add($line)
$shown++
}
if ($diffStat.Count -gt $maximumStatLines) {
$body.Add("... 残り $($diffStat.Count - $maximumStatLines) 行は省略しました。")
}
$body.Add($fence)
$body.Add("")
$body.Add("</details>")
}
if ($previous) {
$body.Add("")
$body.Add("## 全ての変更")
$body.Add("")
$body.Add("$server/$repository/compare/$previous...$tag")
}
$path = "release-body.md"
Set-Content -Path $path -Value ($body -join "`n") -Encoding utf8NoBOM
if (-not (Test-Path $path)) {
throw "変更履歴を作成できませんでした。"
}
Write-Host "変更履歴の行数: $($body.Count)"
$global:LASTEXITCODE = 0
- name: Gitea リリースの作成
shell: pwsh
env:
GITEA_TOKEN: ${{ github.token }}
REPOSITORY: ${{ github.repository }}
SERVER_URL: ${{ github.server_url }}
EVENT_NAME: ${{ github.event_name }}
WORKFLOW_NAME: ${{ github.workflow }}
JOB_NAME: ${{ github.job }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_number }}
RELEASE_TAG: ${{ inputs.tag || github.ref_name }}
RELEASE_NAME: ${{ steps.version.outputs.TAG }}
RELEASE_BODY: ''
RELEASE_BODY_PATH: release-body.md
RELEASE_DRAFT: false
RELEASE_PRERELEASE: false
RELEASE_FILES: |
${{ steps.package.outputs.PKG_NAME }}
run: |
$headers = @{ Authorization = "token $env:GITEA_TOKEN" }
$api = "$env:SERVER_URL/api/v1/repos/$env:REPOSITORY"
$tag = $env:RELEASE_TAG
$body = $env:RELEASE_BODY
if ($env:RELEASE_BODY_PATH -and (Test-Path $env:RELEASE_BODY_PATH)) {
$body = Get-Content $env:RELEASE_BODY_PATH -Raw -Encoding utf8
}
$files = @()
foreach ($pattern in ($env:RELEASE_FILES -split "[`r`n,]+" | Where-Object { $_.Trim() })) {
$found = @(Get-ChildItem -Path $pattern.Trim() -File -ErrorAction SilentlyContinue)
if ($found.Count -eq 0) { throw "リリースに付けるファイルが見つかりません: $pattern" }
$files += $found
}
$payload = @{
tag_name = $tag
name = $env:RELEASE_NAME
body = [string]$body
draft = ($env:RELEASE_DRAFT -eq 'true')
prerelease = ($env:RELEASE_PRERELEASE -eq 'true')
} | ConvertTo-Json
$bytes = [System.Text.Encoding]::UTF8.GetBytes($payload)
$existing = $null
try { $existing = Invoke-RestMethod -Uri "$api/releases/tags/$([System.Uri]::EscapeDataString($tag))" -Headers $headers } catch { }
if ($existing) {
$release = Invoke-RestMethod -Method Patch -Uri "$api/releases/$($existing.id)" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes
foreach ($asset in @($existing.assets)) {
Invoke-RestMethod -Method Delete -Uri "$api/releases/$($existing.id)/assets/$($asset.id)" -Headers $headers | Out-Null
}
} else {
$release = Invoke-RestMethod -Method Post -Uri "$api/releases" -Headers $headers -ContentType "application/json; charset=utf-8" -Body $bytes
}
foreach ($file in $files) {
$name = [System.Uri]::EscapeDataString($file.Name)
Invoke-RestMethod -Method Post -Uri "$api/releases/$($release.id)/assets?name=$name" -Headers $headers -Form @{ attachment = Get-Item $file.FullName } | Out-Null
Write-Host "添付しました: $($file.Name)"
}
Write-Host "リリースを作成しました: $($release.html_url)"
if ($env:EVENT_NAME -eq 'workflow_dispatch') {
try {
$sha = (git rev-parse HEAD).Trim()
$status = @{
state = 'success'
context = "$env:WORKFLOW_NAME / $env:JOB_NAME (workflow_dispatch)"
description = "Actions がタグ $tag のコミットから作成しました"
target_url = $env:RUN_URL
} | ConvertTo-Json
Invoke-RestMethod -Method Post -Uri "$api/statuses/$sha" -Headers $headers -ContentType "application/json; charset=utf-8" -Body ([System.Text.Encoding]::UTF8.GetBytes($status)) | Out-Null
Write-Host "タグのコミット $sha に成功の状態を付けました"
}
catch {
Write-Warning "タグのコミットに状態を付けられませんでした: $($_.Exception.Message)"
}
}
+12 -4
ファイルの表示
@@ -47,8 +47,9 @@ YukkuriMovieMaker4上で動作する、素材の明るい部分を光源とみ
- 影: 前景のアイテムに「体積光の遮光」を付け、「体積光」の
「遮光の番号」と同じ番号を選ぶと、光の筋に影を落とせます。
影を落とすアイテムは、「体積光」を付けたアイテムより上のレイヤーに
置いてください。番号は1から8までで、同じ番号に付けられるのは
4つまでです。
置いてください。番号は1から8までで、同じシーンの同じ番号に付けられる
のは4つまでです。別のシーンのアイテムには、番号が同じでも影を落とし
ません。
- 影の範囲: 影を落とすアイテムが影を落とすのは、光源の画像と光の筋の間に
あるときだけです。影の縁は影を落とすアイテムの画像の縁のままで、
@@ -85,15 +86,22 @@ YukkuriMovieMaker4上で動作する、素材の明るい部分を光源とみ
■ 不具合の報告
--------------------------------------------------------------------------------
本プラグインは、想定していない例外が起きたときに、その内容を開発者へ自動で
送信します。同意は求めず、常に送信します。
送信します。同意は求めません。止める設定もありません。
送信する数には上限があります。YMM4の1回の起動で送る報告は、
YMM4-Telemetryで報告する別のプラグインと合わせて20件までです。
例外の型と発生位置が同じ報告は3件までです。上限を超えた報告と、
送信先から待つよう求められている間に起きた報告は、送信も退避もしません。
送信する情報は次のとおりです。
例外 : 型の完全名、メッセージ、スタックトレース
発生位置 : モジュール名、関数名、ファイル名、行番号
発生位置 : モジュール名、関数名、ファイル名、行番号、
プラグイン自身のコードかどうか
プラグイン : アセンブリ名、バージョン
実行環境 : OSの名前とバージョン、.NETのバージョン、
CPUのアーキテクチャ、論理プロセッサ数
識別子 : YMM4の起動ごとに決まるセッション識別子、報告ごとの識別子
時刻 : 報告を作った時刻(UTC)
映像の中身とプロジェクトの内容は送信しません。継続して個人を追跡する
識別子も持ちません。セッション識別子はYMM4を起動し直すと別の値に
+3 -3
ファイルの表示
@@ -1,9 +1,9 @@
[submodule "YukkuriMovieMaker.Generator"]
path = YukkuriMovieMaker.Generator
url = https://github.com/manju-summoner/YukkuriMovieMaker.Generator.git
url = https://git.routersys.com/manju-summoner/YukkuriMovieMaker.Generator.git
[submodule "YMM4-GitHubUpdateNotifier"]
path = YMM4-GitHubUpdateNotifier
url = https://github.com/routersys/YMM4-GitHubUpdateNotifier.git
url = https://git.routersys.com/routersys/YMM4-GitHubUpdateNotifier.git
[submodule "YMM4-Telemetry"]
path = YMM4-Telemetry
url = https://github.com/routersys/YMM4-Telemetry.git
url = https://git.routersys.com/routersys/YMM4-Telemetry.git
+17 -6
ファイルの表示
@@ -11,7 +11,7 @@ YukkuriMovieMaker4(YMM4)上で動作する、素材の明るい部分を光
結果は設定と素材の画素とフレームの位置から決まり、乱数は使いません。同じ設定では、同じフレームは何度描いても同じ絵になります。
向き、手前への角度、拡がり、長さ、強さ、しきい値、減衰、光源の大きさ、前方散乱、濃淡、大きさ、流れの速さ、流れの向きの13項目はアニメーションに対応しています。
![Image](https://github.com/routersys/YMM4-VolumetricLight/blob/main/docs/VolumetricLight.png)
![Image](https://git.routersys.com/routersys/YMM4-VolumetricLight/raw/branch/main/docs/VolumetricLight.png)
---
@@ -97,6 +97,10 @@ YukkuriMovieMaker4(YMM4)上で動作する、素材の明るい部分を光
「色」は光に掛ける色です。白では素材の画素の色のままになります。
次の画像は、ステンドグラスの窓の写真に適用した例です。「向き」は-60°、「手前への角度」は45°、「強さ」は700%、「しきい値」は30%で、ほかの項目は既定値です。上が入力、下が出力で、しきい値を超える明るいガラスの部分だけが光源になり、窓から右下へ光の筋が伸びます。元の写真は、Wikimedia CommonsにCC0で公開されているWmpearl氏の「[Stained glass window, Hammerfest Church](https://commons.wikimedia.org/wiki/File:Stained_glass_window,_Hammerfest_Church.JPG)」です。
![Image](https://git.routersys.com/routersys/YMM4-VolumetricLight/raw/branch/main/docs/VolumetricLight-Window.png)
### 2. 光の向きと広がり
「向き」は、光が進む向きを、画像の面に沿った角度で決めます。0°が右、90°が上、-90°が下です。
@@ -147,9 +151,13 @@ YukkuriMovieMaker4(YMM4)上で動作する、素材の明るい部分を光
影を落とすアイテムは位置と回転と拡大率を持つ平らな画像として扱い、画像の不透明な部分が光を遮ります。光源の画像の各点から出た光の線が、影を落とすアイテムの不透明な部分を通ると、その線の先の光の筋が弱まって影になります。影を落とすアイテムが影を落とすのは、光源の画像と光の筋の間にあるときだけです。
次の画像は、窓の写真の手前にキャラクターを置いた例です。窓の写真には前の画像と同じ設定の「体積光」を付け、「遮光の番号」を1にしました。キャラクターには「体積光の遮光」を付け、「番号」を上は2、下は1にしました。上は番号が違うので影が落ちません。下は番号が同じなので、キャラクターが遮った分だけ、右と下の光の筋が弱まります。
![Image](https://git.routersys.com/routersys/YMM4-VolumetricLight/raw/branch/main/docs/VolumetricLight-Shadow.png)
「遮る強さ」は、影を落とすアイテムの不透明な部分が、光をどれだけ遮るかです。アイテムの不透明度も掛かります。100%で光を通さず、0%で遮りません。
同じ番号に付けられる「体積光の遮光」は4つまでです。5つ目以降は影を落としません。
同じシーンの同じ番号に付けられる「体積光の遮光」は4つまでです。5つ目以降は影を落としません。別のシーンのアイテムには、番号が同じでも影を落としません。
---
@@ -207,7 +215,7 @@ YukkuriMovieMaker4(YMM4)上で動作する、素材の明るい部分を光
| パラメータ名 | 型 | デフォルト | スライダー表示範囲 | アニメーション | 説明 |
|---|---|---|---|---|---|
| 番号 | 整数 | 1 | 1〜8 | 非対応 | 同じ番号を選んだ「体積光」の光の筋を、このアイテムが遮ります。番号ごとに遮れるアイテムは4つまでです。 |
| 番号 | 整数 | 1 | 1〜8 | 非対応 | 同じ番号を選んだ「体積光」の光の筋を、このアイテムが遮ります。シーンと番号ごとに遮れるアイテムは4つまでです。 |
| 遮る強さ | 数値 | 100% | 0〜100% | 対応 | アイテムの不透明な部分が光をどれだけ遮るかです。アイテムの不透明度も掛かります。100%で光を通さず、0%で遮りません。 |
---
@@ -220,7 +228,7 @@ YukkuriMovieMaker4(YMM4)上で動作する、素材の明るい部分を光
- 素材の幅か高さが4096pxを超えるときは、エフェクトを適用せず入力映像を表示します。
- 光の筋は画面に入る範囲だけを計算します。
- 光の筋はこのエフェクトを付けたアイテムのレイヤーに1枚の映像として描きます。奥行きの違うほかのアイテムとの前後は、レイヤーの順で決まります。
- 「体積光の遮光」は番号ごとに4つまで付けられます。番号は1から8までです。
- 「体積光の遮光」は、シーンと番号ごとに4つまで付けられます。番号は1から8までです。
- 影の縁は影を落とすアイテムの画像の縁のままで、ぼかしません。
- 「体積光」と「体積光の遮光」を同じアイテムに付けても、そのアイテム自身の影は落ちません。
- 「体積光の遮光」はそのエフェクトを付けた位置までの設定で決まる位置と画像を使います。後ろに付けたエフェクトが位置や画像を変えても、影には反映されません。アイテムのエフェクトの最後に付けてください。
@@ -241,17 +249,20 @@ YukkuriMovieMaker4(YMM4)上で動作する、素材の明るい部分を光
## 不具合の報告
本プラグインは、想定していない例外が起きたときに、その内容を開発者へ自動で送信します。同意は求めず、常に送信します。
本プラグインは、想定していない例外が起きたときに、その内容を開発者へ自動で送信します。同意は求めません。止める設定もありません。
送信する数には上限があります。YMM4の1回の起動で送る報告は、YMM4-Telemetryで報告する別のプラグインと合わせて20件までです。例外の型と発生位置が同じ報告は3件までです。上限を超えた報告と、送信先から待つよう求められている間に起きた報告は、送信も退避もしません。
送信する情報は次のとおりです。
| 種類 | 内容 |
|---|---|
| 例外 | 型の完全名、メッセージ、スタックトレース |
| 発生位置 | モジュール名、関数名、ファイル名、行番号 |
| 発生位置 | モジュール名、関数名、ファイル名、行番号、プラグイン自身のコードかどうか |
| プラグイン | アセンブリ名、バージョン |
| 実行環境 | OSの名前とバージョン、.NETのバージョン、CPUのアーキテクチャ、論理プロセッサ数 |
| 識別子 | YMM4の起動ごとに決まるセッション識別子、報告ごとの識別子 |
| 時刻 | 報告を作った時刻(UTC) |
メッセージとファイル名は、送信の前に置き換えを通します。置き換えるのは、Windowsのユーザー名、ユーザーフォルダー、AppDataのパス、マシン名、ドメイン名、メールアドレス、IPv4アドレスです。送信元のIPアドレスは受信側へ渡す手前で取り除いています。
+2
ファイルの表示
@@ -95,6 +95,8 @@ internal static class HarnessCases
yield return ("shadow-figure-half-strength", Shadowed(effect => effect.Direction.Values[0].Value = -60), [0], HarnessPose.Flat, [Figure(new Vector3(-120f, 110f, 240f), configure: effect => effect.Strength.Values[0].Value = 50)]);
yield return ("shadow-figure-strength-animated-frames", Shadowed(effect => effect.Direction.Values[0].Value = -60), [0, 150, 299], HarnessPose.Flat, [Figure(new Vector3(-120f, 110f, 240f), configure: effect => effect.Strength.CopyFrom(Linear(100d, 10d)))]);
yield return ("shadow-figure-rotated-light", Shadowed(), [0], RotatedY, [Figure(new Vector3(0f, 120f, 200f))]);
yield return ("shadow-figure-other-scene", Shadowed(effect => { effect.Direction.Values[0].Value = -60; effect.Elevation.Values[0].Value = 45; }), [0], HarnessPose.Flat, [Figure(new Vector3(40f, 120f, 220f)) with { Scene = new Guid("5b0a8d3e-2c1f-4e7a-9a52-7d4f1c6b8e90") }]);
yield return ("shadow-figure-other-frame", Shadowed(effect => { effect.Direction.Values[0].Value = -60; effect.Elevation.Values[0].Value = 45; }), [0], HarnessPose.Flat, [Figure(new Vector3(-220f, 130f, 160f)) with { FrameOffset = 7 }]);
yield return ("shadow-figure-other-number", Shadowed(effect => { effect.Direction.Values[0].Value = -60; effect.Elevation.Values[0].Value = 45; }), [0], HarnessPose.Flat, [Figure(new Vector3(-120f, 110f, 240f), configure: effect => effect.Channel = 2)]);
}
+3 -3
ファイルの表示
@@ -6,7 +6,7 @@ using YukkuriMovieMaker.Player.Video;
namespace VolumetricLight.Harness;
internal sealed record HarnessOccluder(VolumetricLightOccluderEffect Effect, HarnessPose Pose, HarnessImage Image);
internal sealed record HarnessOccluder(VolumetricLightOccluderEffect Effect, HarnessPose Pose, HarnessImage Image, Guid Scene = default, int FrameOffset = 0);
internal sealed class HarnessOccluderScene : IDisposable
{
@@ -57,11 +57,11 @@ internal sealed class HarnessOccluderScene : IDisposable
public IEnumerable<ID2D1Image> Layers => entries.Select(entry => entry.Display.Output);
public void Update(Func<int, HarnessPose?, EffectDescription> describe, int frame)
public void Update(Func<int, HarnessPose?, Guid, EffectDescription> describe, int frame)
{
foreach (var entry in entries)
{
var description = describe(frame, entry.Occluder.Pose);
var description = describe(frame + entry.Occluder.FrameOffset, entry.Occluder.Pose, entry.Occluder.Scene);
entry.Blocker.Update(description);
entry.Display.Update(description);
}
+2 -2
ファイルの表示
@@ -228,7 +228,7 @@ internal sealed class HarnessRenderer : IDisposable
sync.Unmap();
}
internal EffectDescription Describe(int frame, HarnessPose? pose)
internal EffectDescription Describe(int frame, HarnessPose? pose, Guid scene = default)
{
var timeline = new TimelineSourceDescription(
new System.Drawing.Size(CanvasWidth, CanvasHeight),
@@ -236,7 +236,7 @@ internal sealed class HarnessRenderer : IDisposable
new YukkuriMovieMaker.Player.Video.FrameTime(Length, Fps),
Fps,
TimelineSourceUsage.Playing,
Guid.Empty,
scene,
[]);
var item = new TimelineItemSourceDescription(timeline, frame, Length, 0);
var placement = pose ?? HarnessPose.Flat;
+14
ファイルの表示
@@ -340,6 +340,20 @@
],
"hash": "6885C2736451491A0EC78156B9813B642238350992D3F33BF52435E1ADC9DE83"
},
{
"name": "shadow-figure-other-scene",
"frames": [
0
],
"hash": "44996CD0E824BAE692A7BFF8063E42BFEA76A8E1997B93A86584B92956835454"
},
{
"name": "shadow-figure-other-frame",
"frames": [
0
],
"hash": "91CC1D8F8948BE95E71C93CFE47816849FDF2A03D1DA5E7752059F401CB0774F"
},
{
"name": "shadow-figure-other-number",
"frames": [
+2 -2
ファイルの表示
@@ -19,7 +19,7 @@ internal static class EffectDescriptions
public static EffectDescription At(int frame, int length, DrawDescription draw) => At(frame, length, draw, ScreenSize);
public static EffectDescription At(int frame, int length, DrawDescription draw, Size screenSize)
public static EffectDescription At(int frame, int length, DrawDescription draw, Size screenSize, Guid scene = default)
{
var timeline = new TimelineSourceDescription(
screenSize,
@@ -27,7 +27,7 @@ internal static class EffectDescriptions
new FrameTime(length, Fps),
Fps,
TimelineSourceUsage.Playing,
Guid.Empty,
scene,
[]);
var item = new TimelineItemSourceDescription(timeline, frame, length, 0);
return new EffectDescription(item, draw, 0, 1, 0, 1);
+78 -38
ファイルの表示
@@ -28,14 +28,54 @@ public sealed class OccluderRegistryTests
using var first = devices.CreateContext();
using var second = devices.CreateContext();
using var a = OccluderRegistry.Acquire(first, 1);
using var b = OccluderRegistry.Acquire(second, 1);
using var c = OccluderRegistry.Acquire(first, 2);
using var a = OccluderRegistry.Acquire(first, Guid.Empty, 1);
using var b = OccluderRegistry.Acquire(second, Guid.Empty, 1);
using var c = OccluderRegistry.Acquire(first, Guid.Empty, 2);
Assert.Same(a.Group, b.Group);
Assert.NotSame(a.Group, c.Group);
}
[Fact]
public void TheSameNumberInAnotherSceneHasItsOwnGroup()
{
using var devices = new GraphicsDevices();
using var context = devices.CreateContext();
var home = Guid.NewGuid();
using var a = OccluderRegistry.Acquire(context, home, 1);
using var b = OccluderRegistry.Acquire(context, home, 1);
using var c = OccluderRegistry.Acquire(context, Guid.NewGuid(), 1);
Assert.Same(a.Group, b.Group);
Assert.NotSame(a.Group, c.Group);
}
[Fact]
public void ASnapshotKeepsOnlyTheOccludersPublishedForItsOwnFrame()
{
using var devices = new GraphicsDevices();
using var context = devices.CreateContext();
using var source = new SourceImage(context, Width, Height, Marker);
using var lease = OccluderRegistry.Acquire(context, Guid.Empty, 1);
using var now = lease.Group.Claim()!;
using var later = lease.Group.Claim()!;
now.Publish(source.Bitmap, Sample(0.25f), 4);
later.Publish(source.Bitmap, Sample(0.75f), 9);
var snapshot = new Occluder[VolumetricLightSettings.OccluderCapacity];
lease.Group.Snapshot(snapshot, 4);
Assert.Equal(0.25f, snapshot[0].Strength);
Assert.Equal(0f, snapshot[1].Strength);
lease.Group.Snapshot(snapshot, 9);
Assert.Equal(0f, snapshot[0].Strength);
Assert.Equal(0.75f, snapshot[1].Strength);
lease.Group.Snapshot(snapshot, 5);
Assert.All(snapshot, occluder => Assert.Equal(0f, occluder.Strength));
}
[Fact]
public void DifferentDevicesNeverShareAGroup()
{
@@ -44,8 +84,8 @@ public sealed class OccluderRegistryTests
using var first = firstDevices.CreateContext();
using var second = secondDevices.CreateContext();
using var a = OccluderRegistry.Acquire(first, 1);
using var b = OccluderRegistry.Acquire(second, 1);
using var a = OccluderRegistry.Acquire(first, Guid.Empty, 1);
using var b = OccluderRegistry.Acquire(second, Guid.Empty, 1);
Assert.NotSame(a.Group, b.Group);
}
@@ -55,8 +95,8 @@ public sealed class OccluderRegistryTests
{
using var devices = new GraphicsDevices();
using var context = devices.CreateContext();
var a = OccluderRegistry.Acquire(context, 3);
var b = OccluderRegistry.Acquire(context, 3);
var a = OccluderRegistry.Acquire(context, Guid.Empty, 3);
var b = OccluderRegistry.Acquire(context, Guid.Empty, 3);
var group = a.Group;
var slot = group.Claim()!;
@@ -64,7 +104,7 @@ public sealed class OccluderRegistryTests
a.Dispose();
Assert.NotNull(group.Claim());
b.Dispose();
using var again = OccluderRegistry.Acquire(context, 3);
using var again = OccluderRegistry.Acquire(context, Guid.Empty, 3);
Assert.NotSame(group, again.Group);
Assert.Null(group.Claim());
@@ -76,7 +116,7 @@ public sealed class OccluderRegistryTests
{
using var devices = new GraphicsDevices();
using var context = devices.CreateContext();
using var lease = OccluderRegistry.Acquire(context, 1);
using var lease = OccluderRegistry.Acquire(context, Guid.Empty, 1);
var slots = Enumerable.Range(0, VolumetricLightSettings.OccluderCapacity).Select(_ => lease.Group.Claim()).ToArray();
Assert.All(slots, Assert.NotNull);
@@ -93,7 +133,7 @@ public sealed class OccluderRegistryTests
{
using var devices = new GraphicsDevices();
using var context = devices.CreateContext();
using var lease = OccluderRegistry.Acquire(context, 1);
using var lease = OccluderRegistry.Acquire(context, Guid.Empty, 1);
Assert.False(lease.Group.IsOccupied);
var first = lease.Group.Claim()!;
@@ -111,18 +151,18 @@ public sealed class OccluderRegistryTests
using var devices = new GraphicsDevices();
using var context = devices.CreateContext();
using var source = new SourceImage(context, Width, Height, Marker);
using var lease = OccluderRegistry.Acquire(context, 1);
using var lease = OccluderRegistry.Acquire(context, Guid.Empty, 1);
using var first = lease.Group.Claim()!;
var second = lease.Group.Claim()!;
var snapshot = new Occluder[VolumetricLightSettings.OccluderCapacity];
first.Publish(source.Bitmap, Sample(0.25f));
second.Publish(source.Bitmap, Sample(0.75f));
lease.Group.Snapshot(snapshot);
first.Publish(source.Bitmap, Sample(0.25f), 0);
second.Publish(source.Bitmap, Sample(0.75f), 0);
lease.Group.Snapshot(snapshot, 0);
Assert.Equal([0.25f, 0.75f, 0f, 0f], snapshot.Select(occluder => occluder.Strength));
second.Dispose();
lease.Group.Snapshot(snapshot);
lease.Group.Snapshot(snapshot, 0);
Assert.Equal([0.25f, 0f, 0f, 0f], snapshot.Select(occluder => occluder.Strength));
}
@@ -132,13 +172,13 @@ public sealed class OccluderRegistryTests
using var devices = new GraphicsDevices();
using var context = devices.CreateContext();
using var source = new SourceImage(context, Width, Height, Marker);
using var lease = OccluderRegistry.Acquire(context, 1);
using var lease = OccluderRegistry.Acquire(context, Guid.Empty, 1);
var slot = lease.Group.Claim()!;
slot.Dispose();
var snapshot = new Occluder[VolumetricLightSettings.OccluderCapacity];
slot.Publish(source.Bitmap, Sample());
lease.Group.Snapshot(snapshot);
slot.Publish(source.Bitmap, Sample(), 0);
lease.Group.Snapshot(snapshot, 0);
Assert.All(snapshot, occluder => Assert.Equal(0f, occluder.Strength));
}
@@ -149,12 +189,12 @@ public sealed class OccluderRegistryTests
using var devices = new GraphicsDevices();
using var context = devices.CreateContext();
using var source = new SourceImage(context, Width, Height, Marker);
using var lease = OccluderRegistry.Acquire(context, 1);
using var lease = OccluderRegistry.Acquire(context, Guid.Empty, 1);
var slot = lease.Group.Claim()!;
var relay = lease.Group.GetOutput(0);
var empty = context.DeviceContext.GetImageLocalBounds(relay);
slot.Publish(source.Bitmap, Sample());
slot.Publish(source.Bitmap, Sample(), 0);
var shown = Render(context, relay);
slot.Dispose();
var gone = context.DeviceContext.GetImageLocalBounds(relay);
@@ -172,10 +212,10 @@ public sealed class OccluderRegistryTests
using var reader = devices.CreateContext();
using var writer = devices.CreateContext();
using var source = new SourceImage(writer, Width, Height, Marker);
using var lease = OccluderRegistry.Acquire(reader, 1);
using var lease = OccluderRegistry.Acquire(reader, Guid.Empty, 1);
using var slot = lease.Group.Claim()!;
slot.Publish(source.Bitmap, Sample());
slot.Publish(source.Bitmap, Sample(), 0);
var shown = Render(reader, lease.Group.GetOutput(0));
Assert.Equal(source[3, 2], shown[3, 2]);
@@ -188,11 +228,11 @@ public sealed class OccluderRegistryTests
using var reader = devices.CreateContext();
var creator = devices.CreateContext();
using var source = new SourceImage(reader, Width, Height, Marker);
using var lease = OccluderRegistry.Acquire(creator, 1);
using var lease = OccluderRegistry.Acquire(creator, Guid.Empty, 1);
using var slot = lease.Group.Claim()!;
creator.Dispose();
slot.Publish(source.Bitmap, Sample());
slot.Publish(source.Bitmap, Sample(), 0);
var shown = Render(reader, lease.Group.GetOutput(0));
Assert.Equal(source[5, 1], shown[5, 1]);
@@ -204,7 +244,7 @@ public sealed class OccluderRegistryTests
using var devices = new GraphicsDevices();
using var context = devices.CreateContext();
using var source = new SourceImage(context, Width, Height, Marker);
using var lease = OccluderRegistry.Acquire(context, 1);
using var lease = OccluderRegistry.Acquire(context, Guid.Empty, 1);
var claimed = 0;
Parallel.For(0, 64, index =>
@@ -214,10 +254,10 @@ public sealed class OccluderRegistryTests
return;
Interlocked.Increment(ref claimed);
slot.Publish(source.Bitmap, Sample((index + 1) / 100f));
slot.Publish(source.Bitmap, Sample((index + 1) / 100f), 0);
});
var snapshot = new Occluder[VolumetricLightSettings.OccluderCapacity];
lease.Group.Snapshot(snapshot);
lease.Group.Snapshot(snapshot, 0);
Assert.Equal(VolumetricLightSettings.OccluderCapacity, claimed);
Assert.All(snapshot, occluder => Assert.True(occluder.Strength > 0f));
@@ -229,7 +269,7 @@ public sealed class OccluderRegistryTests
using var devices = new GraphicsDevices();
using var context = devices.CreateContext();
using var source = new SourceImage(context, Width, Height, Marker);
using var lease = OccluderRegistry.Acquire(context, 1);
using var lease = OccluderRegistry.Acquire(context, Guid.Empty, 1);
using var slot = lease.Group.Claim()!;
using var blur = new Vortice.Direct2D1.Effects.GaussianBlur(context.DeviceContext);
blur.SetInput(0, source.Bitmap, true);
@@ -241,12 +281,12 @@ public sealed class OccluderRegistryTests
var freed = new Occluder[VolumetricLightSettings.OccluderCapacity];
lease.Group.AddConsumer(blur.NativePointer);
slot.Publish(image, Sample());
lease.Group.Snapshot(blocked);
slot.Publish(image, Sample(), 0);
lease.Group.Snapshot(blocked, 0);
var kept = context.DeviceContext.GetImageLocalBounds(lease.Group.GetOutput(0));
lease.Group.RemoveConsumer(blur.NativePointer);
slot.Publish(image, Sample());
lease.Group.Snapshot(freed);
slot.Publish(image, Sample(), 0);
lease.Group.Snapshot(freed, 0);
var relayed = context.DeviceContext.GetImageLocalBounds(lease.Group.GetOutput(0));
Assert.Equal(0f, blocked[0].Strength);
@@ -261,18 +301,18 @@ public sealed class OccluderRegistryTests
using var devices = new GraphicsDevices();
using var context = devices.CreateContext();
using var source = new SourceImage(context, Width, Height, Marker);
using var lease = OccluderRegistry.Acquire(context, 1);
using var lease = OccluderRegistry.Acquire(context, Guid.Empty, 1);
using var slot = lease.Group.Claim()!;
using var blur = new Vortice.Direct2D1.Effects.GaussianBlur(context.DeviceContext);
blur.SetInput(0, source.Bitmap, true);
using var image = blur.Output;
var snapshot = new Occluder[VolumetricLightSettings.OccluderCapacity];
slot.Publish(image, Sample());
lease.Group.Snapshot(snapshot);
slot.Publish(image, Sample(), 0);
lease.Group.Snapshot(snapshot, 0);
Assert.Equal(1f, snapshot[0].Strength);
lease.Group.AddConsumer(blur.NativePointer);
lease.Group.Snapshot(snapshot);
lease.Group.Snapshot(snapshot, 0);
Assert.Equal(0f, snapshot[0].Strength);
Assert.Equal((0f, 0f, 0f, 0f), (context.DeviceContext.GetImageLocalBounds(lease.Group.GetOutput(0)) is var bounds ? (bounds.Left, bounds.Top, bounds.Right, bounds.Bottom) : default));
@@ -283,8 +323,8 @@ public sealed class OccluderRegistryTests
{
using var devices = new GraphicsDevices();
using var context = devices.CreateContext();
using var lease = OccluderRegistry.Acquire(context, 1);
var link = new OccluderLink { Group = lease.Group };
using var lease = OccluderRegistry.Acquire(context, Guid.Empty, 1);
var link = new OccluderLink { Group = lease.Group, Frame = 0 };
var id = OccluderLinks.Register(link);
+3 -3
ファイルの表示
@@ -53,11 +53,11 @@ public sealed class ShaftCustomEffectTests(ITestOutputHelper output)
readonly OccluderLease lease;
readonly OccluderSlot[] slots;
readonly ID2D1Bitmap1[] bitmaps;
readonly OccluderLink link = new();
readonly OccluderLink link = new() { Frame = 0 };
public OccluderRig(IGraphicsDevicesAndContext devices, IReadOnlyList<(DrawDescription Draw, GoboPyramid Image, float Strength)> occluders)
{
lease = OccluderRegistry.Acquire(devices, 1);
lease = OccluderRegistry.Acquire(devices, Guid.Empty, 1);
link.Group = lease.Group;
LinkId = OccluderLinks.Register(link);
slots = new OccluderSlot[occluders.Count];
@@ -68,7 +68,7 @@ public sealed class ShaftCustomEffectTests(ITestOutputHelper output)
Assert.True(ViewTransform.TryCreate(draw, out var view));
slots[index] = lease.Group.Claim()!;
bitmaps[index] = image.CreateBitmaps(devices)[0];
slots[index].Publish(bitmaps[index], new Occluder(view, GoboMapping.Create(draw.Zoom, draw.Invert, draw.CenterPoint), strength));
slots[index].Publish(bitmaps[index], new Occluder(view, GoboMapping.Create(draw.Zoom, draw.Invert, draw.CenterPoint), strength), 0);
}
}
+107 -14
ファイルの表示
@@ -49,9 +49,11 @@ public sealed class VolumetricLightOccluderEffectProcessorTests
{
readonly IGraphicsDevicesAndContext context;
readonly SourceImage source;
readonly Guid scene;
public Item(GraphicsDevices devices, YukkuriMovieMaker.Plugin.Effects.VideoEffectBase effect, Func<int, int, Bgra> pixels)
public Item(GraphicsDevices devices, YukkuriMovieMaker.Plugin.Effects.VideoEffectBase effect, Func<int, int, Bgra> pixels, Guid scene = default)
{
this.scene = scene;
context = devices.CreateContext();
source = new SourceImage(context, Width, Height, pixels);
Processor = effect.CreateVideoEffect(context);
@@ -62,12 +64,12 @@ public sealed class VolumetricLightOccluderEffectProcessorTests
public SourceImage Source => source;
public DrawDescription Update(int frame, DrawDescription draw)
=> Processor.Update(EffectDescriptions.At(frame, Length, draw, Canvas));
public DrawDescription Update(int frame, DrawDescription draw, Guid? moveTo = null)
=> Processor.Update(EffectDescriptions.At(frame, Length, draw, Canvas, moveTo ?? scene));
public Rendering Render(int frame, DrawDescription draw)
public Rendering Render(int frame, DrawDescription draw, Guid? moveTo = null)
{
Update(frame, draw);
Update(frame, draw, moveTo);
return Rendering.Capture(context, Processor.Output);
}
@@ -92,11 +94,11 @@ public sealed class VolumetricLightOccluderEffectProcessorTests
.Where(point => point.X < 0 || point.Y < 0 || point.X >= Width || point.Y >= Height)
.Sum(point => (long)rendering[point.X, point.Y].Red + rendering[point.X, point.Y].Green + rendering[point.X, point.Y].Blue);
static Occluder[] Snapshot(IGraphicsDevicesAndContext context, int channel)
static Occluder[] Snapshot(IGraphicsDevicesAndContext context, int channel, int frame = 0, Guid scene = default)
{
using var lease = OccluderRegistry.Acquire(context, channel);
using var lease = OccluderRegistry.Acquire(context, scene, channel);
var snapshot = new Occluder[VolumetricLightSettings.OccluderCapacity];
lease.Group.Snapshot(snapshot);
lease.Group.Snapshot(snapshot, frame);
return snapshot;
}
@@ -158,8 +160,8 @@ public sealed class VolumetricLightOccluderEffectProcessorTests
effect.Channel = 3;
item.Update(1, InFront);
Assert.All(Snapshot(context, 1), occluder => Assert.Equal(0f, occluder.Strength));
Assert.True(Snapshot(context, 3)[0].Strength > 0f);
Assert.All(Snapshot(context, 1, 1), occluder => Assert.Equal(0f, occluder.Strength));
Assert.True(Snapshot(context, 3, 1)[0].Strength > 0f);
}
[Fact]
@@ -185,13 +187,13 @@ public sealed class VolumetricLightOccluderEffectProcessorTests
var light = Light(1).CreateVideoEffect(context);
light.SetInput(source.Bitmap);
light.Update(EffectDescriptions.At(0, Length, EffectDescriptions.Flat, Canvas));
var held = OccluderRegistry.Acquire(context, 1);
var held = OccluderRegistry.Acquire(context, Guid.Empty, 1);
var group = held.Group;
light.Dispose();
held.Dispose();
using var again = OccluderRegistry.Acquire(context, 1);
using var again = OccluderRegistry.Acquire(context, Guid.Empty, 1);
Assert.NotSame(group, again.Group);
}
@@ -209,8 +211,9 @@ public sealed class VolumetricLightOccluderEffectProcessorTests
Assert.All(snapshot, occluder => Assert.True(occluder.Strength > 0f));
items[0].Dispose();
items[^1].Update(1, InFront);
Assert.All(Snapshot(context, 1), occluder => Assert.True(occluder.Strength > 0f));
foreach (var item in items.Skip(1))
item.Update(1, InFront);
Assert.All(Snapshot(context, 1, 1), occluder => Assert.True(occluder.Strength > 0f));
}
finally
{
@@ -275,6 +278,96 @@ public sealed class VolumetricLightOccluderEffectProcessorTests
Assert.True(darker > Width * Height / 4, $"{darker}");
}
[Fact]
public void AnOccluderPublishedForAnotherFrameCastsNoShadowUntilThatFrame()
{
using var devices = new GraphicsDevices();
using var light = new Item(devices, Light(1), Glass);
using var occluder = new Item(devices, Blocker(), Bars);
var clearNow = light.Render(0, EffectDescriptions.Flat);
var clearLater = light.Render(15, EffectDescriptions.Flat);
occluder.Update(15, InFront);
Assert.True(clearNow.SamePixelsAs(light.Render(0, EffectDescriptions.Flat)));
Assert.True(OutsideLight(light.Render(15, EffectDescriptions.Flat)) < OutsideLight(clearLater) * 0.9);
}
[Fact]
public void AnOccluderInAnotherSceneNeverReachesTheLight()
{
var home = Guid.NewGuid();
var away = Guid.NewGuid();
using var devices = new GraphicsDevices();
using var light = new Item(devices, Light(1), Glass, home);
using var foreign = new Item(devices, Blocker(), Bars, away);
var clear = light.Render(0, EffectDescriptions.Flat);
foreign.Update(0, InFront);
Assert.True(clear.SamePixelsAs(light.Render(0, EffectDescriptions.Flat)));
using var native = new Item(devices, Blocker(), Bars, home);
native.Update(0, InFront);
Assert.True(OutsideLight(light.Render(0, EffectDescriptions.Flat)) < OutsideLight(clear) * 0.9);
}
[Fact]
public void ALightThatMovesToAnotherSceneFollowsTheOccludersThereAndLeavesTheOldOnes()
{
var home = Guid.NewGuid();
var away = Guid.NewGuid();
using var devices = new GraphicsDevices();
using var light = new Item(devices, Light(1), Glass, home);
using var occluder = new Item(devices, Blocker(), Bars, away);
var clear = light.Render(0, EffectDescriptions.Flat);
occluder.Update(0, InFront);
Assert.True(OutsideLight(light.Render(0, EffectDescriptions.Flat, away)) < OutsideLight(clear) * 0.9);
Assert.True(clear.SamePixelsAs(light.Render(0, EffectDescriptions.Flat, home)));
}
[Fact]
public void AnOccluderThatMovesToAnotherSceneLeavesTheLightsOfTheOldOne()
{
var home = Guid.NewGuid();
var away = Guid.NewGuid();
using var devices = new GraphicsDevices();
using var light = new Item(devices, Light(1), Glass, home);
using var occluder = new Item(devices, Blocker(), Bars, home);
var clear = light.Render(0, EffectDescriptions.Flat);
occluder.Update(0, InFront);
Assert.True(OutsideLight(light.Render(0, EffectDescriptions.Flat)) < OutsideLight(clear) * 0.9);
occluder.Update(0, InFront, away);
Assert.True(clear.SamePixelsAs(light.Render(0, EffectDescriptions.Flat)));
}
[Fact]
public void EachSceneKeepsItsOwnFourOccluderSlotsOnTheSameNumber()
{
var home = Guid.NewGuid();
var away = Guid.NewGuid();
using var devices = new GraphicsDevices();
using var context = devices.CreateContext();
var items = Enumerable.Range(0, VolumetricLightSettings.OccluderCapacity + 1)
.Select(index => new Item(devices, Blocker(), Bars, index < VolumetricLightSettings.OccluderCapacity ? home : away))
.ToArray();
try
{
foreach (var item in items)
item.Update(0, InFront);
Assert.All(Snapshot(context, 1, 0, home), occluder => Assert.True(occluder.Strength > 0f));
Assert.True(Snapshot(context, 1, 0, away)[0].Strength > 0f);
}
finally
{
foreach (var item in items)
item.Dispose();
}
}
[Fact]
public void ALightIgnoresOccludersOfAnotherNumberAndWhenItsOwnNumberIsZero()
{
+28 -18
ファイルの表示
@@ -17,6 +17,7 @@ internal sealed class OccluderGroup : IDisposable
private readonly ID2D1Image[] _outputs = new ID2D1Image[VolumetricLightSettings.OccluderCapacity];
private readonly ID2D1Image?[] _published = new ID2D1Image?[VolumetricLightSettings.OccluderCapacity];
private readonly Occluder[] _requested = new Occluder[VolumetricLightSettings.OccluderCapacity];
private readonly int[] _frames = new int[VolumetricLightSettings.OccluderCapacity];
private readonly bool[] _blocked = new bool[VolumetricLightSettings.OccluderCapacity];
private readonly int[] _checked = new int[VolumetricLightSettings.OccluderCapacity];
private readonly HashSet<nint> _consumers = [];
@@ -78,12 +79,12 @@ internal sealed class OccluderGroup : IDisposable
}
}
public void Snapshot(Span<Occluder> destination)
public void Snapshot(Span<Occluder> destination, int frame)
{
lock (_gate)
{
for (var index = 0; index < destination.Length; index++)
destination[index] = !_disposed && index < _occluders.Length ? _occluders[index] : default;
destination[index] = !_disposed && index < _occluders.Length && _frames[index] == frame ? _occluders[index] : default;
}
}
@@ -124,7 +125,7 @@ internal sealed class OccluderGroup : IDisposable
}
}
internal void Publish(int index, ID2D1Image image, in Occluder occluder)
internal void Publish(int index, ID2D1Image image, in Occluder occluder, int frame)
{
lock (_gate)
{
@@ -132,6 +133,7 @@ internal sealed class OccluderGroup : IDisposable
return;
_requested[index] = occluder;
_frames[index] = frame;
if (!ReferenceEquals(_published[index], image) || _checked[index] != _version)
{
_published[index] = image;
@@ -217,7 +219,7 @@ internal sealed class OccluderSlot(OccluderGroup group, int index) : IDisposable
{
private int _retired;
public void Publish(ID2D1Image image, in Occluder occluder) => group.Publish(index, image, occluder);
public void Publish(ID2D1Image image, in Occluder occluder, int frame) => group.Publish(index, image, occluder, frame);
public void Dispose()
{
@@ -229,13 +231,13 @@ internal sealed class OccluderSlot(OccluderGroup group, int index) : IDisposable
internal sealed class OccluderLease : IDisposable
{
private readonly OccluderBoard _board;
private readonly int _channel;
private readonly (Guid Scene, int Channel) _key;
private int _released;
internal OccluderLease(OccluderBoard board, int channel, OccluderGroup group)
internal OccluderLease(OccluderBoard board, (Guid Scene, int Channel) key, OccluderGroup group)
{
_board = board;
_channel = channel;
_key = key;
Group = group;
}
@@ -244,7 +246,7 @@ internal sealed class OccluderLease : IDisposable
public void Dispose()
{
if (Interlocked.Exchange(ref _released, 1) == 0)
_board.Release(_channel);
_board.Release(_key);
}
}
@@ -258,31 +260,32 @@ internal sealed class OccluderBoard
}
private readonly object _gate = new();
private readonly Dictionary<int, Entry> _entries = [];
private readonly Dictionary<(Guid Scene, int Channel), Entry> _entries = [];
public OccluderLease Acquire(IGraphicsDevicesAndContext devices, int channel)
public OccluderLease Acquire(IGraphicsDevicesAndContext devices, Guid scene, int channel)
{
var key = (scene, channel);
lock (_gate)
{
if (!_entries.TryGetValue(channel, out var entry))
if (!_entries.TryGetValue(key, out var entry))
{
entry = new Entry(new OccluderGroup(devices.DeviceContext));
_entries.Add(channel, entry);
_entries.Add(key, entry);
}
entry.References++;
return new OccluderLease(this, channel, entry.Group);
return new OccluderLease(this, key, entry.Group);
}
}
internal void Release(int channel)
internal void Release((Guid Scene, int Channel) key)
{
lock (_gate)
{
if (!_entries.TryGetValue(channel, out var entry) || --entry.References > 0)
if (!_entries.TryGetValue(key, out var entry) || --entry.References > 0)
return;
_entries.Remove(channel);
_entries.Remove(key);
entry.Group.Dispose();
}
}
@@ -292,19 +295,26 @@ internal static class OccluderRegistry
{
private static readonly ConditionalWeakTable<D2DDevices, OccluderBoard> Boards = [];
public static OccluderLease Acquire(IGraphicsDevicesAndContext devices, int channel)
=> Boards.GetValue(devices.D2D, _ => new OccluderBoard()).Acquire(devices, channel);
public static OccluderLease Acquire(IGraphicsDevicesAndContext devices, Guid scene, int channel)
=> Boards.GetValue(devices.D2D, _ => new OccluderBoard()).Acquire(devices, scene, channel);
}
internal sealed class OccluderLink
{
private OccluderGroup? _group;
private int _frame;
public OccluderGroup? Group
{
get => Volatile.Read(ref _group);
set => Volatile.Write(ref _group, value);
}
public int Frame
{
get => Volatile.Read(ref _frame);
set => Volatile.Write(ref _frame, value);
}
}
internal static class OccluderLinks
+1 -1
ファイルの表示
@@ -229,7 +229,7 @@ internal sealed class ShaftCustomEffect : D2D1CustomShaderEffectBase
Span<Occluder> occluders = stackalloc Occluder[VolumetricLightSettings.OccluderCapacity];
Span<float> strengths = stackalloc float[VolumetricLightSettings.OccluderCapacity];
group.Snapshot(occluders);
group.Snapshot(occluders, link.Frame);
for (var index = 0; index < occluders.Length; index++)
{
var plane = OccluderPlane.Create(_cameraFromLocal, occluders[index]);
+7 -4
ファイルの表示
@@ -54,6 +54,7 @@ internal sealed class VolumetricLightEffectProcessor(IGraphicsDevicesAndContext
private int _linkId;
private OccluderLease? _lease;
private int _occlusionChannel = -1;
private Guid _occlusionScene;
private int _revision;
public override DrawDescription Update(EffectDescription effectDescription)
@@ -100,7 +101,8 @@ internal sealed class VolumetricLightEffectProcessor(IGraphicsDevicesAndContext
{
SetScale(scene.Scale);
Apply(scene.Constants);
SetOcclusion(Math.Clamp(_item.OcclusionChannel, 0, VolumetricLightSettings.MaximumOcclusionChannel));
_link.Frame = effectDescription.TimelinePosition.Frame;
SetOcclusion(effectDescription.SceneId, Math.Clamp(_item.OcclusionChannel, 0, VolumetricLightSettings.MaximumOcclusionChannel));
SetShaft(ShaftState.Shaft);
}
@@ -213,18 +215,19 @@ internal sealed class VolumetricLightEffectProcessor(IGraphicsDevicesAndContext
_constants = next;
}
private void SetOcclusion(int channel)
private void SetOcclusion(Guid scene, int channel)
{
if (_occlusionChannel != channel)
if (_occlusionChannel != channel || _occlusionScene != scene)
{
ReleaseOcclusion();
_lease = channel > 0 ? OccluderRegistry.Acquire(_devices, channel) : null;
_lease = channel > 0 ? OccluderRegistry.Acquire(_devices, scene, channel) : null;
_lease?.Group.AddConsumer(_shaft!.NativePointer);
for (var slot = 0; slot < VolumetricLightSettings.OccluderCapacity; slot++)
_shaft!.SetInput(VolumetricLightSettings.GoboLevelCount + slot, _lease?.Group.GetOutput(slot) ?? _emptyOutput, true);
_link.Group = _lease?.Group;
_occlusionChannel = channel;
_occlusionScene = scene;
}
if (_lease?.Group.IsOccupied == true)
+6 -3
ファイルの表示
@@ -12,6 +12,7 @@ internal sealed class VolumetricLightOccluderEffectProcessor(IGraphicsDevicesAnd
private OccluderLease? _lease;
private OccluderSlot? _slot;
private int _channel;
private Guid _scene;
public override DrawDescription Update(EffectDescription effectDescription)
{
@@ -34,11 +35,13 @@ internal sealed class VolumetricLightOccluderEffectProcessor(IGraphicsDevicesAnd
var draw = effectDescription.DrawDescription;
var channel = Math.Clamp(_item.Channel, 1, VolumetricLightSettings.MaximumOcclusionChannel);
if (_lease is null || _channel != channel)
var scene = effectDescription.SceneId;
if (_lease is null || _channel != channel || _scene != scene)
{
Release();
_lease = OccluderRegistry.Acquire(_devices, channel);
_lease = OccluderRegistry.Acquire(_devices, scene, channel);
_channel = channel;
_scene = scene;
}
_slot ??= _lease.Group.Claim();
@@ -51,7 +54,7 @@ internal sealed class VolumetricLightOccluderEffectProcessor(IGraphicsDevicesAnd
var occluder = draw.Zoom.X != 0f && draw.Zoom.Y != 0f && ViewTransform.TryCreate(draw, out var view)
? new Occluder(view, GoboMapping.Create(draw.Zoom, draw.Invert, draw.CenterPoint), strength)
: default;
_slot.Publish(input, occluder);
_slot.Publish(input, occluder, effectDescription.TimelinePosition.Frame);
}
private void Release()
バイナリ
ファイルの表示
バイナリファイルは表示されません。

変更後

幅:  |  高さ:  |  サイズ: 1.5 MiB

バイナリ
ファイルの表示
バイナリファイルは表示されません。

変更後

幅:  |  高さ:  |  サイズ: 1.6 MiB

バイナリ
ファイルの表示
バイナリファイルは表示されません。

変更後

幅:  |  高さ:  |  サイズ: 1.0 MiB