@divinevoxel/vlox 0.0.7 → 0.0.72

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.
Files changed (168) hide show
  1. package/Contexts/Base/Main/InitDataGenerator.js +0 -9
  2. package/Contexts/Base/Remote/DataSync.types.d.ts +0 -5
  3. package/Contexts/Base/Remote/InitDataSync.js +17 -31
  4. package/Init/StartConstructor.js +2 -4
  5. package/Init/StartWorld.js +0 -12
  6. package/Math/Indexing.d.ts +12 -3
  7. package/Math/Indexing.js +24 -15
  8. package/Mesher/Functions/CompactVoxelMesh.d.ts +1 -1
  9. package/Mesher/Functions/CompactVoxelMesh.js +3 -4
  10. package/Mesher/Functions/MeshSection.d.ts +1 -1
  11. package/Mesher/Functions/MeshSection.js +54 -60
  12. package/Mesher/Functions/MeshVoxel.js +20 -26
  13. package/Mesher/Geomtry/Buffers.d.ts +9 -8
  14. package/Mesher/Geomtry/Buffers.js +26 -58
  15. package/Mesher/Geomtry/Tools/MesherDataTools.d.ts +1 -1
  16. package/Mesher/Geomtry/Tools/MesherDataTools.js +1 -1
  17. package/Mesher/Geomtry/VoxelGeometryBuilder.js +107 -124
  18. package/Mesher/InitMesher.js +1 -10
  19. package/Mesher/InitTask.js +10 -4
  20. package/Mesher/Models/Common/BoundsFunctions.d.ts +1 -3
  21. package/Mesher/Models/Common/BoundsFunctions.js +0 -16
  22. package/Mesher/Models/Common/Calc/CalcConstants.js +14 -31
  23. package/Mesher/Models/Common/Calc/FaceDataCalc.d.ts +1 -7
  24. package/Mesher/Models/Common/Calc/FaceDataCalc.js +41 -50
  25. package/Mesher/Models/Nodes/Custom/Liquid/LiquidGeomtryNode.d.ts +1 -5
  26. package/Mesher/Models/Nodes/Custom/Liquid/LiquidGeomtryNode.js +30 -26
  27. package/Mesher/Models/Nodes/GeometryNode.d.ts +2 -4
  28. package/Mesher/Models/Nodes/GeometryNode.js +1 -2
  29. package/Mesher/Models/Nodes/Ruled/BoxVoxelGeometryNode.d.ts +2 -6
  30. package/Mesher/Models/Nodes/Ruled/BoxVoxelGeometryNode.js +37 -34
  31. package/Mesher/Models/Nodes/Ruled/QuadVoxelGeometryNode.d.ts +2 -6
  32. package/Mesher/Models/Nodes/Ruled/QuadVoxelGeometryNode.js +52 -51
  33. package/Mesher/Models/Nodes/Ruleless/RulelessBoxVoxelGeometryNode.d.ts +2 -6
  34. package/Mesher/Models/Nodes/Ruleless/RulelessBoxVoxelGeometryNode.js +18 -19
  35. package/Mesher/Models/Nodes/Ruleless/RulelessQuadVoxelGeometryNode.d.ts +2 -6
  36. package/Mesher/Models/Nodes/Ruleless/RulelessQuadVoxelGeometryNode.js +37 -40
  37. package/Mesher/Models/VoxelConstructor.d.ts +3 -4
  38. package/Mesher/Models/VoxelConstructor.js +23 -12
  39. package/Mesher/Models/{VoxelGeometryLookUp.d.ts → VoxelGeometryBuilderCacheSpace.d.ts} +8 -14
  40. package/Mesher/Models/{VoxelGeometryLookUp.js → VoxelGeometryBuilderCacheSpace.js} +49 -44
  41. package/Mesher/Models/VoxelModelConstructorRegister.js +3 -3
  42. package/Mesher/Tools/VoxelMeshBVHBuilder.d.ts +2 -9
  43. package/Mesher/Tools/VoxelMeshBVHBuilder.js +4 -16
  44. package/Mesher/Tools/VoxelMeshVertexStructCursor.d.ts +10 -0
  45. package/Mesher/Tools/VoxelMeshVertexStructCursor.js +10 -0
  46. package/Mesher/Tools/VoxelMesherDataTool.d.ts +8 -5
  47. package/Mesher/Tools/VoxelMesherDataTool.js +34 -13
  48. package/Models/Indexing/VoxelAOResultsIndex.d.ts +4 -4
  49. package/Models/Indexing/VoxelAOResultsIndex.js +15 -9
  50. package/Models/Indexing/VoxelFaceCullResultsIndex.d.ts +3 -3
  51. package/Models/Indexing/VoxelFaceCullResultsIndex.js +14 -9
  52. package/Models/Indexing/VoxelFaceTransparentResultsIndex.d.ts +1 -1
  53. package/Models/Indexing/VoxelFaceTransparentResultsIndex.js +1 -1
  54. package/Models/Rules/Functions/BuildRules.js +2 -2
  55. package/Tasks/IWG/Internal/Classes/Generator.js +1 -1
  56. package/Tasks/IWG/Internal/Functions/getSectorState.js +4 -7
  57. package/Tasks/IWG/Internal/Functions/runWorldUpdate.js +5 -6
  58. package/Tasks/IWG/Internal/IWGTasks.js +12 -21
  59. package/Tasks/Propagation/Flow/FlowManager.d.ts +0 -2
  60. package/Tasks/Propagation/Flow/FlowManager.js +86 -87
  61. package/Tasks/Propagation/Flow/WorldFlow.js +2 -3
  62. package/Tasks/Propagation/Illumanation/WorldRGB.js +1 -2
  63. package/Tasks/Update/InitTasks.d.ts +2 -1
  64. package/Tasks/Update/InitTasks.js +6 -6
  65. package/Tasks/Update/VoxelUpdate.js +15 -7
  66. package/Tasks/WorldGeneration/WorldGenBrush.js +1 -0
  67. package/Templates/Cursor/TemplateCursor.d.ts +1 -1
  68. package/Templates/Cursor/TemplateCursor.js +1 -1
  69. package/Templates/Functions/CreateTemplate.js +1 -1
  70. package/Templates/VoxelTemplate.js +6 -8
  71. package/Tools/Brush/Brush.d.ts +0 -2
  72. package/Tools/Brush/Brush.js +5 -6
  73. package/{Data/Cursor → Tools}/DataCursor.interface.d.ts +1 -1
  74. package/Util/Binary/BitArray.d.ts +4 -0
  75. package/Util/Binary/BitArray.js +16 -0
  76. package/Util/StringPalette.d.ts +1 -0
  77. package/Util/StringPalette.js +8 -0
  78. package/Voxels/Cursor/VoxelCursor.d.ts +6 -6
  79. package/Voxels/Cursor/VoxelCursor.interface.d.ts +10 -15
  80. package/Voxels/Cursor/VoxelCursor.interface.js +30 -50
  81. package/Voxels/Cursor/VoxelCursor.js +13 -12
  82. package/Voxels/Cursor/VoxelLightData.d.ts +3 -4
  83. package/Voxels/Cursor/VoxelLightData.js +8 -7
  84. package/Voxels/Data/VoxelPalettesRegister.d.ts +13 -0
  85. package/Voxels/Data/VoxelPalettesRegister.js +17 -0
  86. package/Voxels/Data/VoxelTag.types.d.ts +56 -0
  87. package/Voxels/Data/VoxelTag.types.js +23 -0
  88. package/Voxels/{State → Data}/VoxelTagStates.d.ts +2 -2
  89. package/Voxels/{State → Data}/VoxelTagStates.js +5 -5
  90. package/Voxels/Data/VoxelTagsRegister.d.ts +9 -0
  91. package/Voxels/Data/VoxelTagsRegister.js +32 -0
  92. package/Voxels/Functions/BuildStateData.js +3 -3
  93. package/Voxels/Functions/BuildTagAndPaletteData.d.ts +13 -0
  94. package/Voxels/Functions/BuildTagAndPaletteData.js +57 -0
  95. package/Voxels/Indexes/VoxelIndex.js +3 -3
  96. package/Voxels/InitVoxelData.js +20 -61
  97. package/Voxels/State/Schema/StateSchema.d.ts +1 -1
  98. package/Voxels/Types/Voxel.types.d.ts +2 -42
  99. package/Voxels/Types/Voxel.types.js +0 -15
  100. package/Voxels/Types/VoxelModelCompiledData.types.d.ts +11 -13
  101. package/Voxels/Types/VoxelSubstances.types.d.ts +2 -15
  102. package/Voxels/Types/VoxelSubstances.types.js +1 -9
  103. package/World/Archive/Functions/ArchiveArea.js +2 -6
  104. package/World/Archive/Functions/ArchiveSector.js +14 -28
  105. package/World/Archive/Functions/ImportSector.js +27 -34
  106. package/World/Cursor/SectionCursor.d.ts +2 -1
  107. package/World/Cursor/SectionCursor.js +8 -2
  108. package/World/Cursor/SectorCursor.d.ts +2 -1
  109. package/World/Cursor/SectorCursor.js +5 -2
  110. package/World/Cursor/WorldCursor.d.ts +1 -1
  111. package/World/Cursor/WorldCursor.js +6 -2
  112. package/World/Cursor/WorldVoxelCursor.d.ts +7 -7
  113. package/World/Cursor/WorldVoxelCursor.js +20 -24
  114. package/World/Section/Section.d.ts +20 -8
  115. package/World/Section/Section.js +65 -9
  116. package/World/Sector/Sector.d.ts +13 -6
  117. package/World/Sector/Sector.js +30 -9
  118. package/World/Sector/SectorHeightMap.js +1 -3
  119. package/World/Sector/SectorState.d.ts +13 -0
  120. package/World/Sector/SectorState.js +15 -0
  121. package/World/WorldSpaces.d.ts +2 -0
  122. package/World/WorldSpaces.js +7 -1
  123. package/package.json +1 -1
  124. package/Data/Register/MappedDataRegister.d.ts +0 -5
  125. package/Data/Register/MappedDataRegister.js +0 -9
  126. package/Data/Register/MappedRegisterBase.d.ts +0 -14
  127. package/Data/Register/MappedRegisterBase.js +0 -50
  128. package/Data/Structs/StructBuilder.d.ts +0 -34
  129. package/Data/Structs/StructBuilder.js +0 -157
  130. package/Data/Structs/StructBuilder.types.d.ts +0 -30
  131. package/Data/Structs/StructBuilder.types.js +0 -1
  132. package/Tools/Data/SubstanceDataTool.d.ts +0 -13
  133. package/Tools/Data/SubstanceDataTool.js +0 -51
  134. package/Voxels/Palettes/MaterialPalette.d.ts +0 -9
  135. package/Voxels/Palettes/MaterialPalette.js +0 -11
  136. package/Voxels/Palettes/SubstancePalette.d.ts +0 -9
  137. package/Voxels/Palettes/SubstancePalette.js +0 -11
  138. package/Voxels/Palettes/VoxelPalette.d.ts +0 -11
  139. package/Voxels/Palettes/VoxelPalette.js +0 -15
  140. package/Voxels/Segments/MaterialDataGenerator.d.ts +0 -6
  141. package/Voxels/Segments/MaterialDataGenerator.js +0 -12
  142. package/Voxels/Segments/SubstanceDataGenerator.d.ts +0 -6
  143. package/Voxels/Segments/SubstanceDataGenerator.js +0 -35
  144. package/Voxels/Segments/VoxelDataGenerator.d.ts +0 -10
  145. package/Voxels/Segments/VoxelDataGenerator.js +0 -56
  146. package/Voxels/Structs/Builder/SubstanceStructBuilder.d.ts +0 -2
  147. package/Voxels/Structs/Builder/SubstanceStructBuilder.js +0 -42
  148. package/Voxels/Structs/Builder/VoxelStructBuilder.d.ts +0 -2
  149. package/Voxels/Structs/Builder/VoxelStructBuilder.js +0 -68
  150. package/Voxels/Structs/SubstanceStruct.d.ts +0 -17
  151. package/Voxels/Structs/SubstanceStruct.js +0 -17
  152. package/Voxels/Structs/VoxelStruct.d.ts +0 -27
  153. package/Voxels/Structs/VoxelStruct.js +0 -29
  154. package/World/Section/SectionHeightMap.d.ts +0 -10
  155. package/World/Section/SectionHeightMap.js +0 -39
  156. package/World/Section/SectionStruct.d.ts +0 -8
  157. package/World/Section/SectionStruct.js +0 -29
  158. package/World/Section/SectionStructProperties.d.ts +0 -10
  159. package/World/Section/SectionStructProperties.js +0 -11
  160. package/World/Sector/SectorStruct.d.ts +0 -1
  161. package/World/Sector/SectorStruct.js +0 -46
  162. package/World/Sector/SectorStructIds.d.ts +0 -13
  163. package/World/Sector/SectorStructIds.js +0 -14
  164. /package/{Data/Cursor → Tools}/DataCursor.interface.js +0 -0
  165. /package/{Data/Functions → Util/Binary}/Palettes.d.ts +0 -0
  166. /package/{Data/Functions → Util/Binary}/Palettes.js +0 -0
  167. /package/Voxels/{VoxelLevelReader.d.ts → Cursor/VoxelLevelReader.d.ts} +0 -0
  168. /package/Voxels/{VoxelLevelReader.js → Cursor/VoxelLevelReader.js} +0 -0
@@ -1,51 +0,0 @@
1
- import { SubstancePalette } from "../../Voxels/Palettes/SubstancePalette.js";
2
- import { MappedDataRegister } from "../../Data/Register/MappedDataRegister.js";
3
- import { SubstanceStructIds } from "../../Voxels/Types/VoxelSubstances.types.js";
4
- import { SubstanceStruct } from "../../Voxels/Structs/SubstanceStruct.js";
5
- export class SubstanceDataTool {
6
- static tags = SubstanceStruct;
7
- //substance = "";
8
- substanceTagIndex = 0;
9
- setSubstanceFromString(substance) {
10
- // this.substance = substance;
11
- this.substanceTagIndex = SubstancePalette.id.numberFromString(substance);
12
- SubstanceStruct.setSubstance(this.substanceTagIndex);
13
- return this;
14
- }
15
- setSubstance(substance) {
16
- // this.substance = substance;
17
- this.substanceTagIndex = substance;
18
- SubstanceStruct.setSubstance(this.substanceTagIndex);
19
- return this;
20
- }
21
- getSubstanceStringId() {
22
- return SubstancePalette.id.stringFromNumber(this.substanceTagIndex);
23
- }
24
- /* isTransparent() {
25
- return SubstanceStruct.instance[SubstanceStructIds.isTransparent] == 1;
26
- }
27
-
28
- */
29
- isSolid() {
30
- return SubstanceStruct.instance[SubstanceStructIds.isSolid] == 1;
31
- }
32
- isLiquid() {
33
- return SubstanceStruct.instance[SubstanceStructIds.isLiquid] == 1;
34
- }
35
- isWindAffected() {
36
- return SubstanceStruct.instance[SubstanceStructIds.isWindAffected] == 1;
37
- }
38
- /* isOpaque() {
39
- return this.isSolid() && !this.isTransparent();
40
- }
41
- */
42
- /* allowLight() {
43
- return this.isTransparent();
44
- } */
45
- getParent() {
46
- return MappedDataRegister.stringMaps.get("substance", SubstanceStructIds.parent, SubstanceStruct.instance[SubstanceStructIds.parent]);
47
- }
48
- getFlowRate() {
49
- return SubstanceStruct.instance[SubstanceStructIds.flowRate];
50
- }
51
- }
@@ -1,9 +0,0 @@
1
- import { StringPalette } from "../../Util/StringPalette";
2
- export declare class MaterialPalette {
3
- static palette: StringPalette;
4
- static setPalette(palette: string[]): void;
5
- static id: {
6
- stringFromNumber: (id: number) => string;
7
- numberFromString: (id: string) => number;
8
- };
9
- }
@@ -1,11 +0,0 @@
1
- import { StringPalette } from "../../Util/StringPalette";
2
- export class MaterialPalette {
3
- static palette;
4
- static setPalette(palette) {
5
- this.palette = new StringPalette(palette);
6
- }
7
- static id = {
8
- stringFromNumber: (id) => this.palette.getStringId(id),
9
- numberFromString: (id) => this.palette.getNumberId(id),
10
- };
11
- }
@@ -1,9 +0,0 @@
1
- import { StringPalette } from "../../Util/StringPalette";
2
- export declare class SubstancePalette {
3
- static palette: StringPalette;
4
- static setPalette(palette: string[]): void;
5
- static id: {
6
- stringFromNumber: (id: number) => string;
7
- numberFromString: (id: string) => number;
8
- };
9
- }
@@ -1,11 +0,0 @@
1
- import { StringPalette } from "../../Util/StringPalette";
2
- export class SubstancePalette {
3
- static palette;
4
- static setPalette(palette) {
5
- this.palette = new StringPalette(palette);
6
- }
7
- static id = {
8
- stringFromNumber: (id) => this.palette.getStringId(id),
9
- numberFromString: (id) => this.palette.getNumberId(id),
10
- };
11
- }
@@ -1,11 +0,0 @@
1
- import { StringPalette } from "../../Util/StringPalette";
2
- export declare class VoxelPalette {
3
- static _nameToIdMap: Map<string, string>;
4
- static _idToNameMap: Map<string, string>;
5
- static ids: StringPalette;
6
- static loadIn(voxelPalette: string[], nameToIdMap: Record<string, string>, idToNameMap: Record<string, string>): void;
7
- static name: {
8
- getId: (name: string) => string;
9
- getName: (id: string) => string;
10
- };
11
- }
@@ -1,15 +0,0 @@
1
- import { StringPalette } from "../../Util/StringPalette";
2
- export class VoxelPalette {
3
- static _nameToIdMap = new Map();
4
- static _idToNameMap = new Map();
5
- static ids;
6
- static loadIn(voxelPalette, nameToIdMap, idToNameMap) {
7
- this.ids = new StringPalette(voxelPalette);
8
- this._nameToIdMap = new Map(Object.entries(nameToIdMap));
9
- this._idToNameMap = new Map(Object.entries(idToNameMap));
10
- }
11
- static name = {
12
- getId: (name) => this._nameToIdMap.get(name),
13
- getName: (id) => this._idToNameMap.get(id),
14
- };
15
- }
@@ -1,6 +0,0 @@
1
- import { StringPalette } from "../../Util/StringPalette";
2
- import { VoxelMaterialData } from "..";
3
- export declare const MaterialDataGenerator: {
4
- generate(data: VoxelMaterialData[]): void;
5
- palette: StringPalette;
6
- };
@@ -1,12 +0,0 @@
1
- import { MaterialPalette } from "../Palettes/MaterialPalette";
2
- import { StringPalette } from "../../Util/StringPalette";
3
- export const MaterialDataGenerator = {
4
- generate(data) {
5
- //build palette
6
- for (const substance of data) {
7
- this.palette.register(substance.id);
8
- }
9
- MaterialPalette.setPalette(this.palette._palette);
10
- },
11
- palette: new StringPalette(),
12
- };
@@ -1,6 +0,0 @@
1
- import { StringPalette } from "../../Util/StringPalette";
2
- import { VoxelSubstanceData } from "../Types/VoxelSubstances.types";
3
- export declare const SubstanceDataGenerator: {
4
- generate(data: VoxelSubstanceData[]): void;
5
- palette: StringPalette;
6
- };
@@ -1,35 +0,0 @@
1
- import { SubstancePalette } from "../Palettes/SubstancePalette";
2
- import { StringPalette } from "../../Util/StringPalette";
3
- import { SubstanceStructBuilder } from "../Structs/Builder/SubstanceStructBuilder";
4
- import { SubstanceStruct } from "..//Structs/SubstanceStruct";
5
- export const SubstanceDataGenerator = {
6
- generate(data) {
7
- //build palette
8
- for (const substance of data) {
9
- this.palette.register(substance.id);
10
- }
11
- SubstancePalette.setPalette(this.palette._palette);
12
- //create data buffer
13
- const tags = SubstanceStructBuilder.build(this.palette.size);
14
- const buffer = new SharedArrayBuffer(tags.structData.bufferSize);
15
- tags.structData.buffer = buffer;
16
- tags.setBuffer(buffer);
17
- //build data
18
- for (const substance of data) {
19
- const substanceID = SubstancePalette.id.numberFromString(substance.id);
20
- if (typeof substanceID == undefined)
21
- continue;
22
- tags.setStructArrayIndex(substanceID);
23
- SubstanceStructBuilder.setDefaults(tags);
24
- for (const id in substance.properties) {
25
- const value = substance.properties[id];
26
- if (!SubstanceStructBuilder.hasNode(id))
27
- continue;
28
- SubstanceStructBuilder.setNode(id, value, tags);
29
- }
30
- }
31
- SubstanceStruct.init(tags.structData);
32
- SubstanceStruct.instance.setBuffer(buffer);
33
- },
34
- palette: new StringPalette(),
35
- };
@@ -1,10 +0,0 @@
1
- import { BinaryStruct } from "@amodx/binary";
2
- import { StringPalette } from "../../Util/StringPalette";
3
- import { VoxelData } from "../Types/Voxel.types";
4
- export declare class VoxelDataGenerator {
5
- static overrides: Map<string, (tags: BinaryStruct, value: unknown, id: string) => void>;
6
- static nameToIdMap: Record<string, string>;
7
- static idToNameMap: Record<string, string>;
8
- static generate(data: VoxelData[]): void;
9
- static palette: StringPalette;
10
- }
@@ -1,56 +0,0 @@
1
- //objects
2
- import { VoxelStructBuilder } from "../Structs/Builder/VoxelStructBuilder";
3
- import { VoxelPalette } from "../Palettes/VoxelPalette";
4
- import { VoxelStruct } from "../Structs/VoxelStruct";
5
- import { StringPalette } from "../../Util/StringPalette";
6
- export class VoxelDataGenerator {
7
- static overrides = new Map();
8
- static nameToIdMap = {};
9
- static idToNameMap = {};
10
- static generate(data) {
11
- //build palette
12
- for (const voxel of data) {
13
- if (this.palette.isRegistered(voxel.id))
14
- throw new Error(`Duplicate voxel id ${voxel.id}`);
15
- this.palette.register(voxel.id);
16
- this.nameToIdMap[voxel.name ? voxel.name : voxel.id] = voxel.id;
17
- this.idToNameMap[voxel.id] = voxel.name ? voxel.name : voxel.id;
18
- }
19
- VoxelPalette.loadIn(this.palette._palette, this.nameToIdMap, this.idToNameMap);
20
- //build index
21
- const indexBuffer = new SharedArrayBuffer(this.palette.size * 2);
22
- const voxelIndex = new Uint16Array(indexBuffer);
23
- for (let i = 0; i < this.palette.size; i++) {
24
- voxelIndex[i] = i;
25
- }
26
- //create data bufferv
27
- const tags = VoxelStructBuilder.build(this.palette.size);
28
- const buffer = new SharedArrayBuffer(tags.structData.bufferSize);
29
- tags.structData.buffer = buffer;
30
- tags.setBuffer(buffer);
31
- // VoxelStruct.init(initData);
32
- // VoxelStruct.setBuffer(buffer);
33
- //build data
34
- for (const voxel of data) {
35
- const baseID = VoxelPalette.ids.getNumberId(voxel.id);
36
- if (!baseID)
37
- continue;
38
- tags.setStructArrayIndex(voxelIndex[baseID]);
39
- VoxelStructBuilder.setDefaults(tags);
40
- for (const id in voxel.properties) {
41
- const value = voxel.properties[id];
42
- if (!VoxelStructBuilder.hasNode(id))
43
- continue;
44
- if (this.overrides.has(id)) {
45
- this.overrides.get(id)(tags, value, id);
46
- continue;
47
- }
48
- VoxelStructBuilder.setNode(id, value, tags);
49
- }
50
- }
51
- VoxelStruct.sync(voxelIndex);
52
- VoxelStruct.init(tags.structData);
53
- VoxelStruct.instance.setBuffer(buffer);
54
- }
55
- static palette = new StringPalette();
56
- }
@@ -1,2 +0,0 @@
1
- import { StructBuilder } from "../../../Data/Structs/StructBuilder.js";
2
- export declare const SubstanceStructBuilder: StructBuilder;
@@ -1,42 +0,0 @@
1
- import { BinaryNumberTypes } from "@amodx/binary";
2
- import { SubstanceStructIds } from "../../Types/VoxelSubstances.types";
3
- import { StructBuilder } from "../../../Data/Structs/StructBuilder.js";
4
- export const SubstanceStructBuilder = new StructBuilder("substance-tag-manager", "substance");
5
- SubstanceStructBuilder.addNode([
6
- {
7
- id: SubstanceStructIds.parent,
8
- type: "string-map",
9
- allowedComms: ["constructor", "nexus", "fx", "world", "render"],
10
- },
11
- /* {
12
- id: SubstanceStructIds.culledSubstnaces,
13
- type: "object-map",
14
- allowedComms: ["constructor"],
15
- }, */
16
- {
17
- id: SubstanceStructIds.isTransparent,
18
- type: "boolean",
19
- default: false,
20
- },
21
- {
22
- id: SubstanceStructIds.isSolid,
23
- type: "boolean",
24
- default: false,
25
- },
26
- {
27
- id: SubstanceStructIds.isLiquid,
28
- type: "boolean",
29
- default: false,
30
- },
31
- {
32
- id: SubstanceStructIds.flowRate,
33
- type: "number",
34
- numberType: BinaryNumberTypes.Float32,
35
- default: 1,
36
- },
37
- {
38
- id: SubstanceStructIds.isWindAffected,
39
- type: "boolean",
40
- default: false,
41
- },
42
- ]);
@@ -1,2 +0,0 @@
1
- import { StructBuilder } from "../../../Data/Structs/StructBuilder.js";
2
- export declare const VoxelStructBuilder: StructBuilder;
@@ -1,68 +0,0 @@
1
- import { BinaryNumberTypes } from "@amodx/binary";
2
- import { VoxelStructIds } from "../../Types/Voxel.types";
3
- import { StructBuilder } from "../../../Data/Structs/StructBuilder.js";
4
- export const VoxelStructBuilder = new StructBuilder("voxel-tag-manager", "voxel");
5
- VoxelStructBuilder.addNode([
6
- {
7
- id: VoxelStructIds.substance,
8
- type: "string-map",
9
- allowedComms: ["constructor", "nexus", "fx", "world", "render"],
10
- },
11
- {
12
- id: VoxelStructIds.colliderID,
13
- type: "string-map",
14
- allowedComms: ["nexus"],
15
- },
16
- {
17
- id: VoxelStructIds.checkCollisions,
18
- type: "boolean",
19
- default: false,
20
- },
21
- {
22
- id: VoxelStructIds.renderedMaterial,
23
- type: "string-map",
24
- allowedComms: ["constructor", "nexus", "fx", "world", "render"],
25
- },
26
- {
27
- id: VoxelStructIds.voxelMaterial,
28
- type: "string-map",
29
- allowedComms: ["constructor", "nexus", "fx", "world", "render"],
30
- },
31
- {
32
- id: VoxelStructIds.isLightSource,
33
- type: "boolean",
34
- default: false,
35
- },
36
- {
37
- id: VoxelStructIds.noAO,
38
- type: "boolean",
39
- default: false,
40
- },
41
- {
42
- id: VoxelStructIds.lightValue,
43
- type: "number",
44
- numberType: BinaryNumberTypes.Uint16,
45
- default: 0,
46
- },
47
- {
48
- id: VoxelStructIds.isRich,
49
- type: "boolean",
50
- default: false,
51
- },
52
- {
53
- id: VoxelStructIds.isTransparent,
54
- type: "boolean",
55
- default: false,
56
- },
57
- {
58
- id: VoxelStructIds.canHaveSecondary,
59
- type: "boolean",
60
- default: false,
61
- },
62
- {
63
- id: VoxelStructIds.hardness,
64
- type: "number",
65
- numberType: BinaryNumberTypes.Uint32,
66
- default: 0,
67
- },
68
- ]);
@@ -1,17 +0,0 @@
1
- import { BinaryStructData, InstantiatedStruct } from "@amodx/binary/";
2
- import { SubstanceStructIds } from "../Types/VoxelSubstances.types.js";
3
- export interface SubstanceStruct {
4
- [key: string]: any;
5
- [SubstanceStructIds.parent]: number;
6
- [SubstanceStructIds.isSolid]: number;
7
- [SubstanceStructIds.isTransparent]: number;
8
- [SubstanceStructIds.isLiquid]: number;
9
- [SubstanceStructIds.flowRate]: number;
10
- [SubstanceStructIds.isWindAffected]: number;
11
- }
12
- export declare class SubstanceStruct extends InstantiatedStruct<SubstanceStruct> {
13
- static instance: SubstanceStruct;
14
- static init(data: BinaryStructData): void;
15
- static setSubstance(id: string | number): void;
16
- static initData: BinaryStructData;
17
- }
@@ -1,17 +0,0 @@
1
- import { RemoteBinaryStruct, InstantiatedStruct, } from "@amodx/binary/";
2
- import { SubstanceStructIds } from "../Types/VoxelSubstances.types.js";
3
- import { SubstancePalette } from "../Palettes/SubstancePalette.js";
4
- const remote = new RemoteBinaryStruct("voxel-data");
5
- export class SubstanceStruct extends InstantiatedStruct {
6
- static instance;
7
- static init(data) {
8
- remote.init(data);
9
- const instance = remote.instantiate();
10
- this.initData = data;
11
- SubstanceStruct.instance = instance;
12
- }
13
- static setSubstance(id) {
14
- this.instance.setIndex(typeof id == "string" ? SubstancePalette.id.numberFromString(id) : id);
15
- }
16
- static initData;
17
- }
@@ -1,27 +0,0 @@
1
- import { BinaryStructData, InstantiatedStruct } from "@amodx/binary/";
2
- import { VoxelStructIds } from "../Types/Voxel.types";
3
- export interface VoxelStruct {
4
- [key: string]: any;
5
- [VoxelStructIds.substance]: number;
6
- [VoxelStructIds.renderedMaterial]: number;
7
- [VoxelStructIds.voxelMaterial]: number;
8
- [VoxelStructIds.hardness]: number;
9
- [VoxelStructIds.colliderID]: number;
10
- [VoxelStructIds.checkCollisions]: number;
11
- [VoxelStructIds.isLightSource]: number;
12
- [VoxelStructIds.noAO]: number;
13
- [VoxelStructIds.lightValue]: number;
14
- [VoxelStructIds.isRich]: number;
15
- [VoxelStructIds.canHaveSecondary]: number;
16
- [VoxelStructIds.isTransparent]: number;
17
- }
18
- export declare class VoxelStruct extends InstantiatedStruct<VoxelStruct> {
19
- static instance: VoxelStruct;
20
- static init(data: BinaryStructData): void;
21
- static clone(): InstantiatedStruct<VoxelStruct> & VoxelStruct;
22
- static sync(voxelMap: Uint16Array): void;
23
- static setVoxel(id: number): void;
24
- static setStringVoxel(id: string): void;
25
- static voxelIndex: Uint16Array;
26
- static initData: BinaryStructData;
27
- }
@@ -1,29 +0,0 @@
1
- import { RemoteBinaryStruct, InstantiatedStruct, } from "@amodx/binary/";
2
- import { VoxelStructIds } from "../Types/Voxel.types";
3
- import { VoxelPalette } from "../Palettes/VoxelPalette";
4
- const remote = new RemoteBinaryStruct("voxel-data");
5
- export class VoxelStruct extends InstantiatedStruct {
6
- static instance;
7
- static init(data) {
8
- remote.init(data);
9
- const instance = remote.instantiate();
10
- this.initData = data;
11
- VoxelStruct.instance = instance;
12
- }
13
- static clone() {
14
- return this.instance.createClone();
15
- }
16
- static sync(voxelMap) {
17
- this.voxelIndex = voxelMap;
18
- }
19
- static setVoxel(id) {
20
- const index = this.voxelIndex[id];
21
- this.instance.setIndex(index);
22
- }
23
- static setStringVoxel(id) {
24
- const index = this.voxelIndex[VoxelPalette.ids.getNumberId(id)];
25
- this.instance.setIndex(index);
26
- }
27
- static voxelIndex = new Uint16Array();
28
- static initData;
29
- }
@@ -1,10 +0,0 @@
1
- import { Section } from "./Section";
2
- export declare class SectionHeightMap {
3
- private static _sectionState;
4
- static setSection(section: Section): typeof SectionHeightMap;
5
- static setVoxel(y: number, hasVoxel: boolean): void;
6
- static getVoxel(y: number): boolean;
7
- static setDirty(y: number, dirty: boolean): void;
8
- static getDirty(y: number): boolean;
9
- static getMinMax(): number[];
10
- }
@@ -1,39 +0,0 @@
1
- import { WorldSpaces } from "../WorldSpaces";
2
- import { Section } from "./Section";
3
- import { SectionStructProperties } from "./SectionStructProperties";
4
- export class SectionHeightMap {
5
- static _sectionState;
6
- static setSection(section) {
7
- if (!this._sectionState)
8
- this._sectionState = Section.StateStruct.instantiate();
9
- this._sectionState.setData(section.sectionState);
10
- return this;
11
- }
12
- static setVoxel(y, hasVoxel) {
13
- this._sectionState[SectionStructProperties.heightMap][y] = hasVoxel ? 1 : 0;
14
- }
15
- static getVoxel(y) {
16
- return this._sectionState[SectionStructProperties.heightMap][y] == 1;
17
- }
18
- static setDirty(y, dirty) {
19
- this._sectionState[SectionStructProperties.dirtyMap][y] = dirty ? 1 : 0;
20
- }
21
- static getDirty(y) {
22
- return this._sectionState[SectionStructProperties.dirtyMap][y] == 1;
23
- }
24
- static getMinMax() {
25
- let min = Infinity;
26
- let max = -Infinity;
27
- let i = WorldSpaces.section.bounds.y;
28
- while (i--) {
29
- if (this._sectionState[SectionStructProperties.heightMap][i] ||
30
- this._sectionState[SectionStructProperties.dirtyMap][i]) {
31
- if (i < min)
32
- min = i;
33
- if (i > max)
34
- max = i;
35
- }
36
- }
37
- return [min, max];
38
- }
39
- }
@@ -1,8 +0,0 @@
1
- import { SectionStructProperties } from "./SectionStructProperties.js";
2
- export interface SectionStruct {
3
- [SectionStructProperties.minHeight]: number;
4
- [SectionStructProperties.maxHeight]: number;
5
- [SectionStructProperties.heightMap]: number[];
6
- [SectionStructProperties.dirtyMap]: number[];
7
- }
8
- export declare function InitalizeSectionTags(): void;
@@ -1,29 +0,0 @@
1
- import { BinaryNumberTypes, BinaryStruct } from "@amodx/binary/";
2
- import { WorldSpaces } from "../WorldSpaces.js";
3
- import { SectionStructProperties } from "./SectionStructProperties.js";
4
- import { Section } from "./Section.js";
5
- const SectionStateStruct = new BinaryStruct("section-tags");
6
- SectionStateStruct.registerProperty({
7
- id: SectionStructProperties.minHeight,
8
- type: "typed-number",
9
- numberType: BinaryNumberTypes.Uint8,
10
- }, {
11
- id: SectionStructProperties.maxHeight,
12
- type: "typed-number",
13
- numberType: BinaryNumberTypes.Uint8,
14
- });
15
- export function InitalizeSectionTags() {
16
- SectionStateStruct.registerProperty({
17
- id: SectionStructProperties.heightMap,
18
- type: "bit-array",
19
- length: WorldSpaces.section.bounds.y,
20
- }, {
21
- id: SectionStructProperties.dirtyMap,
22
- type: "bit-array",
23
- length: WorldSpaces.section.bounds.y,
24
- });
25
- const initData = SectionStateStruct.init({
26
- indexBufferMode: "shared",
27
- });
28
- Section.StateStruct.init(initData);
29
- }
@@ -1,10 +0,0 @@
1
- export declare enum SectionStructProperties {
2
- minHeight = "dve_min_height",
3
- maxHeight = "dve_max_height",
4
- heightMap = "dve_height_map",
5
- dirtyMap = "dve_dirty_map",
6
- voxelIDSegment = "dve_voxel_id",
7
- voxelLightSegment = "dve_voxel_light",
8
- voxelStateSegment = "dve_voxel_state",
9
- voxelSecondaryIDSegment = "dve_voxel_secondary_id"
10
- }
@@ -1,11 +0,0 @@
1
- export var SectionStructProperties;
2
- (function (SectionStructProperties) {
3
- SectionStructProperties["minHeight"] = "dve_min_height";
4
- SectionStructProperties["maxHeight"] = "dve_max_height";
5
- SectionStructProperties["heightMap"] = "dve_height_map";
6
- SectionStructProperties["dirtyMap"] = "dve_dirty_map";
7
- SectionStructProperties["voxelIDSegment"] = "dve_voxel_id";
8
- SectionStructProperties["voxelLightSegment"] = "dve_voxel_light";
9
- SectionStructProperties["voxelStateSegment"] = "dve_voxel_state";
10
- SectionStructProperties["voxelSecondaryIDSegment"] = "dve_voxel_secondary_id";
11
- })(SectionStructProperties || (SectionStructProperties = {}));
@@ -1 +0,0 @@
1
- export declare function InitalizeSectorTags(): void;
@@ -1,46 +0,0 @@
1
- import { BinaryNumberTypes, BinaryStruct } from "@amodx/binary/";
2
- import { Sector } from "./Sector.js";
3
- import { SectorStateStructIds } from "./SectorStructIds.js";
4
- const SectorStateStruct = new BinaryStruct("sector-tags");
5
- SectorStateStruct.registerProperty({
6
- id: SectorStateStructIds.lastSaveTimestamp,
7
- type: "typed-number",
8
- numberType: BinaryNumberTypes.Uint32,
9
- }, {
10
- id: SectorStateStructIds.lastAnalyzerUpdateTimestamp,
11
- type: "typed-number",
12
- numberType: BinaryNumberTypes.Uint32,
13
- }, {
14
- id: SectorStateStructIds.hasRichData,
15
- type: "boolean",
16
- }, {
17
- id: SectorStateStructIds.hasEntityData,
18
- type: "boolean",
19
- }, {
20
- id: SectorStateStructIds.isStored,
21
- type: "boolean",
22
- }, {
23
- id: SectorStateStructIds.isWorldGenDone,
24
- type: "boolean",
25
- }, {
26
- id: SectorStateStructIds.isWorldDecorDone,
27
- type: "boolean",
28
- }, {
29
- id: SectorStateStructIds.isWorldSunDone,
30
- type: "boolean",
31
- }, {
32
- id: SectorStateStructIds.isWorldPropagationDone,
33
- type: "boolean",
34
- }, {
35
- id: SectorStateStructIds.isDirty,
36
- type: "boolean",
37
- }, {
38
- id: SectorStateStructIds.persistent,
39
- type: "boolean",
40
- });
41
- export function InitalizeSectorTags() {
42
- const initData = SectorStateStruct.init({
43
- indexBufferMode: "shared",
44
- });
45
- Sector.StateStruct.init(initData);
46
- }
@@ -1,13 +0,0 @@
1
- export declare enum SectorStateStructIds {
2
- lastSaveTimestamp = "dve_last_save_timestamp",
3
- lastAnalyzerUpdateTimestamp = "dve_last_analyzer_update_timestamp",
4
- hasRichData = "dve_has_rich_data",
5
- hasEntityData = "dve_has_entity_data",
6
- isStored = "dve_is_stored",
7
- isWorldGenDone = "dve_is_world_gen_done",
8
- isWorldDecorDone = "dve_is_world_decor_done",
9
- isWorldSunDone = "dve_is_world_sun_done",
10
- isWorldPropagationDone = "dve_is_world_propagation_done",
11
- isDirty = "dve_is_dirty",
12
- persistent = "dve_persistent"
13
- }