25 #ifndef CPP3DS_SHADER_HPP
26 #define CPP3DS_SHADER_HPP
31 #include <cpp3ds/OpenGL.hpp>
32 #include <cpp3ds/Graphics/Transform.hpp>
33 #include <cpp3ds/Graphics/Color.hpp>
34 #include <cpp3ds/System/NonCopyable.hpp>
35 #include <cpp3ds/System/Vector2.hpp>
36 #include <cpp3ds/System/Vector3.hpp>
142 bool loadFromFile(
const std::string& vertexShaderFilename,
const std::string& fragmentShaderFilename);
183 bool loadFromMemory(
const std::string& vertexShader,
const std::string& fragmentShader);
185 bool loadBinary(
const Uint8* data,
const Uint32 size,
Type type);
269 void setParameter(
const std::string& name,
float x,
float y);
292 void setParameter(
const std::string& name,
float x,
float y,
float z);
316 void setParameter(
const std::string& name,
float x,
float y,
float z,
float w);
526 bool compile(
const char* vertexShaderCode,
const char* fragmentShaderCode);
535 void bindTextures()
const;
545 int getParamLocation(
const std::string& name);
550 typedef std::map<int, const Texture*> TextureTable;
551 typedef std::map<std::string, int> ParamTable;
556 GLuint m_shaderProgram;
557 int m_currentTexture;
558 TextureTable m_textures;
560 std::vector<char> m_shaderData;
564 shaderProgram_s shader;
Shader class (vertex and fragment)
Special type that can be passed to setParameter, and that represents the texture of the object being ...
unsigned int getNativeHandle() const
Get the underlying OpenGL handle of the shader.
Utility class for manpulating RGBA colors.
void setParameter(const std::string &name, float x)
Change a float parameter of the shader.
static bool isAvailable()
Tell whether or not the system supports shaders.
Shader()
Default constructor.
bool loadFromFile(const std::string &filename, Type type)
Load either the vertex or fragment shader from a file.
static CurrentTextureType CurrentTexture
Represents the texture of the object being drawn.
Utility class that makes any derived class non-copyable.
bool loadFromMemory(const std::string &shader, Type type)
Load either the vertex or fragment shader from a source code in memory.
bool loadFromStream(InputStream &stream, Type type)
Load either the vertex or fragment shader from a custom stream.
static void bind(const Shader *shader)
Bind a shader for rendering.
some things could easily be broken///////