1
#ifndef ABSTRACTEFFECTSHADER_H
2
#define ABSTRACTEFFECTSHADER_H
6
#define ATTRIB_INVALID -1
7
#define ATTRIB_POSITION 0
8
#define ATTRIB_WEIGHT 1
9
#define ATTRIB_NORMAL 2
10
#define ATTRIB_COLOR 3
11
#define ATTRIB_COLOR_PRIMARY 3
12
#define ATTRIB_COLOR_SECONDARY 4
13
#define ATTRIB_FOGCOORD 5
14
#define ATTRIB_TEXCOORD 8
15
#define ATTRIB_TEXCOORD0 8
16
#define ATTRIB_TEXCOORD1 9
17
#define ATTRIB_TEXCOORD2 10
18
#define ATTRIB_TEXCOORD3 11
19
#define ATTRIB_TEXCOORD4 12
20
#define ATTRIB_TEXCOORD5 13
21
#define ATTRIB_TEXCOORD6 14
22
#define ATTRIB_TEXCOORD7 15
24
#if defined(NUX_OS_WINDOWS)
25
#define PKGDATADIR "../../data/"
28
class AbstractEffectShader
31
AbstractEffectShader();
32
virtual ~AbstractEffectShader();
33
//void SetLightColor(float red, float green, float blue, float alpha);
35
void SetMaterialAmbientColor(float red, float green, float blue, float alpha);
36
void SetMaterialDiffuseColor(float red, float green, float blue, float alpha);
37
void SetMaterialSpecularColor(float red, float green, float blue, float alpha);
39
void SetGlobalMaterialAmbientColor(float red, float green, float blue, float alpha);
40
void SetGlobalMaterialDiffuseColor(float red, float green, float blue, float alpha);
41
void SetGlobalMaterialSpecularColor(float red, float green, float blue, float alpha);
43
void SetMaterialSpecularExponent(float exponent);
44
void SetAmbientCoefficient(float Ka);
45
void SetObjectAlpha(float alpha);
47
virtual void ReloadShader();
48
virtual void Draw(nux::GraphicsEngine& GfxContext, nux::Geometry Viewport, const nux::Matrix4& CameraMatrix, const nux::Matrix4& ProjectionMatrix);
50
nux::NString gPinkShader0;
52
void RenderTexture(nux::GraphicsEngine& GfxContext, nux::ObjectPtr<nux::IOpenGLTexture2D> Texture,
55
float width, float height,
56
bool inversey = false);
58
void RenderTextureASM(nux::GraphicsEngine& GfxContext, nux::ObjectPtr<nux::IOpenGLTexture2D> Texture,
61
float width, float height,
62
bool inversey = false);
64
void RenderTextureExponentiation(nux::GraphicsEngine& GfxContext, nux::ObjectPtr<nux::IOpenGLTexture2D> Texture, float exponent, float brightness, float x, float y, float width, float height, bool inversey);
65
void RenderTextureExponentiationASM(nux::GraphicsEngine& GfxContext, nux::ObjectPtr<nux::IOpenGLTexture2D> Texture, float exponent, float brightness, float x, float y, float width, float height, bool inversey);
67
void RenderTextureAlpha(nux::GraphicsEngine& GfxContext, nux::ObjectPtr<nux::IOpenGLTexture2D> Texture,
70
float width, float height,
73
void RenderHorizontalBlur(nux::GraphicsEngine& GfxContext, nux::ObjectPtr<nux::IOpenGLTexture2D> Texture, float sigma, unsigned int num_tap, float x, float y, float width, float height, bool inversey = false);
74
void RenderHorizontalBlurASM(nux::GraphicsEngine& GfxContext, nux::ObjectPtr<nux::IOpenGLTexture2D> Texture, float sigma, unsigned int num_tap, float x, float y, float width, float height, bool inversey = false);
75
void RenderVerticalBlur(nux::GraphicsEngine& GfxContext, nux::ObjectPtr<nux::IOpenGLTexture2D> Texture, float sigma, unsigned int num_tap, float x, float y, float width, float height, bool inversey = false);
76
void RenderVerticalBlurASM(nux::GraphicsEngine& GfxContext, nux::ObjectPtr<nux::IOpenGLTexture2D> Texture, float sigma, unsigned int num_tap, float x, float y, float width, float height, bool inversey = false);
78
void RenderColorMatrixFilter(nux::GraphicsEngine& GfxContext, nux::ObjectPtr<nux::IOpenGLTexture2D> Texture,
85
float x, float y, float width, float height, bool inversey);
88
//nux::Color m_LightColor;
89
nux::Color m_MaterialAmbientColor;
90
nux::Color m_MaterialDiffuseColor;
91
nux::Color m_MaterialSpecularColor;
93
nux::Color m_GlobalMaterialAmbientColor;
94
nux::Color m_GlobalMaterialDiffuseColor;
95
nux::Color m_GlobalMaterialSpecularColor;
97
float m_MaterialSpecularExponent;
98
float m_AmbientCoefficient;
101
nux::GLShaderParameter* vxtunf_ObjectMatrix;
102
nux::GLShaderParameter* vxtunf_CameraMatrix;
103
nux::GLShaderParameter* vxtunf_ProjectionMatrix;
104
nux::GLShaderParameter* vxtunf_InverseObjectToCameraMatrix;
105
nux::GLShaderParameter* frgunf_ObjectAlpha;
107
nux::ObjectPtr<nux::IOpenGLShaderProgram> m_TextureProg;
108
nux::ObjectPtr<nux::IOpenGLShaderProgram> m_ExponentProg;
109
nux::ObjectPtr<nux::IOpenGLShaderProgram> m_TextureAlphaProg;
110
nux::ObjectPtr<nux::IOpenGLShaderProgram> m_HorizontalGaussProg;
111
nux::ObjectPtr<nux::IOpenGLShaderProgram> m_VerticalGaussProg;
112
nux::ObjectPtr<nux::IOpenGLShaderProgram> m_ColorMatrixFilterProg;
114
unsigned int m_VertexProgramASM;
115
unsigned int m_FragmentProgramASM;
116
unsigned int m_ExponentProgramASM;
117
unsigned int m_SeparableBlurProgramASM;
121
void SetFrameBufferHelper(nux::GraphicsEngine& GfxContext,
122
nux::ObjectPtr<nux::IOpenGLFrameBufferObject>& fbo,
123
nux::ObjectPtr<nux::IOpenGLTexture2D>& colorbuffer,
124
nux::ObjectPtr<nux::IOpenGLTexture2D>& depthbuffer,
125
int width, int height);
127
void GaussianWeights(float **weights, float sigma, unsigned int num_tap);
129
#endif // ABSTRACTEFFECTSHADER_H