mirror of
https://github.com/minetest/minetestmapper.git
synced 2024-11-22 07:23:46 +01:00
Removed bad shadows.
This commit is contained in:
parent
1aee368837
commit
5be190b5a1
@ -8,7 +8,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "PixelAttributes.h"
|
#include "PixelAttributes.h"
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
PixelAttributes::PixelAttributes()
|
PixelAttributes::PixelAttributes()
|
||||||
{
|
{
|
||||||
@ -25,5 +27,8 @@ void PixelAttributes::setWidth(int width)
|
|||||||
void PixelAttributes::scroll()
|
void PixelAttributes::scroll()
|
||||||
{
|
{
|
||||||
m_blockPixelAttributes[17] = m_blockPixelAttributes[1];
|
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
|
#ifndef PIXELATTRIBUTES_H_ADZ35GYF
|
||||||
#define PIXELATTRIBUTES_H_ADZ35GYF
|
#define PIXELATTRIBUTES_H_ADZ35GYF
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
struct PixelAttribute {
|
struct PixelAttribute {
|
||||||
PixelAttribute(): height(0) {};
|
PixelAttribute(): height(std::numeric_limits<int>::min()) {};
|
||||||
int height;
|
int height;
|
||||||
|
inline bool valid_height() {
|
||||||
|
return height != std::numeric_limits<int>::min();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class PixelAttributes
|
class PixelAttributes
|
||||||
|
@ -475,6 +475,9 @@ inline void TileGenerator::renderShading(int zPos)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (int x = 0; x < m_mapWidth; ++x) {
|
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 y = m_blockPixelAttributes.attribute(z, x).height;
|
||||||
int y1 = m_blockPixelAttributes.attribute(z, x - 1).height;
|
int y1 = m_blockPixelAttributes.attribute(z, x - 1).height;
|
||||||
int y2 = m_blockPixelAttributes.attribute(z - 1, x).height;
|
int y2 = m_blockPixelAttributes.attribute(z - 1, x).height;
|
||||||
|
Loading…
Reference in New Issue
Block a user