+, solidity(0.5f, 0.75f, 1.0f)
+, humidity(-1.0f, 0.0f, 1.0f)
+, temperature(-1.0f, 0.0f, 1.0f)
+, richness(-1.0f, 0.0f, 1.0f)
+, commonness(1.0f) {
+
+}
+
+void BlockType::Copy(const BlockType &other) noexcept {
+ shape = other.shape;
+ textures = other.textures;
+ hsl_mod = other.hsl_mod;
+ rgb_mod = other.rgb_mod;
+ outline_color = other.outline_color;
+ place_sound = other.place_sound;
+ remove_sound = other.remove_sound;
+ luminosity = other.luminosity;
+ visible = other.visible;
+ block_light = other.block_light;
+ collision = other.collision;
+ collide_block = collide_block;
+ generate = other.generate;
+ solidity = other.solidity;
+ humidity = other.humidity;
+ temperature = other.temperature;
+ richness = other.richness;
+ commonness = other.commonness;
+}
+
+void BlockType::Read(
+ TokenStreamReader &in,
+ ResourceIndex &snd_index,
+ ResourceIndex &tex_index,
+ const ShapeRegistry &shapes
+) {
+ std::string name;
+ in.Skip(Token::ANGLE_BRACKET_OPEN);
+ glm::vec3 color_conv;
+ while (in.Peek().type != Token::ANGLE_BRACKET_CLOSE) {
+ in.ReadIdentifier(name);
+ in.Skip(Token::EQUALS);
+ if (name == "visible") {
+ visible = in.GetBool();
+ } else if (name == "texture") {
+ textures.clear();
+ in.ReadString(name);
+ textures.push_back(tex_index.GetID(name));
+ } else if (name == "textures") {
+ textures.clear();
+ in.Skip(Token::BRACKET_OPEN);
+ while (in.Peek().type != Token::BRACKET_CLOSE) {
+ in.ReadString(name);
+ textures.push_back(tex_index.GetID(name));
+ if (in.Peek().type == Token::COMMA) {
+ in.Skip(Token::COMMA);
+ }
+ }
+ in.Skip(Token::BRACKET_CLOSE);
+ } else if (name == "rgb_mod") {
+ in.ReadVec(color_conv);
+ rgb_mod = BlockMesh::ColorMod(color_conv * 255.0f);
+ } else if (name == "hsl_mod") {
+ in.ReadVec(color_conv);
+ hsl_mod = BlockMesh::ColorMod(color_conv * 255.0f);
+ } else if (name == "outline") {
+ in.ReadVec(color_conv);
+ outline_color = BlockMesh::ColorMod(color_conv * 255.0f);
+ } else if (name == "gravity") {
+ gravity = BlockGravity::Read(in);
+ } else if (name == "label") {
+ in.ReadString(label);
+ } else if (name == "place_sound") {
+ in.ReadString(name);
+ place_sound = snd_index.GetID(name);
+ } else if (name == "remove_sound") {
+ in.ReadString(name);
+ remove_sound = snd_index.GetID(name);
+ } else if (name == "luminosity") {
+ luminosity = in.GetInt();
+ } else if (name == "block_light") {
+ block_light = in.GetBool();
+ } else if (name == "collision") {
+ collision = in.GetBool();
+ } else if (name == "collide_block") {
+ collide_block = in.GetBool();
+ } else if (name == "generate") {
+ generate = in.GetBool();
+ } else if (name == "min_solidity") {
+ solidity.Min(in.GetFloat());
+ } else if (name == "mid_solidity") {
+ solidity.Mid(in.GetFloat());
+ } else if (name == "max_solidity") {
+ solidity.Max(in.GetFloat());
+ } else if (name == "min_humidity") {
+ humidity.Min(in.GetFloat());
+ } else if (name == "mid_humidity") {
+ humidity.Mid(in.GetFloat());
+ } else if (name == "max_humidity") {
+ humidity.Max(in.GetFloat());
+ } else if (name == "min_temperature") {
+ temperature.Min(in.GetFloat());
+ } else if (name == "mid_temperature") {
+ temperature.Mid(in.GetFloat());
+ } else if (name == "max_temperature") {
+ temperature.Max(in.GetFloat());
+ } else if (name == "min_richness") {
+ richness.Min(in.GetFloat());
+ } else if (name == "mid_richness") {
+ richness.Mid(in.GetFloat());
+ } else if (name == "max_richness") {
+ richness.Max(in.GetFloat());
+ } else if (name == "commonness") {
+ commonness = in.GetFloat();
+ } else if (name == "shape") {
+ in.ReadIdentifier(name);
+ shape = &shapes.Get(name);
+ } else {
+ std::cerr << "warning: unknown block type property " << name << std::endl;
+ while (in.Peek().type != Token::SEMICOLON) {
+ in.Next();
+ }
+ }
+ in.Skip(Token::SEMICOLON);
+ }
+ in.Skip(Token::ANGLE_BRACKET_CLOSE);
+}
+
+void BlockType::FillEntityMesh(
+ EntityMesh::Buffer &buf,
+ const glm::mat4 &transform