@divinevoxel/vlox 0.0.75 → 0.0.76

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 (97) hide show
  1. package/Builder/RayProvider.d.ts +6 -0
  2. package/Builder/RayProvider.js +1 -0
  3. package/Builder/Tools/Box/BoxSelection.d.ts +12 -0
  4. package/Builder/Tools/Box/BoxSelection.js +27 -0
  5. package/Builder/Tools/Box/BoxTool.d.ts +31 -0
  6. package/Builder/Tools/Box/BoxTool.js +91 -0
  7. package/Builder/Tools/Box/BoxToolTemplate.d.ts +13 -0
  8. package/Builder/Tools/Box/BoxToolTemplate.js +23 -0
  9. package/Builder/Tools/Brush/BrushTool.d.ts +48 -0
  10. package/Builder/Tools/Brush/BrushTool.js +146 -0
  11. package/Builder/Tools/BuilderToolBase.d.ts +3 -0
  12. package/Builder/Tools/BuilderToolBase.js +3 -0
  13. package/Builder/Tools/Hand/HandTool.d.ts +22 -0
  14. package/Builder/Tools/Hand/HandTool.js +56 -0
  15. package/Builder/Tools/Path/PahtTool.d.ts +29 -0
  16. package/Builder/Tools/Path/PahtTool.js +117 -0
  17. package/Builder/Tools/Wand/WandTool.d.ts +28 -0
  18. package/Builder/Tools/Wand/WandTool.js +67 -0
  19. package/Builder/Tools/Wrench/WrenchTool.d.ts +47 -0
  20. package/Builder/Tools/Wrench/WrenchTool.js +175 -0
  21. package/Builder/VoxelBuildSpace.d.ts +61 -0
  22. package/Builder/VoxelBuildSpace.js +165 -0
  23. package/Builder/VoxelBuilder.types.d.ts +0 -0
  24. package/Builder/VoxelBuilder.types.js +1 -0
  25. package/Builder/World/InitTasks.d.ts +1 -0
  26. package/Builder/World/InitTasks.js +134 -0
  27. package/Builder/World/VoxelBuildSpaceWorld.d.ts +4 -0
  28. package/Builder/World/VoxelBuildSpaceWorld.js +10 -0
  29. package/Contexts/Render/DivineVoxelEngineRender.d.ts +5 -5
  30. package/Contexts/World/DivineVoxelEngineWorld.d.ts +5 -5
  31. package/Mesher/Functions/Base/MeshSectionBase.js +3 -0
  32. package/Mesher/Functions/MeshVoxel.js +2 -0
  33. package/Mesher/Geomtry/VoxelMeshBVHBuilder.d.ts +2 -2
  34. package/Mesher/Models/Common/Calc/CalcConstants.d.ts +1 -1
  35. package/Mesher/Models/Procedures/Default/OutlinedTextureProcedure.js +8 -8
  36. package/Tasks/Paint/Erase/EraseVoxel.js +1 -1
  37. package/Tasks/Paint/Paint/PaintVoxel.js +1 -1
  38. package/Templates/Archive/ArchivedVoxelTemplate.d.ts +1 -0
  39. package/Templates/Archive/ArchivedVoxelTemplate.js +4 -0
  40. package/Templates/Archive/Functions/CreateArchivedTemplate.js +4 -2
  41. package/Templates/Cursor/TemplateCursor.js +3 -1
  42. package/Templates/Cursor/TemplateProxy.d.ts +1 -0
  43. package/Templates/Cursor/TemplateProxy.js +14 -0
  44. package/Templates/Full/FullVoxelTemplate.d.ts +1 -0
  45. package/Templates/Full/FullVoxelTemplate.js +4 -0
  46. package/Templates/Path/VoxelPath.d.ts +4 -0
  47. package/Templates/Path/VoxelPath.js +17 -0
  48. package/Templates/Path/VoxelPath.types.d.ts +1 -0
  49. package/Templates/Selection/VoxelBFSSelection.d.ts +3 -0
  50. package/Templates/Selection/VoxelBFSSelection.js +11 -0
  51. package/Templates/Selection/VoxelBoxSelection.d.ts +3 -0
  52. package/Templates/Selection/VoxelBoxSelection.js +11 -0
  53. package/Templates/Selection/VoxelPointSelection.d.ts +17 -0
  54. package/Templates/Selection/VoxelPointSelection.js +48 -0
  55. package/Templates/Selection/VoxelSelecton.d.ts +3 -0
  56. package/Templates/Selection/VoxelSurfaceSelection.d.ts +3 -0
  57. package/Templates/Selection/VoxelSurfaceSelection.js +18 -0
  58. package/Templates/Selection/VoxelTemplateSelection.d.ts +3 -0
  59. package/Templates/Selection/VoxelTemplateSelection.js +10 -0
  60. package/Templates/Shapes/BasicVoxelShapeTemplate.d.ts +1 -0
  61. package/Templates/Shapes/BoxVoxelTemplate.d.ts +1 -0
  62. package/Templates/Shapes/BoxVoxelTemplate.js +8 -0
  63. package/Templates/Shapes/ConeVoxelTemplate.d.ts +1 -0
  64. package/Templates/Shapes/ConeVoxelTemplate.js +4 -0
  65. package/Templates/Shapes/CylinderVoxelTemplate.d.ts +1 -0
  66. package/Templates/Shapes/CylinderVoxelTemplate.js +4 -0
  67. package/Templates/Shapes/EllipsoidVoxelTemplate.d.ts +23 -0
  68. package/Templates/Shapes/EllipsoidVoxelTemplate.js +89 -0
  69. package/Templates/Shapes/OctahedronVoxelTemplate.d.ts +1 -0
  70. package/Templates/Shapes/OctahedronVoxelTemplate.js +4 -0
  71. package/Templates/Shapes/PyramidVoxelTemplate.d.ts +1 -0
  72. package/Templates/Shapes/PyramidVoxelTemplate.js +8 -0
  73. package/Templates/Shapes/SphereVoxelTemplate.d.ts +3 -12
  74. package/Templates/Shapes/SphereVoxelTemplate.js +21 -59
  75. package/Templates/Shapes/TorusVoxelTemplate.d.ts +1 -0
  76. package/Templates/Shapes/TorusVoxelTemplate.js +4 -0
  77. package/Templates/Shapes/VoxelShapeTemplate.types.d.ts +2 -0
  78. package/Templates/Shapes/VoxelShapeTemplate.types.js +6 -1
  79. package/Templates/VoxelTemplates.types.d.ts +1 -0
  80. package/Textures/Classes/TextureAnimationTexture.d.ts +1 -1
  81. package/Util/BinaryBuffer/Functions/BinaryBufferConvert.d.ts +1 -1
  82. package/Util/BinaryBuffer/Functions/BinaryBufferToTypedArray.d.ts +1 -1
  83. package/Util/LocationData.d.ts +1 -1
  84. package/Voxels/Cursor/VoxelCursor.interface.d.ts +2 -0
  85. package/Voxels/Cursor/VoxelCursor.interface.js +2 -0
  86. package/Voxels/Interaction/Functions/PickVoxelWorld.js +15 -43
  87. package/Voxels/Interaction/VoxelPickResult.d.ts +1 -0
  88. package/Voxels/Interaction/VoxelPickResult.js +3 -0
  89. package/Voxels/State/Schema/BinarySchemaNode.d.ts +2 -1
  90. package/Voxels/State/Schema/BinarySchemaNode.js +5 -2
  91. package/Voxels/State/Schema/Conditions/SameVoxelConditions.js +2 -0
  92. package/Voxels/Types/PaintVoxelData.d.ts +11 -1
  93. package/Voxels/Types/PaintVoxelData.js +100 -14
  94. package/World/Archive/Functions/Shared/LightSegments.d.ts +1 -1
  95. package/World/Sector/Sector.d.ts +1 -1
  96. package/WorldSimulation/Dimensions/SimulationSector.d.ts +1 -1
  97. package/package.json +1 -1
@@ -1,19 +1,25 @@
1
1
  import { VoxelPalettesRegister } from "../Data/VoxelPalettesRegister";
2
2
  import { VoxelLevelReader } from "../Cursor/VoxelLevelReader";
3
+ import { SchemaRegister } from "../../Voxels/State/SchemaRegister";
3
4
  export class PaintVoxelData {
4
5
  id;
5
6
  name;
6
- mod;
7
7
  state;
8
+ stateString;
9
+ mod;
10
+ modString;
8
11
  level;
9
12
  levelState;
10
13
  secondaryVoxelId;
11
14
  secondaryName;
12
15
  secondaryMod;
16
+ secondaryModString;
13
17
  secondaryState;
18
+ secondaryStateString;
14
19
  static Create(data = {}) {
15
- return new PaintVoxelData(data.id, data.name, data.mod, data.state, data.level, data.levelState, data.secondaryVoxelId, data.secondaryName, data.secondaryMod, data.secondaryState);
20
+ return new PaintVoxelData(data.id, data.name, data.state, data.stateString, data.mod, data.modString, data.level, data.levelState, data.secondaryVoxelId, data.secondaryName, data.secondaryMod, data.secondaryModString, data.secondaryState, data.secondaryModString);
16
21
  }
22
+ /**Transforms numeric voxel data into a PaintVoxelData object */
17
23
  static FromRaw(data, paintData = PaintVoxelData.Create()) {
18
24
  const [trueVoxelId, state, mod] = VoxelPalettesRegister.voxels[data[0]];
19
25
  paintData.id = VoxelPalettesRegister.voxelIds.getStringId(trueVoxelId);
@@ -34,23 +40,48 @@ export class PaintVoxelData {
34
40
  paintData.levelState = VoxelLevelReader.getLevel(data[2]);
35
41
  return paintData;
36
42
  }
43
+ /**Transforms the voxel data into numeric voxel data */
37
44
  static ToRaw(data, light = 0) {
38
45
  let stringId = data.id
39
46
  ? data.id
40
47
  : data.name
41
48
  ? VoxelPalettesRegister.voxelNametoIdMap.get(data.name)
42
49
  : "dve_air";
43
- let secondaryStringId = data.id
44
- ? data.id
45
- : data.name
46
- ? VoxelPalettesRegister.voxelNametoIdMap.get(data.name)
50
+ let secondaryStringId = data.secondaryName
51
+ ? data.secondaryVoxelId
52
+ : data.secondaryName
53
+ ? VoxelPalettesRegister.voxelNametoIdMap.get(data.secondaryName)
47
54
  : "dve_air";
48
- const id = (stringId !== "dve_air" &&
49
- VoxelPalettesRegister.getVoxelIdFromString(stringId, data.state || 0, data.mod || 0)) ||
50
- 0;
51
- const secondaryId = (secondaryStringId !== "dve_air" &&
52
- VoxelPalettesRegister.getVoxelIdFromString(secondaryStringId, data.secondaryState || 0, data.secondaryMod || 0)) ||
53
- 0;
55
+ let state = data.state || 0;
56
+ let mod = data.mod || 0;
57
+ let secondaryState = data.secondaryState || 0;
58
+ let secondaryMod = data.secondaryMod || 0;
59
+ if (SchemaRegister.hasVoxelSchema(stringId)) {
60
+ const schema = SchemaRegister.getVoxelSchemas(stringId);
61
+ if (data.stateString && data.stateString !== "") {
62
+ state = schema.state.readString(data.stateString);
63
+ }
64
+ if (data.modString && data.modString !== "") {
65
+ mod = schema.mod.readString(data.modString);
66
+ }
67
+ }
68
+ if (secondaryStringId && SchemaRegister.hasVoxelSchema(secondaryStringId)) {
69
+ const schema = SchemaRegister.getVoxelSchemas(secondaryStringId);
70
+ if (data.secondaryStateString && data.secondaryStateString !== "") {
71
+ secondaryState = schema.state.readString(data.secondaryStateString);
72
+ }
73
+ if (data.secondaryModString && data.secondaryModString !== "") {
74
+ secondaryMod = schema.mod.readString(data.secondaryModString);
75
+ }
76
+ }
77
+ const id = stringId !== "dve_air"
78
+ ? VoxelPalettesRegister.getVoxelIdFromString(stringId, state || 0, mod || 0)
79
+ : 0;
80
+ const secondaryId = secondaryStringId !== "dve_air"
81
+ ? secondaryStringId
82
+ ? VoxelPalettesRegister.getVoxelIdFromString(secondaryStringId, secondaryState || 0, secondaryMod || 0)
83
+ : 0
84
+ : 0;
54
85
  let levleData = 0;
55
86
  if (data.level !== undefined)
56
87
  levleData = VoxelLevelReader.setLevel(levleData, data.level);
@@ -58,16 +89,71 @@ export class PaintVoxelData {
58
89
  levleData = VoxelLevelReader.setLevelState(levleData, data.levelState);
59
90
  return [id, light, levleData, secondaryId];
60
91
  }
61
- constructor(id = "dve_air", name = "", mod = 0, state = 0, level = 0, levelState = 0, secondaryVoxelId = "dve_air", secondaryName = "", secondaryMod = 0, secondaryState = 0) {
92
+ /**Restores the data to the default state of being dve_air */
93
+ static Clear(data) {
94
+ data.id = "dve_air";
95
+ data.name = "";
96
+ data.state = 0;
97
+ data.stateString = "";
98
+ data.mod = 0;
99
+ data.modString = "";
100
+ data.level = 0;
101
+ data.levelState = 0;
102
+ data.secondaryVoxelId = "dve_air";
103
+ data.secondaryName = "";
104
+ data.secondaryMod = 0;
105
+ data.secondaryModString = "";
106
+ data.secondaryState = 0;
107
+ data.secondaryStateString = "";
108
+ return data;
109
+ }
110
+ /**Clears the target data and then copies properties from source to target. */
111
+ static Set(target, source) {
112
+ PaintVoxelData.Clear(target);
113
+ if (source.id !== undefined)
114
+ target.id = source.id;
115
+ if (source.name !== undefined)
116
+ target.name = source.name;
117
+ if (source.state !== undefined)
118
+ target.state = source.state;
119
+ if (source.stateString !== undefined)
120
+ target.stateString = source.stateString;
121
+ if (source.mod !== undefined)
122
+ target.mod = source.mod;
123
+ if (source.modString !== undefined)
124
+ target.modString = source.modString;
125
+ if (source.level !== undefined)
126
+ target.level = source.level;
127
+ if (source.levelState !== undefined)
128
+ target.levelState = source.levelState;
129
+ if (source.secondaryVoxelId !== undefined)
130
+ target.secondaryVoxelId = source.secondaryVoxelId;
131
+ if (source.secondaryName !== undefined)
132
+ target.secondaryName = source.secondaryName;
133
+ if (source.secondaryMod !== undefined)
134
+ target.secondaryMod = source.secondaryMod;
135
+ if (source.secondaryModString !== undefined)
136
+ target.secondaryModString = source.secondaryModString;
137
+ if (source.secondaryState !== undefined)
138
+ target.secondaryState = source.secondaryState;
139
+ if (source.secondaryStateString !== undefined)
140
+ target.secondaryStateString = source.secondaryStateString;
141
+ return target;
142
+ }
143
+ constructor(id = "dve_air", name = "", state = 0, stateString = "", mod = 0, modString = "", level = 0, levelState = 0, secondaryVoxelId = "dve_air", secondaryName = "", secondaryMod = 0, secondaryModString = "", secondaryState = 0, secondaryStateString = "") {
62
144
  this.id = id;
63
145
  this.name = name;
64
- this.mod = mod;
65
146
  this.state = state;
147
+ this.stateString = stateString;
148
+ this.mod = mod;
149
+ this.modString = modString;
66
150
  this.level = level;
67
151
  this.levelState = levelState;
68
152
  this.secondaryVoxelId = secondaryVoxelId;
69
153
  this.secondaryName = secondaryName;
70
154
  this.secondaryMod = secondaryMod;
155
+ this.secondaryModString = secondaryModString;
71
156
  this.secondaryState = secondaryState;
157
+ this.secondaryStateString = secondaryStateString;
72
158
  }
73
159
  }
@@ -2,4 +2,4 @@ import { ArchivedLightSegments } from "../../Types/Archive.types";
2
2
  export declare const lightSegments: ArchivedLightSegments[];
3
3
  export declare const lightSemgnetGet: Record<ArchivedLightSegments, (value: number) => number>;
4
4
  export declare const lightSemgnetSet: Record<ArchivedLightSegments, (value: number, source: number) => number>;
5
- export declare function getLightBuffer(light: ArchivedLightSegments, buffer: Uint16Array): Uint8Array;
5
+ export declare function getLightBuffer(light: ArchivedLightSegments, buffer: Uint16Array): Uint8Array<ArrayBuffer>;
@@ -16,7 +16,7 @@ export declare class Sector {
16
16
  static TimeStampIds: typeof import("./SectorState.js").SectorStateDefaultTimeStamps;
17
17
  static GetHeaderSize(): number;
18
18
  static GetBufferSize(): number;
19
- static CreateNewBuffer(): ArrayBuffer;
19
+ static CreateNewBuffer(): ArrayBuffer | SharedArrayBuffer;
20
20
  sections: Section[];
21
21
  bufferView: Uint8Array;
22
22
  position: Vec3Array;
@@ -15,7 +15,7 @@ export declare class SimulationSector {
15
15
  _rendered: boolean;
16
16
  _genAllDone: boolean;
17
17
  /**An array of the last tick each section was built at */
18
- _displayTicks: Uint32Array;
18
+ _displayTicks: Uint32Array<ArrayBuffer>;
19
19
  tickQueue: TickQueue;
20
20
  neighbors: SimulationSector[];
21
21
  fullNeighbors: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@divinevoxel/vlox",
3
- "version": "0.0.75",
3
+ "version": "0.0.76",
4
4
  "description": "Vlox a block style voxel engine.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",