feat: model reconstruction

This commit is contained in:
TrèsAbhi committed 2023-12-08 11:06:56 -06:00
1 parent 610c75d274
commit 6b9bf76da2
4 files changed
+525 -22

No files matched your search

+30 -13
View File
@@ -233,20 +233,37 @@ class SCPGStream {
return { vertices, indices };
});
// writeFileSync(
// 'test.txt',
// polygonGroups
// .map((i) =>
// i.vertices
// .map(
// (e) =>
// `${VertexType[e.type].padEnd(16, ' ')} ${e.value
// .map((j) => j.toString(10).padStart(25, ' '))
// .join(' ')}`,
// )
// .join('\n'),
// )
// .join('\n\n'),
// );
// writeFileSync(
// 'test.json',
// )
writeFileSync(
'test.txt',
polygonGroups
.map((i) =>
i.vertices
.map(
(e) =>
`${VertexType[e.type].padEnd(16, ' ')} ${e.value
.map((j) => j.toString(10).padStart(32, ' '))
.join(' ')}`,
)
.join('\n'),
)
.join('\n\n'),
'test.json',
JSON.stringify(
polygonGroups.map((group) => ({
vertices: group.vertices
.filter(({ type }) => type === VertexType.VERTEX)
.map(({ value }) => value),
indices: group.indices,
})),
),
);
return polygonGroups;