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
10namespace ogl {
11
12class texture;
13
14GLuint get_texture_handle(sys::state& state, dcon::texture_id id, bool keep_data);
16GLuint get_flag_handle(sys::state& state, dcon::national_identity_id nat_id, culture::flag_type type);
17GLuint load_file_and_return_handle(native_string const& native_name, simple_fs::file_system const& fs, texture& asset_texture, bool keep_data);
18
19enum {
21};
22
23GLuint SOIL_direct_load_DDS_from_memory(unsigned char const* const buffer, uint32_t buffer_length, uint32_t& width, uint32_t& height, int soil_flags);
24
25class texture {
26 GLuint texture_handle = 0;
27
28public:
29 uint8_t* data = nullptr;
30 int32_t size_x = 0;
31 int32_t size_y = 0;
32 int32_t channels = 4;
33
34 bool loaded = false;
35
36 texture() { }
37 texture(texture const&) = delete;
38 texture(texture&& other) noexcept;
39 ~texture();
40
41 texture& operator=(texture const&) = delete;
42 texture& operator=(texture&& other) noexcept;
43
44 GLuint get_texture_handle() const;
45
46 friend GLuint get_texture_handle(sys::state& state, dcon::texture_id id, bool keep_data);
47 friend GLuint load_file_and_return_handle(native_string const& native_name, simple_fs::file_system const& fs,
48 texture& asset_texture, bool keep_data);
49 friend GLuint get_flag_handle(sys::state& state, dcon::national_identity_id nat_id, culture::flag_type type);
50};
51
53 GLuint texture_handle = 0;
54
55public:
56 uint8_t* data = nullptr;
57 int32_t size = 0;
58 int32_t channels = 4;
59
60 bool data_updated = false;
61
62 data_texture(int32_t sz, int32_t ch);
63 data_texture(data_texture const&) = delete;
64 data_texture(data_texture&& other) noexcept;
65
67 data_texture& operator=(data_texture&& other) noexcept;
68
69 GLuint handle();
71};
72
76};
77
79
80} // namespace ogl
data_texture(data_texture const &)=delete
data_texture & operator=(data_texture const &)=delete
GLuint handle()
Definition: texture.cpp:707
int32_t channels
Definition: texture.hpp:58
texture & operator=(texture const &)=delete
GLuint get_texture_handle() const
Definition: texture.cpp:454
friend GLuint get_flag_handle(sys::state &state, dcon::national_identity_id nat_id, culture::flag_type type)
Definition: texture.cpp:632
texture(texture const &)=delete
int32_t size_y
Definition: texture.hpp:31
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:459
int32_t size_x
Definition: texture.hpp:30
int32_t channels
Definition: texture.hpp:32
bool loaded
Definition: texture.hpp:34
Definition: color.hpp:6
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:459
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:180
GLuint get_texture_handle(sys::state &state, dcon::texture_id id, bool keep_data)
Definition: texture.cpp:665
native_string flag_type_to_name(sys::state &state, culture::flag_type type)
Definition: texture.cpp:544
@ SOIL_FLAG_TEXTURE_REPEATS
Definition: texture.hpp:20
font_texture_result make_font_texture(simple_fs::file &f)
Definition: texture.cpp:745
GLuint get_flag_handle(sys::state &state, dcon::national_identity_id nat_id, culture::flag_type type)
Definition: texture.cpp:632
std::string native_string
uint uint32_t
uchar uint8_t