Segments is a lightweight line renderer for DOTS tech stack.
It works by creating mesh batches formatted as MeshTopology.Lines
, SystemBase
job system schedules updates with MeshDataArray
. Geometry shader
creates output triangles on the GPU.
Segments.Batch _batch;
void OnEnable () => Segments.Core.CreateBatch( out _batch );
void OnDisable () => _batch.Dispose();
void Update ()
{
_batch.Dependency.Complete();
var buffer = _batch.buffer;
buffer.Length = 3;
Vector3 position = transform.position;
buffer[0] = new float3x2( position , position+transform.right );
buffer[1] = new float3x2( position , position+transform.up );
buffer[2] = new float3x2( position , position+transform.forward );
}
100_000 segments? No problem!
EDIT: Still working on improving this as plotting shapes is not as fast as I wanted
@todo: details
- Unity 2022.2
Entities Graphics
package- Universal Render Pipeline
- mesh wireframe (runtime)
- drawing mesh bounding boxes (runtime)
Select Add package from git URL
from Package Manager
window and pass this address:
https://github.com/andrew-raphael-lukasik/segments.git#upm