Catalog npm
Back to packageRELEASE DETAILS

4.0.0

npm

3d-qml-raub

QML 2D graphics plugin for Node.js 3D Core

3dgraphicsnode3dpluginqmlthreethreejs
Published14 Jan 2025
Direct dependencies9
Transitive dependenciesNot calculated

README

Current package documentation

Node.js 3D QML Helpers

This is a part of Node3D project.

NPM ESLint Test

npm i -s 3d-qml-raub

QML-rendering helpers for Node.js 3D Core. The QML backend is Qt 6.8.0.

Example

Note: IMPORTANT, QML has its own OpenGL context. Make sure to switch back. Use document.makeCurrent() or release() (see exported below).

import * as three from 'three';
import { init, addThreeHelpers } from '3d-core-raub';
import { init as initQml } from '3d-qml-raub';

// Standard Node3D init
const {
	doc, Image: Img, gl,
} = init({
	isGles3: true, isWebGL2: true, autoEsc: true,
});
addThreeHelpers(three, gl);

// Initialize QML and fetch the helpers
const {
	QmlOverlay, Property, Method, View, loop, release, textureFromId,
} = initQml({
	doc, gl, cwd: __dirname, three,
});

It is also possible to run QtQuick examples on Node.js with this renderer. But it will only work with QtQuick components, i.e. not QtMultimedia, QtNetwork, etc. - because those libs are not included. See Dashboard example being copied as a proof of concept.

QmlOverlay

A common use-case is full-screen overlay UI:

// Loads QML and creates all threejs-related resources, e.g. `overlay.mesh` is `THREE.Mesh`
const overlay = new QmlOverlay({ file: `${__dirname}/qml/Test.qml` });
scene.add(overlay.mesh);

// QML property access shortcut
const propTest = new Property<string>({
	view: overlay, name: 'hud', key: 'testProp',
});

// A typed callable example
type TMethodTest = (arg0: number) => void;
const methodTest: TMethodTest = new Method({
	view: overlay, name: 'hud', key: 'testMethod',
});

// Listen to a user-defined event (could be any other name)
overlay.on('custom-event', (event) => {
	release();
	if (event.button === 'test') {
		console.log('test');
	}
	if (event.button === 'quit') {
		process.exit(0)
	}
});

propTest.value = 'test';
methodTest(123);

See examples for more details.

Any Material

Creating a threejs Texture from QML View is also supported. Such textures may be used in arbitrary threejs materials of your choise.

const testView = new View({ file: `${__dirname}/qml/Test.qml` });
const materialTest = new three.SpriteMaterial();

// If the view already has some texture - use it
materialTest.map = textureFromId(testView.textureId, renderer);

// If the view creates a new texture - update the material
testView.on('reset', (textureId) => {
	release();
	materialTest.map = textureFromId(textureId, renderer);
});

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 9

Native requirements
9 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
qml-raub
Environment
{
  "local_name": "qml-raub",
  "alias": false,
  "peer_metadata": null
}
^4.0.0runtime
three
Environment
{
  "local_name": "three",
  "alias": false,
  "peer_metadata": null
}
0.172.0development
eslint
Environment
{
  "local_name": "eslint",
  "alias": false,
  "peer_metadata": null
}
^9.17.0development
@eslint/js
Environment
{
  "local_name": "@eslint/js",
  "alias": false,
  "peer_metadata": null
}
^9.17.0development
pixelmatch
Environment
{
  "local_name": "pixelmatch",
  "alias": false,
  "peer_metadata": null
}
^6.0.0development
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
^5.7.2development
@types/node
Environment
{
  "local_name": "@types/node",
  "alias": false,
  "peer_metadata": null
}
^22.10.5development
3d-core-raub
Environment
{
  "local_name": "3d-core-raub",
  "alias": false,
  "peer_metadata": null
}
^5.1.0development
@types/three
Environment
{
  "local_name": "@types/three",
  "alias": false,
  "peer_metadata": null
}
0.172.0development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "69b5b03e12ae0172475069e3cec02f02c177653e",
  "tarball": "https://registry.npmjs.org/3d-qml-raub/-/3d-qml-raub-4.0.0.tgz",
  "fileCount": 9,
  "integrity": "sha512-9Gn3VPCx2M0SMEvdJ9sHKWLEADzpcrPUBjh5Ed0Ed5Cy7LVWP9iHMTDPUfypHVPjtpaQc9KYcUS5Toq+MzXDfg==",
  "signatures": [
    {
      "sig": "MEUCIFUvwfSqTiR1IV7BoOCbP18fqe2DZMkvxDfIrRjqTIp7AiEAlMMOR2/vasX+m1PSEQDdTk53n5Qobu/TZiOC7emYLa8=",
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
    }
  ],
  "unpackedSize": 14562
}

Repository

PENDING
raub/node-3d-qml

Shared repository data · GitHub

License detected in repository
Not collected

Repository

PENDING
node-3d/3d-qml-raub

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:37 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:407b4b75cbd202bb446d1ed0e643e453631fa44b07c2e15c3a91a4ae899603de

Other collected versions

3.0.015 Nov2.0.16 Jan2.0.027 Nov1.0.020 Feb0.0.329 Apr0.0.225 JanView all collected versions →