Namespaced Color8

This commit is contained in:
Marc Gilleron 2022-01-04 22:30:46 +00:00
parent 64415a3c86
commit 09899eef97
11 changed files with 29 additions and 12 deletions

View File

@ -13,7 +13,8 @@
#include <scene/resources/mesh.h>
#include <scene/resources/packed_scene.h>
using namespace zylann::voxel;
using namespace zylann;
using namespace voxel;
String VoxelVoxImporter::get_importer_name() const {
return "VoxelVoxImporter";

View File

@ -5,12 +5,15 @@
#include <scene/resources/mesh.h>
using namespace zylann;
namespace VoxelDebug {
FixedArray<Ref<Mesh>, ID_COUNT> g_wirecubes;
bool g_finalized = false;
template <typename T> void raw_copy_to(Vector<T> &dst, const T *src, unsigned int count) {
template <typename T>
void raw_copy_to(Vector<T> &dst, const T *src, unsigned int count) {
dst.resize(count);
memcpy(dst.ptrw(), src, count * sizeof(T));
}

View File

@ -29,7 +29,7 @@ public:
void set_world(World3D *world);
void begin();
void draw_box(const Transform3D &t, Color8 color);
void draw_box(const Transform3D &t, zylann::Color8 color);
void end();
void clear();
@ -60,7 +60,7 @@ public:
// Draws a box wireframe using MultiMesh, allowing to draw much more without slowing down.
// The box's origin is its lower corner. Size is defined by the transform's basis.
void draw_box_mm(const Transform3D &t, Color8 color);
void draw_box_mm(const Transform3D &t, zylann::Color8 color);
// Call this after issuing all drawing commands
void end();

View File

@ -1,5 +1,7 @@
#include "voxel_color_palette.h"
using namespace zylann;
VoxelColorPalette::VoxelColorPalette() {
// Default palette
_colors[0] = Color8(0, 0, 0, 0);

View File

@ -23,11 +23,11 @@ public:
// Internal
inline void set_color8(uint8_t i, Color8 c) {
inline void set_color8(uint8_t i, zylann::Color8 c) {
_colors[i] = c;
}
inline Color8 get_color8(uint8_t i) const {
inline zylann::Color8 get_color8(uint8_t i) const {
return _colors[i];
}
@ -37,7 +37,7 @@ private:
static void _bind_methods();
FixedArray<Color8, MAX_COLORS> _colors;
FixedArray<zylann::Color8, MAX_COLORS> _colors;
};
#endif // VOXEL_COLOR_PALETTE_H

View File

@ -707,7 +707,8 @@ VoxelMesherCubes::VoxelMesherCubes() {
VoxelMesherCubes::~VoxelMesherCubes() {}
void VoxelMesherCubes::build(VoxelMesher::Output &output, const VoxelMesher::Input &input) {
using namespace zylann::voxel;
using namespace zylann;
using namespace voxel;
VOXEL_PROFILE_SCOPE();
const int channel = VoxelBufferInternal::CHANNEL_COLOR;

View File

@ -11,7 +11,7 @@ class VoxelMesherCubes : public VoxelMesher {
public:
static const unsigned int PADDING = 1;
enum Materials {
enum Materials { //
MATERIAL_OPAQUE = 0,
MATERIAL_TRANSPARENT,
MATERIAL_COUNT
@ -51,7 +51,9 @@ public:
void set_store_colors_in_texture(bool enable);
bool get_store_colors_in_texture() const;
bool supports_lod() const override { return true; }
bool supports_lod() const override {
return true;
}
// Structs
@ -81,7 +83,7 @@ public:
unsigned int size_y;
unsigned int surface_index;
};
std::vector<Color8> colors;
std::vector<zylann::Color8> colors;
std::vector<ImageInfo> images;
void clear() {

View File

@ -3,6 +3,8 @@
#include "../storage/voxel_buffer.h"
#include "vox_data.h"
using namespace zylann;
Error VoxelVoxLoader::load_from_file(String fpath, Ref<VoxelBuffer> p_voxels, Ref<VoxelColorPalette> palette) {
ERR_FAIL_COND_V(p_voxels.is_null(), ERR_INVALID_PARAMETER);
VoxelBufferInternal &voxels = p_voxels->get_buffer();

View File

@ -3,6 +3,8 @@
#include <scene/resources/world_3d.h>
using namespace zylann;
DirectMultiMeshInstance::DirectMultiMeshInstance() {}
DirectMultiMeshInstance::~DirectMultiMeshInstance() {

View File

@ -31,7 +31,7 @@ public:
struct TransformAndColor8 {
Transform3D transform;
Color8 color;
zylann::Color8 color;
};
static void make_transform_and_color8_3d_bulk_array(

View File

@ -3,6 +3,8 @@
#include <core/math/color.h>
namespace zylann {
struct Color8 {
union {
struct {
@ -65,4 +67,6 @@ struct Color8 {
}
};
} // namespace zylann
#endif // COLOR8_H