Repository navigation
Description
Describe the bug 📝
Viewpoint.toJSON() is documented as "a BCF API JSON compliant object", and create(data) / set(data) take a BCFViewpoint, but the camera in that JSON is in the three.js world's axes (Y up), not BCF's (Z up). A viewpoint stored by an app or sent to a BCF-API server is read by other BCF tools lying on its side, while its clipping planes are right.
Left: buildingSMART's "Perspective camera" test case as BCF means it. Right: the same BCF-API JSON through create(data) + go(). Then both cameras from outside: That Open's is 35 m under the ground, looking up.
Expected: toJSON() gives, and create(data) / set(data) take, the camera in BCF's axes (Z up), as the clipping planes already are. The internal camera can stay Y up; only the JSON boundary would swap (x, y, z) ↔ (x, −z, y), and BCFTopics.load would then pass the file's values on unswapped. This changes the JSON existing apps have stored, so it is probably a breaking change.
Where in the code
updateCamera()stores the world position and direction as they are (viewpoint.ts#L451-L466), andtoJSON()returns them unchanged (#L733-L737).set()takes the camera unchanged (#L307-L309).- In the same JSON the clipping planes are converted to Z up (#L313-L325, #L723-L724), and so is the camera in the BCF-XML export (
serialize()) and import (BCFTopics.load). Worlds/node-example.tssays its JSON "can be consumed by any BCF-aware viewer" and writes the camera Y up.
Reproduction ▶️
Steps to reproduce 🔢
- In the repro:
npm install,npm run dev, openissue-1/example.html. Both worlds load buildingSMART'sArchitectural.ifc. - The camera of the "Perspective camera" test case, as BCF-API JSON, is restored on the left as BCF means it and on the right with
Viewpoints.create(data)+go(). (The field of view is set by hand aftergo(), see #850 .) - Overview of both cameras draws both cameras.
- Save the right view, read it on the left puts the right world on the test case's view, saves it with
updateCamera()+toJSON(), and reads that JSON on the left as a BCF tool would. - The panel's Results:
BUG go() camera height in the world: got -34.796, expected 1.834
BUG toJSON() camera_view_point.z (height): got 28.596, expected 8.034
BUG toJSON() camera_view_point.y: got 8.034, expected -28.596
System Info 💻
System:
OS: Windows 11 10.0.26200
CPU: (16) x64 Intel(R) Core(TM) i9-10885H CPU @ 2.40GHz
Memory: 33.34 GB / 63.76 GB
Binaries:
Node: 22.22.1 - C:\nvm4w\nodejs\node.EXE
npm: 11.12.0 - C:\nvm4w\nodejs\npm.CMD
Browsers:
Chrome: 156.0.8078.48
Edge: Chromium (152.0.4191.53)
npmPackages:
@thatopen/components: 3.6.0 => 3.6.0
@thatopen/components-front: 3.6.0 => 3.6.0
@thatopen/fragments: 3.6.0 => 3.6.0
@thatopen/ui: 3.4.17 => 3.4.17
camera-controls: 3.1.2 => 3.1.2
three: 0.184.0 => 0.184.0
web-ifc: 0.0.77 => 0.0.77Used Package Manager 📦
npm
Error Trace/Logs 📃
No response
Validations ✅
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a repository issue and not a framework-specific issue. For example, if it's a THREE.js related bug, it should likely be reported to mrdoob/threejs instead.
- Check that this is a concrete bug. For Q&A join our Community.
- The provided reproduction is a minimal reproducible example of the bug.
Activity