perf(render): consume prepared mesh package at runtime

This commit is contained in:
Erik 2026-07-24 15:07:25 +02:00
parent c42f93b323
commit f05afc07c1
22 changed files with 328 additions and 370 deletions

View file

@ -1,4 +1,5 @@
using AcDream.Core.Rendering.Wb;
using AcDream.Core.Meshing;
using AcDream.Content.Vfx;
using BCnEncoder.Decoder;
using BCnEncoder.ImageSharp;
@ -569,6 +570,9 @@ public sealed class MeshExtractor {
TextureData = textureData!,
UploadPixelFormat = uploadPixelFormat,
UploadPixelType = uploadPixelType,
Translucency =
TranslucencyKindExtensions.FromSurfaceType(
surface.Type),
IsTransparent = isTransparent,
IsAdditive = isAdditive
};
@ -919,6 +923,9 @@ public sealed class MeshExtractor {
TextureData = textureData!,
UploadPixelFormat = uploadPixelFormat,
UploadPixelType = uploadPixelType,
Translucency =
TranslucencyKindExtensions.FromSurfaceType(
surface.Type),
IsTransparent = isTransparent,
IsAdditive = isAdditive
};

View file

@ -1,5 +1,6 @@
using Chorizite.Core.Lib;
using Chorizite.Core.Render.Enums;
using AcDream.Core.Meshing;
using DatReaderWriter.DBObjs;
using DatReaderWriter.Types;
using System;
@ -149,6 +150,8 @@ public class TextureBatchData {
public UploadPixelType? UploadPixelType { get; set; }
public List<ushort> Indices { get; set; } = new();
public DatReaderWriter.Enums.CullMode CullMode { get; set; }
public TranslucencyKind Translucency { get; set; } =
TranslucencyKind.Opaque;
public bool IsTransparent { get; set; }
public bool IsAdditive { get; set; }
public bool HasWrappingUVs { get; set; }

View file

@ -168,6 +168,7 @@ public static class ObjectMeshDataSerializer {
WriteNullableInt32Enum(w, batch.UploadPixelType.HasValue, batch.UploadPixelType is { } upt ? (int)upt : 0);
WriteUInt16List(w, batch.Indices);
w.Write((int)batch.CullMode);
w.Write((int)batch.Translucency);
w.Write(batch.IsTransparent);
w.Write(batch.IsAdditive);
w.Write(batch.HasWrappingUVs);
@ -182,6 +183,8 @@ public static class ObjectMeshDataSerializer {
batch.UploadPixelType = ReadNullableInt32Enum(r, v => (UploadPixelType)v);
batch.Indices = ReadUInt16List(r);
batch.CullMode = (CullMode)r.ReadInt32();
batch.Translucency =
(AcDream.Core.Meshing.TranslucencyKind)r.ReadInt32();
batch.IsTransparent = r.ReadBoolean();
batch.IsAdditive = r.ReadBoolean();
batch.HasWrappingUVs = r.ReadBoolean();

View file

@ -18,10 +18,12 @@ public static class PakFormat {
/// <summary>
/// Identity of the bake algorithm that produced the payloads. Version 2
/// introduces content-identity EnvCell blobs with ordinary TOC aliases.
/// introduced content-identity EnvCell blobs with ordinary TOC aliases;
/// version 3 embeds exact render-pass translucency in each texture batch
/// so production never rebuilds surface metadata from live DAT.
/// The binary format remains version 1.
/// </summary>
public const uint CurrentBakeToolVersion = 2;
public const uint CurrentBakeToolVersion = 3;
}
/// <summary>