@drawcall/charta 0.1.13 → 0.1.15

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.
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/assets/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,cAAc,EAAqB,MAAM,EAAW,MAAM,OAAO,CAAA;AAEzG,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAU/C,qBAAa,WAAY,SAAQ,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC;IAIlB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAH3D,OAAO,CAAC,aAAa,CAAe;IACpC,OAAO,CAAC,UAAU,CAAY;gBAElB,OAAO,CAAC,EAAE,cAAc,EAAmB,IAAI,GAAE,OAAe;IAM5E,IAAI,CACF,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,EAC5B,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,EAC3C,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,GAC/B,IAAI;YAuBO,iBAAiB;YA8BjB,eAAe;CAuC9B"}
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/assets/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,cAAc,EAAqB,MAAM,EAAW,MAAM,OAAO,CAAA;AAEzG,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAM/C,qBAAa,WAAY,SAAQ,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC;IAIlB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAH3D,OAAO,CAAC,aAAa,CAAe;IACpC,OAAO,CAAC,UAAU,CAAY;gBAElB,OAAO,CAAC,EAAE,cAAc,EAAmB,IAAI,GAAE,OAAe;IAM5E,IAAI,CACF,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,EAC5B,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,EAC3C,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,GAC/B,IAAI;YAuBO,iBAAiB;YA8BjB,eAAe;CAuC9B"}
@@ -2,12 +2,8 @@ import { Texture, TextureLoader, Object3D, Loader, Vector3 } from 'three';
2
2
  import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
3
3
  import { ChartaError } from '../errors.js';
4
4
  import { InstancedMeshGroup } from '../utils/instanced-mesh-group.js';
5
- import { object, string } from 'zod';
6
5
  import { measureObject, PrefabBatchBuilder } from '../place/index.js';
7
- // Schemas
8
- const basePathSchema = object({ path: string() });
9
- const loadTextureSchema = object({ name: string(), path: string() });
10
- const loadModelSchema = object({ name: string(), path: string() });
6
+ import { basePathSchema, loadTextureSchema, loadModelSchema } from '../schemas.js';
11
7
  export class AssetLoader extends Loader {
12
8
  mock;
13
9
  textureLoader;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/grass/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,aAAa,EACb,QAAQ,EAMT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAsB,KAAK,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAY9E,MAAM,MAAM,YAAY,GAAG,oBAAoB,GAAG;IAChD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,qBAAa,SAAU,SAAQ,aAAa;gBAExC,WAAW,EAAE,WAAW,EACxB,QAAQ,GAAE,QAAkC,EAC5C,IAAI,GAAE,YAAiB;CAoP1B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/grass/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,aAAa,EACb,QAAQ,EAMT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAsB,KAAK,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAO9E,MAAM,MAAM,YAAY,GAAG,oBAAoB,GAAG;IAChD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,qBAAa,SAAU,SAAQ,aAAa;gBAExC,WAAW,EAAE,WAAW,EACxB,QAAQ,GAAE,QAAkC,EAC5C,IAAI,GAAE,YAAiB;CAoP1B"}
@@ -1,12 +1,7 @@
1
1
  import { Color, DoubleSide, InstancedMesh, Matrix4, MeshPhongMaterial, PlaneGeometry, Quaternion, Vector3, } from "three";
2
- import { coerce, object, string } from "zod";
3
2
  import { buildGrassMaterial } from "./material.js";
4
3
  import { TilesGeometry } from "../tiles/geometry.js";
5
- const grassSchema = object({
6
- color: string().optional(),
7
- height: coerce.number().optional(),
8
- density: coerce.number().optional(),
9
- });
4
+ import { grassSchema } from "../schemas.js";
10
5
  const UpVector = new Vector3(0, 1, 0);
11
6
  const colorHelper = new Color();
12
7
  export class GrassMesh extends InstancedMesh {
@@ -1,9 +1,8 @@
1
- import { coerce, output, ZodObject } from 'zod';
1
+ import { output, ZodObject } from 'zod';
2
2
  import { Call } from './parser.js';
3
3
  import { ChartaError, ErrorLocation } from './errors.js';
4
- export declare const cellSizeFunctionParams: ZodObject<{
5
- size: coerce.ZodCoercedNumber<unknown>;
6
- }, import("zod/v4/core").$strip>;
4
+ import { cellSizeSchema } from './schemas.js';
5
+ export { cellSizeSchema as cellSizeFunctionParams };
7
6
  export type InterpreterOptions = {
8
7
  throwOnError?: boolean;
9
8
  };
@@ -1 +1 @@
1
- {"version":3,"file":"interpreter.d.ts","sourceRoot":"","sources":["../src/interpreter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,EAAE,SAAS,EAAa,MAAM,KAAK,CAAA;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAExD,eAAO,MAAM,sBAAsB;;gCAAoC,CAAA;AAEvE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,CAAA;AAED,qBAAa,WAAW;IAKpB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IANzB,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,YAAY,CAAS;gBAGV,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,EACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,YAAK,EAChC,MAAM,EAAE,MAAM,EAC/B,OAAO,GAAE,kBAAuB;IAelC,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IAOrC,SAAS,IAAI,WAAW,EAAE;IAI1B,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAQ;IACzC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAU;IAEtC,SAAS,IAAI,MAAM;IAInB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAMtC,kBA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MAAM;CAStB"}
@@ -1,6 +1,6 @@
1
- import { coerce, object } from 'zod';
2
1
  import { ChartaError } from './errors.js';
3
- export const cellSizeFunctionParams = object({ size: coerce.number() });
2
+ import { cellSizeSchema } from './schemas.js';
3
+ export { cellSizeSchema as cellSizeFunctionParams };
4
4
  export class Interpreter {
5
5
  ast;
6
6
  assets;
@@ -217,7 +217,7 @@ export class Interpreter {
217
217
  getCellSize() {
218
218
  let cellSize = 1;
219
219
  for (const [, { size }] of this.getCalls(undefined, {
220
- cellSize: cellSizeFunctionParams,
220
+ cellSize: cellSizeSchema,
221
221
  })) {
222
222
  cellSize = size;
223
223
  }
@@ -1,16 +1,10 @@
1
1
  import { Interpreter } from './interpreter.js';
2
2
  import { Vector3 } from 'three';
3
+ import { locationSchema } from './schemas.js';
4
+ export { locationSchema };
3
5
  export declare class Locations {
4
- private readonly interpreter;
5
- private readonly nameToCell;
6
+ readonly worldPositions: Map<string, Vector3>;
6
7
  constructor(interpreter: Interpreter);
7
- /**
8
- * Resolve a named location to a world-space position (x, y, z).
9
- * - X/Z are the center of the owning cell.
10
- * - Y is sampled from the nearest relevant layer stack at that cell.
11
- *
12
- * If terrain data is unavailable, Y defaults to 0.
13
- */
14
8
  getWorldPosition(name: string, target: Vector3): Vector3;
15
9
  }
16
10
  //# sourceMappingURL=locations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"locations.d.ts","sourceRoot":"","sources":["../src/locations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAG9C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAI/B,qBAAa,SAAS;IAGR,OAAO,CAAC,QAAQ,CAAC,WAAW;IAFxC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkC;gBAEhC,WAAW,EAAE,WAAW;IAsBrD;;;;;;OAMG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO;CAwBzD"}
1
+ {"version":3,"file":"locations.d.ts","sourceRoot":"","sources":["../src/locations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAG9C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C,OAAO,EAAE,cAAc,EAAE,CAAA;AAEzB,qBAAa,SAAS;IACpB,SAAgB,cAAc,uBAA6B;gBAE/C,WAAW,EAAE,WAAW;IAgCpC,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO;CAOzD"}
package/dist/locations.js CHANGED
@@ -1,58 +1,42 @@
1
- import { object, string } from 'zod';
2
1
  import { TilesGeometry } from './tiles/geometry.js';
3
2
  import { ChartaError } from './errors.js';
3
+ import { Vector3 } from 'three';
4
+ import { locationSchema } from './schemas.js';
5
+ export { locationSchema };
4
6
  export class Locations {
5
- interpreter;
6
- nameToCell = new Map();
7
+ worldPositions = new Map();
7
8
  constructor(interpreter) {
8
- this.interpreter = interpreter;
9
9
  const rows = interpreter.getRows();
10
10
  const cols = interpreter.getCols();
11
- const locationSchema = object({ name: string() });
11
+ const tilesGeometry = interpreter.getAsset(TilesGeometry, 'tilesGeometry');
12
+ const isLayer = (c) => c.name === 'ground' || c.name === 'ceiling';
12
13
  for (let row = 0; row < rows; row++) {
13
14
  for (let col = 0; col < cols; col++) {
14
- const entries = interpreter.getCalls([row, col], {
15
- location: locationSchema,
16
- });
15
+ const entries = interpreter.getCalls([row, col], { location: locationSchema });
17
16
  for (const [, parsed, callIdx, loc] of entries) {
18
17
  const name = parsed.name;
19
- if (this.nameToCell.has(name)) {
18
+ if (this.worldPositions.has(name)) {
20
19
  interpreter.reportError(new ChartaError(`duplicate location "${name}"`, interpreter.getSource(), loc));
21
20
  continue;
22
21
  }
23
- this.nameToCell.set(name, { row, col, callIdx });
22
+ const offsetX = parsed.offsetX ?? 0;
23
+ const offsetZ = parsed.offsetZ ?? 0;
24
+ const [cx, cz] = interpreter.getWorldCellCenter(row, col);
25
+ const x = cx + offsetX;
26
+ const z = cz + offsetZ;
27
+ const layersBefore = interpreter.countCalls([row, col], isLayer, 0, callIdx);
28
+ const stackIndex = layersBefore > 0 ? layersBefore - 1 : 0;
29
+ const y = tilesGeometry?.getHeight(row, col, stackIndex, offsetX, offsetZ) ?? 0;
30
+ this.worldPositions.set(name, new Vector3(x, y, z));
24
31
  }
25
32
  }
26
33
  }
27
34
  }
28
- /**
29
- * Resolve a named location to a world-space position (x, y, z).
30
- * - X/Z are the center of the owning cell.
31
- * - Y is sampled from the nearest relevant layer stack at that cell.
32
- *
33
- * If terrain data is unavailable, Y defaults to 0.
34
- */
35
35
  getWorldPosition(name, target) {
36
- const cellLoc = this.nameToCell.get(name);
37
- if (!cellLoc) {
36
+ const pos = this.worldPositions.get(name);
37
+ if (!pos) {
38
38
  throw new Error(`Unknown location "${name}".`);
39
39
  }
40
- const { row, col, callIdx } = cellLoc;
41
- const [x, z] = this.interpreter.getWorldCellCenter(row, col);
42
- // Determine the stack index similarly to how walls/pillars derive defaults.
43
- const isLayer = (c) => c.name === 'ground' || c.name === 'ceiling';
44
- const layersBefore = this.interpreter.countCalls([row, col], isLayer, 0, callIdx);
45
- let stackIndex;
46
- if (layersBefore > 0) {
47
- stackIndex = layersBefore - 1;
48
- }
49
- else {
50
- const layersAfter = this.interpreter.countCalls([row, col], isLayer, callIdx + 1);
51
- stackIndex = layersAfter > 0 ? 0 : 0;
52
- }
53
- const tilesGeometry = this.interpreter.getAsset(TilesGeometry, 'tilesGeometry');
54
- const y = tilesGeometry?.getHeight(row, col, stackIndex, 0, 0) ?? 0;
55
- target.set(x, y, z);
56
- return target;
40
+ return target.copy(pos);
57
41
  }
58
42
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pillars/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EAEb,QAAQ,EAMT,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAO/C,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,UAAU,GAAG,aAAa,GAAG,YAAY,CAAA;AAuBhF,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,qBAAa,UAAW,SAAQ,aAAa;gBAC/B,WAAW,EAAE,WAAW,EAAE,QAAQ,GAAE,QAAkC,EAAE,OAAO,GAAE,iBAAsB;CAoLpH"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pillars/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EAEb,QAAQ,EAMT,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAO/C,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,UAAU,GAAG,aAAa,GAAG,YAAY,CAAA;AAYhF,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,qBAAa,UAAW,SAAQ,aAAa;gBAC/B,WAAW,EAAE,WAAW,EAAE,QAAQ,GAAE,QAAkC,EAAE,OAAO,GAAE,iBAAsB;CAoLpH"}
@@ -1,18 +1,9 @@
1
1
  import { BoxGeometry, InstancedMesh, InstancedBufferAttribute, Matrix4, MeshBasicMaterial, Quaternion, Vector3, Texture, } from 'three';
2
2
  import { TilesGeometry } from '../tiles/geometry.js';
3
- import { coerce, object, string, z } from 'zod';
4
3
  import { buildTextureArrayFromAssets } from '../utils/texture.js';
5
4
  import { buildPillarMeshMaterial } from './material.js';
6
5
  import { ChartaError } from '../errors.js';
7
- const cornerEnum = z.enum(['topleft', 'topright', 'bottomright', 'bottomleft']);
8
- const pillarSchema = object({
9
- corner: cornerEnum, // positional 0
10
- texture: string(), // positional 1
11
- sizeX: coerce.number().optional(),
12
- sizeZ: coerce.number().optional(),
13
- bottomY: coerce.number().optional(),
14
- topY: coerce.number().optional(),
15
- });
6
+ import { pillarSchema } from '../schemas.js';
16
7
  export class PillarMesh extends InstancedMesh {
17
8
  constructor(interpreter, material = new MeshBasicMaterial(), options = {}) {
18
9
  const rows = interpreter.getRows();
@@ -17,17 +17,22 @@ export declare function measureObject(object: Object3D): Vector3;
17
17
  export declare class PrefabBatchBuilder {
18
18
  readonly prefabSize: Vector3;
19
19
  private readonly buildFromMatrices;
20
- private matrices;
20
+ readonly matrices: Array<Matrix4>;
21
21
  constructor(prefabSize: Vector3, buildFromMatrices: (matrices: Array<Matrix4>) => Object3D);
22
22
  add(matrix: Matrix4): this;
23
23
  build(): Object3D;
24
24
  }
25
25
  export type PlaceGroupOptions = {
26
26
  /**
27
- * Mock mode: validates scatter/place calls exist but skips expensive instance generation.
28
- * Useful for server-side validation. Default: false.
27
+ * Mock mode: validates scatter/place calls and assets but skips expensive transform
28
+ * computation and instance generation. Useful for server-side validation. Default: false.
29
29
  */
30
30
  mock?: boolean;
31
+ /**
32
+ * Skip the final build() call on batch builders. Computes all placements but doesn't
33
+ * create the final Object3D instances. Useful for testing placement logic. Default: false.
34
+ */
35
+ skipBuild?: boolean;
31
36
  };
32
37
  export declare class PlaceGroup extends Group {
33
38
  private batchBuilders;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/place/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAQ,MAAM,OAAO,CAAA;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAmC/C,MAAM,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAA;AAEvD,MAAM,MAAM,mBAAmB,GAAG,CAAC,IAAI,EAA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KAAK,IAAI,CAAA;AAEvD,MAAM,MAAM,mBAAmB,GAAG,CAAC,IAAI,EAAE;IACvC,QAAQ,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,UAAU,CAAA;IACpB,KAAK,EAAE,OAAO,CAAA;IACd,WAAW,EAAE,WAAW,CAAA;IACxB,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAA;IAC5D,IAAI,EAAE,MAAM,CAAA;CACb,KAAK,IAAI,CAAA;AAKV,wBAAgB,aAAa,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAOvD;AAED,qBAAa,kBAAkB;aAIX,UAAU,EAAE,OAAO;IACnC,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAJpC,SAAgB,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAK;gBAG3B,UAAU,EAAE,OAAO,EAClB,iBAAiB,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,QAAQ;IAG5E,GAAG,CAAC,MAAM,EAAE,OAAO;IAKZ,KAAK,IAAI,QAAQ;CAGzB;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;IACd;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,qBAAa,UAAW,SAAQ,KAAK;IACnC,OAAO,CAAC,aAAa,CAAgC;gBAEzC,WAAW,EAAE,WAAW,EAAE,iBAAiB,CAAC,EAAE,QAAQ,EAAE,IAAI,GAAE,iBAAsB;IAuPhG,OAAO;CAOR"}
@@ -1,34 +1,9 @@
1
1
  import { Group, Matrix4, Quaternion, Vector3, Box3 } from 'three';
2
2
  import { TilesGeometry } from '../tiles/geometry.js';
3
- import { coerce, object, string, enum as zodEnum } from 'zod';
4
3
  import { createRng, hashNumbersToUint32, hashStringToUint32 } from '../utils/random.js';
5
4
  import { degToRad } from 'three/src/math/MathUtils.js';
6
- const alignEnum = zodEnum(['up', 'normal']);
7
- const scatterSchema = object({
8
- model: string(),
9
- density: coerce.number().optional(),
10
- bottomY: coerce.number().optional(),
11
- yaw: coerce.number().optional(),
12
- yawMin: coerce.number().optional(),
13
- yawMax: coerce.number().optional(),
14
- align: alignEnum.optional(),
15
- sizeX: coerce.number().optional(),
16
- minSizeX: coerce.number().optional(),
17
- maxSizeX: coerce.number().optional(),
18
- sizeZ: coerce.number().optional(),
19
- minSizeZ: coerce.number().optional(),
20
- maxSizeZ: coerce.number().optional(),
21
- });
22
- const placeSchema = object({
23
- model: string(),
24
- offsetX: coerce.number().optional(),
25
- offsetZ: coerce.number().optional(),
26
- bottomY: coerce.number().optional(),
27
- yaw: coerce.number().optional(),
28
- align: alignEnum.optional(),
29
- sizeX: coerce.number().optional(),
30
- sizeZ: coerce.number().optional(),
31
- });
5
+ import { locationSchema, placeSchema, scatterSchema, isPointInsideFootprint } from '../schemas.js';
6
+ import { ChartaError } from '../errors.js';
32
7
  const boxHelper = new Box3();
33
8
  const matrixHelper = new Matrix4();
34
9
  export function measureObject(object) {
@@ -52,108 +27,95 @@ export class PrefabBatchBuilder {
52
27
  return this;
53
28
  }
54
29
  build() {
55
- const batch = this.buildFromMatrices(this.matrices);
56
- this.matrices = [];
57
- return batch;
30
+ return this.buildFromMatrices(this.matrices);
58
31
  }
59
32
  }
60
33
  export class PlaceGroup extends Group {
61
34
  batchBuilders = new Set();
62
35
  constructor(interpreter, _materialFallback, opts = {}) {
63
36
  super();
64
- // Mock mode: validate scatter/place calls exist, skip expensive generation
65
- if (opts.mock) {
66
- const rows = interpreter.getRows();
67
- const cols = interpreter.getCols();
68
- for (let row = 0; row < rows; row++) {
69
- for (let col = 0; col < cols; col++) {
70
- // getCalls validates the schema and reports errors
71
- const scatterEntries = interpreter.getCalls([row, col], { scatter: scatterSchema });
72
- const placeEntries = interpreter.getCalls([row, col], { place: placeSchema });
73
- // Validate that referenced models exist (triggers "unknown asset" errors)
74
- for (const [, parsed, , loc] of scatterEntries) {
75
- interpreter.getAsset(PrefabBatchBuilder, `${parsed.model}Prefab`, loc);
76
- }
77
- for (const [, parsed, , loc] of placeEntries) {
78
- interpreter.getAsset(PrefabBatchBuilder, `${parsed.model}Prefab`, loc);
79
- }
80
- }
81
- }
82
- return;
83
- }
37
+ const { mock = false, skipBuild = false } = opts;
84
38
  const rows = interpreter.getRows();
85
39
  const cols = interpreter.getCols();
86
40
  const cellSize = interpreter.getCellSize();
87
- const tilesGeometry = interpreter.getAsset(TilesGeometry, 'tilesGeometry');
88
- if (!tilesGeometry) {
41
+ // Only get tilesGeometry if not in mock mode (needed for height calculations)
42
+ const tilesGeometry = mock ? null : interpreter.getAsset(TilesGeometry, 'tilesGeometry');
43
+ // Return early if not mock and tilesGeometry is missing
44
+ if (!mock && !tilesGeometry) {
89
45
  return;
90
46
  }
91
- const computeTransform = (px, pz, cell, opts) => {
47
+ const computeScale = (usualSize, sizeX, sizeZ) => {
48
+ if (sizeX === undefined && sizeZ === undefined)
49
+ return new Vector3(1, 1, 1);
50
+ // Avoid division by zero
51
+ const safeUsualX = Math.max(usualSize.x, 0.001);
52
+ const safeUsualZ = Math.max(usualSize.z, 0.001);
53
+ let sFactorX;
54
+ let sFactorZ;
55
+ if (sizeX !== undefined) {
56
+ sFactorX = sizeX / safeUsualX;
57
+ }
58
+ if (sizeZ !== undefined) {
59
+ sFactorZ = sizeZ / safeUsualZ;
60
+ }
61
+ const scale = Math.min(sFactorX ?? sFactorZ ?? 1, sFactorZ ?? sFactorX ?? 1);
62
+ return new Vector3(scale, scale, scale);
63
+ };
64
+ const computeTransform = (px, pz, cell, transformOpts) => {
92
65
  const normal = new Vector3();
93
66
  const offsetX = px - cell.center[0];
94
67
  const offsetZ = pz - cell.center[1];
95
68
  let py = 0;
96
- if (opts.useFixedY) {
97
- py = opts.fixedY;
69
+ if (transformOpts.useFixedY) {
70
+ py = transformOpts.fixedY;
98
71
  }
99
72
  else {
100
- py = tilesGeometry.getHeight(cell.row, cell.col, opts.layerIndex, offsetX, offsetZ, normal);
73
+ py = tilesGeometry.getHeight(cell.row, cell.col, transformOpts.layerIndex, offsetX, offsetZ, normal);
101
74
  }
102
75
  const pos = new Vector3(px, py, pz);
103
76
  const quat = new Quaternion();
104
- if (opts.alignMode === 'normal' && !opts.useFixedY) {
77
+ if (transformOpts.alignMode === 'normal' && !transformOpts.useFixedY) {
105
78
  const qAlign = new Quaternion().setFromUnitVectors(new Vector3(0, 1, 0), normal);
106
- const qYaw = new Quaternion().setFromAxisAngle(normal, degToRad(opts.yaw));
79
+ const qYaw = new Quaternion().setFromAxisAngle(normal, degToRad(transformOpts.yaw));
107
80
  quat.multiplyQuaternions(qYaw, qAlign);
108
81
  }
109
82
  else {
110
- quat.setFromAxisAngle(new Vector3(0, 1, 0), degToRad(opts.yaw));
83
+ quat.setFromAxisAngle(new Vector3(0, 1, 0), degToRad(transformOpts.yaw));
111
84
  }
112
85
  // Scale is handled by the factory via size
113
86
  const scl = new Vector3(1, 1, 1);
114
87
  const matrix = new Matrix4().compose(pos, quat, scl);
115
88
  return { pos, quat, scl, matrix };
116
89
  };
117
- const computeScale = (usualSize, sizeX, sizeZ) => {
118
- if (sizeX === undefined && sizeZ === undefined)
119
- return new Vector3(1, 1, 1);
120
- // Avoid division by zero
121
- const safeUsualX = Math.max(usualSize.x, 0.001);
122
- const safeUsualZ = Math.max(usualSize.z, 0.001);
123
- let sFactorX;
124
- let sFactorZ;
125
- if (sizeX !== undefined) {
126
- sFactorX = sizeX / safeUsualX;
127
- }
128
- if (sizeZ !== undefined) {
129
- sFactorZ = sizeZ / safeUsualZ;
130
- }
131
- const scale = Math.min(sFactorX ?? sFactorZ ?? 1, sFactorZ ?? sFactorX ?? 1);
132
- return new Vector3(scale, scale, scale);
133
- };
134
90
  for (let row = 0; row < rows; row++) {
135
91
  for (let col = 0; col < cols; col++) {
136
- const scatterEntries = interpreter.getCalls([row, col], {
137
- scatter: scatterSchema,
138
- });
139
- const placeEntries = interpreter.getCalls([row, col], {
140
- place: placeSchema,
141
- });
92
+ // getCalls validates the schema and reports errors
93
+ const scatterEntries = interpreter.getCalls([row, col], { scatter: scatterSchema });
94
+ const placeEntries = interpreter.getCalls([row, col], { place: placeSchema });
142
95
  if (scatterEntries.length === 0 && placeEntries.length === 0)
143
96
  continue;
144
97
  const cx = (col - cols / 2 + 0.5) * cellSize;
145
98
  const cz = (row - rows / 2 + 0.5) * cellSize;
146
99
  const half = cellSize * 0.5;
147
- // scatter: randomized distribution, density is count for now
100
+ // Collect location points in this cell for collision/footprint validation
101
+ const locationEntries = interpreter.getCalls([row, col], { location: locationSchema });
102
+ const locationPoints = locationEntries.map(([, parsed]) => ({
103
+ x: cx + (parsed.offsetX ?? 0),
104
+ z: cz + (parsed.offsetZ ?? 0),
105
+ }));
106
+ // scatter: randomized distribution
148
107
  for (const [, parsed, callIdx, loc] of scatterEntries) {
149
- const layerIndex = interpreter.countCalls([row, col], (c) => c.name === 'ground' || c.name === 'ceiling', 0, callIdx) - 1;
150
108
  const prefabName = `${parsed.model}Prefab`;
151
109
  const batchBuilder = interpreter.getAsset(PrefabBatchBuilder, prefabName, loc);
152
110
  if (!batchBuilder)
153
111
  continue;
112
+ // In mock mode, we only validate asset existence - skip expensive placement computation
113
+ if (mock)
114
+ continue;
154
115
  this.batchBuilders.add(batchBuilder);
155
116
  const usualSize = new Vector3();
156
117
  usualSize.copy(batchBuilder.prefabSize);
118
+ const layerIndex = interpreter.countCalls([row, col], (c) => c.name === 'ground' || c.name === 'ceiling', 0, callIdx) - 1;
157
119
  const base = hashStringToUint32(parsed.model);
158
120
  const seed = hashNumbersToUint32(base, row, col);
159
121
  const rng = createRng(seed);
@@ -196,15 +158,39 @@ export class PlaceGroup extends Group {
196
158
  : minSizeZ ?? maxSizeZ;
197
159
  const scale = computeScale(usualSize, sX, sZ);
198
160
  scl.multiply(scale);
161
+ // Check if any location point falls inside this scattered object's footprint
162
+ const halfX = (usualSize.x * scale.x) / 2;
163
+ const halfZ = (usualSize.z * scale.z) / 2;
164
+ const overlapsLocation = locationPoints.some((locPoint) => isPointInsideFootprint(locPoint.x, locPoint.z, px, pz, halfX, halfZ));
165
+ if (overlapsLocation)
166
+ continue;
199
167
  batchBuilder.add(matrixHelper.compose(pos, quat, scl));
200
168
  }
201
169
  }
202
170
  // place: exact in-cell placement
203
171
  for (const [, parsed, callIdx, loc] of placeEntries) {
204
- const layerIndex = interpreter.countCalls([row, col], (c) => c.name === 'ground' || c.name === 'ceiling', 0, callIdx) - 1;
172
+ const prefabName = `${parsed.model}Prefab`;
173
+ const batchBuilder = interpreter.getAsset(PrefabBatchBuilder, prefabName, loc);
174
+ if (!batchBuilder)
175
+ continue;
176
+ const usualSize = batchBuilder.prefabSize;
205
177
  const px = cx + (parsed.offsetX ?? 0);
206
178
  const pz = cz + (parsed.offsetZ ?? 0);
207
- // In place command, yaw is exact, no min/max range
179
+ // Compute scale for footprint validation (needed for both mock and normal mode)
180
+ const scale = computeScale(usualSize, parsed.sizeX, parsed.sizeZ);
181
+ const halfX = (usualSize.x * scale.x) / 2;
182
+ const halfZ = (usualSize.z * scale.z) / 2;
183
+ // Validate that no location point is inside this placed object's footprint
184
+ for (const locPoint of locationPoints) {
185
+ if (isPointInsideFootprint(locPoint.x, locPoint.z, px, pz, halfX, halfZ)) {
186
+ interpreter.reportError(new ChartaError(`location is inside place(${parsed.model}) footprint`, interpreter.getSource(), loc));
187
+ }
188
+ }
189
+ // In mock mode, skip expensive transform computation and placement
190
+ if (mock)
191
+ continue;
192
+ this.batchBuilders.add(batchBuilder);
193
+ const layerIndex = interpreter.countCalls([row, col], (c) => c.name === 'ground' || c.name === 'ceiling', 0, callIdx) - 1;
208
194
  const yaw = parsed.yaw ?? 0;
209
195
  const alignMode = (parsed.align ?? 'up').toLowerCase();
210
196
  const { pos, quat, scl } = computeTransform(px, pz, { row, col, center: [cx, cz] }, {
@@ -214,21 +200,16 @@ export class PlaceGroup extends Group {
214
200
  fixedY: parsed.bottomY,
215
201
  layerIndex,
216
202
  });
217
- const prefabName = `${parsed.model}Prefab`;
218
- const batchBuilder = interpreter.getAsset(PrefabBatchBuilder, prefabName, loc);
219
- if (!batchBuilder)
220
- continue;
221
- this.batchBuilders.add(batchBuilder);
222
- const usualSize = new Vector3();
223
- usualSize.copy(batchBuilder.prefabSize);
224
- const scale = computeScale(usualSize, parsed.sizeX, parsed.sizeZ);
225
203
  scl.multiply(scale);
226
204
  batchBuilder.add(matrixHelper.compose(pos, quat, scl));
227
205
  }
228
206
  }
229
207
  }
230
- for (const batchBuilder of this.batchBuilders) {
231
- this.add(batchBuilder.build());
208
+ // Build step: skip if mock or skipBuild is enabled
209
+ if (!mock && !skipBuild) {
210
+ for (const batchBuilder of this.batchBuilders) {
211
+ this.add(batchBuilder.build());
212
+ }
232
213
  }
233
214
  }
234
215
  dispose() {
@@ -0,0 +1,125 @@
1
+ import { coerce } from 'zod';
2
+ export declare const alignEnum: import("zod").ZodEnum<{
3
+ up: "up";
4
+ normal: "normal";
5
+ }>;
6
+ export declare const cornerEnum: import("zod").ZodEnum<{
7
+ topleft: "topleft";
8
+ topright: "topright";
9
+ bottomright: "bottomright";
10
+ bottomleft: "bottomleft";
11
+ }>;
12
+ export declare const wallDirEnum: import("zod").ZodEnum<{
13
+ top: "top";
14
+ bottom: "bottom";
15
+ left: "left";
16
+ right: "right";
17
+ }>;
18
+ export declare const cellSizeSchema: import("zod").ZodObject<{
19
+ size: coerce.ZodCoercedNumber<unknown>;
20
+ }, import("zod/v4/core").$strip>;
21
+ export declare const basePathSchema: import("zod").ZodObject<{
22
+ path: import("zod").ZodString;
23
+ }, import("zod/v4/core").$strip>;
24
+ export declare const loadTextureSchema: import("zod").ZodObject<{
25
+ name: import("zod").ZodString;
26
+ path: import("zod").ZodString;
27
+ }, import("zod/v4/core").$strip>;
28
+ export declare const loadModelSchema: import("zod").ZodObject<{
29
+ name: import("zod").ZodString;
30
+ path: import("zod").ZodString;
31
+ }, import("zod/v4/core").$strip>;
32
+ export declare const groundSchema: import("zod").ZodObject<{
33
+ texture: import("zod").ZodString;
34
+ y: coerce.ZodCoercedNumber<unknown>;
35
+ }, import("zod/v4/core").$strip>;
36
+ export declare const ceilingSchema: import("zod").ZodObject<{
37
+ texture: import("zod").ZodString;
38
+ y: coerce.ZodCoercedNumber<unknown>;
39
+ }, import("zod/v4/core").$strip>;
40
+ export declare const waterSchema: import("zod").ZodObject<{
41
+ y: coerce.ZodCoercedNumber<unknown>;
42
+ }, import("zod/v4/core").$strip>;
43
+ export declare const wallSchema: import("zod").ZodObject<{
44
+ dir: import("zod").ZodEnum<{
45
+ top: "top";
46
+ bottom: "bottom";
47
+ left: "left";
48
+ right: "right";
49
+ }>;
50
+ texture: import("zod").ZodString;
51
+ bottomY: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
52
+ topY: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
53
+ }, import("zod/v4/core").$strip>;
54
+ export declare const windowSchema: import("zod").ZodObject<{
55
+ offsetX: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
56
+ bottomY: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
57
+ topY: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
58
+ width: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
59
+ }, import("zod/v4/core").$strip>;
60
+ export declare const doorSchema: import("zod").ZodObject<{
61
+ offsetX: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
62
+ bottomY: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
63
+ topY: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
64
+ height: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
65
+ width: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
66
+ }, import("zod/v4/core").$strip>;
67
+ export declare const pillarSchema: import("zod").ZodObject<{
68
+ corner: import("zod").ZodEnum<{
69
+ topleft: "topleft";
70
+ topright: "topright";
71
+ bottomright: "bottomright";
72
+ bottomleft: "bottomleft";
73
+ }>;
74
+ texture: import("zod").ZodString;
75
+ sizeX: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
76
+ sizeZ: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
77
+ bottomY: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
78
+ topY: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
79
+ }, import("zod/v4/core").$strip>;
80
+ export declare const locationSchema: import("zod").ZodObject<{
81
+ name: import("zod").ZodString;
82
+ offsetX: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
83
+ offsetZ: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
84
+ }, import("zod/v4/core").$strip>;
85
+ export declare const placeSchema: import("zod").ZodObject<{
86
+ model: import("zod").ZodString;
87
+ offsetX: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
88
+ offsetZ: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
89
+ bottomY: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
90
+ yaw: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
91
+ align: import("zod").ZodOptional<import("zod").ZodEnum<{
92
+ up: "up";
93
+ normal: "normal";
94
+ }>>;
95
+ sizeX: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
96
+ sizeZ: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
97
+ }, import("zod/v4/core").$strip>;
98
+ export declare const scatterSchema: import("zod").ZodObject<{
99
+ model: import("zod").ZodString;
100
+ density: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
101
+ bottomY: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
102
+ yaw: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
103
+ yawMin: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
104
+ yawMax: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
105
+ align: import("zod").ZodOptional<import("zod").ZodEnum<{
106
+ up: "up";
107
+ normal: "normal";
108
+ }>>;
109
+ sizeX: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
110
+ minSizeX: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
111
+ maxSizeX: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
112
+ sizeZ: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
113
+ minSizeZ: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
114
+ maxSizeZ: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
115
+ }, import("zod/v4/core").$strip>;
116
+ export declare const grassSchema: import("zod").ZodObject<{
117
+ color: import("zod").ZodOptional<import("zod").ZodString>;
118
+ height: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
119
+ density: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
120
+ }, import("zod/v4/core").$strip>;
121
+ /**
122
+ * Check if a point is inside an object's footprint (axis-aligned bounding box in X/Z).
123
+ */
124
+ export declare function isPointInsideFootprint(pointX: number, pointZ: number, objectX: number, objectZ: number, halfSizeX: number, halfSizeZ: number): boolean;
125
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAmC,MAAM,KAAK,CAAA;AAM7D,eAAO,MAAM,SAAS;;;EAA4B,CAAA;AAClD,eAAO,MAAM,UAAU;;;;;EAAgE,CAAA;AACvF,eAAO,MAAM,WAAW;;;;;EAA8C,CAAA;AAMtE,eAAO,MAAM,cAAc;;gCAAoC,CAAA;AAC/D,eAAO,MAAM,cAAc;;gCAA6B,CAAA;AACxD,eAAO,MAAM,iBAAiB;;;gCAA6C,CAAA;AAC3E,eAAO,MAAM,eAAe;;;gCAA6C,CAAA;AAMzE,eAAO,MAAM,YAAY;;;gCAAoD,CAAA;AAC7E,eAAO,MAAM,aAAa;;;gCAAoD,CAAA;AAC9E,eAAO,MAAM,WAAW;;gCAAiC,CAAA;AAMzD,eAAO,MAAM,UAAU;;;;;;;;;;gCAKrB,CAAA;AAEF,eAAO,MAAM,YAAY;;;;;gCAKvB,CAAA;AAEF,eAAO,MAAM,UAAU;;;;;;gCAMrB,CAAA;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;;;gCAOvB,CAAA;AAMF,eAAO,MAAM,cAAc;;;;gCAIzB,CAAA;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;gCAStB,CAAA;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;gCAcxB,CAAA;AAMF,eAAO,MAAM,WAAW;;;;gCAItB,CAAA;AAMF;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,OAAO,CAET"}
@@ -0,0 +1,100 @@
1
+ import { coerce, object, string, enum as zodEnum } from 'zod';
2
+ // ============================================================================
3
+ // Enums
4
+ // ============================================================================
5
+ export const alignEnum = zodEnum(['up', 'normal']);
6
+ export const cornerEnum = zodEnum(['topleft', 'topright', 'bottomright', 'bottomleft']);
7
+ export const wallDirEnum = zodEnum(['top', 'bottom', 'left', 'right']);
8
+ // ============================================================================
9
+ // Meta Schemas (first row)
10
+ // ============================================================================
11
+ export const cellSizeSchema = object({ size: coerce.number() });
12
+ export const basePathSchema = object({ path: string() });
13
+ export const loadTextureSchema = object({ name: string(), path: string() });
14
+ export const loadModelSchema = object({ name: string(), path: string() });
15
+ // ============================================================================
16
+ // Layer Schemas
17
+ // ============================================================================
18
+ export const groundSchema = object({ texture: string(), y: coerce.number() });
19
+ export const ceilingSchema = object({ texture: string(), y: coerce.number() });
20
+ export const waterSchema = object({ y: coerce.number() });
21
+ // ============================================================================
22
+ // Structural Schemas
23
+ // ============================================================================
24
+ export const wallSchema = object({
25
+ dir: wallDirEnum,
26
+ texture: string(),
27
+ bottomY: coerce.number().optional(),
28
+ topY: coerce.number().optional(),
29
+ });
30
+ export const windowSchema = object({
31
+ offsetX: coerce.number().optional(),
32
+ bottomY: coerce.number().optional(),
33
+ topY: coerce.number().optional(),
34
+ width: coerce.number().optional(),
35
+ });
36
+ export const doorSchema = object({
37
+ offsetX: coerce.number().optional(),
38
+ bottomY: coerce.number().optional(),
39
+ topY: coerce.number().optional(),
40
+ height: coerce.number().optional(),
41
+ width: coerce.number().optional(),
42
+ });
43
+ export const pillarSchema = object({
44
+ corner: cornerEnum,
45
+ texture: string(),
46
+ sizeX: coerce.number().optional(),
47
+ sizeZ: coerce.number().optional(),
48
+ bottomY: coerce.number().optional(),
49
+ topY: coerce.number().optional(),
50
+ });
51
+ // ============================================================================
52
+ // Object Placement Schemas
53
+ // ============================================================================
54
+ export const locationSchema = object({
55
+ name: string(),
56
+ offsetX: coerce.number().optional(),
57
+ offsetZ: coerce.number().optional(),
58
+ });
59
+ export const placeSchema = object({
60
+ model: string(),
61
+ offsetX: coerce.number().optional(),
62
+ offsetZ: coerce.number().optional(),
63
+ bottomY: coerce.number().optional(),
64
+ yaw: coerce.number().optional(),
65
+ align: alignEnum.optional(),
66
+ sizeX: coerce.number().optional(),
67
+ sizeZ: coerce.number().optional(),
68
+ });
69
+ export const scatterSchema = object({
70
+ model: string(),
71
+ density: coerce.number().optional(),
72
+ bottomY: coerce.number().optional(),
73
+ yaw: coerce.number().optional(),
74
+ yawMin: coerce.number().optional(),
75
+ yawMax: coerce.number().optional(),
76
+ align: alignEnum.optional(),
77
+ sizeX: coerce.number().optional(),
78
+ minSizeX: coerce.number().optional(),
79
+ maxSizeX: coerce.number().optional(),
80
+ sizeZ: coerce.number().optional(),
81
+ minSizeZ: coerce.number().optional(),
82
+ maxSizeZ: coerce.number().optional(),
83
+ });
84
+ // ============================================================================
85
+ // Decoration Schemas
86
+ // ============================================================================
87
+ export const grassSchema = object({
88
+ color: string().optional(),
89
+ height: coerce.number().optional(),
90
+ density: coerce.number().optional(),
91
+ });
92
+ // ============================================================================
93
+ // Utility Functions
94
+ // ============================================================================
95
+ /**
96
+ * Check if a point is inside an object's footprint (axis-aligned bounding box in X/Z).
97
+ */
98
+ export function isPointInsideFootprint(pointX, pointZ, objectX, objectZ, halfSizeX, halfSizeZ) {
99
+ return Math.abs(pointX - objectX) < halfSizeX && Math.abs(pointZ - objectZ) < halfSizeZ;
100
+ }
@@ -1,15 +1,8 @@
1
1
  import { Material, Mesh } from 'three';
2
2
  import { Interpreter } from '../interpreter.js';
3
- import { coerce } from 'zod';
4
3
  import { TilesGeometry } from './geometry.js';
5
- export declare const groundSchema: import("zod").ZodObject<{
6
- texture: import("zod").ZodString;
7
- y: coerce.ZodCoercedNumber<unknown>;
8
- }, import("zod/v4/core").$strip>;
9
- export declare const ceilingSchema: import("zod").ZodObject<{
10
- texture: import("zod").ZodString;
11
- y: coerce.ZodCoercedNumber<unknown>;
12
- }, import("zod/v4/core").$strip>;
4
+ import { groundSchema, ceilingSchema } from '../schemas.js';
5
+ export { groundSchema, ceilingSchema };
13
6
  export type TilesMeshOptions = {
14
7
  /**
15
8
  * Mock mode: validates ground/ceiling/wall calls but skips geometry creation.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tiles/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EACR,IAAI,EAOL,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAkB,MAAM,KAAK,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAuB,MAAM,eAAe,CAAA;AAMlE,eAAO,MAAM,YAAY;;;gCAAoD,CAAA;AAC7E,eAAO,MAAM,aAAa;;;gCAAoD,CAAA;AAE9E,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAyCD,qBAAa,SAAU,SAAQ,IAAI,CAAC,aAAa,CAAC;gBACpC,WAAW,EAAE,WAAW,EAAE,QAAQ,GAAE,QAAkC,EAAE,OAAO,GAAE,gBAAqB;CA0JnH"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tiles/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EACR,IAAI,EAOL,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAuB,MAAM,eAAe,CAAA;AAIlE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAc,MAAM,eAAe,CAAA;AAEvE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,CAAA;AAEtC,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAyCD,qBAAa,SAAU,SAAQ,IAAI,CAAC,aAAa,CAAC;gBACpC,WAAW,EAAE,WAAW,EAAE,QAAQ,GAAE,QAAkC,EAAE,OAAO,GAAE,gBAAqB;CA0JnH"}
@@ -1,12 +1,10 @@
1
1
  import { Mesh, Texture, MeshBasicMaterial, } from 'three';
2
- import { coerce, object, string } from 'zod';
3
2
  import { TilesGeometry } from './geometry.js';
4
3
  import { buildTilesMaterial } from './material.js';
5
4
  import { ChartaError } from '../errors.js';
6
- import { wallSchema } from '../walls/index.js';
7
5
  import { buildTextureArrayFromAssets } from '../utils/texture.js';
8
- export const groundSchema = object({ texture: string(), y: coerce.number() });
9
- export const ceilingSchema = object({ texture: string(), y: coerce.number() });
6
+ import { groundSchema, ceilingSchema, wallSchema } from '../schemas.js';
7
+ export { groundSchema, ceilingSchema };
10
8
  function resolveHeights(position, items, interpreter, reverse) {
11
9
  items = [...items];
12
10
  if (reverse) {
@@ -1,8 +1,9 @@
1
1
  import { Material, Mesh, Vector2Tuple, Vector3Tuple } from 'three';
2
2
  import { Interpreter } from '../interpreter.js';
3
- import { coerce } from 'zod';
4
3
  import { TilesGeometry } from '../tiles/geometry.js';
5
4
  import { ErrorLocation } from '../errors.js';
5
+ import { wallSchema, windowSchema, doorSchema } from '../schemas.js';
6
+ export { wallSchema, windowSchema, doorSchema };
6
7
  export type WindowData = {
7
8
  offsetX: number;
8
9
  bottomY: number;
@@ -19,30 +20,6 @@ export type WallData = {
19
20
  textureId: number;
20
21
  windows: WindowData[];
21
22
  };
22
- export declare const windowSchema: import("zod").ZodObject<{
23
- offsetX: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
24
- bottomY: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
25
- topY: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
26
- width: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
27
- }, import("zod/v4/core").$strip>;
28
- export declare const doorSchema: import("zod").ZodObject<{
29
- offsetX: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
30
- bottomY: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
31
- topY: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
32
- height: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
33
- width: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
34
- }, import("zod/v4/core").$strip>;
35
- export declare const wallSchema: import("zod").ZodObject<{
36
- dir: import("zod").ZodEnum<{
37
- top: "top";
38
- bottom: "bottom";
39
- left: "left";
40
- right: "right";
41
- }>;
42
- texture: import("zod").ZodString;
43
- bottomY: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
44
- topY: import("zod").ZodOptional<coerce.ZodCoercedNumber<unknown>>;
45
- }, import("zod/v4/core").$strip>;
46
23
  export declare const WALL_CONFIG: {
47
24
  readonly top: {
48
25
  readonly zOffset: -0.5;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/walls/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAER,IAAI,EAGJ,YAAY,EAEZ,YAAY,EAOb,MAAM,OAAO,CAAA;AAEd,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAyC,MAAM,KAAK,CAAA;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAGpD,OAAO,EAAe,aAAa,EAAE,MAAM,cAAc,CAAA;AAMzD,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,MAAM,EAAE,YAAY,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,YAAY,CAAA;IACpB,IAAI,EAAE,YAAY,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,UAAU,EAAE,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,YAAY;;;;;gCAKvB,CAAA;AAEF,eAAO,MAAM,UAAU;;;;;;gCAMrB,CAAA;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;gCAKrB,CAAA;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;CAed,CAAA;AAEV,eAAO,MAAM,+BAA+B,QAAQ,CAAA;AAEpD,wBAAgB,yBAAyB,CACvC,WAAW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Texture, Shape, ExtrudeGeometry, Path, } from 'three';
2
2
  import { mergeGeometries } from 'three/examples/jsm/utils/BufferGeometryUtils.js';
3
- import { coerce, object, string, enum as enum_ } from 'zod';
4
3
  import { TilesGeometry } from '../tiles/geometry.js';
5
4
  import { buildTextureArrayFromAssets } from '../utils/texture.js';
6
5
  import { buildWallMeshMaterial } from './material.js';
7
6
  import { ChartaError } from '../errors.js';
8
- import { ceilingSchema, groundSchema } from '../tiles/index.js';
7
+ import { groundSchema, ceilingSchema, wallSchema, windowSchema, doorSchema, } from '../schemas.js';
8
+ export { wallSchema, windowSchema, doorSchema };
9
9
  const eulerHelper = new Euler();
10
10
  const scaleHelper = new Vector3(1, 1, 1);
11
- export const windowSchema = object({
12
- offsetX: coerce.number().optional(),
13
- bottomY: coerce.number().optional(),
14
- topY: coerce.number().optional(),
15
- width: coerce.number().optional(),
16
- });
17
- export const doorSchema = object({
18
- offsetX: coerce.number().optional(),
19
- bottomY: coerce.number().optional(),
20
- topY: coerce.number().optional(),
21
- height: coerce.number().optional(),
22
- width: coerce.number().optional(),
23
- });
24
- export const wallSchema = object({
25
- dir: enum_(['top', 'bottom', 'left', 'right']),
26
- texture: string(),
27
- bottomY: coerce.number().optional(),
28
- topY: coerce.number().optional(),
29
- });
30
11
  export const WALL_CONFIG = {
31
12
  top: { zOffset: -0.5, rotation: 0, axis: 'z', sampleDir: 1 },
32
13
  bottom: { zOffset: 0.5, rotation: 0, axis: 'z', sampleDir: 1 },
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/water/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAY,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAC;AAIF,qBAAa,SAAU,SAAQ,IAAI;gBACrB,WAAW,EAAE,WAAW,EAAE,OAAO,GAAE,gBAAqB;IAkDpE,OAAO,IAAI,IAAI;CAMhB;AAED,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/water/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAY,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAC;AAEF,qBAAa,SAAU,SAAQ,IAAI;gBACrB,WAAW,EAAE,WAAW,EAAE,OAAO,GAAE,gBAAqB;IAkDpE,OAAO,IAAI,IAAI;CAMhB;AAED,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA"}
@@ -1,7 +1,6 @@
1
1
  import { Mesh, Material } from "three";
2
2
  import { TilesGeometry } from "../tiles/geometry.js";
3
- import { coerce, object } from "zod";
4
- const waterSchema = object({ y: coerce.number() });
3
+ import { waterSchema } from "../schemas.js";
5
4
  export class WaterMesh extends Mesh {
6
5
  constructor(interpreter, options = {}) {
7
6
  const rows = interpreter.getRows();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drawcall/charta",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "author": "Bela Bohlender",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://drawcall.ai",