godot_voxel/streams/voxel_stream_script.h
Marc Gilleron 922f361cb0 Made it compile in Godot 4
- Made a bunch of changes to comply with Godot 4 API
- Use Godot's Vector3i and add the missing stuff with helper functions
- Transvoxel uses custom attributes API, the old way would not work
- Wrap MeshOptimizer in a unique namespace (see build script why)
- Added clang-format file for the module as some rules now differ
- Prevent thirdparty code and lookup tables from being clang-formatted
- Very likely full of runtime bugs that need fixing
2021-12-13 21:38:10 +00:00

30 lines
1.2 KiB
C++

#ifndef VOXEL_STREAM_SCRIPT_H
#define VOXEL_STREAM_SCRIPT_H
#include "voxel_stream.h"
#include <core/object/script_language.h> // needed for GDVIRTUAL macro
#include <core/object/gdvirtual.gen.inc> // Also needed for GDVIRTUAL macro...
// Provides access to a source of paged voxel data, which may load and save.
// Must be implemented in a multi-thread-safe way.
// If you are looking for a more specialized API to generate voxels, use VoxelGenerator.
class VoxelStreamScript : public VoxelStream {
GDCLASS(VoxelStreamScript, VoxelStream)
public:
Result emerge_block(VoxelBufferInternal &out_buffer, Vector3i origin_in_voxels, int lod) override;
void immerge_block(VoxelBufferInternal &buffer, Vector3i origin_in_voxels, int lod) override;
int get_used_channels_mask() const override;
protected:
// TODO Why is it unable to convert `Result` into `Variant` even though a cast is defined in voxel_stream.h???
//GDVIRTUAL3R(VoxelStream::Result, _emerge_block, Ref<VoxelBuffer>, Vector3i, int)
GDVIRTUAL3R(int, _emerge_block, Ref<VoxelBuffer>, Vector3i, int)
GDVIRTUAL3(_immerge_block, Ref<VoxelBuffer>, Vector3i, int)
GDVIRTUAL0RC(int, _get_used_channels_mask) // I think `C` means `const`?
static void _bind_methods();
};
#endif // VOXEL_STREAM_SCRIPT_H