Removed bad shadows.

This commit is contained in:
Miroslav Bendík 2012-08-25 13:27:40 +02:00
parent 1aee368837
commit 5be190b5a1
3 changed files with 13 additions and 1 deletions

@ -8,7 +8,9 @@
*/
#include "PixelAttributes.h"
#include <algorithm>
using namespace std;
PixelAttributes::PixelAttributes()
{
@ -25,5 +27,8 @@ void PixelAttributes::setWidth(int width)
void PixelAttributes::scroll()
{
m_blockPixelAttributes[17] = m_blockPixelAttributes[1];
for (size_t i = 1; i < 17; ++i) {
fill(m_blockPixelAttributes[i].begin(), m_blockPixelAttributes[i].end(), PixelAttribute());
}
}

@ -10,11 +10,15 @@
#ifndef PIXELATTRIBUTES_H_ADZ35GYF
#define PIXELATTRIBUTES_H_ADZ35GYF
#include <limits>
#include <vector>
struct PixelAttribute {
PixelAttribute(): height(0) {};
PixelAttribute(): height(std::numeric_limits<int>::min()) {};
int height;
inline bool valid_height() {
return height != std::numeric_limits<int>::min();
}
};
class PixelAttributes

@ -475,6 +475,9 @@ inline void TileGenerator::renderShading(int zPos)
continue;
}
for (int x = 0; x < m_mapWidth; ++x) {
if (!m_blockPixelAttributes.attribute(z, x).valid_height() || !m_blockPixelAttributes.attribute(z, x - 1).valid_height() || !m_blockPixelAttributes.attribute(z - 1, x).valid_height()) {
continue;
}
int y = m_blockPixelAttributes.attribute(z, x).height;
int y1 = m_blockPixelAttributes.attribute(z, x - 1).height;
int y2 = m_blockPixelAttributes.attribute(z - 1, x).height;