Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Geometry } from 'three/src/core/Geometry';
import { Geometry } from 'three/examples/jsm/deprecated/Geometry.js';

export const mimeType = 'application/vnd.ms-pki.stl';

Expand All @@ -25,11 +25,11 @@ function geometryToData(geometry, binary) {

let dataView;
if (binary) {
const bufferSize = 84 + (50 * faces.length);
const bufferSize = 84 + 50 * faces.length;
const buffer = new ArrayBuffer(bufferSize);
dataView = {
data: new DataView(buffer),
offset: 84
offset: 84,
};

dataView.data.setUint32(80, faces.length, LITTLE_ENDIAN);
Expand All @@ -39,7 +39,7 @@ function geometryToData(geometry, binary) {

const writeVector = binary ? writeVectorBinary : writeVectorAscii;

for (let i = 0; i < faces.length; i ++) {
for (let i = 0; i < faces.length; i++) {
writeVector(dataView, faces[i].normal, true);

if (!binary) {
Expand Down Expand Up @@ -70,7 +70,9 @@ export function fromGeometry(geometry, matrix, binary = true) {
} else if (geometry.isGeometry) {
geometry = geometry.clone();
} else {
throw new Error('Geometry is not an instance of BufferGeometry or Geometry');
throw new Error(
'Geometry is not an instance of BufferGeometry or Geometry'
);
}

if (matrix && matrix.isMatrix4) {
Expand Down