Giter Club home page Giter Club logo

segments's Introduction

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.

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!

@todo: details

Requirements

  • Unity 2020.1
  • Hybrid Renderer (tested with URP, HDRP will require few more lines here and there to be fully compatible)

Samples

  • mesh wireframe (runtime)

  • drawing mesh bounding boxes (runtime)

Installation Unity 2020.x

Add this line in manifest.json / dependencies:

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

Or via Package Manager / Add package from git URL:

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

segments's People

Contributors

andrew-raphael-lukasik avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.