fix outfit glitches, init combobox, move shaders, remove unused particles files, create timer utility

This commit is contained in:
Eduardo Bart
2011-12-28 17:38:29 -02:00
parent 11bb365dce
commit 400afa9981
32 changed files with 273 additions and 269 deletions

View File

@@ -0,0 +1,25 @@
/*
* Copyright (c) 2010-2011 OTClient <https://github.com/edubart/otclient>
*
* 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.
*/
#include "hardwarebuffer.h"

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2010-2011 OTClient <https://github.com/edubart/otclient>
*
* 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 HARDWAREBUFFER_H
#define HARDWAREBUFFER_H
class HardwareBuffer
{
};
#endif

View File

@@ -36,9 +36,10 @@ bool PainterShaderProgram::link()
bindUniformLocation(COLOR_UNIFORM, "color");
bindUniformLocation(OPACITY_UNIFORM, "opacity");
bindUniformLocation(TEXTURE_UNIFORM, "texture");
bindUniformLocation(TICKS_UNIFORM, "ticks");
bindUniformLocation(TIME_UNIFORM, "ticks");
return true;
}
m_startTimer.restart();
return false;
}
@@ -62,10 +63,11 @@ void PainterShaderProgram::setOpacity(float opacity)
void PainterShaderProgram::setUniformTexture(int location, const TexturePtr& texture, int index)
{
if(!texture)
return;
glActiveTexture(GL_TEXTURE0 + index);
glBindTexture(GL_TEXTURE_2D, texture->getId());
if(index > 0)
glActiveTexture(GL_TEXTURE0 + index);
glBindTexture(GL_TEXTURE_2D, texture ? texture->getId() : 0);
if(index > 0)
glActiveTexture(GL_TEXTURE0);
setUniformValue(location, index);
}
@@ -90,7 +92,7 @@ void PainterShaderProgram::draw(const CoordsBuffer& coordsBuffer, DrawMode drawM
{
assert(bind());
setUniformValue(TICKS_UNIFORM, (float)g_clock.ticks());
setUniformValue(TIME_UNIFORM, (float)m_startTimer.timeElapsed());
int numVertices = coordsBuffer.getVertexCount();
if(numVertices == 0)

View File

@@ -25,6 +25,7 @@
#include "shaderprogram.h"
#include "coordsbuffer.h"
#include <framework/core/timer.h>
class PainterShaderProgram : public ShaderProgram
{
@@ -36,7 +37,7 @@ class PainterShaderProgram : public ShaderProgram
COLOR_UNIFORM = 2,
OPACITY_UNIFORM = 3,
TEXTURE_UNIFORM = 4,
TICKS_UNIFORM = 5
TIME_UNIFORM = 5
};
public:
enum DrawMode {
@@ -55,6 +56,7 @@ public:
private:
DrawMode m_drawMode;
Timer m_startTimer;
};
#endif