-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
std wave and texture loaderes, res mgr improved
- Loading branch information
Showing
24 changed files
with
423 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#ifndef __DK_GRAPH_TEXTURE_H__ | ||
#define __DK_GRAPH_TEXTURE_H__ | ||
|
||
#include <GL/gl.h> | ||
#include "status.h" | ||
#include "graph/texture_data.h" | ||
|
||
namespace dk::graph | ||
{ | ||
|
||
class texture final: public resource | ||
{ | ||
private: | ||
GLuint m_id; | ||
|
||
static GLenum convert_to_gl_fmt(uint8_t red_bits, uint8_t green_bits, uint8_t blue_bits, uint8_t alpha_bits) noexcept; | ||
|
||
public: | ||
texture() noexcept; | ||
~texture() noexcept override; | ||
|
||
static resource_type type() noexcept { return resource_type::TEXTURE; } | ||
|
||
void enable() const noexcept; | ||
void disable() const noexcept; | ||
|
||
GLuint id() const noexcept { return m_id; } | ||
|
||
status create(const texture_data& data) noexcept; | ||
void destroy() noexcept; | ||
}; | ||
|
||
} | ||
|
||
#endif // !__DK_GRAPH_TEXTURE_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#ifndef __DK_GRAPH_TEXTURE_DATA_H__ | ||
#define __DK_GRAPH_TEXTURE_DATA_H__ | ||
|
||
#include <stdint.h> | ||
#include "resource.h" | ||
|
||
namespace dk::graph | ||
{ | ||
|
||
class texture_data final: public resource | ||
{ | ||
private: | ||
uint8_t* m_data; | ||
uint32_t m_width; | ||
uint32_t m_height; | ||
uint8_t m_red_bits; | ||
uint8_t m_green_bits; | ||
uint8_t m_blue_bits; | ||
uint8_t m_alpha_bits; | ||
|
||
public: | ||
texture_data() noexcept; | ||
~texture_data() noexcept override; | ||
|
||
static resource_type type() noexcept { return resource_type::TEXTURE_DATA; } | ||
|
||
uint8_t* data() const noexcept { return m_data; } | ||
uint32_t width() const noexcept { return m_width; } | ||
uint32_t height() const noexcept { return m_height; } | ||
uint8_t red_bits() const noexcept { return m_red_bits; } | ||
uint8_t green_bits() const noexcept { return m_green_bits; } | ||
uint8_t blue_bits() const noexcept { return m_blue_bits; } | ||
uint8_t alpha_bits() const noexcept { return m_alpha_bits; } | ||
|
||
void set_data(uint8_t* data) noexcept { m_data = data; } | ||
void set_width(uint32_t width) noexcept { m_width = width; } | ||
void set_height(uint32_t height) noexcept { m_height = height; } | ||
void set_red_bits(uint8_t red_bits) noexcept { m_red_bits = red_bits; } | ||
void set_green_bits(uint8_t green_bits) noexcept { m_green_bits = green_bits; } | ||
void set_blue_bits(uint8_t blue_bits) noexcept { m_blue_bits = blue_bits; } | ||
void set_alpha_bits(uint8_t alpha_bits) noexcept { m_alpha_bits = alpha_bits; } | ||
|
||
void destroy() noexcept; | ||
}; | ||
|
||
} | ||
|
||
#endif // !__DK_GRAPH_TEXTURE_DATA_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef __DK_SYS_TEXTURE_LOADER_H__ | ||
#define __DK_SYS_TEXTURE_LOADER_H__ | ||
|
||
#include "graph/texture.h" | ||
#include "sys/resource_loader.h" | ||
|
||
namespace dk::sys | ||
{ | ||
|
||
class texture_loader final: public resource_loader | ||
{ | ||
public: | ||
status load(graph::texture_data& res, string_view file_path) noexcept; | ||
status load(graph::texture& res, string_view file_path) noexcept; | ||
|
||
resource* load(string_view file_path, resource_type type) noexcept override; | ||
status load(resource& res, string_view file_path, resource_type type) noexcept override; | ||
}; | ||
|
||
} | ||
|
||
#endif // !__DK_SYS_TEXTURE_LOADER_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.