Catalog npm
Back to packageRELEASE DETAILS

3.0.0

npm

3d-core-raub

An extensible Node3D core for desktop applications

3dcoreglglfwgraphicsimagenode3dopenglwebglthreethreejsplugin
Published26 Nov 2019
Direct dependencies4
Transitive dependenciesNot calculated

README

Current package documentation

Node.js 3D Core

This is a part of Node3D project.

NPM ESLint Test

npm i -s 3d-core-raub

This package uses pre-compiled Node.js addons. There is no compilation during npm i. The addons are compiled for: Win64, Linux64, Linux ARM64, MacOS ARM64.

Example

  • WebGL/OpenGL on Node.js with support for web libs, such as three.js.
  • Multi-window apps, low-level window control with glfw-raub.
  • Modern OpenGL functions also available, see webgl-raub.
  • Image loading/saving in popular formats with image-raub.

This module exports 2 methods:

  1. export const init: (opts?: TInitOpts) => TCore3D;

    Initialize Node3D. Creates the first window/document and sets up the global environment. This function can be called repeatedly, but will ignore further calls. The return value is cached and will be returned immediately for repeating calls.

  2. export const addThreeHelpers: (three: TUnknownObject, gl: typeof webgl) => void;

    Teaches three.FileLoader.load to work with Node fs. Additionally implements three.Texture.fromId static method to create THREE textures from known GL resource IDs.

See TS declarations for more details.

Example

(As in crate-lean.mjs):

import * as THREE from 'three';

import node3d from '../index.js';
const { init, addThreeHelpers } = node3d;

const { gl, loop, Screen } = init({
	isGles3: true, vsync: true, autoEsc: true, autoFullscreen: true, title: 'Crate',
});
addThreeHelpers(THREE, gl);
const screen = new Screen({ three: THREE, fov: 70, z: 2 });

const texture = new THREE.TextureLoader().load('three/textures/crate.gif');
texture.colorSpace = THREE.SRGBColorSpace;
const geometry = new THREE.BoxGeometry();
const material = new THREE.MeshBasicMaterial({ map: texture });
const mesh = new THREE.Mesh(geometry, material);
screen.scene.add(mesh);

loop((now) => {
	mesh.rotation.x = now * 0.0005;
	mesh.rotation.y = now * 0.001;
	screen.draw();
});

Example Notes:

  1. You can use mjs, tsx or commonjs with require().
  2. loop is a convenience method, you can use requestAnimationFrame too.
  3. autoFullscreen option enables "CTRL+F", "CTRL+SHIFT+F", "CTRL+ALT+F" to switch window modes.
  4. Screen helps with three.js-oriented resource management, but is not required.
  5. three.js uses VAO, so if not using Screen, handling the window mode changes (which creates a separate OpenGL context) is up to you. Basically, doc.on('mode', () => {...}) - here you should re-create THREE.WebGLRenderer.

OpenGL Features

  1. This is real native OpenGL, and you have direct access to GL resource IDs. This may be useful for resource sharing and compute interop (such as CUDA-GL interop).
  2. The flag isGles3 lets you use a GL ES 3 preset, which is closest to "real" WebGL. If set to false, WebGL stuff (such as three.js) will still work, but now with some hacks. However, if you are planning to use non-WebGL features (e.g. OpenGL 4.5 features), you might want it off, and then select a specific context version manually.
  3. The flag isWebGL2 impacts how web libraries recognize the WebGL version. But it doesn't really change the capabilities of the engine.
  4. Offscreen rendering is possible on Windows and Linux, as demonstrated by the tests running in GitHub Actions. There are test cases that generate and compare screenshots, and they do work in headless mode.
  5. OpenGL context sharing is enabled. You can obtain HDC, HWND, CTX for Windows and whatever those are called on Linux and MacOS. See glfw-raub.

License

You get this for free. Have fun!

Some of the components have their separate licenses, but all of them may be used commercially, without royalty.

Downloads & popularity

Awaiting observations

No metric observations yet

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

Declared dependencies 4

Native requirements
4 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
glfw-raub
Environment
{
  "local_name": "glfw-raub",
  "alias": false,
  "peer_metadata": null
}
4.0.0runtime
image-raub
Environment
{
  "local_name": "image-raub",
  "alias": false,
  "peer_metadata": null
}
3.0.0runtime
webgl-raub
Environment
{
  "local_name": "webgl-raub",
  "alias": false,
  "peer_metadata": null
}
2.0.0runtime
threejs-raub
Environment
{
  "local_name": "threejs-raub",
  "alias": false,
  "peer_metadata": null
}
0.110.0runtime

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "a4aacbdc1863c1fbf10726e87911fb3b00d26b04",
  "tarball": "https://registry.npmjs.org/3d-core-raub/-/3d-core-raub-3.0.0.tgz",
  "fileCount": 24,
  "integrity": "sha512-LGAcE7+spV8xakdjy4BNfg26JYAjzz6PflR56kdH4DkS1YqqGocG46lwGlAOOBr1Y+Lb3kWDbsmFe7g3xtQ4mg==",
  "signatures": [
    {
      "sig": "MEQCIAvaMIsoyoNFkwRmDhIljsCz/15Lg8T0xKyLrW8HlRzTAiB7jQ1CFH+ZecZInkiGMbxBa/RdNXv7eYD8Vu1YtlYpYQ==",
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
    }
  ],
  "unpackedSize": 67753,
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd3QhYCRA9TVsSAnZWagAAlpwP/1K32JO8hyvz4N6Ng3qe\nio2CzHCPaxKe5SFtbDwdMj5FiENWl7JIMs3nn3rFeglgIqXeiKsETxLVZzQd\n9R5CKcUJUa8n2RNI2XY/uJW7nCVnr9aFEEI+RYe4bW8SqdZDkJz+BJrB5bdP\n74FzsfDgcNoylubzLhdT91byrXeaIfqFMjonvCnraqVWzElCQXZZNW3VFz3K\nmUvAvlJL48nfGZYuuLAhGKoZUckOmFjVTihx+w7ri/cfLoj5+cAlQCtnB4i+\nSu1IiWZXP9cYIlIZSCZtFPTamuhunpFIdQLO2hzpM24sLA6U/b8QVIOh37pj\n3Uu3IRGNfmFAnbsmIqJriCxcY3l5AM9Y8ntOy34Jr8a1fz/7z7K/zmVB0+Dm\nCvEDGYbsn2ZLxDzfu62J4plp7ItvzE/X4s0aha0WCJLJdZi+P1IAvwi2QBh6\nHW9I0fGGR8Kg4FpXhgxPMxghsAsE2udIcaty1QW8EbOgzpJDpvz2+8AN056W\nPCJXlTQNALjMwsXU87OIpekA9k0AkAsYmW0ai3yafsPiuTVOOcdHL45wdySA\nuJJE9e3o47JcIxeorntM0sbiIdZ7ysLEL25ePl89+lVD9Idh02VSlZb2RdJr\n5Iw9Tx+A3UPop4pDkcefNP1kvQNAWj9DsOo9jt2YYizMfn0sblI5Ep5MVgwd\neSNC\r\n=xIpq\r\n-----END PGP SIGNATURE-----\r\n"
}

Repository

PENDING
node-3d/3d-core-raub

Shared repository data · GitHub

License detected in repository
Not collected

Repository

PENDING
raub/node-3d-ready

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:34 UTC

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

Record identity

package_version:2fb0a740e99bb0be2e72fb4afa19de93495dcfca87282d324e2c8bd8e6d10c86

Other collected versions

5.3.019 Mar5.2.01 Mar5.1.114 Jan5.1.09 Jan5.0.03 Nov4.3.02 JunView all collected versions →