Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd PBR material type #61
Conversation
alteous
added some commits
Jul 21, 2017
alteous
reviewed
Jul 28, 2017
|
|
||
| bool available(int flag) | ||
| { | ||
| return (u_PbrFlags & flag) == flag; |
This comment has been minimized.
This comment has been minimized.
alteous
Jul 28, 2017
Author
Member
This probably isn't the best strategy for good parallel performance but I'm not sure what else to do.
alteous
reviewed
Jul 28, 2017
| extern crate gltf; | ||
| extern crate three; | ||
|
|
||
| fn load_mesh(mesh: gltf::mesh::Mesh, factory: &mut three::Factory) -> three::Mesh { |
This comment has been minimized.
This comment has been minimized.
alteous
reviewed
Jul 28, 2017
| vertical_wrap_mode: WrapMode, | ||
| ) -> Sampler { | ||
| use gfx::texture::Lod; | ||
| let info = gfx::texture::SamplerInfo { |
This comment has been minimized.
This comment has been minimized.
alteous
Jul 28, 2017
Author
Member
The Lod values were copied from gfx::texture::SamplerInfo::new().
alteous
reviewed
Jul 28, 2017
| shadow_map1: (shadow1.clone(), shadow_sampler.clone()), | ||
| out_color: self.out_color.clone(), | ||
| out_depth: self.out_depth.clone(), | ||
| match *material { |
This comment has been minimized.
This comment has been minimized.
alteous
Jul 28, 2017
Author
Member
This match expression is bloated. It may be worth splitting up the cases in the future.
kvark
approved these changes
Jul 28, 2017
|
This is incredible, great work! |
| }).collect() | ||
| } | ||
| let position_iter = shape.vertices.iter(); | ||
| let normal_iter: Box<Iterator<Item = [gfx::format::I8Norm; 4]>> = { |
This comment has been minimized.
This comment has been minimized.
kvark
Jul 28, 2017
Collaborator
I'd prefer us to avoid Box here, especially wrapping the iterator, since that would mean a virtual dispatch per each iteration...
This comment has been minimized.
This comment has been minimized.
alteous
Jul 28, 2017
•
Author
Member
Would itertools::Either be a good alternative? We would have to rely on the compiler moving the loop condition outside of the loop. There are a lot of branches to consider otherwise.
This comment has been minimized.
This comment has been minimized.
alteous
Jul 28, 2017
Author
Member
So the code would like this:
let position_iter = shape.vertices.iter();
let normal_iter = if shape.normals.is_empty() {
Either::Left(iter::repeat(NORMAL_Z))
} else {
Either::Right(shape.normals.iter().map(...))
};
// etc.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Thanks - glad to be of service! |
This comment has been minimized.
This comment has been minimized.
|
bors r+ |
bors bot
added a commit
that referenced
this pull request
Jul 29, 2017
This comment has been minimized.
This comment has been minimized.
|
Not too shabby for the first PR in this project! Please keep up :) |
This comment has been minimized.
This comment has been minimized.
Build succeeded |
alteous commentedJul 28, 2017
•
edited
This PR implements a physically-based rendering pipeline based on the glTF reference renderer.
There is one example provided, namely
pbr, which should output the following.