Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|
A compiled vertex+fragment shader program. More...
#include <ShaderProgram.h>
Classes | |
struct | TextureUnit |
Public Types | |
typedef CStrIntern | attrib_id_t |
Public Member Functions | |
~CShaderProgram () override | |
virtual void | Bind (CShaderProgram *previousShaderProgram)=0 |
Binds the shader into the GL context. More... | |
virtual void | Unbind ()=0 |
Unbinds the shader from the GL context. More... | |
virtual TextureUnit | GetTextureUnit (const int32_t bindingSlot)=0 |
virtual void | SetUniform (const int32_t bindingSlot, const float value)=0 |
virtual void | SetUniform (const int32_t bindingSlot, const float valueX, const float valueY)=0 |
virtual void | SetUniform (const int32_t bindingSlot, const float valueX, const float valueY, const float valueZ)=0 |
virtual void | SetUniform (const int32_t bindingSlot, const float valueX, const float valueY, const float valueZ, const float valueW)=0 |
virtual void | SetUniform (const int32_t bindingSlot, PS::span< const float > values)=0 |
virtual void | VertexAttribPointer (const VertexAttributeStream stream, const Format format, const uint32_t offset, const uint32_t stride, const VertexAttributeRate rate, const void *data) |
bool | IsStreamActive (const VertexAttributeStream stream) const |
void | AssertPointersBound () |
Checks that all the required vertex attributes have been set. More... | |
Public Member Functions inherited from Renderer::Backend::IShaderProgram | |
virtual int32_t | GetBindingSlot (const CStrIntern name) const =0 |
virtual std::vector< VfsPath > | GetFileDependencies () const =0 |
Public Member Functions inherited from Renderer::Backend::IDeviceObject< IShaderProgram > | |
virtual | ~IDeviceObject () |
virtual IDevice * | GetDevice ()=0 |
T * | As () |
Static Public Member Functions | |
static std::unique_ptr< CShaderProgram > | Create (CDevice *device, const CStr &name, const CShaderDefines &baseDefines) |
Protected Member Functions | |
CShaderProgram (int streamflags) | |
void | VertexPointer (const Renderer::Backend::Format format, GLsizei stride, const void *pointer) |
void | NormalPointer (const Renderer::Backend::Format format, GLsizei stride, const void *pointer) |
void | ColorPointer (const Renderer::Backend::Format format, GLsizei stride, const void *pointer) |
void | TexCoordPointer (GLenum texture, const Renderer::Backend::Format format, GLsizei stride, const void *pointer) |
void | BindClientStates () |
void | UnbindClientStates () |
Protected Attributes | |
int | m_StreamFlags |
int | m_ValidStreams |
Private Member Functions | |
NONCOPYABLE (CShaderProgram) | |
A compiled vertex+fragment shader program.
The implementation may use GL_ARB_{vertex,fragment}_program (ARB assembly syntax) or GL_ARB_{vertex,fragment}_shader (GLSL), or may use hard-coded fixed-function multitexturing setup code; the difference is hidden from the caller.
Texture/uniform IDs are typically strings, corresponding to the names defined in the shader .xml file. Alternatively (and more efficiently, if used very frequently), call GetBindingSlot and pass its return value as the ID. Setting uniforms that the shader .xml doesn't support is harmless.
For a high-level overview of shaders and materials, see http://trac.wildfiregames.com/wiki/MaterialSystem
|
overridedefault |
|
protected |
void CShaderProgram::AssertPointersBound | ( | ) |
Checks that all the required vertex attributes have been set.
Call this before calling Draw/DrawIndexed etc to avoid potential crashes.
|
pure virtual |
Binds the shader into the GL context.
Call this before calling Uniform() or trying to render with it.
Implemented in Renderer::Backend::GL::CShaderProgramARB, and Renderer::Backend::GL::CShaderProgramGLSL.
|
protected |
|
protected |
|
static |
|
pure virtual |
Implemented in Renderer::Backend::GL::CShaderProgramARB, and Renderer::Backend::GL::CShaderProgramGLSL.
bool CShaderProgram::IsStreamActive | ( | const VertexAttributeStream | stream | ) | const |
|
private |
|
protected |
|
pure virtual |
Implemented in Renderer::Backend::GL::CShaderProgramARB, and Renderer::Backend::GL::CShaderProgramGLSL.
|
pure virtual |
Implemented in Renderer::Backend::GL::CShaderProgramARB, and Renderer::Backend::GL::CShaderProgramGLSL.
|
pure virtual |
Implemented in Renderer::Backend::GL::CShaderProgramARB, and Renderer::Backend::GL::CShaderProgramGLSL.
|
pure virtual |
Implemented in Renderer::Backend::GL::CShaderProgramARB, and Renderer::Backend::GL::CShaderProgramGLSL.
|
pure virtual |
Implemented in Renderer::Backend::GL::CShaderProgramARB, and Renderer::Backend::GL::CShaderProgramGLSL.
|
protected |
|
pure virtual |
Unbinds the shader from the GL context.
Call this after rendering with it.
Implemented in Renderer::Backend::GL::CShaderProgramARB, and Renderer::Backend::GL::CShaderProgramGLSL.
|
protected |
|
virtual |
Reimplemented in Renderer::Backend::GL::CShaderProgramGLSL.
|
protected |
|
protected |
|
protected |