mirror of
https://github.com/minetest/minetestmapper.git
synced 2024-11-13 22:20:29 +01:00
Add a flag to never output empty images.
This commit is contained in:
parent
ac15bacf36
commit
ee5b8a9f86
|
@ -83,6 +83,9 @@ extent:
|
|||
noshading:
|
||||
Don't draw shading on nodes, ``--noshading``
|
||||
|
||||
noemptyimage:
|
||||
Don't output anything when the image would be empty, ``--noemptyimage``
|
||||
|
||||
min-y:
|
||||
Don't draw nodes below this y value, e.g. ``--min-y -25``
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ TileGenerator::TileGenerator():
|
|||
m_drawScale(false),
|
||||
m_drawAlpha(false),
|
||||
m_shading(true),
|
||||
m_dontWriteEmpty(false),
|
||||
m_backend(""),
|
||||
m_xBorder(0),
|
||||
m_yBorder(0),
|
||||
|
@ -228,6 +229,10 @@ void TileGenerator::printGeometry(const std::string &input)
|
|||
|
||||
}
|
||||
|
||||
void TileGenerator::setDontWriteEmpty(bool f)
|
||||
{
|
||||
m_dontWriteEmpty = f;
|
||||
}
|
||||
|
||||
void TileGenerator::generate(const std::string &input, const std::string &output)
|
||||
{
|
||||
|
@ -238,6 +243,13 @@ void TileGenerator::generate(const std::string &input, const std::string &output
|
|||
|
||||
openDb(input_path);
|
||||
loadBlocks();
|
||||
|
||||
if (m_dontWriteEmpty && ! m_positions.size())
|
||||
{
|
||||
closeDatabase();
|
||||
return;
|
||||
}
|
||||
|
||||
createImage();
|
||||
renderMap();
|
||||
closeDatabase();
|
||||
|
|
|
@ -89,6 +89,7 @@ public:
|
|||
void printGeometry(const std::string &input);
|
||||
void setZoom(int zoom);
|
||||
void setScales(uint flags);
|
||||
void setDontWriteEmpty(bool f);
|
||||
|
||||
private:
|
||||
void parseColorsStream(std::istream &in);
|
||||
|
@ -120,6 +121,7 @@ private:
|
|||
bool m_drawScale;
|
||||
bool m_drawAlpha;
|
||||
bool m_shading;
|
||||
bool m_dontWriteEmpty;
|
||||
std::string m_backend;
|
||||
int m_xBorder, m_yBorder;
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ void usage()
|
|||
" --draworigin\n"
|
||||
" --drawalpha\n"
|
||||
" --noshading\n"
|
||||
" --noemptyimage\n"
|
||||
" --min-y <y>\n"
|
||||
" --max-y <y>\n"
|
||||
" --backend <backend>\n"
|
||||
|
@ -87,6 +88,7 @@ int main(int argc, char *argv[])
|
|||
{"zoom", required_argument, 0, 'z'},
|
||||
{"colors", required_argument, 0, 'C'},
|
||||
{"scales", required_argument, 0, 'f'},
|
||||
{"noemptyimage", no_argument, 0, 'n'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
@ -195,6 +197,9 @@ int main(int argc, char *argv[])
|
|||
case 'C':
|
||||
colors = optarg;
|
||||
break;
|
||||
case 'n':
|
||||
generator.setDontWriteEmpty(true);
|
||||
break;
|
||||
default:
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -56,6 +56,10 @@ Allow nodes to be drawn with transparency
|
|||
.BR \-\-noshading
|
||||
Don't draw shading on nodes
|
||||
|
||||
.TP
|
||||
.BR \-\-noemptyimage
|
||||
Don't output anything when the image would be empty.
|
||||
|
||||
.TP
|
||||
.BR \-\-min-y " " \fInumber\fR
|
||||
Don't draw nodes below this y value, e.g. "--min-y -25"
|
||||
|
|
Loading…
Reference in New Issue
Block a user