Geodot Plugin
Loading...
Searching...
No Matches
geoimage.h
1#ifndef __RASTER_H__
2#define __RASTER_H__
3
4#include <godot_cpp/classes/global_constants.hpp>
5#include <godot_cpp/classes/height_map_shape3d.hpp>
6#include <godot_cpp/classes/image.hpp>
7#include <godot_cpp/classes/image_texture.hpp>
8#include <godot_cpp/classes/mutex.hpp>
9
10#include <godot_cpp/core/binder_common.hpp>
11
12#include "GeoRaster.h"
13#include "defines.h"
14
15namespace godot {
16
17// Wrapper for a GeoRaster from the RasterTileExtractor.
18// Provides data in a format directly compatible with Godot (using Godot types).
19// Think of it as an extension of a normal Godot Image / ImageTexture (which can
20// be acquired with get_image / get_image_texture) Note that a GeoImage should
21// not be created manually from Godot. It is only used as the return type of
22// Geodot functions such as Geodot::get_image.
23class EXPORT GeoImage : public RefCounted {
24 GDCLASS(GeoImage, RefCounted)
25
26 protected:
27 static void _bind_methods();
28
29 public:
30 enum INTERPOLATION {
31 NEAREST,
32 BILINEAR,
33 CUBIC,
34 CUBICSPLINE,
35 LANCZOS,
36 AVG,
37 MODE,
38 MAX,
39 MIN,
40 MED,
41 Q1,
42 Q2,
43 };
44
45 GeoImage();
46 ~GeoImage();
47
48 bool is_valid();
49
53 void set_raster(GeoRaster *raster, INTERPOLATION interpolation);
54
56 void set_raster_from_band(GeoRaster *raster, INTERPOLATION interpolation, int band_index);
57
59 Ref<Image> get_image();
60
62 Ref<ImageTexture> get_image_texture();
63
67 Ref<Image> get_normalmap_for_heightmap(float scale);
68
74 Ref<HeightMapShape3D> get_shape_for_heightmap();
75
78 Ref<ImageTexture> get_normalmap_texture_for_heightmap(float scale);
79
82 Array get_most_common(int number_of_entries);
83
84 private:
85 GeoRaster *raster;
86
87 Ref<Image> image;
88
89 Ref<Image> normalmap;
90
91 Ref<Mutex> normalmap_load_mutex;
92
93 INTERPOLATION interpolation;
94
95 bool validity = false;
96};
97
98} // namespace godot
99
100VARIANT_ENUM_CAST(GeoImage::INTERPOLATION);
101
102#endif // __RASTER_H__
Definition: GeoRaster.h:24
Definition: geoimage.h:23