2011-12-07 01:31:55 +01:00
|
|
|
/*
|
2012-01-02 17:58:37 +01:00
|
|
|
* Copyright (c) 2010-2012 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 PAINTERSHADER_H
|
|
|
|
#define PAINTERSHADER_H
|
|
|
|
|
|
|
|
#include "shaderprogram.h"
|
2011-12-08 00:43:12 +01:00
|
|
|
#include "coordsbuffer.h"
|
2011-12-28 20:38:29 +01:00
|
|
|
#include <framework/core/timer.h>
|
2011-12-07 01:31:55 +01:00
|
|
|
|
|
|
|
class PainterShaderProgram : public ShaderProgram
|
|
|
|
{
|
2012-04-19 01:03:43 +02:00
|
|
|
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,
|
2012-04-19 01:03:43 +02:00
|
|
|
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,
|
2011-12-07 01:31:55 +01:00
|
|
|
};
|
2011-12-08 00:43:12 +01:00
|
|
|
|
2012-04-19 01:03:43 +02:00
|
|
|
friend class PainterOGL2;
|
|
|
|
|
|
|
|
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
|
|
|
|
2011-12-25 00:14:12 +01:00
|
|
|
void setProjectionMatrix(const Matrix3& projectionMatrix);
|
2012-04-19 01:03:43 +02:00
|
|
|
void setTextureMatrix(const Matrix2& 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-04-19 01:03:43 +02:00
|
|
|
void updateTime();
|
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_projectionMatrix;
|
2012-04-19 01:03:43 +02:00
|
|
|
Matrix2 m_textureMatrix;
|
2012-04-08 21:28:03 +02:00
|
|
|
float m_time;
|
2011-12-07 01:31:55 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|