npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@gov.nasa.jpl.honeycomb/terrain-rendering

v0.0.6

Published

Base class for implementing terrain visualization as meshes, points, or voxels.

Readme

terrain

Set of classes and materials to help with visualizing various terrain artifacts.

Use

TODO

API

RenderMode

POINTS

POINTS : 0

Render the terrain as points.

MESH

MESH : 1

Render the terrain as a mesh.

INSTANCE_POINTS

INSTANCE_POINTS : 2

Render the terrain as instanced points.

Terrain

Terrain class for rendering geometry or set of data as a mesh, points, or voxels.

extends SwitchGroup

renderMode

renderMode : RenderMode

An alias for SwitchGroup.active

points

points : Points

Reference to the child used for rendering Points.

mesh

mesh : Mesh

Reference to the child used for rendering Mesh.

instancedPoints

instancedPoints : Mesh

Reference to the child used for rendering Voxels.

constructor

constructor( geometry : BufferGeometry, baseShader : Shader = ShaderLib.phong ) : void

Takes the geometry and shader used to render the meshes.

update

update(  ) : void

Must be called when the geometry changes or data affecting dynamic geometry has changed.

updateGeometry

updateGeometry( geometry : BufferGeometry ) : void

Overrideable function called when dynamic geometry msut be updated.

HeightMapTerrain

Height map base class that defines a plane that can be used for visualizing a height map.

extends Terrain

args

args : ...null

_setGridDimensions

_setGridDimensions( geometry : BufferGeometry, width : Number, height : Number ) : Boolean

Ensures the grid dimensions are set to the given values. If they are not a new plane geometry is created and the old one is discarded. Returns a boolean indicating whether or not the geometry was replaced.

Private function intended to be called internally when implementing Terrain.updateGeometry function.

StructuredPointCloudTerrain

TODO

extends HeightMapTerrain

pointCloudData

pointCloudData : null = null

cameraData

cameraData : null = null

zScale

zScale : null = 1

cellWidth

cellWidth : null = 1

material

material : null = null

RosPointCloudTerrain

TODO

extends Terrain

args

args : ...null

SwitchGroup

Class for toggling visibility of children based on an active flag.

extends Group

active

active : Number = 0

The flag indicating which child is visible.

items

items : null = []

SampledTerrain

Heightmap class that derives and updates the heightmap based on a Sampler2D object.

extends HeightMapTerrain

sampler

sampler : Sampler2D

The Sampler2D object to use when retriving values to position the Z component of the vertices.

resolution

resolution : Number = -1

The sampling resolution to use when genering the number of vertices on each dimension of the heightmap. If set to - 1 then samples will be used to determine the number of verts.

For example 0.1 will sample the map ever 10 cm.

maxSamplesPerDimension

maxSamplesPerDimension : maxSamplesPerDimension = Infinity

The maximum number of samples per dimension of the heightmap. Useful for ensuring the heightmap does not consume too much memory or take too much time to update.

samples

samples : samples = (0, 0)

The number of vertices to generate on X and Y of the heightmap. Only used if #SampledTerrain#resolution is set to -1.

channel

channel : channel = 0

The channel from the Sampler2D to use for the height value.

sampleInWorldFrame

sampleInWorldFrame : sampleInWorldFrame = true

Whether or not to use the Sampler2D.spatialSampleChannel function when sampling the heightmap. Useful for sampling a heightmap that has a spatial offset or sampling a sub portion of the map.

sampleMatrix

sampleMatrix : sampleMatrix

3x3 2D transform matrix for transforming the positon of the xy sample positions. Useful for generating a heightmap that is offset from the origin.

args

args : ...null

getBoundsRotation

getBoundsRotation(  ) : Number

Returns the rotation of the heightmap based on the #SampledTerrain#sampleMatrix.

getBoundsCenter

getBoundsCenter( target : Vector2 ) : void

Returns the center of the heightmap in target based on the #SampledTerrain#sampleMatrix.

getBoundsSize

getBoundsSize( target : Vector2 ) : void

Returns the size of the heightmap in target based on the #SampledTerrain#sampleMatrix.

setBounds

setBounds(
	minX : Number, 
	minY : Number, 
	maxX : Number, 
	maxY : Number, 
	rotation : Number = 0
) : void

Sets the bounds of the heightmap patch to generate.

convertToSampleWorldFrame

convertToSampleWorldFrame(  ) : void

Sets the #SampledTerrain#sampleInWorldFrame field to true and adjusts #SampledTerrain#sampler inverseMatrix so the terrain is sampled in world frame but is visually unchanged.

Other

Generating wNormalMatrix

From the THREEjs Docs, the normal matrix is the "inverse transpose of modelViewMatrix":

const scene = ...;
const material = ...;
const mesh = ...;

// ensure the world matrix is up to date
scene.add(mesh);
mesh.updateMatrixWorld(true);

// generate the normal matrix
material
    .wNormalMatrix
    .copy(mesh.matrixWorld).invert()
    .transpose();