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