npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

cube-face-name

1.0.0 • Public • Published

cube-face-name

stable

Gets a human readable name like 'px' or 'py' for the specified index into a 3D cube, intended to be used alongside cube map manipulation in OpenGL applications. The order is the same as in DDS and OpenGL, see below.

Example

var direction = require('cube-face-name')
var range = require('array-range')
 
var images = range(6)
  .map(direction)
  .map(x => 'assets/skyboxes/cloudy-${x}.png')

Result:

[
  'assets/skyboxes/cloudy-px.png',
  'assets/skyboxes/cloudy-nx.png',
  'assets/skyboxes/cloudy-py.png',
  'assets/skyboxes/cloudy-ny.png',
  'assets/skyboxes/cloudy-pz.png',
  'assets/skyboxes/cloudy-nz.png'
]

Usage

NPM

name = cubeFace(slot)

Returns a human-readable name for the given slot in a cube map, using the same ordering as OpenGL and various texture formats: px, nx, py, ny, pz, nz.

slot is between 0 (inclusive) and 6 (exclusive).

See Also

License

MIT, see LICENSE.md for details.

install

npm i cube-face-name

Downloadsweekly downloads

1

version

1.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability