How to use the @jscad/io-utils.BinaryReader function in @jscad/io-utils

To help you get started, we’ve selected a few @jscad/io-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jscad / OpenJSCAD.org / packages / io / stl-deserializer / index.js View on Github external
function deserializeBinarySTL (stl, filename, version, elementFormatter, debug = false) {
  // -- This makes more sense if you read http://en.wikipedia.org/wiki/STL_(file_format)#Binary_STL
  let vertices = []
  let triangles = []
  let normals = []
  let colors = []
  let converted = 0
  let vertexIndex = 0
  let err = 0
  let mcolor = null
  let umask = parseInt('01000000000000000', 2)
  let rmask = parseInt('00000000000011111', 2)
  let gmask = parseInt('00000001111100000', 2)
  let bmask = parseInt('00111110000000000', 2)
  let br = new BinaryReader(stl)

  let m = 0
  let c = 0
  let r = 0
  let g = 0
  let b = 0
  let a = 0
  for (let i = 0; i < 80; i++) {
    switch (m) {
      case 6:
        r = br.readUInt8()
        m += 1
        continue
      case 7:
        g = br.readUInt8()
        m += 1
github jscad / io / packages / stl-deserializer / index.js View on Github external
function deserializeBinarySTL (stl, filename, version, elementFormatter, debug = false) {
  // -- This makes more sense if you read http://en.wikipedia.org/wiki/STL_(file_format)#Binary_STL
  let vertices = []
  let triangles = []
  let normals = []
  let colors = []
  let converted = 0
  let vertexIndex = 0
  let err = 0
  let mcolor = null
  let umask = parseInt('01000000000000000', 2)
  let rmask = parseInt('00000000000011111', 2)
  let gmask = parseInt('00000001111100000', 2)
  let bmask = parseInt('00111110000000000', 2)
  let br = new BinaryReader(stl)

  let m = 0
  let c = 0
  let r = 0
  let g = 0
  let b = 0
  let a = 0
  for (let i = 0; i < 80; i++) {
    switch (m) {
      case 6:
        r = br.readUInt8()
        m += 1
        continue
      case 7:
        g = br.readUInt8()
        m += 1

@jscad/io-utils

Utilities for JSCAD IO Packages

MIT
Latest version published 1 month ago

Package Health Score

87 / 100
Full package analysis