Merge branch 'master' into persistence

# Conflicts:
#	voxel_buffer.h
master
Marc Gilleron 2019-06-01 19:53:16 +01:00
commit 94c5d5a78c
5 changed files with 32 additions and 15 deletions

31
SCsub
View File

@ -1,12 +1,25 @@
Import('env')
Import('env_modules')
env.add_source_files(env.modules_sources, "*.cpp")
env.add_source_files(env.modules_sources, "meshers/blocky/*.cpp")
env.add_source_files(env.modules_sources, "meshers/transvoxel/*.cpp")
env.add_source_files(env.modules_sources, "meshers/dmc/*.cpp")
env.add_source_files(env.modules_sources, "meshers/*.cpp")
env.add_source_files(env.modules_sources, "streams/*.cpp")
env.add_source_files(env.modules_sources, "util/*.cpp")
env.add_source_files(env.modules_sources, "terrain/*.cpp")
env.add_source_files(env.modules_sources, "math/*.cpp")
env_voxel = env_modules.Clone()
files = [
"*.cpp",
"meshers/blocky/*.cpp",
"meshers/transvoxel/*.cpp",
"meshers/dmc/*.cpp",
"meshers/*.cpp",
"streams/*.cpp",
"util/*.cpp",
"terrain/*.cpp",
"math/*.cpp"
]
for f in files:
env_voxel.add_source_files(env.modules_sources, f)
# Doesn't work, because reasons
#if env.msvc:
# env_voxel.Append(CXXFLAGS=['/std:c++17'])
#else:
# env_voxel.Append(CXXFLAGS=['-std=c++17'])

View File

@ -1,7 +1,7 @@
#include "voxel_stream_image.h"
VoxelStreamImage::VoxelStreamImage() :
_channel(0) {
_channel(VoxelBuffer::CHANNEL_TYPE) {
}
void VoxelStreamImage::set_image(Ref<Image> im) {
@ -16,7 +16,7 @@ void VoxelStreamImage::set_channel(VoxelBuffer::ChannelId channel) {
_channel = channel;
}
int VoxelStreamImage::get_channel() const {
VoxelBuffer::ChannelId VoxelStreamImage::get_channel() const {
return _channel;
}
@ -107,6 +107,5 @@ void VoxelStreamImage::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_channel"), &VoxelStreamImage::get_channel);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "image", PROPERTY_HINT_RESOURCE_TYPE, "Image"), "set_image", "get_image");
// TODO Enum hint
ADD_PROPERTY(PropertyInfo(Variant::INT, "channel"), "set_channel", "get_channel");
ADD_PROPERTY(PropertyInfo(Variant::INT, "channel", PROPERTY_HINT_ENUM, VoxelBuffer::CHANNEL_ID_HINT_STRING), "set_channel", "get_channel");
}

View File

@ -14,7 +14,7 @@ public:
Ref<Image> get_image() const;
void set_channel(VoxelBuffer::ChannelId channel);
int get_channel() const;
VoxelBuffer::ChannelId get_channel() const;
void emerge_block(Ref<VoxelBuffer> p_out_buffer, Vector3i origin_in_voxels, int lod);
@ -23,7 +23,7 @@ private:
private:
Ref<Image> _image;
int _channel;
VoxelBuffer::ChannelId _channel;
};
#endif // HEADER_VOXEL_STREAM_IMAGE

View File

@ -3,6 +3,8 @@
#include <core/math/math_funcs.h>
#include <string.h>
const char *VoxelBuffer::CHANNEL_ID_HINT_STRING = "Type,Sdf,Data2,Data3,Data4,Data5,Data6,Data7";
VoxelBuffer::VoxelBuffer() {
_channels[CHANNEL_ISOLEVEL].defval = 255;
}

View File

@ -26,6 +26,9 @@ public:
MAX_CHANNELS
};
// TODO use C++17 inline to initialize right here...
static const char *CHANNEL_ID_HINT_STRING;
enum Compression {
COMPRESSION_NONE = 0,
COMPRESSION_UNIFORM,