UNPKG

marching

Version:

Marching.js is a JavaScript library that compiles GLSL ray marchers.

22 lines (17 loc) 322 B
const emit_int = function( a ) { if( a % 1 !== 0 ) return Math.round( a ) else return a } const IntPrototype = { type: 'int', emit() { return emit_int( this.x ) }, emit_decl() { return "" } } const Int = function( x=0 ) { const f = Object.create( IntPrototype ) f.x = x return f } module.exports = Int