|
Rendu
A lightweight rendering engine for experimentations
|
Select and sort objects based on visibility and distance criteria. More...
#include <Culler.hpp>
Classes | |
| struct | DistPair |
Public Types | |
| using | List = std::vector< long > |
| Indices of selected objects. | |
Public Member Functions | |
| Culler (const std::vector< Object > &objects) | |
| const List & | cull (const glm::mat4 &view, const glm::mat4 &proj) |
| const List & | cullAndSort (const glm::mat4 &view, const glm::mat4 &proj, const glm::vec3 &pos) |
| void | interface () |
| Culler & | operator= (const Culler &)=delete |
| Culler (const Culler &)=delete | |
| Culler & | operator= (Culler &&)=delete |
| Culler (Culler &&)=delete | |
Private Types | |
| enum class | Ordering { FRONT_TO_BACK , BACK_TO_FRONT } |
| Define ordering of sorted objects. More... | |
Private Attributes | |
| const std::vector< Object > & | _objects |
| Reference to the objects to process. | |
| List | _order |
| Will contain the indices of the objects selected. | |
| std::vector< DistPair > | _distances |
| Intermediate storage for sorting. | |
| Frustum | _frustum |
| Current view frustum. | |
| unsigned long | _maxCount |
| Maximum number of objects to select. | |
| bool | _freezeFrustum = false |
| Should the frustum not be updated. | |
Select and sort objects based on visibility and distance criteria.
This can be used to limit the number of objects drawn based on if they fall inside a camera frustum. Their ordering can also be optimized, for instance to maximize depth rejection or ensure transparent objects are rendered back to front.
|
strongprivate |
| Culler::Culler | ( | const std::vector< Object > & | objects | ) |
Constructor
| objects | the list of objects to process |
|
delete |
Copy constructor (disabled).
|
delete |
Move constructor (disabled).
| const Culler::List & Culler::cull | ( | const glm::mat4 & | view, |
| const glm::mat4 & | proj | ||
| ) |
Detect objects that are inside the view frustum. This returns the indices of the objects that are visible in a list padded to the objects count with -1s.
| view | the view matrix |
| proj | the projection matrix |
| const Culler::List & Culler::cullAndSort | ( | const glm::mat4 & | view, |
| const glm::mat4 & | proj, | ||
| const glm::vec3 & | pos | ||
| ) |
Detect objects that are inside the view frustum and sort them based on their type. This returns the object indices in a list padded to the objects count with -1s.
| view | the view matrix |
| proj | the projection matrix |
| pos | the camera position in world space |
| void Culler::interface | ( | ) |
Display culling options GUI.
Copy assignment operator (disabled).
Move assignment operator (disabled).