feat: new block custom models implementation (WIP)
This commit is contained in:
@@ -114,12 +114,8 @@ Block::Block(std::string name, const std::string& texture)
|
||||
void Block::cloneTo(Block& dst) {
|
||||
dst.caption = caption;
|
||||
for (int i = 0; i < 6; i++) {
|
||||
dst.textureFaces[i] = textureFaces[i];
|
||||
dst.textureFaces[i] = textureFaces[i];
|
||||
}
|
||||
dst.modelTextures = modelTextures;
|
||||
dst.modelBoxes = modelBoxes;
|
||||
dst.modelExtraPoints = modelExtraPoints;
|
||||
dst.modelUVs = modelUVs;
|
||||
dst.material = material;
|
||||
std::copy(&emission[0], &emission[3], dst.emission);
|
||||
dst.size = size;
|
||||
@@ -143,7 +139,10 @@ void Block::cloneTo(Block& dst) {
|
||||
dst.inventorySize = inventorySize;
|
||||
dst.tickInterval = tickInterval;
|
||||
dst.overlayTexture = overlayTexture;
|
||||
dst.particles = std::make_unique<ParticlesPreset>(*particles);
|
||||
if (particles) {
|
||||
dst.particles = std::make_unique<ParticlesPreset>(*particles);
|
||||
}
|
||||
dst.customModelRaw = customModelRaw;
|
||||
}
|
||||
|
||||
static std::set<std::string, std::less<>> RESERVED_BLOCK_FIELDS {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <vector>
|
||||
#include <array>
|
||||
|
||||
#include "data/dv.hpp"
|
||||
#include "maths/UVRegion.hpp"
|
||||
#include "maths/aabb.hpp"
|
||||
#include "typedefs.hpp"
|
||||
@@ -116,12 +117,6 @@ public:
|
||||
/// @brief Textures set applied to block sides
|
||||
std::array<std::string, 6> textureFaces; // -x,x, -y,y, -z,z
|
||||
|
||||
std::vector<std::string> modelTextures = {};
|
||||
std::vector<BoxModel> modelBoxes = {};
|
||||
// initially made for tetragons
|
||||
std::vector<glm::vec3> modelExtraPoints = {};
|
||||
std::vector<UVRegion> modelUVs = {}; // boxes' tex-UVs also there
|
||||
|
||||
/// @brief id of used BlockMaterial, may specify non-existing material
|
||||
std::string material = DEFAULT_MATERIAL;
|
||||
|
||||
@@ -137,6 +132,9 @@ public:
|
||||
/// @brief Block model type
|
||||
BlockModel model = BlockModel::block;
|
||||
|
||||
/// @brief Custom model raw data
|
||||
dv::value customModelRaw = nullptr;
|
||||
|
||||
/// @brief Does the block passing lights into itself
|
||||
bool lightPassing = false;
|
||||
|
||||
|
||||
@@ -597,8 +597,7 @@ glm::vec3 Chunks::rayCastToObstacle(
|
||||
if (def.obstacle) {
|
||||
if (!def.rt.solid) {
|
||||
const std::vector<AABB>& hitboxes =
|
||||
def.rotatable ? def.rt.hitboxes[voxel->state.rotation]
|
||||
: def.modelBoxes;
|
||||
def.rt.hitboxes[voxel->state.rotation];
|
||||
|
||||
scalar_t distance;
|
||||
glm::ivec3 norm;
|
||||
|
||||
Reference in New Issue
Block a user