I use drawIndexedPrimitives function to draw points in Metal, but I don't know where should I adjust the point size. In OpenGL ES, I can adjust the point size in the shader: gl_PointSize = 10.0f; How does this work in Metal?
By the way, for draw points from a file, I have a las file(3d point cloud data: a sequential binary format used to store data from sensors and as intermediate processing storage by some applications), and I want to import it to Xcode and render those points using Metal for iOS, anyone knows how to implement with the las file using Metal? Should I transform it to OBJ or PLY before importing it?
Draw points function(swift):
commandEncoder.drawIndexedPrimitives(.Point,
indexCount:indexCount,
indexType:.UInt16,
indexBuffer:indexBuffer,
indexBufferOffset: 0)
I found out that define the point size in the shader.
set up a var in the struct for vertex shader
struct VertexOut{
...
float pointsize[[point_size]];
...}
and set the value for the var:
VertexOut.pointsize = 10.0;
then use the Draw points function in the main code:
commandEncoder.drawIndexedPrimitives(.Point,
indexCount:indexCount,
indexType:.UInt16,
indexBuffer:indexBuffer,
indexBufferOffset: 0)
But still stuck with the las file...don't know how to render it with Metal...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With