Skip to content

Create Three.js 3d objects without div #368

@danielch02

Description

@danielch02

Current Situation

Right now, the only options to create or retrieve Three.js 3D objects are:

1. Using a "dummy" div placed off-screen

  • This dummy element is supplied as a parameter alongside the parsed primitive object.
  • After rendering/redrawing, the objects can be obtained through the framePainter, which holds the Three.js scene object.

Simplified example from our implementation:

this.histogramGroup = new THREE.Group();
this.dummyEl = document.createElement("div");
this.dummyEl.id = "dummyDiv" + id;
document.body.appendChild(this.dummyEl);
draw("dummyDiv" + this.id, this.rootObj, opts).then(retValue => {
  this.histogramGroup.add(this.framePainter.scene);
});

2. Handling the case when no div is set

  • I was able to create 3D objects with this approach, but it didn't really work reliably.

Key Questions

  • Would it be possible to create a method or support functionality where the parameters are:

    • object → the object to draw
    • options → draw options

    …and the return value consists of either a Three.js scene or (preferably) a Three.js group.

  • Could this work universally for TH1/TH2/TH3 objects?

    • If I'm correct, TH1/TH2 are rendered by d3.js by default.
    • But they can be rendered via Three.js either by setting drawWith: "lego" or by enabling mode3d: true on the painter.
  • Would it be possible to support creating 3D objects for all JSROOT primitives?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions