macro_rules! pigeon {
($( $pipe:ty => $name:ident ),* | $($cust_pipe:ty >> $func:ident => $cust_name:ident),* | $($spec_pipe:ty >> $setup:ident => $spec_name:ident),* ) => { ... };
}
Expand description
Macro to create a pigeon, the manager, and various draw functions. the pigoen struct as input.
A default Pigeon
is generated from this in the library, but this marco allows you to extend pigeon with your own pipelines.
Pipelines
Pipelines must implement parrot::Plumber
and crate::pipeline::Render
Usage
The primary use for this is to create an instance of pigeon which contains all the pipelines you specified.
The macro also creates a Container
to contain the Breakdown
generated by the shapes for the pipelines
Finally, it creates the relevent funcitons to append a graphic to the dbg!(container)
you assign each pipeline a “name”, which are what the field names for the pipelines in Pigeon
and the sets of Breakdown
in Container
are called.
You can also use parrot
custom pipeline feature
There are sometimes occurances where you want to handle the preparation and rendering yourself. You can specify a custom prepare function that returns your pipeline and pigeon will call render.
Format
In genral:
pigeon!(PipelineType => name, AnotherPipeline => another_name | CustomPipeline : func_for_pipeline => name, AnotherCustom : func => another_custom_name | SpecialPipeline : setupfn() : prepare)
With just customs:
pigeon!(| CustomPipeline : func_for_pipeline => name, AnotherCustom : func => another_custom_name |)
With just normal
pigeon!(PipelineType => name, AnotherPipeline => another_name | |)
With just specialised
pigeon!(| | SpecPipelineType : setupfn() : preparefn() => name,)
Example
pigeon!(QuadPipe => quad, TrianglePipe => triangle);
This creates a Pigeon and Container with the QuadPipe
and TrianglePipe
pipelines, with the field names quad and triangle.
It also creates the fn draw_quad and draw_triangle to append graphics that breakdown for QuadPipe
and TrianglePipe