diff options
author | xengineering <mail2xengineering@protonmail.com> | 2021-05-21 15:11:50 +0200 |
---|---|---|
committer | xengineering <mail2xengineering@protonmail.com> | 2021-05-21 15:11:50 +0200 |
commit | aad26e524922d144fd4ed023dc0d60fadb62f253 (patch) | |
tree | 862d5b1b813128f7912504f0261b11cc8eda9941 /stl.go | |
parent | 78a83df3572c7a91dbcbca21d74d8d11170d947c (diff) | |
download | stlscope-aad26e524922d144fd4ed023dc0d60fadb62f253.tar stlscope-aad26e524922d144fd4ed023dc0d60fadb62f253.tar.zst stlscope-aad26e524922d144fd4ed023dc0d60fadb62f253.zip |
First Rendering of an STL Model
Diffstat (limited to 'stl.go')
-rw-r--r-- | stl.go | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -75,3 +75,25 @@ func ParseBinaryStlTriangle(data []byte) *Triangle { // FIXME: This function sh return triangle } +func (stl StlModel) toVertices() []float32 { + + retval := make([]float32, stl.numberOfTriangles * 9) + + for index,triangle := range(stl.surface.triangles) { + + retval[index*9+0] = triangle.a.x + retval[index*9+1] = triangle.a.y + retval[index*9+2] = triangle.a.z + + retval[index*9+3] = triangle.b.x + retval[index*9+4] = triangle.b.y + retval[index*9+5] = triangle.b.z + + retval[index*9+6] = triangle.c.x + retval[index*9+7] = triangle.c.y + retval[index*9+8] = triangle.c.z + + } + + return retval +} |