Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds functions to triangulation for triangle lists #1044

Open
bvssvni opened this issue May 19, 2016 · 1 comment
Open

Adds functions to triangulation for triangle lists #1044

bvssvni opened this issue May 19, 2016 · 1 comment

Comments

@bvssvni
Copy link
Member

bvssvni commented May 19, 2016

The Graphics trait takes only chunks, which is cumbersome if you have a list of triangles to render. There are some use cases, like doing experimental algorithms in scripting, which requires a simple way to feed the data to the back-end.

Both f64 and f32 precision would be nice.

@echochamber
Copy link
Contributor

@bvssvni From the docs

So currently the trait just takes a closure(Outer) as parameter which takes another closure as a parameter(Inner). Inner takes a slice of i32s, which is a chunk of the tri list. So taking the tri-list as chunks has a function signature like so:

 fn tri_list<F>(&mut self, draw_state: &DrawState, color: &[f32; 4], f: F)
        where F: FnMut(&mut FnMut(&[f32]));
//                │                  └ Inner Closure, each call to it consumes a new chunk of the tri list
//                └ Outer closure, takes inner as a parameter

So what would the function signature look like in what you're describing above?

fn tri_list<F>(&mut self, draw_state: &DrawState, color: &[f32; 4], f: F)
        where F: FnMut(&[f32]);

fn tri_list<F>(&mut self, draw_state: &DrawState, color: &[f32; 4], f: &[f32]) 

fn tri_list<F>(&mut self, draw_state: &DrawState, color: &[f32; 4], tri_list: F)
where F: FnMut() -> i32

Or are you thinking something more like having a tri-list data type that can be passed around that wraps either a reference to the closure a closure that returns chunks of the tri-list?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants