tibia-client/src/framework/graphics/paintershaderprogram.h

83 lines
2.5 KiB
C
Raw Normal View History

2011-12-07 01:31:55 +01:00
/*
2017-01-13 11:47:07 +01:00
* Copyright (c) 2010-2017 OTClient <https://github.com/edubart/otclient>
2011-12-07 01:31:55 +01:00
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef PAINTERSHADERPROGRAM_H
#define PAINTERSHADERPROGRAM_H
2011-12-07 01:31:55 +01:00
#include "shaderprogram.h"
2011-12-08 00:43:12 +01:00
#include "coordsbuffer.h"
#include <framework/core/timer.h>
2011-12-07 01:31:55 +01:00
class PainterShaderProgram : public ShaderProgram
{
protected:
2011-12-07 01:31:55 +01:00
enum {
2012-04-08 21:28:03 +02:00
VERTEX_ATTR = 0,
TEXCOORD_ATTR = 1,
2011-12-07 01:31:55 +01:00
PROJECTION_MATRIX_UNIFORM = 0,
TEXTURE_MATRIX_UNIFORM = 1,
2011-12-07 01:31:55 +01:00
COLOR_UNIFORM = 2,
OPACITY_UNIFORM = 3,
2012-04-08 21:28:03 +02:00
TIME_UNIFORM = 4,
TEX0_UNIFORM = 5,
TEX1_UNIFORM = 6,
TEX2_UNIFORM = 7,
TEX3_UNIFORM = 8,
RESOLUTION_UNIFORM = 9,
TRANSFORM_MATRIX_UNIFORM = 10
2011-12-07 01:31:55 +01:00
};
2011-12-08 00:43:12 +01:00
friend class PainterOGL2;
2012-06-14 20:26:55 +02:00
virtual void setupUniforms();
public:
2012-01-30 07:27:21 +01:00
PainterShaderProgram();
2011-12-08 00:43:12 +01:00
bool link();
2011-12-07 01:31:55 +01:00
void setTransformMatrix(const Matrix3& transformMatrix);
2011-12-25 00:14:12 +01:00
void setProjectionMatrix(const Matrix3& projectionMatrix);
2012-06-02 16:43:27 +02:00
void setTextureMatrix(const Matrix3& textureMatrix);
2011-12-07 01:31:55 +01:00
void setColor(const Color& color);
2011-12-25 00:14:12 +01:00
void setOpacity(float opacity);
2012-06-14 20:26:55 +02:00
void setResolution(const Size& resolution);
void updateTime();
2011-12-07 01:31:55 +01:00
2012-06-14 20:26:55 +02:00
void addMultiTexture(const std::string& file);
void bindMultiTextures();
2011-12-07 01:31:55 +01:00
private:
2012-03-20 16:17:10 +01:00
float m_startTime;
2012-04-08 21:28:03 +02:00
Color m_color;
float m_opacity;
Matrix3 m_transformMatrix;
2012-04-08 21:28:03 +02:00
Matrix3 m_projectionMatrix;
2012-06-02 16:43:27 +02:00
Matrix3 m_textureMatrix;
2012-06-14 20:26:55 +02:00
Size m_resolution;
2012-04-08 21:28:03 +02:00
float m_time;
2012-06-14 20:26:55 +02:00
std::vector<TexturePtr> m_multiTextures;
2011-12-07 01:31:55 +01:00
};
#endif