bernhard-42 / three-cad-viewer

A CAD viewer component based on three.js
MIT License
158 stars 28 forks source link

Enhancement: Add XYZ axis labels to the origin axis marker #11

Closed jdegenstein closed 1 year ago

jdegenstein commented 1 year ago

See the original issue here: https://github.com/bernhard-42/vscode-ocp-cad-viewer/issues/13

Probably best to have it here where the actual code resides. Here is my non-working attempt to modify orientation.js which holds the "trihedron"

    const loader = new THREE.FontLoader();
    loader.load('examples/fonts/helvetiker_regular.typeface.json', function ( font ) {
      var textGeometry = new THREE.TextGeometry( "text", {
        font: font,
        size: 50,
        height: 10,
        curveSegments: 12,
        bevelThickness: 1,
        bevelSize: 1,
        bevelEnabled: true
      });
      var textMaterial = new THREE.MeshPhongMaterial( 
        { color: 0xff0000, specular: 0xffffff }
      );
      const textmesh = new THREE.Mesh(textGeometry, textMaterial);
      this.scene.add(textmesh);
bernhard-42 commented 1 year ago

The examples folder is usually not available in the distribution package of threejs. One needs to somehow add them to the codebase. Nevertheless, I will check how to add the font to the my viewer and then try to use the orientation/quaternion trick. Thanks

bernhard-42 commented 1 year ago

for reference: https://components.ai/docs/typefaces/packages

bernhard-42 commented 1 year ago

fixed in 1.8.2