Complete portable planetary presentation contracts
This commit is contained in:
parent
42fef7cdd7
commit
102403efac
74 changed files with 1166 additions and 31 deletions
8
unity/Runtime.meta
Normal file
8
unity/Runtime.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8226365c03c5e1a438408b7e42b98740
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
7
unity/Runtime/CultMath.Unity.asmdef.meta
Normal file
7
unity/Runtime/CultMath.Unity.asmdef.meta
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d1906c397c420ae4eb222a3f09f36843
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -36,12 +36,28 @@ public readonly struct PlanetaryPageMetadataGpu
|
|||
public readonly Vector4 State;
|
||||
}
|
||||
|
||||
public readonly record struct PlanetaryPageUpload(
|
||||
PlanetaryPageInputGpu[] Inputs,
|
||||
PlanetaryPageMetadataGpu[] Metadata,
|
||||
int OutputSampleCount,
|
||||
ulong ContentVersion,
|
||||
ulong PresentationVersion);
|
||||
public readonly struct PlanetaryPageUpload
|
||||
{
|
||||
public PlanetaryPageUpload(
|
||||
PlanetaryPageInputGpu[] inputs,
|
||||
PlanetaryPageMetadataGpu[] metadata,
|
||||
int outputSampleCount,
|
||||
ulong contentVersion,
|
||||
ulong presentationVersion)
|
||||
{
|
||||
Inputs = inputs;
|
||||
Metadata = metadata;
|
||||
OutputSampleCount = outputSampleCount;
|
||||
ContentVersion = contentVersion;
|
||||
PresentationVersion = presentationVersion;
|
||||
}
|
||||
|
||||
public PlanetaryPageInputGpu[] Inputs { get; }
|
||||
public PlanetaryPageMetadataGpu[] Metadata { get; }
|
||||
public int OutputSampleCount { get; }
|
||||
public ulong ContentVersion { get; }
|
||||
public ulong PresentationVersion { get; }
|
||||
}
|
||||
|
||||
public static class PlanetaryPageUploadBuilder
|
||||
{
|
||||
|
|
@ -57,25 +73,23 @@ public static class PlanetaryPageUploadBuilder
|
|||
foreach (var (resident, pageIndex) in snapshot.Tiles.Select((resident, index) => (resident, index)))
|
||||
{
|
||||
var layout = new PlanetaryPageLayout(resident.Tile, interiorSize, borderSize).Validate();
|
||||
var spacing = PlanetaryPageSampling.NominalAngularTexelSize(layout) * radius;
|
||||
var parentSpacing = resident.Tile.Level == 0
|
||||
? 0
|
||||
: PlanetaryPageSampling.NominalAngularTexelSize(new(resident.Tile.Parent(), interiorSize, borderSize)) * radius;
|
||||
var content = PlanetaryGpuPageBuilder.BuildContent(layout, radius);
|
||||
var outputOffset = inputs.Count;
|
||||
for (var y = 0; y < layout.StorageSize; y++)
|
||||
for (var x = 0; x < layout.StorageSize; x++)
|
||||
foreach (var input in content.Inputs)
|
||||
{
|
||||
var direction = PlanetaryPageSampling.Direction(layout, x, y);
|
||||
inputs.Add(new(
|
||||
new Vector4(direction.x, direction.y, direction.z, radius),
|
||||
new Vector4(spacing, parentSpacing, 0, 0)));
|
||||
ToUnity(input.DirectionRadius),
|
||||
ToUnity(input.Sampling)));
|
||||
}
|
||||
var commonMetadata = PlanetaryGpuPageBuilder.Metadata(content, outputOffset, resident.Blend);
|
||||
metadata[pageIndex] = new(
|
||||
new Vector4((int)resident.Tile.Face, resident.Tile.Level, resident.Tile.X, resident.Tile.Y),
|
||||
new Vector4(outputOffset, layout.StorageSize, layout.InteriorSize, layout.BorderSize),
|
||||
Vector4.zero,
|
||||
new Vector4(1, resident.Blend, PlanetaryPageSampling.NominalAngularTexelSize(layout), spacing));
|
||||
ToUnity(commonMetadata.Address),
|
||||
ToUnity(commonMetadata.Layout),
|
||||
ToUnity(commonMetadata.Bounds),
|
||||
ToUnity(commonMetadata.State));
|
||||
}
|
||||
return new(inputs.ToArray(), metadata, inputs.Count, snapshot.ContentVersion, snapshot.PresentationVersion);
|
||||
}
|
||||
|
||||
private static Vector4 ToUnity(float4 value) => new(value.x, value.y, value.z, value.w);
|
||||
}
|
||||
|
|
|
|||
2
unity/Runtime/PlanetaryPageUpload.cs.meta
Normal file
2
unity/Runtime/PlanetaryPageUpload.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7edd3bb2edb2e6448a2d54fc082c27dc
|
||||
2
unity/Runtime/PlanetaryPatchMeshAdapter.cs.meta
Normal file
2
unity/Runtime/PlanetaryPatchMeshAdapter.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9ad7b581e14ef774d8435069bb77ca6a
|
||||
Reference in a new issue