@plasius/gpu-world-generator 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/dist/index.cjs +166 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +46 -1
- package/dist/index.d.ts +46 -1
- package/dist/index.js +163 -2
- package/dist/index.js.map +1 -1
- package/docs/adrs/adr-0005-render-representation-tiers-and-proxy-outputs.md +51 -0
- package/docs/adrs/index.md +2 -1
- package/docs/tdrs/index.md +1 -0
- package/docs/tdrs/tdr-0002-render-representation-tier-contract.md +60 -0
- package/package.json +8 -8
- package/src/tiles.ts +0 -2
- package/src/worker.ts +268 -0
package/dist/index.d.cts
CHANGED
|
@@ -449,6 +449,44 @@ type WorldGeneratorWorkerProfileName = "streaming" | "bake";
|
|
|
449
449
|
type WorldGeneratorWorkerDomain = "geometry" | "textures" | "custom";
|
|
450
450
|
type WorldGeneratorWorkerAuthority = "visual" | "non-authoritative-simulation" | "authoritative";
|
|
451
451
|
type WorldGeneratorWorkerImportance = "medium" | "high" | "critical";
|
|
452
|
+
type WorldGeneratorRepresentationBand = "near" | "mid" | "far" | "horizon";
|
|
453
|
+
type WorldGeneratorRepresentationOutput = "liveGeometry" | "simplifiedGeometry" | "rtProxy" | "mergedProxy" | "horizonShell";
|
|
454
|
+
type WorldGeneratorRepresentationRtParticipation = "full" | "selective" | "proxy" | "disabled";
|
|
455
|
+
type WorldGeneratorRepresentationShadowRelevance = "ray-traced-primary" | "selective-raster" | "proxy-caster" | "baked-impression";
|
|
456
|
+
interface WorldGeneratorRepresentationCadence {
|
|
457
|
+
readonly kind: "per-frame" | "interval";
|
|
458
|
+
readonly divisor: number;
|
|
459
|
+
}
|
|
460
|
+
interface WorldGeneratorRepresentationDescriptor {
|
|
461
|
+
readonly id: string;
|
|
462
|
+
readonly chunkId: string;
|
|
463
|
+
readonly profile: WorldGeneratorWorkerProfileName;
|
|
464
|
+
readonly band: WorldGeneratorRepresentationBand;
|
|
465
|
+
readonly output: WorldGeneratorRepresentationOutput;
|
|
466
|
+
readonly rasterMode: "full-live" | "simplified-live" | "proxy" | "not-rendered" | "horizon-shell";
|
|
467
|
+
readonly rtParticipation: WorldGeneratorRepresentationRtParticipation;
|
|
468
|
+
readonly shadowRelevance: WorldGeneratorRepresentationShadowRelevance;
|
|
469
|
+
readonly refreshCadence: WorldGeneratorRepresentationCadence;
|
|
470
|
+
readonly preservesChunkIdentity: boolean;
|
|
471
|
+
readonly sourceChunkIds: readonly string[];
|
|
472
|
+
readonly sourceJobKeys: readonly string[];
|
|
473
|
+
readonly suggestedAllocationIds: readonly string[];
|
|
474
|
+
readonly scheduling: Readonly<{
|
|
475
|
+
owner: "renderer";
|
|
476
|
+
queueClass: typeof worldGeneratorWorkerQueueClass;
|
|
477
|
+
priorityHint: number;
|
|
478
|
+
gameplayImportance: WorldGeneratorWorkerImportance;
|
|
479
|
+
representationBand: WorldGeneratorRepresentationBand;
|
|
480
|
+
}>;
|
|
481
|
+
}
|
|
482
|
+
interface WorldGeneratorRepresentationPlan {
|
|
483
|
+
readonly schemaVersion: 1;
|
|
484
|
+
readonly owner: typeof worldGeneratorDebugOwner;
|
|
485
|
+
readonly profile: WorldGeneratorWorkerProfileName;
|
|
486
|
+
readonly chunkId: string;
|
|
487
|
+
readonly representations: readonly WorldGeneratorRepresentationDescriptor[];
|
|
488
|
+
readonly bands: readonly WorldGeneratorRepresentationBand[];
|
|
489
|
+
}
|
|
452
490
|
interface WorldGeneratorWorkerBudgetLevelConfig {
|
|
453
491
|
maxDispatchesPerFrame: number;
|
|
454
492
|
maxJobsPerDispatch: number;
|
|
@@ -512,10 +550,17 @@ interface WorldGeneratorWorkerManifest {
|
|
|
512
550
|
declare const worldGeneratorDebugOwner = "world-generator";
|
|
513
551
|
declare const worldGeneratorWorkerQueueClass = "voxel";
|
|
514
552
|
declare const defaultWorldGeneratorWorkerProfile = "streaming";
|
|
553
|
+
declare const worldGeneratorRepresentationBands: readonly WorldGeneratorRepresentationBand[];
|
|
554
|
+
declare const worldGeneratorRepresentationOutputs: readonly WorldGeneratorRepresentationOutput[];
|
|
515
555
|
declare const worldGeneratorWorkerProfiles: Readonly<Record<WorldGeneratorWorkerProfileName, WorldGeneratorWorkerProfile>>;
|
|
516
556
|
declare const worldGeneratorWorkerProfileNames: readonly WorldGeneratorWorkerProfileName[];
|
|
517
557
|
declare const worldGeneratorWorkerManifests: Readonly<Record<WorldGeneratorWorkerProfileName, WorldGeneratorWorkerManifest>>;
|
|
518
558
|
declare function getWorldGeneratorWorkerProfile(name?: WorldGeneratorWorkerProfileName): WorldGeneratorWorkerProfile;
|
|
519
559
|
declare function getWorldGeneratorWorkerManifest(name?: WorldGeneratorWorkerProfileName): WorldGeneratorWorkerManifest;
|
|
560
|
+
declare function createWorldGeneratorRepresentationPlan(options: {
|
|
561
|
+
profile?: WorldGeneratorWorkerProfileName;
|
|
562
|
+
chunkId: string;
|
|
563
|
+
gameplayImportance?: WorldGeneratorWorkerImportance;
|
|
564
|
+
}): WorldGeneratorRepresentationPlan;
|
|
520
565
|
|
|
521
|
-
export { DEFAULT_TILE_SIZE_WORLD, FIELD_DOWNWARD_MAX, FIELD_UPWARD_MIN, FRACTAL_ASSET_VERSION, FRACTAL_SAMPLE_STRIDE, type FieldParams, type FieldSample, type FractalAsset, type FractalAssetPayload, type FractalMandelSettings, type FractalPrepassRunOptions, type FractalPrepassRunner, type HexCell, type HexLevelSpec, MacroBiome, type MacroBiomeId, MacroBiomeLabel, type MeshBuilder, type MeshBuilderOptions, type MeshGeomorph, MicroFeature, type MicroFeatureId, MicroFeatureLabel, type MixedForestLayer, type MixedForestOptions, type PerfMonitor, type PerfMonitorOptions, type PerfMonitorUpdate, SlopeBand, type SlopeBandId, SlopeBandLabel, SurfaceCover, type SurfaceCoverId, SurfaceCoverLabel, TILE_ASSET_VERSION, TerrainBiome, type TerrainBiomeId, TerrainBiomeLabel, type TerrainCell, type TerrainParams, type TileAsset, type TileAssetPayload, type TileBakeOutput, type TileBakeWriter, TileCache, type TileCacheEntry, type TileCacheOptions, type TileCacheStatus, type TileGenerator, type TileKey, type Vec3, type WorldGeneratorWorkerAuthority, type WorldGeneratorWorkerBudgetLevel, type WorldGeneratorWorkerBudgetLevelConfig, type WorldGeneratorWorkerDomain, type WorldGeneratorWorkerImportance, type WorldGeneratorWorkerManifest, type WorldGeneratorWorkerManifestJob, type WorldGeneratorWorkerProfile, type WorldGeneratorWorkerProfileName, type WorldGeneratorWorkerQueueClass, assetMatches, axialToWorld, bakeTileAsset, buildHexLevels, classifySlopeBand, computeNormal, createFractalPrepassRunner, createMeshBuilder, createPerfMonitor, defaultFieldParams, defaultFractalMandelSettings, defaultWorldGeneratorWorkerProfile, encodeTerrainParams, fieldWgslUrl, fractalPrepassWgslUrl, generateHexGrid, generateTemperateMixedForest, getWorldGeneratorWorkerManifest, getWorldGeneratorWorkerProfile, hexAreaFromSide, hexSideFromArea, loadFieldWgsl, loadFractalPrepassWgsl, loadTerrainWgsl, normalize, normalizeTileKey, packHexCells, parseFractalAsset, parseTileAssetBinary, parseTileAssetJson, resolveTileSizeWorld, sampleFieldStack, serializeFractalAsset, serializeTileAssetBinary, serializeTileAssetBinaryFromJson, serializeTileAssetJson, serializeTileAssetJsonFromBinary, shade, terrainWgslUrl, tileAssetFileStem, tileBoundsWorld, tileKeyFromWorldPosition, tileKeyToString, unpackTerrain, validateTileAssetPayload, worldGeneratorDebugOwner, worldGeneratorWorkerManifests, worldGeneratorWorkerProfileNames, worldGeneratorWorkerProfiles, worldGeneratorWorkerQueueClass };
|
|
566
|
+
export { DEFAULT_TILE_SIZE_WORLD, FIELD_DOWNWARD_MAX, FIELD_UPWARD_MIN, FRACTAL_ASSET_VERSION, FRACTAL_SAMPLE_STRIDE, type FieldParams, type FieldSample, type FractalAsset, type FractalAssetPayload, type FractalMandelSettings, type FractalPrepassRunOptions, type FractalPrepassRunner, type HexCell, type HexLevelSpec, MacroBiome, type MacroBiomeId, MacroBiomeLabel, type MeshBuilder, type MeshBuilderOptions, type MeshGeomorph, MicroFeature, type MicroFeatureId, MicroFeatureLabel, type MixedForestLayer, type MixedForestOptions, type PerfMonitor, type PerfMonitorOptions, type PerfMonitorUpdate, SlopeBand, type SlopeBandId, SlopeBandLabel, SurfaceCover, type SurfaceCoverId, SurfaceCoverLabel, TILE_ASSET_VERSION, TerrainBiome, type TerrainBiomeId, TerrainBiomeLabel, type TerrainCell, type TerrainParams, type TileAsset, type TileAssetPayload, type TileBakeOutput, type TileBakeWriter, TileCache, type TileCacheEntry, type TileCacheOptions, type TileCacheStatus, type TileGenerator, type TileKey, type Vec3, type WorldGeneratorRepresentationBand, type WorldGeneratorRepresentationCadence, type WorldGeneratorRepresentationDescriptor, type WorldGeneratorRepresentationOutput, type WorldGeneratorRepresentationPlan, type WorldGeneratorRepresentationRtParticipation, type WorldGeneratorRepresentationShadowRelevance, type WorldGeneratorWorkerAuthority, type WorldGeneratorWorkerBudgetLevel, type WorldGeneratorWorkerBudgetLevelConfig, type WorldGeneratorWorkerDomain, type WorldGeneratorWorkerImportance, type WorldGeneratorWorkerManifest, type WorldGeneratorWorkerManifestJob, type WorldGeneratorWorkerProfile, type WorldGeneratorWorkerProfileName, type WorldGeneratorWorkerQueueClass, assetMatches, axialToWorld, bakeTileAsset, buildHexLevels, classifySlopeBand, computeNormal, createFractalPrepassRunner, createMeshBuilder, createPerfMonitor, createWorldGeneratorRepresentationPlan, defaultFieldParams, defaultFractalMandelSettings, defaultWorldGeneratorWorkerProfile, encodeTerrainParams, fieldWgslUrl, fractalPrepassWgslUrl, generateHexGrid, generateTemperateMixedForest, getWorldGeneratorWorkerManifest, getWorldGeneratorWorkerProfile, hexAreaFromSide, hexSideFromArea, loadFieldWgsl, loadFractalPrepassWgsl, loadTerrainWgsl, normalize, normalizeTileKey, packHexCells, parseFractalAsset, parseTileAssetBinary, parseTileAssetJson, resolveTileSizeWorld, sampleFieldStack, serializeFractalAsset, serializeTileAssetBinary, serializeTileAssetBinaryFromJson, serializeTileAssetJson, serializeTileAssetJsonFromBinary, shade, terrainWgslUrl, tileAssetFileStem, tileBoundsWorld, tileKeyFromWorldPosition, tileKeyToString, unpackTerrain, validateTileAssetPayload, worldGeneratorDebugOwner, worldGeneratorRepresentationBands, worldGeneratorRepresentationOutputs, worldGeneratorWorkerManifests, worldGeneratorWorkerProfileNames, worldGeneratorWorkerProfiles, worldGeneratorWorkerQueueClass };
|
package/dist/index.d.ts
CHANGED
|
@@ -449,6 +449,44 @@ type WorldGeneratorWorkerProfileName = "streaming" | "bake";
|
|
|
449
449
|
type WorldGeneratorWorkerDomain = "geometry" | "textures" | "custom";
|
|
450
450
|
type WorldGeneratorWorkerAuthority = "visual" | "non-authoritative-simulation" | "authoritative";
|
|
451
451
|
type WorldGeneratorWorkerImportance = "medium" | "high" | "critical";
|
|
452
|
+
type WorldGeneratorRepresentationBand = "near" | "mid" | "far" | "horizon";
|
|
453
|
+
type WorldGeneratorRepresentationOutput = "liveGeometry" | "simplifiedGeometry" | "rtProxy" | "mergedProxy" | "horizonShell";
|
|
454
|
+
type WorldGeneratorRepresentationRtParticipation = "full" | "selective" | "proxy" | "disabled";
|
|
455
|
+
type WorldGeneratorRepresentationShadowRelevance = "ray-traced-primary" | "selective-raster" | "proxy-caster" | "baked-impression";
|
|
456
|
+
interface WorldGeneratorRepresentationCadence {
|
|
457
|
+
readonly kind: "per-frame" | "interval";
|
|
458
|
+
readonly divisor: number;
|
|
459
|
+
}
|
|
460
|
+
interface WorldGeneratorRepresentationDescriptor {
|
|
461
|
+
readonly id: string;
|
|
462
|
+
readonly chunkId: string;
|
|
463
|
+
readonly profile: WorldGeneratorWorkerProfileName;
|
|
464
|
+
readonly band: WorldGeneratorRepresentationBand;
|
|
465
|
+
readonly output: WorldGeneratorRepresentationOutput;
|
|
466
|
+
readonly rasterMode: "full-live" | "simplified-live" | "proxy" | "not-rendered" | "horizon-shell";
|
|
467
|
+
readonly rtParticipation: WorldGeneratorRepresentationRtParticipation;
|
|
468
|
+
readonly shadowRelevance: WorldGeneratorRepresentationShadowRelevance;
|
|
469
|
+
readonly refreshCadence: WorldGeneratorRepresentationCadence;
|
|
470
|
+
readonly preservesChunkIdentity: boolean;
|
|
471
|
+
readonly sourceChunkIds: readonly string[];
|
|
472
|
+
readonly sourceJobKeys: readonly string[];
|
|
473
|
+
readonly suggestedAllocationIds: readonly string[];
|
|
474
|
+
readonly scheduling: Readonly<{
|
|
475
|
+
owner: "renderer";
|
|
476
|
+
queueClass: typeof worldGeneratorWorkerQueueClass;
|
|
477
|
+
priorityHint: number;
|
|
478
|
+
gameplayImportance: WorldGeneratorWorkerImportance;
|
|
479
|
+
representationBand: WorldGeneratorRepresentationBand;
|
|
480
|
+
}>;
|
|
481
|
+
}
|
|
482
|
+
interface WorldGeneratorRepresentationPlan {
|
|
483
|
+
readonly schemaVersion: 1;
|
|
484
|
+
readonly owner: typeof worldGeneratorDebugOwner;
|
|
485
|
+
readonly profile: WorldGeneratorWorkerProfileName;
|
|
486
|
+
readonly chunkId: string;
|
|
487
|
+
readonly representations: readonly WorldGeneratorRepresentationDescriptor[];
|
|
488
|
+
readonly bands: readonly WorldGeneratorRepresentationBand[];
|
|
489
|
+
}
|
|
452
490
|
interface WorldGeneratorWorkerBudgetLevelConfig {
|
|
453
491
|
maxDispatchesPerFrame: number;
|
|
454
492
|
maxJobsPerDispatch: number;
|
|
@@ -512,10 +550,17 @@ interface WorldGeneratorWorkerManifest {
|
|
|
512
550
|
declare const worldGeneratorDebugOwner = "world-generator";
|
|
513
551
|
declare const worldGeneratorWorkerQueueClass = "voxel";
|
|
514
552
|
declare const defaultWorldGeneratorWorkerProfile = "streaming";
|
|
553
|
+
declare const worldGeneratorRepresentationBands: readonly WorldGeneratorRepresentationBand[];
|
|
554
|
+
declare const worldGeneratorRepresentationOutputs: readonly WorldGeneratorRepresentationOutput[];
|
|
515
555
|
declare const worldGeneratorWorkerProfiles: Readonly<Record<WorldGeneratorWorkerProfileName, WorldGeneratorWorkerProfile>>;
|
|
516
556
|
declare const worldGeneratorWorkerProfileNames: readonly WorldGeneratorWorkerProfileName[];
|
|
517
557
|
declare const worldGeneratorWorkerManifests: Readonly<Record<WorldGeneratorWorkerProfileName, WorldGeneratorWorkerManifest>>;
|
|
518
558
|
declare function getWorldGeneratorWorkerProfile(name?: WorldGeneratorWorkerProfileName): WorldGeneratorWorkerProfile;
|
|
519
559
|
declare function getWorldGeneratorWorkerManifest(name?: WorldGeneratorWorkerProfileName): WorldGeneratorWorkerManifest;
|
|
560
|
+
declare function createWorldGeneratorRepresentationPlan(options: {
|
|
561
|
+
profile?: WorldGeneratorWorkerProfileName;
|
|
562
|
+
chunkId: string;
|
|
563
|
+
gameplayImportance?: WorldGeneratorWorkerImportance;
|
|
564
|
+
}): WorldGeneratorRepresentationPlan;
|
|
520
565
|
|
|
521
|
-
export { DEFAULT_TILE_SIZE_WORLD, FIELD_DOWNWARD_MAX, FIELD_UPWARD_MIN, FRACTAL_ASSET_VERSION, FRACTAL_SAMPLE_STRIDE, type FieldParams, type FieldSample, type FractalAsset, type FractalAssetPayload, type FractalMandelSettings, type FractalPrepassRunOptions, type FractalPrepassRunner, type HexCell, type HexLevelSpec, MacroBiome, type MacroBiomeId, MacroBiomeLabel, type MeshBuilder, type MeshBuilderOptions, type MeshGeomorph, MicroFeature, type MicroFeatureId, MicroFeatureLabel, type MixedForestLayer, type MixedForestOptions, type PerfMonitor, type PerfMonitorOptions, type PerfMonitorUpdate, SlopeBand, type SlopeBandId, SlopeBandLabel, SurfaceCover, type SurfaceCoverId, SurfaceCoverLabel, TILE_ASSET_VERSION, TerrainBiome, type TerrainBiomeId, TerrainBiomeLabel, type TerrainCell, type TerrainParams, type TileAsset, type TileAssetPayload, type TileBakeOutput, type TileBakeWriter, TileCache, type TileCacheEntry, type TileCacheOptions, type TileCacheStatus, type TileGenerator, type TileKey, type Vec3, type WorldGeneratorWorkerAuthority, type WorldGeneratorWorkerBudgetLevel, type WorldGeneratorWorkerBudgetLevelConfig, type WorldGeneratorWorkerDomain, type WorldGeneratorWorkerImportance, type WorldGeneratorWorkerManifest, type WorldGeneratorWorkerManifestJob, type WorldGeneratorWorkerProfile, type WorldGeneratorWorkerProfileName, type WorldGeneratorWorkerQueueClass, assetMatches, axialToWorld, bakeTileAsset, buildHexLevels, classifySlopeBand, computeNormal, createFractalPrepassRunner, createMeshBuilder, createPerfMonitor, defaultFieldParams, defaultFractalMandelSettings, defaultWorldGeneratorWorkerProfile, encodeTerrainParams, fieldWgslUrl, fractalPrepassWgslUrl, generateHexGrid, generateTemperateMixedForest, getWorldGeneratorWorkerManifest, getWorldGeneratorWorkerProfile, hexAreaFromSide, hexSideFromArea, loadFieldWgsl, loadFractalPrepassWgsl, loadTerrainWgsl, normalize, normalizeTileKey, packHexCells, parseFractalAsset, parseTileAssetBinary, parseTileAssetJson, resolveTileSizeWorld, sampleFieldStack, serializeFractalAsset, serializeTileAssetBinary, serializeTileAssetBinaryFromJson, serializeTileAssetJson, serializeTileAssetJsonFromBinary, shade, terrainWgslUrl, tileAssetFileStem, tileBoundsWorld, tileKeyFromWorldPosition, tileKeyToString, unpackTerrain, validateTileAssetPayload, worldGeneratorDebugOwner, worldGeneratorWorkerManifests, worldGeneratorWorkerProfileNames, worldGeneratorWorkerProfiles, worldGeneratorWorkerQueueClass };
|
|
566
|
+
export { DEFAULT_TILE_SIZE_WORLD, FIELD_DOWNWARD_MAX, FIELD_UPWARD_MIN, FRACTAL_ASSET_VERSION, FRACTAL_SAMPLE_STRIDE, type FieldParams, type FieldSample, type FractalAsset, type FractalAssetPayload, type FractalMandelSettings, type FractalPrepassRunOptions, type FractalPrepassRunner, type HexCell, type HexLevelSpec, MacroBiome, type MacroBiomeId, MacroBiomeLabel, type MeshBuilder, type MeshBuilderOptions, type MeshGeomorph, MicroFeature, type MicroFeatureId, MicroFeatureLabel, type MixedForestLayer, type MixedForestOptions, type PerfMonitor, type PerfMonitorOptions, type PerfMonitorUpdate, SlopeBand, type SlopeBandId, SlopeBandLabel, SurfaceCover, type SurfaceCoverId, SurfaceCoverLabel, TILE_ASSET_VERSION, TerrainBiome, type TerrainBiomeId, TerrainBiomeLabel, type TerrainCell, type TerrainParams, type TileAsset, type TileAssetPayload, type TileBakeOutput, type TileBakeWriter, TileCache, type TileCacheEntry, type TileCacheOptions, type TileCacheStatus, type TileGenerator, type TileKey, type Vec3, type WorldGeneratorRepresentationBand, type WorldGeneratorRepresentationCadence, type WorldGeneratorRepresentationDescriptor, type WorldGeneratorRepresentationOutput, type WorldGeneratorRepresentationPlan, type WorldGeneratorRepresentationRtParticipation, type WorldGeneratorRepresentationShadowRelevance, type WorldGeneratorWorkerAuthority, type WorldGeneratorWorkerBudgetLevel, type WorldGeneratorWorkerBudgetLevelConfig, type WorldGeneratorWorkerDomain, type WorldGeneratorWorkerImportance, type WorldGeneratorWorkerManifest, type WorldGeneratorWorkerManifestJob, type WorldGeneratorWorkerProfile, type WorldGeneratorWorkerProfileName, type WorldGeneratorWorkerQueueClass, assetMatches, axialToWorld, bakeTileAsset, buildHexLevels, classifySlopeBand, computeNormal, createFractalPrepassRunner, createMeshBuilder, createPerfMonitor, createWorldGeneratorRepresentationPlan, defaultFieldParams, defaultFractalMandelSettings, defaultWorldGeneratorWorkerProfile, encodeTerrainParams, fieldWgslUrl, fractalPrepassWgslUrl, generateHexGrid, generateTemperateMixedForest, getWorldGeneratorWorkerManifest, getWorldGeneratorWorkerProfile, hexAreaFromSide, hexSideFromArea, loadFieldWgsl, loadFractalPrepassWgsl, loadTerrainWgsl, normalize, normalizeTileKey, packHexCells, parseFractalAsset, parseTileAssetBinary, parseTileAssetJson, resolveTileSizeWorld, sampleFieldStack, serializeFractalAsset, serializeTileAssetBinary, serializeTileAssetBinaryFromJson, serializeTileAssetJson, serializeTileAssetJsonFromBinary, shade, terrainWgslUrl, tileAssetFileStem, tileBoundsWorld, tileKeyFromWorldPosition, tileKeyToString, unpackTerrain, validateTileAssetPayload, worldGeneratorDebugOwner, worldGeneratorRepresentationBands, worldGeneratorRepresentationOutputs, worldGeneratorWorkerManifests, worldGeneratorWorkerProfileNames, worldGeneratorWorkerProfiles, worldGeneratorWorkerQueueClass };
|
package/dist/index.js
CHANGED
|
@@ -1303,7 +1303,6 @@ function serializeTileAssetBinary(asset) {
|
|
|
1303
1303
|
view.setUint32(cursor, materialStride >>> 0, true);
|
|
1304
1304
|
cursor += 4;
|
|
1305
1305
|
view.setUint32(cursor, featureStride >>> 0, true);
|
|
1306
|
-
cursor += 4;
|
|
1307
1306
|
let writeOffset = HEADER_BYTES;
|
|
1308
1307
|
new Float32Array(buffer, writeOffset, heightCount).set(asset.height);
|
|
1309
1308
|
writeOffset += heightBytes;
|
|
@@ -1368,7 +1367,6 @@ function parseTileAssetBinary(input) {
|
|
|
1368
1367
|
const materialStride = view.getUint32(cursor, true);
|
|
1369
1368
|
cursor += 4;
|
|
1370
1369
|
const featureStride = view.getUint32(cursor, true);
|
|
1371
|
-
cursor += 4;
|
|
1372
1370
|
const heightBytes = heightCount * 4;
|
|
1373
1371
|
const fieldBytes = fieldCount * 4;
|
|
1374
1372
|
const materialBytes = materialCount;
|
|
@@ -1789,6 +1787,64 @@ function createMeshBuilder(sizeOrOptions = 1) {
|
|
|
1789
1787
|
var worldGeneratorDebugOwner = "world-generator";
|
|
1790
1788
|
var worldGeneratorWorkerQueueClass = "voxel";
|
|
1791
1789
|
var defaultWorldGeneratorWorkerProfile = "streaming";
|
|
1790
|
+
var worldGeneratorRepresentationBands = Object.freeze([
|
|
1791
|
+
"near",
|
|
1792
|
+
"mid",
|
|
1793
|
+
"far",
|
|
1794
|
+
"horizon"
|
|
1795
|
+
]);
|
|
1796
|
+
var worldGeneratorRepresentationOutputs = Object.freeze([
|
|
1797
|
+
"liveGeometry",
|
|
1798
|
+
"simplifiedGeometry",
|
|
1799
|
+
"rtProxy",
|
|
1800
|
+
"mergedProxy",
|
|
1801
|
+
"horizonShell"
|
|
1802
|
+
]);
|
|
1803
|
+
var worldGeneratorRepresentationBandPriorityHints = Object.freeze({
|
|
1804
|
+
near: 400,
|
|
1805
|
+
mid: 300,
|
|
1806
|
+
far: 200,
|
|
1807
|
+
horizon: 100
|
|
1808
|
+
});
|
|
1809
|
+
function assertWorldGeneratorIdentifier(name, value) {
|
|
1810
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
1811
|
+
throw new Error(`${name} must be a non-empty string.`);
|
|
1812
|
+
}
|
|
1813
|
+
return value.trim();
|
|
1814
|
+
}
|
|
1815
|
+
function normalizeWorldGeneratorImportance(name, value) {
|
|
1816
|
+
if (value === "medium" || value === "high" || value === "critical") {
|
|
1817
|
+
return value;
|
|
1818
|
+
}
|
|
1819
|
+
throw new Error(`${name} must be one of: medium, high, critical.`);
|
|
1820
|
+
}
|
|
1821
|
+
function buildWorldGeneratorRepresentationDescriptor(options) {
|
|
1822
|
+
return Object.freeze({
|
|
1823
|
+
id: `${options.chunkId}.${options.band}.${options.output}`,
|
|
1824
|
+
chunkId: options.chunkId,
|
|
1825
|
+
profile: options.profile,
|
|
1826
|
+
band: options.band,
|
|
1827
|
+
output: options.output,
|
|
1828
|
+
rasterMode: options.rasterMode,
|
|
1829
|
+
rtParticipation: options.rtParticipation,
|
|
1830
|
+
shadowRelevance: options.shadowRelevance,
|
|
1831
|
+
refreshCadence: Object.freeze({
|
|
1832
|
+
kind: options.refreshCadence.kind,
|
|
1833
|
+
divisor: options.refreshCadence.divisor
|
|
1834
|
+
}),
|
|
1835
|
+
preservesChunkIdentity: options.preservesChunkIdentity,
|
|
1836
|
+
sourceChunkIds: Object.freeze([options.chunkId]),
|
|
1837
|
+
sourceJobKeys: Object.freeze([...options.sourceJobKeys]),
|
|
1838
|
+
suggestedAllocationIds: Object.freeze([...options.suggestedAllocationIds]),
|
|
1839
|
+
scheduling: Object.freeze({
|
|
1840
|
+
owner: "renderer",
|
|
1841
|
+
queueClass: worldGeneratorWorkerQueueClass,
|
|
1842
|
+
priorityHint: worldGeneratorRepresentationBandPriorityHints[options.band],
|
|
1843
|
+
gameplayImportance: options.gameplayImportance,
|
|
1844
|
+
representationBand: options.band
|
|
1845
|
+
})
|
|
1846
|
+
});
|
|
1847
|
+
}
|
|
1792
1848
|
function buildBudgetLevels(jobType, queueClass, levels) {
|
|
1793
1849
|
return Object.freeze(
|
|
1794
1850
|
levels.map(
|
|
@@ -2369,6 +2425,108 @@ function getWorldGeneratorWorkerManifest(name = defaultWorldGeneratorWorkerProfi
|
|
|
2369
2425
|
}
|
|
2370
2426
|
return manifest;
|
|
2371
2427
|
}
|
|
2428
|
+
function createWorldGeneratorRepresentationPlan(options) {
|
|
2429
|
+
const profile = options.profile ?? defaultWorldGeneratorWorkerProfile;
|
|
2430
|
+
const spec = worldGeneratorWorkerProfileSpecs[profile];
|
|
2431
|
+
if (!spec) {
|
|
2432
|
+
const available = worldGeneratorWorkerProfileNames.join(", ");
|
|
2433
|
+
throw new Error(
|
|
2434
|
+
`Unknown world-generator worker profile "${profile}". Available: ${available}.`
|
|
2435
|
+
);
|
|
2436
|
+
}
|
|
2437
|
+
const chunkId = assertWorldGeneratorIdentifier("chunkId", options.chunkId);
|
|
2438
|
+
const gameplayImportance = normalizeWorldGeneratorImportance(
|
|
2439
|
+
"gameplayImportance",
|
|
2440
|
+
options.gameplayImportance ?? "high"
|
|
2441
|
+
);
|
|
2442
|
+
const highValueAllocations = spec.suggestedAllocationIds;
|
|
2443
|
+
const farFieldAllocations = spec.suggestedAllocationIds.filter(
|
|
2444
|
+
(allocationId) => allocationId.includes("mesh") || allocationId.includes("asset") || allocationId.includes("tile")
|
|
2445
|
+
);
|
|
2446
|
+
const bakeSourceJobKeys = profile === "bake" ? ["meshBuild", "tileBake", "assetSerialize"] : ["meshBuild", "tileBake"];
|
|
2447
|
+
const representations = Object.freeze([
|
|
2448
|
+
buildWorldGeneratorRepresentationDescriptor({
|
|
2449
|
+
profile,
|
|
2450
|
+
chunkId,
|
|
2451
|
+
band: "near",
|
|
2452
|
+
output: "liveGeometry",
|
|
2453
|
+
rasterMode: "full-live",
|
|
2454
|
+
rtParticipation: "full",
|
|
2455
|
+
shadowRelevance: "ray-traced-primary",
|
|
2456
|
+
refreshCadence: { kind: "per-frame", divisor: 1 },
|
|
2457
|
+
preservesChunkIdentity: true,
|
|
2458
|
+
sourceJobKeys: ["meshBuild"],
|
|
2459
|
+
gameplayImportance: gameplayImportance === "medium" ? "high" : gameplayImportance,
|
|
2460
|
+
suggestedAllocationIds: highValueAllocations
|
|
2461
|
+
}),
|
|
2462
|
+
buildWorldGeneratorRepresentationDescriptor({
|
|
2463
|
+
profile,
|
|
2464
|
+
chunkId,
|
|
2465
|
+
band: "mid",
|
|
2466
|
+
output: "simplifiedGeometry",
|
|
2467
|
+
rasterMode: "simplified-live",
|
|
2468
|
+
rtParticipation: "selective",
|
|
2469
|
+
shadowRelevance: "selective-raster",
|
|
2470
|
+
refreshCadence: { kind: "interval", divisor: 2 },
|
|
2471
|
+
preservesChunkIdentity: true,
|
|
2472
|
+
sourceJobKeys: ["meshBuild"],
|
|
2473
|
+
gameplayImportance,
|
|
2474
|
+
suggestedAllocationIds: highValueAllocations
|
|
2475
|
+
}),
|
|
2476
|
+
buildWorldGeneratorRepresentationDescriptor({
|
|
2477
|
+
profile,
|
|
2478
|
+
chunkId,
|
|
2479
|
+
band: "mid",
|
|
2480
|
+
output: "rtProxy",
|
|
2481
|
+
rasterMode: "not-rendered",
|
|
2482
|
+
rtParticipation: "proxy",
|
|
2483
|
+
shadowRelevance: "selective-raster",
|
|
2484
|
+
refreshCadence: { kind: "interval", divisor: 2 },
|
|
2485
|
+
preservesChunkIdentity: true,
|
|
2486
|
+
sourceJobKeys: ["meshBuild", "tileBake"],
|
|
2487
|
+
gameplayImportance,
|
|
2488
|
+
suggestedAllocationIds: highValueAllocations
|
|
2489
|
+
}),
|
|
2490
|
+
buildWorldGeneratorRepresentationDescriptor({
|
|
2491
|
+
profile,
|
|
2492
|
+
chunkId,
|
|
2493
|
+
band: "far",
|
|
2494
|
+
output: "mergedProxy",
|
|
2495
|
+
rasterMode: "proxy",
|
|
2496
|
+
rtParticipation: "proxy",
|
|
2497
|
+
shadowRelevance: "proxy-caster",
|
|
2498
|
+
refreshCadence: { kind: "interval", divisor: 8 },
|
|
2499
|
+
preservesChunkIdentity: true,
|
|
2500
|
+
sourceJobKeys: bakeSourceJobKeys,
|
|
2501
|
+
gameplayImportance: "medium",
|
|
2502
|
+
suggestedAllocationIds: farFieldAllocations.length > 0 ? farFieldAllocations : highValueAllocations
|
|
2503
|
+
}),
|
|
2504
|
+
buildWorldGeneratorRepresentationDescriptor({
|
|
2505
|
+
profile,
|
|
2506
|
+
chunkId,
|
|
2507
|
+
band: "horizon",
|
|
2508
|
+
output: "horizonShell",
|
|
2509
|
+
rasterMode: "horizon-shell",
|
|
2510
|
+
rtParticipation: "disabled",
|
|
2511
|
+
shadowRelevance: "baked-impression",
|
|
2512
|
+
refreshCadence: { kind: "interval", divisor: 60 },
|
|
2513
|
+
preservesChunkIdentity: true,
|
|
2514
|
+
sourceJobKeys: profile === "bake" ? ["tileBake", "assetSerialize"] : ["tileBake"],
|
|
2515
|
+
gameplayImportance: "medium",
|
|
2516
|
+
suggestedAllocationIds: farFieldAllocations.length > 0 ? farFieldAllocations : highValueAllocations
|
|
2517
|
+
})
|
|
2518
|
+
]);
|
|
2519
|
+
return Object.freeze({
|
|
2520
|
+
schemaVersion: 1,
|
|
2521
|
+
owner: worldGeneratorDebugOwner,
|
|
2522
|
+
profile,
|
|
2523
|
+
chunkId,
|
|
2524
|
+
representations,
|
|
2525
|
+
bands: Object.freeze(
|
|
2526
|
+
[...new Set(representations.map((representation) => representation.band))]
|
|
2527
|
+
)
|
|
2528
|
+
});
|
|
2529
|
+
}
|
|
2372
2530
|
export {
|
|
2373
2531
|
DEFAULT_TILE_SIZE_WORLD,
|
|
2374
2532
|
FIELD_DOWNWARD_MAX,
|
|
@@ -2396,6 +2554,7 @@ export {
|
|
|
2396
2554
|
createFractalPrepassRunner,
|
|
2397
2555
|
createMeshBuilder,
|
|
2398
2556
|
createPerfMonitor,
|
|
2557
|
+
createWorldGeneratorRepresentationPlan,
|
|
2399
2558
|
defaultFieldParams,
|
|
2400
2559
|
defaultFractalMandelSettings,
|
|
2401
2560
|
defaultWorldGeneratorWorkerProfile,
|
|
@@ -2433,6 +2592,8 @@ export {
|
|
|
2433
2592
|
unpackTerrain,
|
|
2434
2593
|
validateTileAssetPayload,
|
|
2435
2594
|
worldGeneratorDebugOwner,
|
|
2595
|
+
worldGeneratorRepresentationBands,
|
|
2596
|
+
worldGeneratorRepresentationOutputs,
|
|
2436
2597
|
worldGeneratorWorkerManifests,
|
|
2437
2598
|
worldGeneratorWorkerProfileNames,
|
|
2438
2599
|
worldGeneratorWorkerProfiles,
|