@divinevoxel/vlox 0.0.80 → 0.0.81
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/Builder/Tools/Brush/BrushTool.d.ts +12 -2
- package/Builder/Tools/Brush/BrushTool.js +53 -28
- package/Builder/Tools/Debug/DebugTool.d.ts +18 -0
- package/Builder/Tools/Debug/DebugTool.js +36 -0
- package/Builder/Tools/Path/PahtTool.d.ts +1 -1
- package/Builder/Tools/Path/PahtTool.js +1 -1
- package/Builder/Tools/Sculpt/SculptTool.js +8 -0
- package/Builder/Tools/Wrench/WrenchTool.js +10 -23
- package/Builder/Util/SurfaceBoxSelection.js +2 -0
- package/Builder/VoxelBuildSpace.js +3 -3
- package/Contexts/Base/Remote/InitDataSync.js +1 -1
- package/Math/UtilFunctions.js +7 -8
- package/Math/VoxelFaces.d.ts +2 -2
- package/Math/VoxelFaces.js +46 -55
- package/Math/WorldIndexing.d.ts +11 -0
- package/Math/WorldIndexing.js +34 -0
- package/Mesher/Geometry/Geometry.types.d.ts +2 -2
- package/Mesher/Geometry/Geometry.types.js +7 -20
- package/Mesher/Geometry/Primitives/QuadVertexData.js +118 -119
- package/Mesher/Geometry/Primitives/TriangleVertexData.js +89 -90
- package/Mesher/Geometry/Proto/ProtoMesh.d.ts +1 -1
- package/Mesher/Geometry/Proto/ProtoMesh.js +22 -29
- package/Mesher/Geometry/Proto/ProtoMeshBuffer.d.ts +4 -2
- package/Mesher/Geometry/Proto/ProtoMeshBuffer.js +14 -6
- package/Mesher/Geometry/Shapes/Box.js +6 -7
- package/Mesher/Geometry/Transform/TransformBox.js +8 -9
- package/Mesher/Geometry/Transform/TransformQuad.js +4 -5
- package/Mesher/Geometry/Transform/TransformTriangle.js +3 -4
- package/Mesher/InitMesher.js +4 -9
- package/Mesher/Items/Geometry/ItemGeometryBuilder.js +7 -8
- package/Mesher/Items/MeshTexture.js +125 -57
- package/Mesher/Voxels/Base/BuildVoxel.d.ts +6 -0
- package/Mesher/Voxels/Base/BuildVoxel.js +101 -0
- package/Mesher/Voxels/Base/CompactVoxelSectionMesh.js +1 -21
- package/Mesher/Voxels/Base/MeshSectionBase.js +3 -26
- package/Mesher/Voxels/Geometry/VoxelGeometryBuilder.js +33 -31
- package/Mesher/Voxels/Geometry/VoxelShaderData.js +3 -7
- package/Mesher/Voxels/MeshTemplate.js +6 -26
- package/Mesher/Voxels/MeshVoxel.js +5 -10
- package/Mesher/Voxels/Models/Common/Calc/CalcConstants.js +41 -42
- package/Mesher/Voxels/Models/Common/Calc/FaceDataCalc.js +6 -9
- package/Mesher/Voxels/Models/Common/Faces/CullRulledFace.js +64 -47
- package/Mesher/Voxels/Models/Common/Faces/ShadeRulledFace.js +57 -43
- package/Mesher/Voxels/Models/Nodes/Custom/Liquid/FlowGradient.js +4 -5
- package/Mesher/Voxels/Models/Nodes/Custom/Liquid/LiquidGeometryNode.d.ts +1 -1
- package/Mesher/Voxels/Models/Nodes/Custom/Liquid/LiquidGeometryNode.js +116 -118
- package/Mesher/Voxels/Models/Nodes/Default/QuadVoxelGeometryNode.js +4 -4
- package/Mesher/Voxels/Models/Nodes/VoxelGeometryConstructor.js +2 -2
- package/Mesher/Voxels/Models/Procedures/Default/OutlinedTextureProcedure.js +19 -21
- package/Mesher/Voxels/Models/Procedures/Default/PillarTextureProcedure.js +45 -38
- package/Mesher/Voxels/Models/RenderedMaterials.d.ts +1 -1
- package/Mesher/Voxels/Models/RenderedMaterials.js +8 -5
- package/Mesher/Voxels/Models/VoxelGeometryBuilderCacheSpace.d.ts +18 -4
- package/Mesher/Voxels/Models/VoxelGeometryBuilderCacheSpace.js +135 -22
- package/Mesher/Voxels/Models/VoxelGeometryBuilderCacheSpaceN.d.ts +33 -0
- package/Mesher/Voxels/Models/VoxelGeometryBuilderCacheSpaceN.js +204 -0
- package/Mesher/Voxels/Models/{VoxelModelConstructorRegister.d.ts → VoxelGeometryConstructorRegister.d.ts} +1 -6
- package/Mesher/Voxels/Models/VoxelGeometryConstructorRegister.js +20 -0
- package/Mesher/Voxels/Models/VoxelModelBuilder.js +15 -16
- package/Mesher/Voxels/Models/VoxelModelEffect.d.ts +1 -3
- package/Mesher/Voxels/Models/VoxelModelEffect.js +1 -3
- package/Renderer/DVERenderNode.types.d.ts +1 -0
- package/Renderer/InitTasks.js +2 -0
- package/Tasks/Paint/Erase/EraseVoxel.js +1 -1
- package/Tasks/Propagation/Illumanation/RGBUpdate.js +191 -48
- package/Tasks/Propagation/Illumanation/SunUpdate.d.ts +1 -1
- package/Tasks/Propagation/Illumanation/SunUpdate.js +167 -63
- package/Tasks/Propagation/Illumanation/WorldSun.js +96 -60
- package/Tasks/WorldGeneration/WorldGenBrush.d.ts +2 -0
- package/Tasks/WorldGeneration/WorldGenBrush.js +31 -0
- package/Templates/Archive/ArchivedVoxelTemplate.js +1 -1
- package/Templates/Archive/Functions/CreateArchivedTemplate.js +1 -1
- package/Templates/Archive/Functions/CreateArchivedTemplateFromFull.d.ts +6 -0
- package/Templates/Archive/Functions/CreateArchivedTemplateFromFull.js +174 -0
- package/Textures/Classes/CompactedTextureReader.d.ts +22 -0
- package/Textures/Classes/CompactedTextureReader.js +90 -0
- package/Textures/Classes/CompiledTexture.d.ts +4 -1
- package/Textures/Classes/CompiledTexture.js +36 -8
- package/Textures/Classes/TextureAtlasIndex.d.ts +7 -0
- package/Textures/Classes/TextureAtlasIndex.js +14 -0
- package/Textures/Classes/TextureLoader.d.ts +20 -0
- package/Textures/Classes/TextureLoader.js +95 -0
- package/Textures/Functions/BuildTextureData.d.ts +1 -1
- package/Textures/Functions/BuildTextureData.js +19 -122
- package/Textures/Functions/CreateCompactedTexture.d.ts +6 -0
- package/Textures/Functions/CreateCompactedTexture.js +105 -0
- package/Textures/Functions/ReadCompactedTexture.d.ts +2 -0
- package/Textures/Functions/ReadCompactedTexture.js +42 -0
- package/Textures/Texture.types.d.ts +14 -0
- package/Textures/TextureManager.d.ts +7 -1
- package/Textures/TextureManager.js +13 -0
- package/Tools/Brush/Brush.d.ts +4 -2
- package/Tools/Brush/Brush.js +28 -6
- package/Util/BinaryBuffer/Functions/BinaryBufferConvert.d.ts +1 -1
- package/Util/TickInterval.d.ts +3 -0
- package/Util/TickInterval.js +31 -3
- package/Voxels/Archive/VoxelPaletteArchiveReader.d.ts +1 -0
- package/Voxels/Archive/VoxelPaletteArchiveReader.js +9 -10
- package/Voxels/Archive/VoxelPaletteArechive.js +5 -4
- package/Voxels/Cursor/VoxelCursor.interface.d.ts +1 -1
- package/Voxels/Cursor/VoxelCursor.interface.js +22 -16
- package/Voxels/Data/VoxelLUT.d.ts +69 -42
- package/Voxels/Data/VoxelLUT.js +110 -53
- package/Voxels/Functions/BuildLUTs.js +100 -45
- package/Voxels/Functions/Geometry/CalcFunctions.js +6 -7
- package/Voxels/Functions/Geometry/Inputs/BuildTriangleInputs.js +3 -0
- package/Voxels/Indexes/VoxelIndex.js +3 -1
- package/Voxels/InitVoxelData.js +3 -1
- package/Voxels/Interaction/Functions/PickVoxel.js +3 -5
- package/Voxels/Interaction/Functions/PickVoxelWorld.js +4 -6
- package/Voxels/Models/Defaults/Examples.d.ts +2 -0
- package/Voxels/Models/Defaults/Examples.js +151 -2
- package/Voxels/State/Reltional/ReltionalStateBuilder.js +2 -0
- package/Voxels/State/Schema/BinarySchema.d.ts +1 -0
- package/Voxels/State/Schema/BinarySchema.js +14 -0
- package/Voxels/State/VoxelSchemas.d.ts +11 -4
- package/Voxels/State/VoxelSchemas.js +42 -9
- package/Voxels/Types/PaintVoxelData.js +6 -2
- package/World/Archive/Classes/ImportedSection.js +1 -1
- package/World/Archive/Classes/ImportedSector.js +0 -1
- package/World/Archive/Functions/Sector/ArchiveSector.js +2 -2
- package/World/Archive/Functions/Sector/ImportSector.d.ts +1 -0
- package/World/Archive/Functions/Sector/ImportSector.js +183 -7
- package/World/Cursor/SectorCursor.js +1 -4
- package/World/Cursor/WorldCursor.d.ts +12 -3
- package/World/Cursor/WorldCursor.js +60 -30
- package/World/InitTasks.js +1 -1
- package/World/Lock/Function/LockSectors.js +5 -1
- package/World/Lock/Function/UnLockSectors.js +5 -1
- package/World/SnapShot/SectionSnapShot.d.ts +7 -3
- package/World/SnapShot/SectionSnapShot.js +47 -21
- package/World/SnapShot/SectionSnapShotCursor.d.ts +4 -2
- package/World/SnapShot/SectionSnapShotCursor.js +23 -11
- package/World/SnapShot/SnapShots.d.ts +1 -2
- package/World/SnapShot/SnapShots.js +3 -3
- package/World/WorldSpaces.d.ts +7 -0
- package/World/WorldSpaces.js +35 -13
- package/WorldSimulation/Dimensions/DimensionSegment.d.ts +2 -0
- package/WorldSimulation/Dimensions/DimensionSegment.js +9 -1
- package/WorldSimulation/Dimensions/DimensionSimulation.js +6 -7
- package/WorldSimulation/Dimensions/Generator.d.ts +4 -0
- package/WorldSimulation/Dimensions/Generator.js +15 -1
- package/WorldSimulation/Dimensions/SimulationSector.d.ts +1 -0
- package/WorldSimulation/Dimensions/SimulationSector.js +18 -0
- package/WorldSimulation/Internal/WorldSimulationTasks.js +11 -7
- package/WorldSimulation/Procedures/InitalLoad.d.ts +1 -0
- package/WorldSimulation/Procedures/InitalLoad.js +18 -8
- package/WorldSimulation/Tasks/SimulationTaskBase.d.ts +4 -1
- package/WorldSimulation/Tasks/SimulationTaskBase.js +13 -2
- package/WorldSimulation/Tasks/TaskSegment.d.ts +4 -2
- package/WorldSimulation/Tasks/TaskSegment.js +36 -22
- package/WorldSimulation/Voxels/Ticks/Types/LiquidVoxelUpdate.js +1 -2
- package/WorldSimulation/WorldSimulation.d.ts +6 -3
- package/WorldSimulation/WorldSimulation.js +44 -20
- package/package.json +1 -1
- package/Mesher/Items/MeshTextureO.d.ts +0 -1
- package/Mesher/Items/MeshTextureO.js +0 -277
- package/Mesher/Voxels/Models/VoxelConstructor.d.ts +0 -8
- package/Mesher/Voxels/Models/VoxelConstructor.js +0 -78
- package/Mesher/Voxels/Models/VoxelModelConstructorRegister.js +0 -37
- package/WorldSimulation/Procedures/BuildOnly.d.ts +0 -10
- package/WorldSimulation/Procedures/BuildOnly.js +0 -55
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { VoxelModelConstructorRegister } from "./VoxelModelConstructorRegister";
|
|
2
|
-
import { VoxelLUT } from "../../../Voxels/Data/VoxelLUT";
|
|
3
|
-
import { GeometryLUT } from "../../../Voxels/Data/GeometryLUT";
|
|
4
|
-
export class VoxelConstructor {
|
|
5
|
-
id;
|
|
6
|
-
builder;
|
|
7
|
-
isModel = true;
|
|
8
|
-
// effects: VoxelModelEffect;
|
|
9
|
-
constructor(id, builder) {
|
|
10
|
-
this.id = id;
|
|
11
|
-
this.builder = builder;
|
|
12
|
-
// this.effects = new VoxelModelEffect(this);
|
|
13
|
-
}
|
|
14
|
-
process() {
|
|
15
|
-
let added = false;
|
|
16
|
-
const builder = this.builder;
|
|
17
|
-
const hashed = builder.space.getHash(builder.nVoxel, builder.position.x, builder.position.y, builder.position.z);
|
|
18
|
-
const trueVoxelId = builder.voxel.getVoxelId();
|
|
19
|
-
const voxelId = builder.space.voxelCache[hashed];
|
|
20
|
-
const reltionalVoxelId = builder.space.reltionalVoxelCache[hashed];
|
|
21
|
-
const geomtriesIndex = VoxelLUT.getGeometryIndex(voxelId, reltionalVoxelId);
|
|
22
|
-
const geomtries = GeometryLUT.geometryIndex[geomtriesIndex];
|
|
23
|
-
const inputsIndex = VoxelLUT.getGeometryInputIndex(voxelId, reltionalVoxelId);
|
|
24
|
-
const inputs = GeometryLUT.geometryInputsIndex[inputsIndex];
|
|
25
|
-
const geometriesLength = geomtries.length;
|
|
26
|
-
for (let i = 0; i < geometriesLength; i++) {
|
|
27
|
-
const nodeId = geomtries[i];
|
|
28
|
-
const inputsIndex = inputs[i];
|
|
29
|
-
const geoInputs = GeometryLUT.geometryInputs[inputsIndex];
|
|
30
|
-
const geometry = VoxelModelConstructorRegister.geometry[nodeId];
|
|
31
|
-
const nodesLength = geometry.nodes.length;
|
|
32
|
-
for (let k = 0; k < nodesLength; k++) {
|
|
33
|
-
const geo = geometry.nodes[k];
|
|
34
|
-
geo.builder = this.builder;
|
|
35
|
-
const addedGeo = geo.add(geoInputs[k]);
|
|
36
|
-
if (addedGeo)
|
|
37
|
-
added = true;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
const conditioanlNodes = VoxelLUT.getConditionalGeometryNodes(trueVoxelId);
|
|
41
|
-
if (conditioanlNodes) {
|
|
42
|
-
const modelState = VoxelLUT.voxelIdToModelState[voxelId];
|
|
43
|
-
const reltionalState = builder.space.reltionalStateCache[hashed];
|
|
44
|
-
const nodesLength = conditioanlNodes.length;
|
|
45
|
-
for (let i = 0; i < nodesLength; i++) {
|
|
46
|
-
const [geoId, requiredModelState, requiredModelReltionalState] = conditioanlNodes[i];
|
|
47
|
-
if (requiredModelState !== modelState ||
|
|
48
|
-
!requiredModelReltionalState[reltionalState])
|
|
49
|
-
continue;
|
|
50
|
-
const geomtries = GeometryLUT.geometryIndex[geoId];
|
|
51
|
-
const inputsIndex = VoxelLUT.getConditionalGeometryInputIndex(geoId, voxelId, reltionalVoxelId);
|
|
52
|
-
const inputs = GeometryLUT.geometryInputsIndex[inputsIndex];
|
|
53
|
-
const geometriesLength = geomtries.length;
|
|
54
|
-
for (let i = 0; i < geometriesLength; i++) {
|
|
55
|
-
const nodeId = geomtries[i];
|
|
56
|
-
const inputsIndex = inputs[i];
|
|
57
|
-
const geoInputs = GeometryLUT.geometryInputs[inputsIndex];
|
|
58
|
-
const geometry = VoxelModelConstructorRegister.geometry[nodeId];
|
|
59
|
-
const nodesLength = geometry.nodes.length;
|
|
60
|
-
for (let k = 0; k < nodesLength; k++) {
|
|
61
|
-
const geo = geometry.nodes[k];
|
|
62
|
-
geo.builder = this.builder;
|
|
63
|
-
const addedGeo = geo.add(geoInputs[k]);
|
|
64
|
-
if (addedGeo)
|
|
65
|
-
added = true;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
/* this.effects.addEffects(
|
|
71
|
-
builder.voxel.getState(),
|
|
72
|
-
builder.origin,
|
|
73
|
-
builder.effects
|
|
74
|
-
); */
|
|
75
|
-
builder.clearCalculatedData();
|
|
76
|
-
return added;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { VoxelGeometryConstructor } from "./Nodes/VoxelGeometryConstructor";
|
|
2
|
-
import { VoxelLUT } from "../../../Voxels/Data/VoxelLUT";
|
|
3
|
-
import { GeometryLUT } from "../../../Voxels/Data/GeometryLUT";
|
|
4
|
-
export class VoxelModelConstructorRegister {
|
|
5
|
-
static geometry = [];
|
|
6
|
-
static customNodes = new Map();
|
|
7
|
-
static registerCustomNode(id, node) {
|
|
8
|
-
this.customNodes.set(id, node);
|
|
9
|
-
}
|
|
10
|
-
static getCustomNode(id) {
|
|
11
|
-
const node = this.customNodes.get(id);
|
|
12
|
-
if (!node)
|
|
13
|
-
throw new Error(`Custom geometry node [${id}] does not exist.`);
|
|
14
|
-
return node;
|
|
15
|
-
}
|
|
16
|
-
static constructorsPaltte = [];
|
|
17
|
-
static constructors = new Map();
|
|
18
|
-
static getConstructor(id) {
|
|
19
|
-
return this.constructors.get(id);
|
|
20
|
-
}
|
|
21
|
-
static registerVoxel(voxel) {
|
|
22
|
-
if (Array.isArray(voxel)) {
|
|
23
|
-
for (const vox of voxel) {
|
|
24
|
-
this.constructors.set(vox.id, vox);
|
|
25
|
-
this.constructorsPaltte[VoxelLUT.voxelIds.getNumberId(vox.id)] = vox;
|
|
26
|
-
}
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
this.constructorsPaltte[VoxelLUT.voxelIds.getNumberId(voxel.id)] = voxel;
|
|
30
|
-
this.constructors.set(voxel.id, voxel);
|
|
31
|
-
}
|
|
32
|
-
static init() {
|
|
33
|
-
for (let i = 0; i < GeometryLUT.compiledGeometry.length; i++) {
|
|
34
|
-
this.geometry[i] = new VoxelGeometryConstructor(i);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { GeneratorData } from "../Dimensions/Generator";
|
|
2
|
-
/**# InitalLoad
|
|
3
|
-
* ---
|
|
4
|
-
* Load the world without building.
|
|
5
|
-
*/
|
|
6
|
-
export declare function BuildOnly(props: {
|
|
7
|
-
dimension?: number;
|
|
8
|
-
logTasks?: true;
|
|
9
|
-
genData: Partial<GeneratorData>;
|
|
10
|
-
}): Promise<unknown>;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { WorldSimulation } from "../WorldSimulation";
|
|
2
|
-
import { WorldSimulationDimensions } from "../Internal/WorldSimulationDimensions";
|
|
3
|
-
import { WorldSimulationTools } from "../Internal/WorldSimulationTools";
|
|
4
|
-
import SaveAllSectors from "./SaveAllSectors";
|
|
5
|
-
/**# InitalLoad
|
|
6
|
-
* ---
|
|
7
|
-
* Load the world without building.
|
|
8
|
-
*/
|
|
9
|
-
export async function BuildOnly(props) {
|
|
10
|
-
return new Promise((resolve) => {
|
|
11
|
-
const generator = WorldSimulation.createGenerator({
|
|
12
|
-
...props.genData,
|
|
13
|
-
building: false,
|
|
14
|
-
culling: false,
|
|
15
|
-
});
|
|
16
|
-
if (!WorldSimulationDimensions._dimensions.has(generator._dimension)) {
|
|
17
|
-
WorldSimulationDimensions.addDimension(generator._dimension);
|
|
18
|
-
}
|
|
19
|
-
const dimension = WorldSimulationDimensions.getDimension(props.dimension || 0);
|
|
20
|
-
let done = false;
|
|
21
|
-
generator._building = false;
|
|
22
|
-
WorldSimulation.addGenerator(generator);
|
|
23
|
-
let timeOut = null;
|
|
24
|
-
const update = () => {
|
|
25
|
-
if (done)
|
|
26
|
-
return;
|
|
27
|
-
WorldSimulation.tick(true);
|
|
28
|
-
timeOut = setTimeout(update, 0);
|
|
29
|
-
};
|
|
30
|
-
update();
|
|
31
|
-
const inte = setInterval(() => {
|
|
32
|
-
let allDone = true;
|
|
33
|
-
for (const [key, task] of dimension.tasks) {
|
|
34
|
-
if (!task.generationTask)
|
|
35
|
-
continue;
|
|
36
|
-
if (task.waitingFor > 0 || task._task.size > 0) {
|
|
37
|
-
allDone = false;
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
if (!allDone)
|
|
42
|
-
return;
|
|
43
|
-
done = true;
|
|
44
|
-
clearInterval(inte);
|
|
45
|
-
clearTimeout(timeOut);
|
|
46
|
-
WorldSimulation.removeGenerator(generator);
|
|
47
|
-
(async () => {
|
|
48
|
-
if (WorldSimulationTools.worldStorage) {
|
|
49
|
-
await SaveAllSectors();
|
|
50
|
-
}
|
|
51
|
-
resolve(true);
|
|
52
|
-
})();
|
|
53
|
-
}, 250);
|
|
54
|
-
});
|
|
55
|
-
}
|