mirror of
https://github.com/Relintai/voxelman.git
synced 2025-01-12 15:01:09 +01:00
Ran clang format, as apparently I had it off.
This commit is contained in:
parent
01c57c30e6
commit
1f23f61b3a
@ -60,11 +60,11 @@ void VoxelmanLibrary::clear_materials() {
|
||||
Vector<Variant> VoxelmanLibrary::get_materials() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _materials.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_materials[i].get_ref_ptr());
|
||||
#else
|
||||
#else
|
||||
r.push_back(_materials[i]);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
}
|
||||
@ -113,11 +113,11 @@ void VoxelmanLibrary::clear_liquid_materials() {
|
||||
Vector<Variant> VoxelmanLibrary::get_liquid_materials() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _liquid_materials.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_liquid_materials[i].get_ref_ptr());
|
||||
#else
|
||||
#else
|
||||
r.push_back(_liquid_materials[i]);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
@ -135,11 +135,11 @@ void VoxelmanLibraryMerger::clear_surfaces() {
|
||||
Vector<Variant> VoxelmanLibraryMerger::get_voxel_surfaces() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _voxel_surfaces.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_voxel_surfaces[i].get_ref_ptr());
|
||||
#else
|
||||
#else
|
||||
r.push_back(_voxel_surfaces[i]);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
}
|
||||
@ -217,11 +217,11 @@ void VoxelmanLibraryMerger::clear_liquid_surfaces() {
|
||||
Vector<Variant> VoxelmanLibraryMerger::get_liquid_voxel_surfaces() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _liquid_surfaces.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_liquid_surfaces[i].get_ref_ptr());
|
||||
#else
|
||||
#else
|
||||
r.push_back(_liquid_surfaces[i]);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
}
|
||||
@ -387,11 +387,11 @@ void VoxelmanLibraryMerger::_setup_material_albedo(int material_index, Ref<Textu
|
||||
VoxelmanLibraryMerger::VoxelmanLibraryMerger() {
|
||||
_packer.instance();
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
#if VERSION_MAJOR < 4
|
||||
_packer->set_texture_flags(Texture::FLAG_MIPMAPS | Texture::FLAG_FILTER);
|
||||
#else
|
||||
//nyi
|
||||
#endif
|
||||
#else
|
||||
//nyi
|
||||
#endif
|
||||
|
||||
_packer->set_max_atlas_size(1024);
|
||||
_packer->set_keep_original_atlases(false);
|
||||
|
@ -91,11 +91,11 @@ void VoxelmanLibrarySimple::clear_surfaces() {
|
||||
Vector<Variant> VoxelmanLibrarySimple::get_voxel_surfaces() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _voxel_surfaces.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_voxel_surfaces[i].get_ref_ptr());
|
||||
#else
|
||||
#else
|
||||
r.push_back(_voxel_surfaces[i]);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
}
|
||||
@ -164,11 +164,11 @@ void VoxelmanLibrarySimple::clear_liquid_surfaces() {
|
||||
Vector<Variant> VoxelmanLibrarySimple::get_liquid_voxel_surfaces() {
|
||||
Vector<Variant> r;
|
||||
for (int i = 0; i < _liquid_surfaces.size(); i++) {
|
||||
#if VERSION_MAJOR < 4
|
||||
#if VERSION_MAJOR < 4
|
||||
r.push_back(_liquid_surfaces[i].get_ref_ptr());
|
||||
#else
|
||||
#else
|
||||
r.push_back(_liquid_surfaces[i]);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ typedef class RenderingServer VisualServer;
|
||||
typedef class RenderingServer VS;
|
||||
#endif
|
||||
|
||||
|
||||
void VoxelMesherCubic::_add_chunk(Ref<VoxelChunk> p_chunk) {
|
||||
Ref<VoxelChunkDefault> chunk = p_chunk;
|
||||
|
||||
|
@ -167,17 +167,17 @@ Array VoxelMesher::build_mesh() {
|
||||
{
|
||||
PoolVector<Vector3> array;
|
||||
array.resize(_vertices.size());
|
||||
#if VERSION_MAJOR < 4
|
||||
#if VERSION_MAJOR < 4
|
||||
PoolVector<Vector3>::Write w = array.write();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < _vertices.size(); ++i) {
|
||||
array.set(i, _vertices[i].vertex);
|
||||
}
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
#if VERSION_MAJOR < 4
|
||||
w.release();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
a[VisualServer::ARRAY_VERTEX] = array;
|
||||
}
|
||||
@ -189,51 +189,51 @@ Array VoxelMesher::build_mesh() {
|
||||
{
|
||||
PoolVector<Vector3> array;
|
||||
array.resize(_vertices.size());
|
||||
#if VERSION_MAJOR < 4
|
||||
#if VERSION_MAJOR < 4
|
||||
PoolVector<Vector3>::Write w = array.write();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < _vertices.size(); ++i) {
|
||||
array.set(i, _vertices[i].normal);
|
||||
}
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
#if VERSION_MAJOR < 4
|
||||
w.release();
|
||||
#endif
|
||||
#endif
|
||||
a[VisualServer::ARRAY_NORMAL] = array;
|
||||
}
|
||||
|
||||
if ((_format & VisualServer::ARRAY_FORMAT_COLOR) != 0) {
|
||||
PoolVector<Color> array;
|
||||
array.resize(_vertices.size());
|
||||
#if VERSION_MAJOR < 4
|
||||
#if VERSION_MAJOR < 4
|
||||
PoolVector<Color>::Write w = array.write();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < _vertices.size(); ++i) {
|
||||
array.set(i, _vertices[i].color);
|
||||
}
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
#if VERSION_MAJOR < 4
|
||||
w.release();
|
||||
#endif
|
||||
#endif
|
||||
a[VisualServer::ARRAY_COLOR] = array;
|
||||
}
|
||||
|
||||
if ((_format & VisualServer::ARRAY_FORMAT_TEX_UV) != 0) {
|
||||
PoolVector<Vector2> array;
|
||||
array.resize(_vertices.size());
|
||||
#if VERSION_MAJOR < 4
|
||||
#if VERSION_MAJOR < 4
|
||||
PoolVector<Vector2>::Write w = array.write();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < _vertices.size(); ++i) {
|
||||
array.set(i, _vertices[i].uv);
|
||||
}
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
#if VERSION_MAJOR < 4
|
||||
w.release();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
a[VisualServer::ARRAY_TEX_UV] = array;
|
||||
}
|
||||
@ -241,34 +241,34 @@ Array VoxelMesher::build_mesh() {
|
||||
if ((_format & VisualServer::ARRAY_FORMAT_TEX_UV2) != 0) {
|
||||
PoolVector<Vector2> array;
|
||||
array.resize(_vertices.size());
|
||||
#if VERSION_MAJOR < 4
|
||||
#if VERSION_MAJOR < 4
|
||||
PoolVector<Vector2>::Write w = array.write();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < _vertices.size(); ++i) {
|
||||
array.set(i, _vertices[i].uv2);
|
||||
}
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
#if VERSION_MAJOR < 4
|
||||
w.release();
|
||||
#endif
|
||||
#endif
|
||||
a[VisualServer::ARRAY_TEX_UV2] = array;
|
||||
}
|
||||
|
||||
if (_indices.size() > 0) {
|
||||
PoolVector<int> array;
|
||||
array.resize(_indices.size());
|
||||
#if VERSION_MAJOR < 4
|
||||
#if VERSION_MAJOR < 4
|
||||
PoolVector<int>::Write w = array.write();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < _indices.size(); ++i) {
|
||||
array.set(i, _indices[i]);
|
||||
}
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
#if VERSION_MAJOR < 4
|
||||
w.release();
|
||||
#endif
|
||||
#endif
|
||||
a[VisualServer::ARRAY_INDEX] = array;
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,6 @@ SOFTWARE.
|
||||
typedef class ImmediateGeometry3D ImmediateGeometry;
|
||||
#endif
|
||||
|
||||
|
||||
#include "core/engine.h"
|
||||
#include "core/os/mutex.h"
|
||||
#include "core/os/thread.h"
|
||||
|
@ -445,15 +445,15 @@ PoolByteArray VoxelChunk::get_channel_compressed(int channel_index) const {
|
||||
int bound = LZ4_compressBound(size);
|
||||
arr.resize(bound);
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
#if VERSION_MAJOR < 4
|
||||
PoolByteArray::Write w = arr.write();
|
||||
|
||||
int ns = LZ4_compress_default(reinterpret_cast<char *>(ch), reinterpret_cast<char *>(w.ptr()), size, bound);
|
||||
|
||||
|
||||
w.release();
|
||||
#else
|
||||
#else
|
||||
int ns = LZ4_compress_default(reinterpret_cast<char *>(ch), reinterpret_cast<char *>(arr.ptrw()), size, bound);
|
||||
#endif
|
||||
#endif
|
||||
arr.resize(ns);
|
||||
|
||||
return arr;
|
||||
@ -479,19 +479,19 @@ void VoxelChunk::set_channel_compressed(int channel_index, const PoolByteArray &
|
||||
|
||||
int ds = data.size();
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
#if VERSION_MAJOR < 4
|
||||
PoolByteArray::Read r = data.read();
|
||||
|
||||
//We are not going to write to it
|
||||
uint8_t *data_arr = const_cast<uint8_t *>(r.ptr());
|
||||
|
||||
LZ4_decompress_safe(reinterpret_cast<char *>(data_arr), reinterpret_cast<char *>(ch), ds, size);
|
||||
#else
|
||||
#else
|
||||
//We are not going to write to it
|
||||
uint8_t *data_arr = const_cast<uint8_t *>(data.ptr());
|
||||
|
||||
LZ4_decompress_safe(reinterpret_cast<char *>(data_arr), reinterpret_cast<char *>(ch), ds, size);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ int VoxelChunk::get_index(const int x, const int y, const int z) const {
|
||||
@ -588,9 +588,9 @@ Array VoxelChunk::bake_mesh_array_uv(Array arr, Ref<Texture> tex, float mul_colo
|
||||
PoolVector2Array uvs = arr[VisualServer::ARRAY_TEX_UV];
|
||||
PoolColorArray colors = arr[VisualServer::ARRAY_COLOR];
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
#if VERSION_MAJOR < 4
|
||||
img->lock();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < uvs.size(); ++i) {
|
||||
Vector2 uv = uvs[i];
|
||||
@ -601,9 +601,9 @@ Array VoxelChunk::bake_mesh_array_uv(Array arr, Ref<Texture> tex, float mul_colo
|
||||
colors.set(i, colors[i] * c * mul_color);
|
||||
}
|
||||
|
||||
#if VERSION_MAJOR < 4
|
||||
#if VERSION_MAJOR < 4
|
||||
img->unlock();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
arr[VisualServer::ARRAY_COLOR] = colors;
|
||||
|
||||
|
@ -63,7 +63,6 @@ SOFTWARE.
|
||||
|
||||
class VoxelWorld;
|
||||
|
||||
|
||||
class VoxelChunk : public Resource {
|
||||
GDCLASS(VoxelChunk, Resource);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user