@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
@@ -60,10 +60,18 @@ export class BoxVoxelTemplate extends BasicVoxelShapeTemplate {
60
60
  this._width = data.width;
61
61
  this._height = data.height;
62
62
  this._depth = data.depth;
63
+ this.bounds.size.x = data.width;
64
+ this.bounds.size.y = data.height;
65
+ this.bounds.size.z = data.depth;
66
+ this._updateBounds();
63
67
  }
64
68
  isIncluded(index) {
65
69
  return true;
66
70
  }
71
+ clone() {
72
+ const newTemplate = new BoxVoxelTemplate(structuredClone(this.toJSON()));
73
+ return newTemplate;
74
+ }
67
75
  toJSON() {
68
76
  return {
69
77
  width: this.width,
@@ -18,5 +18,6 @@ export declare class ConeVoxelTemplate extends BasicVoxelShapeTemplate<"cone-sha
18
18
  set depth(depth: number);
19
19
  constructor(data: ConeVoxelTemplateData);
20
20
  isIncluded(index: number): boolean;
21
+ clone(): ConeVoxelTemplate;
21
22
  toJSON(): ConeVoxelTemplateData;
22
23
  }
@@ -58,6 +58,10 @@ export class ConeVoxelTemplate extends BasicVoxelShapeTemplate {
58
58
  isIncluded(index) {
59
59
  return true;
60
60
  }
61
+ clone() {
62
+ const newTemplate = new ConeVoxelTemplate(structuredClone(this.toJSON()));
63
+ return newTemplate;
64
+ }
61
65
  toJSON() {
62
66
  return {
63
67
  width: this.width,
@@ -18,5 +18,6 @@ export declare class CylinderVoxelTemplate extends BasicVoxelShapeTemplate<"cyli
18
18
  set depth(depth: number);
19
19
  constructor(data: CylinderVoxelTemplateData);
20
20
  isIncluded(index: number): boolean;
21
+ clone(): CylinderVoxelTemplate;
21
22
  toJSON(): CylinderVoxelTemplateData;
22
23
  }
@@ -58,6 +58,10 @@ export class CylinderVoxelTemplate extends BasicVoxelShapeTemplate {
58
58
  isIncluded(index) {
59
59
  return true;
60
60
  }
61
+ clone() {
62
+ const newTemplate = new CylinderVoxelTemplate(structuredClone(this.toJSON()));
63
+ return newTemplate;
64
+ }
61
65
  toJSON() {
62
66
  return {
63
67
  width: this.width,
@@ -0,0 +1,23 @@
1
+ import { IVoxelShapeTemplateData } from "./VoxelShapeTemplate.types";
2
+ import { BasicVoxelShapeTemplate } from "./BasicVoxelShapeTemplate";
3
+ export interface SphereVoxelTemplateData extends IVoxelShapeTemplateData<"ellipsoid-shape"> {
4
+ radiusX: number;
5
+ radiusY: number;
6
+ radiusZ: number;
7
+ }
8
+ export declare class EllipsoidVoxelTemplate extends BasicVoxelShapeTemplate<"ellipsoid-shape", SphereVoxelTemplateData> {
9
+ static CreateNew(data: Partial<SphereVoxelTemplateData>): SphereVoxelTemplateData;
10
+ private _radiusX;
11
+ get radiusX(): number;
12
+ set radiusX(radius: number);
13
+ private _radiusY;
14
+ get radiusY(): number;
15
+ set radiusY(radius: number);
16
+ private _radiusZ;
17
+ get radiusZ(): number;
18
+ set radiusZ(radius: number);
19
+ constructor(data: SphereVoxelTemplateData);
20
+ isIncluded(index: number): boolean;
21
+ clone(): EllipsoidVoxelTemplate;
22
+ toJSON(): SphereVoxelTemplateData;
23
+ }
@@ -0,0 +1,89 @@
1
+ import { BasicVoxelShapeTemplate } from "./BasicVoxelShapeTemplate";
2
+ export class EllipsoidVoxelTemplate extends BasicVoxelShapeTemplate {
3
+ static CreateNew(data) {
4
+ return {
5
+ ...BasicVoxelShapeTemplate.CreateBaseData("ellipsoid-shape", {
6
+ bounds: {
7
+ x: (data.radiusX || 1) * 2 + 1,
8
+ y: (data.radiusY || 1) * 2 + 1,
9
+ z: (data.radiusZ || 1) * 2 + 1,
10
+ },
11
+ }),
12
+ radiusX: data.radiusX || 1,
13
+ radiusY: data.radiusY || 1,
14
+ radiusZ: data.radiusZ || 1,
15
+ };
16
+ }
17
+ _radiusX = 0;
18
+ get radiusX() {
19
+ return this._radiusX;
20
+ }
21
+ set radiusX(radius) {
22
+ const oldRadius = this._radiusX;
23
+ this._radiusX = radius;
24
+ if (oldRadius != radius) {
25
+ this.bounds.size.x = radius * 2 + 1;
26
+ this._updateBounds();
27
+ this.dispatch("updated", null);
28
+ }
29
+ }
30
+ _radiusY = 0;
31
+ get radiusY() {
32
+ return this._radiusY;
33
+ }
34
+ set radiusY(radius) {
35
+ const oldRadius = this._radiusY;
36
+ this._radiusY = radius;
37
+ if (oldRadius != radius) {
38
+ this.bounds.size.y = radius * 2 + 1;
39
+ this._updateBounds();
40
+ this.dispatch("updated", null);
41
+ }
42
+ }
43
+ _radiusZ = 0;
44
+ get radiusZ() {
45
+ return this._radiusZ;
46
+ }
47
+ set radiusZ(radius) {
48
+ const oldRadius = this._radiusZ;
49
+ this._radiusZ = radius;
50
+ if (oldRadius != radius) {
51
+ this.bounds.size.z = radius * 2 + 1;
52
+ this._updateBounds();
53
+ this.dispatch("updated", null);
54
+ }
55
+ }
56
+ constructor(data) {
57
+ super(data);
58
+ this._radiusX = data.radiusX;
59
+ this._radiusY = data.radiusY;
60
+ this._radiusZ = data.radiusZ;
61
+ this.bounds.size.x = this._radiusX * 2 + 1;
62
+ this.bounds.size.y = this._radiusY * 2 + 1;
63
+ this.bounds.size.z = this._radiusZ * 2 + 1;
64
+ this._updateBounds();
65
+ }
66
+ isIncluded(index) {
67
+ const [x, y, z] = this.index.getXYZ(index);
68
+ const cx = Math.floor(this.bounds.size.x / 2);
69
+ const cy = Math.floor(this.bounds.size.y / 2);
70
+ const cz = Math.floor(this.bounds.size.z / 2);
71
+ const normX = (x - cx) / this.radiusX;
72
+ const normY = (y - cy) / this.radiusY;
73
+ const normZ = (z - cz) / this.radiusZ;
74
+ const distance = Math.sqrt(normX * normX + normY * normY + normZ * normZ);
75
+ return distance <= 1;
76
+ }
77
+ clone() {
78
+ const newTemplate = new EllipsoidVoxelTemplate(structuredClone(this.toJSON()));
79
+ return newTemplate;
80
+ }
81
+ toJSON() {
82
+ return {
83
+ ...this.getBaseJSON(),
84
+ radiusX: this.radiusX,
85
+ radiusY: this.radiusY,
86
+ radiusZ: this.radiusZ,
87
+ };
88
+ }
89
+ }
@@ -18,5 +18,6 @@ export declare class OctahedronVoxelTemplate extends BasicVoxelShapeTemplate<"oc
18
18
  set depth(depth: number);
19
19
  constructor(data: OctahedronVoxelTemplateData);
20
20
  isIncluded(index: number): boolean;
21
+ clone(): OctahedronVoxelTemplate;
21
22
  toJSON(): OctahedronVoxelTemplateData;
22
23
  }
@@ -58,6 +58,10 @@ export class OctahedronVoxelTemplate extends BasicVoxelShapeTemplate {
58
58
  isIncluded(index) {
59
59
  return true;
60
60
  }
61
+ clone() {
62
+ const newTemplate = new OctahedronVoxelTemplate(structuredClone(this.toJSON()));
63
+ return newTemplate;
64
+ }
61
65
  toJSON() {
62
66
  return {
63
67
  width: this.width,
@@ -26,5 +26,6 @@ export declare class PyramidVoxelTemplate extends BasicVoxelShapeTemplate<"pyram
26
26
  set depth(depth: number);
27
27
  constructor(data: PyramidVoxelTemplateData);
28
28
  isIncluded(index: number): boolean;
29
+ clone(): PyramidVoxelTemplate;
29
30
  toJSON(): PyramidVoxelTemplateData;
30
31
  }
@@ -80,6 +80,10 @@ export class PyramidVoxelTemplate extends BasicVoxelShapeTemplate {
80
80
  this._width = data.width;
81
81
  this._height = data.height;
82
82
  this._depth = data.depth;
83
+ this.bounds.size.x = this._width;
84
+ this.bounds.size.y = this._height;
85
+ this.bounds.size.z = this._depth;
86
+ this._updateBounds();
83
87
  }
84
88
  isIncluded(index) {
85
89
  const [x, y, z] = this.index.getXYZ(index);
@@ -127,6 +131,10 @@ export class PyramidVoxelTemplate extends BasicVoxelShapeTemplate {
127
131
  return false;
128
132
  }
129
133
  }
134
+ clone() {
135
+ const newTemplate = new PyramidVoxelTemplate(structuredClone(this.toJSON()));
136
+ return newTemplate;
137
+ }
130
138
  toJSON() {
131
139
  return {
132
140
  width: this.width,
@@ -1,24 +1,15 @@
1
1
  import { IVoxelShapeTemplateData } from "./VoxelShapeTemplate.types";
2
2
  import { BasicVoxelShapeTemplate } from "./BasicVoxelShapeTemplate";
3
3
  export interface SphereVoxelTemplateData extends IVoxelShapeTemplateData<"sphere-shape"> {
4
- radiusX: number;
5
- radiusY: number;
6
- radiusZ: number;
4
+ radius: number;
7
5
  }
8
6
  export declare class SphereVoxelTemplate extends BasicVoxelShapeTemplate<"sphere-shape", SphereVoxelTemplateData> {
9
7
  static CreateNew(data: Partial<SphereVoxelTemplateData>): SphereVoxelTemplateData;
8
+ private _radius;
10
9
  get radius(): number;
11
10
  set radius(radius: number);
12
- private _radiusX;
13
- get radiusX(): number;
14
- set radiusX(radius: number);
15
- private _radiusY;
16
- get radiusY(): number;
17
- set radiusY(radius: number);
18
- private _radiusZ;
19
- get radiusZ(): number;
20
- set radiusZ(radius: number);
21
11
  constructor(data: SphereVoxelTemplateData);
22
12
  isIncluded(index: number): boolean;
13
+ clone(): SphereVoxelTemplate;
23
14
  toJSON(): SphereVoxelTemplateData;
24
15
  }
@@ -4,24 +4,21 @@ export class SphereVoxelTemplate extends BasicVoxelShapeTemplate {
4
4
  return {
5
5
  ...BasicVoxelShapeTemplate.CreateBaseData("sphere-shape", {
6
6
  bounds: {
7
- x: (data.radiusX || 1) * 2 + 1,
8
- y: (data.radiusY || 1) * 2 + 1,
9
- z: (data.radiusZ || 1) * 2 + 1,
7
+ x: (data.radius || 1) * 2 + 1,
8
+ y: (data.radius || 1) * 2 + 1,
9
+ z: (data.radius || 1) * 2 + 1,
10
10
  },
11
11
  }),
12
- radiusX: data.radiusX || 1,
13
- radiusY: data.radiusY || 1,
14
- radiusZ: data.radiusZ || 1,
12
+ radius: data.radius || 1,
15
13
  };
16
14
  }
15
+ _radius = 0;
17
16
  get radius() {
18
- return this._radiusX;
17
+ return this._radius;
19
18
  }
20
19
  set radius(radius) {
21
- const oldRadius = this._radiusX;
22
- this._radiusX = radius;
23
- this._radiusY = radius;
24
- this._radiusY = radius;
20
+ const oldRadius = this._radius;
21
+ this._radius = radius;
25
22
  this.bounds.size.x = radius * 2 + 1;
26
23
  this.bounds.size.y = radius * 2 + 1;
27
24
  this.bounds.size.z = radius * 2 + 1;
@@ -30,68 +27,33 @@ export class SphereVoxelTemplate extends BasicVoxelShapeTemplate {
30
27
  this.dispatch("updated", null);
31
28
  }
32
29
  }
33
- _radiusX = 0;
34
- get radiusX() {
35
- return this._radiusX;
36
- }
37
- set radiusX(radius) {
38
- const oldRadius = this._radiusX;
39
- this._radiusX = radius;
40
- if (oldRadius != radius) {
41
- this.bounds.size.x = radius * 2 + 1;
42
- this._updateBounds();
43
- this.dispatch("updated", null);
44
- }
45
- }
46
- _radiusY = 0;
47
- get radiusY() {
48
- return this._radiusY;
49
- }
50
- set radiusY(radius) {
51
- const oldRadius = this._radiusY;
52
- this._radiusY = radius;
53
- if (oldRadius != radius) {
54
- this.bounds.size.y = radius * 2 + 1;
55
- this._updateBounds();
56
- this.dispatch("updated", null);
57
- }
58
- }
59
- _radiusZ = 0;
60
- get radiusZ() {
61
- return this._radiusZ;
62
- }
63
- set radiusZ(radius) {
64
- const oldRadius = this._radiusZ;
65
- this._radiusZ = radius;
66
- if (oldRadius != radius) {
67
- this.bounds.size.z = radius * 2 + 1;
68
- this._updateBounds();
69
- this.dispatch("updated", null);
70
- }
71
- }
72
30
  constructor(data) {
73
31
  super(data);
74
- this._radiusX = data.radiusX;
75
- this._radiusY = data.radiusY;
76
- this._radiusZ = data.radiusZ;
32
+ this._radius = data.radius;
33
+ this.bounds.size.x = this._radius * 2 + 1;
34
+ this.bounds.size.y = this._radius * 2 + 1;
35
+ this.bounds.size.z = this._radius * 2 + 1;
36
+ this._updateBounds();
77
37
  }
78
38
  isIncluded(index) {
79
39
  const [x, y, z] = this.index.getXYZ(index);
80
40
  const cx = Math.floor(this.bounds.size.x / 2);
81
41
  const cy = Math.floor(this.bounds.size.y / 2);
82
42
  const cz = Math.floor(this.bounds.size.z / 2);
83
- const normX = (x - cx) / this.radiusX;
84
- const normY = (y - cy) / this.radiusY;
85
- const normZ = (z - cz) / this.radiusZ;
43
+ const normX = (x - cx) / this.radius;
44
+ const normY = (y - cy) / this.radius;
45
+ const normZ = (z - cz) / this.radius;
86
46
  const distance = Math.sqrt(normX * normX + normY * normY + normZ * normZ);
87
47
  return distance <= 1;
88
48
  }
49
+ clone() {
50
+ const newTemplate = new SphereVoxelTemplate(structuredClone(this.toJSON()));
51
+ return newTemplate;
52
+ }
89
53
  toJSON() {
90
54
  return {
91
55
  ...this.getBaseJSON(),
92
- radiusX: this.radiusX,
93
- radiusY: this.radiusY,
94
- radiusZ: this.radiusZ,
56
+ radius: this.radius,
95
57
  };
96
58
  }
97
59
  }
@@ -18,5 +18,6 @@ export declare class TorusVoxelTemplate extends BasicVoxelShapeTemplate<"torus-s
18
18
  set depth(depth: number);
19
19
  constructor(data: TorusVoxelTemplateData);
20
20
  isIncluded(index: number): boolean;
21
+ clone(): TorusVoxelTemplate;
21
22
  toJSON(): TorusVoxelTemplateData;
22
23
  }
@@ -58,6 +58,10 @@ export class TorusVoxelTemplate extends BasicVoxelShapeTemplate {
58
58
  isIncluded(index) {
59
59
  return true;
60
60
  }
61
+ clone() {
62
+ const newTemplate = new TorusVoxelTemplate(structuredClone(this.toJSON()));
63
+ return newTemplate;
64
+ }
61
65
  toJSON() {
62
66
  return {
63
67
  width: this.width,
@@ -6,6 +6,8 @@ export interface IVoxelShapeTemplateEvents {
6
6
  }
7
7
  export type VoxelShapeTemplateFillModes = "full" | "outline" | "shell";
8
8
  export type VoxelShapeTemplateShapeDirections = "+x" | "-x" | "+y" | "-y" | "+z" | "-z";
9
+ export declare const VoxelShapeTemplateFillModesArray: VoxelShapeTemplateFillModes[];
10
+ export declare const VoxelShapeTemplateShapeDirectionsArray: VoxelShapeTemplateShapeDirections[];
9
11
  export interface IVoxelShapeTemplate<Type extends string, Data extends IVoxelShapeTemplateData<Type>, Events extends IVoxelShapeTemplateEvents = IVoxelShapeTemplateEvents> extends IVoxelTemplate<Type, Data>, TypedEventTarget<Events> {
10
12
  fillMode: VoxelShapeTemplateFillModes;
11
13
  fillVoxel: PaintVoxelData;
@@ -1 +1,6 @@
1
- export {};
1
+ export const VoxelShapeTemplateFillModesArray = [
2
+ "full",
3
+ "outline",
4
+ "shell",
5
+ ];
6
+ export const VoxelShapeTemplateShapeDirectionsArray = ["+x", "-x", "+y", "-y", "+z", "-z"];
@@ -13,6 +13,7 @@ export interface IVoxelTemplate<Type extends string = "", Data extends IVoxelTem
13
13
  getLevel(index: number): number;
14
14
  getLight(index: number): number;
15
15
  getSecondary(index: number): number;
16
+ clone(): IVoxelTemplate;
16
17
  getRaw(index: number, rawRef?: RawVoxelData): RawVoxelData;
17
18
  toJSON(): Data;
18
19
  }
@@ -5,6 +5,6 @@ export declare class TextureAnimationTexture {
5
5
  _size: number;
6
6
  shaderTexture: any;
7
7
  constructor(_texture: CompiledTexture);
8
- build(): Uint16Array;
8
+ build(): Uint16Array<ArrayBufferLike>;
9
9
  tick(delta: number): boolean;
10
10
  }
@@ -2,4 +2,4 @@ import { BinaryBufferFormat } from "../BinaryBuffer.types";
2
2
  export declare function DetermineSubByteArrayForBinaryBuffer(paletteSize: number): BinaryBufferFormat | null;
3
3
  export declare function GetConvertedBinaryBufferSize(source: Uint8Array | Uint16Array, format: BinaryBufferFormat): number;
4
4
  export declare function GetBinaryBufferIndexLength(source: Uint8Array | Uint16Array, format: BinaryBufferFormat): number;
5
- export declare function ConvertBinaryBuffer(source: Uint8Array | Uint16Array, sourceType: BinaryBufferFormat, destinationType: BinaryBufferFormat): Uint16Array | Uint8Array;
5
+ export declare function ConvertBinaryBuffer(source: Uint8Array | Uint16Array, sourceType: BinaryBufferFormat, destinationType: BinaryBufferFormat): Uint8Array<ArrayBuffer> | Uint16Array<ArrayBuffer>;
@@ -1,2 +1,2 @@
1
1
  import { BinaryBufferData } from "../BinaryBuffer.types";
2
- export default function BinaryBufferToTypedArray(buffer: BinaryBufferData): Uint16Array | Uint8Array | undefined;
2
+ export default function BinaryBufferToTypedArray(buffer: BinaryBufferData): Uint16Array<ArrayBuffer | SharedArrayBuffer> | Uint8Array<ArrayBuffer | SharedArrayBuffer> | undefined;
@@ -1,3 +1,3 @@
1
1
  import { LocationData } from "Math";
2
2
  export declare function getLocationData(view: DataView, location?: LocationData): LocationData;
3
- export declare function setLocationData(view: DataView, location: LocationData): DataView;
3
+ export declare function setLocationData(view: DataView, location: LocationData): DataView<ArrayBufferLike>;
@@ -53,8 +53,10 @@ export declare abstract class VoxelCursorInterface {
53
53
  isRenderable(): boolean;
54
54
  isAir(): boolean;
55
55
  setAir(): this;
56
+ /**Get the voxels palette id. The id is the combination of the true id, state, and mod. */
56
57
  getId(): number;
57
58
  setId(id: number): this;
59
+ /**Get the true voxel id. Meaning the numeric id for the string id of the voxel */
58
60
  getVoxelId(): number;
59
61
  setVoxelId(id: number, state?: number, mod?: number): this;
60
62
  setStringId(id: string, state?: number, mod?: number): this;
@@ -173,6 +173,7 @@ export class VoxelCursorInterface {
173
173
  this.ids[this._index] = 0;
174
174
  return this;
175
175
  }
176
+ /**Get the voxels palette id. The id is the combination of the true id, state, and mod. */
176
177
  getId() {
177
178
  if (this.__readingSecondaryVoxel) {
178
179
  return this.secondaryId;
@@ -187,6 +188,7 @@ export class VoxelCursorInterface {
187
188
  this.ids[this._index] = id;
188
189
  return this;
189
190
  }
191
+ /**Get the true voxel id. Meaning the numeric id for the string id of the voxel */
190
192
  getVoxelId() {
191
193
  return this.getIndexData()[0];
192
194
  }
@@ -1,6 +1,5 @@
1
1
  import { Vector3Like } from "@amodx/math";
2
2
  import PickVoxel from "./PickVoxel";
3
- import { Axes } from "@amodx/math/Vectors/Axes";
4
3
  import { WorldSpaces } from "../../../World/WorldSpaces";
5
4
  import { WorldRegister } from "../../../World/WorldRegister";
6
5
  import { SectorCursor } from "../../../World/Cursor/SectorCursor";
@@ -12,19 +11,7 @@ import { SectorCursor } from "../../../World/Cursor/SectorCursor";
12
11
  export default async function PickVoxelWorld(cursor, rayStart, rayDirection, rayLength) {
13
12
  let t = 0;
14
13
  const d = 8;
15
- const rayPosition = Vector3Like.Create(...rayStart);
16
- const rd = Vector3Like.Create(...rayDirection);
17
- const rayRight = Vector3Like.Cross(rd, Axes.UpReadOnly());
18
- const rayUp = Vector3Like.Cross(rayRight, rd);
19
- const cubeSize = 16.0;
20
- const halfSize = cubeSize / 2.0;
21
- const rayDirectionScaled = Vector3Like.MultiplyScalar(rd, halfSize);
22
- const rayRightScaled = Vector3Like.MultiplyScalar(rayRight, halfSize);
23
- const rayUpScaled = Vector3Like.MultiplyScalar(rayUp, halfSize);
24
- const finalRayCubeDirection = Vector3Like.Subtract(Vector3Like.Subtract(rayDirectionScaled, rayRightScaled), rayUpScaled);
25
- const finalMin = Vector3Like.Create();
26
- const finalMax = Vector3Like.Create();
27
- const { x: sectorSizeX, y: sectorSizeY, z: sectorSizeZ, } = WorldSpaces.sector.bounds;
14
+ const rayPosition = Vector3Like.Create();
28
15
  const visited = new Set();
29
16
  const sectorCursor = new SectorCursor();
30
17
  while (t < rayLength) {
@@ -32,35 +19,20 @@ export default async function PickVoxelWorld(cursor, rayStart, rayDirection, ray
32
19
  rayPosition.y = rayStart[1] + t * rayDirection[1];
33
20
  rayPosition.z = rayStart[2] + t * rayDirection[2];
34
21
  t += d;
35
- const min = WorldSpaces.sector.getPosition(...Vector3Like.ToArray(Vector3Like.Subtract(rayPosition, finalRayCubeDirection)));
36
- const max = WorldSpaces.sector.getPosition(...Vector3Like.ToArray(Vector3Like.Add(rayPosition, finalRayCubeDirection)));
37
- max.x < min.x ? (finalMin.x = max.x) : (finalMin.x = min.x);
38
- max.y < min.y ? (finalMin.y = max.y) : (finalMin.y = min.y);
39
- max.z < min.z ? (finalMin.z = max.z) : (finalMin.z = min.z);
40
- min.x > max.x ? (finalMax.x = min.x) : (finalMax.x = max.x);
41
- min.y > max.y ? (finalMax.y = min.y) : (finalMax.y = max.y);
42
- min.z > max.z ? (finalMax.z = min.z) : (finalMax.z = max.z);
43
- const { x: sx, y: sy, z: sz } = finalMin;
44
- const { x: ex, y: ey, z: ez } = finalMax;
45
- for (let x = sx - sectorSizeX; x < ex + sectorSizeX; x += sectorSizeX) {
46
- for (let z = sz - sectorSizeZ; z < ez + sectorSizeZ; z += sectorSizeZ) {
47
- for (let y = sy - sectorSizeY; y < ey + sectorSizeY; y += sectorSizeY) {
48
- if (!WorldSpaces.world.inBounds(x, y, z))
49
- continue;
50
- const sector = WorldRegister.sectors.get(cursor.dimension, x, y, z);
51
- if (!sector)
52
- continue;
53
- if (visited.has(sector))
54
- continue;
55
- visited.add(sector);
56
- await sector.waitTillCheckedIn();
57
- sectorCursor.loadSector(cursor.dimension, x, y, z);
58
- const result = PickVoxel(sectorCursor, rayStart, rayDirection, rayLength);
59
- if (result !== null)
60
- return result;
61
- }
62
- }
63
- }
22
+ const { x, y, z } = WorldSpaces.sector.transformPosition(rayPosition);
23
+ if (!WorldSpaces.world.inBounds(x, y, z))
24
+ continue;
25
+ const sector = WorldRegister.sectors.get(cursor.dimension, x, y, z);
26
+ if (!sector)
27
+ continue;
28
+ if (visited.has(sector))
29
+ continue;
30
+ visited.add(sector);
31
+ await sector.waitTillCheckedIn();
32
+ sectorCursor.loadSector(cursor.dimension, x, y, z);
33
+ const result = PickVoxel(sectorCursor, rayStart, rayDirection, rayLength);
34
+ if (result !== null)
35
+ return result;
64
36
  }
65
37
  return null;
66
38
  }
@@ -46,5 +46,6 @@ export declare class VoxelPickResult implements VoxelPickResultData {
46
46
  voxel: VoxelCursor;
47
47
  static FromJSON(data: VoxelPickResultData): VoxelPickResult;
48
48
  constructor(rayOrigin: Vector3Like, rayDirection: Vector3Like, rayLength: number, voxelData: RawVoxelData, position: Vector3Like, normal: Vector3Like, distance: number, normalPosition: Vector3Like, unitRayDirection: Vector3Like, unitRayVoxelFace: VoxelFaces, unitNormal: Vector3Like, unitNormalFace: VoxelFaces, delta: number);
49
+ clone(): VoxelPickResult;
49
50
  toJSON(): VoxelPickResultData;
50
51
  }
@@ -35,6 +35,9 @@ export class VoxelPickResult {
35
35
  this.voxel.setRaw(voxelData);
36
36
  this.voxel.loadIn();
37
37
  }
38
+ clone() {
39
+ return VoxelPickResult.FromJSON(this.toJSON());
40
+ }
38
41
  toJSON() {
39
42
  return {
40
43
  rayOrigin: { ...this.rayOrigin },
@@ -1,7 +1,8 @@
1
1
  import { StringPalette } from "../../../Util/StringPalette";
2
2
  import { VoxelBinaryStateSchemaNode } from "../State.types";
3
3
  export declare class BinarySchemaNode {
4
- name: string;
4
+ readonly data: VoxelBinaryStateSchemaNode;
5
+ get name(): string;
5
6
  valuePalette?: StringPalette;
6
7
  bitIndex: number;
7
8
  bitMask: number;
@@ -1,11 +1,14 @@
1
1
  import { StringPalette } from "../../../Util/StringPalette";
2
2
  export class BinarySchemaNode {
3
- name;
3
+ data;
4
+ get name() {
5
+ return this.data.name;
6
+ }
4
7
  valuePalette;
5
8
  bitIndex = 0;
6
9
  bitMask = 0;
7
10
  constructor(data) {
8
- this.name = data.name;
11
+ this.data = data;
9
12
  this.bitIndex = data.bitIndex;
10
13
  this.bitMask = (1 << data.bitSize) - 1;
11
14
  if (data.values)
@@ -9,6 +9,8 @@ export class SameVoxelCondition extends ShapeStateSchemaRelationsCondition {
9
9
  const nx = this.schema.position.x + this.data.direction[0];
10
10
  const ny = this.schema.position.y + this.data.direction[1];
11
11
  const nz = this.schema.position.z + this.data.direction[2];
12
+ if (!this.schema.dataCursor.inBounds(nx, ny, nz))
13
+ return false;
12
14
  const nVoxel = this.schema.dataCursor.getVoxel(nx, ny, nz);
13
15
  if (!nVoxel)
14
16
  return false;
@@ -2,16 +2,26 @@ import { RawVoxelData } from "./Voxel.types";
2
2
  export declare class PaintVoxelData {
3
3
  id: string;
4
4
  name: string;
5
- mod: number;
6
5
  state: number;
6
+ stateString: string;
7
+ mod: number;
8
+ modString: string;
7
9
  level: number;
8
10
  levelState: number;
9
11
  secondaryVoxelId: string;
10
12
  secondaryName: string;
11
13
  secondaryMod: number;
14
+ secondaryModString: string;
12
15
  secondaryState: number;
16
+ secondaryStateString: string;
13
17
  static Create(data?: Partial<PaintVoxelData>): PaintVoxelData;
18
+ /**Transforms numeric voxel data into a PaintVoxelData object */
14
19
  static FromRaw(data: RawVoxelData, paintData?: PaintVoxelData): PaintVoxelData;
20
+ /**Transforms the voxel data into numeric voxel data */
15
21
  static ToRaw(data: Partial<PaintVoxelData>, light?: number): RawVoxelData;
22
+ /**Restores the data to the default state of being dve_air */
23
+ static Clear(data: PaintVoxelData): PaintVoxelData;
24
+ /**Clears the target data and then copies properties from source to target. */
25
+ static Set(target: PaintVoxelData, source: Partial<PaintVoxelData>): PaintVoxelData;
16
26
  private constructor();
17
27
  }