Allow air nodes to have a color.
As this comes with a significant performance penalty, this feature must be enabled using the command-line option --drawair For best results, the color of air should be fully transparent, so that underlying nodes will override it.
This commit is contained in:
parent
ced0390611
commit
f832530bf8
@ -12,6 +12,12 @@
|
|||||||
are: point, line, rectangle, ellipse (circle), text.
|
are: point, line, rectangle, ellipse (circle), text.
|
||||||
Translucency (alpha) is supported, although for ellipses, it does not
|
Translucency (alpha) is supported, although for ellipses, it does not
|
||||||
work as expected (due to a bug in libgd)
|
work as expected (due to a bug in libgd)
|
||||||
|
- 'air' nodes can now have a color. Their color should be defined as fully
|
||||||
|
transparent (alpha = 0), so that they don't obscure underlying blocks.
|
||||||
|
In that case, air will only be drawn if no other blocks are beneath it.
|
||||||
|
Nodes with alpha value 0 never participate in shading.
|
||||||
|
As this comes at a significant performance penalty, this feature is
|
||||||
|
subject to a command-line option: --drawair.
|
||||||
- A default color can be specified for invisible/undefined nodes in rendered
|
- A default color can be specified for invisible/undefined nodes in rendered
|
||||||
blocks Normally, such nodes are not drawn, so they have the background
|
blocks Normally, such nodes are not drawn, so they have the background
|
||||||
color; If a different default color is specified, undefined/invisible
|
color; If a different default color is specified, undefined/invisible
|
||||||
|
@ -171,6 +171,14 @@ draworigin:
|
|||||||
drawalpha:
|
drawalpha:
|
||||||
Allow blocks to be drawn with transparency, `--drawalpha`
|
Allow blocks to be drawn with transparency, `--drawalpha`
|
||||||
|
|
||||||
|
drawair:
|
||||||
|
Draw air blocks (at a significant performance penalty). `--drawair`
|
||||||
|
|
||||||
|
For best results, the air color should be defined as fully transparent
|
||||||
|
so that the color of underlying blocks overrides it.
|
||||||
|
|
||||||
|
This option has a significant performance impact.
|
||||||
|
|
||||||
noshading:
|
noshading:
|
||||||
Don't draw shading on nodes, `--noshading`
|
Don't draw shading on nodes, `--noshading`
|
||||||
|
|
||||||
|
@ -131,6 +131,7 @@ TileGenerator::TileGenerator():
|
|||||||
m_drawPlayers(false),
|
m_drawPlayers(false),
|
||||||
m_drawScale(false),
|
m_drawScale(false),
|
||||||
m_drawAlpha(false),
|
m_drawAlpha(false),
|
||||||
|
m_drawAir(false),
|
||||||
m_shading(true),
|
m_shading(true),
|
||||||
m_border(0),
|
m_border(0),
|
||||||
m_backend(DEFAULT_BACKEND),
|
m_backend(DEFAULT_BACKEND),
|
||||||
@ -268,6 +269,11 @@ void TileGenerator::setDrawAlpha(bool drawAlpha)
|
|||||||
m_drawAlpha = drawAlpha;
|
m_drawAlpha = drawAlpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TileGenerator::setDrawAir(bool drawAir)
|
||||||
|
{
|
||||||
|
m_drawAir = drawAir;
|
||||||
|
}
|
||||||
|
|
||||||
void TileGenerator::setShading(bool shading)
|
void TileGenerator::setShading(bool shading)
|
||||||
{
|
{
|
||||||
m_shading = shading;
|
m_shading = shading;
|
||||||
@ -1089,7 +1095,9 @@ void TileGenerator::processMapBlock(const DB::Block &block)
|
|||||||
readString(name, data, dataOffset, nameLen, length);
|
readString(name, data, dataOffset, nameLen, length);
|
||||||
name = name.c_str(); // Truncate any trailing NUL bytes
|
name = name.c_str(); // Truncate any trailing NUL bytes
|
||||||
if (name == "air") {
|
if (name == "air") {
|
||||||
m_blockAirId = nodeId;
|
ColorMap::const_iterator color = m_colors.find(name);
|
||||||
|
if (!m_drawAir || color == m_colors.end())
|
||||||
|
m_blockAirId = nodeId;
|
||||||
}
|
}
|
||||||
else if (name == "ignore") {
|
else if (name == "ignore") {
|
||||||
m_blockIgnoreId = nodeId;
|
m_blockIgnoreId = nodeId;
|
||||||
|
@ -92,6 +92,7 @@ public:
|
|||||||
void setDrawPlayers(bool drawPlayers);
|
void setDrawPlayers(bool drawPlayers);
|
||||||
void setDrawScale(bool drawScale);
|
void setDrawScale(bool drawScale);
|
||||||
void setDrawAlpha(bool drawAlpha);
|
void setDrawAlpha(bool drawAlpha);
|
||||||
|
void setDrawAir(bool drawAir);
|
||||||
void drawObject(const DrawObject &object) { m_drawObjects.push_back(object); }
|
void drawObject(const DrawObject &object) { m_drawObjects.push_back(object); }
|
||||||
void setShading(bool shading);
|
void setShading(bool shading);
|
||||||
void setGeometry(const NodeCoord &corner1, const NodeCoord &corner2);
|
void setGeometry(const NodeCoord &corner1, const NodeCoord &corner2);
|
||||||
@ -169,6 +170,7 @@ private:
|
|||||||
bool m_drawPlayers;
|
bool m_drawPlayers;
|
||||||
bool m_drawScale;
|
bool m_drawScale;
|
||||||
bool m_drawAlpha;
|
bool m_drawAlpha;
|
||||||
|
bool m_drawAir;
|
||||||
bool m_shading;
|
bool m_shading;
|
||||||
int m_border;
|
int m_border;
|
||||||
std::string m_backend;
|
std::string m_backend;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
air 220 220 255 0
|
||||||
mesecons_pistons:piston_up_sticky_on 160 160 160
|
mesecons_pistons:piston_up_sticky_on 160 160 160
|
||||||
mesecons_pistons:piston_normal_off 125 125 125
|
mesecons_pistons:piston_normal_off 125 125 125
|
||||||
mesecons_pistons:piston_up_pusher_sticky 123 124 124
|
mesecons_pistons:piston_up_pusher_sticky 123 124 124
|
||||||
|
@ -26,6 +26,7 @@ using namespace std;
|
|||||||
#define OPT_PROGRESS_INDICATOR 0x82
|
#define OPT_PROGRESS_INDICATOR 0x82
|
||||||
#define OPT_DRAW_OBJECT 0x83
|
#define OPT_DRAW_OBJECT 0x83
|
||||||
#define OPT_BLOCKCOLOR 0x84
|
#define OPT_BLOCKCOLOR 0x84
|
||||||
|
#define OPT_DRAWAIR 0x85
|
||||||
#define OPT_VERBOSE_SEARCH_COLORS 0x86
|
#define OPT_VERBOSE_SEARCH_COLORS 0x86
|
||||||
|
|
||||||
// Will be replaced with the actual name and location of the executable (if found)
|
// Will be replaced with the actual name and location of the executable (if found)
|
||||||
@ -71,6 +72,7 @@ void usage()
|
|||||||
" --drawplayers\n"
|
" --drawplayers\n"
|
||||||
" --draworigin\n"
|
" --draworigin\n"
|
||||||
" --drawalpha\n"
|
" --drawalpha\n"
|
||||||
|
" --drawair\n"
|
||||||
" --draw[map]point \"<x>,<y> color\"\n"
|
" --draw[map]point \"<x>,<y> color\"\n"
|
||||||
" --draw[map]line \"<geometry> color\"\n"
|
" --draw[map]line \"<geometry> color\"\n"
|
||||||
" --draw[map]circle \"<geometry> color\"\n"
|
" --draw[map]circle \"<geometry> color\"\n"
|
||||||
@ -526,6 +528,7 @@ int main(int argc, char *argv[])
|
|||||||
{"drawplayers", no_argument, 0, 'P'},
|
{"drawplayers", no_argument, 0, 'P'},
|
||||||
{"drawscale", no_argument, 0, 'S'},
|
{"drawscale", no_argument, 0, 'S'},
|
||||||
{"drawalpha", no_argument, 0, 'e'},
|
{"drawalpha", no_argument, 0, 'e'},
|
||||||
|
{"drawair", no_argument, 0, OPT_DRAWAIR},
|
||||||
{"drawpoint", required_argument, 0, OPT_DRAW_OBJECT},
|
{"drawpoint", required_argument, 0, OPT_DRAW_OBJECT},
|
||||||
{"drawline", required_argument, 0, OPT_DRAW_OBJECT},
|
{"drawline", required_argument, 0, OPT_DRAW_OBJECT},
|
||||||
{"drawcircle", required_argument, 0, OPT_DRAW_OBJECT},
|
{"drawcircle", required_argument, 0, OPT_DRAW_OBJECT},
|
||||||
@ -647,6 +650,9 @@ int main(int argc, char *argv[])
|
|||||||
case 'e':
|
case 'e':
|
||||||
generator.setDrawAlpha(true);
|
generator.setDrawAlpha(true);
|
||||||
break;
|
break;
|
||||||
|
case OPT_DRAWAIR:
|
||||||
|
generator.setDrawAir(true);
|
||||||
|
break;
|
||||||
case 'H':
|
case 'H':
|
||||||
generator.setShading(false);
|
generator.setShading(false);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user