mirror of
https://github.com/Relintai/godot_voxel.git
synced 2024-12-22 01:26:50 +01:00
Use named constant
This commit is contained in:
parent
a0026dbbeb
commit
085f94579a
@ -138,7 +138,7 @@ const unsigned int g_edge_corners[EDGE_COUNT][2] = {
|
||||
};
|
||||
|
||||
// Order is irrelevant
|
||||
const Vector3i g_moore_neighboring_3d[26] = {
|
||||
const Vector3i g_moore_neighboring_3d[MOORE_NEIGHBORING_3D_COUNT] = {
|
||||
Vector3i(-1, -1, -1),
|
||||
Vector3i(0, -1, -1),
|
||||
Vector3i(1, -1, -1),
|
||||
|
@ -9,6 +9,7 @@ namespace CubeTables {
|
||||
|
||||
const unsigned int CORNER_COUNT = 8;
|
||||
const unsigned int EDGE_COUNT = 12;
|
||||
const unsigned int MOORE_NEIGHBORING_3D_COUNT = 26;
|
||||
|
||||
extern const Vector3 g_corner_position[CORNER_COUNT];
|
||||
|
||||
@ -28,7 +29,7 @@ extern const Vector3i g_edge_inormals[EDGE_COUNT];
|
||||
|
||||
extern const unsigned int g_edge_corners[EDGE_COUNT][2];
|
||||
|
||||
extern const Vector3i g_moore_neighboring_3d[26];
|
||||
extern const Vector3i g_moore_neighboring_3d[MOORE_NEIGHBORING_3D_COUNT];
|
||||
|
||||
} // namespace CubeTables
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
#include "voxel_map.h"
|
||||
#include "core/os/os.h"
|
||||
#include "voxel_block.h"
|
||||
#include "cube_tables.h"
|
||||
|
||||
#include "core/os/os.h"
|
||||
|
||||
|
||||
VoxelMap::VoxelMap()
|
||||
: _last_accessed_block(NULL) {
|
||||
@ -102,7 +104,7 @@ bool VoxelMap::has_block(Vector3i pos) const {
|
||||
}
|
||||
|
||||
bool VoxelMap::is_block_surrounded(Vector3i pos) const {
|
||||
for (unsigned int i = 0; i < 26; ++i) {
|
||||
for (unsigned int i = 0; i < CubeTables::MOORE_NEIGHBORING_3D_COUNT; ++i) {
|
||||
Vector3i bpos = pos + CubeTables::g_moore_neighboring_3d[i];
|
||||
if (!has_block(bpos)) {
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user