@adatechnology/game-floorplan-three 0.3.1 → 0.4.0
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/README.md +13 -0
- package/dist/index.d.ts +34 -1
- package/dist/index.global.js +1070 -14
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +66 -3
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1852,8 +1852,8 @@ function installRoofGutters(K, shared) {
|
|
|
1852
1852
|
t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t;
|
|
1853
1853
|
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
1854
1854
|
};
|
|
1855
|
-
const
|
|
1856
|
-
void
|
|
1855
|
+
const draw2 = rnd() < p, light = rnd() < 0.6;
|
|
1856
|
+
void draw2;
|
|
1857
1857
|
const on = true;
|
|
1858
1858
|
return { on, rnd, color: high ? 3816770 : light ? 15527921 : 10857392, bad: (shared.ctx.colors.meta && shared.ctx.colors.meta.state) === "abandoned" || R.state === "abandoned", fallback: false };
|
|
1859
1859
|
}
|
|
@@ -8769,6 +8769,67 @@ function tapSpec(THREE, opts = {}) {
|
|
|
8769
8769
|
K.PARTS.length = before;
|
|
8770
8770
|
return { spec: made.spec, build: made.build, spout: [water.pos[0] - root.x, water.pos[1], water.pos[2] - root.z] };
|
|
8771
8771
|
}
|
|
8772
|
+
|
|
8773
|
+
// src/wall.ts
|
|
8774
|
+
import { buildStructure, masonryConstruction } from "@adatechnology/game-floorplan-structure";
|
|
8775
|
+
var PLASTER = 15262420;
|
|
8776
|
+
var WALL_ID = "wall_0_0";
|
|
8777
|
+
function wallPlan(options) {
|
|
8778
|
+
const { w, h, thickness = 0.15, finish = "plaster", color = PLASTER } = options;
|
|
8779
|
+
const facade = { finish, roof: "none", floors: 1 };
|
|
8780
|
+
const wall = { id: WALL_ID, floor: 0, axis: "u", u0: -w / 2, v0: 0, u1: w / 2, v1: 0, thickness, sides: ["outside", "outside"], exterior: true, type: "wall", h };
|
|
8781
|
+
const plan = {
|
|
8782
|
+
template: "wall",
|
|
8783
|
+
name: "wall",
|
|
8784
|
+
style: "mid",
|
|
8785
|
+
state: "normal",
|
|
8786
|
+
w,
|
|
8787
|
+
d: thickness,
|
|
8788
|
+
floors: [{ index: 0, y0: 0, ceiling: h }],
|
|
8789
|
+
rooms: [],
|
|
8790
|
+
walls: [wall],
|
|
8791
|
+
doors: [],
|
|
8792
|
+
windows: [],
|
|
8793
|
+
items: [],
|
|
8794
|
+
stateItems: [],
|
|
8795
|
+
openPairs: [],
|
|
8796
|
+
partyWalls: [],
|
|
8797
|
+
missing: [],
|
|
8798
|
+
facade,
|
|
8799
|
+
colors: { facade: color, wall: color },
|
|
8800
|
+
lot: null,
|
|
8801
|
+
building: null,
|
|
8802
|
+
waterTank: null,
|
|
8803
|
+
outbuildings: []
|
|
8804
|
+
};
|
|
8805
|
+
plan.construction = masonryConstruction({ ...plan, facade: { ...facade, roof: "colonial" } });
|
|
8806
|
+
plan.structure = buildStructure(plan, { wallDetail: "coarse", construction: plan.construction, roof: false });
|
|
8807
|
+
return plan;
|
|
8808
|
+
}
|
|
8809
|
+
function draw(THREE, plan, options) {
|
|
8810
|
+
return create(THREE, { ...options, fleet: null }).build(plan, { quality: "game", terrain: false, noPerimeter: true, pieces: "meshes" });
|
|
8811
|
+
}
|
|
8812
|
+
function label(house) {
|
|
8813
|
+
for (const [id, items] of Object.entries(house.destruction.ranges())) {
|
|
8814
|
+
for (const item of items) {
|
|
8815
|
+
const object = item.isObject3D ? item : item.mesh;
|
|
8816
|
+
object.userData.destructionPart = id;
|
|
8817
|
+
}
|
|
8818
|
+
}
|
|
8819
|
+
return house.group;
|
|
8820
|
+
}
|
|
8821
|
+
function wallPiece(THREE, options) {
|
|
8822
|
+
const plan = wallPlan(options);
|
|
8823
|
+
const houseOptions = options.house ?? {};
|
|
8824
|
+
const probe = draw(THREE, plan, { ...houseOptions, destruction: void 0, destructionRenderer: void 0 });
|
|
8825
|
+
const spec = probe.structure.spec({ wallDetail: "coarse" });
|
|
8826
|
+
probe.dispose();
|
|
8827
|
+
return {
|
|
8828
|
+
plan,
|
|
8829
|
+
spec,
|
|
8830
|
+
build: (T) => label(draw(T, plan, houseOptions))
|
|
8831
|
+
};
|
|
8832
|
+
}
|
|
8772
8833
|
export {
|
|
8773
8834
|
DEFAULT_SPECIMENS,
|
|
8774
8835
|
FLOORPLAN_AREA_ID,
|
|
@@ -8792,6 +8853,8 @@ export {
|
|
|
8792
8853
|
ptBR,
|
|
8793
8854
|
rectsOf,
|
|
8794
8855
|
specimenSpec,
|
|
8795
|
-
tapSpec
|
|
8856
|
+
tapSpec,
|
|
8857
|
+
wallPiece,
|
|
8858
|
+
wallPlan
|
|
8796
8859
|
};
|
|
8797
8860
|
//# sourceMappingURL=index.js.map
|