|
15 | 15 | * m._c1.set([px - hw, py - hh, pz - hd]) |
16 | 16 | * m._c2.set([px + hw, py + hh, pz + hd]) |
17 | 17 | * m.visibility = p.visibility({ corner1: m._c1, corner2: m._c2 }) |
| 18 | + * |
| 19 | + * ── Sign contract ───────────────────────────────────────────────────────── |
| 20 | + * |
| 21 | + * Frustum extents are near-plane coordinates in camera space (y-up, z into |
| 22 | + * screen): |
| 23 | + * |
| 24 | + * top > 0 bottom < 0 (y axis) |
| 25 | + * right > 0 left < 0 (x axis) |
| 26 | + * near, far > 0 (positive distances along −z) |
| 27 | + * |
| 28 | + * All of frustumPlanes, viewFrustum, projTop/projBottom, projLeft/projRight, |
| 29 | + * mat4Frustum, mat4Ortho, and p5 v2's frustum()/ortho() share this contract. |
| 30 | + * p5 v2 call order: frustum(left, right, bottom, top, near, far). |
18 | 31 | */ |
19 | 32 |
|
20 | 33 | 'use strict'; |
@@ -234,11 +247,11 @@ export function installVisibility(p5, fn) { |
234 | 247 | * |
235 | 248 | * @method bounds |
236 | 249 | * @for p5 |
237 | | - * @param {{ eMatrix?: Float32Array | ArrayLike | p5.Matrix }} [opts] |
| 250 | + * @param {{ mat4Eye?: Float32Array | ArrayLike | p5.Matrix }} [opts] |
238 | 251 | * @returns {object} |
239 | 252 | */ |
240 | | - p5.Renderer3D.prototype.bounds = function ({ eMatrix } = {}) { |
241 | | - const eRaw = _rawMat4(eMatrix) ?? (mat4Invert(_eye, _viewMat4(this)), _eye); |
| 253 | + p5.Renderer3D.prototype.bounds = function ({ mat4Eye } = {}) { |
| 254 | + const eRaw = _rawMat4(mat4Eye) ?? (mat4Invert(_eye, _viewMat4(this)), _eye); |
242 | 255 | computePlanes(this, eRaw); |
243 | 256 | const keys = [p5.Tree.LEFT, p5.Tree.RIGHT, p5.Tree.NEAR, p5.Tree.FAR, p5.Tree.TOP, p5.Tree.BOTTOM]; |
244 | 257 | const result = {}; |
|
0 commit comments