25 #include <tbb/blocked_range.h>
26 #include <tbb/concurrent_vector.h>
27 #include <tbb/parallel_for.h>
28 #include <tbb/combinable.h>
29 #include "eng3d/map.hpp"
30 #include "eng3d/state.hpp"
31 #include "eng3d/primitive.hpp"
32 #include "eng3d/texture.hpp"
33 #include "eng3d/utils.hpp"
37 map_sphere(0.f, 0.f, 0.f,
Eng3D::GLOBE_RADIUS, 100),
42 for(
int x = -1; x <= 1; x++) {
43 auto square = std::make_unique<Eng3D::Square>(size.x * x, 0.f, size.x * (x + 1), size.y);
44 map_quads.push_back(std::move(square));
49 mipmap_options.
wrap_s = Eng3D::TextureOptions::Wrap::REPEAT;
50 mipmap_options.wrap_t = Eng3D::TextureOptions::Wrap::REPEAT;
51 mipmap_options.min_filter = Eng3D::TextureOptions::Filter::LINEAR_MIPMAP;
52 mipmap_options.mag_filter = Eng3D::TextureOptions::Filter::LINEAR;
53 mipmap_options.compressed =
true;
59 mipmap_options.internal_format = Eng3D::TextureOptions::Format::SRGB;
64 this->terrain_map = std::make_unique<Eng3D::Texture>(this->s.
package_man.
get_unique(
"map/color.png")->get_abs_path());
66 tbb::parallel_for(
static_cast<size_t>(0), this->terrain_map->width * this->terrain_map->height, [
this](
const auto i) {
67 auto* data = &(this->terrain_map->buffer.get()[i]);
68 const auto color = std::byteswap<std::uint32_t>((*data) << 8);
101 *data |= (color == 0x243089 ? 0x00 : 0x02) << 16;
106 this->terrain_sheet = std::make_unique<Eng3D::TextureArray>(this->s.package_man.get_unique(
"gfx/terrain_sheet.png")->get_abs_path(), 4, 4);
107 this->terrain_sheet->upload();
BaseMap(Eng3D::State &s, glm::ivec2 size)
std::shared_ptr< Eng3D::IO::Asset::Base > get_unique(const Eng3D::IO::Path &path)
Obtaining an unique asset means the "first-found" policy applies.
Eng3D::TextureManager tex_man
Eng3D::IO::PackageManager package_man
std::shared_ptr< Eng3D::Texture > load(const std::string &path, TextureOptions options=default_options)
Finds a texture in the list of a texture manager if the texture is already in the list we load the sa...
enum Eng3D::TextureOptions::Wrap wrap_s
void parallel_for(T range, F &&func)