Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
vim-webgl-viewer
Advanced tools
A high-performance 3D viewer and VIM file loader built on top of Three.JS.
The VIM WebGL Viewer is an open-source high-performance 3D model viewer built on top of the popular Three.JS WebGL framework that specializes in loading extremely large AEC (Architectural/Engineering/Construction) models represented as VIM files.
The VIM WebGL viewer combines the Three.JS library with several common loaders and utilities, to reduce boilerplate code. It can be simply included via script tags or consumed using esm imports.
The VIM file format is a high-performance 3D scene format that supports rich BIM data, and can be easily extended to support other relational or non-relation data sets.
Unlike IFC the VIM format is already tessellated, and ready to render. This results in very fast load times. Unlike glTF the VIM format is faster to load, scales better, and has a consistent structure for relational BIM data.
Virtually the simplest usage of the VIM viewer is the following example:
<html>
<head>
<title>VIM Viewer</title>
</head>
<body>
<script src="https://unpkg.com/three@0.133.1/build/three.min.js"></script>
<script src="https://unpkg.com/vim-webgl-viewer"></script>
<script>
var viewer = new vim.Viewer({
url: 'https://vim.azureedge.net/samples/residence.vim',
object: { rotation: { x: 270 } }
})
</script>
</body>
</html>
npm install
to install all dependenciesnpm run dev
to launch a dev-server and watch for changedocs
- this is the root folder for the GitHub page at https://vimaec.github.io/vim-webgl-viewer
. The docs\index.html
file uses
the latest published default NPM release package (@latest
), while the docs\index-dev.html
uses the latest published dev NPM package (@dev
). Also contains a mustache template and file for generating the various index.html files fromsrc
- contains the TypeScript source code for the viewer and loader.dist
- created by running the build script for creating a
distributable package. It contains three files after running the build
script:
dist\vim-webgl-viewer.es.js
- an EcmaScript moduledist\vim-webgl-viewer.iife.js
- an immediately-invocable function expression (IIFE) intended for consumption from a web-pageindex.html
- an index.html test file that can be used to test the IIFE output locally, before packaging on NPM.npm run dev
npm run build
to build the distribution files.npm run serve-dist
to test the built distribution files locally. Or npm run test-dist
to combine steps 2 and 3.main
branch (the default branch).git status
is cleannpm login
npm run release-dev
to create a pre-release NPM package, and test it on the GitHub pages.After making a pre-release package test it by running npm run test-dev
. This will open https://vimaec.github.io/vim-webgl-viewer/index-dev.html
.
Login to npm if needed using npm login
After creating and validating the pre-release, and assuring main
is checked out, and the git status is clean, run npm run release-patch
.
After making a release package test it by running npm run test-latest
. This will open https://vimaec.github.io/vim-webgl-viewer/index.html
The following scripts are defined in the package.json, and can each be
executed from within VSCode by right-clicking the script name, or from the
command line by writing npm run <script-name>
where <script-name>
is the name of the script.
dev
- launch a dev environment using Vitebuild
- compiles an IIFE JavaScript module and ES module using Vite and the configuration file, placing the output in the dist
folder.bump-dev
- increments the pre-release version of the NPM package, with the id dev
. This will update the package.json
version number with a pre-release tag and number value (e.g. 1.0.0-dev.42). It will also create corresponding tag and commit it to Git.publish-dev
- publishes the current package to NPM with a dev
tag, as opposed to the default tag latest
.serve-docs
- launches a web-server with the docs folder as the root folder, for testing a published NPM packages (tagged develop or latest) locallyserve-dist
: - launches a web-server with the dist folder as the root folder, for testing the built artifacts locally before publishinggen-docs
- Uses mustache to create index.html filestest-latest
- Opens the GitHub page with a test file and using the latest release on NPM.test-dist
- Locally serves the dist
folder for testing before releasing a package.release-patch
- Increments the patch number and publishes an NPM package using the default tag (@latest
). Intended to be called from the main
branch only after the pre-release package has been created and tested.release-dev
- Increments the prerelease number and publishes an NPM prerelease package using the @dev
tag. Intended to be called from the main
branch after the features has been tested and built locally.The distributable file vim-webgl-viewer.iife.js
does not contain the underlying source for Three.JS to avoid duplication. Please include Three.JS on your own.
The viewer is broadly divided into three layer.
Meshes: The scene is rendered using a collection of InstancedMesh, specific object are refered by a (Mesh, instanceIndex) pair.
Nodes: The vim scene is a collection of nodes with a transform and a geometry, each node will result in zero or one object added to Three to be rendered. Nodes are refered by Index.
Elements: objects from the original the bim software containing rich data. Each element can have from 0 to N nodes associated with it. Elements are refered to by Id or Index.
Example:
A table has elementId 12321
it gets exported into 5 nodes, 4 legs and a table top.
the 5 nodes are rendered using 2 meshes, one for the table top, one for all 4 legs.
Frame camera on an element
// If you already have element index from the vim you can skip this line
const elementIndex = viewer.getElementIndexFromId(MY_ELEMENT_ID)
viewer.lookAtElementIndex(elementIndex)
// Optional highlight for your element
// call disposer() to remove highligh
const disposer = viewer.highlightElementByIndex(elementIndex)
FAQs
A high-performance 3D viewer and VIM file loader built on top of Three.JS.
The npm package vim-webgl-viewer receives a total of 237 weekly downloads. As such, vim-webgl-viewer popularity was classified as not popular.
We found that vim-webgl-viewer 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.