コミットを比較
| 作成者 | SHA1 | 日付 | |
|---|---|---|---|
|
|
c953e9b089
|
||
|
|
8dc2dcca6f
|
||
|
|
bbe49c4ba2
|
||
|
|
062860380f
|
||
|
|
39b0e1e989
|
||
|
|
f5d1948278
|
||
|
|
419718474c
|
||
|
|
d4040a48a4
|
||
|
|
8f44a88931
|
||
|
|
fbeb366111
|
||
|
|
2d1369a5c7
|
||
|
|
a6ca143486
|
||
|
|
148284f594
|
||
|
|
57e9a83fcc
|
||
|
|
2657fd3392
|
||
|
|
ba61a9495a
|
||
|
|
a7840711be
|
||
|
|
33a89eb95a
|
||
|
|
3df1c8054e
|
||
|
|
1604154160
|
||
|
|
0cde42ed67
|
||
|
|
28b30c551c
|
||
|
|
4450c3c51c
|
||
|
|
3480a65a3b
|
||
|
|
0f1453b6fd
|
||
|
|
95324ec2b3
|
||
|
|
615ef56a8d
|
検索条件に一致するファイルはありません
@@ -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" = "Mirage-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 = "Mirage/Mirage.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 Mirage.Shader/Mirage.Shader.vcxproj `
|
||||
/p:Configuration=Release `
|
||||
/p:Platform=Win32 `
|
||||
/nologo
|
||||
|
||||
- name: プロジェクトのビルド
|
||||
shell: pwsh
|
||||
run: |
|
||||
$proj = "Mirage/Mirage.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 = "Mirage/bin/Release/net10.0-windows10.0.19041.0"
|
||||
$stageRoot = "stage/Mirage"
|
||||
$pkgName = "Mirage_$version.ymme"
|
||||
|
||||
New-Item -ItemType Directory -Path $stageRoot -Force | Out-Null
|
||||
New-Item -ItemType Directory -Path "$stageRoot/LICENSE" -Force | Out-Null
|
||||
|
||||
$dll = "$outDir/Mirage.dll"
|
||||
if (-not (Test-Path $dll)) {
|
||||
Write-Error "ビルド結果に Mirage.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)"
|
||||
}
|
||||
}
|
||||
|
||||
+10
-3
@@ -1,5 +1,5 @@
|
||||
========================================
|
||||
蜃気楼 for YMM4 v1.0.0
|
||||
蜃気楼 for YMM4 v1.0.1
|
||||
========================================
|
||||
YukkuriMovieMaker4上で動作する、
|
||||
気温の分布から光が曲がる経路を求め、
|
||||
@@ -148,15 +148,22 @@ visible and near infrared」(Applied Optics、1996年)の式で求めます
|
||||
■ 不具合の報告
|
||||
--------------------------------------------------------------------------------
|
||||
本プラグインは、想定していない例外が起きたときに、その内容を開発者へ自動で
|
||||
送信します。同意は求めず、常に送信します。
|
||||
送信します。同意は求めません。止める設定もありません。
|
||||
|
||||
送信する数には上限があります。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
|
||||
@@ -437,6 +437,35 @@ public sealed class MirageEffectProcessorTests
|
||||
Assert.True(reused.SamePixelsAs(created));
|
||||
}
|
||||
|
||||
public static readonly TheoryData<string, Action<MirageEffect>> TableChanges = new()
|
||||
{
|
||||
{ nameof(MirageEffect.EyeHeight), effect => effect.EyeHeight.Values[0].Value = 6d },
|
||||
{ nameof(MirageEffect.HeatDifference), effect => effect.HeatDifference.Values[0].Value = 45d },
|
||||
{ nameof(MirageEffect.HeatThickness), effect => effect.HeatThickness.Values[0].Value = 1.5d },
|
||||
};
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(TableChanges))]
|
||||
public void ATableReusedAfterAChangeDrawsTheSameMirageAsANewProcessor(string setting, Action<MirageEffect> change)
|
||||
{
|
||||
using var devices = new GraphicsDevices();
|
||||
using var context = devices.CreateContext();
|
||||
var effect = Inferior();
|
||||
effect.FieldOfView.Values[0].Value = 1d;
|
||||
using var source = new SourceImage(context, Width, Height, Pattern);
|
||||
using var used = effect.CreateVideoEffect(context);
|
||||
used.SetInput(source.Bitmap);
|
||||
RenderFrame(context, used, 3);
|
||||
change(effect);
|
||||
using var fresh = effect.CreateVideoEffect(context);
|
||||
fresh.SetInput(source.Bitmap);
|
||||
|
||||
var reused = RenderFrame(context, used, 3);
|
||||
var created = RenderFrame(context, fresh, 3);
|
||||
|
||||
Assert.True(reused.SamePixelsAs(created), setting);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AnimatedEyeHeightIsReadAtEachFrame()
|
||||
{
|
||||
|
||||
@@ -163,8 +163,8 @@ public sealed class MirageEffectTests
|
||||
[InlineData(nameof(MirageEffect.Source), nameof(Texts.AtmosphereGroup), nameof(Texts.Source), nameof(Texts.SourceDescription), 18)]
|
||||
[InlineData(nameof(MirageEffect.Shimmer), nameof(Texts.AtmosphereGroup), nameof(Texts.Shimmer), nameof(Texts.ShimmerDescription), 19)]
|
||||
[InlineData(nameof(MirageEffect.ShimmerSpeed), nameof(Texts.AtmosphereGroup), nameof(Texts.ShimmerSpeed), nameof(Texts.ShimmerSpeedDescription), 20)]
|
||||
[InlineData(nameof(MirageEffect.FieldOfView), nameof(Texts.CameraGroup), nameof(Texts.FieldOfView), nameof(Texts.FieldOfViewDescription), 20)]
|
||||
[InlineData(nameof(MirageEffect.HorizonPosition), nameof(Texts.CameraGroup), nameof(Texts.HorizonPosition), nameof(Texts.HorizonPositionDescription), 21)]
|
||||
[InlineData(nameof(MirageEffect.FieldOfView), nameof(Texts.CameraGroup), nameof(Texts.FieldOfView), nameof(Texts.FieldOfViewDescription), 30)]
|
||||
[InlineData(nameof(MirageEffect.HorizonPosition), nameof(Texts.CameraGroup), nameof(Texts.HorizonPosition), nameof(Texts.HorizonPositionDescription), 31)]
|
||||
public void EveryParameterIsDisplayedInItsGroupInOrder(string property, string group, string name, string description, int order)
|
||||
{
|
||||
var display = Attribute<DisplayAttribute>(property);
|
||||
@@ -176,6 +176,18 @@ public sealed class MirageEffectTests
|
||||
Assert.Equal(typeof(Texts), display.ResourceType);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NoTwoParametersShareAnOrder()
|
||||
{
|
||||
var orders = typeof(MirageEffect).GetProperties()
|
||||
.Select(property => property.GetCustomAttribute<DisplayAttribute>())
|
||||
.OfType<DisplayAttribute>()
|
||||
.Select(display => display.Order)
|
||||
.ToArray();
|
||||
|
||||
Assert.Equal(orders.Length, orders.Distinct().Count());
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(nameof(MirageEffect.Amount), "F1", "%", 0d, 100d)]
|
||||
[InlineData(nameof(MirageEffect.EyeHeight), "F1", "m", 0.5d, 20d)]
|
||||
|
||||
+12
-18
@@ -19,11 +19,11 @@ internal readonly record struct Atmosphere(AtmosphereLayer Layer, double Differe
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization)]
|
||||
public double Temperature(double height)
|
||||
=> MirageSettings.StandardTemperature - MirageSettings.LapseRate * height + LayerTemperature(height);
|
||||
=> MirageSettings.StandardTemperature - MirageSettings.LapseRate * height + LayerValues(height).Temperature;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization)]
|
||||
public double TemperatureGradient(double height)
|
||||
=> -MirageSettings.LapseRate + LayerGradient(height);
|
||||
=> -MirageSettings.LapseRate + LayerValues(height).Gradient;
|
||||
|
||||
public double Pressure(double height)
|
||||
=> MirageSettings.StandardPressure * Math.Pow(PressureRatio(height), MirageSettings.BarometricExponent);
|
||||
@@ -42,10 +42,11 @@ internal readonly record struct Atmosphere(AtmosphereLayer Layer, double Differe
|
||||
var power = Math.Pow(ratio, MirageSettings.BarometricExponent - 1.0);
|
||||
var pressure = MirageSettings.StandardPressure * power * ratio;
|
||||
var pressureGradient = -MirageSettings.StandardPressure * MirageSettings.BarometricExponent * MirageSettings.LapseRate / MirageSettings.StandardTemperature * power;
|
||||
var temperature = Temperature(height);
|
||||
var layer = LayerValues(height);
|
||||
var temperature = MirageSettings.StandardTemperature - MirageSettings.LapseRate * height + layer.Temperature;
|
||||
var index = 1.0 + Refractivity * (pressure / MirageSettings.StandardPressure) * (MirageSettings.StandardTemperature / temperature);
|
||||
var gradient = Refractivity * MirageSettings.StandardTemperature / MirageSettings.StandardPressure
|
||||
* (pressureGradient / temperature - pressure * TemperatureGradient(height) / (temperature * temperature));
|
||||
* (pressureGradient / temperature - pressure * (-MirageSettings.LapseRate + layer.Gradient) / (temperature * temperature));
|
||||
return (index, gradient);
|
||||
}
|
||||
|
||||
@@ -53,26 +54,19 @@ internal readonly record struct Atmosphere(AtmosphereLayer Layer, double Differe
|
||||
=> 1.0 - MirageSettings.LapseRate * height / MirageSettings.StandardTemperature;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization)]
|
||||
private double LayerTemperature(double height)
|
||||
=> Layer switch
|
||||
{
|
||||
AtmosphereLayer.Inversion => Difference * 0.5 * (1.0 + Math.Tanh((height - Height) / Thickness)),
|
||||
AtmosphereLayer.Heated => Difference * Math.Exp(-height / Thickness),
|
||||
_ => 0.0,
|
||||
};
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization)]
|
||||
private double LayerGradient(double height)
|
||||
private (double Temperature, double Gradient) LayerValues(double height)
|
||||
{
|
||||
switch (Layer)
|
||||
{
|
||||
case AtmosphereLayer.Inversion:
|
||||
var cosine = Math.Cosh((height - Height) / Thickness);
|
||||
return Difference * 0.5 / (Thickness * cosine * cosine);
|
||||
var scaled = (height - Height) / Thickness;
|
||||
var cosine = Math.Cosh(scaled);
|
||||
return (Difference * 0.5 * (1.0 + Math.Tanh(scaled)), Difference * 0.5 / (Thickness * cosine * cosine));
|
||||
case AtmosphereLayer.Heated:
|
||||
return -Difference / Thickness * Math.Exp(-height / Thickness);
|
||||
var decay = Math.Exp(-height / Thickness);
|
||||
return (Difference * decay, -Difference / Thickness * decay);
|
||||
default:
|
||||
return 0.0;
|
||||
return (0.0, 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
<UseWPF>true</UseWPF>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>1.0.0</Version>
|
||||
<Version>1.0.1</Version>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<ShaderDirPath>..\Release\</ShaderDirPath>
|
||||
|
||||
@@ -78,11 +78,11 @@ public sealed class MirageEffect : VideoEffectBase
|
||||
[AnimationSlider("F2", "×", MirageSettings.MinimumShimmerSpeed, MirageSettings.MaximumShimmerSpeed)]
|
||||
public Animation ShimmerSpeed { get; } = new Animation(MirageSettings.DefaultShimmerSpeed, MirageSettings.MinimumShimmerSpeed, MirageSettings.MaximumShimmerSpeed);
|
||||
|
||||
[Display(GroupName = nameof(Texts.CameraGroup), Name = nameof(Texts.FieldOfView), Description = nameof(Texts.FieldOfViewDescription), Order = 20, ResourceType = typeof(Texts))]
|
||||
[Display(GroupName = nameof(Texts.CameraGroup), Name = nameof(Texts.FieldOfView), Description = nameof(Texts.FieldOfViewDescription), Order = 30, ResourceType = typeof(Texts))]
|
||||
[AnimationSlider("F2", "°", MirageSettings.MinimumFieldOfViewDegrees, MirageSettings.MaximumFieldOfViewDegrees)]
|
||||
public Animation FieldOfView { get; } = new Animation(3, MirageSettings.MinimumFieldOfViewDegrees, MirageSettings.MaximumFieldOfViewDegrees);
|
||||
|
||||
[Display(GroupName = nameof(Texts.CameraGroup), Name = nameof(Texts.HorizonPosition), Description = nameof(Texts.HorizonPositionDescription), Order = 21, ResourceType = typeof(Texts))]
|
||||
[Display(GroupName = nameof(Texts.CameraGroup), Name = nameof(Texts.HorizonPosition), Description = nameof(Texts.HorizonPositionDescription), Order = 31, ResourceType = typeof(Texts))]
|
||||
[AnimationSlider("F1", "px", -MirageSettings.HorizonPositionSliderPixels, MirageSettings.HorizonPositionSliderPixels)]
|
||||
public Animation HorizonPosition { get; } = new Animation(0, -MirageSettings.MaximumHorizonPositionPixels, MirageSettings.MaximumHorizonPositionPixels);
|
||||
|
||||
|
||||
@@ -17,8 +17,10 @@ internal sealed class MirageEffectProcessor(IGraphicsDevicesAndContext devices,
|
||||
private MirageCustomEffect? _effect;
|
||||
private ID2D1Bitmap1? _map;
|
||||
private double[]? _standard;
|
||||
private InferiorReference? _reference;
|
||||
private bool _isFirst = true;
|
||||
private StandardKey _standardKey;
|
||||
private ReferenceKey _referenceKey;
|
||||
private MapKey _mapKey;
|
||||
private ConstantKey _constantKey;
|
||||
private ImmutableList<VideoEffectController> _controllers = [];
|
||||
@@ -60,10 +62,7 @@ internal sealed class MirageEffectProcessor(IGraphicsDevicesAndContext devices,
|
||||
return draw;
|
||||
}
|
||||
|
||||
var eyeHeight = Math.Clamp(_item.EyeHeight.GetValue(frame, length, fps), MirageSettings.MinimumEyeHeightMeters, MirageSettings.MaximumEyeHeightMeters);
|
||||
var mapKey = _item.Kind == MirageKind.Inferior
|
||||
? new MapKey(MirageKind.Inferior, eyeHeight, Math.Clamp(_item.HeatDifference.GetValue(frame, length, fps), MirageSettings.MinimumHeatDifference, MirageSettings.MaximumHeatDifference), Math.Clamp(_item.HeatThickness.GetValue(frame, length, fps), MirageSettings.MinimumHeatThicknessMeters, MirageSettings.MaximumHeatThicknessMeters), 0.0, 0.0, 0.0, 0.0, default)
|
||||
: new MapKey(MirageKind.Superior, eyeHeight, 0.0, 0.0, Math.Clamp(_item.InversionDifference.GetValue(frame, length, fps), MirageSettings.MinimumInversionDifference, MirageSettings.MaximumInversionDifference), Math.Clamp(_item.InversionHeight.GetValue(frame, length, fps), MirageSettings.MinimumInversionHeightMeters, MirageSettings.MaximumInversionHeightMeters), Math.Clamp(_item.InversionThickness.GetValue(frame, length, fps), MirageSettings.MinimumInversionThicknessMeters, MirageSettings.MaximumInversionThicknessMeters), Math.Clamp(_item.Distance.GetValue(frame, length, fps), MirageSettings.MinimumDistanceKilometers, MirageSettings.MaximumDistanceKilometers), _item.Source);
|
||||
var mapKey = GetMapKey(frame, length, fps);
|
||||
if (_isFirst || _mapKey != mapKey)
|
||||
{
|
||||
WriteMap(Build(mapKey));
|
||||
@@ -96,6 +95,26 @@ internal sealed class MirageEffectProcessor(IGraphicsDevicesAndContext devices,
|
||||
return draw;
|
||||
}
|
||||
|
||||
private MapKey GetMapKey(long frame, long length, int fps)
|
||||
{
|
||||
var eyeHeight = Math.Clamp(_item.EyeHeight.GetValue(frame, length, fps), MirageSettings.MinimumEyeHeightMeters, MirageSettings.MaximumEyeHeightMeters);
|
||||
if (_item.Kind == MirageKind.Inferior)
|
||||
{
|
||||
return MapKey.Inferior(
|
||||
eyeHeight,
|
||||
Math.Clamp(_item.HeatDifference.GetValue(frame, length, fps), MirageSettings.MinimumHeatDifference, MirageSettings.MaximumHeatDifference),
|
||||
Math.Clamp(_item.HeatThickness.GetValue(frame, length, fps), MirageSettings.MinimumHeatThicknessMeters, MirageSettings.MaximumHeatThicknessMeters));
|
||||
}
|
||||
|
||||
return MapKey.Superior(
|
||||
eyeHeight,
|
||||
Math.Clamp(_item.InversionDifference.GetValue(frame, length, fps), MirageSettings.MinimumInversionDifference, MirageSettings.MaximumInversionDifference),
|
||||
Math.Clamp(_item.InversionHeight.GetValue(frame, length, fps), MirageSettings.MinimumInversionHeightMeters, MirageSettings.MaximumInversionHeightMeters),
|
||||
Math.Clamp(_item.InversionThickness.GetValue(frame, length, fps), MirageSettings.MinimumInversionThicknessMeters, MirageSettings.MaximumInversionThicknessMeters),
|
||||
Math.Clamp(_item.Distance.GetValue(frame, length, fps), MirageSettings.MinimumDistanceKilometers, MirageSettings.MaximumDistanceKilometers),
|
||||
_item.Source);
|
||||
}
|
||||
|
||||
private (HorizonLine? Line, float PitchCosine, float PitchSine) GetHorizon(float halfTangent, double position)
|
||||
{
|
||||
if (input is null)
|
||||
@@ -138,7 +157,17 @@ internal sealed class MirageEffectProcessor(IGraphicsDevicesAndContext devices,
|
||||
private float[] Build(MapKey key)
|
||||
{
|
||||
if (key.Kind == MirageKind.Inferior)
|
||||
return MirageTable.ToTexels(MirageTable.BuildInferior(key.EyeHeight, key.HeatDifference, key.HeatThickness));
|
||||
{
|
||||
var referenceKey = new ReferenceKey(key.EyeHeight, key.HeatThickness);
|
||||
if (_reference is not { } reference || _referenceKey != referenceKey)
|
||||
{
|
||||
reference = MirageTable.BuildInferiorReference(key.EyeHeight, key.HeatThickness);
|
||||
_reference = reference;
|
||||
_referenceKey = referenceKey;
|
||||
}
|
||||
|
||||
return MirageTable.ToTexels(MirageTable.BuildInferior(key.EyeHeight, key.HeatDifference, key.HeatThickness, reference));
|
||||
}
|
||||
|
||||
var distanceMeters = key.Distance * MirageSettings.MetersPerKilometer;
|
||||
var standardKey = new StandardKey(key.EyeHeight, distanceMeters);
|
||||
@@ -222,7 +251,25 @@ internal sealed class MirageEffectProcessor(IGraphicsDevicesAndContext devices,
|
||||
|
||||
private readonly record struct StandardKey(double EyeHeight, double Distance);
|
||||
|
||||
private readonly record struct MapKey(MirageKind Kind, double EyeHeight, double HeatDifference, double HeatThickness, double InversionDifference, double InversionHeight, double InversionThickness, double Distance, MirageSource Source);
|
||||
private readonly record struct ReferenceKey(double EyeHeight, double Thickness);
|
||||
|
||||
private readonly record struct MapKey(
|
||||
MirageKind Kind,
|
||||
double EyeHeight,
|
||||
double HeatDifference,
|
||||
double HeatThickness,
|
||||
double InversionDifference,
|
||||
double InversionHeight,
|
||||
double InversionThickness,
|
||||
double Distance,
|
||||
MirageSource Source)
|
||||
{
|
||||
public static MapKey Inferior(double eyeHeight, double heatDifference, double heatThickness)
|
||||
=> new(MirageKind.Inferior, eyeHeight, heatDifference, heatThickness, default, default, default, default, default);
|
||||
|
||||
public static MapKey Superior(double eyeHeight, double inversionDifference, double inversionHeight, double inversionThickness, double distance, MirageSource source)
|
||||
=> new(MirageKind.Superior, eyeHeight, default, default, inversionDifference, inversionHeight, inversionThickness, distance, source);
|
||||
}
|
||||
|
||||
private readonly record struct ConstantKey(float Amount, float HalfFieldTangent, float PitchCosine, float PitchSine, float ShimmerAmplitude, float ShimmerPhase0, float ShimmerPhase1, float ShimmerPhase2, float ShimmerPhase3);
|
||||
}
|
||||
+27
-15
@@ -1,13 +1,16 @@
|
||||
using System.Collections.Concurrent;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Mirage;
|
||||
|
||||
internal readonly record struct InferiorReference(double[] Directions, double[] Angles);
|
||||
|
||||
internal static class MirageTable
|
||||
{
|
||||
public static double[] BuildStandard(double eyeHeight, double distanceMeters)
|
||||
{
|
||||
var coordinates = new double[MirageSettings.MapWidth];
|
||||
Parallel.For(0, MirageSettings.MapWidth, index =>
|
||||
ForEachRay(index =>
|
||||
{
|
||||
var result = RayTracer.Trace(Atmosphere.Standard, eyeHeight, MirageSettings.GetMapAngleRadians(index), distanceMeters, double.PositiveInfinity);
|
||||
coordinates[index] = Coordinate(result, distanceMeters);
|
||||
@@ -24,7 +27,7 @@ internal static class MirageTable
|
||||
var shifts = new float[MirageSettings.MapWidth];
|
||||
var unseen = new float[MirageSettings.MapWidth];
|
||||
var (gapLow, gapHigh) = HiddenCoordinates(standard);
|
||||
Parallel.For(0, MirageSettings.MapWidth, index =>
|
||||
ForEachRay(index =>
|
||||
{
|
||||
var angle = MirageSettings.GetMapAngleRadians(index);
|
||||
var result = RayTracer.Trace(atmosphere, eyeHeight, angle, distanceMeters, double.PositiveInfinity);
|
||||
@@ -38,26 +41,22 @@ internal static class MirageTable
|
||||
return shifts;
|
||||
}
|
||||
|
||||
private static void ForEachRay(Action<int> trace)
|
||||
=> Parallel.ForEach(Partitioner.Create(0, MirageSettings.MapWidth, 1), range => trace(range.Item1));
|
||||
|
||||
public static (double Low, double High) HiddenCoordinates(double[] standard)
|
||||
{
|
||||
var first = Array.FindIndex(standard, coordinate => coordinate >= 0.0);
|
||||
return first > 0 ? (standard[first - 1], standard[first]) : (double.NaN, double.NaN);
|
||||
}
|
||||
|
||||
public static float[] BuildInferior(double eyeHeight, double difference, double thickness)
|
||||
public static InferiorReference BuildInferiorReference(double eyeHeight, double thickness)
|
||||
{
|
||||
var heated = new Atmosphere(AtmosphereLayer.Heated, difference, 0.0, thickness);
|
||||
var unheated = new Atmosphere(AtmosphereLayer.Heated, 0.0, 0.0, thickness);
|
||||
var ceiling = MirageSettings.HeatedCeilingFactor * thickness;
|
||||
var width = MirageSettings.MapWidth;
|
||||
var reference = new double[width];
|
||||
var observed = new double[width];
|
||||
Parallel.For(0, width, index =>
|
||||
{
|
||||
var angle = MirageSettings.GetMapAngleRadians(index);
|
||||
reference[index] = Direction(RayTracer.Trace(unheated, eyeHeight, angle, double.PositiveInfinity, ceiling));
|
||||
observed[index] = Direction(RayTracer.Trace(heated, eyeHeight, angle, double.PositiveInfinity, ceiling));
|
||||
});
|
||||
ForEachRay(index => reference[index] = Direction(RayTracer.Trace(unheated, eyeHeight, MirageSettings.GetMapAngleRadians(index), double.PositiveInfinity, ceiling)));
|
||||
|
||||
var directions = new List<double>(width);
|
||||
var angles = new List<double>(width);
|
||||
@@ -70,16 +69,29 @@ internal static class MirageTable
|
||||
angles.Add(MirageSettings.GetMapAngleRadians(index));
|
||||
}
|
||||
|
||||
return new InferiorReference([.. directions], [.. angles]);
|
||||
}
|
||||
|
||||
public static float[] BuildInferior(double eyeHeight, double difference, double thickness)
|
||||
=> BuildInferior(eyeHeight, difference, thickness, BuildInferiorReference(eyeHeight, thickness));
|
||||
|
||||
public static float[] BuildInferior(double eyeHeight, double difference, double thickness, InferiorReference reference)
|
||||
{
|
||||
var heated = new Atmosphere(AtmosphereLayer.Heated, difference, 0.0, thickness);
|
||||
var ceiling = MirageSettings.HeatedCeilingFactor * thickness;
|
||||
var width = MirageSettings.MapWidth;
|
||||
var shifts = new float[width];
|
||||
if (directions.Count < 2)
|
||||
if (reference.Directions.Length < 2)
|
||||
return shifts;
|
||||
|
||||
var observed = new double[width];
|
||||
ForEachRay(index => observed[index] = Direction(RayTracer.Trace(heated, eyeHeight, MirageSettings.GetMapAngleRadians(index), double.PositiveInfinity, ceiling)));
|
||||
for (var index = 0; index < width; index++)
|
||||
{
|
||||
if (double.IsNaN(observed[index]))
|
||||
continue;
|
||||
|
||||
shifts[index] = (float)(Interpolate(directions, angles, observed[index]) - MirageSettings.GetMapAngleRadians(index));
|
||||
shifts[index] = (float)(Interpolate(reference.Directions, reference.Angles, observed[index]) - MirageSettings.GetMapAngleRadians(index));
|
||||
}
|
||||
|
||||
return shifts;
|
||||
@@ -88,9 +100,9 @@ internal static class MirageTable
|
||||
private static double Direction(RayResult result)
|
||||
=> result.End == RayEnd.Exited ? result.Elevation - result.Distance / MirageSettings.EarthRadiusMeters : double.NaN;
|
||||
|
||||
private static double Interpolate(List<double> keys, List<double> values, double key)
|
||||
private static double Interpolate(double[] keys, double[] values, double key)
|
||||
{
|
||||
var last = keys.Count - 1;
|
||||
var last = keys.Length - 1;
|
||||
if (key <= keys[0])
|
||||
return values[0];
|
||||
if (key >= keys[last])
|
||||
|
||||
+14
-9
@@ -29,14 +29,16 @@ internal static class RayTracer
|
||||
|
||||
for (var step = 0; step < MirageSettings.MaximumSteps; step++)
|
||||
{
|
||||
var slope = Math.Max(Math.Abs(Math.Sin(state.Elevation)), MirageSettings.MinimumSlope);
|
||||
var sine = Math.Sin(state.Elevation);
|
||||
var cosine = Math.Cos(state.Elevation);
|
||||
var slope = Math.Max(Math.Abs(sine), MirageSettings.MinimumSlope);
|
||||
var length = Math.Clamp(scale / (MirageSettings.StepsPerLayerThickness * slope), MirageSettings.MinimumStepMeters, MirageSettings.MaximumStepMeters);
|
||||
var remaining = (targetDistance / earth - state.Arc) * state.Radius / Math.Max(Math.Cos(state.Elevation), MirageSettings.MinimumSlope);
|
||||
var remaining = (targetDistance / earth - state.Arc) * state.Radius / Math.Max(cosine, MirageSettings.MinimumSlope);
|
||||
var last = remaining <= length;
|
||||
if (last)
|
||||
length = Math.Max(remaining, 0.0);
|
||||
|
||||
var next = Advance(atmosphere, state, length);
|
||||
var next = Advance(atmosphere, state, length, sine, cosine);
|
||||
var height = next.Radius - earth;
|
||||
if (height <= 0.0)
|
||||
{
|
||||
@@ -57,8 +59,8 @@ internal static class RayTracer
|
||||
{
|
||||
var previous = state.Radius - earth;
|
||||
var fraction = (ceilingHeight - previous) / (height - previous);
|
||||
var cosine = Math.Min(1.0, invariant / (atmosphere.At(ceilingHeight).Index * (earth + ceilingHeight)));
|
||||
return new RayResult(RayEnd.Exited, ceilingHeight, earth * (state.Arc + fraction * (next.Arc - state.Arc)), Math.Acos(cosine));
|
||||
var exitCosine = Math.Min(1.0, invariant / (atmosphere.At(ceilingHeight).Index * (earth + ceilingHeight)));
|
||||
return new RayResult(RayEnd.Exited, ceilingHeight, earth * (state.Arc + fraction * (next.Arc - state.Arc)), Math.Acos(exitCosine));
|
||||
}
|
||||
|
||||
if (last)
|
||||
@@ -74,9 +76,9 @@ internal static class RayTracer
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization)]
|
||||
private static State Advance(Atmosphere atmosphere, State state, double length)
|
||||
private static State Advance(Atmosphere atmosphere, State state, double length, double sine, double cosine)
|
||||
{
|
||||
var (k1e, k1r, k1p) = Derivative(atmosphere, state);
|
||||
var (k1e, k1r, k1p) = Derivative(atmosphere, state, sine, cosine);
|
||||
var (k2e, k2r, k2p) = Derivative(atmosphere, Offset(state, 0.5 * length, k1e, k1r, k1p));
|
||||
var (k3e, k3r, k3p) = Derivative(atmosphere, Offset(state, 0.5 * length, k2e, k2r, k2p));
|
||||
var (k4e, k4r, k4p) = Derivative(atmosphere, Offset(state, length, k3e, k3r, k3p));
|
||||
@@ -91,9 +93,12 @@ internal static class RayTracer
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization)]
|
||||
private static (double Elevation, double Radius, double Arc) Derivative(Atmosphere atmosphere, State state)
|
||||
=> Derivative(atmosphere, state, Math.Sin(state.Elevation), Math.Cos(state.Elevation));
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization)]
|
||||
private static (double Elevation, double Radius, double Arc) Derivative(Atmosphere atmosphere, State state, double sine, double cosine)
|
||||
{
|
||||
var (index, gradient) = atmosphere.At(state.Radius - MirageSettings.EarthRadiusMeters);
|
||||
var cosine = Math.Cos(state.Elevation);
|
||||
return (cosine * (1.0 / state.Radius + gradient / index), Math.Sin(state.Elevation), cosine / state.Radius);
|
||||
return (cosine * (1.0 / state.Radius + gradient / index), sine, cosine / state.Radius);
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ YukkuriMovieMaker4(YMM4)上で動作する、気温の分布から光が曲
|
||||
結果は入力の映像と設定と画素の位置から決定論的に決まります。フレームの位置を使うのは「揺らぎ」だけで、同じ入力と同じ設定と同じフレームでは常に同じ絵になります。
|
||||
強さ、目の高さ、地面の気温差、高温層の厚さ、逆転層の気温差、逆転層の高さ、逆転層の厚さ、距離、揺らぎ、揺らぎの速さ、画角、水平線の位置の12項目はアニメーションに対応しています。
|
||||
|
||||

|
||||

|
||||
|
||||
---
|
||||
|
||||
@@ -93,7 +93,7 @@ $$
|
||||
|
||||
次の画像は、水平線が中心より72px下にある砂漠の写真に、「目の高さ」を1.5m、「画角」を10°にして適用した例で、ほかの項目は既定値です。上が入力、中が「水平線の位置」を72pxにした出力、下が0pxのままにした出力です。72pxにすると蜃気楼が水平線のところに現れます。0pxのままでは、水平線より上の山にかかります。元の写真は3節の画像と同じ、Wikimedia CommonsにCC0で公開されているZ3lvs氏の「[Dirt road across a desert flat toward distant mountains near Newberry Springs, California](https://commons.wikimedia.org/wiki/File:Dirt_road_across_a_desert_flat_toward_distant_mountains_near_Newberry_Springs,_California.jpg)」から切り出したものです。
|
||||
|
||||

|
||||

|
||||
|
||||
YMM4の画面上では、水平線の位置に、処理する範囲の左端から右端まで届く線が表示されます。この線をドラッグすると「水平線の位置」が動きます。「水平線の位置」にアニメーションがあるときは、動かした分がすべての値に加わります。
|
||||
|
||||
@@ -162,7 +162,7 @@ $$
|
||||
|
||||
次の画像は、砂漠の地面と遠くの山が写る写真に、「目の高さ」を1.5m、「画角」を10°にして適用した例です。ほかの項目は既定値です。写真は、地平線が処理する範囲の中央に来るように切り出しています。上が入力、下が出力です。地平線のすぐ下の地面が、山と空を逆さに映した水面のように見えます。元の写真は、Wikimedia CommonsにCC0で公開されているZ3lvs氏の「[Dirt road across a desert flat toward distant mountains near Newberry Springs, California](https://commons.wikimedia.org/wiki/File:Dirt_road_across_a_desert_flat_toward_distant_mountains_near_Newberry_Springs,_California.jpg)」です。
|
||||
|
||||

|
||||

|
||||
|
||||
### 4. 上位蜃気楼
|
||||
|
||||
@@ -192,7 +192,7 @@ $$
|
||||
|
||||
次の画像は、湖の向こうの街並みが写る写真に、「種類」を「上位蜃気楼」、「入力の扱い」を「景色」にして適用した例です。ほかの項目は既定値で、「距離」は40km、「画角」は3°です。写真は、湖岸が処理する範囲の中央より少し下に来るように切り出しています。上が入力、下が出力です。建物の像が縦に伸びて高くなり、その下に逆さの像が重なって見えます。元の写真は、Wikimedia CommonsにCC0で公開されているHide Obara氏の「[Chicago from Michigan Lake (Unsplash)](https://commons.wikimedia.org/wiki/File:Chicago_from_Michigan_Lake_%28Unsplash%29.jpg)」です。
|
||||
|
||||

|
||||

|
||||
|
||||
### 5. 入力の扱い
|
||||
|
||||
@@ -235,7 +235,7 @@ $`a_i`$と$`b_i`$の単位は1/ラジアンです。波の形と大きさは、
|
||||
|
||||
次の画像は、冒頭の砂漠の写真に、「揺らぎ」を70%にして適用した例です。「目の高さ」を1.5m、「画角」を10°にし、ほかの項目は既定値です。最初の2秒を順に再生したあと、逆の順に再生することを繰り返しています。
|
||||
|
||||

|
||||

|
||||
|
||||
「強さ」の割合で、入力の映像の色と、蜃気楼の色を混ぜます。「強さ」が0%のときは、映像をそのまま通します。
|
||||
|
||||
@@ -307,17 +307,20 @@ $`a_i`$と$`b_i`$の単位は1/ラジアンです。波の形と大きさは、
|
||||
|
||||
## 不具合の報告
|
||||
|
||||
本プラグインは、想定していない例外が起きたときに、その内容を開発者へ自動で送信します。同意は求めず、常に送信します。
|
||||
本プラグインは、想定していない例外が起きたときに、その内容を開発者へ自動で送信します。同意は求めません。止める設定もありません。
|
||||
|
||||
送信する数には上限があります。YMM4の1回の起動で送る報告は、YMM4-Telemetryで報告する別のプラグインと合わせて20件までです。例外の型と発生位置が同じ報告は3件までです。上限を超えた報告と、送信先から待つよう求められている間に起きた報告は、送信も退避もしません。
|
||||
|
||||
送信する情報は次のとおりです。
|
||||
|
||||
| 種類 | 内容 |
|
||||
|---|---|
|
||||
| 例外 | 型の完全名、メッセージ、スタックトレース |
|
||||
| 発生位置 | モジュール名、関数名、ファイル名、行番号 |
|
||||
| 発生位置 | モジュール名、関数名、ファイル名、行番号、プラグイン自身のコードかどうか |
|
||||
| プラグイン | アセンブリ名、バージョン |
|
||||
| 実行環境 | OSの名前とバージョン、.NETのバージョン、CPUのアーキテクチャ、論理プロセッサ数 |
|
||||
| 識別子 | YMM4の起動ごとに決まるセッション識別子、報告ごとの識別子 |
|
||||
| 時刻 | 報告を作った時刻(UTC) |
|
||||
|
||||
メッセージとファイル名は、送信の前に置き換えを通します。置き換えるのは、Windowsのユーザー名、ユーザーフォルダー、AppDataのパス、マシン名、ドメイン名、メールアドレス、IPv4アドレスです。送信元のIPアドレスは受信側へ渡す手前で取り除いています。
|
||||
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする