Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef __SP_OPENGL_SHADER_H__
00009 #define __SP_OPENGL_SHADER_H__
00010
00011
00012 #include "Base/spStandard.hpp"
00013
00014 #if defined(SP_COMPILE_WITH_OPENGL) || defined(SP_COMPILE_WITH_OPENGLES2)
00015
00016
00017 #include "RenderSystem/OpenGL/spOpenGLShaderClass.hpp"
00018
00019
00020 namespace sp
00021 {
00022 namespace video
00023 {
00024
00025
00026 class SP_EXPORT OpenGLShader : public Shader
00027 {
00028
00029 public:
00030
00031 OpenGLShader(ShaderClass* Table, const EShaderTypes Type, const EShaderVersions Version);
00032 ~OpenGLShader();
00033
00034
00035
00036 bool compile(
00037 const std::list<io::stringc> &ShaderBuffer, const io::stringc &EntryPoint = "", const c8** CompilerOptions = 0
00038 );
00039
00040 const SShaderConstant* getConstantRef(const io::stringc &Name) const;
00041 const SShaderConstant& getConstant(const io::stringc &Name) const;
00042
00043
00044
00045 bool setConstant(s32 Number, const EConstantTypes Type, const f32 Value);
00046 bool setConstant(s32 Number, const EConstantTypes Type, const f32* Buffer, s32 Count);
00047
00048 bool setConstant(s32 Number, const EConstantTypes Type, const dim::vector3df &Position);
00049 bool setConstant(s32 Number, const EConstantTypes Type, const video::color &Color);
00050 bool setConstant(s32 Number, const EConstantTypes Type, const dim::matrix4f &Matrix);
00051
00052
00053
00054 bool setConstant(const io::stringc &Name, const f32 Value);
00055 bool setConstant(const io::stringc &Name, const f32* Buffer, s32 Count);
00056
00057 bool setConstant(const io::stringc &Name, const s32 Value);
00058 bool setConstant(const io::stringc &Name, const s32* Buffer, s32 Count);
00059
00060 bool setConstant(const io::stringc &Name, const dim::vector3df &Vector);
00061 bool setConstant(const io::stringc &Name, const dim::vector4df &Vector);
00062 bool setConstant(const io::stringc &Name, const video::color &Color);
00063 bool setConstant(const io::stringc &Name, const dim::matrix4f &Matrix);
00064
00065
00066
00067 bool setConstant(const SShaderConstant &Constant, const f32 Value);
00068 bool setConstant(const SShaderConstant &Constant, const f32* Buffer, s32 Count);
00069
00070 bool setConstant(const SShaderConstant &Constant, const s32 Value);
00071 bool setConstant(const SShaderConstant &Constant, const s32* Buffer, s32 Count);
00072
00073 bool setConstant(const SShaderConstant &Constant, const dim::vector3df &Vector);
00074 bool setConstant(const SShaderConstant &Constant, const dim::vector4df &Vector);
00075 bool setConstant(const SShaderConstant &Constant, const video::color &Color);
00076 bool setConstant(const SShaderConstant &Constant, const dim::matrix4f &Matrix);
00077
00078
00079
00080 bool setConstant(const f32* Buffer, s32 StartRegister, s32 ConstAmount);
00081
00082 bool setConstantBuffer(const io::stringc &Name, const void* Buffer);
00083
00084 private:
00085
00086 friend class OpenGLShaderClass;
00087
00088
00089
00090 bool compileGLSL(const std::list<io::stringc> &ShaderBuffer);
00091 bool checkCompilingErrors();
00092
00093 #ifdef SP_COMPILE_WITH_OPENGL
00094 bool compileProgram(const std::list<io::stringc> &ShaderBuffer);
00095 bool checkCompilingErrors(const io::stringc &ShaderName);
00096 #endif
00097
00098 void addShaderConstant(const c8* Name, const GLenum Type, u32 Count, s32 Location);
00099
00100
00101
00102 GLuint ProgramObject_;
00103 GLuint ShaderObject_;
00104 GLuint AsmShaderProgram_;
00105 GLenum AsmShaderType_;
00106
00107 };
00108
00109
00110 }
00111
00112 }
00113
00114
00115 #endif
00116
00117 #endif
00118
00119
00120
00121