Otclient  14/8/2020
paintershaderprogram.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2020 OTClient <https://github.com/edubart/otclient>
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20  * THE SOFTWARE.
21  */
22 
23 #ifndef PAINTERSHADERPROGRAM_H
24 #define PAINTERSHADERPROGRAM_H
25 
26 #include "shaderprogram.h"
27 #include "coordsbuffer.h"
28 #include <framework/core/timer.h>
29 
31 {
32 protected:
33  enum {
47  };
48 
49  friend class PainterOGL2;
50 
51  virtual void setupUniforms();
52 
53 public:
55 
56  bool link();
57 
58  void setTransformMatrix(const Matrix3& transformMatrix);
59  void setProjectionMatrix(const Matrix3& projectionMatrix);
60  void setTextureMatrix(const Matrix3& textureMatrix);
61  void setColor(const Color& color);
62  void setOpacity(float opacity);
63  void setResolution(const Size& resolution);
64  void updateTime();
65 
66  void addMultiTexture(const std::string& file);
67  void bindMultiTextures();
68 
69 private:
70  float m_startTime;
71 
72  Color m_color;
73  float m_opacity;
78  float m_time;
79  std::vector<TexturePtr> m_multiTextures;
80 };
81 
82 #endif
PainterShaderProgram::TEX0_UNIFORM
@ TEX0_UNIFORM
Definition: paintershaderprogram.h:41
Color
Definition: color.h:32
PainterShaderProgram::updateTime
void updateTime()
Definition: paintershaderprogram.cpp:140
PainterShaderProgram::TEX1_UNIFORM
@ TEX1_UNIFORM
Definition: paintershaderprogram.h:42
PainterShaderProgram::setColor
void setColor(const Color &color)
Definition: paintershaderprogram.cpp:110
PainterShaderProgram::TEXTURE_MATRIX_UNIFORM
@ TEXTURE_MATRIX_UNIFORM
Definition: paintershaderprogram.h:37
PainterOGL::m_textureMatrix
Matrix3 m_textureMatrix
Definition: painterogl.h:107
Painter::m_opacity
float m_opacity
Definition: painter.h:118
PainterShaderProgram::addMultiTexture
void addMultiTexture(const std::string &file)
Definition: paintershaderprogram.cpp:151
PainterShaderProgram::TIME_UNIFORM
@ TIME_UNIFORM
Definition: paintershaderprogram.h:40
coordsbuffer.h
Painter::m_resolution
Size m_resolution
Definition: painter.h:117
PainterShaderProgram::setupUniforms
virtual void setupUniforms()
Definition: paintershaderprogram.cpp:39
PainterShaderProgram::setProjectionMatrix
void setProjectionMatrix(const Matrix3 &projectionMatrix)
Definition: paintershaderprogram.cpp:90
PainterShaderProgram::link
bool link()
Definition: paintershaderprogram.cpp:66
PainterShaderProgram::setResolution
void setResolution(const Size &resolution)
Definition: paintershaderprogram.cpp:130
PainterShaderProgram::setTransformMatrix
void setTransformMatrix(const Matrix3 &transformMatrix)
Definition: paintershaderprogram.cpp:80
PainterShaderProgram::TEX2_UNIFORM
@ TEX2_UNIFORM
Definition: paintershaderprogram.h:43
PainterShaderProgram::TEXCOORD_ATTR
@ TEXCOORD_ATTR
Definition: paintershaderprogram.h:35
Painter::m_color
Color m_color
Definition: painter.h:116
timer.h
PainterShaderProgram::TRANSFORM_MATRIX_UNIFORM
@ TRANSFORM_MATRIX_UNIFORM
Definition: paintershaderprogram.h:46
PainterShaderProgram::setOpacity
void setOpacity(float opacity)
Definition: paintershaderprogram.cpp:120
PainterShaderProgram::PROJECTION_MATRIX_UNIFORM
@ PROJECTION_MATRIX_UNIFORM
Definition: paintershaderprogram.h:36
PainterOGL::m_transformMatrix
Matrix3 m_transformMatrix
Definition: painterogl.h:105
PainterOGL2
Definition: painterogl2.h:35
PainterShaderProgram::COLOR_UNIFORM
@ COLOR_UNIFORM
Definition: paintershaderprogram.h:38
PainterShaderProgram
Definition: paintershaderprogram.h:30
PainterShaderProgram::VERTEX_ATTR
@ VERTEX_ATTR
Definition: paintershaderprogram.h:34
PainterShaderProgram::TEX3_UNIFORM
@ TEX3_UNIFORM
Definition: paintershaderprogram.h:44
PainterShaderProgram::PainterShaderProgram
PainterShaderProgram()
Definition: paintershaderprogram.cpp:31
PainterShaderProgram::OPACITY_UNIFORM
@ OPACITY_UNIFORM
Definition: paintershaderprogram.h:39
shaderprogram.h
PainterOGL::m_projectionMatrix
Matrix3 m_projectionMatrix
Definition: painterogl.h:106
PainterShaderProgram::bindMultiTextures
void bindMultiTextures()
Definition: paintershaderprogram.cpp:166
Matrix
Definition: matrix.h:32
PainterShaderProgram::setTextureMatrix
void setTextureMatrix(const Matrix3 &textureMatrix)
Definition: paintershaderprogram.cpp:100
TSize< int >
PainterShaderProgram::RESOLUTION_UNIFORM
@ RESOLUTION_UNIFORM
Definition: paintershaderprogram.h:45
ShaderProgram
Definition: shaderprogram.h:30