Project Alice
Loading...
Searching...
No Matches
texture.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "container_types.hpp"
4
5#ifndef GLEW_STATIC
6#define GLEW_STATIC
7#endif
8#include "glew.h"
9#include "culture.hpp"
10
11namespace ogl {
12
13class texture;
14
15GLuint get_texture_handle(sys::state& state, dcon::texture_id id, bool keep_data);
17GLuint get_flag_handle(sys::state& state, dcon::national_identity_id nat_id, culture::flag_type type);
18GLuint get_rebel_flag_handle(sys::state& state, dcon::rebel_faction_id faction);
19GLuint load_file_and_return_handle(native_string const& native_name, simple_fs::file_system const& fs, texture& asset_texture, bool keep_data);
20GLuint get_late_load_texture_handle(sys::state& state, dcon::texture_id& id, std::string_view asset_name);
21
22enum {
24};
25
26GLuint SOIL_direct_load_DDS_from_memory(unsigned char const* const buffer, uint32_t buffer_length, uint32_t& width, uint32_t& height, int soil_flags);
27
28class texture {
29 GLuint texture_handle = 0;
30
31public:
32 uint8_t* data = nullptr;
33 int32_t size_x = 0;
34 int32_t size_y = 0;
35 int32_t channels = 4;
36
37 bool loaded = false;
38
39 texture() { }
40 texture(texture const&) = delete;
41 texture(texture&& other) noexcept;
42 ~texture();
43
44 texture& operator=(texture const&) = delete;
45 texture& operator=(texture&& other) noexcept;
46
47 GLuint get_texture_handle() const;
48
49 friend GLuint get_texture_handle(sys::state& state, dcon::texture_id id, bool keep_data);
50 friend GLuint load_file_and_return_handle(native_string const& native_name, simple_fs::file_system const& fs,
51 texture& asset_texture, bool keep_data);
52 friend GLuint get_flag_handle(sys::state& state, dcon::national_identity_id nat_id, culture::flag_type type);
53 friend GLuint get_rebel_flag_handle(sys::state& state, dcon::rebel_faction_id faction);
54 friend GLuint get_late_load_texture_handle(sys::state& state, dcon::texture_id& id, std::string_view asset_name);
55};
56
58 GLuint texture_handle = 0;
59
60public:
61 uint8_t* data = nullptr;
62 int32_t size = 0;
63 int32_t channels = 4;
64
65 bool data_updated = false;
66
67 data_texture(int32_t sz, int32_t ch);
68 data_texture(data_texture const&) = delete;
69 data_texture(data_texture&& other) noexcept;
70
72 data_texture& operator=(data_texture&& other) noexcept;
73
74 GLuint handle();
76};
77
81};
82
84
85} // namespace ogl
data_texture(data_texture const &)=delete
data_texture & operator=(data_texture const &)=delete
int32_t channels
Definition: texture.hpp:63
texture & operator=(texture const &)=delete
GLuint get_texture_handle() const
Definition: texture.cpp:799
friend GLuint get_rebel_flag_handle(sys::state &state, dcon::rebel_faction_id faction)
Definition: texture.cpp:1010
friend GLuint get_flag_handle(sys::state &state, dcon::national_identity_id nat_id, culture::flag_type type)
Definition: texture.cpp:977
texture(texture const &)=delete
int32_t size_y
Definition: texture.hpp:34
friend GLuint load_file_and_return_handle(native_string const &native_name, simple_fs::file_system const &fs, texture &asset_texture, bool keep_data)
Definition: texture.cpp:804
int32_t size_x
Definition: texture.hpp:33
int32_t channels
Definition: texture.hpp:35
friend GLuint get_late_load_texture_handle(sys::state &state, dcon::texture_id &id, std::string_view asset_name)
Definition: texture.cpp:1049
bool loaded
Definition: texture.hpp:37
GLuint get_late_load_texture_handle(sys::state &state, dcon::texture_id &id, std::string_view asset_name)
Definition: texture.cpp:1049
GLuint get_rebel_flag_handle(sys::state &state, dcon::rebel_faction_id faction)
Definition: texture.cpp:1010
GLuint load_file_and_return_handle(native_string const &native_name, simple_fs::file_system const &fs, texture &asset_texture, bool keep_data)
Definition: texture.cpp:804
GLuint SOIL_direct_load_DDS_from_memory(unsigned char const *const buffer, uint32_t buffer_length, uint32_t &width, uint32_t &height, int soil_flags)
Definition: texture.cpp:101
@ SOIL_FLAG_TEXTURE_REPEATS
Definition: texture.hpp:23
GLuint get_texture_handle(sys::state &state, dcon::texture_id id, bool keep_data)
Definition: texture.cpp:1066
native_string flag_type_to_name(sys::state &state, culture::flag_type type)
Definition: texture.cpp:889
font_texture_result make_font_texture(simple_fs::file &f)
Definition: texture.cpp:1146
GLuint get_flag_handle(sys::state &state, dcon::national_identity_id nat_id, culture::flag_type type)
Definition: texture.cpp:977
std::string native_string
uint uint32_t
uchar uint8_t
Holds important data about the game world, state, and other data regarding windowing,...