core

pex-context

2.11.0-2

Context

ctx = createContext(opts)

ctx.set(opts)

Render Loop

ctx.frame(cb)

Commands

Submitting commands to the GPU

ctx.submit(cmd)

ctx.submit(cmd, opts)

ctx.submit(cmd, [opts1, opts2, opts3...])

Subcommands

ctx.submit(cmd, cb)

Resources

Pass

pass = ctx.pass(opts)

Pipeline

pipeline = ctx.pipeline(opts)

Texture

texture = ctx.texture2D(opts)

texture = ctx.textureCube(opts)

Renderbuffer

renderbuffer = ctx.renderbuffer(opts)

Buffer

buffer = ctx.vertexBuffer(opts)

buffer = ctx.indexBuffer(opts)

Query

query = ctx.query(opts)

ctx.beginQuery(q)

ctx.endQuery(q)

Updating resources

ctx.update(res, opts)

Disposing resources

ctx.dispose()

ctx.dispose(res)

Capabilities

ctx.BlendFactor

ctx.CubemapFace

ctx.DataType

ctx.DepthFunc

ctx.Face

ctx.PixelFormat

ctx.Primitive

ctx.Encoding

ctx.Usage

ctx.Wrap

ctx.QueryTarget

ctx.QueryState

License

pex-renderer

3.1.0

Key dependencies:

Renderer

renderer = createRenderer(opts)

renderer.draw()

Entities

entity = renderer.entity(components, tags)

entity = renderer.add(entity, parent)

renderer.remove(entity)

entity.addComponent(component)

component = entity.getComponent(type)

entity.dispose()

Components

Properties shared by all components:

Observing component changes

Update components

component.dispose()

Scene Components

transform = renderer.transform(opts)

camera = renderer.camera(opts)

postProcessing = renderer.postProcessing(opts)

Antialiasing

Screen Space Ambient Occlusion

Depth Of Field

Bloom

Fog

orbiter = renderer.orbiter(opts)

overlay = renderer.overlay(opts)

Geometry Components

geometry = renderer.geometry(opts)

material = renderer.material(opts)

animation = renderer.animation(opts)

morph = renderer.morph(opts)

skin = renderer.skin(opts)

Lighting Components

ambientLight = renderer.ambientLight(opts)

directionalLight = renderer.directionalLight(opts)

areaLight = renderer.areaLight(opts)

spotLight = renderer.spotLight(opts)

skybox = renderer.skybox(opts)

reflectionProbe = renderer.reflectionProbe(opts)

Loaders

scene = renderer.loadScene(url, opts)

Creating Custom Components

License

pex-gl

2.7.0

Usage

API

createGL(width, height)

License

pex-math

3.0.0-4

vec2

vec2.create()

vec2.set(v, w)

vec2.copy(v)

vec2.equals(v, w)

vec2.add(v, w)

vec2.sub(v, w)

vec2.scale(v, s)

vec2.dot(v, w)

vec2.length(v)

vec2.lengthSq(v)

vec2.normalize(v)

vec2.distance(v, w)

vec2.distanceSq(v, w)

vec2.limit(v, s)

vec2.lerp(v, w, t)

vec2.toString(v, precision)

vec3

vec3.create()

vec3.set(v, w)

vec3.copy(v)

vec3.equals(v, w)

vec3.add(v, w)

vec3.addScaled(v, w, s)

vec3.sub(v, w)

vec3.scale(v, s)

vec3.multMat4(v, m)

vec3.multQuat(v, q)

vec3.dot(v, w)

vec3.cross(v, w)

vec3.length(v)

vec3.lengthSq(v)

vec3.normalize(v)

vec3.distance(v, w)

vec3.distanceSq(v, w)

vec3.limit(v, s)

vec3.lerp(v, w, t)

vec3.toString(v, p)

vec4

vec4.create()

vec4.equals(v, w)

vec4.set(v, w)

vec4.fromVec3(v, v3)

vec4.multMat4(v, m)

vec4.copy(v)

vec4.scale(v, s)

mat2x3

mat2x3.create()

mat2x3.set(m, n)

mat2x3.identity(m)

mat2x3.mult(m, n)

mat2x3.translate(m, v)

mat2x3.rotate(m, r)

mat2x3.scale(m, v)

mat3

mat3.create()

mat3.set(m, n)

mat3.identity(m)

mat3.mult(m, n)

mat3.equals(m, n)

mat3.fromMat2x3(m, m2x3)

mat3.fromMat4(m, m4)

mat3.fromQuat(m, q)

mat4

mat4.create()

mat4.set(m, n)

mat4.equals(m, n)

mat4.copy(m)

mat4.mult(m, n)

mat4.invert(m)

mat4.tranpose(m)

mat4.identity(m)

mat4.scale(m, v)

mat4.translate(m, v)

mat4.rotate(m, r, v)

mat4.frustum(m, left, right, bottom, top, near, far)

mat4.perspective(m, fovy, aspectRatio, near, far)

mat4.ortho(m, left, right, bottom, top, near, far)

mat4.lookAt(m, from, to, up)

mat4.fromQuat(m, q)

mat4.fromMat3(m, m3)

mat4.fromTranslationRotationScale(m, t, r, s)

quat

quat.create()

quat.equals(q, p)

quat.identity(q)

quat.copy(q)

quat.set(q, p)

quat.mult(q, p)

quat.invert(q)

quat.conjugate(q)

quat.length(q)

quat.normalize(q)

quat.dot(q, p)

quat.fromEuler(q, euler)

quat.fromAxisAngle(q, axis, angle)

quat.fromAxes(q, xAxis, yAxis, zAxis)

quat.fromMat3(q, m)

quat.fromMat4(q, m)

quat.slerp(q, p, t)

quat.fromTo(q, from, to, up)

euler

euler.create()

euler.fromQuat(e, q)

utils

utils.lerp(a, b, t)

utils.clamp(a, min, max)

utils.smoothstep(a, min, max)

utils.map(a, inStart, inEnd, outStart, outEnd)

toRadians(degrees)

toDegrees(radians)

fraction(a)

sign(a)

sign(a)

isPowerOfTwo(a)

nextPowerOfTwo(a)

pex-color

1.1.1

color

color = require('pex-color')

color.copy(c, out)

color.create(r, g, b, a)

color.fromHSL(h, s, l, a)

color.fromHSV(h, s, v, a)

color.fromHex(hex)

color.fromLab(l, a, b)

color.fromRGB(r, g, b, a)

color.fromRGBBytes(bytes)

color.fromXYZ(x, y, z)

color.getHSL(c)

color.getHSV(c)

color.getHex(c)

color.getLab(c)

color.getRGBBytes(c, out)

color.getXYZ(c)

color.lerp(a, b, t)

color.set(color, r, g, b, a)

color.setHSL(c, h, s, l, a)

color.setHSV(c, h, s, v, a)

color.setHex(c, hex)

color.setLab(c, l, a, b)

color.setRGB(c, r, g, b, a)

color.setXYZ(c, x, y, z)

pex-random

1.0.1

pex-io

2.1.0

Usage

Async

API

io.load(resources, callback)

io.loadBinary(url, callback)

io.loadImage(url, callback)

io.loadJSON(url, callback)

io.loadText(url, callback)

pex-cam

2.8.0

Perspective Camera

cam = createPerspectiveCamera(opts)

cam.set(opts)

cam.getViewRay(x, y, windowWidth, windowHeight)

cam.getWorldRay(x, y, windowWidth, windowHeight)

Orbiter

orbiter = createOrbiter(opts)

orbiter.set(opts)

License

pex-gui

2.4.0

Usage

API

GUI

gui = createGUI(ctx [, options])

gui.draw()

gui.addTab(title)

gui.addColumn(title)

gui.addSeparator()

gui.addParam(title, object, propName, [, opts, onChange])

gui.addButton(title, onClick)

gui.addRadioList(title, object, index, items, onChange)

gui.addTexture2D(title, texture)

gui.addTexture2DList(title, object, index, items, itemsPerRow, onChange)

gui.addTextureCube(title, texture, options)

gui.addFPSMeeter()

gui.setEnabled(state)

gui.isEnabled()

gui.toggleEnabled()

gui.serialize()

gui.deserialize(data)

gui.dispose()

License

pex-geom

2.0.2

aabb

aabb.create()

aabb.set(a, b)

aabb.copy(a)

aabb.fromPoints(aa)

aabb.center(a, out)

aabb.size(a, out)

aabb.isEmpty(a)

aabb.includeAABB(a, b)

aabb.includePoint(a, v)

rect

rect.create()

rect.zero()

rect.copy(r)

rect.set(r, c)

rect.scale(r, s)

rect.setSize(r, wh)

rect.getSize(r, out)

rect.getAspectRatio(r)

rect.setPosition(r, v)

rect.getCenter(r, out)

rect.containsPoint(r, v)

rect.containsRect(r, c)

rect.includePoint(r, v)

rect.includePoints(r, vv)

rect.includePoints(r, vv)

rect.includeRect(r, c)

rect.includeRects(r, cc)

rect.mapPoint(r, v)

rect.clampPoint(r, v)

rect.setEmpty(r)

rect.isEmpty(r)

rect.createFromPoints(vv)

plane

plane.create()

plane.getRayIntersection(p, r, out)

plane.side(p, v)

ray

ray.create()

ray.hitTestTriangle(r, t, out)

ray.hitTestPlane(r, v, n, out)

ray.intersectAABB(r, a)

geom/primitives

primitive-geometry

dmnsgn2.9.0

Installation

Features

Usage

API

Modules

Typedefs

index

annulus

annulus([options]) ⇒

annulus~AnnulusOptions :

box

box([options]) ⇒

box~BoxOptions :

capsule

capsule([options]) ⇒

capsule~CapsuleOptions :

circle

circle([options]) ⇒

circle~CircleOptions :

cone

cone([options]) ⇒

cone~ConeOptions :

cube

cube([options]) ⇒

cube~CubeOptions :

cylinder

cylinder([options]) ⇒

cylinder~CylinderOptions :

disc

disc([options]) ⇒

disc~DiscOptions :

ellipse

ellipse([options]) ⇒

ellipse~EllipseOptions :

ellipsoid

ellipsoid([options]) ⇒

ellipsoid~EllipsoidOptions :

icosahedron

icosahedron([options]) ⇒

icosahedron~IcosahedronOptions :

icosphere

icosphere([options]) ⇒

icosphere~IcosphereOptions :

mappings

plane

plane([options]) ⇒

plane~PlaneOptions :

plane~PlaneDirection :

quad

quad([options]) ⇒

quad~QuadOptions :

reuleux

reuleux([options]) ⇒

reuleux~ReuleuxOptions :

roundedCube

roundedCube([options]) ⇒

roundedCube~RoundedCubeOptions :

roundedRectangle

roundedRectangle([options]) ⇒

roundedRectangle~RoundedCubeOptions :

sphere

sphere([options]) ⇒

sphere~SphereOptions :

squircle

squircle([options]) ⇒

squircle~SquircleOptions :

stadium

stadium([options]) ⇒

stadium~StadiumOptions :

superellipse

superellipse([options]) ⇒

superellipse~SuperellipseOptions :

tetrahedron

tetrahedron([options]) ⇒

tetrahedron~TetrahedronOptions :

torus

torus([options]) ⇒

torus~TorusOptions :

utils

utils.TAU :

utils.HALF_PI :

utils.SQRT2 :

utils.getCellsTypedArray ⇒

utils.normalize(v) ⇒

utils.checkArguments(...args)

utils.setTypedArrayType(type)

BasicSimplicialComplex :

SimplicialComplex :

License

primitive-box

vorg1.0.0

Usage

mesh = createBox([sx, sy, sz])

Example

Demo

License

primitive-capsule

vorg3.0.1

Usage

mesh = createCapsule([r, h, numSubdivisionsHeight, numSegments])

Example

Demo

Credits

License

primitive-circle

vorg1.0.2

Usage

API

createCircle(r, segments)

License

primitive-cylinder

ataber1.0.3

Example

Usage

mesh = cylinder(radiusTop, radiusBottom, height, radialSegments, heightSegments)

Contributing

Credits

License

primitive-cube

vorg2.0.1

Usage

mesh = createCube([sx, sy, sz, nx, ny, nz])

Example

Demo

License

primitive-icosphere

mattdesl1.0.2

Example

Usage

mesh = sphere(radius, [opt])

License

primitive-plane

vorg2.0.1

Usage

mesh = createPlane([sx, sy, nx, ny, options])

Example

Demo

License

primitive-quad

mattdesl2.0.0

Example

Usage

mesh = quad([scale])

License

primitive-rounded-cube

vorg1.0.2

Usage

mesh = createRoundedCube([sx, sy, sz, nx, ny, nz, r])

Example

Demo

License

primitive-sphere

mattdesl3.0.0

Example

Usage

mesh = sphere(radius, [opt])

See Also

License

primitive-torus

mattdesl1.0.4

Example

Usage

mesh = torus([opt])

Credits

License

primitive-ellipsoid

dmnsgn2.1.0

Installation

Usage

API

Functions

Typedefs

createEllipsoid(radius, [options]) ⇒

vec3 :

Options :

SimplicialComplex :

License

primitive-octasphere

dmnsgn1.1.0

Installation

Usage

API

Functions

Typedefs

createOctasphere([options]) ⇒

vec2 :

vec3 :

OctasphereOptions :

SimplicialComplex :

License

geo-arc

mikkoh1.1.2

Usage

Example

License

geom/3d

geom-builder

vorg2.1.0

Running the example

GeomBuilder

builder = createGeomBuilder(opts)

Adding vertex and index data

builder.reset()

builder.addPosition(pos)

builder.addColor(color)

builder.addNormal(normal)

builder.addUV(uv)

builder.addCell(cell)

License

geom-center-and-normalize

vorg1.0.3

Usage

normalizedPositions = centerAndNormalize(positions)

Example

License

geom-edges

vorg1.2.0

Usage

edges(faces | geometry)

Example

License

geom-half-edge

vorg0.0.2

Install

Usage

License

geom-merge

vorg1.0.2

Usage

API

merge(geometries)

License

geom-normals

vorg1.0.1

Usage

API

normals(positions, cells, [out])

License

geom-split-vertices

vorg1.0.0

Usage

API

splitVertices(geometry)

License

geom-revolve

vorg1.0.4

Usage

revolve(path, [numSteps, rotation])

Example

Demo

License

geom-sweep

vorg0.3.1

Usage

API

sweep(path, shape, opts)

License

geom-triangulate

vorg1.0.1

Usage

triangulate(faces | geometry)

Example

License

spline-points

vorg0.2.1

Running the example

smoothPoints = splinePoints(points, opts)

License

latlon-to-xyz

vorg1.0.1

Usage

API

latLonToXyz(lat, lon, [out])

License

xyz-to-latlon

vorg1.0.2

Usage

API

xyzToLatLon(normalizedPosition, [out])

License

ray-geom-intersections

nicknikolov1.0.1

Installation

Usage

License

frenet-serret-frames

dmnsgn2.1.0

Installation

Usage

API

Functions

Typedefs

frenetSerretFrames(points, tangents, [options]) ⇒

vec3 :

Options :

Frame :

License

path-tangents

dmnsgn2.1.0

Installation

Usage

API

Functions

Typedefs

pathTangents(path, [isClosed]) ⇒

vec3 :

License

vector-field

dmnsgn2.1.0

Installation

Usage

API

Classes

Typedefs

VectorField

new VectorField(directionFn, [steps], [bounds])

vectorField.update()

vectorField.lookup(cell) ⇒

vec3 :

VectorFieldCell :

VectorFieldDirectionFn :

License

geom/2d

hammersley

vorg1.0.0

Usage

hammersley(i, n)

Example

See also

License

fit-rect

vorg1.0.3

Usage

fitRect(rect, target, mode)

License

perspective-grid

dmnsgn3.0.1

Installation

Usage

API

Modules

LineEquation

LineEquation ⏏

new LineEquation(lineParams, x)

lineEquation.intersect(equation) ⇒

LineType

LineType ⏏

MathHelper

MathHelper.EPSILON :

MathHelper.PI :

MathHelper.TWO_PI :

MathHelper.getDistance(point1, point2) ⇒

MathHelper.getConvergencePoint(m1, c1, m2, c2) ⇒

MathHelper.getVerticalConvergence(x, m, c) ⇒

MathHelper.getLineParams(x1, y1, x2, y2) ⇒

MathHelper.getParallelLine(line, point) ⇒

MathHelper.getDistanceToLine(line, point) ⇒

MathHelper.getProjectedPoint(line, point) ⇒

MathHelper.getMassCenter(p1, p2, p3, p4) ⇒

PerspectiveGrid

PerspectiveGrid ⏏

new PerspectiveGrid(units, [squares])

perspectiveGrid.init(tl, tr, br, bl)

perspectiveGrid.draw(context)

perspectiveGrid.update()

perspectiveGrid.getQuadAt(column, row) ⇒

perspectiveGrid.getCenterAt(column, row) ⇒

perspectiveGrid.drawLines(context)

perspectiveGrid.drawSquares(context)

perspectiveGrid.drawPoint(context, point, radius, color)

perspectiveGrid._getHorizon(vVanishing, hVanishing) ⇒

Point

Point ⏏

new Point(x, y)

point.isInList(list) ⇒

Segment

Segment ⏏

new Segment(p1, p1)

segment.intersect(segment) ⇒

License

grid-cells

vorg2.0.0

Usage

grid(width, height, numCellsX, numCellsY, margin)

Example

License

algo/3d

space-colonization

nicknikolov0.2.0

Usage

iterate = space-colonization(opts)

License

spatial-index

vorg1.0.2

API

index = spatialIndex(points, metric, dimensions, accuracy)

index.getUniquePoints()

index.nearestPoint(p)

index.includePoint(p)

index.indexOf(p)

canvas

canvas-context

dmnsgn3.2.0

Installation

Usage

API

Modules

Typedefs

createCanvasContext

createCanvasContext([contextType], [options]) ⇒

ContextType :

CanvasContextOptions :

CanvasContextReturnValue :

License

canvas-pattern

dmnsgn1.0.1

Installation

Usage

API

Modules

Typedefs

canvasPattern

canvasPattern(context, source, [options]) ⇒

CanvasPatternRepetition :

CanvasPatternOptions :

License

canvas-record

dmnsgn3.1.0

Installation

Usage

API

Modules

Typedefs

canvasRecord

canvasRecord(canvas, [options]) ⇒

canvasRecord~filename

canvasRecord~stream

canvasRecord~recorder

canvasRecord~start([timeslice])

canvasRecord~step()

canvasRecord~stop() ⇒

canvasRecord~dispose()

CanvasRecordOptions :

License

canvas-screenshot

dmnsgn4.1.0

Installation

Usage

API

Modules

Typedefs

canvasScreenshot

canvasScreenshot(canvas, [options]) ⇒

CanvasScreenshotOptions :

License

canvas-thumbnail-cache

dmnsgn2.1.1

Installation

Usage

API

Classes

Typedefs

CanvasThumbnailCache

new CanvasThumbnailCache([options])

canvasThumbnailCache.reset()

canvasThumbnailCache.add(key, source) ⇒

canvasThumbnailCache.get(key) ⇒

canvasThumbnailCache.remove(key)

Slot :

Options :

License

canvas-tint-image

dmnsgn2.1.0

Installation

Usage

API

canvasTintImage(image, color, [opacity]) ⇒

License

math

interpolate-angle

vorg1.0.2

Usage

interpolateAngle(from, to, t)

License

interpolate-arrays

vorg1.0.4

Usage

interpolateArrays(arraysList, t[, out])

License

concat-typed-array

dmnsgn2.1.0

Installation

Usage

API

concatTypedArray

concatTypedArray(ResultConstructor, ...arrays) ⇒

License

interleave-typed-array

dmnsgn1.1.0

Installation

Usage

API

interleaveTypedArray

interleaveTypedArray(ResultConstructor, elements, ...arrays) ⇒

License

eases

mattdesl1.0.8

Usage

v = ease(t)

License

lerp

mattdesl1.0.3

Usage

License

eerp

dmnsgn1.0.0

Installation

Usage

API

eerp

eerp(a, b, t) ⇒

License

color

cosine-gradient

vorg0.3.0

Usage

cosineGradient(scheme)

Example

Credits

License

io

parse-dds

mattdesl1.2.1

Example

Install

Usage

dds = parse(arrayBuffer)

See Also

License

parse-hdr

vorg1.0.0

Usage

hdrInfo = parseHDR(buffer)

Example

License

geom-parse-obj

vorg1.0.0

Usage

parseObj(str)

Example

See also

License

geom-export-obj

dmnsgn1.1.0

Installation

Usage

API

Modules

Typedefs

geomExportObj

geomExportObj(geometries, [options]) ⇒

geomExportObj~parse(geometry, [offsets], [defaultName]) ⇒

SimplicialComplex :

GeomExportObjOffsets :

GeomExportObjOptions :

GeomExportObjReturnValue :

License

glsl

glsl-conditionals

dmnsgn2.0.1

Installation

Usage

ESM

glslify

License

glsl-constants

dmnsgn2.0.0

Installation

Usage

ESM

glslify

License

glsl-rotate

dmnsgn2.0.0

Installation

Usage

ESM

glslify

License

glsl-smaa

dmnsgn2.0.0

Installation

Usage

Attributes

Uniforms and defines

edges.vert

edges-<edge-detection-method>.frag

luma-edges.frag

color-edges.frag

depth-edges.frag

smaa-weights.(vert|frag)

smaa-blend.(vert|frag)

License

glsl-tone-map

dmnsgn2.0.1

Installation

Usage

ESM

glslify

License

sys

raf-perf

dmnsgn2.1.0

Installation

Usage

API

Classes

Typedefs

RafPerf

new RafPerf([options])

rafPerf.start()

rafPerf.tick()

rafPerf.stop()

"perf"

"tick"

Options :

OptionsPerformances :

License

is-browser

forbeslindesay2.1.0

API

License

is-plask

vorg1.1.1

Usage

License

is-electron-renderer

jprichardson2.0.1

Why?

Use Cases:

Why Use a One Line Module?

Install

Usage

API

License

is-mobile

juliangruber3.1.1

Example

API

mobile({ [ua], [tablet], [featureDetect] })

Installation

Kudos

License

tutorials

pex-examples

1.0.0-alpha.1

How to run the examples in the browser?

pragmatic-pbr