2
* Copyright 2010 Inalogic Inc.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU Lesser General Public License version 3, as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranties of
10
* MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
11
* PURPOSE. See the applicable version of the GNU Lesser General Public
12
* License for more details.
14
* You should have received a copy of both the GNU Lesser General Public
15
* License version 3 along with this program. If not, see
16
* <http://www.gnu.org/licenses/>
18
* Authored by: Jay Taoko <jay.taoko_AT_gmail_DOT_com>
23
#ifndef IOPENGLASMSHADER_H
24
#define IOPENGLASMSHADER_H
30
VTXATTRIB_INVALID = -1,
31
VTXATTRIB_POSITION = 0,
35
VTXATTRIB_COLOR_PRIMARY = 3,
36
VTXATTRIB_COLOR_SECONDARY = 4,
37
VTXATTRIB_FOGCOORD = 5,
38
VTXATTRIB_TEXCOORD = 8,
39
VTXATTRIB_TEXCOORD0 = 8,
40
VTXATTRIB_TEXCOORD1 = 9,
41
VTXATTRIB_TEXCOORD2 = 10,
42
VTXATTRIB_TEXCOORD3 = 11,
43
VTXATTRIB_TEXCOORD4 = 12,
44
VTXATTRIB_TEXCOORD5 = 13,
45
VTXATTRIB_TEXCOORD6 = 14,
46
VTXATTRIB_TEXCOORD7 = 15,
49
class IOpenGLResource;
51
class IOpenGLAsmShader: public IOpenGLResource
53
DECLARE_OBJECT_TYPE(IOpenGLAsmShader, IOpenGLResource);
54
IOpenGLAsmShader(NString ShaderName, OpenGLResourceType ResourceType);
55
virtual ~IOpenGLAsmShader();
57
virtual void SetShaderCode(const ANSICHAR* ShaderCode) = 0;
58
virtual bool Compile() = 0;
59
virtual bool IsValid() = 0;
64
class IOpenGLAsmVertexShader: public IOpenGLAsmShader
66
DECLARE_OBJECT_TYPE(IOpenGLAsmVertexShader, IOpenGLAsmShader);
68
virtual ~IOpenGLAsmVertexShader();
69
virtual void SetShaderCode(const ANSICHAR* ShaderCode);
70
virtual bool Compile();
71
virtual bool IsValid();
73
IOpenGLAsmVertexShader(NString ShaderName = NString("VertexProgram"));
74
bool m_CompiledAndReady;
75
friend class GLDeviceFactory;
78
class IOpenGLAsmPixelShader: public IOpenGLAsmShader
80
DECLARE_OBJECT_TYPE(IOpenGLAsmPixelShader, IOpenGLAsmShader);
82
virtual ~IOpenGLAsmPixelShader();
83
virtual void SetShaderCode(const ANSICHAR* ShaderCode);
84
virtual bool Compile();
85
virtual bool IsValid();
87
IOpenGLAsmPixelShader(NString ShaderName = NString("PixelProgram"));
88
bool m_CompiledAndReady;
89
friend class GLDeviceFactory;
93
class IOpenGLAsmShaderProgram: public IOpenGLResource
95
DECLARE_OBJECT_TYPE(IOpenGLAsmShaderProgram, IOpenGLResource);
97
virtual ~IOpenGLAsmShaderProgram();
99
void LoadVertexShader(const TCHAR* glslshader);
100
void LoadPixelShader(const TCHAR* glslshader);
101
void LoadIShaderFile(const TCHAR* ShaderFileName);
102
void LoadIShader(const TCHAR* ShaderCode);
110
void SetVertexEnvParameter4dARB (t_uint32 index, double x, double y, double z, double w);
111
void SetVertexEnvParameter4dvARB (t_uint32 index, const double *params);
112
void SetVertexEnvParameter4fARB (t_uint32 index, float x, float y, float z, float w);
113
void SetVertexEnvParameter4fvARB (t_uint32 index, const float *params);
114
void SetVertexLocalParameter4dARB (t_uint32 index, double x, double y, double z, double w);
115
void SetVertexLocalParameter4dvARB (t_uint32 index, const double *params);
116
void SetVertexLocalParameter4fARB (t_uint32 index, float x, float y, float z, float w);
117
void SetVertexLocalParameter4fvARB (t_uint32 index, const float *params);
119
void SetFragmentEnvParameter4dARB (t_uint32 index, double x, double y, double z, double w);
120
void SetFragmentEnvParameter4dvARB (t_uint32 index, const double *params);
121
void SetFragmentEnvParameter4fARB (t_uint32 index, float x, float y, float z, float w);
122
void SetFragmentEnvParameter4fvARB (t_uint32 index, const float *params);
123
void SetFragmentLocalParameter4dARB (t_uint32 index, double x, double y, double z, double w);
124
void SetFragmentLocalParameter4dvARB (t_uint32 index, const double *params);
125
void SetFragmentLocalParameter4fARB (t_uint32 index, float x, float y, float z, float w);
126
void SetFragmentLocalParameter4fvARB (t_uint32 index, const float *params);
129
IOpenGLAsmShaderProgram(NString ShaderProgramName = NString("AsmShaderProgram"));
130
std::vector<TRefGL<IOpenGLAsmShader> > ShaderObjectList;
131
NString _ShaderProgramName;
133
TRefGL<IOpenGLAsmVertexShader> m_AsmVertexProgram;
134
TRefGL<IOpenGLAsmPixelShader> m_AsmFragmentProgram;
136
friend class GLDeviceFactory;
141
#endif // IOPENGLASMSHADER_H