Skip to content

Instantly share code, notes, and snippets.

@jackrusher
jackrusher / stl-reader.clj
Last active November 23, 2018 19:10
A quick hack to load binary STL files using ztellman's gloss and pjstadig's nio library.
(ns stl-reader
(:require [nio.core :as nio])
(:use [gloss core io]))
(defcodec stl-codec
{:header (string :ascii :length 80)
:shape (repeated (ordered-map :normal [:float32-le :float32-le :float32-le]
:v1 [:float32-le :float32-le :float32-le]
:v2 [:float32-le :float32-le :float32-le]
:v3 [:float32-le :float32-le :float32-le]