@divinevoxel/vlox 0.0.73 → 0.0.74
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/Contexts/Base/Remote/InitDataSync.js +4 -0
- package/Contexts/Base/Remote/InitWorldDataSync.js +1 -1
- package/Contexts/Render/DivineVoxelEngineRender.d.ts +1 -0
- package/Contexts/World/DivineVoxelEngineWorld.d.ts +1 -0
- package/Init/StartConstructor.js +2 -0
- package/Math/index.d.ts +5 -1
- package/Mesher/Functions/CompactVoxelSectionMesh.d.ts +4 -0
- package/Mesher/Functions/CompactVoxelSectionMesh.js +112 -0
- package/Mesher/Functions/MeshSection.d.ts +1 -1
- package/Mesher/Functions/MeshSection.js +15 -22
- package/Mesher/Geomtry/CompactedSectionVoxelMesh.d.ts +23 -0
- package/Mesher/Geomtry/CompactedSectionVoxelMesh.js +144 -0
- package/Mesher/Geomtry/VoxelGeometryBuilder.d.ts +1 -1
- package/Mesher/Geomtry/VoxelGeometryBuilder.js +118 -197
- package/Mesher/Geomtry/VoxelMesh.js +2 -2
- package/Mesher/Geomtry/VoxelMeshBVHBuilder.d.ts +8 -70
- package/Mesher/Geomtry/VoxelMeshBVHBuilder.js +18 -183
- package/Mesher/Geomtry/VoxelMeshBVHStructCursor.d.ts +22 -0
- package/Mesher/Geomtry/VoxelMeshBVHStructCursor.js +78 -0
- package/Mesher/Geomtry/VoxelMeshBuffers.js +2 -2
- package/Mesher/InitTask.js +5 -1
- package/Mesher/Models/Common/BoxGeometryNode.js +7 -7
- package/Mesher/Models/Common/Calc/CalcConstants.d.ts +1 -1
- package/Mesher/Models/Common/Calc/CalcConstants.js +1 -1
- package/Mesher/Models/Common/QuadGeometryNode.js +2 -2
- package/Mesher/Models/Nodes/Custom/Liquid/LiquidGeomtryNode.js +7 -7
- package/Mesher/Models/Nodes/Ruled/BoxVoxelGeometryNode.js +22 -25
- package/Mesher/Models/Nodes/Ruled/QuadVoxelGeometryNode.js +2 -2
- package/Mesher/Models/Nodes/Ruleless/RulelessBoxVoxelGeometryNode.js +2 -2
- package/Mesher/Models/Nodes/Ruleless/RulelessQuadVoxelGeometryNode.js +2 -2
- package/Mesher/Models/VoxelConstructor.d.ts +3 -3
- package/Mesher/Models/VoxelConstructor.js +8 -8
- package/Mesher/Models/VoxelGeometryBuilderCacheSpace.d.ts +2 -2
- package/Mesher/Models/VoxelGeometryBuilderCacheSpace.js +8 -9
- package/Mesher/Models/VoxelModelBuilder.js +1 -8
- package/Mesher/Types/Mesher.types.d.ts +1 -0
- package/Models/Defaults/CubeVoxelModels.js +16 -39
- package/Models/Defaults/LiquidVoxelModel.js +3 -3
- package/Models/Defaults/PanelVoxelModels.js +10 -36
- package/Models/Defaults/StairVoxelModel.js +6 -21
- package/Models/Examples.js +23 -44
- package/Models/Rules/Classes/VoxelRulesModel.d.ts +1 -1
- package/Models/Rules/Classes/VoxelRulesModel.js +3 -3
- package/Models/Rules/Functions/BuildFinalInputs.d.ts +1 -1
- package/Models/Rules/Functions/BuildFinalInputs.js +13 -13
- package/Models/Rules/VoxelModelRuleBuilderRegister.js +8 -8
- package/Models/VoxelModel.types.d.ts +3 -3
- package/Renderer/Classes/DVESectionMeshes.d.ts +2 -3
- package/Renderer/InitTasks.js +1 -9
- package/Renderer/MeshManager.d.ts +1 -1
- package/Renderer/MeshManager.js +24 -23
- package/Renderer/MeshRegister.d.ts +5 -5
- package/Renderer/MeshRegister.js +2 -2
- package/Settings/EngineSettings.d.ts +1 -0
- package/Settings/EngineSettings.js +6 -3
- package/Settings/EngineSettings.types.d.ts +7 -21
- package/Settings/EngineSettings.types.js +6 -14
- package/Tasks/Logic/InitTasks.d.ts +1 -0
- package/Tasks/Logic/InitTasks.js +10 -0
- package/Tasks/Logic/VoxelLogicUpdate.d.ts +3 -0
- package/Tasks/Logic/VoxelLogicUpdate.js +71 -0
- package/Tasks/Propagation/Explosion/ExplosionManager.d.ts +2 -2
- package/Tasks/Propagation/Explosion/ExplosionManager.js +1 -2
- package/Tasks/Propagation/Flow/FlowManager.d.ts +4 -4
- package/Tasks/Propagation/Flow/FlowRemove.d.ts +2 -2
- package/Tasks/Propagation/Flow/FlowUpdate.d.ts +2 -2
- package/Tasks/Propagation/Flow/WorldFlow.d.ts +2 -2
- package/Tasks/Propagation/Illumanation/RGBUpdate.d.ts +3 -3
- package/Tasks/Propagation/Illumanation/SunUpdate.d.ts +3 -3
- package/Tasks/Propagation/Illumanation/WorldRGB.d.ts +2 -2
- package/Tasks/Propagation/Illumanation/WorldSun.d.ts +2 -2
- package/Tasks/Propagation/Illumanation/WorldSun.js +8 -15
- package/Tasks/Propagation/InitTasks.js +4 -4
- package/Tasks/Propagation/Power/PowerUpdate.d.ts +3 -0
- package/Tasks/Propagation/Power/PowerUpdate.js +80 -0
- package/Tasks/Tasks.types.d.ts +2 -2
- package/Tasks/TasksIds.d.ts +2 -1
- package/Tasks/TasksIds.js +1 -0
- package/Tasks/Update/Common.d.ts +3 -0
- package/Tasks/Update/Common.js +41 -0
- package/Tasks/Update/EreaseUpdate.d.ts +3 -0
- package/Tasks/Update/EreaseUpdate.js +66 -0
- package/Tasks/Update/InitTasks.d.ts +2 -2
- package/Tasks/Update/InitTasks.js +3 -1
- package/Tasks/Update/PaintUpdate.d.ts +3 -0
- package/Tasks/Update/PaintUpdate.js +89 -0
- package/Tasks/Update/VoxelUpdate.d.ts +2 -5
- package/Tasks/Update/VoxelUpdate.js +5 -147
- package/Tasks/{Update/UpdateTask.d.ts → VoxelUpdateTask.d.ts} +15 -7
- package/Tasks/{Update/UpdateTask.js → VoxelUpdateTask.js} +20 -7
- package/Tasks/WorldGeneration/WorldGenBrush.d.ts +3 -3
- package/Tasks/WorldGeneration/WorldGenBrush.js +2 -2
- package/Tasks/WorldGeneration/WorldGenRegister.d.ts +1 -1
- package/Templates/Functions/CreateTemplate.d.ts +1 -1
- package/Tools/Brush/AdvancedBrushTool.js +1 -1
- package/Tools/Brush/Brush.d.ts +2 -2
- package/Tools/Brush/Brush.js +1 -1
- package/Tools/Tasks/TasksTool.d.ts +1 -0
- package/Tools/Tasks/TasksTool.js +2 -0
- package/Util/Binary/BinaryBuffer.d.ts +17 -11
- package/Util/Binary/BinaryBuffer.js +65 -59
- package/Util/Binary/BinaryTree.d.ts +46 -0
- package/Util/Binary/BinaryTree.js +104 -0
- package/Voxels/Cursor/VoxelCursor.interface.d.ts +7 -2
- package/Voxels/Cursor/VoxelCursor.interface.js +46 -2
- package/Voxels/Cursor/VoxelLightData.js +1 -1
- package/Voxels/Data/VoxelTag.types.d.ts +17 -2
- package/Voxels/Data/VoxelTag.types.js +6 -1
- package/Voxels/Data/VoxelTagsRegister.js +5 -0
- package/Voxels/Functions/BuildStateData.d.ts +6 -6
- package/Voxels/Functions/BuildStateData.js +31 -31
- package/Voxels/Functions/BuildTagAndPaletteData.js +5 -0
- package/Voxels/Indexes/VoxelIndex.d.ts +2 -2
- package/Voxels/Indexes/VoxelIndex.js +16 -18
- package/Voxels/InitVoxelData.js +12 -8
- package/Voxels/Logic/Classes/Default/Types/VoxelPoweredLogicType.d.ts +5 -0
- package/Voxels/Logic/Classes/Default/Types/VoxelPoweredLogicType.js +6 -0
- package/Voxels/Logic/Classes/VoxelLogic.d.ts +11 -0
- package/Voxels/Logic/Classes/VoxelLogic.js +49 -0
- package/Voxels/Logic/Classes/VoxelLogicType.d.ts +4 -0
- package/Voxels/Logic/Classes/VoxelLogicType.js +2 -0
- package/Voxels/Logic/VoxelLogic.types.d.ts +23 -0
- package/Voxels/Logic/VoxelLogic.types.js +1 -0
- package/Voxels/Logic/VoxelLogicRegister.d.ts +9 -0
- package/Voxels/Logic/VoxelLogicRegister.js +15 -0
- package/Voxels/State/SchemaRegister.js +10 -5
- package/Voxels/State/State.types.d.ts +1 -1
- package/Voxels/State/StateTreeReader.d.ts +1 -1
- package/Voxels/State/StateTreeReader.js +2 -3
- package/Voxels/Types/Voxel.types.d.ts +3 -0
- package/Voxels/Types/VoxelModelCompiledData.types.d.ts +6 -4
- package/World/Archive/Archive.types.d.ts +31 -12
- package/World/Archive/Classes/ArchiveClasses.d.ts +66 -0
- package/World/Archive/Classes/ArchiveClasses.js +78 -0
- package/World/Archive/Classes/ImportedSection.d.ts +40 -0
- package/World/Archive/Classes/ImportedSection.js +307 -0
- package/World/Archive/Classes/ImportedSector.d.ts +23 -0
- package/World/Archive/Classes/ImportedSector.js +97 -0
- package/World/Archive/Functions/ArchiveArea.d.ts +1 -1
- package/World/Archive/Functions/ArchiveArea.js +39 -36
- package/World/Archive/Functions/ArchiveSector.js +210 -404
- package/World/Archive/Functions/CreateArchivedSection.d.ts +3 -0
- package/World/Archive/Functions/CreateArchivedSection.js +207 -0
- package/World/Archive/Functions/ImportSector.d.ts +1 -3
- package/World/Archive/Functions/ImportSector.js +13 -244
- package/World/Archive/Functions/RemoveDuplicates.d.ts +3 -0
- package/World/Archive/Functions/RemoveDuplicates.js +92 -0
- package/World/Archive/Functions/Shared.d.ts +2 -2
- package/World/Archive/Functions/Shared.js +15 -40
- package/World/Archive/InitTasks.js +7 -10
- package/World/Cursor/SectionCursor.d.ts +1 -1
- package/World/Cursor/SectorCursor.d.ts +1 -1
- package/World/Cursor/WorldCursor.d.ts +4 -3
- package/World/Cursor/WorldCursor.js +16 -13
- package/World/Cursor/WorldVoxelCursor.d.ts +0 -4
- package/World/Cursor/WorldVoxelCursor.js +23 -14
- package/World/Dimension/Dimension.d.ts +4 -1
- package/World/Dimension/Dimension.js +8 -1
- package/World/Section/Section.d.ts +17 -4
- package/World/Section/Section.js +68 -6
- package/World/Section/SectionState.d.ts +4 -2
- package/World/Section/SectionState.js +4 -2
- package/World/Sector/Sector.d.ts +7 -1
- package/World/Sector/Sector.js +37 -4
- package/World/Sector/SectorState.d.ts +3 -2
- package/World/Sector/SectorState.js +3 -2
- package/World/Types/WorldData.types.d.ts +2 -7
- package/World/WorldRegister.d.ts +9 -9
- package/World/WorldRegister.js +9 -6
- package/World/WorldSpaces.js +6 -6
- package/{Tasks/IWG → WorldSimulation}/Internal/Classes/DimensionSegment.d.ts +2 -2
- package/{Tasks/IWG → WorldSimulation}/Internal/Classes/Generator.d.ts +6 -4
- package/{Tasks/IWG → WorldSimulation}/Internal/Classes/Generator.js +9 -5
- package/WorldSimulation/Internal/Classes/Queues/BuildQueue.d.ts +5 -0
- package/WorldSimulation/Internal/Classes/Queues/BuildQueue.js +6 -0
- package/WorldSimulation/Internal/Classes/Queues/LogiccQueue.d.ts +5 -0
- package/WorldSimulation/Internal/Classes/Queues/LogiccQueue.js +6 -0
- package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorVisistedMap.js +1 -1
- package/WorldSimulation/Internal/Classes/TickQueue.d.ts +12 -0
- package/{Tasks/IWG/Internal/Classes/BuildQueue.js → WorldSimulation/Internal/Classes/TickQueue.js} +16 -7
- package/WorldSimulation/Internal/Classes/WorldSimulationTaskBase.d.ts +15 -0
- package/{Tasks/IWG/Internal/Classes/IWGTaskBase.js → WorldSimulation/Internal/Classes/WorldSimulationTaskBase.js} +6 -6
- package/{Tasks/IWG → WorldSimulation}/Internal/Functions/cullSectors.js +9 -9
- package/{Tasks/IWG → WorldSimulation}/Internal/Functions/getSectorState.d.ts +1 -1
- package/{Tasks/IWG → WorldSimulation}/Internal/Functions/getSectorState.js +4 -4
- package/WorldSimulation/Internal/Functions/runTickUpdate.d.ts +2 -0
- package/{Tasks/IWG/Internal/Functions/runBuildUpdate.js → WorldSimulation/Internal/Functions/runTickUpdate.js} +29 -19
- package/{Tasks/IWG → WorldSimulation}/Internal/Functions/runWorldUpdate.js +13 -13
- package/{Tasks/IWG → WorldSimulation}/Internal/TaskRegister.d.ts +2 -2
- package/{Tasks/IWG → WorldSimulation}/Internal/TaskRegister.js +1 -1
- package/WorldSimulation/Internal/WorldSimulationDimensions.d.ts +6 -0
- package/{Tasks/IWG/Internal/IWGDimensions.js → WorldSimulation/Internal/WorldSimulationDimensions.js} +1 -1
- package/WorldSimulation/Internal/WorldSimulationTasks.d.ts +30 -0
- package/{Tasks/IWG/Internal/IWGTasks.js → WorldSimulation/Internal/WorldSimulationTasks.js} +14 -14
- package/WorldSimulation/Internal/WorldSimulationTools.d.ts +8 -0
- package/{Tasks/IWG/Internal/IWGTools.js → WorldSimulation/Internal/WorldSimulationTools.js} +1 -1
- package/{Tasks/IWG → WorldSimulation}/Procedures/InitalLoad.d.ts +1 -1
- package/{Tasks/IWG → WorldSimulation}/Procedures/InitalLoad.js +11 -11
- package/{Tasks/IWG → WorldSimulation}/Procedures/SaveAllSectors.js +5 -5
- package/{Tasks/IWG/IWG.d.ts → WorldSimulation/WorldSimulation.d.ts} +5 -5
- package/{Tasks/IWG/IWG.js → WorldSimulation/WorldSimulation.js} +21 -21
- package/{Tasks/IWG → WorldSimulation}/index.d.ts +1 -1
- package/{Tasks/IWG → WorldSimulation}/index.js +1 -1
- package/package.json +1 -1
- package/Tasks/IWG/Internal/Classes/BuildQueue.d.ts +0 -11
- package/Tasks/IWG/Internal/Classes/IWGTaskBase.d.ts +0 -15
- package/Tasks/IWG/Internal/Functions/runBuildUpdate.d.ts +0 -2
- package/Tasks/IWG/Internal/IWGDimensions.d.ts +0 -6
- package/Tasks/IWG/Internal/IWGTasks.d.ts +0 -30
- package/Tasks/IWG/Internal/IWGTools.d.ts +0 -8
- /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/DimensionSegment.js +0 -0
- /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorState.d.ts +0 -0
- /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorState.js +0 -0
- /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorVisistedMap.d.ts +0 -0
- /package/{Tasks/IWG → WorldSimulation}/Internal/Functions/cullSectors.d.ts +0 -0
- /package/{Tasks/IWG → WorldSimulation}/Internal/Functions/runWorldUpdate.d.ts +0 -0
- /package/{Tasks/IWG → WorldSimulation}/Procedures/SaveAllSectors.d.ts +0 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Vec3Array } from "@amodx/math";
|
|
2
|
-
import { LocationData } from "../../Math";
|
|
3
2
|
import { BinaryBufferData } from "../../Util/Binary/BinaryBuffer";
|
|
4
3
|
export type ArchivedLightSegments = "sun" | "red" | "green" | "blue";
|
|
5
4
|
/**
|
|
@@ -10,8 +9,9 @@ export interface ArchivedSectorData {
|
|
|
10
9
|
version: string;
|
|
11
10
|
/** The version of vlox the data was stored in. */
|
|
12
11
|
vloxVersion: string;
|
|
12
|
+
dimension: string;
|
|
13
13
|
/** The location of the sector in the world. */
|
|
14
|
-
location:
|
|
14
|
+
location: Vec3Array;
|
|
15
15
|
/** Record of the sector's bit flags. */
|
|
16
16
|
flags: Record<string, boolean>;
|
|
17
17
|
/** Record of the sector's timestamps. */
|
|
@@ -20,6 +20,7 @@ export interface ArchivedSectorData {
|
|
|
20
20
|
palettes: ArchivedSectorPaletteData;
|
|
21
21
|
/** Placeholder for future buffer data. */
|
|
22
22
|
buffers: ArchivedSectorBuffersData;
|
|
23
|
+
/**Contains duplicate data like duplicate sections. */
|
|
23
24
|
duplicates: ArchivedSectorDuplicteData;
|
|
24
25
|
/** Array of archived section data within the sector. */
|
|
25
26
|
sections: (ArchivedSectionData | string)[];
|
|
@@ -33,13 +34,25 @@ export interface ArchivedSectorDuplicteData {
|
|
|
33
34
|
export interface ArchivedSectorPaletteData {
|
|
34
35
|
id: string[];
|
|
35
36
|
secondaryId: string[];
|
|
36
|
-
state
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
/**A map of sector voxel ids to a palette of store state objects.
|
|
38
|
+
*1. First depth -> voxels
|
|
39
|
+
*2. Second depth -> voxel states
|
|
40
|
+
*3. Third depth -> state object
|
|
41
|
+
*/
|
|
42
|
+
stateMap: any[][][];
|
|
43
|
+
/**Same as state map but for secondary voxels */
|
|
44
|
+
secondaryStateMap: any[][][];
|
|
45
|
+
/**A map of sector voxel ids to a palette of store mod state objects.
|
|
46
|
+
*1. First depth -> voxels
|
|
47
|
+
*2. Second depth -> voxel mode states
|
|
48
|
+
*3. Third depth -> mode state object
|
|
49
|
+
*/
|
|
50
|
+
modMap: any[][][];
|
|
51
|
+
/**Same as mod map but for secondary voxels */
|
|
52
|
+
secondaryModMap: any[][][];
|
|
40
53
|
level?: Uint8Array;
|
|
41
54
|
light: Partial<Record<ArchivedLightSegments, Uint8Array>>;
|
|
42
|
-
|
|
55
|
+
secondaryValue?: Uint16Array;
|
|
43
56
|
}
|
|
44
57
|
/**
|
|
45
58
|
* Placeholder interface for future buffer data in a sector.
|
|
@@ -65,9 +78,15 @@ export interface ArchivedSectionPaletteData {
|
|
|
65
78
|
light?: Partial<Record<ArchivedLightSegments, Uint8Array>>;
|
|
66
79
|
level?: Uint8Array;
|
|
67
80
|
secondaryId?: Uint16Array;
|
|
68
|
-
state
|
|
69
|
-
|
|
70
|
-
|
|
81
|
+
/** Palette of sector voxel ids to a palette of state ids for the voxel*/
|
|
82
|
+
state?: Record<number, Uint16Array>;
|
|
83
|
+
/** Palette of sector secondary voxel ids to a palette of state ids for the voxel*/
|
|
84
|
+
secondaryState?: Record<number, Uint16Array>;
|
|
85
|
+
/** Palette of sector voxel ids to a palette of mod ids for the voxel*/
|
|
86
|
+
mod?: Record<number, Uint16Array>;
|
|
87
|
+
/** Palette of sector secondary voxel ids to a palette of mod ids for the voxel*/
|
|
88
|
+
secondaryMod?: Record<number, Uint16Array>;
|
|
89
|
+
secondaryValue?: Uint16Array;
|
|
71
90
|
}
|
|
72
91
|
/**
|
|
73
92
|
* Interface representing the buffer data for a section.
|
|
@@ -117,7 +136,7 @@ export interface ArchivedAreaMapData {
|
|
|
117
136
|
/** Record mapping string IDs to arrays of secondary voxel identifiers. */
|
|
118
137
|
secondaryIdPalette: Record<string, string[]>;
|
|
119
138
|
/** Record mapping string IDs to Uint16Arrays of secondary voxel states. */
|
|
120
|
-
|
|
139
|
+
secondaryValuePalette: Record<string, Uint16Array>;
|
|
121
140
|
/** Record mapping section identifiers to `ArchivedSectionData`. */
|
|
122
141
|
section: Record<string, ArchivedSectionData>;
|
|
123
142
|
/** Record mapping sector state identifiers to arrays of state data. */
|
|
@@ -144,7 +163,7 @@ export interface ArchivedAreaSectorPaletteData {
|
|
|
144
163
|
stateMap: Record<number, any[]>;
|
|
145
164
|
modMap: Record<number, any[]>;
|
|
146
165
|
secondaryId: string[];
|
|
147
|
-
|
|
166
|
+
secondaryValueState: Uint16Array;
|
|
148
167
|
}
|
|
149
168
|
/**
|
|
150
169
|
* Interface representing the archived data for a sector within an area.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { StringPalette } from "../../../Util/StringPalette";
|
|
2
|
+
import { NumberPalette } from "../../../Util/NumberPalette";
|
|
3
|
+
import { Section } from "../../../World/Section";
|
|
4
|
+
import { ArchivedLightSegments } from "../Archive.types";
|
|
5
|
+
declare class ProcessedData<Buffer = any> {
|
|
6
|
+
buffer: Buffer;
|
|
7
|
+
constructor(buffer: Buffer);
|
|
8
|
+
allTheSame: boolean;
|
|
9
|
+
isPaletted: boolean;
|
|
10
|
+
remapped: boolean;
|
|
11
|
+
value: number;
|
|
12
|
+
}
|
|
13
|
+
declare class SectionPalette {
|
|
14
|
+
ids: NumberPalette;
|
|
15
|
+
level: NumberPalette;
|
|
16
|
+
light: LightPalette;
|
|
17
|
+
maxStatePaletteSize: number;
|
|
18
|
+
state: Record<number, NumberPalette>;
|
|
19
|
+
secondaryState: Record<number, NumberPalette>;
|
|
20
|
+
maxModPaletteSize: number;
|
|
21
|
+
mod: Record<number, NumberPalette>;
|
|
22
|
+
secondaryMod: Record<number, NumberPalette>;
|
|
23
|
+
secondaryId: NumberPalette;
|
|
24
|
+
secondaryValue: NumberPalette;
|
|
25
|
+
}
|
|
26
|
+
export declare class ProcessedSection {
|
|
27
|
+
original: Section;
|
|
28
|
+
palettes: SectionPalette;
|
|
29
|
+
isBuriedAllTheSame: boolean;
|
|
30
|
+
buriedValue: number;
|
|
31
|
+
isVoxelMapAllTheSame: boolean;
|
|
32
|
+
voxelMapValue: number;
|
|
33
|
+
isDirtyMapAllTheSame: boolean;
|
|
34
|
+
dirtyMapValue: number;
|
|
35
|
+
ids: ProcessedData<Uint16Array>;
|
|
36
|
+
light: Record<ArchivedLightSegments, ProcessedData<Uint8Array>>;
|
|
37
|
+
level: ProcessedData<Uint8Array>;
|
|
38
|
+
state: ProcessedData<Uint16Array>;
|
|
39
|
+
mod: ProcessedData<Uint16Array>;
|
|
40
|
+
secondary: ProcessedData<Uint16Array>;
|
|
41
|
+
constructor(original: Section);
|
|
42
|
+
}
|
|
43
|
+
declare class LightPalette {
|
|
44
|
+
sun: NumberPalette;
|
|
45
|
+
red: NumberPalette;
|
|
46
|
+
green: NumberPalette;
|
|
47
|
+
blue: NumberPalette;
|
|
48
|
+
}
|
|
49
|
+
export declare class VoxelStateObjectMap {
|
|
50
|
+
palette: NumberPalette;
|
|
51
|
+
states: any[];
|
|
52
|
+
}
|
|
53
|
+
export declare class SectorPalette {
|
|
54
|
+
ids: StringPalette;
|
|
55
|
+
level: NumberPalette;
|
|
56
|
+
light: LightPalette;
|
|
57
|
+
stateMap: VoxelStateObjectMap[];
|
|
58
|
+
secondaryStateMap: VoxelStateObjectMap[];
|
|
59
|
+
maxStatePaletteSize: number;
|
|
60
|
+
modMap: VoxelStateObjectMap[];
|
|
61
|
+
secondaryModMap: VoxelStateObjectMap[];
|
|
62
|
+
maxModPaletteSize: number;
|
|
63
|
+
secondaryId: StringPalette;
|
|
64
|
+
secondaryValue: NumberPalette;
|
|
65
|
+
}
|
|
66
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { StringPalette } from "../../../Util/StringPalette";
|
|
2
|
+
import { NumberPalette } from "../../../Util/NumberPalette";
|
|
3
|
+
class ProcessedData {
|
|
4
|
+
buffer;
|
|
5
|
+
constructor(buffer) {
|
|
6
|
+
this.buffer = buffer;
|
|
7
|
+
}
|
|
8
|
+
allTheSame = true;
|
|
9
|
+
isPaletted = false;
|
|
10
|
+
remapped = false;
|
|
11
|
+
value = 0;
|
|
12
|
+
}
|
|
13
|
+
class SectionPalette {
|
|
14
|
+
ids = new NumberPalette();
|
|
15
|
+
level = new NumberPalette();
|
|
16
|
+
light = new LightPalette();
|
|
17
|
+
maxStatePaletteSize = 0;
|
|
18
|
+
state = {};
|
|
19
|
+
secondaryState = {};
|
|
20
|
+
maxModPaletteSize = 0;
|
|
21
|
+
mod = {};
|
|
22
|
+
secondaryMod = {};
|
|
23
|
+
secondaryId = new NumberPalette();
|
|
24
|
+
secondaryValue = new NumberPalette();
|
|
25
|
+
}
|
|
26
|
+
export class ProcessedSection {
|
|
27
|
+
original;
|
|
28
|
+
palettes = new SectionPalette();
|
|
29
|
+
isBuriedAllTheSame = false;
|
|
30
|
+
buriedValue = 0;
|
|
31
|
+
isVoxelMapAllTheSame = false;
|
|
32
|
+
voxelMapValue = 0;
|
|
33
|
+
isDirtyMapAllTheSame = false;
|
|
34
|
+
dirtyMapValue = 0;
|
|
35
|
+
ids;
|
|
36
|
+
light;
|
|
37
|
+
level;
|
|
38
|
+
state;
|
|
39
|
+
mod;
|
|
40
|
+
secondary;
|
|
41
|
+
constructor(original) {
|
|
42
|
+
this.original = original;
|
|
43
|
+
this.ids = new ProcessedData(new Uint16Array(original.ids.length));
|
|
44
|
+
this.level = new ProcessedData(new Uint8Array(original.level.length));
|
|
45
|
+
this.light = {
|
|
46
|
+
sun: new ProcessedData(new Uint8Array(original.light.length)),
|
|
47
|
+
red: new ProcessedData(new Uint8Array(original.light.length)),
|
|
48
|
+
green: new ProcessedData(new Uint8Array(original.light.length)),
|
|
49
|
+
blue: new ProcessedData(new Uint8Array(original.light.length)),
|
|
50
|
+
};
|
|
51
|
+
this.state = new ProcessedData(new Uint16Array(original.state.length));
|
|
52
|
+
this.mod = new ProcessedData(new Uint16Array(original.mod.length));
|
|
53
|
+
this.secondary = new ProcessedData(new Uint16Array(original.mod.length));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
class LightPalette {
|
|
57
|
+
sun = new NumberPalette();
|
|
58
|
+
red = new NumberPalette();
|
|
59
|
+
green = new NumberPalette();
|
|
60
|
+
blue = new NumberPalette();
|
|
61
|
+
}
|
|
62
|
+
export class VoxelStateObjectMap {
|
|
63
|
+
palette = new NumberPalette();
|
|
64
|
+
states = [];
|
|
65
|
+
}
|
|
66
|
+
export class SectorPalette {
|
|
67
|
+
ids = new StringPalette();
|
|
68
|
+
level = new NumberPalette();
|
|
69
|
+
light = new LightPalette();
|
|
70
|
+
stateMap = [];
|
|
71
|
+
secondaryStateMap = [];
|
|
72
|
+
maxStatePaletteSize = 0;
|
|
73
|
+
modMap = [];
|
|
74
|
+
secondaryModMap = [];
|
|
75
|
+
maxModPaletteSize = 0;
|
|
76
|
+
secondaryId = new StringPalette();
|
|
77
|
+
secondaryValue = new NumberPalette();
|
|
78
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { NumberPalette } from "../../../Util/NumberPalette";
|
|
2
|
+
import { ArchivedLightSegments, ArchivedSectionData } from "../Archive.types";
|
|
3
|
+
import { BinaryBuffer } from "../../../Util/Binary/BinaryBuffer";
|
|
4
|
+
import { ImportedSector } from "./ImportedSector";
|
|
5
|
+
declare class ImportedSectionBuffers {
|
|
6
|
+
ids: BinaryBuffer;
|
|
7
|
+
level: BinaryBuffer;
|
|
8
|
+
light: Record<ArchivedLightSegments, BinaryBuffer>;
|
|
9
|
+
state: BinaryBuffer;
|
|
10
|
+
mod: BinaryBuffer;
|
|
11
|
+
secondary: BinaryBuffer;
|
|
12
|
+
constructor(section: ArchivedSectionData);
|
|
13
|
+
}
|
|
14
|
+
declare class ImportedSectionPalettes {
|
|
15
|
+
id?: NumberPalette;
|
|
16
|
+
level?: NumberPalette;
|
|
17
|
+
light: Record<ArchivedLightSegments, NumberPalette | null>;
|
|
18
|
+
state?: NumberPalette[];
|
|
19
|
+
secondaryState?: NumberPalette[];
|
|
20
|
+
mod?: NumberPalette[];
|
|
21
|
+
secondaryMod?: NumberPalette[];
|
|
22
|
+
secondaryId?: NumberPalette;
|
|
23
|
+
secondaryValue?: NumberPalette;
|
|
24
|
+
constructor(section: ArchivedSectionData);
|
|
25
|
+
}
|
|
26
|
+
export declare class ImportedSection {
|
|
27
|
+
sectionIndex: number;
|
|
28
|
+
sector: ImportedSector;
|
|
29
|
+
section: ArchivedSectionData;
|
|
30
|
+
buffers: ImportedSectionBuffers;
|
|
31
|
+
palettes: ImportedSectionPalettes;
|
|
32
|
+
constructor(sectionIndex: number, sector: ImportedSector, section: ArchivedSectionData);
|
|
33
|
+
getId(index: number): number;
|
|
34
|
+
getLight(index: number): number;
|
|
35
|
+
getLevel(index: number): number;
|
|
36
|
+
getSecondary(index: number): number;
|
|
37
|
+
getState(index: number): number;
|
|
38
|
+
getMod(index: number): number;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import { NumberPalette } from "../../../Util/NumberPalette";
|
|
2
|
+
import { BinaryBuffer, BinaryBufferTypes, } from "../../../Util/Binary/BinaryBuffer";
|
|
3
|
+
import { VoxelPalettesRegister } from "../../../Voxels/Data/VoxelPalettesRegister";
|
|
4
|
+
import { lightSegments, lightSemgnetSet } from "../Functions/Shared";
|
|
5
|
+
import { VoxelTagsRegister } from "../../../Voxels/Data/VoxelTagsRegister";
|
|
6
|
+
class ImportedSectionBuffers {
|
|
7
|
+
ids;
|
|
8
|
+
level;
|
|
9
|
+
light;
|
|
10
|
+
state;
|
|
11
|
+
mod;
|
|
12
|
+
secondary;
|
|
13
|
+
constructor(section) {
|
|
14
|
+
this.ids = !section.buffers.id
|
|
15
|
+
? new BinaryBuffer({ buffer: 0, type: BinaryBufferTypes.Value })
|
|
16
|
+
: typeof section.buffers.id == "number"
|
|
17
|
+
? new BinaryBuffer({
|
|
18
|
+
buffer: section.buffers.id,
|
|
19
|
+
type: BinaryBufferTypes.Value,
|
|
20
|
+
})
|
|
21
|
+
: new BinaryBuffer(section.buffers.id);
|
|
22
|
+
this.level = !section.buffers.level
|
|
23
|
+
? new BinaryBuffer({ buffer: 0, type: BinaryBufferTypes.Value })
|
|
24
|
+
: typeof section.buffers.level == "number"
|
|
25
|
+
? new BinaryBuffer({
|
|
26
|
+
buffer: section.buffers.level,
|
|
27
|
+
type: BinaryBufferTypes.Value,
|
|
28
|
+
})
|
|
29
|
+
: new BinaryBuffer(section.buffers.level);
|
|
30
|
+
this.light = {
|
|
31
|
+
sun: !section.buffers.light?.sun
|
|
32
|
+
? new BinaryBuffer({ buffer: 0, type: BinaryBufferTypes.Value })
|
|
33
|
+
: typeof section.buffers.light.sun == "number"
|
|
34
|
+
? new BinaryBuffer({
|
|
35
|
+
buffer: section.buffers.light.sun,
|
|
36
|
+
type: BinaryBufferTypes.Value,
|
|
37
|
+
})
|
|
38
|
+
: new BinaryBuffer(section.buffers.light.sun),
|
|
39
|
+
red: !section.buffers.light?.red
|
|
40
|
+
? new BinaryBuffer({ buffer: 0, type: BinaryBufferTypes.Value })
|
|
41
|
+
: typeof section.buffers.light.red == "number"
|
|
42
|
+
? new BinaryBuffer({
|
|
43
|
+
buffer: section.buffers.light.red,
|
|
44
|
+
type: BinaryBufferTypes.Value,
|
|
45
|
+
})
|
|
46
|
+
: new BinaryBuffer(section.buffers.light.red),
|
|
47
|
+
green: !section.buffers.light?.green
|
|
48
|
+
? new BinaryBuffer({ buffer: 0, type: BinaryBufferTypes.Value })
|
|
49
|
+
: typeof section.buffers.light.green == "number"
|
|
50
|
+
? new BinaryBuffer({
|
|
51
|
+
buffer: section.buffers.light.green,
|
|
52
|
+
type: BinaryBufferTypes.Value,
|
|
53
|
+
})
|
|
54
|
+
: new BinaryBuffer(section.buffers.light.green),
|
|
55
|
+
blue: !section.buffers.light?.blue
|
|
56
|
+
? new BinaryBuffer({ buffer: 0, type: BinaryBufferTypes.Value })
|
|
57
|
+
: typeof section.buffers.light.blue == "number"
|
|
58
|
+
? new BinaryBuffer({
|
|
59
|
+
buffer: section.buffers.light.blue,
|
|
60
|
+
type: BinaryBufferTypes.Value,
|
|
61
|
+
})
|
|
62
|
+
: new BinaryBuffer(section.buffers.light.blue),
|
|
63
|
+
};
|
|
64
|
+
this.state = !section.buffers.state
|
|
65
|
+
? new BinaryBuffer({ buffer: 0, type: BinaryBufferTypes.Value })
|
|
66
|
+
: typeof section.buffers.state == "number"
|
|
67
|
+
? new BinaryBuffer({
|
|
68
|
+
buffer: section.buffers.state,
|
|
69
|
+
type: BinaryBufferTypes.Value,
|
|
70
|
+
})
|
|
71
|
+
: new BinaryBuffer(section.buffers.state);
|
|
72
|
+
this.mod = !section.buffers.mod
|
|
73
|
+
? new BinaryBuffer({ buffer: 0, type: BinaryBufferTypes.Value })
|
|
74
|
+
: typeof section.buffers.mod == "number"
|
|
75
|
+
? new BinaryBuffer({
|
|
76
|
+
buffer: section.buffers.mod,
|
|
77
|
+
type: BinaryBufferTypes.Value,
|
|
78
|
+
})
|
|
79
|
+
: new BinaryBuffer(section.buffers.mod);
|
|
80
|
+
this.secondary = !section.buffers.secondary
|
|
81
|
+
? new BinaryBuffer({ buffer: 0, type: BinaryBufferTypes.Value })
|
|
82
|
+
: typeof section.buffers.secondary == "number"
|
|
83
|
+
? new BinaryBuffer({
|
|
84
|
+
buffer: section.buffers.secondary,
|
|
85
|
+
type: BinaryBufferTypes.Value,
|
|
86
|
+
})
|
|
87
|
+
: new BinaryBuffer(section.buffers.secondary);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
class ImportedSectionPalettes {
|
|
91
|
+
id;
|
|
92
|
+
level;
|
|
93
|
+
light;
|
|
94
|
+
state;
|
|
95
|
+
secondaryState;
|
|
96
|
+
mod;
|
|
97
|
+
secondaryMod;
|
|
98
|
+
secondaryId;
|
|
99
|
+
secondaryValue;
|
|
100
|
+
constructor(section) {
|
|
101
|
+
this.id = section.palettes?.id
|
|
102
|
+
? new NumberPalette(section.palettes?.id)
|
|
103
|
+
: undefined;
|
|
104
|
+
this.light = {
|
|
105
|
+
sun: section.palettes?.light?.sun
|
|
106
|
+
? new NumberPalette(section.palettes?.light?.sun)
|
|
107
|
+
: null,
|
|
108
|
+
red: section.palettes?.light?.red
|
|
109
|
+
? new NumberPalette(section.palettes?.light?.red)
|
|
110
|
+
: null,
|
|
111
|
+
green: section.palettes?.light?.green
|
|
112
|
+
? new NumberPalette(section.palettes?.light?.green)
|
|
113
|
+
: null,
|
|
114
|
+
blue: section.palettes?.light?.blue
|
|
115
|
+
? new NumberPalette(section.palettes?.light?.blue)
|
|
116
|
+
: null,
|
|
117
|
+
};
|
|
118
|
+
this.level = section.palettes?.level
|
|
119
|
+
? new NumberPalette(section.palettes?.level)
|
|
120
|
+
: undefined;
|
|
121
|
+
if (section.palettes?.state) {
|
|
122
|
+
for (const stateKey in section.palettes.state) {
|
|
123
|
+
this.state ??= [];
|
|
124
|
+
this.state[stateKey] = new NumberPalette(section.palettes.state[stateKey]);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (section.palettes?.mod) {
|
|
128
|
+
for (const modKey in section.palettes.mod) {
|
|
129
|
+
this.mod ??= [];
|
|
130
|
+
this.mod[modKey] = new NumberPalette(section.palettes.mod[modKey]);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
this.secondaryValue = section.palettes?.secondaryValue
|
|
134
|
+
? new NumberPalette(section.palettes?.secondaryValue)
|
|
135
|
+
: undefined;
|
|
136
|
+
this.secondaryId = section.palettes?.secondaryId
|
|
137
|
+
? new NumberPalette(section.palettes?.secondaryId)
|
|
138
|
+
: undefined;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
export class ImportedSection {
|
|
142
|
+
sectionIndex;
|
|
143
|
+
sector;
|
|
144
|
+
section;
|
|
145
|
+
buffers;
|
|
146
|
+
palettes;
|
|
147
|
+
constructor(sectionIndex, sector, section) {
|
|
148
|
+
this.sectionIndex = sectionIndex;
|
|
149
|
+
this.sector = sector;
|
|
150
|
+
this.section = section;
|
|
151
|
+
this.buffers = new ImportedSectionBuffers(section);
|
|
152
|
+
this.palettes = new ImportedSectionPalettes(section);
|
|
153
|
+
}
|
|
154
|
+
getId(index) {
|
|
155
|
+
const value = this.buffers.ids.getValue(index);
|
|
156
|
+
if (this.buffers.ids.type == BinaryBufferTypes.Value) {
|
|
157
|
+
return VoxelPalettesRegister.voxels.getNumberId(this.sector.palettes.id.getStringId(value));
|
|
158
|
+
}
|
|
159
|
+
if (this.palettes.id) {
|
|
160
|
+
return VoxelPalettesRegister.voxels.getNumberId(this.sector.palettes.id.getStringId(this.palettes.id.getValue(value)));
|
|
161
|
+
}
|
|
162
|
+
return VoxelPalettesRegister.voxels.getNumberId(this.sector.palettes.id.getStringId(value));
|
|
163
|
+
}
|
|
164
|
+
getLight(index) {
|
|
165
|
+
let finalLight = 0;
|
|
166
|
+
for (let l = 0; l < lightSegments.length; l++) {
|
|
167
|
+
const segment = lightSegments[l];
|
|
168
|
+
let value = 0;
|
|
169
|
+
if (this.buffers.light[segment].type == BinaryBufferTypes.Value) {
|
|
170
|
+
value = this.buffers.light[segment].getValue(index);
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
if (this.buffers.light[segment].type == BinaryBufferTypes.NibbleArray) {
|
|
174
|
+
value = this.buffers.light[segment].getValue(index);
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
if (this.palettes.light[segment]) {
|
|
178
|
+
value = this.palettes.light[segment].getValue(this.buffers.light[segment].getValue(index));
|
|
179
|
+
}
|
|
180
|
+
else if (this.sector.palettes.light[segment]) {
|
|
181
|
+
value = this.sector.palettes.light[segment].getValue(this.buffers.light[segment].getValue(index));
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
finalLight = lightSemgnetSet[segment](value, finalLight);
|
|
186
|
+
}
|
|
187
|
+
return finalLight;
|
|
188
|
+
}
|
|
189
|
+
getLevel(index) {
|
|
190
|
+
const value = this.buffers.level.getValue(index);
|
|
191
|
+
if (this.palettes.level) {
|
|
192
|
+
return this.palettes.level.getValue(value);
|
|
193
|
+
}
|
|
194
|
+
if (this.sector.palettes.level) {
|
|
195
|
+
return this.sector.palettes.level.getValue(value);
|
|
196
|
+
}
|
|
197
|
+
return value;
|
|
198
|
+
}
|
|
199
|
+
getSecondary(index) {
|
|
200
|
+
const voxelId = this.getId(index);
|
|
201
|
+
const value = this.buffers.secondary.getValue(index);
|
|
202
|
+
if (VoxelTagsRegister.VoxelTags[voxelId]["dve_can_have_secondary"]) {
|
|
203
|
+
if (this.palettes.secondaryId) {
|
|
204
|
+
return VoxelPalettesRegister.voxels.getNumberId(this.sector.palettes.secondaryId.getStringId(this.palettes.secondaryId.getValue(value)));
|
|
205
|
+
}
|
|
206
|
+
return VoxelPalettesRegister.voxels.getNumberId(this.sector.sector.palettes.secondaryId[value]);
|
|
207
|
+
}
|
|
208
|
+
if (typeof this.section.buffers.secondary == "number") {
|
|
209
|
+
return value;
|
|
210
|
+
}
|
|
211
|
+
if (this.palettes.secondaryValue && this.sector.palettes.secondaryValue) {
|
|
212
|
+
return this.sector.palettes.secondaryValue.getValue(this.palettes.secondaryValue.getValue(value));
|
|
213
|
+
}
|
|
214
|
+
if (this.sector.palettes.secondaryValue) {
|
|
215
|
+
return this.sector.palettes.secondaryValue.getId(value);
|
|
216
|
+
}
|
|
217
|
+
return value;
|
|
218
|
+
}
|
|
219
|
+
getState(index) {
|
|
220
|
+
const stateIndex = this.buffers.state.getValue(index);
|
|
221
|
+
let returnValue = stateIndex;
|
|
222
|
+
let voxelId = VoxelPalettesRegister.voxels.getStringId(this.getId(index));
|
|
223
|
+
const secondary = VoxelTagsRegister.VoxelTags[this.getId(index)]["dve_can_have_secondary"] && this.getSecondary(index) > 0;
|
|
224
|
+
if (secondary) {
|
|
225
|
+
voxelId = VoxelPalettesRegister.voxels.getStringId(this.getSecondary(index));
|
|
226
|
+
let voxelIndex = this.sector.palettes.secondaryId.getNumberId(voxelId);
|
|
227
|
+
const statePalette = this.sector.palettes.secondaryState[voxelIndex];
|
|
228
|
+
if (!statePalette)
|
|
229
|
+
return 0;
|
|
230
|
+
if (this.buffers.state.type == BinaryBufferTypes.Value) {
|
|
231
|
+
returnValue = statePalette[stateIndex];
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
if (this.section.palettes?.secondaryState) {
|
|
235
|
+
returnValue =
|
|
236
|
+
statePalette[this.section.palettes?.secondaryState[voxelIndex][stateIndex]];
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
returnValue = statePalette[stateIndex];
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
let voxelIndex = this.sector.palettes.id.getNumberId(voxelId);
|
|
245
|
+
const statePalette = this.sector.palettes.state[voxelIndex];
|
|
246
|
+
if (!statePalette)
|
|
247
|
+
return 0;
|
|
248
|
+
if (this.buffers.state.type == BinaryBufferTypes.Value) {
|
|
249
|
+
returnValue = statePalette[stateIndex];
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
if (this.section.palettes?.state) {
|
|
253
|
+
returnValue =
|
|
254
|
+
statePalette[this.section.palettes?.state[voxelIndex][stateIndex]];
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
returnValue = statePalette[stateIndex];
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return returnValue;
|
|
262
|
+
}
|
|
263
|
+
getMod(index) {
|
|
264
|
+
const modIndex = this.buffers.mod.getValue(index);
|
|
265
|
+
let returnValue = modIndex;
|
|
266
|
+
let voxelId = VoxelPalettesRegister.voxels.getStringId(this.getId(index));
|
|
267
|
+
const secondary = VoxelTagsRegister.VoxelTags[this.getId(index)]["dve_can_have_secondary"] && this.getSecondary(index) > 0;
|
|
268
|
+
if (secondary) {
|
|
269
|
+
voxelId = VoxelPalettesRegister.voxels.getStringId(this.getSecondary(index));
|
|
270
|
+
let voxelIndex = this.sector.palettes.secondaryId.getNumberId(voxelId);
|
|
271
|
+
const modPalette = this.sector.palettes.secondaryMod[voxelIndex];
|
|
272
|
+
if (!modPalette)
|
|
273
|
+
return 0;
|
|
274
|
+
if (this.buffers.mod.type == BinaryBufferTypes.Value) {
|
|
275
|
+
returnValue = modPalette[modIndex];
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
if (this.section.palettes?.secondaryMod) {
|
|
279
|
+
returnValue =
|
|
280
|
+
modPalette[this.section.palettes?.secondaryMod[voxelIndex][modIndex]];
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
returnValue = modPalette[modIndex];
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
let voxelIndex = this.sector.palettes.id.getNumberId(voxelId);
|
|
289
|
+
const modPalette = this.sector.palettes.mod[voxelIndex];
|
|
290
|
+
if (!modPalette)
|
|
291
|
+
return 0;
|
|
292
|
+
if (this.buffers.mod.type == BinaryBufferTypes.Value) {
|
|
293
|
+
returnValue = modPalette[modIndex];
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
if (this.section.palettes?.mod) {
|
|
297
|
+
returnValue =
|
|
298
|
+
modPalette[this.section.palettes?.mod[voxelIndex][modIndex]];
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
returnValue = modPalette[modIndex];
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
return returnValue;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { StringPalette } from "../../../Util/StringPalette";
|
|
2
|
+
import { NumberPalette } from "../../../Util/NumberPalette";
|
|
3
|
+
import { ArchivedLightSegments, ArchivedSectorData } from "../Archive.types";
|
|
4
|
+
import { ImportedSection } from "./ImportedSection";
|
|
5
|
+
declare class ImportedSectorPalettes {
|
|
6
|
+
id: StringPalette;
|
|
7
|
+
secondaryId: StringPalette;
|
|
8
|
+
secondaryValue: NumberPalette;
|
|
9
|
+
level?: NumberPalette;
|
|
10
|
+
light: Record<ArchivedLightSegments, NumberPalette | null>;
|
|
11
|
+
state: number[][];
|
|
12
|
+
secondaryState: number[][];
|
|
13
|
+
mod: number[][];
|
|
14
|
+
secondaryMod: number[][];
|
|
15
|
+
constructor(sector: ArchivedSectorData);
|
|
16
|
+
}
|
|
17
|
+
export declare class ImportedSector {
|
|
18
|
+
sector: ArchivedSectorData;
|
|
19
|
+
sections: ImportedSection[];
|
|
20
|
+
palettes: ImportedSectorPalettes;
|
|
21
|
+
constructor(sector: ArchivedSectorData);
|
|
22
|
+
}
|
|
23
|
+
export {};
|