@hello-terrain/react 0.0.0-alpha.11 → 0.0.0-alpha.12

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/dist/index.cjs CHANGED
@@ -23,10 +23,12 @@ function createSyncTerrainRuntimeTask(runtime) {
23
23
  return work.task((get, work) => {
24
24
  const queryContext = get(three.terrainTasks.terrainQuery);
25
25
  const query = queryContext.query;
26
+ const surfaceQuery = queryContext.surfaceQuery;
26
27
  const sphereQuery = queryContext.sphereQuery;
27
28
  const raycast = get(three.terrainTasks.terrainRaycast);
28
29
  return work(() => {
29
30
  runtime.query = query;
31
+ runtime.surfaceQuery = surfaceQuery;
30
32
  runtime.sphereQuery = sphereQuery;
31
33
  runtime.raycast = raycast;
32
34
  return runtime;
@@ -328,6 +330,7 @@ function useTerrain(options = {}) {
328
330
  const runtime = react.useMemo(
329
331
  () => ({
330
332
  query: null,
333
+ surfaceQuery: null,
331
334
  sphereQuery: null,
332
335
  raycast: null
333
336
  }),
@@ -485,7 +488,7 @@ function TerrainWithHandle({
485
488
  maxNodes,
486
489
  ...primitiveProps
487
490
  }) {
488
- const flipWinding = (terrain.topology?.projection ?? "flat") === "cubeSphere";
491
+ const flipWinding = terrain.topology?.projection?.faceOutward ?? false;
489
492
  const mesh = useTerrainMesh(innerTileSegments, maxNodes, flipWinding);
490
493
  const { visible: primitiveVisible = true, ...restPrimitiveProps } = primitiveProps;
491
494
  fiber.useFrame(() => {
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ElevationCallback, Topology, TerrainGraph, TerrainTasks, TerrainQuery, TerrainSphereQuery, TerrainRaycast } from '@hello-terrain/three';
2
+ import { ElevationCallback, Topology, TerrainGraph, TerrainTasks, TerrainQuery, TerrainSurfaceQuery, TerrainSphereQuery, TerrainRaycast } from '@hello-terrain/three';
3
3
  export { TerrainQuery, TerrainRaycast, TerrainRaycastResult, TerrainSample, TerrainSphereQuery, TerrainSurfaceSample, TerrainSurfaceSampleBatch, TerrainTile } from '@hello-terrain/three';
4
4
  import { Task } from '@hello-terrain/work';
5
5
  import { ThreeElements, RootState } from '@react-three/fiber';
@@ -20,6 +20,8 @@ interface TerrainNodes {
20
20
  }
21
21
  interface TerrainRuntime {
22
22
  query: TerrainQuery | null;
23
+ /** Generic closed-surface query; `null` on flat surfaces. */
24
+ surfaceQuery: TerrainSurfaceQuery | null;
23
25
  /** Cube-sphere query; `null` unless the topology uses the cubeSphere projection. */
24
26
  sphereQuery: TerrainSphereQuery | null;
25
27
  raycast: TerrainRaycast | null;
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ElevationCallback, Topology, TerrainGraph, TerrainTasks, TerrainQuery, TerrainSphereQuery, TerrainRaycast } from '@hello-terrain/three';
2
+ import { ElevationCallback, Topology, TerrainGraph, TerrainTasks, TerrainQuery, TerrainSurfaceQuery, TerrainSphereQuery, TerrainRaycast } from '@hello-terrain/three';
3
3
  export { TerrainQuery, TerrainRaycast, TerrainRaycastResult, TerrainSample, TerrainSphereQuery, TerrainSurfaceSample, TerrainSurfaceSampleBatch, TerrainTile } from '@hello-terrain/three';
4
4
  import { Task } from '@hello-terrain/work';
5
5
  import { ThreeElements, RootState } from '@react-three/fiber';
@@ -20,6 +20,8 @@ interface TerrainNodes {
20
20
  }
21
21
  interface TerrainRuntime {
22
22
  query: TerrainQuery | null;
23
+ /** Generic closed-surface query; `null` on flat surfaces. */
24
+ surfaceQuery: TerrainSurfaceQuery | null;
23
25
  /** Cube-sphere query; `null` unless the topology uses the cubeSphere projection. */
24
26
  sphereQuery: TerrainSphereQuery | null;
25
27
  raycast: TerrainRaycast | null;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ElevationCallback, Topology, TerrainGraph, TerrainTasks, TerrainQuery, TerrainSphereQuery, TerrainRaycast } from '@hello-terrain/three';
2
+ import { ElevationCallback, Topology, TerrainGraph, TerrainTasks, TerrainQuery, TerrainSurfaceQuery, TerrainSphereQuery, TerrainRaycast } from '@hello-terrain/three';
3
3
  export { TerrainQuery, TerrainRaycast, TerrainRaycastResult, TerrainSample, TerrainSphereQuery, TerrainSurfaceSample, TerrainSurfaceSampleBatch, TerrainTile } from '@hello-terrain/three';
4
4
  import { Task } from '@hello-terrain/work';
5
5
  import { ThreeElements, RootState } from '@react-three/fiber';
@@ -20,6 +20,8 @@ interface TerrainNodes {
20
20
  }
21
21
  interface TerrainRuntime {
22
22
  query: TerrainQuery | null;
23
+ /** Generic closed-surface query; `null` on flat surfaces. */
24
+ surfaceQuery: TerrainSurfaceQuery | null;
23
25
  /** Cube-sphere query; `null` unless the topology uses the cubeSphere projection. */
24
26
  sphereQuery: TerrainSphereQuery | null;
25
27
  raycast: TerrainRaycast | null;
package/dist/index.mjs CHANGED
@@ -21,10 +21,12 @@ function createSyncTerrainRuntimeTask(runtime) {
21
21
  return task((get, work) => {
22
22
  const queryContext = get(terrainTasks.terrainQuery);
23
23
  const query = queryContext.query;
24
+ const surfaceQuery = queryContext.surfaceQuery;
24
25
  const sphereQuery = queryContext.sphereQuery;
25
26
  const raycast = get(terrainTasks.terrainRaycast);
26
27
  return work(() => {
27
28
  runtime.query = query;
29
+ runtime.surfaceQuery = surfaceQuery;
28
30
  runtime.sphereQuery = sphereQuery;
29
31
  runtime.raycast = raycast;
30
32
  return runtime;
@@ -326,6 +328,7 @@ function useTerrain(options = {}) {
326
328
  const runtime = useMemo(
327
329
  () => ({
328
330
  query: null,
331
+ surfaceQuery: null,
329
332
  sphereQuery: null,
330
333
  raycast: null
331
334
  }),
@@ -483,7 +486,7 @@ function TerrainWithHandle({
483
486
  maxNodes,
484
487
  ...primitiveProps
485
488
  }) {
486
- const flipWinding = (terrain.topology?.projection ?? "flat") === "cubeSphere";
489
+ const flipWinding = terrain.topology?.projection?.faceOutward ?? false;
487
490
  const mesh = useTerrainMesh(innerTileSegments, maxNodes, flipWinding);
488
491
  const { visible: primitiveVisible = true, ...restPrimitiveProps } = primitiveProps;
489
492
  useFrame(() => {
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "type": "git",
7
7
  "url": "https://github.com/kenjinp/hello-terrain.git"
8
8
  },
9
- "version": "0.0.0-alpha.11",
9
+ "version": "0.0.0-alpha.12",
10
10
  "type": "module",
11
11
  "main": "./dist/index.mjs",
12
12
  "module": "./dist/index.mjs",
@@ -22,8 +22,8 @@
22
22
  "dist"
23
23
  ],
24
24
  "dependencies": {
25
- "@hello-terrain/work": "0.3.0",
26
- "@hello-terrain/three": "0.0.0-alpha.11"
25
+ "@hello-terrain/three": "0.0.0-alpha.12",
26
+ "@hello-terrain/work": "0.3.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@testing-library/dom": "^10.4.0",
@@ -34,9 +34,9 @@
34
34
  "jsdom": "^26.0.0",
35
35
  "unbuild": "^3.5.0",
36
36
  "vitest": "^4.0.17",
37
- "@config/oxlint": "0.1.0",
38
37
  "@config/oxfmt": "0.1.0",
39
- "@config/typescript": "0.1.0"
38
+ "@config/typescript": "0.1.0",
39
+ "@config/oxlint": "0.1.0"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@react-three/fiber": "^8.0.0 || ^9.0.0",