mirror of
https://github.com/minetest/minetestmapper.git
synced 2024-11-22 07:23:46 +01:00
Tabs -> spaces
This commit is contained in:
parent
84d46ab8eb
commit
2a4681d5c8
@ -306,13 +306,13 @@ void TileGenerator::parseColorsStream(std::istream &in)
|
|||||||
in >> g;
|
in >> g;
|
||||||
in >> b;
|
in >> b;
|
||||||
if(in.peek() != '\n') {
|
if(in.peek() != '\n') {
|
||||||
in >> a;
|
in >> a;
|
||||||
if(in.peek() != '\n')
|
if(in.peek() != '\n')
|
||||||
in >> t;
|
in >> t;
|
||||||
else
|
else
|
||||||
t = 0;
|
t = 0;
|
||||||
} else
|
} else
|
||||||
a = 0xFF;
|
a = 0xFF;
|
||||||
if (in.good()) {
|
if (in.good()) {
|
||||||
color = ColorEntry(r,g,b,a,t);
|
color = ColorEntry(r,g,b,a,t);
|
||||||
m_colors[name] = color;
|
m_colors[name] = color;
|
||||||
@ -536,8 +536,8 @@ inline void TileGenerator::renderMapBlock(const unsigned_string &mapBlock, const
|
|||||||
}
|
}
|
||||||
int imageX = getImageX(xBegin + x);
|
int imageX = getImageX(xBegin + x);
|
||||||
if(m_drawAlpha) {
|
if(m_drawAlpha) {
|
||||||
col = Color(0,0,0,0);
|
col = Color(0,0,0,0);
|
||||||
th = 0;
|
th = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int y = maxY; y >= minY; --y) {
|
for (int y = maxY; y >= minY; --y) {
|
||||||
@ -548,25 +548,25 @@ inline void TileGenerator::renderMapBlock(const unsigned_string &mapBlock, const
|
|||||||
}
|
}
|
||||||
std::map<int, std::string>::iterator blockName = m_nameMap.find(content);
|
std::map<int, std::string>::iterator blockName = m_nameMap.find(content);
|
||||||
if (blockName == m_nameMap.end())
|
if (blockName == m_nameMap.end())
|
||||||
continue;
|
continue;
|
||||||
const string &name = blockName->second;
|
const string &name = blockName->second;
|
||||||
ColorMap::const_iterator color = m_colors.find(name);
|
ColorMap::const_iterator color = m_colors.find(name);
|
||||||
if (color != m_colors.end()) {
|
if (color != m_colors.end()) {
|
||||||
const Color c = color->second.to_color();
|
const Color c = color->second.to_color();
|
||||||
if (m_drawAlpha) {
|
if (m_drawAlpha) {
|
||||||
if (col.a == 0)
|
if (col.a == 0)
|
||||||
col = c;
|
col = c;
|
||||||
else
|
else
|
||||||
col = mixColors(col, c);
|
col = mixColors(col, c);
|
||||||
if(col.a == 0xFF) {
|
if(col.a == 0xFF) {
|
||||||
m_image->tpixels[imageY][imageX] = color2int(col);
|
m_image->tpixels[imageY][imageX] = color2int(col);
|
||||||
m_blockPixelAttributes.attribute(15 - z, xBegin + x).thicken = th;
|
m_blockPixelAttributes.attribute(15 - z, xBegin + x).thicken = th;
|
||||||
} else {
|
} else {
|
||||||
th = (th + color->second.t) / 2.0;
|
th = (th + color->second.t) / 2.0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
m_image->tpixels[imageY][imageX] = color2int(c);
|
m_image->tpixels[imageY][imageX] = color2int(c);
|
||||||
m_readedPixels[z] |= (1 << x);
|
m_readedPixels[z] |= (1 << x);
|
||||||
m_blockPixelAttributes.attribute(15 - z, xBegin + x).height = pos.y * 16 + y;
|
m_blockPixelAttributes.attribute(15 - z, xBegin + x).height = pos.y * 16 + y;
|
||||||
} else {
|
} else {
|
||||||
@ -600,7 +600,7 @@ inline void TileGenerator::renderShading(int zPos)
|
|||||||
d = 36;
|
d = 36;
|
||||||
}
|
}
|
||||||
if (m_drawAlpha)
|
if (m_drawAlpha)
|
||||||
d = d * ((0xFF - m_blockPixelAttributes.attribute(z, x).thicken) / 255.0);
|
d = d * ((0xFF - m_blockPixelAttributes.attribute(z, x).thicken) / 255.0);
|
||||||
int sourceColor = m_image->tpixels[imageY][getImageX(x)] & 0xffffff;
|
int sourceColor = m_image->tpixels[imageY][getImageX(x)] & 0xffffff;
|
||||||
uint8_t r = (sourceColor & 0xff0000) >> 16;
|
uint8_t r = (sourceColor & 0xff0000) >> 16;
|
||||||
uint8_t g = (sourceColor & 0x00ff00) >> 8;
|
uint8_t g = (sourceColor & 0x00ff00) >> 8;
|
||||||
|
@ -31,7 +31,7 @@ struct Color {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct ColorEntry {
|
struct ColorEntry {
|
||||||
ColorEntry(): r(0), g(0), b(0), a(0), t(0) {};
|
ColorEntry(): r(0), g(0), b(0), a(0), t(0) {};
|
||||||
ColorEntry(uint8_t r, uint8_t g, uint8_t b, uint8_t a, uint8_t t): r(r), g(g), b(b), a(a), t(t) {};
|
ColorEntry(uint8_t r, uint8_t g, uint8_t b, uint8_t a, uint8_t t): r(r), g(g), b(b), a(a), t(t) {};
|
||||||
inline Color to_color() const { return Color(r, g, b, a); }
|
inline Color to_color() const { return Color(r, g, b, a); }
|
||||||
uint8_t r;
|
uint8_t r;
|
||||||
|
Loading…
Reference in New Issue
Block a user