@divinevoxel/vlox 0.0.72 → 0.0.73
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/Render/DivineVoxelEngineRender.d.ts +1 -1
- package/Contexts/World/DivineVoxelEngineWorld.d.ts +1 -1
- package/Init/StartConstructor.js +6 -4
- package/Init/StartWorld.d.ts +1 -1
- package/Mesher/Functions/CompactVoxelMesh.d.ts +2 -2
- package/Mesher/Functions/CompactVoxelMesh.js +1 -1
- package/Mesher/Functions/MeshSection.js +20 -8
- package/Mesher/Functions/MeshTexture.d.ts +1 -1
- package/Mesher/Functions/MeshTexture.js +3 -4
- package/Mesher/Geomtry/Primitives/QuadVertexData.d.ts +12 -10
- package/Mesher/Geomtry/Primitives/QuadVertexData.js +49 -56
- package/Mesher/Geomtry/VoxelGeometryBuilder.d.ts +2 -2
- package/Mesher/Geomtry/VoxelGeometryBuilder.js +2 -2
- package/Mesher/Geomtry/VoxelMesh.d.ts +1 -1
- package/Mesher/Geomtry/VoxelMesh.js +2 -2
- package/Mesher/Geomtry/index.d.ts +0 -1
- package/Mesher/Geomtry/index.js +0 -1
- package/Mesher/InitMesher.js +1 -1
- package/Mesher/InitTask.js +4 -22
- package/Mesher/Models/Common/Calc/FaceDataCalc.d.ts +2 -2
- package/Mesher/Models/Common/Calc/FaceDataCalc.js +37 -30
- package/Mesher/Models/Nodes/Custom/Liquid/FlowGradient.d.ts +2 -2
- package/Mesher/Models/Nodes/Custom/Liquid/FlowGradient.js +1 -1
- package/Mesher/Models/Nodes/Custom/Liquid/LiquidGeomtryNode.js +11 -17
- package/Mesher/Models/Nodes/GeometryNode.d.ts +2 -2
- package/Mesher/Models/Nodes/Ruled/BoxVoxelGeometryNode.d.ts +1 -0
- package/Mesher/Models/Nodes/Ruled/BoxVoxelGeometryNode.js +24 -12
- package/Mesher/{Tools → Models/Protocols}/OutlinedVoxelTool.d.ts +1 -1
- package/Mesher/{Tools → Models/Protocols}/OutlinedVoxelTool.js +1 -1
- package/Mesher/Models/RenderedMaterials.d.ts +6 -0
- package/Mesher/{RenderedMaterials.js → Models/RenderedMaterials.js} +2 -2
- package/Mesher/Models/VoxelConstructor.d.ts +3 -3
- package/Mesher/Models/VoxelGeometryBuilderCacheSpace.d.ts +1 -3
- package/Mesher/Models/VoxelGeometryBuilderCacheSpace.js +0 -23
- package/Mesher/{Tools/VoxelMesherDataTool.d.ts → Models/VoxelModelBuilder.d.ts} +4 -5
- package/Mesher/{Tools/VoxelMesherDataTool.js → Models/VoxelModelBuilder.js} +11 -7
- package/Models/Defaults/CubeVoxelGeometry.js +4 -0
- package/Models/Defaults/CubeVoxelModels.js +344 -344
- package/Models/Defaults/LiquidVoxelModel.js +2 -2
- package/Models/Defaults/PanelVoxelModels.js +432 -432
- package/Models/Defaults/StairVoxelModel.js +576 -576
- package/Models/Examples.js +469 -456
- package/Models/Rules/Functions/BuildFinalInputs.js +9 -7
- package/Models/Rules/Functions/BuildGeomtryInputs.js +8 -5
- package/Models/Rules/Functions/BuildRules.js +2 -2
- package/Models/Rules/{VoxelModelManager.d.ts → VoxelModelRuleBuilderRegister.d.ts} +1 -1
- package/Models/Rules/VoxelModelRuleBuilderRegister.js +178 -0
- package/Models/VoxelModel.types.d.ts +14 -5
- package/Renderer/Classes/SectorMesh.d.ts +3 -4
- package/Renderer/Classes/SectorMesh.js +6 -11
- package/Renderer/InitTasks.js +6 -7
- package/Renderer/MeshManager.js +2 -2
- package/Renderer/MeshRegister.js +2 -1
- package/Settings/EngineSettings.d.ts +1 -1
- package/Settings/EngineSettings.js +3 -5
- package/Settings/EngineSettings.types.d.ts +17 -18
- package/Settings/EngineSettings.types.js +16 -15
- package/Tasks/IWG/IWG.d.ts +2 -1
- package/Tasks/IWG/IWG.js +9 -3
- package/Tasks/IWG/Internal/Classes/BuildQueue.d.ts +11 -0
- package/Tasks/IWG/Internal/Classes/BuildQueue.js +49 -0
- package/Tasks/IWG/Internal/Classes/Generator.d.ts +6 -1
- package/Tasks/IWG/Internal/Classes/Generator.js +13 -1
- package/Tasks/IWG/Internal/Classes/IWGTaskBase.js +2 -2
- package/Tasks/IWG/Internal/Functions/runBuildUpdate.js +21 -2
- package/Tasks/IWG/Internal/IWGTasks.d.ts +0 -4
- package/Tasks/IWG/Internal/IWGTasks.js +0 -10
- package/Tasks/IWG/Internal/IWGTools.d.ts +1 -1
- package/Tasks/IWG/Procedures/SaveAllSectors.js +2 -0
- package/Tasks/Update/UpdateTask.d.ts +3 -1
- package/Tasks/Update/UpdateTask.js +28 -2
- package/Tasks/Update/VoxelUpdate.js +6 -0
- package/Tasks/WorldGeneration/WorldGenBrush.js +1 -1
- package/Templates/Cursor/TemplateCursor.d.ts +2 -2
- package/Templates/Cursor/TemplateCursor.js +1 -2
- package/Templates/VoxelTemplates.types.d.ts +1 -1
- package/Textures/Classes/CompiledTexture.d.ts +18 -0
- package/Textures/Classes/CompiledTexture.js +50 -0
- package/Textures/Classes/CompiledTextureAnimation.d.ts +12 -0
- package/Textures/Classes/CompiledTextureAnimation.js +27 -0
- package/Textures/Classes/TextureAnimationTexture.d.ts +10 -0
- package/Textures/Classes/TextureAnimationTexture.js +32 -0
- package/Textures/Functions/BuildTextureData.d.ts +10 -0
- package/Textures/Functions/BuildTextureData.js +205 -0
- package/Textures/Texture.types.d.ts +50 -64
- package/Textures/TextureManager.d.ts +8 -19
- package/Textures/TextureManager.js +28 -166
- package/Tools/Brush/Brush.d.ts +1 -1
- package/Tools/Brush/Brush.js +39 -7
- package/Util/Binary/BinaryArrays.d.ts +6 -0
- package/Util/Binary/BinaryArrays.js +25 -0
- package/Util/Binary/BinaryBuffer.d.ts +29 -0
- package/Util/Binary/BinaryBuffer.js +130 -0
- package/Util/Binary/{BitArray.d.ts → BinaryFunctions.d.ts} +1 -2
- package/Util/Binary/BinaryFunctions.js +11 -0
- package/Voxels/Cursor/DataCursor.interface.d.ts +5 -0
- package/Voxels/Cursor/VoxelCursor.interface.d.ts +1 -1
- package/Voxels/Cursor/VoxelCursor.interface.js +8 -11
- package/Voxels/Data/VoxelPalettesRegister.d.ts +0 -5
- package/Voxels/Data/VoxelPalettesRegister.js +0 -9
- package/Voxels/Data/VoxelTagsRegister.js +7 -7
- package/Voxels/Functions/BuildStateData.js +9 -9
- package/Voxels/Functions/BuildTagAndPaletteData.js +2 -4
- package/Voxels/InitVoxelData.js +12 -13
- package/Voxels/State/Schema/StateSchema.d.ts +1 -1
- package/Voxels/Types/Voxel.types.d.ts +18 -0
- package/Voxels/Types/Voxel.types.js +6 -2
- package/World/Archive/Archive.types.d.ts +38 -34
- package/World/Archive/Functions/ArchiveArea.js +16 -24
- package/World/Archive/Functions/ArchiveSector.js +477 -192
- package/World/Archive/Functions/ImportSector.d.ts +3 -3
- package/World/Archive/Functions/ImportSector.js +202 -141
- package/World/Archive/Functions/Shared.d.ts +6 -0
- package/World/Archive/Functions/Shared.js +75 -0
- package/World/Archive/InitTasks.js +30 -13
- package/World/Cursor/SectionCursor.d.ts +2 -2
- package/World/Cursor/SectionCursor.js +2 -3
- package/World/Cursor/SectorCursor.d.ts +2 -2
- package/World/Cursor/SectorCursor.js +1 -2
- package/World/Cursor/WorldCursor.d.ts +2 -2
- package/World/Cursor/WorldCursor.js +1 -2
- package/World/Cursor/WorldVoxelCursor.js +1 -0
- package/World/InitTasks.d.ts +1 -1
- package/World/Lock/WorldLock.d.ts +1 -1
- package/World/Section/Section.d.ts +12 -16
- package/World/Section/Section.js +62 -20
- package/World/Section/SectionState.d.ts +10 -0
- package/World/Section/SectionState.js +11 -0
- package/World/Sector/Sector.d.ts +14 -6
- package/World/Sector/Sector.js +67 -17
- package/World/Sector/SectorHeightMap.js +2 -2
- package/World/Sector/SectorState.d.ts +14 -6
- package/World/Sector/SectorState.js +28 -15
- package/World/Types/WorldStorage.interface.js +1 -0
- package/World/WorldRegister.d.ts +4 -0
- package/World/WorldRegister.js +15 -3
- package/World/WorldSpaces.d.ts +4 -0
- package/World/WorldSpaces.js +19 -6
- package/package.json +1 -1
- package/Mesher/Functions/CompactMesh.d.ts +0 -2
- package/Mesher/Functions/CompactMesh.js +0 -42
- package/Mesher/Geomtry/GeometryNormals.d.ts +0 -10
- package/Mesher/Geomtry/GeometryNormals.js +0 -52
- package/Mesher/Geomtry/MeshData.types.d.ts +0 -13
- package/Mesher/Geomtry/MeshData.types.js +0 -6
- package/Mesher/Geomtry/Tools/MesherDataTools.d.ts +0 -7
- package/Mesher/Geomtry/Tools/MesherDataTools.js +0 -12
- package/Mesher/Geomtry/Tools/index.d.ts +0 -1
- package/Mesher/Geomtry/Tools/index.js +0 -1
- package/Mesher/RenderedMaterials.d.ts +0 -6
- package/Models/Rules/VoxelModelManager.js +0 -82
- package/Textures/TextureAnimations.d.ts +0 -4
- package/Textures/TextureAnimations.js +0 -35
- package/Textures/TextureArray.d.ts +0 -47
- package/Textures/TextureArray.js +0 -202
- package/Textures/TextureBuilder.d.ts +0 -13
- package/Textures/TextureBuilder.js +0 -120
- package/Textures/TextureRegister.d.ts +0 -9
- package/Textures/TextureRegister.js +0 -28
- package/Tools/DataCursor.interface.d.ts +0 -5
- package/Tools/DataCursor.interface.js +0 -2
- package/Util/Binary/BitArray.js +0 -16
- package/World/Structs/WorldDataStructProperties.d.ts +0 -8
- package/World/Structs/WorldDataStructProperties.js +0 -9
- /package/Mesher/{Tools → Geomtry}/VoxelMeshBVHBuilder.d.ts +0 -0
- /package/Mesher/{Tools → Geomtry}/VoxelMeshBVHBuilder.js +0 -0
- /package/Mesher/Geomtry/{Buffers.d.ts → VoxelMeshBuffers.d.ts} +0 -0
- /package/Mesher/Geomtry/{Buffers.js → VoxelMeshBuffers.js} +0 -0
- /package/Mesher/{Tools → Geomtry}/VoxelMeshVertexStructCursor.d.ts +0 -0
- /package/Mesher/{Tools → Geomtry}/VoxelMeshVertexStructCursor.js +0 -0
- /package/Mesher/{VoxelShaderData.d.ts → Geomtry/VoxelShaderData.d.ts} +0 -0
- /package/Mesher/{VoxelShaderData.js → Geomtry/VoxelShaderData.js} +0 -0
- /package/{World/Storage/WorldStorage.interface.js → Voxels/Cursor/DataCursor.interface.js} +0 -0
- /package/World/{Storage → Types}/WorldStorage.interface.d.ts +0 -0
|
@@ -19,11 +19,11 @@ export declare class DivineVoxelEngineRender {
|
|
|
19
19
|
settings: {
|
|
20
20
|
enviorment: "node" | "browser";
|
|
21
21
|
settings: EngineSettingsData;
|
|
22
|
+
version: string;
|
|
22
23
|
readonly doSunPropagation: boolean;
|
|
23
24
|
readonly doRGBPropagation: boolean;
|
|
24
25
|
readonly doLight: boolean;
|
|
25
26
|
readonly doFlow: boolean;
|
|
26
|
-
readonly isClient: boolean;
|
|
27
27
|
getSettings(): EngineSettingsData;
|
|
28
28
|
syncSettings(data: EngineSettingsData): void;
|
|
29
29
|
getSettingsCopy(): any;
|
|
@@ -11,11 +11,11 @@ export declare class DivineVoxelEngineWorld {
|
|
|
11
11
|
settings: {
|
|
12
12
|
enviorment: "node" | "browser";
|
|
13
13
|
settings: import("../../Settings/EngineSettings.types.js").EngineSettingsData;
|
|
14
|
+
version: string;
|
|
14
15
|
readonly doSunPropagation: boolean;
|
|
15
16
|
readonly doRGBPropagation: boolean;
|
|
16
17
|
readonly doLight: boolean;
|
|
17
18
|
readonly doFlow: boolean;
|
|
18
|
-
readonly isClient: boolean;
|
|
19
19
|
getSettings(): import("../../Settings/EngineSettings.types.js").EngineSettingsData;
|
|
20
20
|
syncSettings(data: import("../../Settings/EngineSettings.types.js").EngineSettingsData): void;
|
|
21
21
|
getSettingsCopy(): any;
|
package/Init/StartConstructor.js
CHANGED
|
@@ -44,10 +44,12 @@ export async function StartContrusctor(data = {}) {
|
|
|
44
44
|
InitMesherTasks(DVEC.threads.parent);
|
|
45
45
|
InitUpdateTasks({
|
|
46
46
|
onDone(tasks, origin) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
tasks.bounds.markSectionsAsDirty();
|
|
48
|
+
/*
|
|
49
|
+
origin.runTask("build-queue", [
|
|
50
|
+
tasks.origin[0],
|
|
51
|
+
tasks.bounds.getSections(),
|
|
52
|
+
]); */
|
|
51
53
|
},
|
|
52
54
|
});
|
|
53
55
|
InitWorldGenerationTasks();
|
package/Init/StartWorld.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DivineVoxelEngineWorld } from "../Contexts/World/DivineVoxelEngineWorld";
|
|
2
|
-
import { WorldStorageInterface } from "World/
|
|
2
|
+
import { WorldStorageInterface } from "World/Types/WorldStorage.interface";
|
|
3
3
|
type StartWorldProps = {
|
|
4
4
|
worldStorage?: WorldStorageInterface;
|
|
5
5
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CompactMeshData } from "../Types/Mesher.types";
|
|
2
|
-
import {
|
|
3
|
-
export declare function CompactVoxelMesh(tools:
|
|
2
|
+
import { VoxelModelBuilder } from "Mesher/Models/VoxelModelBuilder";
|
|
3
|
+
export declare function CompactVoxelMesh(tools: VoxelModelBuilder[], transfers?: any[]): CompactMeshData;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { VoxelMeshVertexStructCursor } from "../
|
|
1
|
+
import { VoxelMeshVertexStructCursor } from "../Geomtry/VoxelMeshVertexStructCursor";
|
|
2
2
|
const structCursor = new VoxelMeshVertexStructCursor();
|
|
3
3
|
/*
|
|
4
4
|
function MakeWebGPUMesh(tool: VoxelMesherDataTool): CompactMeshData {
|
|
@@ -7,9 +7,9 @@ import { WorldCursor } from "../../World/Cursor/WorldCursor.js";
|
|
|
7
7
|
import { SectionCursor } from "../../World/Cursor/SectionCursor.js";
|
|
8
8
|
import { VoxelModelConstructorRegister } from "../Models/VoxelModelConstructorRegister.js";
|
|
9
9
|
import { WorldRegister } from "../../World/WorldRegister.js";
|
|
10
|
-
import { VoxelMeshBVHBuilder } from "../
|
|
10
|
+
import { VoxelMeshBVHBuilder } from "../Geomtry/VoxelMeshBVHBuilder";
|
|
11
11
|
import { Vector3Like } from "@amodx/math";
|
|
12
|
-
import { RenderedMaterials } from "
|
|
12
|
+
import { RenderedMaterials } from "../Models/RenderedMaterials";
|
|
13
13
|
const sectionCursor = new SectionCursor();
|
|
14
14
|
const worldCursor = new WorldCursor();
|
|
15
15
|
let space;
|
|
@@ -39,16 +39,19 @@ export function MeshSection(location, transfers = []) {
|
|
|
39
39
|
y: WorldSpaces.section.bounds.y + padding.y,
|
|
40
40
|
z: WorldSpaces.section.bounds.z + padding.z,
|
|
41
41
|
});
|
|
42
|
-
const
|
|
43
|
-
const sector = WorldRegister.sectors.get(dimension, cx, cy, cz);
|
|
42
|
+
const sector = WorldRegister.sectors.getAt(location);
|
|
44
43
|
if (!sector)
|
|
45
44
|
return null;
|
|
46
|
-
const section = sector.getSection(
|
|
45
|
+
const section = sector.getSection(location[1], location[2], location[3]);
|
|
46
|
+
const [cx, cy, cz] = section.getPosition();
|
|
47
47
|
worldCursor.setFocalPoint(...location);
|
|
48
48
|
sectionCursor.setSection(...location);
|
|
49
49
|
let [minY, maxY] = section.getMinMax();
|
|
50
|
-
if (
|
|
50
|
+
if (minY == Infinity && maxY == -Infinity) {
|
|
51
|
+
section.setDirty(false);
|
|
52
|
+
section.setInProgress(false);
|
|
51
53
|
return null;
|
|
54
|
+
}
|
|
52
55
|
space.start(cx - (padding.x - 1), cy - (padding.y - 1), cz - (padding.z - 1));
|
|
53
56
|
bvhTool.reset();
|
|
54
57
|
const effects = {};
|
|
@@ -65,10 +68,12 @@ export function MeshSection(location, transfers = []) {
|
|
|
65
68
|
if (!(i % slice)) {
|
|
66
69
|
const y = i / slice;
|
|
67
70
|
if (!section.getHasVoxel(y) && !section.getHasVoxelDirty(y)) {
|
|
68
|
-
i += slice;
|
|
71
|
+
i += slice - 1;
|
|
69
72
|
continue;
|
|
70
73
|
}
|
|
71
74
|
}
|
|
75
|
+
if (!section.ids[i])
|
|
76
|
+
continue;
|
|
72
77
|
if (!section.ids[i] || section.getBuried(i))
|
|
73
78
|
continue;
|
|
74
79
|
const voxel = sectionCursor.getVoxelAtIndex(i);
|
|
@@ -88,7 +93,12 @@ export function MeshSection(location, transfers = []) {
|
|
|
88
93
|
}
|
|
89
94
|
// console.log(performance.now() - t);
|
|
90
95
|
const sectionEffects = [];
|
|
91
|
-
const sections = [
|
|
96
|
+
const sections = [
|
|
97
|
+
[location[0], ...section.getPosition()],
|
|
98
|
+
[],
|
|
99
|
+
sectionEffects,
|
|
100
|
+
0,
|
|
101
|
+
];
|
|
92
102
|
const meshed = [];
|
|
93
103
|
for (let i = 0; i < RenderedMaterials.meshers.length; i++) {
|
|
94
104
|
const mesher = RenderedMaterials.meshers[i];
|
|
@@ -110,5 +120,7 @@ export function MeshSection(location, transfers = []) {
|
|
|
110
120
|
meshed[i].clear();
|
|
111
121
|
meshed[i].bvhTool = null;
|
|
112
122
|
}
|
|
123
|
+
section.setDirty(false);
|
|
124
|
+
section.setInProgress(false);
|
|
113
125
|
return sections;
|
|
114
126
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function MeshTexture(textureId: number, textureData: number[]):
|
|
1
|
+
export declare function MeshTexture(textureId: number, textureData: number[]): void;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { MesherDataTool } from "../Geomtry/Tools/MesherDataTools";
|
|
2
1
|
import { Quad } from "../Geomtry/Primitives/Quad";
|
|
3
2
|
const Quads = {
|
|
4
3
|
north: Quad.Create([
|
|
@@ -10,8 +9,8 @@ const Quads = {
|
|
|
10
9
|
[1, 1, 0],
|
|
11
10
|
], Quad.FullUVs, false, 0),
|
|
12
11
|
};
|
|
13
|
-
const tool = new MesherDataTool();
|
|
14
|
-
tool.startNewMesh();
|
|
12
|
+
//const tool = new MesherDataTool();
|
|
13
|
+
//tool.startNewMesh();
|
|
15
14
|
//tool.mesh!.attributes.set("uv", [[], 2, BinaryNumberTypes.Float32]);
|
|
16
15
|
//tool.mesh!.attributes.set("textureIndex", [[], 3, BinaryNumberTypes.Float32]);
|
|
17
16
|
export function MeshTexture(textureId, textureData) {
|
|
@@ -271,5 +270,5 @@ export function MeshTexture(textureId, textureData) {
|
|
|
271
270
|
|
|
272
271
|
const compacted = CompactMesh("dve_node", tool);
|
|
273
272
|
*/
|
|
274
|
-
return tool.mesh;
|
|
273
|
+
// return tool.mesh;
|
|
275
274
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { QuadVerticies } from "../Geometry.types.js";
|
|
2
2
|
import { Vector3Like, Vector2Like, Vec3Array } from "@amodx/math";
|
|
3
|
+
type QuadDataType<Data> = [Data, Data, Data, Data];
|
|
3
4
|
export declare class QuadVertexData<Data> {
|
|
4
|
-
vertices:
|
|
5
|
-
constructor(vertices:
|
|
5
|
+
vertices: QuadDataType<Data>;
|
|
6
|
+
constructor(vertices: QuadDataType<Data>);
|
|
6
7
|
getAsArray(): Data[];
|
|
7
8
|
setVertex(vertex: QuadVerticies, value: Data): void;
|
|
8
9
|
getVertex(vertex: QuadVerticies): Data;
|
|
@@ -14,8 +15,8 @@ export declare class QuadVertexData<Data> {
|
|
|
14
15
|
clone(): QuadVertexData<Data>;
|
|
15
16
|
}
|
|
16
17
|
export declare class QuadVec3ArrayVertexData extends QuadVertexData<Vec3Array> {
|
|
17
|
-
vertices:
|
|
18
|
-
constructor(vertices?:
|
|
18
|
+
vertices: QuadDataType<Vec3Array>;
|
|
19
|
+
constructor(vertices?: QuadDataType<Vec3Array>);
|
|
19
20
|
setFromQuadData(vertexData: QuadVertexData<Vec3Array>): void;
|
|
20
21
|
addToVertex(vertex: QuadVerticies, value: Vec3Array): void;
|
|
21
22
|
subtractFromVertex(vertex: QuadVerticies, value: Vec3Array): void;
|
|
@@ -26,8 +27,8 @@ export declare class QuadVec3ArrayVertexData extends QuadVertexData<Vec3Array> {
|
|
|
26
27
|
clone(): QuadVec3ArrayVertexData;
|
|
27
28
|
}
|
|
28
29
|
export declare class QuadVector3VertexData extends QuadVertexData<Vector3Like> {
|
|
29
|
-
vertices:
|
|
30
|
-
constructor(vertices?:
|
|
30
|
+
vertices: QuadDataType<Vector3Like>;
|
|
31
|
+
constructor(vertices?: QuadDataType<Vector3Like>);
|
|
31
32
|
setFromQuadData(vertexData: QuadVertexData<Vector3Like>): void;
|
|
32
33
|
addToVertex(vertex: QuadVerticies, value: Vector3Like): void;
|
|
33
34
|
subtractFromVertex(vertex: QuadVerticies, value: Vector3Like): void;
|
|
@@ -38,8 +39,8 @@ export declare class QuadVector3VertexData extends QuadVertexData<Vector3Like> {
|
|
|
38
39
|
clone(): QuadVector3VertexData;
|
|
39
40
|
}
|
|
40
41
|
export declare class QuadVector2VertexData extends QuadVertexData<Vector2Like> {
|
|
41
|
-
vertices:
|
|
42
|
-
constructor(vertices?:
|
|
42
|
+
vertices: QuadDataType<Vector2Like>;
|
|
43
|
+
constructor(vertices?: QuadDataType<Vector2Like>);
|
|
43
44
|
setFromQuadData(vertexData: QuadVertexData<Vector3Like>): void;
|
|
44
45
|
addToVertex(vertex: QuadVerticies, value: Vector2Like): void;
|
|
45
46
|
subtractFromVertex(vertex: QuadVerticies, value: Vector2Like): void;
|
|
@@ -50,8 +51,8 @@ export declare class QuadVector2VertexData extends QuadVertexData<Vector2Like> {
|
|
|
50
51
|
clone(): QuadVector2VertexData;
|
|
51
52
|
}
|
|
52
53
|
export declare class QuadScalarVertexData extends QuadVertexData<number> {
|
|
53
|
-
vertices:
|
|
54
|
-
constructor(vertices?:
|
|
54
|
+
vertices: QuadDataType<number>;
|
|
55
|
+
constructor(vertices?: QuadDataType<number>);
|
|
55
56
|
setFromQuadData(vertexData: QuadVertexData<number>): void;
|
|
56
57
|
subtractFromVertex(vertex: QuadVerticies, value: number): void;
|
|
57
58
|
addAll(value: number): void;
|
|
@@ -64,3 +65,4 @@ export declare class QuadScalarVertexData extends QuadVertexData<number> {
|
|
|
64
65
|
isAllLessThan(value: number): boolean;
|
|
65
66
|
clone(): QuadScalarVertexData;
|
|
66
67
|
}
|
|
68
|
+
export {};
|
|
@@ -68,22 +68,22 @@ export class QuadVertexData {
|
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
clone() {
|
|
71
|
-
return new QuadVertexData(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
return new QuadVertexData([
|
|
72
|
+
structuredClone(this.vertices[QuadVerticies.TopRight]),
|
|
73
|
+
structuredClone(this.vertices[QuadVerticies.TopLeft]),
|
|
74
|
+
structuredClone(this.vertices[QuadVerticies.BottomLeft]),
|
|
75
|
+
structuredClone(this.vertices[QuadVerticies.BottomRight]),
|
|
76
|
+
]);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
export class QuadVec3ArrayVertexData extends QuadVertexData {
|
|
80
80
|
vertices;
|
|
81
|
-
constructor(vertices =
|
|
82
|
-
[
|
|
83
|
-
[
|
|
84
|
-
[
|
|
85
|
-
[
|
|
86
|
-
|
|
81
|
+
constructor(vertices = [
|
|
82
|
+
[0, 0, 0],
|
|
83
|
+
[0, 0, 0],
|
|
84
|
+
[0, 0, 0],
|
|
85
|
+
[0, 0, 0],
|
|
86
|
+
]) {
|
|
87
87
|
super(vertices);
|
|
88
88
|
this.vertices = vertices;
|
|
89
89
|
}
|
|
@@ -124,24 +124,22 @@ export class QuadVec3ArrayVertexData extends QuadVertexData {
|
|
|
124
124
|
Vector3Like.EqualsArray(this.vertices[QuadVerticies.BottomRight], v1));
|
|
125
125
|
}
|
|
126
126
|
clone() {
|
|
127
|
-
return new QuadVec3ArrayVertexData(
|
|
128
|
-
[
|
|
129
|
-
[
|
|
130
|
-
[
|
|
131
|
-
[QuadVerticies.BottomRight]
|
|
132
|
-
|
|
133
|
-
],
|
|
134
|
-
});
|
|
127
|
+
return new QuadVec3ArrayVertexData([
|
|
128
|
+
[...this.vertices[QuadVerticies.TopRight]],
|
|
129
|
+
[...this.vertices[QuadVerticies.TopLeft]],
|
|
130
|
+
[...this.vertices[QuadVerticies.BottomLeft]],
|
|
131
|
+
[...this.vertices[QuadVerticies.BottomRight]],
|
|
132
|
+
]);
|
|
135
133
|
}
|
|
136
134
|
}
|
|
137
135
|
export class QuadVector3VertexData extends QuadVertexData {
|
|
138
136
|
vertices;
|
|
139
|
-
constructor(vertices =
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
137
|
+
constructor(vertices = [
|
|
138
|
+
Vector3Like.Create(),
|
|
139
|
+
Vector3Like.Create(),
|
|
140
|
+
Vector3Like.Create(),
|
|
141
|
+
Vector3Like.Create(),
|
|
142
|
+
]) {
|
|
145
143
|
super(vertices);
|
|
146
144
|
this.vertices = vertices;
|
|
147
145
|
}
|
|
@@ -182,22 +180,22 @@ export class QuadVector3VertexData extends QuadVertexData {
|
|
|
182
180
|
Vector3Like.Equals(this.vertices[QuadVerticies.BottomRight], v1));
|
|
183
181
|
}
|
|
184
182
|
clone() {
|
|
185
|
-
return new QuadVector3VertexData(
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
183
|
+
return new QuadVector3VertexData([
|
|
184
|
+
Vector3Like.Clone(this.vertices[QuadVerticies.TopRight]),
|
|
185
|
+
Vector3Like.Clone(this.vertices[QuadVerticies.TopLeft]),
|
|
186
|
+
Vector3Like.Clone(this.vertices[QuadVerticies.BottomLeft]),
|
|
187
|
+
Vector3Like.Clone(this.vertices[QuadVerticies.BottomRight]),
|
|
188
|
+
]);
|
|
191
189
|
}
|
|
192
190
|
}
|
|
193
191
|
export class QuadVector2VertexData extends QuadVertexData {
|
|
194
192
|
vertices;
|
|
195
|
-
constructor(vertices =
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
193
|
+
constructor(vertices = [
|
|
194
|
+
Vector2Like.Create(),
|
|
195
|
+
Vector2Like.Create(),
|
|
196
|
+
Vector2Like.Create(),
|
|
197
|
+
Vector2Like.Create(),
|
|
198
|
+
]) {
|
|
201
199
|
super(vertices);
|
|
202
200
|
this.vertices = vertices;
|
|
203
201
|
}
|
|
@@ -238,22 +236,17 @@ export class QuadVector2VertexData extends QuadVertexData {
|
|
|
238
236
|
Vector2Like.Equals(this.vertices[QuadVerticies.BottomRight], v1));
|
|
239
237
|
}
|
|
240
238
|
clone() {
|
|
241
|
-
return new QuadVector2VertexData(
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
239
|
+
return new QuadVector2VertexData([
|
|
240
|
+
Vector2Like.Clone(this.vertices[QuadVerticies.TopRight]),
|
|
241
|
+
Vector2Like.Clone(this.vertices[QuadVerticies.TopLeft]),
|
|
242
|
+
Vector2Like.Clone(this.vertices[QuadVerticies.BottomLeft]),
|
|
243
|
+
Vector2Like.Clone(this.vertices[QuadVerticies.BottomRight]),
|
|
244
|
+
]);
|
|
247
245
|
}
|
|
248
246
|
}
|
|
249
247
|
export class QuadScalarVertexData extends QuadVertexData {
|
|
250
248
|
vertices;
|
|
251
|
-
constructor(vertices = {
|
|
252
|
-
[QuadVerticies.TopRight]: 0,
|
|
253
|
-
[QuadVerticies.TopLeft]: 0,
|
|
254
|
-
[QuadVerticies.BottomLeft]: 0,
|
|
255
|
-
[QuadVerticies.BottomRight]: 0,
|
|
256
|
-
}) {
|
|
249
|
+
constructor(vertices = [0, 0, 0, 0]) {
|
|
257
250
|
super(vertices);
|
|
258
251
|
this.vertices = vertices;
|
|
259
252
|
}
|
|
@@ -339,11 +332,11 @@ export class QuadScalarVertexData extends QuadVertexData {
|
|
|
339
332
|
return true;
|
|
340
333
|
}
|
|
341
334
|
clone() {
|
|
342
|
-
return new QuadScalarVertexData(
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
335
|
+
return new QuadScalarVertexData([
|
|
336
|
+
this.vertices[QuadVerticies.TopRight],
|
|
337
|
+
this.vertices[QuadVerticies.TopLeft],
|
|
338
|
+
this.vertices[QuadVerticies.BottomLeft],
|
|
339
|
+
this.vertices[QuadVerticies.BottomRight],
|
|
340
|
+
]);
|
|
348
341
|
}
|
|
349
342
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Vector3Like } from "@amodx/math";
|
|
2
|
-
import {
|
|
2
|
+
import { VoxelModelBuilder } from "../Models/VoxelModelBuilder";
|
|
3
3
|
import { Quad } from "./Primitives/Quad";
|
|
4
4
|
export declare class VoxelGeometryBuilder {
|
|
5
|
-
static addQuad(tool:
|
|
5
|
+
static addQuad(tool: VoxelModelBuilder, origin: Vector3Like, quad: Quad): void;
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { VoxelShaderData } from "
|
|
1
|
+
import { VoxelShaderData } from "./VoxelShaderData";
|
|
2
2
|
import { QuadVerticies } from "./Geometry.types";
|
|
3
|
-
import { VoxelMeshVertexConstants, VoxelMeshVertexStructCursor, } from "
|
|
3
|
+
import { VoxelMeshVertexConstants, VoxelMeshVertexStructCursor, } from "./VoxelMeshVertexStructCursor";
|
|
4
4
|
const empty = [];
|
|
5
5
|
const structCursor = new VoxelMeshVertexStructCursor();
|
|
6
6
|
export class VoxelGeometryBuilder {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Vector3Like } from "@amodx/math";
|
|
2
|
-
import { VoxelVertexBuffer, VoxelIndiceBuffer } from "./
|
|
3
|
-
import { VoxelMeshVertexStructCursor } from "
|
|
2
|
+
import { VoxelVertexBuffer, VoxelIndiceBuffer } from "./VoxelMeshBuffers";
|
|
3
|
+
import { VoxelMeshVertexStructCursor } from "./VoxelMeshVertexStructCursor";
|
|
4
4
|
export class VoxelMesh {
|
|
5
5
|
indicieCount = 0;
|
|
6
6
|
vertexCount = 0;
|
package/Mesher/Geomtry/index.js
CHANGED
package/Mesher/InitMesher.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RenderedMaterials } from "./RenderedMaterials";
|
|
1
|
+
import { RenderedMaterials } from "./Models/RenderedMaterials";
|
|
2
2
|
import { VoxelModelConstructorRegister } from "./Models/VoxelModelConstructorRegister.js";
|
|
3
3
|
import { LiquidGeometryNode } from "./Models/Nodes/Custom/Liquid/LiquidGeomtryNode.js";
|
|
4
4
|
import { VoxelConstructor } from "./Models/VoxelConstructor.js";
|
package/Mesher/InitTask.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Threads } from "@amodx/threads";
|
|
2
2
|
import { WorldRegister } from "../World/WorldRegister";
|
|
3
|
-
import { WorldSpaces } from "../World/WorldSpaces";
|
|
4
3
|
import { MeshSection } from "./Functions/MeshSection";
|
|
5
4
|
import { TasksIds } from "../Tasks/TasksIds";
|
|
6
5
|
export default function (rendererThread) {
|
|
@@ -12,35 +11,18 @@ export default function (rendererThread) {
|
|
|
12
11
|
rendererThread.runTask("set-section", section, transfers);
|
|
13
12
|
});
|
|
14
13
|
Threads.registerTask(TasksIds.BuildSector, (location) => {
|
|
15
|
-
const
|
|
16
|
-
const sector = WorldRegister.sectors.get(location[0], sectorPosition.x, sectorPosition.y, sectorPosition.z);
|
|
14
|
+
const sector = WorldRegister.sectors.getAt(location);
|
|
17
15
|
if (!sector) {
|
|
18
|
-
console.warn("Tried building a sector that does not exists.",
|
|
19
|
-
sectorPosition.x,
|
|
20
|
-
sectorPosition.y,
|
|
21
|
-
sectorPosition.z,
|
|
22
|
-
]);
|
|
16
|
+
console.warn("Tried building a sector that does not exists.", location);
|
|
23
17
|
return;
|
|
24
18
|
}
|
|
25
|
-
if (sector.sections.length == 0) {
|
|
26
|
-
console.warn("Tried building a sector with no sections.", sector.position);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const transfers = [];
|
|
30
19
|
for (let i = 0; i < sector.sections.length; i++) {
|
|
31
20
|
const section = sector.sections[i];
|
|
32
|
-
if (!section)
|
|
33
|
-
continue;
|
|
34
21
|
let [minY, maxY] = section.getMinMax();
|
|
35
22
|
if (Math.abs(minY) == Infinity && Math.abs(maxY) == Infinity)
|
|
36
23
|
continue;
|
|
37
|
-
transfers
|
|
38
|
-
const sectionMesh = MeshSection([
|
|
39
|
-
location[0],
|
|
40
|
-
sector.position[0],
|
|
41
|
-
sector.position[1] + i * WorldSpaces.section.bounds.y,
|
|
42
|
-
sector.position[2],
|
|
43
|
-
], transfers);
|
|
24
|
+
const transfers = [];
|
|
25
|
+
const sectionMesh = MeshSection([location[0], ...section.getPosition()], transfers);
|
|
44
26
|
if (!sectionMesh)
|
|
45
27
|
continue;
|
|
46
28
|
rendererThread.runTask("set-section", sectionMesh, transfers);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { VoxelModelBuilder } from "../../VoxelModelBuilder.js";
|
|
2
2
|
import { VoxelFaces } from "../../../../Math/index.js";
|
|
3
|
-
export default function calculateFaceData(face: VoxelFaces, builder:
|
|
3
|
+
export default function calculateFaceData(face: VoxelFaces, builder: VoxelModelBuilder): void;
|
|
@@ -2,47 +2,54 @@ import { VoxelFaceDirections } from "../../../../Math/index.js";
|
|
|
2
2
|
import { GradientCheckSets } from "./CalcConstants.js";
|
|
3
3
|
import { VoxelLightData } from "../../../../Voxels/Cursor/VoxelLightData.js";
|
|
4
4
|
const lightData = new VoxelLightData();
|
|
5
|
-
const currentLightValues = new Uint16Array([0, 0, 0, 0]);
|
|
6
|
-
const loadedLightValues = new Uint16Array([0, 0, 0, 0]);
|
|
7
5
|
export default function calculateFaceData(face, builder) {
|
|
8
|
-
let light = builder.voxel.getLight();
|
|
9
|
-
const faceNormal = VoxelFaceDirections[face];
|
|
10
6
|
const x = builder.position.x;
|
|
11
7
|
const y = builder.position.y;
|
|
12
8
|
const z = builder.position.z;
|
|
13
9
|
const vertexData = builder.lightData[face];
|
|
14
10
|
const nVoxel = builder.nVoxel;
|
|
15
11
|
const checkSet = GradientCheckSets[face];
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
let startLight = 0;
|
|
13
|
+
if (builder.voxel.isLightSource()) {
|
|
14
|
+
startLight = builder.voxel.getLightSourceValue();
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
startLight =
|
|
18
|
+
nVoxel
|
|
19
|
+
.getVoxel(x + VoxelFaceDirections[face][0], y + VoxelFaceDirections[face][1], z + VoxelFaceDirections[face][2])
|
|
20
|
+
?.getLight() || 0;
|
|
21
|
+
}
|
|
22
|
+
if (startLight < 0)
|
|
23
|
+
startLight = 0;
|
|
24
|
+
const startS = lightData.getS(startLight);
|
|
25
|
+
const startR = lightData.getR(startLight);
|
|
26
|
+
const startG = lightData.getG(startLight);
|
|
27
|
+
const startB = lightData.getB(startLight);
|
|
18
28
|
for (let vertex = 0; vertex < 4; vertex++) {
|
|
19
|
-
vertexData[vertex] =
|
|
20
|
-
|
|
29
|
+
vertexData[vertex] = startLight;
|
|
30
|
+
let s = startS;
|
|
31
|
+
let r = startR;
|
|
32
|
+
let g = startG;
|
|
33
|
+
let b = startB;
|
|
21
34
|
for (let i = 0; i < 9; i += 3) {
|
|
22
|
-
const nl =
|
|
35
|
+
const nl = nVoxel
|
|
36
|
+
.getVoxel(checkSet[vertex][i] + x, checkSet[vertex][i + 1] + y, checkSet[vertex][i + 2] + z)
|
|
37
|
+
?.getLight() || -1;
|
|
23
38
|
if (nl <= 0)
|
|
24
39
|
continue;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
lightData.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
currentLightValues[2] =
|
|
38
|
-
currentLightValues[2] < loadedLightValues[2]
|
|
39
|
-
? loadedLightValues[2]
|
|
40
|
-
: currentLightValues[2];
|
|
41
|
-
currentLightValues[3] =
|
|
42
|
-
currentLightValues[3] < loadedLightValues[3]
|
|
43
|
-
? loadedLightValues[3]
|
|
44
|
-
: currentLightValues[3];
|
|
40
|
+
let ns = lightData.getS(nl);
|
|
41
|
+
let nr = lightData.getR(nl);
|
|
42
|
+
let ng = lightData.getG(nl);
|
|
43
|
+
let nb = lightData.getB(nl);
|
|
44
|
+
if (s < ns)
|
|
45
|
+
s = ns;
|
|
46
|
+
if (r < nr)
|
|
47
|
+
r = nr;
|
|
48
|
+
if (g < ng)
|
|
49
|
+
g = ng;
|
|
50
|
+
if (b < nb)
|
|
51
|
+
b = nb;
|
|
45
52
|
}
|
|
46
|
-
vertexData[vertex] = lightData.
|
|
53
|
+
vertexData[vertex] = lightData.createLightValue(s, r, g, b);
|
|
47
54
|
}
|
|
48
55
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { VoxelModelBuilder } from "../../../VoxelModelBuilder";
|
|
2
2
|
import { QuadScalarVertexData } from "../../../../Geomtry/Primitives/QuadVertexData";
|
|
3
3
|
import { CompassAngles } from "@amodx/math";
|
|
4
4
|
export declare enum FlowVerticies {
|
|
@@ -8,4 +8,4 @@ export declare enum FlowVerticies {
|
|
|
8
8
|
SouthEsat = 3
|
|
9
9
|
}
|
|
10
10
|
export declare function getFlowAngle(vertexLevel: QuadScalarVertexData): [angle: CompassAngles, flow: number];
|
|
11
|
-
export declare function getFlowGradient(tool:
|
|
11
|
+
export declare function getFlowGradient(tool: VoxelModelBuilder, flowStates: QuadScalarVertexData): QuadScalarVertexData;
|
|
@@ -66,7 +66,7 @@ const returnData = [
|
|
|
66
66
|
export function getFlowAngle(vertexLevel) {
|
|
67
67
|
if (vertexLevel.isAllEqualTo(7)) {
|
|
68
68
|
returnData[0] = 0;
|
|
69
|
-
returnData[1] = FlowStates.
|
|
69
|
+
returnData[1] = FlowStates.Up;
|
|
70
70
|
return returnData;
|
|
71
71
|
}
|
|
72
72
|
const upRight = vertexLevel.vertices[QuadVerticies.TopRight];
|