perf(render): consume prepared mesh package at runtime
This commit is contained in:
parent
c42f93b323
commit
f05afc07c1
22 changed files with 328 additions and 370 deletions
|
|
@ -25,6 +25,7 @@ internal sealed record ContentAudioGraph(
|
|||
|
||||
internal sealed record ContentEffectsAudioResult(
|
||||
IDatReaderWriter Dats,
|
||||
IPreparedAssetSource PreparedAssets,
|
||||
MagicCatalog MagicCatalog,
|
||||
IAnimationLoader AnimationLoader,
|
||||
LiveEntityCollisionBuilder CollisionBuilder,
|
||||
|
|
@ -41,6 +42,7 @@ internal sealed record ContentEffectsAudioResult(
|
|||
|
||||
internal sealed record ContentEffectsAudioDependencies(
|
||||
string DatDirectory,
|
||||
string PreparedAssetPath,
|
||||
PhysicsDataCache PhysicsDataCache,
|
||||
bool DumpMotionEnabled,
|
||||
Spellbook SpellBook,
|
||||
|
|
@ -56,6 +58,7 @@ internal sealed record ContentEffectsAudioDependencies(
|
|||
internal interface IGameWindowContentEffectsAudioPublication
|
||||
{
|
||||
void PublishDatCollection(IDatReaderWriter value);
|
||||
void PublishPreparedAssetSource(IPreparedAssetSource value);
|
||||
void PublishMagicCatalog(MagicCatalog value);
|
||||
void PublishAnimationLoader(IAnimationLoader value);
|
||||
void PublishLiveEntityCollisionBuilder(LiveEntityCollisionBuilder value);
|
||||
|
|
@ -74,6 +77,10 @@ internal interface IGameWindowContentEffectsAudioPublication
|
|||
internal interface IContentEffectsAudioCompositionFactory
|
||||
{
|
||||
IDatReaderWriter OpenDatCollection(string datDirectory);
|
||||
IPreparedAssetSource OpenPreparedAssetSource(
|
||||
string path,
|
||||
IDatReaderWriter dats,
|
||||
Action<string> diagnostic);
|
||||
MagicCatalog LoadMagicCatalog(IDatReaderWriter dats);
|
||||
void InstallSpellMetadata(Spellbook spellBook, MagicCatalog catalog);
|
||||
int GetSpellCount(MagicCatalog catalog);
|
||||
|
|
@ -116,6 +123,12 @@ internal sealed class RetailContentEffectsAudioCompositionFactory
|
|||
public IDatReaderWriter OpenDatCollection(string datDirectory) =>
|
||||
RuntimeDatCollectionFactory.OpenReadOnly(datDirectory);
|
||||
|
||||
public IPreparedAssetSource OpenPreparedAssetSource(
|
||||
string path,
|
||||
IDatReaderWriter dats,
|
||||
Action<string> diagnostic) =>
|
||||
new PakPreparedAssetSource(path, dats, diagnostic);
|
||||
|
||||
public MagicCatalog LoadMagicCatalog(IDatReaderWriter dats) =>
|
||||
MagicCatalog.Load(dats);
|
||||
|
||||
|
|
@ -196,6 +209,7 @@ internal sealed class RetailContentEffectsAudioCompositionFactory
|
|||
internal enum ContentEffectsAudioCompositionPoint
|
||||
{
|
||||
DatCollectionPublished,
|
||||
PreparedAssetSourcePublished,
|
||||
MagicCatalogPublished,
|
||||
SpellMetadataInstalled,
|
||||
AnimationLoaderPublished,
|
||||
|
|
@ -268,6 +282,18 @@ internal sealed class ContentEffectsAudioCompositionPhase :
|
|||
_publication.PublishDatCollection);
|
||||
Fault(ContentEffectsAudioCompositionPoint.DatCollectionPublished);
|
||||
|
||||
IPreparedAssetSource preparedAssets = mainScope.Acquire(
|
||||
"prepared asset source",
|
||||
() => _factory.OpenPreparedAssetSource(
|
||||
_dependencies.PreparedAssetPath,
|
||||
dats,
|
||||
_dependencies.Error),
|
||||
static value => value.Dispose()).Publish(
|
||||
_publication.PublishPreparedAssetSource);
|
||||
Fault(ContentEffectsAudioCompositionPoint.PreparedAssetSourcePublished);
|
||||
_dependencies.Log(
|
||||
$"prepared assets: opened '{_dependencies.PreparedAssetPath}'");
|
||||
|
||||
MagicCatalog magic = _factory.LoadMagicCatalog(dats);
|
||||
_publication.PublishMagicCatalog(magic);
|
||||
Fault(ContentEffectsAudioCompositionPoint.MagicCatalogPublished);
|
||||
|
|
@ -354,6 +380,7 @@ internal sealed class ContentEffectsAudioCompositionPhase :
|
|||
mainScope.Complete();
|
||||
return new ContentEffectsAudioResult(
|
||||
dats,
|
||||
preparedAssets,
|
||||
magic,
|
||||
animations,
|
||||
collision,
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ internal interface IWorldRenderCompositionFactory
|
|||
WbMeshAdapter CreateMeshAdapter(
|
||||
GL gl,
|
||||
IDatReaderWriter dats,
|
||||
IPreparedAssetSource preparedAssets,
|
||||
IGpuResourceRetirementQueue retirement);
|
||||
TextureCache CreateTextureCache(
|
||||
GL gl,
|
||||
|
|
@ -261,10 +262,12 @@ internal sealed class RetailWorldRenderCompositionFactory
|
|||
public WbMeshAdapter CreateMeshAdapter(
|
||||
GL gl,
|
||||
IDatReaderWriter dats,
|
||||
IPreparedAssetSource preparedAssets,
|
||||
IGpuResourceRetirementQueue retirement) =>
|
||||
new(
|
||||
gl,
|
||||
dats,
|
||||
preparedAssets,
|
||||
NullLogger<WbMeshAdapter>.Instance,
|
||||
retirement);
|
||||
|
||||
|
|
@ -430,6 +433,7 @@ internal sealed class WorldRenderCompositionPhase
|
|||
() => _factory.CreateMeshAdapter(
|
||||
gl,
|
||||
content.Dats,
|
||||
content.PreparedAssets,
|
||||
_dependencies.ResourceRetirement),
|
||||
_publication.PublishWbMeshAdapter,
|
||||
WorldRenderCompositionPoint.MeshAdapterPublished);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue