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

@ -4,7 +4,7 @@ PROJECT(otclient)
INCLUDE(src/framework/CMakeLists.txt) INCLUDE(src/framework/CMakeLists.txt)
INCLUDE(src/otclient/CMakeLists.txt) INCLUDE(src/otclient/CMakeLists.txt)
OPTION(USE_PCH "Use precompiled header (speed up compile)" ON) OPTION(USE_PCH "Use precompiled header (speed up compile)" OFF)
SET(executable_SOURCES src/main.cpp) SET(executable_SOURCES src/main.cpp)

View File

@ -1 +1,10 @@
-- place any code for testing purposes here -- place any code for testing purposes here
function init()
local box = UIComboBox.create()
box:setStyle('ComboBox')
box:moveTo({x=100, y=8})
UI.display(box)
end
addEvent(init)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 845 B

View File

@ -55,3 +55,17 @@ function resolveFileFullPath(filePath, depth)
return filePath return filePath
end end
end end
function extends(base)
local derived = {}
function derived.internalCreate()
local instance = base.create()
for k,v in pairs(derived) do
instance[k] = v
end
return instance
end
derived.create = derived.internalCreate
return derived
end

View File

@ -15,4 +15,5 @@ Module
importStyles 'styles/listboxes.otui' importStyles 'styles/listboxes.otui'
importStyles 'styles/items.otui' importStyles 'styles/items.otui'
importStyles 'styles/creatures.otui' importStyles 'styles/creatures.otui'
importStyles 'styles/comboboxes.otui'
return true return true

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 B

View File

@ -0,0 +1,9 @@
ComboBox < UIComboBox
font: verdana-11px-antialised
color: #aaaaaa
size: 86 20
text-margin: 3
border-image:
source: /core_styles/images/combobox.png
border: 1
border.right: 17

View File

@ -7,4 +7,5 @@ Module
onLoad: | onLoad: |
require 'tooltip/tooltip' require 'tooltip/tooltip'
require 'messagebox/messagebox' require 'messagebox/messagebox'
require 'uicombobox/uicombobox'
return true return true

View File

@ -0,0 +1 @@
UIComboBox = extends(UIWidget)

View File

@ -0,0 +1,10 @@
uniform float opacity; // painter opacity
uniform vec4 color; // painter color
uniform float time; // time in seconds since shader linkage
uniform sampler2D texture; // map texture
varying vec2 textureCoords; // map texture coords
void main()
{
gl_FragColor = texture2D(texture, textureCoords) * color * opacity;
}

View File

@ -1,6 +1,6 @@
uniform float opacity; uniform float opacity; // painter opacity
uniform vec4 color; uniform vec4 color; // painter color
uniform float ticks; uniform float time; // time in seconds since shader linkage
uniform sampler2D texture; // outfit texture uniform sampler2D texture; // outfit texture
varying vec2 textureCoords; // outfit texture coords varying vec2 textureCoords; // outfit texture coords
@ -38,3 +38,4 @@ void main()
{ {
gl_FragColor = calcOutfitPixel() * color * opacity; gl_FragColor = calcOutfitPixel() * color * opacity;
} }

View File

@ -1,102 +0,0 @@
ParticleSystem
AttractionAffector
position: 320 180
acceleration: 500
repelish: true
delay: 0.5
// Fire
Emitter
position: 295 180
duration: 0.5
burstRate: 0.0166
burstCount: 3
delay: 0
particle-min-duration: 0.3
particle-max-duration: 0.5
particle-position-radius: 0
particle-min-velocity: 200
particle-max-velocity: 240
particle-min-velocity-angle: -10
particle-max-velocity-angle: 10
particle-acceleration: 0
particle-start-size: 16 16
particle-final-size: 64 64
particle-colors: #ffcc0050 #ffff0025 #ff000000
particle-colors-stops: 0 0.15 0.3
particle-composition-mode: addition
particle-texture: circle2.png
// Fire ball
Emitter
position: 295 180
duration: 0
burstRate: 0.0166
burstCount: 3
delay: 0
particle-min-duration: 0.5
particle-max-duration: 0.9
particle-position-radius: 0
particle-min-velocity: 80
particle-max-velocity: 110
particle-min-velocity-angle: -30
particle-max-velocity-angle: 30
particle-acceleration: 0
particle-start-size: 16 16
particle-final-size: 32 32
particle-composition-mode: addition
particle-colors: #19191980 #0f0f0f80 #00000000
particle-colors-stops: 0 0.45 0.9
particle-texture: circle2.png
ParticleSystem
AttractionAffector
position: 320 180
acceleration: 30
repelish: true
// Smoke
Emitter
position: 295 180
duration: 0.7
burstRate: 0.0166
burstCount: 3
delay: 0.4
particle-min-duration: 0.9
particle-max-duration: 0.9
particle-position-radius: 0
particle-min-velocity: 60
particle-max-velocity: 85
particle-min-velocity-angle: -20
particle-max-velocity-angle: 20
particle-acceleration: 0
particle-start-size: 8 8
particle-final-size: 64 64
particle-colors: #66666610 #00000000
particle-colors-stops: 0 0.9
particle-texture: circle2.png

View File

@ -1,123 +0,0 @@
varying vec2 textureCoords;
uniform float opacity;
uniform vec4 color;
uniform float ticks;
uniform sampler2D texture;
void main()
{
gl_FragColor = texture2D(texture, textureCoords) * color * opacity;
}
/*
varying vec2 textureCoords;
uniform vec4 color;
uniform float ticks;
uniform sampler2D texture;
void main()
{
int num = 4;
vec4 sum = vec4(0);
int i, j;
for(i=-num/2;i<num/2;++i) {
for(j=-num/2;j<num/2;++j) {
sum += texture2D(texture, textureCoords + vec2(i+1, j+1)*0.001) * 1.0/(num*num);
}
}
float period = ticks/1000.0;
float a = (sin(period)+1.0)/2.0;
sum.a = 0;
gl_FragColor = vec4(1,1,1,2) - texture2D(texture, textureCoords);
}
*/
/*
uniform sampler2D texture;
varying vec2 textureCoords;
void main()
{
vec4 sum = vec4(0);
vec2 texcoord = textureCoords;
int j;
int i;
for( i= -4 ;i < 4; i++)
{
for (j = -3; j < 3; j++)
{
sum += texture2D(texture, texcoord + vec2(j, i)*0.004) * 0.25;
}
}
if (texture2D(texture, texcoord).r < 0.3)
{
gl_FragColor = sum*sum*0.012 + texture2D(texture, texcoord);
}
else
{
if (texture2D(texture, texcoord).r < 0.5)
{
gl_FragColor = sum*sum*0.009 + texture2D(texture, texcoord);
}
else
{
gl_FragColor = sum*sum*0.0075 + texture2D(texture, texcoord);
}
}
}
*/
/*
uniform sampler2D texture;
varying vec2 textureCoords;
uniform vec4 color;
uniform float opacity;
uniform float ticks;
uniform float rt_w = 18*32;
uniform float rt_h = 14*32;
uniform float radius = 300.0;
uniform float angle = 0.2;
uniform vec2 center = vec2(8*32, 5*32);
vec4 PostFX(sampler2D tex, vec2 uv, float time)
{
vec2 texSize = vec2(rt_w, rt_h);
vec2 tc = uv * texSize;
tc -= center;
float dist = length(tc);
if (dist < radius)
{
float percent = (radius - dist) / radius;
float theta = percent * percent * ((int)ticks % 1000)/1000.0 * 8.0;
float s = sin(theta);
float c = cos(theta);
tc = vec2(dot(tc, vec2(c, -s)), dot(tc, vec2(s, c)));
}
tc += center;
vec3 color = texture2D(texture, tc / texSize).rgb;
return vec4(color, 1.0);
}
void main (void)
{
vec2 uv = textureCoords.st;
gl_FragColor = PostFX(texture, uv, ticks) * opacity;
}
*/
/*
uniform float opacity;
vec4 calculatePixel();
void main()
{
gl_FragColor = calculatePixel() * opacity;
}
varying vec2 textureCoords;
uniform vec4 color;
uniform sampler2D texture;
vec4 calculatePixel() {
return texture2D(texture, textureCoords) * color;
}
*/

View File

@ -128,6 +128,7 @@ SET(framework_SOURCES ${framework_SOURCES}
${CMAKE_CURRENT_LIST_DIR}/core/modulemanager.cpp ${CMAKE_CURRENT_LIST_DIR}/core/modulemanager.cpp
${CMAKE_CURRENT_LIST_DIR}/core/module.cpp ${CMAKE_CURRENT_LIST_DIR}/core/module.cpp
${CMAKE_CURRENT_LIST_DIR}/core/clock.cpp ${CMAKE_CURRENT_LIST_DIR}/core/clock.cpp
${CMAKE_CURRENT_LIST_DIR}/core/timer.cpp
# framework net # framework net
${CMAKE_CURRENT_LIST_DIR}/net/connection.cpp ${CMAKE_CURRENT_LIST_DIR}/net/connection.cpp

View File

@ -103,11 +103,10 @@ void Application::init(const std::vector<std::string>& args, int appFlags)
// fire first resize // fire first resize
resize(g_window.getSize()); resize(g_window.getSize());
}
// finally show the window // display window when the application starts running
if(m_appFlags & Fw::AppEnableGraphics) g_dispatcher.addEvent([]{ g_window.show(); });
g_window.show(); }
if(m_appFlags & Fw::AppEnableModules) if(m_appFlags & Fw::AppEnableModules)
g_modules.discoverModulesPath(); g_modules.discoverModulesPath();

View File

@ -48,20 +48,5 @@ private:
extern Clock g_clock; extern Clock g_clock;
class Timer
{
public:
Timer() { restart(); }
void restart() { m_startTicks = g_clock.ticks(); }
ticks_t startTicks() { return m_startTicks; }
ticks_t ticksElapsed() { return g_clock.ticks() - m_startTicks; }
double timeElapsed() { return ticksElapsed()/1000.0; }
private:
ticks_t m_startTicks;
};
#endif #endif

View File

@ -30,7 +30,6 @@ void EventDispatcher::flush()
{ {
poll(); poll();
m_eventList.clear();
while(!m_scheduledEventList.empty()) while(!m_scheduledEventList.empty())
m_scheduledEventList.pop(); m_scheduledEventList.pop();
} }

View File

@ -25,7 +25,7 @@
Logger g_logger; Logger g_logger;
Logger::Logger() : m_terminated(false) Logger::Logger()
{ {
} }

View File

@ -48,7 +48,6 @@ public:
private: private:
std::list<LogMessage> m_logMessages; std::list<LogMessage> m_logMessages;
OnLogCallback m_onLog; OnLogCallback m_onLog;
bool m_terminated;
}; };
extern Logger g_logger; extern Logger g_logger;

View File

@ -48,14 +48,14 @@ void Module::discover(const OTMLNodePtr& moduleNode)
// set onLoad callback // set onLoad callback
if(OTMLNodePtr node = moduleNode->get("onLoad")) { if(OTMLNodePtr node = moduleNode->get("onLoad")) {
g_lua.loadFunction(node->value<std::string>(), "@" + node->source() + "[" + node->tag() + "]"); g_lua.loadFunction(node->value(), "@" + node->source() + "[" + node->tag() + "]");
g_lua.useValue(); g_lua.useValue();
m_loadCallback = g_lua.polymorphicPop<BooleanCallback>(); m_loadCallback = g_lua.polymorphicPop<BooleanCallback>();
} }
// set onUnload callback // set onUnload callback
if(OTMLNodePtr node = moduleNode->get("onUnload")) { if(OTMLNodePtr node = moduleNode->get("onUnload")) {
g_lua.loadFunction(node->value<std::string>(), "@" + node->source() + "[" + node->tag() + "]"); g_lua.loadFunction(node->value(), "@" + node->source() + "[" + node->tag() + "]");
g_lua.useValue(); g_lua.useValue();
m_unloadCallback = g_lua.polymorphicPop<SimpleCallback>(); m_unloadCallback = g_lua.polymorphicPop<SimpleCallback>();
} }

View File

@ -0,0 +1,35 @@
/*
* 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 "timer.h"
#include "clock.h"
void Timer::restart()
{
m_startTicks = g_clock.ticks();
}
ticks_t Timer::ticksElapsed()
{
return g_clock.ticks() - m_startTicks;
}

View File

@ -0,0 +1,43 @@
/*
* 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 TIMER_H
#define TIMER_H
#include <framework/util/types.h>
class Timer
{
public:
Timer() { restart(); }
void restart();
ticks_t startTicks() { return m_startTicks; }
ticks_t ticksElapsed();
double timeElapsed() { return ticksElapsed()/1000.0; }
private:
ticks_t m_startTicks;
};
#endif

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

View File

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

View File

@ -427,7 +427,12 @@ bool X11Window::isExtensionSupported(const char *ext)
void X11Window::move(const Point& pos) void X11Window::move(const Point& pos)
{ {
bool wasVisible = isVisible();
if(!wasVisible)
show();
XMoveWindow(m_display, m_window, pos.x, pos.y); XMoveWindow(m_display, m_window, pos.x, pos.y);
if(!wasVisible)
hide();
} }
void X11Window::resize(const Size& size) void X11Window::resize(const Size& size)

View File

@ -299,4 +299,6 @@ inline float randomRange<float>(float min, float max) {
// shortcut for Fw::dump // shortcut for Fw::dump
const static Fw::dumper dump; const static Fw::dumper dump;
#define forever for(;;)
#endif #endif

View File

@ -67,7 +67,7 @@ void Creature::draw(const Point& p)
if(!outfitProgram) { if(!outfitProgram) {
outfitProgram = PainterShaderProgramPtr(new PainterShaderProgram); outfitProgram = PainterShaderProgramPtr(new PainterShaderProgram);
outfitProgram->addShaderFromSourceCode(Shader::Vertex, glslMainWithTexCoordsVertexShader + glslPositionOnlyVertexShader); outfitProgram->addShaderFromSourceCode(Shader::Vertex, glslMainWithTexCoordsVertexShader + glslPositionOnlyVertexShader);
outfitProgram->addShaderFromSourceFile(Shader::Fragment, "/outfit.frag"); outfitProgram->addShaderFromSourceFile(Shader::Fragment, "/game_shaders/outfit.frag");
assert(outfitProgram->link()); assert(outfitProgram->link());
outfitProgram->bindUniformLocation(HEAD_COLOR_UNIFORM, "headColor"); outfitProgram->bindUniformLocation(HEAD_COLOR_UNIFORM, "headColor");
outfitProgram->bindUniformLocation(BODY_COLOR_UNIFORM, "bodyColor"); outfitProgram->bindUniformLocation(BODY_COLOR_UNIFORM, "bodyColor");
@ -93,6 +93,13 @@ void Creature::draw(const Point& p)
for(int h = 0; h < m_type->dimensions[ThingType::Height]; h++) { for(int h = 0; h < m_type->dimensions[ThingType::Height]; h++) {
for(int w = 0; w < m_type->dimensions[ThingType::Width]; w++) { for(int w = 0; w < m_type->dimensions[ThingType::Width]; w++) {
int spriteId = m_type->getSpriteId(w, h, 0, m_xPattern, m_yPattern, m_zPattern, m_animation);
if(!spriteId)
continue;
TexturePtr spriteTex = g_sprites.getSpriteTexture(spriteId);
if(!spriteTex)
continue;
if(m_type->dimensions[ThingType::Layers] > 1) { if(m_type->dimensions[ThingType::Layers] > 1) {
int maskId = m_type->getSpriteId(w, h, 1, m_xPattern, m_yPattern, m_zPattern, m_animation); int maskId = m_type->getSpriteId(w, h, 1, m_xPattern, m_yPattern, m_zPattern, m_animation);
if(!maskId) if(!maskId)
@ -101,12 +108,6 @@ void Creature::draw(const Point& p)
outfitProgram->setUniformTexture(MASK_TEXTURE_UNIFORM, maskTex, 1); outfitProgram->setUniformTexture(MASK_TEXTURE_UNIFORM, maskTex, 1);
} }
int spriteId = m_type->getSpriteId(w, h, 0, m_xPattern, m_yPattern, m_zPattern, m_animation);
if(!spriteId)
continue;
TexturePtr spriteTex = g_sprites.getSpriteTexture(spriteId);
Rect drawRect(((p + m_walkOffset).x - w*32) - m_type->parameters[ThingType::DisplacementX], Rect drawRect(((p + m_walkOffset).x - w*32) - m_type->parameters[ThingType::DisplacementX],
((p + m_walkOffset).y - h*32) - m_type->parameters[ThingType::DisplacementY], ((p + m_walkOffset).y - h*32) - m_type->parameters[ThingType::DisplacementY],
32, 32); 32, 32);

View File

@ -0,0 +1,24 @@
/*
* 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 "gameshadermanager.h"

View File

@ -0,0 +1,30 @@
/*
* 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 GAMESHADERMANAGER_H
#define GAMESHADERMANAGER_H
class GameShaderManager
{
};
#endif

View File

@ -48,7 +48,7 @@ void Map::draw(const Rect& rect)
program = PainterShaderProgramPtr(new PainterShaderProgram); program = PainterShaderProgramPtr(new PainterShaderProgram);
program->addShaderFromSourceCode(Shader::Vertex, glslMainWithTexCoordsVertexShader + glslPositionOnlyVertexShader); program->addShaderFromSourceCode(Shader::Vertex, glslMainWithTexCoordsVertexShader + glslPositionOnlyVertexShader);
program->addShaderFromSourceFile(Shader::Fragment, "/shadertest.frag"); program->addShaderFromSourceFile(Shader::Fragment, "/game_shaders/map.frag");
assert(program->link()); assert(program->link());
} }