Skip to content

Vp::Shader

Base class for shaders. More...

#include "Viewport/shader/Shader.h"

Inherited by Vp::BoxBlurShader, Vp::ScreenOverlayShader, Vp::SelectionCompositeShader, Vp::WBOITCompositeShader, Vp::WorldShader

Public Functions

Name
Shader(GLuint id)
virtual~Shader() =default
voidbindTexture2D(GLuint textureUnit, GLuint textureID, GLint samplerLocation)
voidbindTexture2DMS(GLuint textureUnit, GLuint textureID, GLint samplerLocation)
boolhasUniform(GLint location)
virtual voidinit(bool initSuperclass)
virtual voidsetUniforms()<br>Set uniforms before rendering.
virtual voidsetUniformsPerMeshPart(Core::Mesh::MeshPart & meshPart)<br>Set uniforms before rendering individual mesh parts.
boolsupportsWboit()
virtual voiduse() const

Public Attributes

Name
GLuintm_id
boolm_wboit <br>Whether to use weighted blended transparency for output if supported.
intm_wboitFunc

Protected Attributes

Name
GLintm_wboitFlagId <br>Uniform id of the wboit enable/disable flag.
GLintm_wboitFuncId

Detailed Description

cpp
class Vp::Shader;
class Vp::Shader;

Base class for shaders.

Note that shader objects are just a facade/API for the glsl shaders. They shouldn't store state across frames and should have ALL their variables and uniforms set before each use. However sometimes it makes sense to store values in them. Just be aware that shaders are shared between many objects.

Public Functions Documentation

function Shader

cpp
explicit Shader(
    GLuint id
)
explicit Shader(
    GLuint id
)

function ~Shader

cpp
virtual ~Shader() =default
virtual ~Shader() =default

function bindTexture2D

cpp
void bindTexture2D(
    GLuint textureUnit,
    GLuint textureID,
    GLint samplerLocation
)
void bindTexture2D(
    GLuint textureUnit,
    GLuint textureID,
    GLint samplerLocation
)

function bindTexture2DMS

cpp
void bindTexture2DMS(
    GLuint textureUnit,
    GLuint textureID,
    GLint samplerLocation
)
void bindTexture2DMS(
    GLuint textureUnit,
    GLuint textureID,
    GLint samplerLocation
)

function hasUniform

cpp
bool hasUniform(
    GLint location
)
bool hasUniform(
    GLint location
)

function init

cpp
virtual void init(
    bool initSuperclass
)
virtual void init(
    bool initSuperclass
)

Reimplemented by: Vp::BoxBlurShader::init, Vp::ColorShader::init, Vp::FrustumShader::init, Vp::GridShader::init, Vp::ObjectShader::init, Vp::PhongShader::init, Vp::ScreenOverlayShader::init, Vp::SelectionCompositeShader::init, Vp::WBOITCompositeShader::init, Vp::WorldShader::init

function setUniforms

cpp
virtual void setUniforms()
virtual void setUniforms()

Set uniforms before rendering.

Reimplemented by: Vp::BoxBlurShader::setUniforms, Vp::ColorShader::setUniforms, Vp::FrustumShader::setUniforms, Vp::GridShader::setUniforms, Vp::ObjectShader::setUniforms, Vp::PhongShader::setUniforms, Vp::ScreenOverlayShader::setUniforms, Vp::SelectionCompositeShader::setUniforms, Vp::WBOITCompositeShader::setUniforms, Vp::WorldShader::setUniforms

function setUniformsPerMeshPart

cpp
virtual void setUniformsPerMeshPart(
    Core::Mesh::MeshPart & meshPart
)
virtual void setUniformsPerMeshPart(
    Core::Mesh::MeshPart & meshPart
)

Set uniforms before rendering individual mesh parts.

Parameters:

  • meshPart MeshPart being rendered

Reimplemented by: Vp::PhongShader::setUniformsPerMeshPart

function supportsWboit

cpp
bool supportsWboit()
bool supportsWboit()

Return: Whether this shader supports output to wboit buffers

function use

cpp
virtual void use() const
virtual void use() const

Public Attributes Documentation

variable m_id

cpp
GLuint m_id;
GLuint m_id;

variable m_wboit

cpp
bool m_wboit = false;
bool m_wboit = false;

Whether to use weighted blended transparency for output if supported.

See: supportsWboit()

variable m_wboitFunc

cpp
int m_wboitFunc = 0;
int m_wboitFunc = 0;

Protected Attributes Documentation

variable m_wboitFlagId

cpp
GLint m_wboitFlagId {-1};
GLint m_wboitFlagId {-1};

Uniform id of the wboit enable/disable flag.

variable m_wboitFuncId

cpp
GLint m_wboitFuncId {-1};
GLint m_wboitFuncId {-1};

Updated on 2024-11-06 at 20:16:53 +0000