Added a new flags default channel. Also added flags enum for it.

This commit is contained in:
Relintai 2022-02-26 14:56:04 +01:00
parent 0298d0216f
commit b30c1b9153
2 changed files with 36 additions and 0 deletions

View File

@ -923,6 +923,7 @@ void Terrain2DChunkDefault::_bind_methods() {
ClassDB::bind_method(D_METHOD("_finalize_build"), &Terrain2DChunkDefault::_finalize_build);
BIND_ENUM_CONSTANT(DEFAULT_CHANNEL_TYPE);
BIND_ENUM_CONSTANT(DEFAULT_CHANNEL_FLAGS);
BIND_ENUM_CONSTANT(DEFAULT_CHANNEL_LIQUID_TYPE);
BIND_ENUM_CONSTANT(DEFAULT_CHANNEL_LIGHT_COLOR_R);
BIND_ENUM_CONSTANT(DEFAULT_CHANNEL_LIGHT_COLOR_G);
@ -931,6 +932,18 @@ void Terrain2DChunkDefault::_bind_methods() {
BIND_ENUM_CONSTANT(DEFAULT_CHANNEL_RANDOM_AO);
BIND_ENUM_CONSTANT(MAX_DEFAULT_CHANNELS);
BIND_ENUM_CONSTANT(FLAG_CHANNEL_WALL_NORTH);
BIND_ENUM_CONSTANT(FLAG_CHANNEL_WALL_PY);
BIND_ENUM_CONSTANT(FLAG_CHANNEL_WALL_SOUTH);
BIND_ENUM_CONSTANT(FLAG_CHANNEL_WALL_NY);
BIND_ENUM_CONSTANT(FLAG_CHANNEL_WALL_EAST);
BIND_ENUM_CONSTANT(FLAG_CHANNEL_WALL_PX);
BIND_ENUM_CONSTANT(FLAG_CHANNEL_WALL_WEST);
BIND_ENUM_CONSTANT(FLAG_CHANNEL_WALL_NX);
BIND_ENUM_CONSTANT(FLAG_CHANNEL_WALL_COLLIDER);
BIND_ENUM_CONSTANT(FLAG_CHANNEL_WALL_FLIP_H);
BIND_ENUM_CONSTANT(FLAG_CHANNEL_WALL_FLIP_V);
BIND_CONSTANT(MESH_INDEX_TERRAIN);
BIND_CONSTANT(MESH_INDEX_PROP);
BIND_CONSTANT(MESH_INDEX_LIQUID);

View File

@ -63,6 +63,7 @@ public:
enum DefaultChannels {
DEFAULT_CHANNEL_TYPE = 0,
DEFAULT_CHANNEL_FLAGS,
DEFAULT_CHANNEL_LIQUID_TYPE,
DEFAULT_CHANNEL_LIGHT_COLOR_R,
DEFAULT_CHANNEL_LIGHT_COLOR_G,
@ -72,6 +73,27 @@ public:
MAX_DEFAULT_CHANNELS
};
enum ChannelFlags {
//+y
FLAG_CHANNEL_WALL_NORTH = 1 << 0,
FLAG_CHANNEL_WALL_PY = 1 << 0,
//-y
FLAG_CHANNEL_WALL_SOUTH = 1 << 1,
FLAG_CHANNEL_WALL_NY = 1 << 1,
//+x
FLAG_CHANNEL_WALL_EAST = 1 << 2,
FLAG_CHANNEL_WALL_PX = 1 << 2,
//-x
FLAG_CHANNEL_WALL_WEST = 1 << 3,
FLAG_CHANNEL_WALL_NX = 1 << 3,
FLAG_CHANNEL_WALL_COLLIDER = 1 << 4,
FLAG_CHANNEL_WALL_FLIP_H = 1 << 5,
FLAG_CHANNEL_WALL_FLIP_V= 1 << 6,
//All of these has to fit to a uint8_t!
//Don't add more than one actual flag entry!
};
enum {
MESH_INDEX_TERRAIN = 0,
MESH_INDEX_PROP,
@ -211,5 +233,6 @@ protected:
VARIANT_ENUM_CAST(Terrain2DChunkDefault::DefaultChannels);
VARIANT_ENUM_CAST(Terrain2DChunkDefault::BuildFlags);
VARIANT_ENUM_CAST(Terrain2DChunkDefault::ChannelFlags);
#endif