Catalog npm
Back to packageRELEASE DETAILS

2.0.0

npm

3d-qml-raub

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

3dgraphicsnode3dpluginqmlthreethreejs
Published27 Nov 2019
Direct dependencies1
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 1

Native requirements
1 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
qml-raub
Environment
{
  "local_name": "qml-raub",
  "alias": false,
  "peer_metadata": null
}
2.0.0runtime

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "f17630770dd754ca146c42d88139a5264b96e6e9",
  "tarball": "https://registry.npmjs.org/3d-qml-raub/-/3d-qml-raub-2.0.0.tgz",
  "fileCount": 9,
  "integrity": "sha512-XVIXhDtI1ouRSKEbCVlyOTAB+U+9WBbvbF13mb5nd29Dm7srCqodQxcb4OlDxR5CRhvX94Ld4h82MxpyLBEb8Q==",
  "signatures": [
    {
      "sig": "MEUCIEUEoSVmDdG225vhiDubWICArX0nmaG3jFwM7vpeKFv7AiEAoFciGkXmOGvHFTyQi5QiKLcbCr6mBqt9sxPsMiQtIIs=",
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
    }
  ],
  "unpackedSize": 9375,
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd3i/sCRA9TVsSAnZWagAA9bsP/24HyPry1wxLKOfddm1T\nyAcPJ1Rt0grpJrOGdub9ch7T5Gu1a6ZTP7FTeGIHP71547wVvwxuO1wQU4Lt\nKYBx3/JWAn+VmVJcOecO3BPqBSfYdOfXBdKukU018wztF5IWdkuNDxpi5YKu\nwxz9s6gCHHU1nsHaxmLICxdfsH+CCQxexgOWiFXoKmYxGTlAT9MD+sr5cLJv\n9QNd/EIrSmNsQlWDRR1Gtn3Nmc/t8La8njN8dGR+0drJK7BmwHXDrEFqhNw2\nJRGIdsX5ui9bzpyoX6WnOE00aeHAzoC5XP4ONdTK1s+Lr9d7thtTJZHeRRdx\ngPTb43bSyKzwItnUVAhhG6oSICgJ7+69IVxN3DRyLI8LIdDw1+O4IuLrBmVY\njKh/B8U6R/WAauxKjLBtp2V4TFZtAjHvp6H6RCAIrh4jDxU6rwmFqCUzC1O+\nasm6F+pWzASBxt3Hy+n0NxYn4OzjMN790zoqzMNio0u5pRXOqyKM/sRPZWEz\nNFcW8lPW4gz5IbRfkAk/f+KGJUHJYltn1nI3X0a3MPLh6KnNN2We29xjvF4b\na6vVrAOR9nTOFi0FvTqvIBzVifJFYU4n1p3a557nk9RkanyzeG3ydEiW65e6\n0DERVilfi4UfMQoOXfugfClVKFU0rMG7+AJwvaJ8cjyWT50y+9wC5Sc3PCnO\nS8hj\r\n=ZYww\r\n-----END PGP SIGNATURE-----\r\n"
}

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:61398f12bc933dcd506f6f94c041f07e014fa371877825e6ad6dd7faadf40c71

Other collected versions

4.0.014 Jan3.0.015 Nov2.0.16 Jan1.0.020 Feb0.0.329 Apr0.0.225 JanView all collected versions →