Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
3d-core-raub
Advanced tools
This is a part of Node3D project.
npm i -s 3d-core-raub
Run WebGL code on Node.js.
Note: Since version 4.0.0, three.js is a peer dependency. Please install your version of choise and call
addThreeHelpers
before drawing frames.
Note: this package uses a bunch of N-API addons, which are ABI-compatible across different Node.js versions. Addon binaries are precompiled and there is no compilation step during the
npm i
command.
This module exports 2 methods:
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.
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 TypeScript defenitions for more details.
Example (also see here):
const three = require('three');
const { init, addThreeHelpers } = require('3d-core-raub');
const { doc, gl, requestAnimationFrame } = init({ isGles3: true });
addThreeHelpers(three, gl);
const renderer = new three.WebGLRenderer();
renderer.setPixelRatio( doc.devicePixelRatio );
renderer.setSize( doc.innerWidth, doc.innerHeight );
const camera = new three.PerspectiveCamera(70, doc.innerWidth / doc.innerHeight, 1, 1000);
camera.position.z = 2;
const scene = new three.Scene();
const geometry = new three.BoxGeometry();
const material = new three.MeshBasicMaterial({ color: 0xFACE8D });
const mesh = new three.Mesh( geometry, material );
scene.add(mesh);
doc.addEventListener('resize', () => {
camera.aspect = doc.innerWidth / doc.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(doc.innerWidth, doc.innerHeight);
});
const animate = () => {
requestAnimationFrame(animate);
const time = Date.now();
mesh.rotation.x = time * 0.0005;
mesh.rotation.y = time * 0.001;
renderer.render(scene, camera);
};
animate();
FAQs
An extensible Node3D core for desktop applications
The npm package 3d-core-raub receives a total of 9 weekly downloads. As such, 3d-core-raub popularity was classified as not popular.
We found that 3d-core-raub demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.