@solidrt/3d 0.0.60 → 0.0.61
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/AGENTS.md +436 -139
- package/examples/cascades.tsx +10 -4
- package/examples/pick.tsx +6 -4
- package/examples/sprites.tsx +7 -1
- package/package.json +4 -3
- package/src/components/context.tsx +13 -2
- package/src/components/first-person-camera.tsx +1 -1
- package/src/components/index.ts +2 -0
- package/src/components/instanced-mesh.tsx +25 -6
- package/src/components/lod.tsx +3 -1
- package/src/components/orbit-camera.tsx +105 -20
- package/src/components/shots.tsx +93 -0
- package/src/first-person.ts +48 -16
- package/src/gltf.ts +316 -62
- package/src/index.ts +8 -3
- package/src/input.ts +61 -17
- package/src/light.ts +25 -2
- package/src/material.ts +101 -25
- package/src/math.ts +11 -0
- package/src/mesh.ts +68 -21
- package/src/model-data.ts +27 -0
- package/src/model-file.ts +112 -37
- package/src/model.ts +90 -29
- package/src/node.ts +1 -1
- package/src/orbit.ts +526 -108
- package/src/scene-shadows.ts +4 -3
- package/src/scene.ts +201 -189
- package/src/shots.ts +63 -0
- package/src/skeleton.ts +39 -7
- package/tools/environment.ts +1 -0
- package/tools/model.ts +4 -3
- package/tools/node-env.d.ts +25 -0
- package/src/motion.ts +0 -17
- package/src/order.ts +0 -58
package/src/scene-shadows.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import { createDrawTarget, depthTexture, destroyTexture, limits, setTargetRect, setTargetSize } from "@solidrt/core/gpu"
|
|
11
11
|
import type { ShaderParams, TextureId } from "@solidrt/core/gpu"
|
|
12
|
-
import {
|
|
12
|
+
import { cascadeBoundary, copy, frustumSliceSphere, lookAt as lookAtMatrix, mat4, snapToGrid, transformVector } from "./math.ts"
|
|
13
13
|
import type { Mat4, Vec3 } from "./math.ts"
|
|
14
14
|
import { MAX_LIGHTS, MAX_SHADOW_MAPS } from "./glsl.ts"
|
|
15
15
|
import { shadowDepthMaterial } from "./material.ts"
|
|
@@ -389,7 +389,8 @@ export function makeShadowSystem<V extends ShadowView>(deps: ShadowSystemDeps<V>
|
|
|
389
389
|
return
|
|
390
390
|
}
|
|
391
391
|
// Cascades: the scene camera's range near..far (far capped by
|
|
392
|
-
// shadow.distance) sliced by
|
|
392
|
+
// shadow.distance) sliced by cascadeBoundary (the light's explicit
|
|
393
|
+
// splits, or the practical split), each slice's bounding
|
|
393
394
|
// sphere (frustumSliceSphere) as an orthographic box looking along
|
|
394
395
|
// the light, its centre snapped to the map's texel grid in light
|
|
395
396
|
// space (snapToGrid) so the shadow edges do not swim as the camera
|
|
@@ -406,7 +407,7 @@ export function makeShadowSystem<V extends ShadowView>(deps: ShadowSystemDeps<V>
|
|
|
406
407
|
let aspect = size.width / size.height
|
|
407
408
|
let zn = near
|
|
408
409
|
for (let c = 0; c < n; c++) {
|
|
409
|
-
let zf =
|
|
410
|
+
let zf = cascadeBoundary(near, far, c, n, CASCADE_SPLIT_LAMBDA, light.shadow.splits)
|
|
410
411
|
let radius = frustumSliceSphere(cascadeCenter, camera, aspect, zn, zf)
|
|
411
412
|
zn = zf
|
|
412
413
|
let view = shadow.views[c]!
|