
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
geom-builder
Advanced tools
Simplicial-complex-like geometry builder backed by typed arrays.

npm install geom-builder
import createGeomBuilder from "geom-builder";
const builder = createGeomBuilder({ vertexColors: 4, cells: 3 });
builder.addPosition([0, 0, 0]);
builder.addPosition([1, 0, 0]);
builder.addPosition([1, 1, 0]);
builder.addVertexColor([1, 0, 0, 1]);
builder.addVertexColor([0, 1, 0, 1]);
builder.addVertexColor([0, 0, 1, 1]);
builder.addCell([0, 1, 0]);
// or builder.addCell(0, 1, 0)
//builder.count = 3 //vertex count
//builder.indexCount = 3 //indices count
//builder.positions = Float32Array(0, 0, 0, 1, 0, 0, 1, 1, 0, ..,)
//builder.colors = Float32Array(1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, ...)
//builder.cells = Uint16Array(0, 1, 2, ...)
createGeomBuilder(opts): geometryBuilderParameters
Int (default: 32) - preallocated vertex buffer sizeInt (default: 3) - positions attributeInt - enable normals attributeInt - enable uvs attributeInt - enable vertexColors attributeInt - enable cells (indices)Int - enable an arbitrary attributeNote: positions attribute is always enabled and defaults to size 3
Note: attribute names should be plural
Returns
geometryBuilder: { positions: Float32Array, vertexColors: Float32Array, cells: Uint32Array }: each attribute can be enabled by passing an integer e.g.: createGeomBuilder({ positions: 3, vertexColors: 4, cells: 2 }).
Every time we add vertex position, color, etc., the internal buffer size is checked and expanded by doubling its capacity as necessary. Therefore builder.count should be used to determine how many vertices to draw instead of builder.positions.length as not all allocated vertices have to be used. Similarly for meshes with cells builder.cellsIndex should be used instead of builder.cells.length.
All enabled attributes can be accessed by builder.attributeName e.g. builder.vertexColors.
All data methods accept structs or individual components e.g. builder.addPosition(v) or builder.addPosition(v[0], v[1], v[2]).
Reset all the counters to prepare arrays for reuse. Nothing is deallocated.
vec3 - position to addNote: adding a vertex position will increment builder.count counter indicating number of vertices added so far
vec3 - normal to addNote: you need to enable normals in constructor
vec2 - uv texture coord to addNote: you need to enable uvs in constructor
vec4 - vertexColor to addNote: you need to enable vertexColors in constructor
number | vec2 | vec3 - cell (face) with vertex indices to addNote: you need to enable cells in constructor
number | array - any attribute to addNote: you need to enable attributeNames (plural) in constructor to get builder.addAttributeName (singular)
MIT, see LICENSE.md for details.
FAQs
Simplicial-complex-like geometry builder backed by typed arrays.
The npm package geom-builder receives a total of 15 weekly downloads. As such, geom-builder popularity was classified as not popular.
We found that geom-builder demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.