Compare commits

..
Author SHA1 Message Date
Jiaqi (0x7c13) Liu faad8c4d63 Document Unity CI after disabling the Codacy integration 2026-11-12 00:57:40 +08:00
Jiaqi (0x7c13) Liu 59ee409e6b Fix DXT3 alpha decoding that produces foliage stripes
Expand the high alpha nibble into both halves of the output byte. Fully opaque DXT3 texels now decode to 255 in both pixel positions, preventing alternating coverage in the cutout and blended rendering passes. Add editor regressions for opaque RGB/alpha, all sixteen alpha levels in pixel order, and partial blocks with buffer-tail protection.
2026-11-12 00:12:20 +08:00
Jiaqi (0x7c13) Liu 49d50b863b Tune Toon lighting, water and bounded point-light shadows
Strengthen indoor and outdoor lighting contrast, integrate SSAO and baked shading while retaining character detail, and light transparent water with the shared Toon shader. Expose independent switches and strengths through the console. Support up to four shadowed fires with bounded allocation-free selection, preserve saved preferences, adapt the shadow atlas, and default desktop devices to four shadowed fires.

Report invalid console strengths and shadow budgets without saving rejected values.
2026-11-12 00:12:19 +08:00
Jiaqi (0x7c13) Liu b743505d54 Manage camera post-processing, anti-aliasing and menu glass
Give each game camera its own VolumeStack without mutating shared profiles, and restore inherited camera and effect state on disposal. Map the old PPv2 Bloom intensity through its exponential compositing coefficient; this does not establish visual equivalence across pipelines. Share saved and live MSAA handling with ResourceViewer, and make the main menu acrylic background whiter with less scene color showing through.

Restore pipeline settings even after partial initialization or service cleanup failure. Protect the persistent URP asset from ordinary Play Mode saves and restore the two runtime fields across Play exit and script reloads without reverting unrelated edits.
2026-11-12 00:12:19 +08:00
Jiaqi (0x7c13) Liu ba018bb752 Isolate optional VFX lifetimes and private asset builds
Centralize optional prefab loading, persistent attachments, active-effect cleanup and cache invalidation. Runtime toggles hide active effects and restore surviving attachments. Block private VFX and legacy Toon assets in public builds, with an explicit local private-build override.

Release portal attachments on destruction, reject dead parents and prune orphaned persistent attachments.
2026-11-12 00:12:19 +08:00
Jiaqi (0x7c13) Liu 3c21e1cfcc Preserve two-sided model normals across animation
Recognize coincident MV3 vertices by their complete animation trajectories and skeletal vertices by their bind positions and bone. Separate opposing faces only where a source normal group is shared, preserving UV seams and adjacent single-sided faces.
2026-11-11 23:07:30 +08:00
Jiaqi (0x7c13) Liu ef7d798cc6 Use the new Input System as the only input backend
Select Input System Package as the sole backend. Remove the extra scroll-sensitivity reductions in the console and file browser, preserving their previous Both-mode scrolling behavior.
2026-11-11 23:07:30 +08:00
Jiaqi (0x7c13) Liu e757685a90 Fix Unity 6.6 startup compiler warnings
Use Unity assembly discovery and object lookup APIs, keep PAL3 command reflection independent of UnityEngine, and preserve the runtime GDB dictionaries in JSON exports.
2026-11-11 14:19:22 +08:00
Jiaqi (0x7c13) Liu 3886661036 Save Unity 6.6 and URP project settings
Persist the current graphics, quality, player and shader graph settings plus the URP material upgrade marker.
2026-11-11 14:18:56 +08:00
Jiaqi (0x7c13) Liu fc1bde9da9 Restore opt-in story VFX loading
Use the existing local VFX resource path for synchronous and asynchronous loading. Keep the preference off by default and document compatible optional assets.
2026-11-11 14:08:24 +08:00
Jiaqi (0x7c13) Liu f42d04c2bb Manage game Bloom and screen effect state by camera
Expose a persisted Bloom switch, restore the active style default on reset, and release camera and volume state when the manager is disposed.
2026-11-11 14:08:24 +08:00
Jiaqi (0x7c13) Liu 729fa33101 Skip redundant CVD mesh updates
Reuse unchanged poses and UVs, and recompute Toon normals only when geometry or the linear transform changes.
2026-11-11 14:08:24 +08:00
Jiaqi (0x7c13) Liu e309660c5c Add standalone Toon lighting and shared model rendering support
Add independent Toon shaders, scene and character lighting, contact shadows and fire controls. Share POL materials, preserve MV3 seams and texture swaps across both styles, and support scene-specific Toon water.
2026-11-11 14:08:24 +08:00
Jiaqi (0x7c13) Liu 8c0d95a071 Migrate original rendering and frosted UI to URP Forward+
Port the original materials, fog and screen passes to URP. Capture the finished scene for frosted UI and keep the renderer assets ready for clustered lighting.
2026-11-11 14:08:24 +08:00
716 changed files with 2826 additions and 7307 deletions

No files matched your search

+2 -7
View File
@@ -2,18 +2,13 @@
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 only on pull requests.
New commits cancel superseded runs for the same pull request and workflow.
Successful desktop/Android builds upload artifacts.
macOS, Linux, and 32-bit/64-bit Windows. The workflows run on pushes and pull
requests, and 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.
+5 -10
View File
@@ -1,10 +1,6 @@
name: Builds - PAL3 - Mono - Android
on: [pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
on: [push, pull_request]
jobs:
build_pal3_mono_android:
@@ -25,16 +21,16 @@ jobs:
large-packages: true
docker-images: true
swap-storage: true
- uses: actions/checkout@v7.0.1
- uses: actions/checkout@v6.0.3
with:
fetch-depth: 0
lfs: true
- uses: actions/cache@v6.1.0
- uses: actions/cache@v5.0.5
with:
path: Library
key: Library-${{ matrix.targetPlatform }}
restore-keys: Library-
- uses: game-ci/unity-builder@v6.0.0
- uses: game-ci/unity-builder@v5
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
@@ -43,9 +39,8 @@ 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
+5 -10
View File
@@ -1,10 +1,6 @@
name: Builds - PAL3 - Mono - iOS
on: [pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
on: [push, pull_request]
jobs:
build_pal3_mono_ios:
@@ -16,16 +12,16 @@ jobs:
targetPlatform:
- iOS # Build an iOS player.
steps:
- uses: actions/checkout@v7.0.1
- uses: actions/checkout@v6.0.3
with:
fetch-depth: 0
lfs: true
- uses: actions/cache@v6.1.0
- uses: actions/cache@v5.0.5
with:
path: Library
key: Library-${{ matrix.targetPlatform }}
restore-keys: Library-
- uses: game-ci/unity-builder@v6.0.0
- uses: game-ci/unity-builder@v5
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
@@ -34,5 +30,4 @@ jobs:
targetPlatform: ${{ matrix.targetPlatform }}
buildName: PAL3
versioning: Semantic
cliVersion: v0.1.73
# do not upload artifacts for iOS builds
# do not upload artifacts for iOS builds
+5 -10
View File
@@ -1,10 +1,6 @@
name: Builds - PAL3 - Mono - Linux
on: [pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
on: [push, pull_request]
jobs:
build_pal3_mono_linux:
@@ -16,16 +12,16 @@ jobs:
targetPlatform:
- StandaloneLinux64 # Build a Linux 64-bit standalone.
steps:
- uses: actions/checkout@v7.0.1
- uses: actions/checkout@v6.0.3
with:
fetch-depth: 0
lfs: true
- uses: actions/cache@v6.1.0
- uses: actions/cache@v5.0.5
with:
path: Library
key: Library-${{ matrix.targetPlatform }}
restore-keys: Library-
- uses: game-ci/unity-builder@v6.0.0
- uses: game-ci/unity-builder@v5
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
@@ -34,9 +30,8 @@ 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
+5 -10
View File
@@ -1,10 +1,6 @@
name: Builds - PAL3 - Mono - MacOS
on: [pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
on: [push, pull_request]
jobs:
build_pal3_mono_macos:
@@ -16,16 +12,16 @@ jobs:
targetPlatform:
- StandaloneOSX # Build a macOS standalone (Intel 64-bit).
steps:
- uses: actions/checkout@v7.0.1
- uses: actions/checkout@v6.0.3
with:
fetch-depth: 0
lfs: true
- uses: actions/cache@v6.1.0
- uses: actions/cache@v5.0.5
with:
path: Library
key: Library-${{ matrix.targetPlatform }}
restore-keys: Library-
- uses: game-ci/unity-builder@v6.0.0
- uses: game-ci/unity-builder@v5
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
@@ -34,9 +30,8 @@ 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
+5 -10
View File
@@ -1,10 +1,6 @@
name: Builds - PAL3 - Mono - Windows
on: [pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
on: [push, pull_request]
jobs:
build_pal3_mono_windows:
@@ -17,16 +13,16 @@ jobs:
- StandaloneWindows # Build a Windows standalone.
- StandaloneWindows64 # Build a Windows 64-bit standalone.
steps:
- uses: actions/checkout@v7.0.1
- uses: actions/checkout@v6.0.3
with:
fetch-depth: 0
lfs: true
- uses: actions/cache@v6.1.0
- uses: actions/cache@v5.0.5
with:
path: Library
key: Library-${{ matrix.targetPlatform }}
restore-keys: Library-
- uses: game-ci/unity-builder@v6.0.0
- uses: game-ci/unity-builder@v5
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
@@ -35,9 +31,8 @@ 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
+5 -10
View File
@@ -1,10 +1,6 @@
name: Builds - PAL3A - Mono - Android
on: [pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
on: [push, pull_request]
jobs:
build_pal3a_mono_android:
@@ -25,7 +21,7 @@ jobs:
large-packages: true
docker-images: true
swap-storage: true
- uses: actions/checkout@v7.0.1
- uses: actions/checkout@v6.0.3
with:
fetch-depth: 0
lfs: true
@@ -41,12 +37,12 @@ jobs:
find: "6b32649dccc45df4ebe8e3f8eccee249"
replace: "d03d417e5660d5849939c8fe43732dbd"
include: "**ProjectSettings.asset"
- uses: actions/cache@v6.1.0
- uses: actions/cache@v5.0.5
with:
path: Library
key: Library-${{ matrix.targetPlatform }}
restore-keys: Library-
- uses: game-ci/unity-builder@v6.0.0
- uses: game-ci/unity-builder@v5
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
@@ -56,9 +52,8 @@ 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
+5 -10
View File
@@ -1,10 +1,6 @@
name: Builds - PAL3A - Mono - iOS
on: [pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
on: [push, pull_request]
jobs:
build_pal3a_mono_ios:
@@ -16,7 +12,7 @@ jobs:
targetPlatform:
- iOS # Build an iOS player.
steps:
- uses: actions/checkout@v7.0.1
- uses: actions/checkout@v6.0.3
with:
fetch-depth: 0
lfs: true
@@ -32,12 +28,12 @@ jobs:
find: "6b32649dccc45df4ebe8e3f8eccee249"
replace: "d03d417e5660d5849939c8fe43732dbd"
include: "**ProjectSettings.asset"
- uses: actions/cache@v6.1.0
- uses: actions/cache@v5.0.5
with:
path: Library
key: Library-${{ matrix.targetPlatform }}
restore-keys: Library-
- uses: game-ci/unity-builder@v6.0.0
- uses: game-ci/unity-builder@v5
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
@@ -47,5 +43,4 @@ jobs:
targetPlatform: ${{ matrix.targetPlatform }}
buildName: PAL3A
versioning: Semantic
cliVersion: v0.1.73
# do not upload artifacts for iOS builds
# do not upload artifacts for iOS builds
+5 -10
View File
@@ -1,10 +1,6 @@
name: Builds - PAL3A - Mono - Linux
on: [pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
on: [push, pull_request]
jobs:
build_pal3a_mono_linux:
@@ -16,7 +12,7 @@ jobs:
targetPlatform:
- StandaloneLinux64 # Build a Linux 64-bit standalone.
steps:
- uses: actions/checkout@v7.0.1
- uses: actions/checkout@v6.0.3
with:
fetch-depth: 0
lfs: true
@@ -32,12 +28,12 @@ jobs:
find: "6b32649dccc45df4ebe8e3f8eccee249"
replace: "d03d417e5660d5849939c8fe43732dbd"
include: "**ProjectSettings.asset"
- uses: actions/cache@v6.1.0
- uses: actions/cache@v5.0.5
with:
path: Library
key: Library-${{ matrix.targetPlatform }}
restore-keys: Library-
- uses: game-ci/unity-builder@v6.0.0
- uses: game-ci/unity-builder@v5
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
@@ -47,9 +43,8 @@ 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
+5 -10
View File
@@ -1,10 +1,6 @@
name: Builds - PAL3A - Mono - MacOS
on: [pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
on: [push, pull_request]
jobs:
build_pal3a_mono_macos:
@@ -16,7 +12,7 @@ jobs:
targetPlatform:
- StandaloneOSX # Build a macOS standalone (Intel 64-bit).
steps:
- uses: actions/checkout@v7.0.1
- uses: actions/checkout@v6.0.3
with:
fetch-depth: 0
lfs: true
@@ -32,12 +28,12 @@ jobs:
find: "6b32649dccc45df4ebe8e3f8eccee249"
replace: "d03d417e5660d5849939c8fe43732dbd"
include: "**ProjectSettings.asset"
- uses: actions/cache@v6.1.0
- uses: actions/cache@v5.0.5
with:
path: Library
key: Library-${{ matrix.targetPlatform }}
restore-keys: Library-
- uses: game-ci/unity-builder@v6.0.0
- uses: game-ci/unity-builder@v5
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
@@ -47,9 +43,8 @@ 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
+5 -10
View File
@@ -1,10 +1,6 @@
name: Builds - PAL3A - Mono - Windows
on: [pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
on: [push, pull_request]
jobs:
build_pal3a_mono_windows:
@@ -17,7 +13,7 @@ jobs:
- StandaloneWindows # Build a Windows standalone.
- StandaloneWindows64 # Build a Windows 64-bit standalone.
steps:
- uses: actions/checkout@v7.0.1
- uses: actions/checkout@v6.0.3
with:
fetch-depth: 0
lfs: true
@@ -33,12 +29,12 @@ jobs:
find: "6b32649dccc45df4ebe8e3f8eccee249"
replace: "d03d417e5660d5849939c8fe43732dbd"
include: "**ProjectSettings.asset"
- uses: actions/cache@v6.1.0
- uses: actions/cache@v5.0.5
with:
path: Library
key: Library-${{ matrix.targetPlatform }}
restore-keys: Library-
- uses: game-ci/unity-builder@v6.0.0
- uses: game-ci/unity-builder@v5
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
@@ -48,9 +44,8 @@ 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------
/*
reference: https://www.shadertoy.com/view/MsKXDh
@@ -1,8 +1,7 @@
// ------------------------------------------------------------------------
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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,8 +1,7 @@
// ------------------------------------------------------------------------
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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
View File
@@ -1,7 +1,4 @@
// ------------------------------------------------------------------------
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// See LICENSE in the project root.
#include "Pal3ToonInput.hlsl"
+1 -4
View File
@@ -1,7 +1,4 @@
// ------------------------------------------------------------------------
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// See LICENSE in the project root.
#include "Pal3ToonInput.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
+1 -4
View File
@@ -1,7 +1,4 @@
// ------------------------------------------------------------------------
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// See LICENSE in the project root.
#ifndef PAL3_TOON_INPUT_INCLUDED
#define PAL3_TOON_INPUT_INCLUDED
+1 -4
View File
@@ -1,7 +1,4 @@
// ------------------------------------------------------------------------
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// See LICENSE in the project root.
#include "Pal3ToonInput.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
@@ -1,7 +1,4 @@
// ------------------------------------------------------------------------
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// See LICENSE in the project root.
Shader "Pal3/ToonCutout"
{
@@ -1,7 +1,4 @@
// ------------------------------------------------------------------------
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// See LICENSE in the project root.
Shader "Pal3/ToonOpaque"
{
@@ -1,7 +1,4 @@
// ------------------------------------------------------------------------
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// See LICENSE in the project root.
Shader "Pal3/ToonTransparent"
{
@@ -1,7 +1,4 @@
// ------------------------------------------------------------------------
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// See LICENSE in the project root.
Shader "Pal3/ToonWater"
{
+3 -3
View File
@@ -1,7 +1,7 @@
// ------------------------------------------------------------------------
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------
Shader "Pal3/Dev"
{
+3 -3
View File
@@ -1,7 +1,7 @@
// ------------------------------------------------------------------------
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------
Shader "Pal3/Opaque"
{
+3 -3
View File
@@ -1,7 +1,7 @@
// ------------------------------------------------------------------------
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------
Shader "Pal3/TransparentOpaquePart"
{
+3 -3
View File
@@ -1,7 +1,7 @@
// ------------------------------------------------------------------------
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------
Shader "Pal3/Water"
{
@@ -1,42 +0,0 @@
// ------------------------------------------------------------------------
// 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
}
}
}
@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 0d3ce4f585ff416caf911181f6f5dd56
@@ -1,7 +1,7 @@
// ------------------------------------------------------------------------
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------
#if UNITY_EDITOR_OSX && UNITY_STANDALONE_OSX
+3 -3
View File
@@ -1,7 +1,7 @@
// ------------------------------------------------------------------------
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------
namespace Editor
{
@@ -1,7 +1,7 @@
// ------------------------------------------------------------------------
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------
namespace Editor
{
@@ -1,7 +1,4 @@
// ------------------------------------------------------------------------
// Copyright (c) 2026, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// See LICENSE in the project root.
namespace Editor
{
@@ -1,7 +1,7 @@
// ------------------------------------------------------------------------
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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,14 +1,12 @@
// ------------------------------------------------------------------------
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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;
@@ -41,18 +39,6 @@ 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,
@@ -77,7 +63,7 @@ namespace Editor
sourceGenerator.GenerateSourceClass(writer, className, nameSpace);
// Final output string
string output = CopyrightHeader(writePath) + $"#if {GAME_VARIANT_SYMBOL}\n\n{writer.Buffer}\n#endif";
string output = $"#if {GAME_VARIANT_SYMBOL}\n\n{writer.Buffer}\n#endif";
// Write to file
using StreamWriter sw = new(writePath);
+3 -3
View File
@@ -1,7 +1,7 @@
// ------------------------------------------------------------------------
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------
namespace Engine.Core.Abstraction
{
@@ -1,43 +0,0 @@
// ------------------------------------------------------------------------
// 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();
}
}
@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 336875a34c8a40fdb3e81bea05b5db7f
@@ -1,31 +1,29 @@
// ------------------------------------------------------------------------
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------
namespace Engine.Core.Abstraction
{
/// <summary>Creates graphics textures from CPU-side pixel data.</summary>
/// <summary>
/// Interface for a texture factory that creates textures.
/// </summary>
public interface ITextureFactory
{
/// <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 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>
/// 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.
/// Creates a new white texture.
/// </summary>
/// <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();
/// <returns>The created texture.</returns>
public ITexture2D CreateWhiteTexture();
}
}
}
@@ -1,19 +1,31 @@
// ------------------------------------------------------------------------
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------
namespace Engine.Core.Abstraction
{
/// <summary>Decode a file into CPU-side data without creating graphics objects.</summary>
/// <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>
public interface ITextureLoader
{
/// <summary>
/// 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.
/// Load and decode texture data.
/// </summary>
/// <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);
/// <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();
}
}
}
@@ -1,14 +0,0 @@
// ------------------------------------------------------------------------
// 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);
}
}
@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: c24ebc56cb2a45bca760e20bded1ab02
@@ -1,7 +1,7 @@
// ------------------------------------------------------------------------
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------
namespace Engine.Core.Abstraction
{
@@ -1,32 +0,0 @@
// ------------------------------------------------------------------------
// 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);
}
}
@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: e86d1e0ca8f948be888eb88254554127
@@ -1,7 +1,7 @@
// ------------------------------------------------------------------------
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------
namespace Engine.Core.Implementation
{
@@ -1,96 +0,0 @@
// ------------------------------------------------------------------------
// 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]);
}
}
}
}
@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: fc5fd6d3991f4cc29604a6fc6303fe36
@@ -1,7 +1,7 @@
// ------------------------------------------------------------------------
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------
namespace Engine.Core.Implementation
{
@@ -16,12 +16,10 @@ namespace Engine.Core.Implementation
public bool IsNativeObjectDisposed => _texture2D == null;
private Texture2D _texture2D;
private ITexturePixelReader _pixelReader;
public UnityTexture2D(Texture2D texture2D, ITexturePixelReader pixelReader = null)
public UnityTexture2D(Texture2D texture2D)
{
_texture2D = texture2D;
_pixelReader = pixelReader;
}
public int Width => _texture2D.width;
@@ -40,15 +38,6 @@ 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);
}
@@ -75,7 +64,6 @@ namespace Engine.Core.Implementation
}
_texture2D = null;
_pixelReader = null;
}
}
}
}
@@ -1,94 +1,29 @@
// ------------------------------------------------------------------------
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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)
{
using var source = new Rgba32TextureDataSource(width, height, rgba32DataBuffer);
return CreateTexture(source, TextureCreateOptions.Readable);
}
if (rgba32DataBuffer.Length < width * height * 4)
{
throw new ArgumentException("rgba32DataBuffer.Length < width * height * 4");
}
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;
}
Texture2D texture = new Texture2D(width, height, TextureFormat.RGBA32, mipChain: false);
texture.LoadRawTextureData(rgba32DataBuffer);
texture.Apply(updateMipmaps: false);
return new UnityTexture2D(texture);
}
public ITexture2D CreateWhiteTexture() => new UnityTexture2D(Texture2D.whiteTexture);
}
}
}
@@ -1,7 +1,7 @@
// ------------------------------------------------------------------------
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------
namespace Engine.DataLoader
{
@@ -1,50 +1,84 @@
// ------------------------------------------------------------------------
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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
{
public ITextureDataSource Load(byte[] data, out bool hasAlphaChannel)
{
hasAlphaChannel = false;
BmpFile image = new BmpFileReader().Read(data);
int width = image.Info.AbsWidth;
int height = image.Info.AbsHeight;
private readonly ITextureFactory _textureFactory;
private BmpFile _image;
if (image.Info.Height < 0)
public BmpTextureLoader(ITextureFactory textureFactory)
{
_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);
}
// 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++)
{
for (int y = 0; y < height / 2; y++)
for(int x = 0, o1 = y * width, o2 = (height - y - 1) * width; x < width; x++, o1++, o2++)
{
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.ImageData[o1], _image.ImageData[o2]) = (_image.ImageData[o2], _image.ImageData[o1]);
}
}
byte[] rgba = ArrayPool<byte>.Shared.Rent(checked(image.ImageData.Length * 4));
_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);
try
{
for (int i = 0; i < image.ImageData.Length; i++)
for (int i = 0; i < _image.ImageData.Length; i++)
{
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;
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;
}
return Rgba32TextureDataSource.TakePooledBuffer(width, height, rgba, hasTransparency: false);
// Use the buffer instead of a new array
return _textureFactory.CreateTexture(_image.Info.AbsWidth, _image.Info.AbsHeight, rawRgbaDataBuffer);
}
catch
finally
{
ArrayPool<byte>.Shared.Return(rgba);
throw;
ArrayPool<byte>.Shared.Return(rawRgbaDataBuffer);
_image = null;
}
}
}
}
}
@@ -1,43 +0,0 @@
// ------------------------------------------------------------------------
// 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() { }
}
}
@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 297f6c8fd4754f03b14fd961080d843a
@@ -1,20 +1,81 @@
// ------------------------------------------------------------------------
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------
namespace Engine.DataLoader
{
using Core.Abstraction;
using Pal3.Core.DataReader.Dxt;
using System;
using System.Buffers;
using System.IO;
using Core.Abstraction;
using Pal3.Core.DataReader.Dxt;
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);
}
}
/// <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;
}
}
}
}
@@ -1,52 +1,75 @@
// ------------------------------------------------------------------------
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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
{
public unsafe ITextureDataSource Load(byte[] data, out bool hasAlphaChannel)
private readonly ITextureFactory _textureFactory;
private short _width;
private short _height;
private byte[] _rawRgbaDataBuffer;
public TgaTextureLoader(ITextureFactory textureFactory)
{
short width;
short height;
_textureFactory = textureFactory;
}
public unsafe void Load(byte[] data, out bool hasAlphaChannel)
{
if (_rawRgbaDataBuffer != null) throw new Exception("TGA texture already loaded");
byte bitDepth;
fixed (byte* p = &data[12])
{
width = *(short*)p;
height = *(short*)(p + 2);
_width = *(short*)p;
_height = *(short*)(p + 2);
bitDepth = *(p + 4);
}
byte[] rgba = ArrayPool<byte>.Shared.Rent(checked(width * height * 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;
try
{
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);
return _textureFactory.CreateTexture(_width, _height, _rawRgbaDataBuffer);
}
catch
finally
{
ArrayPool<byte>.Shared.Return(rgba);
throw;
ArrayPool<byte>.Shared.Return(_rawRgbaDataBuffer);
_rawRgbaDataBuffer = null;
}
}
}
}
}
@@ -1,7 +1,7 @@
// ------------------------------------------------------------------------
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------
namespace Engine.Navigation
{
+3 -3
View File
@@ -1,7 +1,7 @@
// ------------------------------------------------------------------------
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------
namespace Engine.Renderer
{
@@ -40,7 +40,6 @@ 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------------
namespace Engine.UI
{
+3 -3
View File
@@ -1,7 +1,7 @@
// ------------------------------------------------------------------------
// Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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-2026, Jiaqi (0x7c13) Liu. All rights reserved.
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2025, 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