source: trunk/src/shader/shader.h @ 832

Last change on this file since 832 was 832, checked in by sam, 8 years ago

shader: factor the uniform handling logic into platform-independent methods
for both OpenGL and the PS3.

File size: 1.1 KB
Line 
1//
2// Lol Engine
3//
4// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
5//   This program is free software; you can redistribute it and/or
6//   modify it under the terms of the Do What The Fuck You Want To
7//   Public License, Version 2, as published by Sam Hocevar. See
8//   http://sam.zoy.org/projects/COPYING.WTFPL for more details.
9//
10
11//
12// The Shader class
13// ----------------
14//
15
16#if !defined __LOL_SHADER_H__
17#define __LOL_SHADER_H__
18
19namespace lol
20{
21
22class ShaderData;
23
24class Shader
25{
26public:
27    static Shader *Create(char const *vert, char const *frag);
28    static void Destroy(Shader *shader);
29
30    int GetAttribLocation(char const *attr) const;
31
32    int GetUniformLocation(char const *uni) const;
33    void SetUniform(int uni, float f);
34    void SetUniform(int uni, vec2 const &v);
35    void SetUniform(int uni, vec3 const &v);
36    void SetUniform(int uni, vec4 const &v);
37    void SetUniform(int uni, mat4 const &m);
38
39    void Bind() const;
40
41protected:
42    Shader(char const *vert, char const *frag);
43    ~Shader();
44
45private:
46    ShaderData *data;
47};
48
49} /* namespace lol */
50
51#endif // __LOL_SHADER_H__
52
Note: See TracBrowser for help on using the repository browser.