Game of Ur 0.3.3
This is a computer adaptation of Game of Ur, written in C++ mainly using SDL and OpenGL.
Loading...
Searching...
No Matches
ToyMaker::OpaqueRenderUnit Struct Reference

An object representing a single opaque mesh-material pair, to be rendered this frame. More...

#include <render_stage.hpp>

Public Member Functions

 OpaqueRenderUnit (std::shared_ptr< StaticMesh > meshHandle, std::shared_ptr< Material > materialHandle, glm::mat4 modelMatrix)
 Constructs a new Opaque Render Unit object.
 
bool operator< (const OpaqueRenderUnit &other) const
 Compares this unit to another based on priority.
 
void setSortKey ()
 Method responsible for actually computing this unit's sort key.
 

Public Attributes

std::uint32_t mSortKey {}
 The computed sort key for this object.
 
std::shared_ptr< StaticMeshmMeshHandle
 The mesh handle for this render unit.
 
std::shared_ptr< MaterialmMaterialHandle
 The material handle for this render unit.
 
glm::mat4 mModelMatrix
 The model matrix to apply to this unit.
 

Detailed Description

An object representing a single opaque mesh-material pair, to be rendered this frame.

Its sort key is computed such that render priority looks like this:

Mesh > Material Texture > Material Everything Else

Todo
Maybe there's a better order for opaque queues? Investigate.

Constructor & Destructor Documentation

◆ OpaqueRenderUnit()

ToyMaker::OpaqueRenderUnit::OpaqueRenderUnit ( std::shared_ptr< StaticMesh > meshHandle,
std::shared_ptr< Material > materialHandle,
glm::mat4 modelMatrix )
inline

Constructs a new Opaque Render Unit object.

Parameters
meshHandleHandle to the mesh associated with this unit.
materialHandleHandle to the material associated with this unit.
modelMatrixThis object's model matrix.

Member Function Documentation

◆ operator<()

bool ToyMaker::OpaqueRenderUnit::operator< ( const OpaqueRenderUnit & other) const
inline

Compares this unit to another based on priority.

Parameters
otherThe unit this one is being compared to
Return values
trueThis unit has a lower sort key than the other.
falseThis unit does not have a lower sort key than the other.

The documentation for this struct was generated from the following file: