vsg-dev / vsgPoints

VulkanSceneGraph library and example suite for rendering point clouds
MIT License
23 stars 7 forks source link

ArrayState for vsgPoints #23

Closed jamierobertson1 closed 6 months ago

jamierobertson1 commented 6 months ago

I wonder if there should possibly be a new "PositionScaleArrayState" ArrayState added in the main vsg to allow vsgPoints scaled vertices to be calculated back to their local coordinates?

Currently vsg::intersectors skip vsgPoints VertexDraw nodes as the ArrayState doesnt return vertices().

robertosfield commented 6 months ago

A quick reply as I have lots of other work to get on with.

There is the vsg::PositionArrayState, looking the the PositionArrayState::vertexArray(uint32_t instanceIndex) it currently just supports a vec3Array for the position data. Potentially this could be generalized to handle a vec4Array as well and then assume a scale. Alternatively a wholly new PositionScaleArrayState could be written just handle the vec4ArrayState case.

However, neither of this will add support for points into vsg::LineSegmentIntersector as it just handles mesh geometries right now. For supporting points a PolytopeIntersector or similar would need to be written.

I'm not in the position to write these classes at this point but others are welcome to pitch in.

jamierobertson1 commented 6 months ago

Thanks for the reply. I might experiment and try and add this in the coming days.

In the absence of a PolytopeIntersector I previously fudged a vsg::LineSegmentIntersector to work for (non-vsgPoints) point geometries, which just returned the closest points within a radius along a line segment ray.