mirror of
https://github.com/0x7c13/Pal3.Unity.git
synced 2026-11-27 01:48:06 +08:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e93e088923 | ||
|
|
9ba462240b | ||
|
|
7e5df726cc | ||
|
|
e870cf487a | ||
|
|
9cda701b13 |
No files matched your search
+7
-2
@@ -2,13 +2,18 @@
|
||||
|
||||
GitHub Actions builds PAL3 and PAL3A with the Unity version in
|
||||
`ProjectSettings/ProjectVersion.txt`. Each variant covers Android, iOS,
|
||||
macOS, Linux, and 32-bit/64-bit Windows. The workflows run on pushes and pull
|
||||
requests, and successful desktop/Android builds upload artifacts.
|
||||
macOS, Linux, and 32-bit/64-bit Windows. The workflows run only on pull requests.
|
||||
New commits cancel superseded runs for the same pull request and workflow.
|
||||
Successful desktop/Android builds upload artifacts.
|
||||
|
||||
Codacy is not part of this repository's CI. Its repository webhook is disabled;
|
||||
there is no Codacy workflow or Codacy-required branch protection check. Re-enabling
|
||||
that external integration would resume its checks independently of these workflows.
|
||||
|
||||
The workflows use checkout v7.0.1, cache v6.1.0, and unity-builder v6.0.0.
|
||||
The builder CLI is pinned to v0.1.73 so its behavior does not change independently
|
||||
of the workflow. Update and validate this pin together with builder upgrades.
|
||||
|
||||
Keep the committed project configured for PAL3. PAL3A workflows switch their own
|
||||
checkout before building. Public builds reject imported private VFX and legacy Toon assets;
|
||||
do not add them or original game data to CI inputs.
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
name: Builds - PAL3 - Mono - Android
|
||||
|
||||
on: [push, pull_request]
|
||||
on: [pull_request]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build_pal3_mono_android:
|
||||
@@ -21,16 +25,16 @@ jobs:
|
||||
large-packages: true
|
||||
docker-images: true
|
||||
swap-storage: true
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.1
|
||||
with:
|
||||
fetch-depth: 0
|
||||
lfs: true
|
||||
- uses: actions/cache@v5.0.5
|
||||
- uses: actions/cache@v6.1.0
|
||||
with:
|
||||
path: Library
|
||||
key: Library-${{ matrix.targetPlatform }}
|
||||
restore-keys: Library-
|
||||
- uses: game-ci/unity-builder@v5
|
||||
- uses: game-ci/unity-builder@v6.0.0
|
||||
env:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
||||
@@ -39,8 +43,9 @@ jobs:
|
||||
targetPlatform: ${{ matrix.targetPlatform }}
|
||||
buildName: PAL3
|
||||
versioning: Semantic
|
||||
cliVersion: v0.1.73
|
||||
- uses: actions/upload-artifact@v7.0.1
|
||||
with:
|
||||
name: PAL3-Mono-${{ matrix.targetPlatform }}
|
||||
path: build/${{ matrix.targetPlatform }}
|
||||
retention-days: 14
|
||||
retention-days: 14
|
||||
@@ -1,6 +1,10 @@
|
||||
name: Builds - PAL3 - Mono - iOS
|
||||
|
||||
on: [push, pull_request]
|
||||
on: [pull_request]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build_pal3_mono_ios:
|
||||
@@ -12,16 +16,16 @@ jobs:
|
||||
targetPlatform:
|
||||
- iOS # Build an iOS player.
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.1
|
||||
with:
|
||||
fetch-depth: 0
|
||||
lfs: true
|
||||
- uses: actions/cache@v5.0.5
|
||||
- uses: actions/cache@v6.1.0
|
||||
with:
|
||||
path: Library
|
||||
key: Library-${{ matrix.targetPlatform }}
|
||||
restore-keys: Library-
|
||||
- uses: game-ci/unity-builder@v5
|
||||
- uses: game-ci/unity-builder@v6.0.0
|
||||
env:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
||||
@@ -30,4 +34,5 @@ jobs:
|
||||
targetPlatform: ${{ matrix.targetPlatform }}
|
||||
buildName: PAL3
|
||||
versioning: Semantic
|
||||
# do not upload artifacts for iOS builds
|
||||
cliVersion: v0.1.73
|
||||
# do not upload artifacts for iOS builds
|
||||
@@ -1,6 +1,10 @@
|
||||
name: Builds - PAL3 - Mono - Linux
|
||||
|
||||
on: [push, pull_request]
|
||||
on: [pull_request]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build_pal3_mono_linux:
|
||||
@@ -12,16 +16,16 @@ jobs:
|
||||
targetPlatform:
|
||||
- StandaloneLinux64 # Build a Linux 64-bit standalone.
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.1
|
||||
with:
|
||||
fetch-depth: 0
|
||||
lfs: true
|
||||
- uses: actions/cache@v5.0.5
|
||||
- uses: actions/cache@v6.1.0
|
||||
with:
|
||||
path: Library
|
||||
key: Library-${{ matrix.targetPlatform }}
|
||||
restore-keys: Library-
|
||||
- uses: game-ci/unity-builder@v5
|
||||
- uses: game-ci/unity-builder@v6.0.0
|
||||
env:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
||||
@@ -30,8 +34,9 @@ jobs:
|
||||
targetPlatform: ${{ matrix.targetPlatform }}
|
||||
buildName: PAL3
|
||||
versioning: Semantic
|
||||
cliVersion: v0.1.73
|
||||
- uses: actions/upload-artifact@v7.0.1
|
||||
with:
|
||||
name: PAL3-Mono-${{ matrix.targetPlatform }}
|
||||
path: build/${{ matrix.targetPlatform }}
|
||||
retention-days: 14
|
||||
retention-days: 14
|
||||
@@ -1,6 +1,10 @@
|
||||
name: Builds - PAL3 - Mono - MacOS
|
||||
|
||||
on: [push, pull_request]
|
||||
on: [pull_request]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build_pal3_mono_macos:
|
||||
@@ -12,16 +16,16 @@ jobs:
|
||||
targetPlatform:
|
||||
- StandaloneOSX # Build a macOS standalone (Intel 64-bit).
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.1
|
||||
with:
|
||||
fetch-depth: 0
|
||||
lfs: true
|
||||
- uses: actions/cache@v5.0.5
|
||||
- uses: actions/cache@v6.1.0
|
||||
with:
|
||||
path: Library
|
||||
key: Library-${{ matrix.targetPlatform }}
|
||||
restore-keys: Library-
|
||||
- uses: game-ci/unity-builder@v5
|
||||
- uses: game-ci/unity-builder@v6.0.0
|
||||
env:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
||||
@@ -30,8 +34,9 @@ jobs:
|
||||
targetPlatform: ${{ matrix.targetPlatform }}
|
||||
buildName: PAL3
|
||||
versioning: Semantic
|
||||
cliVersion: v0.1.73
|
||||
- uses: actions/upload-artifact@v7.0.1
|
||||
with:
|
||||
name: PAL3-Mono-${{ matrix.targetPlatform }}
|
||||
path: build/${{ matrix.targetPlatform }}
|
||||
retention-days: 14
|
||||
retention-days: 14
|
||||
@@ -1,6 +1,10 @@
|
||||
name: Builds - PAL3 - Mono - Windows
|
||||
|
||||
on: [push, pull_request]
|
||||
on: [pull_request]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build_pal3_mono_windows:
|
||||
@@ -13,16 +17,16 @@ jobs:
|
||||
- StandaloneWindows # Build a Windows standalone.
|
||||
- StandaloneWindows64 # Build a Windows 64-bit standalone.
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.1
|
||||
with:
|
||||
fetch-depth: 0
|
||||
lfs: true
|
||||
- uses: actions/cache@v5.0.5
|
||||
- uses: actions/cache@v6.1.0
|
||||
with:
|
||||
path: Library
|
||||
key: Library-${{ matrix.targetPlatform }}
|
||||
restore-keys: Library-
|
||||
- uses: game-ci/unity-builder@v5
|
||||
- uses: game-ci/unity-builder@v6.0.0
|
||||
env:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
||||
@@ -31,8 +35,9 @@ jobs:
|
||||
targetPlatform: ${{ matrix.targetPlatform }}
|
||||
buildName: PAL3
|
||||
versioning: Semantic
|
||||
cliVersion: v0.1.73
|
||||
- uses: actions/upload-artifact@v7.0.1
|
||||
with:
|
||||
name: PAL3-Mono-${{ matrix.targetPlatform }}
|
||||
path: build/${{ matrix.targetPlatform }}
|
||||
retention-days: 14
|
||||
retention-days: 14
|
||||
@@ -1,6 +1,10 @@
|
||||
name: Builds - PAL3A - Mono - Android
|
||||
|
||||
on: [push, pull_request]
|
||||
on: [pull_request]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build_pal3a_mono_android:
|
||||
@@ -21,7 +25,7 @@ jobs:
|
||||
large-packages: true
|
||||
docker-images: true
|
||||
swap-storage: true
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.1
|
||||
with:
|
||||
fetch-depth: 0
|
||||
lfs: true
|
||||
@@ -37,12 +41,12 @@ jobs:
|
||||
find: "6b32649dccc45df4ebe8e3f8eccee249"
|
||||
replace: "d03d417e5660d5849939c8fe43732dbd"
|
||||
include: "**ProjectSettings.asset"
|
||||
- uses: actions/cache@v5.0.5
|
||||
- uses: actions/cache@v6.1.0
|
||||
with:
|
||||
path: Library
|
||||
key: Library-${{ matrix.targetPlatform }}
|
||||
restore-keys: Library-
|
||||
- uses: game-ci/unity-builder@v5
|
||||
- uses: game-ci/unity-builder@v6.0.0
|
||||
env:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
||||
@@ -52,8 +56,9 @@ jobs:
|
||||
targetPlatform: ${{ matrix.targetPlatform }}
|
||||
buildName: PAL3A
|
||||
versioning: Semantic
|
||||
cliVersion: v0.1.73
|
||||
- uses: actions/upload-artifact@v7.0.1
|
||||
with:
|
||||
name: PAL3A-Mono-${{ matrix.targetPlatform }}
|
||||
path: build/${{ matrix.targetPlatform }}
|
||||
retention-days: 14
|
||||
retention-days: 14
|
||||
@@ -1,6 +1,10 @@
|
||||
name: Builds - PAL3A - Mono - iOS
|
||||
|
||||
on: [push, pull_request]
|
||||
on: [pull_request]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build_pal3a_mono_ios:
|
||||
@@ -12,7 +16,7 @@ jobs:
|
||||
targetPlatform:
|
||||
- iOS # Build an iOS player.
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.1
|
||||
with:
|
||||
fetch-depth: 0
|
||||
lfs: true
|
||||
@@ -28,12 +32,12 @@ jobs:
|
||||
find: "6b32649dccc45df4ebe8e3f8eccee249"
|
||||
replace: "d03d417e5660d5849939c8fe43732dbd"
|
||||
include: "**ProjectSettings.asset"
|
||||
- uses: actions/cache@v5.0.5
|
||||
- uses: actions/cache@v6.1.0
|
||||
with:
|
||||
path: Library
|
||||
key: Library-${{ matrix.targetPlatform }}
|
||||
restore-keys: Library-
|
||||
- uses: game-ci/unity-builder@v5
|
||||
- uses: game-ci/unity-builder@v6.0.0
|
||||
env:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
||||
@@ -43,4 +47,5 @@ jobs:
|
||||
targetPlatform: ${{ matrix.targetPlatform }}
|
||||
buildName: PAL3A
|
||||
versioning: Semantic
|
||||
# do not upload artifacts for iOS builds
|
||||
cliVersion: v0.1.73
|
||||
# do not upload artifacts for iOS builds
|
||||
@@ -1,6 +1,10 @@
|
||||
name: Builds - PAL3A - Mono - Linux
|
||||
|
||||
on: [push, pull_request]
|
||||
on: [pull_request]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build_pal3a_mono_linux:
|
||||
@@ -12,7 +16,7 @@ jobs:
|
||||
targetPlatform:
|
||||
- StandaloneLinux64 # Build a Linux 64-bit standalone.
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.1
|
||||
with:
|
||||
fetch-depth: 0
|
||||
lfs: true
|
||||
@@ -28,12 +32,12 @@ jobs:
|
||||
find: "6b32649dccc45df4ebe8e3f8eccee249"
|
||||
replace: "d03d417e5660d5849939c8fe43732dbd"
|
||||
include: "**ProjectSettings.asset"
|
||||
- uses: actions/cache@v5.0.5
|
||||
- uses: actions/cache@v6.1.0
|
||||
with:
|
||||
path: Library
|
||||
key: Library-${{ matrix.targetPlatform }}
|
||||
restore-keys: Library-
|
||||
- uses: game-ci/unity-builder@v5
|
||||
- uses: game-ci/unity-builder@v6.0.0
|
||||
env:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
||||
@@ -43,8 +47,9 @@ jobs:
|
||||
targetPlatform: ${{ matrix.targetPlatform }}
|
||||
buildName: PAL3A
|
||||
versioning: Semantic
|
||||
cliVersion: v0.1.73
|
||||
- uses: actions/upload-artifact@v7.0.1
|
||||
with:
|
||||
name: PAL3A-Mono-${{ matrix.targetPlatform }}
|
||||
path: build/${{ matrix.targetPlatform }}
|
||||
retention-days: 14
|
||||
retention-days: 14
|
||||
@@ -1,6 +1,10 @@
|
||||
name: Builds - PAL3A - Mono - MacOS
|
||||
|
||||
on: [push, pull_request]
|
||||
on: [pull_request]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build_pal3a_mono_macos:
|
||||
@@ -12,7 +16,7 @@ jobs:
|
||||
targetPlatform:
|
||||
- StandaloneOSX # Build a macOS standalone (Intel 64-bit).
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.1
|
||||
with:
|
||||
fetch-depth: 0
|
||||
lfs: true
|
||||
@@ -28,12 +32,12 @@ jobs:
|
||||
find: "6b32649dccc45df4ebe8e3f8eccee249"
|
||||
replace: "d03d417e5660d5849939c8fe43732dbd"
|
||||
include: "**ProjectSettings.asset"
|
||||
- uses: actions/cache@v5.0.5
|
||||
- uses: actions/cache@v6.1.0
|
||||
with:
|
||||
path: Library
|
||||
key: Library-${{ matrix.targetPlatform }}
|
||||
restore-keys: Library-
|
||||
- uses: game-ci/unity-builder@v5
|
||||
- uses: game-ci/unity-builder@v6.0.0
|
||||
env:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
||||
@@ -43,8 +47,9 @@ jobs:
|
||||
targetPlatform: ${{ matrix.targetPlatform }}
|
||||
buildName: PAL3A
|
||||
versioning: Semantic
|
||||
cliVersion: v0.1.73
|
||||
- uses: actions/upload-artifact@v7.0.1
|
||||
with:
|
||||
name: PAL3A-Mono-${{ matrix.targetPlatform }}
|
||||
path: build/${{ matrix.targetPlatform }}
|
||||
retention-days: 14
|
||||
retention-days: 14
|
||||
@@ -1,6 +1,10 @@
|
||||
name: Builds - PAL3A - Mono - Windows
|
||||
|
||||
on: [push, pull_request]
|
||||
on: [pull_request]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build_pal3a_mono_windows:
|
||||
@@ -13,7 +17,7 @@ jobs:
|
||||
- StandaloneWindows # Build a Windows standalone.
|
||||
- StandaloneWindows64 # Build a Windows 64-bit standalone.
|
||||
steps:
|
||||
- uses: actions/checkout@v6.0.3
|
||||
- uses: actions/checkout@v7.0.1
|
||||
with:
|
||||
fetch-depth: 0
|
||||
lfs: true
|
||||
@@ -29,12 +33,12 @@ jobs:
|
||||
find: "6b32649dccc45df4ebe8e3f8eccee249"
|
||||
replace: "d03d417e5660d5849939c8fe43732dbd"
|
||||
include: "**ProjectSettings.asset"
|
||||
- uses: actions/cache@v5.0.5
|
||||
- uses: actions/cache@v6.1.0
|
||||
with:
|
||||
path: Library
|
||||
key: Library-${{ matrix.targetPlatform }}
|
||||
restore-keys: Library-
|
||||
- uses: game-ci/unity-builder@v5
|
||||
- uses: game-ci/unity-builder@v6.0.0
|
||||
env:
|
||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
||||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
||||
@@ -44,8 +48,9 @@ jobs:
|
||||
targetPlatform: ${{ matrix.targetPlatform }}
|
||||
buildName: PAL3A
|
||||
versioning: Semantic
|
||||
cliVersion: v0.1.73
|
||||
- uses: actions/upload-artifact@v7.0.1
|
||||
with:
|
||||
name: PAL3A-Mono-${{ matrix.targetPlatform }}
|
||||
path: build/${{ matrix.targetPlatform }}
|
||||
retention-days: 14
|
||||
retention-days: 14
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
reference: https://www.shadertoy.com/view/MsKXDh
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
// Based on cician's shader from https://forum.unity3d.com/threads/simple-optimized-blur-shader.185327/#post-1267642
|
||||
// Based on RoundedCorners.shader from https://github.com/kirevdokimov/Unity-UI-Rounded-Corners
|
||||
// with some modifications
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
// Based on https://www.shadertoy.com/view/4dl3R4
|
||||
|
||||
Shader "Pal3/Snow"
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// See LICENSE in the project root.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
#include "Pal3ToonInput.hlsl"
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// See LICENSE in the project root.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
#include "Pal3ToonInput.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// See LICENSE in the project root.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
#ifndef PAL3_TOON_INPUT_INCLUDED
|
||||
#define PAL3_TOON_INPUT_INCLUDED
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// See LICENSE in the project root.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
#include "Pal3ToonInput.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// See LICENSE in the project root.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
Shader "Pal3/ToonCutout"
|
||||
{
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// See LICENSE in the project root.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
Shader "Pal3/ToonOpaque"
|
||||
{
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// See LICENSE in the project root.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
Shader "Pal3/ToonTransparent"
|
||||
{
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// See LICENSE in the project root.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
Shader "Pal3/ToonWater"
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
Shader "Pal3/Dev"
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
Shader "Pal3/Opaque"
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
Shader "Pal3/Sprite"
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
Shader "Pal3/Transparent"
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
Shader "Pal3/TransparentOpaquePart"
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
Shader "Pal3/Water"
|
||||
{
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
Shader "Pal3/SkyboxEffect"
|
||||
{
|
||||
Properties { _MainTex ("Sequence frame", 2D) = "black" {} }
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderPipeline"="UniversalPipeline" "Queue"="Transparent-10" "RenderType"="Transparent" }
|
||||
Pass
|
||||
{
|
||||
Blend SrcAlpha One
|
||||
ZWrite Off
|
||||
Cull Off
|
||||
HLSLPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
TEXTURE2D(_MainTex); SAMPLER(sampler_MainTex);
|
||||
struct Attributes { float4 positionOS : POSITION; float2 uv : TEXCOORD0; };
|
||||
struct Varyings { float4 positionCS : SV_POSITION; float2 uv : TEXCOORD0; };
|
||||
Varyings vert(Attributes input)
|
||||
{
|
||||
Varyings output;
|
||||
output.positionCS = TransformObjectToHClip(input.positionOS.xyz);
|
||||
// Sky effects must remain behind all scene geometry, including
|
||||
// mountains farther away than the effect cube's actual mesh.
|
||||
#if UNITY_REVERSED_Z
|
||||
output.positionCS.z = 0.0;
|
||||
#else
|
||||
output.positionCS.z = output.positionCS.w;
|
||||
#endif
|
||||
output.uv = input.uv;
|
||||
return output;
|
||||
}
|
||||
half4 frag(Varyings input) : SV_Target { return SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.uv); }
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0d3ce4f585ff416caf911181f6f5dd56
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
#if UNITY_EDITOR_OSX && UNITY_IOS
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
#if UNITY_EDITOR_OSX && UNITY_STANDALONE_OSX
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Editor
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Editor
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Editor
|
||||
{
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// See LICENSE in the project root.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Editor
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Editor.SourceGenerator.Base
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Editor.SourceGenerator.Base
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Editor.SourceGenerator.Base
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Editor.SourceGenerator
|
||||
{
|
||||
@@ -24,11 +24,11 @@ namespace Editor.SourceGenerator
|
||||
public void GenerateSourceClass(CodeWriter writer, string className, string nameSpace)
|
||||
{
|
||||
// Header.
|
||||
writer.WriteLine("// ---------------------------------------------------------------------------------------------");
|
||||
writer.WriteLine("// ------------------------------------------------------------------------");
|
||||
writer.WriteLine("// <auto-generated>");
|
||||
writer.WriteLine($"// This code was auto-generated by {GetType().Name}");
|
||||
writer.WriteLine("// </auto-generated>");
|
||||
writer.WriteLine("// ---------------------------------------------------------------------------------------------");
|
||||
writer.WriteLine("// ------------------------------------------------------------------------");
|
||||
writer.WriteLine();
|
||||
|
||||
// Begin namespace.
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Editor
|
||||
{
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Pal3.Core.Command;
|
||||
using SourceGenerator;
|
||||
using SourceGenerator.Base;
|
||||
@@ -39,6 +41,18 @@ namespace Editor
|
||||
GenerateSourceInternal(OutputFileName, writePath, ClassName, NameSpace, sourceGenerator, true);
|
||||
}
|
||||
|
||||
private static string CopyrightHeader(string writePath)
|
||||
{
|
||||
int currentYear = DateTime.Now.Year;
|
||||
Match previous = Regex.Match(File.Exists(writePath) ? File.ReadAllText(writePath) : string.Empty,
|
||||
@"Copyright \(c\) (?<first>\d{4})");
|
||||
int firstYear = previous.Success ? int.Parse(previous.Groups["first"].Value) : currentYear;
|
||||
string years = firstYear == currentYear ? $"{currentYear}" : $"{firstYear}-{currentYear}";
|
||||
const string separator = "// ------------------------------------------------------------------------";
|
||||
return $"{separator}\n// Copyright (c) {years}, Jiaqi (0x7c13) Liu. All rights reserved.\n" +
|
||||
$"// See LICENSE file in the project root for license information.\n{separator}\n\n";
|
||||
}
|
||||
|
||||
private static void GenerateSourceInternal(string fileName,
|
||||
string writePath,
|
||||
string className,
|
||||
@@ -63,7 +77,7 @@ namespace Editor
|
||||
sourceGenerator.GenerateSourceClass(writer, className, nameSpace);
|
||||
|
||||
// Final output string
|
||||
string output = $"#if {GAME_VARIANT_SYMBOL}\n\n{writer.Buffer}\n#endif";
|
||||
string output = CopyrightHeader(writePath) + $"#if {GAME_VARIANT_SYMBOL}\n\n{writer.Buffer}\n#endif";
|
||||
|
||||
// Write to file
|
||||
using StreamWriter sw = new(writePath);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Editor
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Animation
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Core.Abstraction
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Core.Abstraction
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Core.Abstraction
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Core.Abstraction
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Core.Abstraction
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Core.Abstraction
|
||||
{
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Core.Abstraction
|
||||
{
|
||||
using System;
|
||||
|
||||
public enum TextureDataFormat
|
||||
{
|
||||
Rgba32,
|
||||
Bc1,
|
||||
Bc2,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Texture pixels and mip layout, independent of a file container or graphics API.
|
||||
/// The caller owns this source and disposes it after synchronous texture creation.
|
||||
/// Upload buffers must remain unchanged until then and may be pooled.
|
||||
/// </summary>
|
||||
public interface ITextureDataSource : IDisposable
|
||||
{
|
||||
int Width { get; }
|
||||
int Height { get; }
|
||||
int MipCount { get; }
|
||||
TextureDataFormat Format { get; }
|
||||
/// <summary>Conservative indication that alpha coverage must be preserved.</summary>
|
||||
bool HasTransparency { get; }
|
||||
|
||||
/// <summary>Borrow one tightly packed mip in Format encoding; do not modify its data.</summary>
|
||||
ArraySegment<byte> GetMipData(int mip);
|
||||
|
||||
/// <summary>Copy or decode one mip to RGBA32 in a caller-owned buffer.</summary>
|
||||
void CopyMipToRgba32(int mip, byte[] destination);
|
||||
|
||||
/// <summary>
|
||||
/// Create a reader whose backing data remains valid after this source is disposed.
|
||||
/// The texture retains the reader until Destroy; owned immutable data may be shared.
|
||||
/// </summary>
|
||||
ITexturePixelReader CreatePixelReader();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 336875a34c8a40fdb3e81bea05b5db7f
|
||||
@@ -1,29 +1,31 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Core.Abstraction
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface for a texture factory that creates textures.
|
||||
/// </summary>
|
||||
/// <summary>Creates graphics textures from CPU-side pixel data.</summary>
|
||||
public interface ITextureFactory
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new texture with the specified width, height, and RGBA data.
|
||||
/// </summary>
|
||||
/// <param name="width">The width of the texture.</param>
|
||||
/// <param name="height">The height of the texture.</param>
|
||||
/// <param name="rgba32DataBuffer">The RGBA32 data of the texture to be read from.
|
||||
/// Size should be greater than or equal to width * height * 4.</param>
|
||||
/// <returns>The created texture.</returns>
|
||||
public ITexture2D CreateTexture(int width, int height, byte[] rgba32DataBuffer);
|
||||
/// <summary>Create a readable, base-only RGBA32 texture from a borrowed buffer.</summary>
|
||||
/// <param name="width">Positive texture width in pixels.</param>
|
||||
/// <param name="height">Positive texture height in pixels.</param>
|
||||
/// <param name="rgba32DataBuffer">At least width * height * 4 bytes in RGBA order.
|
||||
/// The caller may reuse the buffer after this call returns.</param>
|
||||
/// <returns>The created texture, owned by the caller.</returns>
|
||||
ITexture2D CreateTexture(int width, int height, byte[] rgba32DataBuffer);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new white texture.
|
||||
/// Synchronously upload a format-neutral data source using resolved creation options.
|
||||
/// The caller still owns the source and may dispose it after this call returns.
|
||||
/// </summary>
|
||||
/// <returns>The created texture.</returns>
|
||||
public ITexture2D CreateWhiteTexture();
|
||||
/// <param name="source">Borrowed pixel data and mip layout; remains caller-owned.</param>
|
||||
/// <param name="options">Resolved mip, compression and CPU-readability requirements.</param>
|
||||
/// <returns>The created texture, which retains any required independent pixel reader.</returns>
|
||||
ITexture2D CreateTexture(ITextureDataSource source, TextureCreateOptions options);
|
||||
|
||||
/// <summary>Create a new white texture.</summary>
|
||||
ITexture2D CreateWhiteTexture();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,31 +1,19 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Core.Abstraction
|
||||
{
|
||||
/// <summary>
|
||||
/// Texture loader and ITexture2D creator interface.
|
||||
/// The reason we have a separate Load method interface is because
|
||||
/// uploading texture to GPU is single threaded (upload texture to VRAM),
|
||||
/// while the loading and decoding part can run in parallel and it should
|
||||
/// be thread-safe in general. This two-step approach gives caller
|
||||
/// more flexibility.
|
||||
/// </summary>
|
||||
/// <summary>Decode a file into CPU-side data without creating graphics objects.</summary>
|
||||
public interface ITextureLoader
|
||||
{
|
||||
/// <summary>
|
||||
/// Load and decode texture data.
|
||||
/// Load texture data. The caller disposes the returned source after uploading it.
|
||||
/// This operation may run off the graphics thread; loaders hold no per-image state.
|
||||
/// </summary>
|
||||
/// <param name="data">Raw texture data in byte array</param>
|
||||
/// <param name="hasAlphaChannel">True if texture has alpha channel</param>
|
||||
public void Load(byte[] data, out bool hasAlphaChannel);
|
||||
|
||||
/// <summary>
|
||||
/// Convert loaded data into ITexture2D instance.
|
||||
/// </summary>
|
||||
/// <returns>ITexture2D instance</returns>
|
||||
public ITexture2D ToTexture();
|
||||
/// <param name="data">Owned file bytes, which must not be modified after loading.</param>
|
||||
/// <param name="hasAlphaChannel">Legacy material classification, independent of sampling policy.</param>
|
||||
ITextureDataSource Load(byte[] data, out bool hasAlphaChannel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Core.Abstraction
|
||||
{
|
||||
/// <summary>Owned, immutable CPU pixel data, independent of upload-buffer lifetime.</summary>
|
||||
public interface ITexturePixelReader
|
||||
{
|
||||
/// <summary>Read an in-bounds base-level pixel in RGBA byte order.</summary>
|
||||
(byte r, byte g, byte b, byte a) GetPixel(int x, int y);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c24ebc56cb2a45bca760e20bded1ab02
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Core.Abstraction
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Core.Abstraction
|
||||
{
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Core.Abstraction
|
||||
{
|
||||
public enum TextureMipMode
|
||||
{
|
||||
BaseOnly,
|
||||
Preserve,
|
||||
GenerateIfMissing,
|
||||
}
|
||||
|
||||
/// <summary>Resolved creation requirements; contains no game-specific sampling policy.</summary>
|
||||
public readonly struct TextureCreateOptions
|
||||
{
|
||||
public TextureMipMode Mipmaps { get; }
|
||||
public bool PreferNativeCompression { get; }
|
||||
public bool KeepCpuReadable { get; }
|
||||
|
||||
public TextureCreateOptions(TextureMipMode mipmaps, bool preferNativeCompression, bool keepCpuReadable)
|
||||
{
|
||||
Mipmaps = mipmaps;
|
||||
PreferNativeCompression = preferNativeCompression;
|
||||
KeepCpuReadable = keepCpuReadable;
|
||||
}
|
||||
|
||||
public static TextureCreateOptions Readable => new(TextureMipMode.BaseOnly,
|
||||
preferNativeCompression: false, keepCpuReadable: true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e86d1e0ca8f948be888eb88254554127
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Core.Implementation
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Core.Implementation
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Core.Implementation
|
||||
{
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Core.Implementation
|
||||
{
|
||||
using System;
|
||||
using System.Buffers;
|
||||
using Abstraction;
|
||||
|
||||
/// <summary>A base-level RGBA32 upload buffer, optionally owned by the shared array pool.</summary>
|
||||
public sealed class Rgba32TextureDataSource : ITextureDataSource
|
||||
{
|
||||
public int Width { get; }
|
||||
public int Height { get; }
|
||||
public int MipCount => 1;
|
||||
public TextureDataFormat Format => TextureDataFormat.Rgba32;
|
||||
public bool HasTransparency { get; }
|
||||
|
||||
private byte[] _data;
|
||||
private readonly int _length;
|
||||
private readonly bool _returnToPool;
|
||||
|
||||
/// <summary>Borrow a buffer; the caller must keep it unchanged until upload completes.</summary>
|
||||
public Rgba32TextureDataSource(int width, int height, byte[] data, bool hasTransparency = true)
|
||||
: this(width, height, data, hasTransparency, returnToPool: false) { }
|
||||
|
||||
private Rgba32TextureDataSource(int width, int height, byte[] data,
|
||||
bool hasTransparency, bool returnToPool)
|
||||
{
|
||||
if (width <= 0 || height <= 0) throw new ArgumentOutOfRangeException(nameof(width));
|
||||
_length = checked(width * height * 4);
|
||||
if (data == null || data.Length < _length) throw new ArgumentException("Incomplete RGBA32 data", nameof(data));
|
||||
Width = width;
|
||||
Height = height;
|
||||
HasTransparency = hasTransparency;
|
||||
_data = data;
|
||||
_returnToPool = returnToPool;
|
||||
}
|
||||
|
||||
/// <summary>Transfer a rented buffer to this source, which returns it on Dispose.</summary>
|
||||
internal static Rgba32TextureDataSource TakePooledBuffer(int width, int height, byte[] data,
|
||||
bool hasTransparency) => new(width, height, data, hasTransparency, returnToPool: true);
|
||||
|
||||
public ArraySegment<byte> GetMipData(int mip)
|
||||
{
|
||||
if (mip != 0) throw new ArgumentOutOfRangeException(nameof(mip));
|
||||
if (_data == null) throw new ObjectDisposedException(nameof(Rgba32TextureDataSource));
|
||||
return new ArraySegment<byte>(_data, 0, _length);
|
||||
}
|
||||
|
||||
public void CopyMipToRgba32(int mip, byte[] destination)
|
||||
{
|
||||
var data = GetMipData(mip);
|
||||
Buffer.BlockCopy(data.Array, data.Offset, destination, 0, data.Count);
|
||||
}
|
||||
|
||||
public ITexturePixelReader CreatePixelReader()
|
||||
{
|
||||
var data = GetMipData(0);
|
||||
var ownedPixels = new byte[data.Count];
|
||||
Buffer.BlockCopy(data.Array, data.Offset, ownedPixels, 0, data.Count);
|
||||
return new PixelReader(Width, Height, ownedPixels);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_data == null) return;
|
||||
if (_returnToPool) ArrayPool<byte>.Shared.Return(_data);
|
||||
_data = null;
|
||||
}
|
||||
|
||||
private sealed class PixelReader : ITexturePixelReader
|
||||
{
|
||||
private readonly int _width;
|
||||
private readonly int _height;
|
||||
private readonly byte[] _pixels;
|
||||
|
||||
public PixelReader(int width, int height, byte[] pixels)
|
||||
{
|
||||
_width = width;
|
||||
_height = height;
|
||||
_pixels = pixels;
|
||||
}
|
||||
|
||||
public (byte r, byte g, byte b, byte a) GetPixel(int x, int y)
|
||||
{
|
||||
if ((uint)x >= (uint)_width || (uint)y >= (uint)_height)
|
||||
throw new ArgumentOutOfRangeException(nameof(x));
|
||||
int offset = (y * _width + x) * 4;
|
||||
return (_pixels[offset], _pixels[offset + 1], _pixels[offset + 2], _pixels[offset + 3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fc5fd6d3991f4cc29604a6fc6303fe36
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Core.Implementation
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Core.Implementation
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Core.Implementation
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Core.Implementation
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Core.Implementation
|
||||
{
|
||||
@@ -16,10 +16,12 @@ namespace Engine.Core.Implementation
|
||||
public bool IsNativeObjectDisposed => _texture2D == null;
|
||||
|
||||
private Texture2D _texture2D;
|
||||
private ITexturePixelReader _pixelReader;
|
||||
|
||||
public UnityTexture2D(Texture2D texture2D)
|
||||
public UnityTexture2D(Texture2D texture2D, ITexturePixelReader pixelReader = null)
|
||||
{
|
||||
_texture2D = texture2D;
|
||||
_pixelReader = pixelReader;
|
||||
}
|
||||
|
||||
public int Width => _texture2D.width;
|
||||
@@ -38,6 +40,15 @@ namespace Engine.Core.Implementation
|
||||
|
||||
public (float r, float g, float b, float a) GetPixel(int x, int y)
|
||||
{
|
||||
if (_pixelReader != null)
|
||||
{
|
||||
x = _texture2D.wrapMode == TextureWrapMode.Clamp
|
||||
? Mathf.Clamp(x, 0, Width - 1) : (x % Width + Width) % Width;
|
||||
y = _texture2D.wrapMode == TextureWrapMode.Clamp
|
||||
? Mathf.Clamp(y, 0, Height - 1) : (y % Height + Height) % Height;
|
||||
var rgba = _pixelReader.GetPixel(x, y);
|
||||
return (rgba.r / 255f, rgba.g / 255f, rgba.b / 255f, rgba.a / 255f);
|
||||
}
|
||||
Color pixel = _texture2D.GetPixel(x, y);
|
||||
return (pixel.r, pixel.g, pixel.b, pixel.a);
|
||||
}
|
||||
@@ -64,6 +75,7 @@ namespace Engine.Core.Implementation
|
||||
}
|
||||
|
||||
_texture2D = null;
|
||||
_pixelReader = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +1,94 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Core.Implementation
|
||||
{
|
||||
using System;
|
||||
using System.Buffers;
|
||||
using Abstraction;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Experimental.Rendering;
|
||||
|
||||
public sealed class UnityTextureFactory : ITextureFactory
|
||||
{
|
||||
public ITexture2D CreateTexture(int width, int height, byte[] rgba32DataBuffer)
|
||||
{
|
||||
if (rgba32DataBuffer.Length < width * height * 4)
|
||||
{
|
||||
throw new ArgumentException("rgba32DataBuffer.Length < width * height * 4");
|
||||
}
|
||||
using var source = new Rgba32TextureDataSource(width, height, rgba32DataBuffer);
|
||||
return CreateTexture(source, TextureCreateOptions.Readable);
|
||||
}
|
||||
|
||||
Texture2D texture = new Texture2D(width, height, TextureFormat.RGBA32, mipChain: false);
|
||||
texture.LoadRawTextureData(rgba32DataBuffer);
|
||||
texture.Apply(updateMipmaps: false);
|
||||
return new UnityTexture2D(texture);
|
||||
public ITexture2D CreateTexture(ITextureDataSource source, TextureCreateOptions options)
|
||||
{
|
||||
if (source == null) throw new ArgumentNullException(nameof(source));
|
||||
int mipCount = options.Mipmaps switch
|
||||
{
|
||||
TextureMipMode.BaseOnly => 1,
|
||||
TextureMipMode.Preserve or TextureMipMode.GenerateIfMissing => source.MipCount,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(options)),
|
||||
};
|
||||
bool generateMips = options.Mipmaps == TextureMipMode.GenerateIfMissing && mipCount == 1;
|
||||
GraphicsFormat format = source.Format switch
|
||||
{
|
||||
TextureDataFormat.Rgba32 => GraphicsFormat.R8G8B8A8_SRGB,
|
||||
TextureDataFormat.Bc1 => GraphicsFormat.RGBA_DXT1_SRGB,
|
||||
TextureDataFormat.Bc2 => GraphicsFormat.RGBA_DXT3_SRGB,
|
||||
_ => throw new NotSupportedException($"Unsupported texture data format: {source.Format}"),
|
||||
};
|
||||
Texture2D texture = null;
|
||||
try
|
||||
{
|
||||
// Native blocks cannot synthesize missing mips or serve readable sprite pixels.
|
||||
bool uploadCompressed = source.Format != TextureDataFormat.Rgba32 &&
|
||||
options.PreferNativeCompression && !options.KeepCpuReadable && !generateMips &&
|
||||
source.Width % 4 == 0 && source.Height % 4 == 0 &&
|
||||
SystemInfo.IsFormatSupported(format, GraphicsFormatUsage.Sample);
|
||||
if (uploadCompressed)
|
||||
{
|
||||
texture = new Texture2D(source.Width, source.Height, format, mipCount, TextureCreationFlags.None);
|
||||
for (int mip = 0; mip < mipCount; mip++)
|
||||
{
|
||||
var data = source.GetMipData(mip);
|
||||
texture.SetPixelData(data.Array, mip, data.Offset);
|
||||
}
|
||||
texture.Apply(updateMipmaps: false, makeNoLongerReadable: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
texture = new Texture2D(source.Width, source.Height, TextureFormat.RGBA32,
|
||||
generateMips ? -1 : mipCount, linear: false);
|
||||
byte[] rgba = source.Format == TextureDataFormat.Rgba32 ? null :
|
||||
ArrayPool<byte>.Shared.Rent(checked(source.Width * source.Height * 4));
|
||||
try
|
||||
{
|
||||
for (int mip = 0; mip < mipCount; mip++)
|
||||
{
|
||||
if (rgba == null)
|
||||
{
|
||||
var data = source.GetMipData(mip);
|
||||
texture.SetPixelData(data.Array, mip, data.Offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
source.CopyMipToRgba32(mip, rgba);
|
||||
texture.SetPixelData(rgba, mip);
|
||||
}
|
||||
}
|
||||
texture.Apply(updateMipmaps: generateMips, makeNoLongerReadable: !options.KeepCpuReadable);
|
||||
}
|
||||
finally { if (rgba != null) ArrayPool<byte>.Shared.Return(rgba); }
|
||||
}
|
||||
if (texture.mipmapCount > 1) texture.filterMode = FilterMode.Trilinear;
|
||||
return new UnityTexture2D(texture, options.KeepCpuReadable ? null : source.CreatePixelReader());
|
||||
}
|
||||
catch
|
||||
{
|
||||
if (texture != null) UnityEngine.Object.Destroy(texture);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public ITexture2D CreateWhiteTexture() => new UnityTexture2D(Texture2D.whiteTexture);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Core.Implementation
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Coroutine
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.DataLoader
|
||||
{
|
||||
|
||||
@@ -1,84 +1,50 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.DataLoader
|
||||
{
|
||||
using System;
|
||||
using System.Buffers;
|
||||
using Core.Abstraction;
|
||||
using Core.Implementation;
|
||||
using Pal3.Core.DataReader.Bmp;
|
||||
|
||||
/// <summary>
|
||||
/// .bmp file loader and Texture2D converter.
|
||||
/// </summary>
|
||||
public sealed class BmpTextureLoader : ITextureLoader
|
||||
{
|
||||
private readonly ITextureFactory _textureFactory;
|
||||
private BmpFile _image;
|
||||
|
||||
public BmpTextureLoader(ITextureFactory textureFactory)
|
||||
public ITextureDataSource Load(byte[] data, out bool hasAlphaChannel)
|
||||
{
|
||||
_textureFactory = textureFactory;
|
||||
}
|
||||
|
||||
public void Load(byte[] data, out bool hasAlphaChannel)
|
||||
{
|
||||
if (_image != null) throw new Exception("BMP texture already loaded");
|
||||
|
||||
hasAlphaChannel = false;
|
||||
_image = new BmpFileReader().Read(data);
|
||||
}
|
||||
BmpFile image = new BmpFileReader().Read(data);
|
||||
int width = image.Info.AbsWidth;
|
||||
int height = image.Info.AbsHeight;
|
||||
|
||||
// Flip image if height is negative
|
||||
private void FlipImage()
|
||||
{
|
||||
if (_image.Info.Height > 0) return;
|
||||
|
||||
int width = _image.Info.AbsWidth;
|
||||
int height = _image.Info.AbsHeight;
|
||||
|
||||
for (int y = 0; y < height / 2; y++)
|
||||
if (image.Info.Height < 0)
|
||||
{
|
||||
for(int x = 0, o1 = y * width, o2 = (height - y - 1) * width; x < width; x++, o1++, o2++)
|
||||
for (int y = 0; y < height / 2; y++)
|
||||
{
|
||||
(_image.ImageData[o1], _image.ImageData[o2]) = (_image.ImageData[o2], _image.ImageData[o1]);
|
||||
for (int x = 0, o1 = y * width, o2 = (height - y - 1) * width; x < width; x++, o1++, o2++)
|
||||
(image.ImageData[o1], image.ImageData[o2]) = (image.ImageData[o2], image.ImageData[o1]);
|
||||
}
|
||||
}
|
||||
|
||||
_image.Info.Height = height;
|
||||
}
|
||||
|
||||
public ITexture2D ToTexture()
|
||||
{
|
||||
if (_image == null) return null;
|
||||
|
||||
if (_image.Info.Height < 0)
|
||||
{
|
||||
FlipImage();
|
||||
}
|
||||
|
||||
byte[] rawRgbaDataBuffer = ArrayPool<byte>.Shared.Rent(_image.ImageData.Length * 4);
|
||||
|
||||
byte[] rgba = ArrayPool<byte>.Shared.Rent(checked(image.ImageData.Length * 4));
|
||||
try
|
||||
{
|
||||
for (int i = 0; i < _image.ImageData.Length; i++)
|
||||
for (int i = 0; i < image.ImageData.Length; i++)
|
||||
{
|
||||
rawRgbaDataBuffer[i * 4 + 0] = _image.ImageData[i].B;
|
||||
rawRgbaDataBuffer[i * 4 + 1] = _image.ImageData[i].G;
|
||||
rawRgbaDataBuffer[i * 4 + 2] = _image.ImageData[i].R;
|
||||
rawRgbaDataBuffer[i * 4 + 3] = _image.ImageData[i].A;
|
||||
rgba[i * 4 + 0] = image.ImageData[i].B;
|
||||
rgba[i * 4 + 1] = image.ImageData[i].G;
|
||||
rgba[i * 4 + 2] = image.ImageData[i].R;
|
||||
rgba[i * 4 + 3] = image.ImageData[i].A;
|
||||
}
|
||||
|
||||
// Use the buffer instead of a new array
|
||||
return _textureFactory.CreateTexture(_image.Info.AbsWidth, _image.Info.AbsHeight, rawRgbaDataBuffer);
|
||||
return Rgba32TextureDataSource.TakePooledBuffer(width, height, rgba, hasTransparency: false);
|
||||
}
|
||||
finally
|
||||
catch
|
||||
{
|
||||
ArrayPool<byte>.Shared.Return(rawRgbaDataBuffer);
|
||||
_image = null;
|
||||
ArrayPool<byte>.Shared.Return(rgba);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.DataLoader
|
||||
{
|
||||
using System;
|
||||
using Core.Abstraction;
|
||||
using Pal3.Core.DataReader.Dxt;
|
||||
|
||||
/// <summary>Adapts validated DDS data to format-neutral texture blocks and pixel reads.</summary>
|
||||
internal sealed class DxtTextureDataSource : ITextureDataSource, ITexturePixelReader
|
||||
{
|
||||
private readonly DxtImage _image;
|
||||
|
||||
public DxtTextureDataSource(DxtImage image) => _image = image;
|
||||
|
||||
public int Width => _image.Width;
|
||||
public int Height => _image.Height;
|
||||
public int MipCount => _image.MipCount;
|
||||
public TextureDataFormat Format => _image.HasAlphaChannel ? TextureDataFormat.Bc2 : TextureDataFormat.Bc1;
|
||||
public bool HasTransparency => _image.HasTransparency;
|
||||
|
||||
public ArraySegment<byte> GetMipData(int mip)
|
||||
{
|
||||
int offset = _image.GetOffset(mip);
|
||||
int length = ((_image.GetWidth(mip) + 3) / 4) * ((_image.GetHeight(mip) + 3) / 4) *
|
||||
(Format == TextureDataFormat.Bc2 ? 16 : 8);
|
||||
return new ArraySegment<byte>(_image.Data, offset, length);
|
||||
}
|
||||
|
||||
public void CopyMipToRgba32(int mip, byte[] destination) => _image.Decode(mip, destination);
|
||||
|
||||
// DDS bytes are owned managed data, never a pooled upload buffer. Sharing this reader
|
||||
// keeps compressed blocks alive without allocating an uncompressed CPU copy.
|
||||
public ITexturePixelReader CreatePixelReader() => this;
|
||||
|
||||
public (byte r, byte g, byte b, byte a) GetPixel(int x, int y) => _image.GetPixel(x, y);
|
||||
|
||||
public void Dispose() { }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 297f6c8fd4754f03b14fd961080d843a
|
||||
@@ -1,81 +1,20 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.DataLoader
|
||||
{
|
||||
using System;
|
||||
using System.Buffers;
|
||||
using System.IO;
|
||||
using Core.Abstraction;
|
||||
using Pal3.Core.DataReader.Dxt;
|
||||
using Core.Abstraction;
|
||||
using Pal3.Core.DataReader.Dxt;
|
||||
|
||||
/// <summary>
|
||||
/// .dds file loader and Texture2D converter.
|
||||
/// </summary>
|
||||
public sealed class DxtTextureLoader : ITextureLoader
|
||||
{
|
||||
private readonly ITextureFactory _textureFactory;
|
||||
|
||||
private int _width;
|
||||
private int _height;
|
||||
private byte[] _rawRgbaDataBuffer;
|
||||
|
||||
public DxtTextureLoader(ITextureFactory textureFactory)
|
||||
{
|
||||
_textureFactory = textureFactory;
|
||||
}
|
||||
|
||||
public void Load(byte[] data, out bool hasAlphaChannel)
|
||||
{
|
||||
if (_rawRgbaDataBuffer != null) throw new Exception("DXT texture already loaded");
|
||||
|
||||
using MemoryStream stream = new(data);
|
||||
using BinaryReader headerReader = new(stream);
|
||||
|
||||
if (new string(headerReader.ReadChars(4)) != "DDS ")
|
||||
{
|
||||
throw new InvalidDataException("Not a valid DXT file");
|
||||
}
|
||||
|
||||
DxtHeader header = DxtHeader.ReadHeader(headerReader);
|
||||
|
||||
_width = header.Width;
|
||||
_height = header.Height;
|
||||
|
||||
_rawRgbaDataBuffer = ArrayPool<byte>.Shared.Rent(_width * _height * 4);
|
||||
|
||||
switch (header.DxtPixelFormat.Format)
|
||||
{
|
||||
case "DXT1":
|
||||
hasAlphaChannel = false;
|
||||
Dxt1Decoder.ToRgba32(data, _width, _height, _rawRgbaDataBuffer);
|
||||
break;
|
||||
case "DXT3":
|
||||
hasAlphaChannel = true;
|
||||
Dxt3Decoder.ToRgba32(data, _width, _height, _rawRgbaDataBuffer);
|
||||
break;
|
||||
case "DXT5":
|
||||
throw new NotImplementedException("DXT5 decoder not implemented");
|
||||
default:
|
||||
throw new Exception($"DXT Texture format: {header.DxtPixelFormat.Format} is not supported");
|
||||
}
|
||||
}
|
||||
|
||||
public ITexture2D ToTexture()
|
||||
{
|
||||
if (_rawRgbaDataBuffer == null) return null;
|
||||
|
||||
try
|
||||
{
|
||||
return _textureFactory.CreateTexture(_width, _height, _rawRgbaDataBuffer);
|
||||
}
|
||||
finally
|
||||
{
|
||||
ArrayPool<byte>.Shared.Return(_rawRgbaDataBuffer);
|
||||
_rawRgbaDataBuffer = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
public sealed class DxtTextureLoader : ITextureLoader
|
||||
{
|
||||
public ITextureDataSource Load(byte[] data, out bool hasAlphaChannel)
|
||||
{
|
||||
var image = new DxtImage(data);
|
||||
hasAlphaChannel = image.HasAlphaChannel;
|
||||
return new DxtTextureDataSource(image);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,75 +1,52 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.DataLoader
|
||||
{
|
||||
using System;
|
||||
using System.Buffers;
|
||||
using Core.Abstraction;
|
||||
using Core.Implementation;
|
||||
using Pal3.Core.DataReader.Tga;
|
||||
|
||||
/// <summary>
|
||||
/// .tga file loader and Texture2D converter.
|
||||
/// </summary>
|
||||
public sealed class TgaTextureLoader : ITextureLoader
|
||||
{
|
||||
private readonly ITextureFactory _textureFactory;
|
||||
|
||||
private short _width;
|
||||
private short _height;
|
||||
private byte[] _rawRgbaDataBuffer;
|
||||
|
||||
public TgaTextureLoader(ITextureFactory textureFactory)
|
||||
public unsafe ITextureDataSource Load(byte[] data, out bool hasAlphaChannel)
|
||||
{
|
||||
_textureFactory = textureFactory;
|
||||
}
|
||||
|
||||
public unsafe void Load(byte[] data, out bool hasAlphaChannel)
|
||||
{
|
||||
if (_rawRgbaDataBuffer != null) throw new Exception("TGA texture already loaded");
|
||||
|
||||
short width;
|
||||
short height;
|
||||
byte bitDepth;
|
||||
|
||||
fixed (byte* p = &data[12])
|
||||
{
|
||||
_width = *(short*)p;
|
||||
_height = *(short*)(p + 2);
|
||||
width = *(short*)p;
|
||||
height = *(short*)(p + 2);
|
||||
bitDepth = *(p + 4);
|
||||
}
|
||||
|
||||
_rawRgbaDataBuffer = ArrayPool<byte>.Shared.Rent(_width * _height * 4);
|
||||
|
||||
switch (bitDepth)
|
||||
{
|
||||
case 24:
|
||||
hasAlphaChannel = false;
|
||||
TgaDecoder.Decode24BitDataToRgba32(
|
||||
data, _width, _height, _rawRgbaDataBuffer);
|
||||
break;
|
||||
case 32:
|
||||
TgaDecoder.Decode32BitDataToRgba32(
|
||||
data, _width, _height, _rawRgbaDataBuffer, out hasAlphaChannel);
|
||||
break;
|
||||
default:
|
||||
throw new Exception("TGA texture had non 32/24 bit depth");
|
||||
}
|
||||
}
|
||||
|
||||
public ITexture2D ToTexture()
|
||||
{
|
||||
if (_rawRgbaDataBuffer == null) return null;
|
||||
|
||||
byte[] rgba = ArrayPool<byte>.Shared.Rent(checked(width * height * 4));
|
||||
try
|
||||
{
|
||||
return _textureFactory.CreateTexture(_width, _height, _rawRgbaDataBuffer);
|
||||
switch (bitDepth)
|
||||
{
|
||||
case 24:
|
||||
hasAlphaChannel = false;
|
||||
TgaDecoder.Decode24BitDataToRgba32(data, width, height, rgba);
|
||||
break;
|
||||
case 32:
|
||||
TgaDecoder.Decode32BitDataToRgba32(data, width, height, rgba, out hasAlphaChannel);
|
||||
break;
|
||||
default:
|
||||
throw new Exception("TGA texture had non 32/24 bit depth");
|
||||
}
|
||||
return Rgba32TextureDataSource.TakePooledBuffer(width, height, rgba, hasTransparency: true);
|
||||
}
|
||||
finally
|
||||
catch
|
||||
{
|
||||
ArrayPool<byte>.Shared.Return(_rawRgbaDataBuffer);
|
||||
_rawRgbaDataBuffer = null;
|
||||
ArrayPool<byte>.Shared.Return(rgba);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Extensions
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Extensions
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Extensions
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Logging
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Navigation
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Navigation
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Navigation
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Renderer
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Renderer
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Renderer
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Renderer
|
||||
{
|
||||
@@ -40,6 +40,7 @@ namespace Engine.Renderer
|
||||
_meshFilter = GameEntity.AddComponent<MeshFilter>();
|
||||
|
||||
Mesh mesh = new();
|
||||
if (vertices.Length > ushort.MaxValue) mesh.indexFormat = IndexFormat.UInt32;
|
||||
|
||||
if (isDynamic)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Services
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Services
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Services
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Services
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Services
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Services
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Services
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.Services
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.UI
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.UI
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// ------------------------------------------------------------------------
|
||||
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
|
||||
// See LICENSE file in the project root for license information.
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
namespace Engine.UI
|
||||
{
|
||||
|
||||
Loaded 100 of 716 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user