Gamp v0.0.7-54-gccdc599
Gamp: Graphics, Audio, Multimedia and Processing
Loading...
Searching...
No Matches
gamp::graph::gl::RenderState Class Reference

The RenderState is owned by GraphRenderer. More...

#include <RenderState.hpp>

Collaboration diagram for gamp::graph::gl::RenderState:

Classes

class  ProgramLocal
 Representation of RenderState data per ShaderProgram as GLUniformData. More...
 

Public Member Functions

 RenderState (jau::math::util::PMVMat4f &pmvMat)
 Create a RenderState, a composition of RegionRenderer.
 
constexpr int aaQuality () const noexcept
 Returns pass2 AA-quality rendering value for Graph Region AA render-modes: Region#VBAA_RENDERING_BIT.
 
void clearDebugBits (int mask) noexcept
 
void clearHintBits (int bits) noexcept
 
jau::math::geom::FrustumclipFrustum ()
 Returns the optional Mv-premultiplied clipping Frustum or nullptr if unused.
 
constexpr int debugBits () const noexcept
 
constexpr bool debugBitsSet (int mask) const noexcept
 
void destroy ()
 Only nullifies ShaderProgram reference owned by RegionRenderer.
 
void disableFrustumClipping () noexcept
 
const jau::math::util::PMVMat4fgetMatrix () const noexcept
 
jau::math::util::PMVMat4fgetMatrix () noexcept
 
float getWeight ()
 
constexpr int hintBits () const noexcept
 
constexpr bool hintBitsSet (int bits) const noexcept
 
constexpr int id () const noexcept
 
constexpr bool isShaderProgramInUse () const noexcept
 Return whether the current ShaderProgram is in use.
 
constexpr int sampleCount () const noexcept
 Returns pass2 AA sample count for Graph Region AA render-modes: VBAA_RENDERING_BIT or Region#MSAA_RENDERING_BIT.
 
int setAAQuality (int v)
 Sets pass2 AA-quality rendering value clipped to the range [Region#MIN_AA_QUALITY..Region#MAX_AA_QUALITY] for Graph Region AA render-modes: Region#VBAA_RENDERING_BIT.
 
void setDebugBits (int mask) noexcept
 
void setFrustumClipping (const jau::math::geom::Frustum &clipFrustum) noexcept
 Set the optional clipping Frustum, which shall be pre-multiplied with the Mv-matrix or null to disable.
 
void setHintBits (int bits) noexcept
 
int setSampleCount (int v)
 Sets pass2 AA sample count clipped to the range [Region#MIN_AA_SAMPLE_COUNT..Region#MAX_AA_SAMPLE_COUNT] for Graph Region AA render-modes: VBAA_RENDERING_BIT or Region#MSAA_RENDERING_BIT.
 
bool setShaderProgram (GL &gl, ShaderProgramRef &spNext)
 Sets the current ShaderProgram and enables it.
 
void setWeight (float v)
 
constexpr const ShaderProgramRefshaderProgram () const noexcept
 Return the current ShaderProgram.
 
constexpr ShaderProgramRefshaderProgram () noexcept
 Return the current ShaderProgram.
 
const jau::math::Vec4fstaticColor () const noexcept
 
jau::math::Vec4fstaticColor () noexcept
 
std::string toString ()
 
bool updateAttributeLoc (GL &gl, bool updateLocation, GLArrayData &data, bool throwOnError)
 
bool updateUniformDataLoc (GL &gl, bool updateLocation, bool updateData, GLUniformData &data, bool throwOnError)
 
bool updateUniformLoc (GL &gl, bool updateLocation, GLUniformData &data, bool throwOnError)
 
constexpr bool usesFrustumClipping () const noexcept
 
constexpr float weight () const noexcept
 

Static Public Member Functions

static constexpr int clipAAQuality (int v)
 Returns clipped AA quality value to [MIN_AA_QUALITY..MAX_AA_QUALITY].
 
static constexpr int clipAASampleCount (int v)
 Returns clipped AA sample-count to [MIN_AA_SAMPLE_COUNT..MAX_AA_SAMPLE_COUNT].
 
static bool isWeightValid (float v)
 

Static Public Attributes

static constexpr int BITHINT_BLENDING_ENABLED = 1 << 0
 Bitfield hint, if set stating enabled GL#GL_BLEND, otherwise disabled.
 
static constexpr int BITHINT_GLOBAL_DEPTH_TEST_ENABLED = 1 << 1
 Bitfield hint, if set stating globally enabled GL#GL_DEPTH_TEST, otherwise disabled.
 
static constexpr int DEBUG_LINESTRIP = 1 << 0
 
static constexpr int DEFAULT_AA_QUALITY = MAX_AA_QUALITY
 Default pass2 AA-quality rendering {@value} for Graph Region AA GraphRegion::renderMode(): RenderMode::vbaa.
 
static constexpr int DEFAULT_AA_SAMPLE_COUNT = 4
 Default pass2 AA sample count {@value} for Graph Region AA GraphRegion::renderMode(): RenderMode::vbaa or RenderMode::msaa.
 
static constexpr int MAX_AA_QUALITY = 1
 Maximum pass2 AA-quality rendering {@value} for Graph Region AA GraphRegion::renderMode(): RenderMode::vbaa.
 
static constexpr int MAX_AA_SAMPLE_COUNT = 8
 Maximum pass2 AA sample count {@value} for Graph Region AA GraphRegion::renderMode(): RenderMode::vbaa or RenderMode::msaa.
 
static constexpr int MIN_AA_QUALITY = 0
 Minimum pass2 AA-quality rendering {@value} for Graph Region AA GraphRegion::renderMode(): RenderMode::vbaa.
 
static constexpr int MIN_AA_SAMPLE_COUNT = 1
 Minimum pass2 AA sample count {@value} for Graph Region AA GraphRegion::renderMode(): RenderMode::vbaa or RenderMode::msaa.
 

Detailed Description

The RenderState is owned by GraphRenderer.

It holds rendering state data like jau::math::util::PMVMat4f, viewport, but also the current staticColor().

Definition at line 46 of file RenderState.hpp.

Constructor & Destructor Documentation

◆ RenderState()

gamp::graph::gl::RenderState::RenderState ( jau::math::util::PMVMat4f & pmvMat)
inline

Create a RenderState, a composition of RegionRenderer.

Parameters
pmvMatused PMVMatrix4f, could be shared

Definition at line 207 of file RenderState.hpp.

Here is the caller graph for this function:

Member Function Documentation

◆ clipAAQuality()

static constexpr int gamp::graph::gl::RenderState::clipAAQuality ( int v)
inlinestaticconstexpr

Returns clipped AA quality value to [MIN_AA_QUALITY..MAX_AA_QUALITY].

Definition at line 58 of file RenderState.hpp.

Here is the caller graph for this function:

◆ clipAASampleCount()

static constexpr int gamp::graph::gl::RenderState::clipAASampleCount ( int v)
inlinestaticconstexpr

Returns clipped AA sample-count to [MIN_AA_SAMPLE_COUNT..MAX_AA_SAMPLE_COUNT].

Definition at line 67 of file RenderState.hpp.

Here is the caller graph for this function:

◆ id()

int gamp::graph::gl::RenderState::id ( ) const
inlineconstexprnoexcept

Definition at line 216 of file RenderState.hpp.

◆ shaderProgram() [1/2]

const ShaderProgramRef & gamp::graph::gl::RenderState::shaderProgram ( ) const
inlineconstexprnoexcept

Return the current ShaderProgram.

Definition at line 219 of file RenderState.hpp.

◆ shaderProgram() [2/2]

ShaderProgramRef & gamp::graph::gl::RenderState::shaderProgram ( )
inlineconstexprnoexcept

Return the current ShaderProgram.

Definition at line 221 of file RenderState.hpp.

◆ isShaderProgramInUse()

bool gamp::graph::gl::RenderState::isShaderProgramInUse ( ) const
inlineconstexprnoexcept

Return whether the current ShaderProgram is in use.

Definition at line 224 of file RenderState.hpp.

◆ setShaderProgram()

bool gamp::graph::gl::RenderState::setShaderProgram ( GL & gl,
ShaderProgramRef & spNext )
inline

Sets the current ShaderProgram and enables it.

If the given ShaderProgram is not the current, method returns true, otherwise false.

Parameters
gl
spNextthe next current ShaderProgram to be set and enabled
Returns
true if a new shader program is being used and hence external uniform-data and -location, as well as the attribute-location must be updated, otherwise false.

Definition at line 236 of file RenderState.hpp.

◆ getMatrix() [1/2]

const jau::math::util::PMVMat4f & gamp::graph::gl::RenderState::getMatrix ( ) const
inlinenoexcept

Definition at line 249 of file RenderState.hpp.

◆ getMatrix() [2/2]

jau::math::util::PMVMat4f & gamp::graph::gl::RenderState::getMatrix ( )
inlinenoexcept

Definition at line 250 of file RenderState.hpp.

◆ isWeightValid()

static bool gamp::graph::gl::RenderState::isWeightValid ( float v)
inlinestatic

Definition at line 252 of file RenderState.hpp.

Here is the caller graph for this function:

◆ getWeight()

float gamp::graph::gl::RenderState::getWeight ( )
inline

Definition at line 253 of file RenderState.hpp.

◆ setWeight()

void gamp::graph::gl::RenderState::setWeight ( float v)
inline

Definition at line 254 of file RenderState.hpp.

◆ staticColor() [1/2]

const jau::math::Vec4f & gamp::graph::gl::RenderState::staticColor ( ) const
inlinenoexcept

Definition at line 261 of file RenderState.hpp.

◆ staticColor() [2/2]

jau::math::Vec4f & gamp::graph::gl::RenderState::staticColor ( )
inlinenoexcept

Definition at line 262 of file RenderState.hpp.

◆ weight()

float gamp::graph::gl::RenderState::weight ( ) const
inlineconstexprnoexcept

Definition at line 264 of file RenderState.hpp.

◆ setAAQuality()

int gamp::graph::gl::RenderState::setAAQuality ( int v)
inline

Sets pass2 AA-quality rendering value clipped to the range [Region#MIN_AA_QUALITY..Region#MAX_AA_QUALITY] for Graph Region AA render-modes: Region#VBAA_RENDERING_BIT.

Definition at line 267 of file RenderState.hpp.

◆ aaQuality()

int gamp::graph::gl::RenderState::aaQuality ( ) const
inlineconstexprnoexcept

Returns pass2 AA-quality rendering value for Graph Region AA render-modes: Region#VBAA_RENDERING_BIT.

Definition at line 269 of file RenderState.hpp.

Here is the caller graph for this function:

◆ setSampleCount()

int gamp::graph::gl::RenderState::setSampleCount ( int v)
inline

Sets pass2 AA sample count clipped to the range [Region#MIN_AA_SAMPLE_COUNT..Region#MAX_AA_SAMPLE_COUNT] for Graph Region AA render-modes: VBAA_RENDERING_BIT or Region#MSAA_RENDERING_BIT.

Definition at line 272 of file RenderState.hpp.

◆ sampleCount()

int gamp::graph::gl::RenderState::sampleCount ( ) const
inlineconstexprnoexcept

Returns pass2 AA sample count for Graph Region AA render-modes: VBAA_RENDERING_BIT or Region#MSAA_RENDERING_BIT.

Definition at line 274 of file RenderState.hpp.

Here is the caller graph for this function:

◆ setFrustumClipping()

void gamp::graph::gl::RenderState::setFrustumClipping ( const jau::math::geom::Frustum & clipFrustum)
inlinenoexcept

Set the optional clipping Frustum, which shall be pre-multiplied with the Mv-matrix or null to disable.

Definition at line 277 of file RenderState.hpp.

◆ disableFrustumClipping()

void gamp::graph::gl::RenderState::disableFrustumClipping ( )
inlinenoexcept

Definition at line 281 of file RenderState.hpp.

◆ usesFrustumClipping()

bool gamp::graph::gl::RenderState::usesFrustumClipping ( ) const
inlineconstexprnoexcept

Definition at line 282 of file RenderState.hpp.

◆ clipFrustum()

jau::math::geom::Frustum * gamp::graph::gl::RenderState::clipFrustum ( )
inline

Returns the optional Mv-premultiplied clipping Frustum or nullptr if unused.

Definition at line 285 of file RenderState.hpp.

Here is the caller graph for this function:

◆ hintBits()

int gamp::graph::gl::RenderState::hintBits ( ) const
inlineconstexprnoexcept

Definition at line 287 of file RenderState.hpp.

◆ hintBitsSet()

bool gamp::graph::gl::RenderState::hintBitsSet ( int bits) const
inlineconstexprnoexcept

Definition at line 288 of file RenderState.hpp.

◆ setHintBits()

void gamp::graph::gl::RenderState::setHintBits ( int bits)
inlinenoexcept

Definition at line 289 of file RenderState.hpp.

◆ clearHintBits()

void gamp::graph::gl::RenderState::clearHintBits ( int bits)
inlinenoexcept

Definition at line 290 of file RenderState.hpp.

◆ debugBits()

int gamp::graph::gl::RenderState::debugBits ( ) const
inlineconstexprnoexcept

Definition at line 292 of file RenderState.hpp.

◆ debugBitsSet()

bool gamp::graph::gl::RenderState::debugBitsSet ( int mask) const
inlineconstexprnoexcept

Definition at line 293 of file RenderState.hpp.

◆ setDebugBits()

void gamp::graph::gl::RenderState::setDebugBits ( int mask)
inlinenoexcept

Definition at line 294 of file RenderState.hpp.

◆ clearDebugBits()

void gamp::graph::gl::RenderState::clearDebugBits ( int mask)
inlinenoexcept

Definition at line 295 of file RenderState.hpp.

◆ updateUniformLoc()

bool gamp::graph::gl::RenderState::updateUniformLoc ( GL & gl,
bool updateLocation,
GLUniformData & data,
bool throwOnError )
inline
Parameters
gl
updateLocation
data
throwOnError
Returns
true if no error occured, i.e. all locations found, otherwise false.

Definition at line 305 of file RenderState.hpp.

◆ updateUniformDataLoc()

bool gamp::graph::gl::RenderState::updateUniformDataLoc ( GL & gl,
bool updateLocation,
bool updateData,
GLUniformData & data,
bool throwOnError )
inline
Parameters
gl
updateLocation
updateData
data
throwOnError
Returns
true if no error occured, i.e. all locations found, otherwise false.

Definition at line 327 of file RenderState.hpp.

Here is the caller graph for this function:

◆ updateAttributeLoc()

bool gamp::graph::gl::RenderState::updateAttributeLoc ( GL & gl,
bool updateLocation,
GLArrayData & data,
bool throwOnError )
inline
Parameters
gl
data
throwOnError
Returns
true if no error occured, i.e. all locations found, otherwise false.

Definition at line 350 of file RenderState.hpp.

◆ destroy()

void gamp::graph::gl::RenderState::destroy ( )
inline

Only nullifies ShaderProgram reference owned by RegionRenderer.

Definition at line 366 of file RenderState.hpp.

◆ toString()

std::string gamp::graph::gl::RenderState::toString ( )
inline

Definition at line 370 of file RenderState.hpp.

Member Data Documentation

◆ MIN_AA_QUALITY

int gamp::graph::gl::RenderState::MIN_AA_QUALITY = 0
staticconstexpr

Minimum pass2 AA-quality rendering {@value} for Graph Region AA GraphRegion::renderMode(): RenderMode::vbaa.

Definition at line 52 of file RenderState.hpp.

◆ MAX_AA_QUALITY

int gamp::graph::gl::RenderState::MAX_AA_QUALITY = 1
staticconstexpr

Maximum pass2 AA-quality rendering {@value} for Graph Region AA GraphRegion::renderMode(): RenderMode::vbaa.

Definition at line 54 of file RenderState.hpp.

◆ DEFAULT_AA_QUALITY

int gamp::graph::gl::RenderState::DEFAULT_AA_QUALITY = MAX_AA_QUALITY
staticconstexpr

Default pass2 AA-quality rendering {@value} for Graph Region AA GraphRegion::renderMode(): RenderMode::vbaa.

Definition at line 56 of file RenderState.hpp.

◆ MIN_AA_SAMPLE_COUNT

int gamp::graph::gl::RenderState::MIN_AA_SAMPLE_COUNT = 1
staticconstexpr

Minimum pass2 AA sample count {@value} for Graph Region AA GraphRegion::renderMode(): RenderMode::vbaa or RenderMode::msaa.

Definition at line 61 of file RenderState.hpp.

◆ MAX_AA_SAMPLE_COUNT

int gamp::graph::gl::RenderState::MAX_AA_SAMPLE_COUNT = 8
staticconstexpr

Maximum pass2 AA sample count {@value} for Graph Region AA GraphRegion::renderMode(): RenderMode::vbaa or RenderMode::msaa.

Definition at line 63 of file RenderState.hpp.

◆ DEFAULT_AA_SAMPLE_COUNT

int gamp::graph::gl::RenderState::DEFAULT_AA_SAMPLE_COUNT = 4
staticconstexpr

Default pass2 AA sample count {@value} for Graph Region AA GraphRegion::renderMode(): RenderMode::vbaa or RenderMode::msaa.

Definition at line 65 of file RenderState.hpp.

◆ BITHINT_BLENDING_ENABLED

int gamp::graph::gl::RenderState::BITHINT_BLENDING_ENABLED = 1 << 0
staticconstexpr

Bitfield hint, if set stating enabled GL#GL_BLEND, otherwise disabled.

Shall be set via setHintBits(int) and cleared via clearHintBits(int).

If set, GLRegion's draw-method will set the proper blend-function and the clear-color to transparent-black in case of multipass FBO rendering.

Shall be set by custom code, e.g. via RegionRenderer's enable and disable RegionRenderer.GLCallback as done in RegionRenderer#defaultBlendEnable and RegionRenderer#defaultBlendDisable.

Definition at line 86 of file RenderState.hpp.

◆ BITHINT_GLOBAL_DEPTH_TEST_ENABLED

int gamp::graph::gl::RenderState::BITHINT_GLOBAL_DEPTH_TEST_ENABLED = 1 << 1
staticconstexpr

Bitfield hint, if set stating globally enabled GL#GL_DEPTH_TEST, otherwise disabled.

Shall be set via setHintBits(int) and cleared via clearHintBits(int).

GLRegion's draw-method may toggle depth test, and reset it's state according to this hint.

Shall be set by custom code, e.g. after RenderState or RegionRenderer construction.

Definition at line 102 of file RenderState.hpp.

◆ DEBUG_LINESTRIP

int gamp::graph::gl::RenderState::DEBUG_LINESTRIP = 1 << 0
staticconstexpr

Definition at line 104 of file RenderState.hpp.


The documentation for this class was generated from the following files: