@divinevoxel/vlox 0.0.5 → 0.0.7
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/InitWorldDataSync.js +2 -4
- package/Contexts/Render/DVERenderThreads.d.ts +1 -1
- package/Contexts/Render/DVERenderThreads.js +2 -2
- package/Contexts/Render/DivineVoxelEngineRender.d.ts +5 -5
- package/Contexts/Render/DivineVoxelEngineRender.js +1 -1
- package/Contexts/World/DivineVoxelEngineWorld.d.ts +5 -5
- package/Init/StartRenderer.js +5 -5
- package/Math/Indexing.js +6 -6
- package/Mesher/Functions/CompactVoxelMesh.js +40 -7
- package/Mesher/Functions/MeshSection.js +16 -9
- package/Mesher/Functions/MeshTexture.d.ts +1 -1
- package/Mesher/Functions/MeshVoxel.js +5 -4
- package/Mesher/Geomtry/Buffers.d.ts +19 -0
- package/Mesher/Geomtry/Buffers.js +81 -0
- package/Mesher/Geomtry/Tools/MesherDataTools.d.ts +3 -3
- package/Mesher/Geomtry/Tools/MesherDataTools.js +2 -2
- package/Mesher/Geomtry/VoxelGeometryBuilder.js +3 -3
- package/Mesher/Geomtry/VoxelMesh.d.ts +12 -0
- package/Mesher/Geomtry/VoxelMesh.js +25 -0
- package/Mesher/InitTask.js +1 -2
- package/Mesher/Models/Common/BoxGeometryNode.js +2 -1
- package/Mesher/Models/Nodes/Ruled/BoxVoxelGeometryNode.js +10 -7
- package/Mesher/Models/Nodes/Ruled/QuadVoxelGeometryNode.js +7 -7
- package/Mesher/Models/Nodes/VoxelGeometryConstructor.js +1 -1
- package/Mesher/Models/VoxelConstructor.d.ts +0 -2
- package/Mesher/Models/VoxelConstructor.js +9 -15
- package/Mesher/Models/VoxelGeometryLookUp.d.ts +20 -11
- package/Mesher/Models/VoxelGeometryLookUp.js +84 -50
- package/Mesher/Tools/VoxelMeshBVHBuilder.js +20 -25
- package/Mesher/Tools/VoxelMeshVertexStructCursor.d.ts +3 -1
- package/Mesher/Tools/VoxelMesherDataTool.d.ts +3 -2
- package/Mesher/Tools/VoxelMesherDataTool.js +8 -3
- package/Renderer/Classes/DVESectionMeshes.d.ts +1 -0
- package/Renderer/Classes/SectionMesh.d.ts +1 -2
- package/Renderer/Classes/SectionMesh.js +0 -3
- package/Renderer/InitTasks.js +16 -1
- package/Renderer/MeshManager.js +4 -0
- package/Renderer/MeshRegister.d.ts +1 -6
- package/Renderer/index.d.ts +0 -1
- package/Renderer/index.js +0 -1
- package/Settings/EngineSettings.d.ts +5 -5
- package/Settings/EngineSettings.js +15 -15
- package/Settings/EngineSettings.types.d.ts +62 -44
- package/Settings/EngineSettings.types.js +44 -42
- package/Tasks/IWG/IWG.d.ts +3 -0
- package/Tasks/IWG/IWG.js +3 -0
- package/Tasks/IWG/Internal/Functions/cullSectors.js +1 -2
- package/Tasks/IWG/Internal/Functions/getSectorState.js +1 -1
- package/Tasks/IWG/Internal/Functions/runBuildUpdate.js +1 -2
- package/Tasks/IWG/Internal/Functions/runWorldUpdate.js +1 -2
- package/Tasks/IWG/Internal/IWGTasks.js +7 -13
- package/Tasks/Propagation/Explosion/ExplosionManager.js +1 -1
- package/Tasks/Propagation/Flow/WorldFlow.js +6 -8
- package/Tasks/Propagation/Illumanation/RGBUpdate.js +2 -2
- package/Tasks/Propagation/Illumanation/WorldRGB.js +2 -3
- package/Tasks/Propagation/Illumanation/WorldSun.js +11 -5
- package/Tasks/Update/VoxelUpdate.js +21 -26
- package/Tasks/WorldGeneration/WorldGenRegister.js +5 -8
- package/Tasks/WorldGeneration/WorldGeneration.d.ts +0 -2
- package/Tasks/WorldGeneration/WorldGeneration.js +0 -2
- package/Templates/Cursor/TemplateVoxelCursor.d.ts +1 -0
- package/Templates/Cursor/TemplateVoxelCursor.js +1 -0
- package/Textures/TextureBuilder.d.ts +1 -1
- package/Textures/TextureBuilder.js +1 -1
- package/Textures/TextureManager.js +1 -1
- package/Tools/Brush/Brush.d.ts +1 -0
- package/Tools/Brush/Brush.js +8 -11
- package/Voxels/Cursor/VoxelCursor.d.ts +1 -0
- package/Voxels/Cursor/VoxelCursor.interface.d.ts +5 -0
- package/Voxels/Cursor/VoxelCursor.interface.js +5 -5
- package/Voxels/Cursor/VoxelCursor.js +5 -3
- package/Voxels/VoxelLevelReader.d.ts +10 -0
- package/Voxels/VoxelLevelReader.js +20 -0
- package/World/Archive/Functions/ArchiveSector.d.ts +1 -1
- package/World/Archive/Functions/ArchiveSector.js +2 -3
- package/World/Archive/InitTasks.js +2 -3
- package/World/Cursor/SectionCursor.js +1 -2
- package/World/Cursor/SectorCursor.d.ts +1 -0
- package/World/Cursor/SectorCursor.js +8 -3
- package/World/Cursor/WorldCursor.js +1 -2
- package/World/Cursor/WorldVoxelCursor.d.ts +1 -5
- package/World/Cursor/WorldVoxelCursor.js +1 -5
- package/World/InitTasks.js +5 -10
- package/World/Lock/WorldLock.js +4 -5
- package/World/Sector/SectorHeightMap.js +4 -6
- package/World/WorldRegister.d.ts +4 -6
- package/World/WorldRegister.js +24 -20
- package/World/WorldSpaces.d.ts +21 -0
- package/World/WorldSpaces.js +58 -7
- package/package.json +1 -1
- package/Mesher/Geomtry/Mesh.d.ts +0 -11
- package/Mesher/Geomtry/Mesh.js +0 -23
- package/Renderer/Classes/DVESectionMeshInterface.d.ts +0 -3
- package/Renderer/Classes/DVESectionMeshInterface.js +0 -1
- package/Voxels/VoxelStateReader.d.ts +0 -12
- package/Voxels/VoxelStateReader.js +0 -30
- package/World/WorldBounds.d.ts +0 -20
- package/World/WorldBounds.js +0 -53
package/World/WorldSpaces.js
CHANGED
|
@@ -4,6 +4,55 @@ import { Vector3Like } from "@amodx/math";
|
|
|
4
4
|
import { CubeHashVec3, CubeHashVec3Array, GetYXZOrderArrayIndex, } from "../Math/Indexing.js";
|
|
5
5
|
const tempPosition = Vector3Like.Create();
|
|
6
6
|
const tempPosition2 = Vector3Like.Create();
|
|
7
|
+
class WorldBounds {
|
|
8
|
+
static bounds = {
|
|
9
|
+
MinZ: -Number.MAX_SAFE_INTEGER,
|
|
10
|
+
MaxZ: Number.MAX_SAFE_INTEGER,
|
|
11
|
+
MinX: -Number.MAX_SAFE_INTEGER,
|
|
12
|
+
MaxX: Number.MAX_SAFE_INTEGER,
|
|
13
|
+
MinY: 0,
|
|
14
|
+
MaxY: 256,
|
|
15
|
+
};
|
|
16
|
+
static setWorldBounds(minX, minY, minZ, maxX, maxY, maxZ) {
|
|
17
|
+
this.bounds.MinX = minX;
|
|
18
|
+
this.bounds.MaxX = maxX;
|
|
19
|
+
this.bounds.MinX = minZ;
|
|
20
|
+
this.bounds.MaxZ = maxZ;
|
|
21
|
+
this.bounds.MinY = minY;
|
|
22
|
+
this.bounds.MaxY = maxY;
|
|
23
|
+
}
|
|
24
|
+
static inBounds(x, y, z) {
|
|
25
|
+
if (x < this.bounds.MinX)
|
|
26
|
+
return false;
|
|
27
|
+
if (y < this.bounds.MinY)
|
|
28
|
+
return false;
|
|
29
|
+
if (z < this.bounds.MinZ)
|
|
30
|
+
return false;
|
|
31
|
+
if (x > this.bounds.MaxX)
|
|
32
|
+
return false;
|
|
33
|
+
if (y > this.bounds.MaxY)
|
|
34
|
+
return false;
|
|
35
|
+
if (z > this.bounds.MaxZ)
|
|
36
|
+
return false;
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
static getWorldWidth() {
|
|
40
|
+
return this.bounds.MaxX - this.bounds.MinX;
|
|
41
|
+
}
|
|
42
|
+
static getWorldDepth() {
|
|
43
|
+
return this.bounds.MaxZ - this.bounds.MinZ;
|
|
44
|
+
}
|
|
45
|
+
static getWorldHeightY() {
|
|
46
|
+
return this.bounds.MaxY - this.bounds.MinY;
|
|
47
|
+
}
|
|
48
|
+
static getWorldDimensions() {
|
|
49
|
+
return {
|
|
50
|
+
width: this.getWorldWidth(),
|
|
51
|
+
depth: this.getWorldDepth(),
|
|
52
|
+
height: this.getWorldHeightY(),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
7
56
|
class SectorSpace {
|
|
8
57
|
static power2Axes = Vector3Like.Create();
|
|
9
58
|
static bounds = Vector3Like.Create();
|
|
@@ -69,21 +118,23 @@ class Hash {
|
|
|
69
118
|
}
|
|
70
119
|
export class WorldSpaces {
|
|
71
120
|
static hash = Hash;
|
|
121
|
+
static world = WorldBounds;
|
|
72
122
|
static sector = SectorSpace;
|
|
73
123
|
static section = SectionSpace;
|
|
74
124
|
static voxel = VoxelSpace;
|
|
75
125
|
}
|
|
76
126
|
EngineSettings.addEventListener("synced", (event) => {
|
|
77
|
-
event.detail.settings;
|
|
78
|
-
|
|
79
|
-
SectorSpace.power2Axes.
|
|
80
|
-
SectorSpace.power2Axes.
|
|
127
|
+
const { settings } = event.detail.settings;
|
|
128
|
+
WorldBounds.setWorldBounds(settings.world.min.x, settings.world.min.y, settings.world.min.z, settings.world.max.x, settings.world.max.y, settings.world.max.z);
|
|
129
|
+
SectorSpace.power2Axes.x = settings.sectors.power2Size.x;
|
|
130
|
+
SectorSpace.power2Axes.y = settings.sectors.power2Size.y;
|
|
131
|
+
SectorSpace.power2Axes.z = settings.sectors.power2Size.z;
|
|
81
132
|
SectorSpace.bounds.x = 1 << SectorSpace.power2Axes.x;
|
|
82
133
|
SectorSpace.bounds.y = 1 << SectorSpace.power2Axes.y;
|
|
83
134
|
SectorSpace.bounds.z = 1 << SectorSpace.power2Axes.z;
|
|
84
|
-
SectionSpace.power2Axes.x =
|
|
85
|
-
SectionSpace.power2Axes.y =
|
|
86
|
-
SectionSpace.power2Axes.z =
|
|
135
|
+
SectionSpace.power2Axes.x = settings.sections.power2Size.x;
|
|
136
|
+
SectionSpace.power2Axes.y = settings.sections.power2Size.y;
|
|
137
|
+
SectionSpace.power2Axes.z = settings.sections.power2Size.z;
|
|
87
138
|
SectionSpace.bounds.x = 1 << SectionSpace.power2Axes.x;
|
|
88
139
|
SectionSpace.bounds.y = 1 << SectionSpace.power2Axes.y;
|
|
89
140
|
SectionSpace.bounds.z = 1 << SectionSpace.power2Axes.z;
|
package/package.json
CHANGED
package/Mesher/Geomtry/Mesh.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Vector3Like } from "@amodx/math";
|
|
2
|
-
export declare class Mesh {
|
|
3
|
-
buildBVH?: boolean | undefined;
|
|
4
|
-
indicieIndex: number;
|
|
5
|
-
minBounds: Vector3Like;
|
|
6
|
-
maxBounds: Vector3Like;
|
|
7
|
-
readonly buffer: number[];
|
|
8
|
-
readonly indices: number[];
|
|
9
|
-
constructor(buildBVH?: boolean | undefined);
|
|
10
|
-
clear(): void;
|
|
11
|
-
}
|
package/Mesher/Geomtry/Mesh.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Vector3Like } from "@amodx/math";
|
|
2
|
-
export class Mesh {
|
|
3
|
-
buildBVH;
|
|
4
|
-
indicieIndex = 0;
|
|
5
|
-
minBounds = Vector3Like.Create(Infinity, Infinity, Infinity);
|
|
6
|
-
maxBounds = Vector3Like.Create(-Infinity, -Infinity, -Infinity);
|
|
7
|
-
buffer = [];
|
|
8
|
-
indices = [];
|
|
9
|
-
constructor(buildBVH) {
|
|
10
|
-
this.buildBVH = buildBVH;
|
|
11
|
-
}
|
|
12
|
-
clear() {
|
|
13
|
-
this.buffer.length = 0;
|
|
14
|
-
this.indices.length = 0;
|
|
15
|
-
this.indicieIndex = 0;
|
|
16
|
-
this.minBounds.x = Infinity;
|
|
17
|
-
this.minBounds.y = Infinity;
|
|
18
|
-
this.minBounds.z = Infinity;
|
|
19
|
-
this.maxBounds.x = -Infinity;
|
|
20
|
-
this.maxBounds.y = -Infinity;
|
|
21
|
-
this.maxBounds.z = -Infinity;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**# Voxel Reader
|
|
2
|
-
* ---
|
|
3
|
-
* Used to decode voxel state data.
|
|
4
|
-
*/
|
|
5
|
-
export declare class VoxelStateReader {
|
|
6
|
-
static getLevel(stateData: number): number;
|
|
7
|
-
static setLevel(stateData: number, level: number): number;
|
|
8
|
-
static getLevelState(stateData: number): number;
|
|
9
|
-
static setLevelState(stateData: number, levelState: number): number;
|
|
10
|
-
static getShapeState(voxelData: number): number;
|
|
11
|
-
static setShapeState(voxelData: number, shapeState: number): number;
|
|
12
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
var StateMasks;
|
|
2
|
-
(function (StateMasks) {
|
|
3
|
-
StateMasks[StateMasks["Level"] = 15] = "Level";
|
|
4
|
-
StateMasks[StateMasks["LevelState"] = 48] = "LevelState";
|
|
5
|
-
StateMasks[StateMasks["ShapeState"] = 65472] = "ShapeState";
|
|
6
|
-
})(StateMasks || (StateMasks = {}));
|
|
7
|
-
/**# Voxel Reader
|
|
8
|
-
* ---
|
|
9
|
-
* Used to decode voxel state data.
|
|
10
|
-
*/
|
|
11
|
-
export class VoxelStateReader {
|
|
12
|
-
static getLevel(stateData) {
|
|
13
|
-
return stateData & StateMasks.Level;
|
|
14
|
-
}
|
|
15
|
-
static setLevel(stateData, level) {
|
|
16
|
-
return (stateData & ~StateMasks.Level) | level;
|
|
17
|
-
}
|
|
18
|
-
static getLevelState(stateData) {
|
|
19
|
-
return (stateData & StateMasks.LevelState) >> 4;
|
|
20
|
-
}
|
|
21
|
-
static setLevelState(stateData, levelState) {
|
|
22
|
-
return (stateData & ~StateMasks.LevelState) | (levelState << 4);
|
|
23
|
-
}
|
|
24
|
-
static getShapeState(voxelData) {
|
|
25
|
-
return (voxelData & StateMasks.ShapeState) >> 6;
|
|
26
|
-
}
|
|
27
|
-
static setShapeState(voxelData, shapeState) {
|
|
28
|
-
return (voxelData & ~StateMasks.ShapeState) | (shapeState << 6);
|
|
29
|
-
}
|
|
30
|
-
}
|
package/World/WorldBounds.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare class WorldBounds {
|
|
2
|
-
static bounds: {
|
|
3
|
-
MinZ: number;
|
|
4
|
-
MaxZ: number;
|
|
5
|
-
MinX: number;
|
|
6
|
-
MaxX: number;
|
|
7
|
-
MinY: number;
|
|
8
|
-
MaxY: number;
|
|
9
|
-
};
|
|
10
|
-
static setWorldBounds(minX: number, maxX: number, minZ: number, maxZ: number, minY: number, maxY: number): void;
|
|
11
|
-
static inBounds(x: number, y: number, z: number): boolean;
|
|
12
|
-
static getWorldWidth(): number;
|
|
13
|
-
static getWorldDepth(): number;
|
|
14
|
-
static getWorldHeightY(): number;
|
|
15
|
-
static getWorldDimensions(): {
|
|
16
|
-
width: number;
|
|
17
|
-
depth: number;
|
|
18
|
-
height: number;
|
|
19
|
-
};
|
|
20
|
-
}
|
package/World/WorldBounds.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { EngineSettings } from "../Settings/EngineSettings";
|
|
2
|
-
export class WorldBounds {
|
|
3
|
-
static bounds = {
|
|
4
|
-
MinZ: -Number.MAX_SAFE_INTEGER,
|
|
5
|
-
MaxZ: Number.MAX_SAFE_INTEGER,
|
|
6
|
-
MinX: -Number.MAX_SAFE_INTEGER,
|
|
7
|
-
MaxX: Number.MAX_SAFE_INTEGER,
|
|
8
|
-
MinY: 0,
|
|
9
|
-
MaxY: 256,
|
|
10
|
-
};
|
|
11
|
-
static setWorldBounds(minX, maxX, minZ, maxZ, minY, maxY) {
|
|
12
|
-
this.bounds.MinX = minX;
|
|
13
|
-
this.bounds.MaxX = maxX;
|
|
14
|
-
this.bounds.MinX = minZ;
|
|
15
|
-
this.bounds.MaxZ = maxZ;
|
|
16
|
-
this.bounds.MinY = minY;
|
|
17
|
-
this.bounds.MaxY = maxY;
|
|
18
|
-
}
|
|
19
|
-
static inBounds(x, y, z) {
|
|
20
|
-
if (x < this.bounds.MinX)
|
|
21
|
-
return false;
|
|
22
|
-
if (y < this.bounds.MinY)
|
|
23
|
-
return false;
|
|
24
|
-
if (z < this.bounds.MinZ)
|
|
25
|
-
return false;
|
|
26
|
-
if (x > this.bounds.MaxX)
|
|
27
|
-
return false;
|
|
28
|
-
if (y > this.bounds.MaxY)
|
|
29
|
-
return false;
|
|
30
|
-
if (z > this.bounds.MaxZ)
|
|
31
|
-
return false;
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
static getWorldWidth() {
|
|
35
|
-
return this.bounds.MaxX - this.bounds.MinX;
|
|
36
|
-
}
|
|
37
|
-
static getWorldDepth() {
|
|
38
|
-
return this.bounds.MaxZ - this.bounds.MinZ;
|
|
39
|
-
}
|
|
40
|
-
static getWorldHeightY() {
|
|
41
|
-
return this.bounds.MaxY - this.bounds.MinY;
|
|
42
|
-
}
|
|
43
|
-
static getWorldDimensions() {
|
|
44
|
-
return {
|
|
45
|
-
width: this.getWorldWidth(),
|
|
46
|
-
depth: this.getWorldDepth(),
|
|
47
|
-
height: this.getWorldHeightY(),
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
EngineSettings.addEventListener("synced", ({ detail: { settings: { settings }, }, }) => {
|
|
52
|
-
WorldBounds.setWorldBounds(settings.world.minX, settings.world.maxX, settings.world.minZ, settings.world.maxZ, settings.world.minY, settings.world.maxY);
|
|
53
|
-
});
|