Closed mimooh closed 5 years ago
Take a look at https://github.com/xeolabs/xeogl/tree/master/examples/js/models, there are some Model loaders you can use as as starting point. I used the OBJ Loader and modified it for my needs. OBJ needs Positions, Normals and Faces as a bare minimum, so you just have to create the faces using the indices
So I need faces too, ok, thank you for the hint
Since I couldn't find a way to extrude a polygon in xeogl I used an external tool https://github.com/pissang/geometry-extrude which returns the arrays as below (indices, normal, position, uv). The question is can I use this somehow to create xeogl 3D geometries?
boundingRect: {x: 495, y: 415, width: 505, height: 1585} indices: Uint16Array(36) [1, 0, 3, 3, 2, 1, 7, 4, 5, 5, 6, 7, 8, 9, 17, 8, 17, 16, 10, 11, 19, 10, 19, 18, 12, 13, 21, 12, 21, 20, 14, 15, 23, 14, 23, 22] normal: Float32Array(72) [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0] position: Float32Array(72) [495, 2000, 350, 1000, 2000, 350, 1000, 415, 350, 495, 415, 350, 495, 2000, 0, 1000, 2000, 0, 1000, 415, 0, 495, 415, 0, 495, 2000, 350, 1000, 2000, 350, 1000, 2000, 350, 1000, 415, 350, 1000, 415, 350, 495, 415, 350, 495, 415, 350, 495, 2000, 350, 495, 2000, 0, 1000, 2000, 0, 1000, 2000, 0, 1000, 415, 0, 1000, 415, 0, 495, 415, 0, 495, 415, 0, 495, 2000, 0] uv: Float32Array(48) [0, 1, 0.3186119794845581, 1, 0.3186119794845581, 0, 0, 0, 0, 1, 0.3186119794845581, 1, 0.3186119794845581, 0, 0, 0, 0, 0.22082018852233887, 0.3186119794845581, 0.22082018852233887, 0.3186119794845581, 0.22082018852233887, 0.3186119794845581, 0.22082018852233887, 0.3186119794845581, 0.22082018852233887, 0.6372239589691162, 0.22082018852233887, 0.6372239589691162, 0.22082018852233887, 0.6372239589691162, 0.22082018852233887, 0, 0, 0.3186119794845581, 0, 0.3186119794845581, 0, 0.3186119794845581, 0, 0.3186119794845581, 0, 0.6372239589691162, 0, 0.6372239589691162, 0, 0.6372239589691162, 0]