Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign uprefactor: Make passes work on Visibility rather than Transparent directly #595
Conversation
jojolepro
requested changes
Mar 6, 2018
A good step towards optimizing that renderer :)
| - for entity in &back_to_front.entities { | ||
| - if let Some(mesh) = mesh.get(*entity) { | ||
| + match visibility { | ||
| + None => for (mesh, material, global) in (&mesh, &material, &global).join() { |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
| - for entity in &back_to_front.entities { | ||
| - if let Some(mesh) = mesh.get(*entity) { | ||
| + match visibility { | ||
| + None => for (entity, mesh, material, global) in |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
| - for entity in &back_to_front.entities { | ||
| - if let Some(mesh) = mesh.get(*entity) { | ||
| + match visibility { | ||
| + None => for (mesh, material, global) in (&mesh, &material, &global).join() { |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
| + camera_distance: centroid.distance2(camera_centroid), | ||
| + from_camera: centroid - camera_centroid, | ||
| + }) | ||
| + .filter(|c| c.from_camera.dot(camera_forward) > 0.), // filter entities behind the camera |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jojolepro
Mar 6, 2018
Collaborator
Doesn't take into account the camera FOV.
If its > 180, you can see behind the camera.
If its < 180, you might not be culling things that could be culled.
If the center of the object is behind the camera, but stretches towards the front of it, it won't be shown and will pop in and out of existence.
jojolepro
Mar 6, 2018
•
Collaborator
Doesn't take into account the camera FOV.
If its > 180, you can see behind the camera.
If its < 180, you might not be culling things that could be culled.
If the center of the object is behind the camera, but stretches towards the front of it, it won't be shown and will pop in and out of existence.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Rhuagh
Mar 6, 2018
Member
This is known, to handle all those cases requires a much larger amount of math, which basically requires bounding volumes etc, which I don't want to add here. This is a system for fast prototyping, and will with 99% likelyhood not be used in larger games.
Rhuagh
Mar 6, 2018
Member
This is known, to handle all those cases requires a much larger amount of math, which basically requires bounding volumes etc, which I don't want to add here. This is a system for fast prototyping, and will with 99% likelyhood not be used in larger games.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Rhuagh
Mar 6, 2018
Member
Note that the Visibility structure can handle those since it has no concept of all that, it's up to the culling system to do all those things. Also note that amethyst-rhusics is likely to have a better implementation for this, since there we can do real frustum culling based on the bounding volumes.
Rhuagh
Mar 6, 2018
•
Member
Note that the Visibility structure can handle those since it has no concept of all that, it's up to the culling system to do all those things. Also note that amethyst-rhusics is likely to have a better implementation for this, since there we can do real frustum culling based on the bounding volumes.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
| + false, | ||
| + mesh_storage.get(mesh), | ||
| + None, | ||
| + &*tex_storage, |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Bors r=torkleyy |
Rhuagh commentedMar 6, 2018
•
edited by torkleyy
Edited 1 time
-
torkleyy
edited Mar 6, 2018 (most recent)
This change is