Namespaced blocky and cubes internal functions

This commit is contained in:
Marc Gilleron 2022-01-04 00:17:56 +00:00
parent c672e21ff3
commit 1f579cf860
2 changed files with 14 additions and 3 deletions

View File

@ -7,9 +7,10 @@
using namespace zylann;
namespace zylann::voxel {
// Utility functions
namespace {
const int g_opposite_side[6] = {
Cube::SIDE_NEGATIVE_X, //
Cube::SIDE_POSITIVE_X, //
@ -46,7 +47,7 @@ inline bool contributes_to_ao(const VoxelLibrary::BakedData &lib, uint32_t voxel
} // namespace
template <typename Type_T>
static void generate_blocky_mesh(
void generate_blocky_mesh(
FixedArray<VoxelMesherBlocky::Arrays, VoxelMesherBlocky::MAX_MATERIALS> &out_arrays_per_material,
const Span<Type_T> type_buffer, const Vector3i block_size, const VoxelLibrary::BakedData &library,
bool bake_occlusion, float baked_occlusion_darkness) {
@ -331,6 +332,8 @@ static void generate_blocky_mesh(
}
}
} // namespace zylann::voxel
thread_local VoxelMesherBlocky::Cache VoxelMesherBlocky::_cache;
VoxelMesherBlocky::VoxelMesherBlocky() {
@ -370,6 +373,8 @@ bool VoxelMesherBlocky::get_occlusion_enabled() const {
}
void VoxelMesherBlocky::build(VoxelMesher::Output &output, const VoxelMesher::Input &input) {
using namespace zylann::voxel;
const int channel = VoxelBuffer::CHANNEL_TYPE;
Parameters params;
{

View File

@ -4,6 +4,8 @@
#include "../../util/profiling.h"
#include <core/math/geometry_2d.h>
namespace zylann::voxel {
namespace {
// Table of indices for vertices of cube faces
// 2-----3
@ -608,7 +610,7 @@ void build_voxel_mesh_as_greedy_cubes_atlased(
}
}
static Ref<Image> make_greedy_atlas(
Ref<Image> make_greedy_atlas(
const VoxelMesherCubes::GreedyAtlasData &atlas_data, Span<VoxelMesherCubes::Arrays> surfaces) {
//
ERR_FAIL_COND_V(atlas_data.images.size() == 0, Ref<Image>());
@ -692,6 +694,8 @@ static Ref<Image> make_greedy_atlas(
return image;
}
} // namespace zylann::voxel
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
thread_local VoxelMesherCubes::Cache VoxelMesherCubes::_cache;
@ -703,6 +707,8 @@ VoxelMesherCubes::VoxelMesherCubes() {
VoxelMesherCubes::~VoxelMesherCubes() {}
void VoxelMesherCubes::build(VoxelMesher::Output &output, const VoxelMesher::Input &input) {
using namespace zylann::voxel;
VOXEL_PROFILE_SCOPE();
const int channel = VoxelBufferInternal::CHANNEL_COLOR;
Cache &cache = _cache;