NAP
Public Types | Public Member Functions | List of all members
DepthComparer Class Reference

#include <depthsorter.h>

Public Types

enum  EMode { FrontToBack = 0, BackToFront }
 

Public Member Functions

 DepthComparer (EMode mode, const glm::mat4x4 &viewMatrix)
 
bool operator() (const nap::ComponentInstance *objectA, const nap::ComponentInstance *objectB)
 

Description

Helper class that can sort a list of components back to front or front to back.

Member Enumeration Documentation

◆ EMode

enum EMode
strong
Enumerator
FrontToBack 

Sort front to back.

BackToFront 

Sort back to front.

Constructor & Destructor Documentation

◆ DepthComparer()

DepthComparer ( EMode  mode,
const glm::mat4x4 &  viewMatrix 
)

Default constructor

Parameters
modethe sort mode to use
viewMatrixthe camera location in world space

Member Function Documentation

◆ operator()()

bool operator() ( const nap::ComponentInstance objectA,
const nap::ComponentInstance objectB 
)

Compares location of objectA to objectB based on the current sort mode

Parameters
objectAthe first object to compare against
objectBthe second object to compare against
Returns
if objectA is closer or further away than objectB based on the current sort mode