Vesper 0.5.1
Vesper is short form for the Latin word for "Bat", as Vesper is designed to be small, lightweight, and easily handle things like particles and flocking behaviors in accordance with the nature of bats. \n It is meant to be a particle simulation, VFX editor, and CAN be used secondarily as a small game engine.
GitHub | Vesper Updates | Creator
Loading...
Searching...
No Matches
Vesper::Shader Class Referenceabstract

An abstraction for a shader program. More...

#include <Shader.h>

Inheritance diagram for Vesper::Shader:
Vesper::OpenGLShader

Public Member Functions

virtual ~Shader ()=default
virtual void Bind () const =0
 connects the shader program for use.
virtual void Unbind () const =0
 disconnects the shader program.
virtual void SetMat4 (const std::string &name, const glm::mat4 &value)=0
 Sets a 4x4 matrix uniform in the shader.
virtual void SetFloat4 (const std::string &name, const glm::vec4 &value)=0
 Sets a 4-component float vector uniform in the shader.
virtual void SetFloat3 (const std::string &name, const glm::vec3 &value)=0
 Sets a 3-component float vector uniform in the shader.
virtual void SetFloat (const std::string &name, float value)=0
 Sets a single float uniform in the shader.
virtual void SetInt (const std::string &name, int value)=0
 Sets a single integer uniform in the shader.
virtual void SetIntArray (const std::string &name, int *values, uint32_t count)=0
 Sets an array of integers uniform in the shader.
virtual const std::string & GetName () const =0

Static Public Member Functions

static Ref< ShaderCreate (const std::string &name, const std::string &vertexSrc, const std::string &fragmentSrc)
static Ref< ShaderCreate (const std::string &filepath)

Detailed Description

An abstraction for a shader program.

Constructor & Destructor Documentation

◆ ~Shader()

virtual Vesper::Shader::~Shader ( )
virtualdefault

Member Function Documentation

◆ Bind()

virtual void Vesper::Shader::Bind ( ) const
pure virtual

connects the shader program for use.

Implemented in Vesper::OpenGLShader.

◆ Create() [1/2]

Ref< Shader > Vesper::Shader::Create ( const std::string & filepath)
static
10 {
11 switch (Renderer::GetAPI())
12 {
13 case RendererAPI::API::None: VZ_CORE_ASSERT(false, "RendererAPI::None is currently not supported!"); return nullptr;
15 }
16 VZ_CORE_ASSERT(false, "Unknown RendererAPI!");
17 return nullptr;
18 }
#define VZ_CORE_ASSERT(x,...)
Definition Asserts.h:20
@ None
Definition RendererAPI.h:15
@ OpenGL
Definition RendererAPI.h:16
static RendererAPI::API GetAPI()
Retrieves the current rendering API.
Definition Renderer.h:40
constexpr Ref< T > CreateRef(Args &&... args)
Creates a Ref (shared_ptr) for the given type and constructor arguments.
Definition Defines_Macros.h:72

References Vesper::Renderer::GetAPI(), Vesper::RendererAPI::None, and Vesper::RendererAPI::OpenGL.

◆ Create() [2/2]

Ref< Shader > Vesper::Shader::Create ( const std::string & name,
const std::string & vertexSrc,
const std::string & fragmentSrc )
static
21 {
22 switch (Renderer::GetAPI())
23 {
24 case RendererAPI::API::None: VZ_CORE_ASSERT(false, "RendererAPI::None is currently not supported!"); return nullptr;
25 case RendererAPI::API::OpenGL: return CreateRef<OpenGLShader>(name, vertexSrc, fragmentSrc);
26 }
27 VZ_CORE_ASSERT(false, "Unknown RendererAPI!");
28 return nullptr;
29 }

References Vesper::Renderer::GetAPI(), Vesper::RendererAPI::None, and Vesper::RendererAPI::OpenGL.

◆ GetName()

virtual const std::string & Vesper::Shader::GetName ( ) const
pure virtual

Implemented in Vesper::OpenGLShader.

◆ SetFloat()

virtual void Vesper::Shader::SetFloat ( const std::string & name,
float value )
pure virtual

Sets a single float uniform in the shader.

Implemented in Vesper::OpenGLShader.

◆ SetFloat3()

virtual void Vesper::Shader::SetFloat3 ( const std::string & name,
const glm::vec3 & value )
pure virtual

Sets a 3-component float vector uniform in the shader.

Implemented in Vesper::OpenGLShader.

◆ SetFloat4()

virtual void Vesper::Shader::SetFloat4 ( const std::string & name,
const glm::vec4 & value )
pure virtual

Sets a 4-component float vector uniform in the shader.

Implemented in Vesper::OpenGLShader.

◆ SetInt()

virtual void Vesper::Shader::SetInt ( const std::string & name,
int value )
pure virtual

Sets a single integer uniform in the shader.

Implemented in Vesper::OpenGLShader.

◆ SetIntArray()

virtual void Vesper::Shader::SetIntArray ( const std::string & name,
int * values,
uint32_t count )
pure virtual

Sets an array of integers uniform in the shader.

Implemented in Vesper::OpenGLShader.

◆ SetMat4()

virtual void Vesper::Shader::SetMat4 ( const std::string & name,
const glm::mat4 & value )
pure virtual

Sets a 4x4 matrix uniform in the shader.

Implemented in Vesper::OpenGLShader.

◆ Unbind()

virtual void Vesper::Shader::Unbind ( ) const
pure virtual

disconnects the shader program.

Implemented in Vesper::OpenGLShader.


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