Skip to content

andrew-raphael-lukasik/Segments

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Segments is a lightweight line renderer for DOTS tech stack.

This repo is a work in progress so it's not ready for production and expect occasional changes in any of this works (especially since entitties package is changing as well).

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.

Getting started with Segments:

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 );
}

Performance

100_000 segments? No problem!

EDIT: Still working on improving this as plotting shapes is not as fast as I wanted...

@todo: details

Requirements

  • Unity 2022.2
  • Entities Graphics package
  • Universal Render Pipeline

Samples

  • mesh wireframe (runtime)

  • drawing mesh bounding boxes (runtime)

Installation Unity 2022.2

Select Add package from git URL from Package Manager window and pass this address:

https://github.com/andrew-raphael-lukasik/segments.git#upm