Closed flybirdGit closed 1 year ago
I encountered the same issue I guess when I wanted to draw a cube in 3D and finally created a shape based on meshes instead that is defining triangles vertices for each face of the cube (that's 36 vertices for a total of 12 triangles, 2 per face of the cube). Others might know how to use the BoxBuffer instead?
Thanks for your help, so how about using NGL to draw a spatial triangle based on the coordinates of three points, that sounds like a good solution
something like that
cont meshes = [
0, 0, 0, // 1st vertex x, y, z
0, 0, 1, // 2nd vertex
0, 1, 0, // 3rd vertex
// continue with the other triangles
];
const colors = [[1, 0, 0], [1, 0,0], [1,0,0]] // colors for each edge of the first triangle
const shape = new Shape('my triangle', {})
shape.addMesh(meshes, colors)
const comp = stage.addComponentFromObject(shape, {})
comp.addBufferRepresentation(shape)
Thank you again for your help, which solved the problem I was facing perfectly.
I want to generate the corresponding box based on the 8 point coordinates of the cube, but I don't know how to use this data to generate the corresponding NGL.BoxBuffer, especially the meaning of the parameters of this object, postion, size, heightAxis, depthAxis. I need your help.