@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
|
@@ -3,63 +3,77 @@ import { GeometryLUT } from "../../../../../Voxels/Data/GeometryLUT";
|
|
|
3
3
|
import { getInterpolationValue } from "../Calc/CalcConstants";
|
|
4
4
|
import { VoxelLUT } from "../../../../../Voxels/Data/VoxelLUT";
|
|
5
5
|
export function ShadeRulledFace(builder, trueFaceIndex, lightData, vertexWeights, vertexStride) {
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
6
|
+
const voxel = builder.voxel;
|
|
7
|
+
const noAO = voxel.isLightSource() || voxel.noAO();
|
|
8
|
+
const worldLightVerts = builder.vars.light.vertices;
|
|
9
|
+
const worldAOVerts = builder.vars.ao.vertices;
|
|
10
|
+
const space = builder.space;
|
|
11
|
+
const foundHash = space.foundHash;
|
|
12
|
+
const posX = builder.position.x;
|
|
13
|
+
const posY = builder.position.y;
|
|
14
|
+
const posZ = builder.position.z;
|
|
15
|
+
const nVoxel = builder.nVoxel;
|
|
16
|
+
const aoVertexHitMap = GeometryLUT.aoVertexHitMap;
|
|
17
|
+
const geometryIndex = GeometryLUT.geometryIndex;
|
|
18
|
+
const aoIndex = GeometryLUT.aoIndex;
|
|
19
|
+
const voxelIdToState = VoxelLUT.voxelIdToState;
|
|
9
20
|
for (let v = 0; v < vertexStride; v++) {
|
|
10
|
-
|
|
11
|
-
|
|
21
|
+
worldAOVerts[v] = 0;
|
|
22
|
+
worldLightVerts[v] = getInterpolationValue(lightData, vertexWeights[v]);
|
|
12
23
|
if (noAO)
|
|
13
24
|
continue;
|
|
14
|
-
const aoIndexes =
|
|
25
|
+
const aoIndexes = aoVertexHitMap[trueFaceIndex][v];
|
|
15
26
|
if (!aoIndexes)
|
|
16
27
|
continue;
|
|
17
28
|
for (let i = 0; i < aoIndexes.length; i++) {
|
|
18
29
|
const directionIndex = aoIndexes[i];
|
|
19
30
|
const p = VoxelRelativeCubeIndexPositionMap[directionIndex];
|
|
20
|
-
const hashed =
|
|
21
|
-
if (
|
|
22
|
-
builder.space.noCastAO[hashed] === 1)
|
|
31
|
+
const hashed = space.getHash(nVoxel, posX + p[0], posY + p[1], posZ + p[2]);
|
|
32
|
+
if (foundHash[hashed] < 2)
|
|
23
33
|
continue;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
let count = 1;
|
|
35
|
+
for (let s = 0; s < count; s++) {
|
|
36
|
+
let secondary = s == 1 ? true : false;
|
|
37
|
+
if (space.getNoCastAO(hashed, secondary))
|
|
38
|
+
continue;
|
|
39
|
+
const voxelId = space.getVoxelId(hashed, secondary);
|
|
40
|
+
const reltionalVoxelId = space.getRelationalVoxelId(hashed, secondary);
|
|
41
|
+
const geoIdx = VoxelLUT.getGeometryIndex(voxelId, reltionalVoxelId);
|
|
42
|
+
const baseGeo = geometryIndex[geoIdx];
|
|
43
|
+
let shaded = false;
|
|
44
|
+
if (baseGeo) {
|
|
45
|
+
for (let geoIndex = 0; geoIndex < baseGeo.length; geoIndex++) {
|
|
46
|
+
if (aoIndex.getValue(baseGeo[geoIndex], directionIndex, trueFaceIndex, v)) {
|
|
47
|
+
if (++worldAOVerts[v] >= 3) {
|
|
48
|
+
shaded = true;
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
37
51
|
}
|
|
38
52
|
}
|
|
39
53
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
shaded = true;
|
|
60
|
-
break;
|
|
54
|
+
if (shaded)
|
|
55
|
+
continue;
|
|
56
|
+
const trueVoxelId = space.getTrueVoxelId(hashed, secondary);
|
|
57
|
+
const offsetConditonalGeometry = VoxelLUT.getConditionalGeometryNodes(trueVoxelId);
|
|
58
|
+
if (offsetConditonalGeometry) {
|
|
59
|
+
const modelState = voxelIdToState[voxelId];
|
|
60
|
+
const relationalModState = space.getRelationalState(hashed, secondary);
|
|
61
|
+
for (let j = 0; j < offsetConditonalGeometry.length; j++) {
|
|
62
|
+
const [geoId, requiredModelState, requiredReltionalModelState] = offsetConditonalGeometry[j];
|
|
63
|
+
if (requiredModelState !== modelState ||
|
|
64
|
+
!requiredReltionalModelState[relationalModState])
|
|
65
|
+
continue;
|
|
66
|
+
const geometries = geometryIndex[geoId];
|
|
67
|
+
for (let k = 0; k < geometries.length; k++) {
|
|
68
|
+
if (aoIndex.getValue(geometries[k], directionIndex, trueFaceIndex, v)) {
|
|
69
|
+
if (++worldAOVerts[v] >= 3) {
|
|
70
|
+
shaded = true;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
61
73
|
}
|
|
62
74
|
}
|
|
75
|
+
if (shaded)
|
|
76
|
+
break;
|
|
63
77
|
}
|
|
64
78
|
}
|
|
65
79
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { QuadVerticies } from "../../../../../Geometry/Geometry.types";
|
|
2
1
|
import { CompassAngles } from "@amodx/math";
|
|
3
2
|
var FlowStates;
|
|
4
3
|
(function (FlowStates) {
|
|
@@ -69,10 +68,10 @@ export function getFlowAngle(vertexLevel) {
|
|
|
69
68
|
returnData[1] = FlowStates.None;
|
|
70
69
|
return returnData;
|
|
71
70
|
}
|
|
72
|
-
const upRight = vertexLevel.vertices[QuadVerticies.TopRight];
|
|
73
|
-
const upLeft = vertexLevel.vertices[QuadVerticies.TopLeft];
|
|
74
|
-
const downLeft = vertexLevel.vertices[QuadVerticies.BottomLeft];
|
|
75
|
-
const downRight = vertexLevel.vertices[QuadVerticies.BottomRight];
|
|
71
|
+
const upRight = vertexLevel.vertices[0 /* QuadVerticies.TopRight */];
|
|
72
|
+
const upLeft = vertexLevel.vertices[1 /* QuadVerticies.TopLeft */];
|
|
73
|
+
const downLeft = vertexLevel.vertices[2 /* QuadVerticies.BottomLeft */];
|
|
74
|
+
const downRight = vertexLevel.vertices[3 /* QuadVerticies.BottomRight */];
|
|
76
75
|
const upEqual = upRight == upLeft;
|
|
77
76
|
const downEqual = downRight == downLeft;
|
|
78
77
|
const rightEqual = upRight == downRight;
|
|
@@ -4,7 +4,7 @@ import { VoxelFaces } from "../../../../../../Math";
|
|
|
4
4
|
import type { LiquidVoxelModelArgs } from "../../../../../../Voxels/Models/Defaults/LiquidVoxelModel";
|
|
5
5
|
export declare class LiquidGeometryNode extends GeoemtryNode<VoxelCustomGeometryNode, LiquidVoxelModelArgs> {
|
|
6
6
|
init(): void;
|
|
7
|
-
isExposed(face: VoxelFaces): boolean;
|
|
7
|
+
isExposed(face: VoxelFaces, voxelId: number): boolean;
|
|
8
8
|
determineShading(face: VoxelFaces): void;
|
|
9
9
|
add(args: LiquidVoxelModelArgs): boolean;
|
|
10
10
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { GeoemtryNode } from "../../GeometryNode";
|
|
2
2
|
import { CompassAngles } from "@amodx/math";
|
|
3
3
|
import { Quad } from "../../../../../Geometry/Primitives/Quad";
|
|
4
|
-
import { QuadVerticies, } from "../../../../../Geometry/Geometry.types";
|
|
5
4
|
import { QuadScalarVertexData } from "../../../../../Geometry/Primitives/QuadVertexData";
|
|
6
|
-
import { VoxelFaceDirections
|
|
5
|
+
import { VoxelFaceDirections } from "../../../../../../Math";
|
|
7
6
|
import { getFlowAngle, getFlowGradient, FlowVerticies } from "./FlowGradient";
|
|
8
7
|
import { VoxelLightData } from "../../../../../../Voxels/Cursor/VoxelLightData";
|
|
9
8
|
import { addVoxelQuad } from "../../../../Geometry/VoxelGeometryBuilder";
|
|
@@ -33,22 +32,20 @@ const { quads: Quads } = Box.Create([
|
|
|
33
32
|
[0, 0, 0],
|
|
34
33
|
[1, waterHeight, 1],
|
|
35
34
|
]);
|
|
36
|
-
Quads[VoxelFaces.Up].setUVs(uvs);
|
|
37
|
-
Quads[VoxelFaces.Down].setUVs(uvs);
|
|
35
|
+
Quads[0 /* VoxelFaces.Up */].setUVs(uvs);
|
|
36
|
+
Quads[1 /* VoxelFaces.Down */].setUVs(uvs);
|
|
38
37
|
export class LiquidGeometryNode extends GeoemtryNode {
|
|
39
38
|
init() { }
|
|
40
|
-
isExposed(face) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const nv = this.builder.nVoxel.getVoxel(VoxelFaceDirections[face][0] + this.builder.position.x, VoxelFaceDirections[face][1] + this.builder.position.y, VoxelFaceDirections[face][2] + this.builder.position.z);
|
|
45
|
-
if (!nv)
|
|
39
|
+
isExposed(face, voxelId) {
|
|
40
|
+
const hashed = this.builder.space.getHash(this.builder.nVoxel, VoxelFaceDirections[face][0] + this.builder.position.x, VoxelFaceDirections[face][1] + this.builder.position.y, VoxelFaceDirections[face][2] + this.builder.position.z);
|
|
41
|
+
const found = this.builder.space.foundHash[hashed];
|
|
42
|
+
if (!found)
|
|
46
43
|
return true;
|
|
47
|
-
if (this.builder.
|
|
44
|
+
if (voxelId == this.builder.space.getTrueVoxelId(hashed))
|
|
48
45
|
return false;
|
|
49
|
-
if (
|
|
46
|
+
if (found == 1 || found == 3)
|
|
50
47
|
return true;
|
|
51
|
-
if (face == VoxelFaces.Up)
|
|
48
|
+
if (face == 0 /* VoxelFaces.Up */)
|
|
52
49
|
return true;
|
|
53
50
|
return false;
|
|
54
51
|
}
|
|
@@ -77,26 +74,27 @@ export class LiquidGeometryNode extends GeoemtryNode {
|
|
|
77
74
|
flowTexture = 0;
|
|
78
75
|
stillTexture = 0;
|
|
79
76
|
} */
|
|
77
|
+
const voxelId = builder.voxel.getVoxelId();
|
|
80
78
|
let added = false;
|
|
81
79
|
let upFaceExposed = false;
|
|
82
|
-
if (this.isExposed(VoxelFaces.Up)) {
|
|
80
|
+
if (this.isExposed(0 /* VoxelFaces.Up */, voxelId)) {
|
|
83
81
|
upFaceExposed = true;
|
|
84
82
|
added = true;
|
|
85
83
|
getFlowGradient(builder, vertexLevel);
|
|
86
|
-
const quad = Quads[VoxelFaces.Up];
|
|
87
|
-
this.determineShading(VoxelFaces.Up);
|
|
84
|
+
const quad = Quads[0 /* VoxelFaces.Up */];
|
|
85
|
+
this.determineShading(0 /* VoxelFaces.Up */);
|
|
88
86
|
vertexValue.set(vertexLevel.vertices[0] / 7, vertexLevel.vertices[1] / 7, vertexLevel.vertices[2] / 7, vertexLevel.vertices[3] / 7);
|
|
89
87
|
const flowData = getFlowAngle(vertexLevel);
|
|
90
88
|
const uvSet = quadRotations[flowData[0]];
|
|
91
89
|
builder.vars.animation.setAll(flowData[1]);
|
|
92
|
-
quad.uvs.vertices[QuadVerticies.TopRight].x = uvSet[0][0];
|
|
93
|
-
quad.uvs.vertices[QuadVerticies.TopRight].y = uvSet[0][1];
|
|
94
|
-
quad.uvs.vertices[QuadVerticies.TopLeft].x = uvSet[1][0];
|
|
95
|
-
quad.uvs.vertices[QuadVerticies.TopLeft].y = uvSet[1][1];
|
|
96
|
-
quad.uvs.vertices[QuadVerticies.BottomLeft].x = uvSet[2][0];
|
|
97
|
-
quad.uvs.vertices[QuadVerticies.BottomLeft].y = uvSet[2][1];
|
|
98
|
-
quad.uvs.vertices[QuadVerticies.BottomRight].x = uvSet[3][0];
|
|
99
|
-
quad.uvs.vertices[QuadVerticies.BottomRight].y = uvSet[3][1];
|
|
90
|
+
quad.uvs.vertices[0 /* QuadVerticies.TopRight */].x = uvSet[0][0];
|
|
91
|
+
quad.uvs.vertices[0 /* QuadVerticies.TopRight */].y = uvSet[0][1];
|
|
92
|
+
quad.uvs.vertices[1 /* QuadVerticies.TopLeft */].x = uvSet[1][0];
|
|
93
|
+
quad.uvs.vertices[1 /* QuadVerticies.TopLeft */].y = uvSet[1][1];
|
|
94
|
+
quad.uvs.vertices[2 /* QuadVerticies.BottomLeft */].x = uvSet[2][0];
|
|
95
|
+
quad.uvs.vertices[2 /* QuadVerticies.BottomLeft */].y = uvSet[2][1];
|
|
96
|
+
quad.uvs.vertices[3 /* QuadVerticies.BottomRight */].x = uvSet[3][0];
|
|
97
|
+
quad.uvs.vertices[3 /* QuadVerticies.BottomRight */].y = uvSet[3][1];
|
|
100
98
|
quad.positions.vertices[0].y = vertexValue.vertices[0] * waterHeight;
|
|
101
99
|
quad.positions.vertices[1].y = vertexValue.vertices[1] * waterHeight;
|
|
102
100
|
quad.positions.vertices[2].y = vertexValue.vertices[2] * waterHeight;
|
|
@@ -105,176 +103,176 @@ export class LiquidGeometryNode extends GeoemtryNode {
|
|
|
105
103
|
vertexLevel.vertices[1] != 7 ||
|
|
106
104
|
vertexLevel.vertices[2] != 7 ||
|
|
107
105
|
vertexLevel.vertices[3] != 7) {
|
|
108
|
-
GetTexture(builder, flowTexture, VoxelFaces.Up
|
|
106
|
+
GetTexture(builder, flowTexture, 0 /* VoxelFaces.Up */, quad);
|
|
109
107
|
}
|
|
110
108
|
else {
|
|
111
|
-
GetTexture(builder, stillTexture, VoxelFaces.Up
|
|
109
|
+
GetTexture(builder, stillTexture, 0 /* VoxelFaces.Up */, quad);
|
|
112
110
|
}
|
|
113
111
|
addVoxelQuad(builder, quad);
|
|
114
112
|
builder.updateBounds(quad.bounds);
|
|
115
113
|
}
|
|
116
|
-
if (this.isExposed(VoxelFaces.Down)) {
|
|
114
|
+
if (this.isExposed(1 /* VoxelFaces.Down */, voxelId)) {
|
|
117
115
|
added = true;
|
|
118
|
-
const quad = Quads[VoxelFaces.Down];
|
|
116
|
+
const quad = Quads[1 /* VoxelFaces.Down */];
|
|
119
117
|
if (reverseHeight) {
|
|
120
|
-
quad.positions.vertices[QuadVerticies.TopRight].y = currentHeight;
|
|
121
|
-
quad.positions.vertices[QuadVerticies.TopLeft].y = currentHeight;
|
|
122
|
-
quad.positions.vertices[QuadVerticies.BottomRight].y = currentHeight;
|
|
123
|
-
quad.positions.vertices[QuadVerticies.BottomLeft].y = currentHeight;
|
|
118
|
+
quad.positions.vertices[0 /* QuadVerticies.TopRight */].y = currentHeight;
|
|
119
|
+
quad.positions.vertices[1 /* QuadVerticies.TopLeft */].y = currentHeight;
|
|
120
|
+
quad.positions.vertices[3 /* QuadVerticies.BottomRight */].y = currentHeight;
|
|
121
|
+
quad.positions.vertices[2 /* QuadVerticies.BottomLeft */].y = currentHeight;
|
|
124
122
|
}
|
|
125
123
|
else {
|
|
126
|
-
quad.positions.vertices[QuadVerticies.TopRight].y = 0;
|
|
127
|
-
quad.positions.vertices[QuadVerticies.TopLeft].y = 0;
|
|
128
|
-
quad.positions.vertices[QuadVerticies.BottomLeft].y = 0;
|
|
129
|
-
quad.positions.vertices[QuadVerticies.BottomRight].y = 0;
|
|
124
|
+
quad.positions.vertices[0 /* QuadVerticies.TopRight */].y = 0;
|
|
125
|
+
quad.positions.vertices[1 /* QuadVerticies.TopLeft */].y = 0;
|
|
126
|
+
quad.positions.vertices[2 /* QuadVerticies.BottomLeft */].y = 0;
|
|
127
|
+
quad.positions.vertices[3 /* QuadVerticies.BottomRight */].y = 0;
|
|
130
128
|
}
|
|
131
129
|
quad.setUVs(uvs);
|
|
132
|
-
this.determineShading(VoxelFaces.Down);
|
|
133
|
-
GetTexture(builder, stillTexture, VoxelFaces.Up
|
|
130
|
+
this.determineShading(1 /* VoxelFaces.Down */);
|
|
131
|
+
GetTexture(builder, stillTexture, 0 /* VoxelFaces.Up */, quad);
|
|
134
132
|
addVoxelQuad(builder, quad);
|
|
135
133
|
builder.updateBounds(quad.bounds);
|
|
136
134
|
}
|
|
137
|
-
if (this.isExposed(VoxelFaces.North)) {
|
|
135
|
+
if (this.isExposed(2 /* VoxelFaces.North */, voxelId)) {
|
|
138
136
|
added = true;
|
|
139
|
-
const quad = Quads[VoxelFaces.North];
|
|
137
|
+
const quad = Quads[2 /* VoxelFaces.North */];
|
|
140
138
|
builder.vars.animation.setAll(1);
|
|
141
|
-
this.determineShading(VoxelFaces.North);
|
|
139
|
+
this.determineShading(2 /* VoxelFaces.North */);
|
|
142
140
|
if (upFaceExposed) {
|
|
143
|
-
quad.positions.vertices[QuadVerticies.TopRight].y =
|
|
141
|
+
quad.positions.vertices[0 /* QuadVerticies.TopRight */].y =
|
|
144
142
|
vertexValue.vertices[FlowVerticies.NorthWest] * waterHeight;
|
|
145
|
-
quad.positions.vertices[QuadVerticies.TopLeft].y =
|
|
143
|
+
quad.positions.vertices[1 /* QuadVerticies.TopLeft */].y =
|
|
146
144
|
vertexValue.vertices[FlowVerticies.NorthEast] * waterHeight;
|
|
147
|
-
quad.positions.vertices[QuadVerticies.BottomLeft].y = 0;
|
|
148
|
-
quad.positions.vertices[QuadVerticies.BottomRight].y = 0;
|
|
149
|
-
quad.uvs.vertices[QuadVerticies.TopRight].y =
|
|
145
|
+
quad.positions.vertices[2 /* QuadVerticies.BottomLeft */].y = 0;
|
|
146
|
+
quad.positions.vertices[3 /* QuadVerticies.BottomRight */].y = 0;
|
|
147
|
+
quad.uvs.vertices[0 /* QuadVerticies.TopRight */].y =
|
|
150
148
|
vertexValue.vertices[FlowVerticies.NorthWest];
|
|
151
|
-
quad.uvs.vertices[QuadVerticies.TopLeft].y =
|
|
149
|
+
quad.uvs.vertices[1 /* QuadVerticies.TopLeft */].y =
|
|
152
150
|
vertexValue.vertices[FlowVerticies.NorthEast];
|
|
153
151
|
}
|
|
154
152
|
else if (reverseHeight) {
|
|
155
|
-
quad.positions.vertices[QuadVerticies.TopRight].y = 1;
|
|
156
|
-
quad.positions.vertices[QuadVerticies.TopLeft].y = 1;
|
|
157
|
-
quad.positions.vertices[QuadVerticies.BottomRight].y = currentHeight;
|
|
158
|
-
quad.positions.vertices[QuadVerticies.BottomLeft].y = currentHeight;
|
|
159
|
-
quad.uvs.vertices[QuadVerticies.BottomRight].y = currentHeight;
|
|
160
|
-
quad.uvs.vertices[QuadVerticies.BottomLeft].y = currentHeight;
|
|
153
|
+
quad.positions.vertices[0 /* QuadVerticies.TopRight */].y = 1;
|
|
154
|
+
quad.positions.vertices[1 /* QuadVerticies.TopLeft */].y = 1;
|
|
155
|
+
quad.positions.vertices[3 /* QuadVerticies.BottomRight */].y = currentHeight;
|
|
156
|
+
quad.positions.vertices[2 /* QuadVerticies.BottomLeft */].y = currentHeight;
|
|
157
|
+
quad.uvs.vertices[3 /* QuadVerticies.BottomRight */].y = currentHeight;
|
|
158
|
+
quad.uvs.vertices[2 /* QuadVerticies.BottomLeft */].y = currentHeight;
|
|
161
159
|
}
|
|
162
160
|
else {
|
|
163
|
-
quad.positions.vertices[QuadVerticies.TopRight].y = 1;
|
|
164
|
-
quad.positions.vertices[QuadVerticies.TopLeft].y = 1;
|
|
165
|
-
quad.positions.vertices[QuadVerticies.BottomLeft].y = 0;
|
|
166
|
-
quad.positions.vertices[QuadVerticies.BottomRight].y = 0;
|
|
161
|
+
quad.positions.vertices[0 /* QuadVerticies.TopRight */].y = 1;
|
|
162
|
+
quad.positions.vertices[1 /* QuadVerticies.TopLeft */].y = 1;
|
|
163
|
+
quad.positions.vertices[2 /* QuadVerticies.BottomLeft */].y = 0;
|
|
164
|
+
quad.positions.vertices[3 /* QuadVerticies.BottomRight */].y = 0;
|
|
167
165
|
quad.setUVs(uvs);
|
|
168
166
|
}
|
|
169
|
-
GetTexture(builder, flowTexture, VoxelFaces.North
|
|
167
|
+
GetTexture(builder, flowTexture, 2 /* VoxelFaces.North */, quad);
|
|
170
168
|
addVoxelQuad(builder, quad);
|
|
171
169
|
builder.updateBounds(quad.bounds);
|
|
172
170
|
}
|
|
173
|
-
if (this.isExposed(VoxelFaces.South)) {
|
|
171
|
+
if (this.isExposed(3 /* VoxelFaces.South */, voxelId)) {
|
|
174
172
|
added = true;
|
|
175
|
-
const quad = Quads[VoxelFaces.South];
|
|
173
|
+
const quad = Quads[3 /* VoxelFaces.South */];
|
|
176
174
|
builder.vars.animation.setAll(1);
|
|
177
|
-
this.determineShading(VoxelFaces.South);
|
|
175
|
+
this.determineShading(3 /* VoxelFaces.South */);
|
|
178
176
|
if (upFaceExposed) {
|
|
179
|
-
quad.positions.vertices[QuadVerticies.TopRight].y =
|
|
177
|
+
quad.positions.vertices[0 /* QuadVerticies.TopRight */].y =
|
|
180
178
|
vertexValue.vertices[FlowVerticies.SouthEsat] * waterHeight;
|
|
181
|
-
quad.positions.vertices[QuadVerticies.TopLeft].y =
|
|
179
|
+
quad.positions.vertices[1 /* QuadVerticies.TopLeft */].y =
|
|
182
180
|
vertexValue.vertices[FlowVerticies.SouthWest] * waterHeight;
|
|
183
|
-
quad.positions.vertices[QuadVerticies.BottomLeft].y = 0;
|
|
184
|
-
quad.positions.vertices[QuadVerticies.BottomRight].y = 0;
|
|
185
|
-
quad.uvs.vertices[QuadVerticies.TopRight].y =
|
|
181
|
+
quad.positions.vertices[2 /* QuadVerticies.BottomLeft */].y = 0;
|
|
182
|
+
quad.positions.vertices[3 /* QuadVerticies.BottomRight */].y = 0;
|
|
183
|
+
quad.uvs.vertices[0 /* QuadVerticies.TopRight */].y =
|
|
186
184
|
vertexValue.vertices[FlowVerticies.SouthEsat];
|
|
187
|
-
quad.uvs.vertices[QuadVerticies.TopLeft].y =
|
|
185
|
+
quad.uvs.vertices[1 /* QuadVerticies.TopLeft */].y =
|
|
188
186
|
vertexValue.vertices[FlowVerticies.SouthWest];
|
|
189
187
|
}
|
|
190
188
|
else if (reverseHeight) {
|
|
191
|
-
quad.positions.vertices[QuadVerticies.TopRight].y = 1;
|
|
192
|
-
quad.positions.vertices[QuadVerticies.TopLeft].y = 1;
|
|
193
|
-
quad.positions.vertices[QuadVerticies.BottomRight].y = currentHeight;
|
|
194
|
-
quad.positions.vertices[QuadVerticies.BottomLeft].y = currentHeight;
|
|
195
|
-
quad.uvs.vertices[QuadVerticies.BottomRight].y = currentHeight;
|
|
196
|
-
quad.uvs.vertices[QuadVerticies.BottomLeft].y = currentHeight;
|
|
189
|
+
quad.positions.vertices[0 /* QuadVerticies.TopRight */].y = 1;
|
|
190
|
+
quad.positions.vertices[1 /* QuadVerticies.TopLeft */].y = 1;
|
|
191
|
+
quad.positions.vertices[3 /* QuadVerticies.BottomRight */].y = currentHeight;
|
|
192
|
+
quad.positions.vertices[2 /* QuadVerticies.BottomLeft */].y = currentHeight;
|
|
193
|
+
quad.uvs.vertices[3 /* QuadVerticies.BottomRight */].y = currentHeight;
|
|
194
|
+
quad.uvs.vertices[2 /* QuadVerticies.BottomLeft */].y = currentHeight;
|
|
197
195
|
}
|
|
198
196
|
else {
|
|
199
|
-
quad.positions.vertices[QuadVerticies.TopLeft].y = 1;
|
|
200
|
-
quad.positions.vertices[QuadVerticies.TopRight].y = 1;
|
|
201
|
-
quad.positions.vertices[QuadVerticies.BottomLeft].y = 0;
|
|
202
|
-
quad.positions.vertices[QuadVerticies.BottomRight].y = 0;
|
|
197
|
+
quad.positions.vertices[1 /* QuadVerticies.TopLeft */].y = 1;
|
|
198
|
+
quad.positions.vertices[0 /* QuadVerticies.TopRight */].y = 1;
|
|
199
|
+
quad.positions.vertices[2 /* QuadVerticies.BottomLeft */].y = 0;
|
|
200
|
+
quad.positions.vertices[3 /* QuadVerticies.BottomRight */].y = 0;
|
|
203
201
|
quad.setUVs(uvs);
|
|
204
202
|
}
|
|
205
|
-
GetTexture(builder, flowTexture, VoxelFaces.Up
|
|
203
|
+
GetTexture(builder, flowTexture, 0 /* VoxelFaces.Up */, quad);
|
|
206
204
|
addVoxelQuad(builder, quad);
|
|
207
205
|
builder.updateBounds(quad.bounds);
|
|
208
206
|
}
|
|
209
|
-
if (this.isExposed(VoxelFaces.East)) {
|
|
207
|
+
if (this.isExposed(4 /* VoxelFaces.East */, voxelId)) {
|
|
210
208
|
added = true;
|
|
211
|
-
const quad = Quads[VoxelFaces.East];
|
|
209
|
+
const quad = Quads[4 /* VoxelFaces.East */];
|
|
212
210
|
builder.vars.animation.setAll(1);
|
|
213
|
-
this.determineShading(VoxelFaces.East);
|
|
211
|
+
this.determineShading(4 /* VoxelFaces.East */);
|
|
214
212
|
if (upFaceExposed) {
|
|
215
|
-
quad.positions.vertices[QuadVerticies.TopRight].y =
|
|
213
|
+
quad.positions.vertices[0 /* QuadVerticies.TopRight */].y =
|
|
216
214
|
vertexValue.vertices[FlowVerticies.NorthEast] * waterHeight;
|
|
217
|
-
quad.positions.vertices[QuadVerticies.TopLeft].y =
|
|
215
|
+
quad.positions.vertices[1 /* QuadVerticies.TopLeft */].y =
|
|
218
216
|
vertexValue.vertices[FlowVerticies.SouthEsat] * waterHeight;
|
|
219
|
-
quad.positions.vertices[QuadVerticies.BottomLeft].y = 0;
|
|
220
|
-
quad.positions.vertices[QuadVerticies.BottomRight].y = 0;
|
|
221
|
-
quad.uvs.vertices[QuadVerticies.TopRight].y =
|
|
217
|
+
quad.positions.vertices[2 /* QuadVerticies.BottomLeft */].y = 0;
|
|
218
|
+
quad.positions.vertices[3 /* QuadVerticies.BottomRight */].y = 0;
|
|
219
|
+
quad.uvs.vertices[0 /* QuadVerticies.TopRight */].y =
|
|
222
220
|
vertexValue.vertices[FlowVerticies.SouthEsat];
|
|
223
|
-
quad.uvs.vertices[QuadVerticies.TopLeft].y =
|
|
221
|
+
quad.uvs.vertices[1 /* QuadVerticies.TopLeft */].y =
|
|
224
222
|
vertexValue.vertices[FlowVerticies.NorthEast];
|
|
225
223
|
}
|
|
226
224
|
else if (reverseHeight) {
|
|
227
|
-
quad.positions.vertices[QuadVerticies.TopRight].y = 1;
|
|
228
|
-
quad.positions.vertices[QuadVerticies.TopLeft].y = 1;
|
|
229
|
-
quad.positions.vertices[QuadVerticies.BottomRight].y = currentHeight;
|
|
230
|
-
quad.positions.vertices[QuadVerticies.BottomLeft].y = currentHeight;
|
|
231
|
-
quad.uvs.vertices[QuadVerticies.BottomRight].y = currentHeight;
|
|
232
|
-
quad.uvs.vertices[QuadVerticies.BottomLeft].y = currentHeight;
|
|
225
|
+
quad.positions.vertices[0 /* QuadVerticies.TopRight */].y = 1;
|
|
226
|
+
quad.positions.vertices[1 /* QuadVerticies.TopLeft */].y = 1;
|
|
227
|
+
quad.positions.vertices[3 /* QuadVerticies.BottomRight */].y = currentHeight;
|
|
228
|
+
quad.positions.vertices[2 /* QuadVerticies.BottomLeft */].y = currentHeight;
|
|
229
|
+
quad.uvs.vertices[3 /* QuadVerticies.BottomRight */].y = currentHeight;
|
|
230
|
+
quad.uvs.vertices[2 /* QuadVerticies.BottomLeft */].y = currentHeight;
|
|
233
231
|
}
|
|
234
232
|
else {
|
|
235
|
-
quad.positions.vertices[QuadVerticies.TopLeft].y = 1;
|
|
236
|
-
quad.positions.vertices[QuadVerticies.TopRight].y = 1;
|
|
237
|
-
quad.positions.vertices[QuadVerticies.BottomLeft].y = 0;
|
|
238
|
-
quad.positions.vertices[QuadVerticies.BottomRight].y = 0;
|
|
233
|
+
quad.positions.vertices[1 /* QuadVerticies.TopLeft */].y = 1;
|
|
234
|
+
quad.positions.vertices[0 /* QuadVerticies.TopRight */].y = 1;
|
|
235
|
+
quad.positions.vertices[2 /* QuadVerticies.BottomLeft */].y = 0;
|
|
236
|
+
quad.positions.vertices[3 /* QuadVerticies.BottomRight */].y = 0;
|
|
239
237
|
quad.setUVs(uvs);
|
|
240
238
|
}
|
|
241
|
-
GetTexture(builder, flowTexture, VoxelFaces.Up
|
|
239
|
+
GetTexture(builder, flowTexture, 0 /* VoxelFaces.Up */, quad);
|
|
242
240
|
addVoxelQuad(builder, quad);
|
|
243
241
|
builder.updateBounds(quad.bounds);
|
|
244
242
|
}
|
|
245
|
-
if (this.isExposed(VoxelFaces.West)) {
|
|
243
|
+
if (this.isExposed(5 /* VoxelFaces.West */, voxelId)) {
|
|
246
244
|
added = true;
|
|
247
|
-
const quad = Quads[VoxelFaces.West];
|
|
245
|
+
const quad = Quads[5 /* VoxelFaces.West */];
|
|
248
246
|
builder.vars.animation.setAll(1);
|
|
249
|
-
this.determineShading(VoxelFaces.West);
|
|
247
|
+
this.determineShading(5 /* VoxelFaces.West */);
|
|
250
248
|
if (upFaceExposed) {
|
|
251
|
-
quad.positions.vertices[QuadVerticies.TopRight].y =
|
|
249
|
+
quad.positions.vertices[0 /* QuadVerticies.TopRight */].y =
|
|
252
250
|
vertexValue.vertices[FlowVerticies.SouthWest] * waterHeight;
|
|
253
|
-
quad.positions.vertices[QuadVerticies.TopLeft].y =
|
|
251
|
+
quad.positions.vertices[1 /* QuadVerticies.TopLeft */].y =
|
|
254
252
|
vertexValue.vertices[FlowVerticies.NorthWest] * waterHeight;
|
|
255
|
-
quad.positions.vertices[QuadVerticies.BottomLeft].y = 0;
|
|
256
|
-
quad.positions.vertices[QuadVerticies.BottomRight].y = 0;
|
|
257
|
-
quad.uvs.vertices[QuadVerticies.TopRight].y =
|
|
253
|
+
quad.positions.vertices[2 /* QuadVerticies.BottomLeft */].y = 0;
|
|
254
|
+
quad.positions.vertices[3 /* QuadVerticies.BottomRight */].y = 0;
|
|
255
|
+
quad.uvs.vertices[0 /* QuadVerticies.TopRight */].y =
|
|
258
256
|
vertexValue.vertices[FlowVerticies.SouthWest];
|
|
259
|
-
quad.uvs.vertices[QuadVerticies.TopLeft].y =
|
|
257
|
+
quad.uvs.vertices[1 /* QuadVerticies.TopLeft */].y =
|
|
260
258
|
vertexValue.vertices[FlowVerticies.NorthWest];
|
|
261
259
|
}
|
|
262
260
|
else if (reverseHeight) {
|
|
263
|
-
quad.positions.vertices[QuadVerticies.TopRight].y = 1;
|
|
264
|
-
quad.positions.vertices[QuadVerticies.TopLeft].y = 1;
|
|
265
|
-
quad.positions.vertices[QuadVerticies.BottomRight].y = currentHeight;
|
|
266
|
-
quad.positions.vertices[QuadVerticies.BottomLeft].y = currentHeight;
|
|
267
|
-
quad.uvs.vertices[QuadVerticies.BottomRight].y = currentHeight;
|
|
268
|
-
quad.uvs.vertices[QuadVerticies.BottomLeft].y = currentHeight;
|
|
261
|
+
quad.positions.vertices[0 /* QuadVerticies.TopRight */].y = 1;
|
|
262
|
+
quad.positions.vertices[1 /* QuadVerticies.TopLeft */].y = 1;
|
|
263
|
+
quad.positions.vertices[3 /* QuadVerticies.BottomRight */].y = currentHeight;
|
|
264
|
+
quad.positions.vertices[2 /* QuadVerticies.BottomLeft */].y = currentHeight;
|
|
265
|
+
quad.uvs.vertices[3 /* QuadVerticies.BottomRight */].y = currentHeight;
|
|
266
|
+
quad.uvs.vertices[2 /* QuadVerticies.BottomLeft */].y = currentHeight;
|
|
269
267
|
}
|
|
270
268
|
else {
|
|
271
|
-
quad.positions.vertices[QuadVerticies.TopLeft].y = 1;
|
|
272
|
-
quad.positions.vertices[QuadVerticies.TopRight].y = 1;
|
|
273
|
-
quad.positions.vertices[QuadVerticies.BottomLeft].y = 0;
|
|
274
|
-
quad.positions.vertices[QuadVerticies.BottomRight].y = 0;
|
|
269
|
+
quad.positions.vertices[1 /* QuadVerticies.TopLeft */].y = 1;
|
|
270
|
+
quad.positions.vertices[0 /* QuadVerticies.TopRight */].y = 1;
|
|
271
|
+
quad.positions.vertices[2 /* QuadVerticies.BottomLeft */].y = 0;
|
|
272
|
+
quad.positions.vertices[3 /* QuadVerticies.BottomRight */].y = 0;
|
|
275
273
|
quad.setUVs(uvs);
|
|
276
274
|
}
|
|
277
|
-
GetTexture(builder, flowTexture, VoxelFaces.Up
|
|
275
|
+
GetTexture(builder, flowTexture, 0 /* VoxelFaces.Up */, quad);
|
|
278
276
|
addVoxelQuad(builder, quad);
|
|
279
277
|
builder.updateBounds(quad.bounds);
|
|
280
278
|
}
|
|
@@ -22,14 +22,14 @@ export class QuadVoxelGometryNode extends GeoemtryNode {
|
|
|
22
22
|
add(args) {
|
|
23
23
|
if (!args[ArgIndexes.Enabled])
|
|
24
24
|
return false;
|
|
25
|
+
const builder = this.builder;
|
|
25
26
|
if (this.trueFaceIndex !== undefined &&
|
|
26
|
-
!CullRulledFace(
|
|
27
|
+
!CullRulledFace(builder, this.trueFaceIndex))
|
|
27
28
|
return false;
|
|
28
|
-
const builder = this.builder;
|
|
29
29
|
builder.calculateFaceData(this.closestFace);
|
|
30
30
|
this.trueFaceIndex !== undefined
|
|
31
|
-
? ShadeRulledFace(
|
|
32
|
-
: ShadeRulelessFace(
|
|
31
|
+
? ShadeRulledFace(builder, this.trueFaceIndex, builder.lightData[this.closestFace], this.vertexWeights, 4)
|
|
32
|
+
: ShadeRulelessFace(builder, builder.lightData[this.closestFace], this.vertexWeights, 4);
|
|
33
33
|
const quad = this.quad;
|
|
34
34
|
quad.doubleSided = args[ArgIndexes.DoubleSided];
|
|
35
35
|
const uvs = args[ArgIndexes.UVs];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { QuadVoxelGometryNode } from "./Default/QuadVoxelGeometryNode";
|
|
2
2
|
import { TriangleVoxelGeometryNode } from "./Default/TriangleVoxelGeometryNode";
|
|
3
|
-
import {
|
|
3
|
+
import { VoxelGeometryConstructorRegister } from "../VoxelGeometryConstructorRegister";
|
|
4
4
|
import { GeometryLUT } from "../../../../Voxels/Data/GeometryLUT";
|
|
5
5
|
export class VoxelGeometryConstructor {
|
|
6
6
|
geometryPaletteId;
|
|
@@ -13,7 +13,7 @@ export class VoxelGeometryConstructor {
|
|
|
13
13
|
const nodes = GeometryLUT.compiledGeometry[geometryPaletteId];
|
|
14
14
|
for (const node of nodes) {
|
|
15
15
|
if (node.type == "custom") {
|
|
16
|
-
const nodeClass =
|
|
16
|
+
const nodeClass = VoxelGeometryConstructorRegister.getCustomNode(node.id);
|
|
17
17
|
const newNode = new nodeClass(geometryPaletteId, this, node);
|
|
18
18
|
newNode.init();
|
|
19
19
|
this.nodes.push(newNode);
|