-
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.
shaders, window close event, audio destroy bug fix
- Loading branch information
Showing
33 changed files
with
565 additions
and
139 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ class core | |
|
||
public: | ||
static status create() noexcept; | ||
static void destroy() noexcept; | ||
}; | ||
|
||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef __DK_GRAPH_DEBUG_H__ | ||
#define __DK_GRAPH_DEBUG_H__ | ||
|
||
#include <GL/gl.h> | ||
#include "containers/string_view.h" | ||
#include "log.h" | ||
|
||
#define GL_CALL(func) \ | ||
func, \ | ||
[](string_view func_name) { \ | ||
if(auto err = glGetError(); err != GL_NO_ERROR) \ | ||
DK_LOG_ERROR_IMPL(__FILE__, func_name, __LINE__, \ | ||
"OpenGL function '", #func, "' failed: ", debug::code_to_str(err)); \ | ||
}(__func__) | ||
|
||
namespace dk::graph | ||
{ | ||
|
||
class debug | ||
{ | ||
public: | ||
static string_view code_to_str(GLenum code) noexcept; | ||
}; | ||
|
||
} | ||
|
||
#endif // !__DK_AUDIO_DEBUG_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,37 @@ | ||
#ifndef __DK_GRAPH_SHADER_H__ | ||
#define __DK_GRAPH_SHADER_H__ | ||
|
||
#include <GL/gl.h> | ||
#include "graph/shader_data.h" | ||
|
||
namespace dk::graph | ||
{ | ||
|
||
enum class shader_type | ||
{ | ||
VERTEX = 0, | ||
GEOMETRY, | ||
FRAGMENT | ||
}; | ||
|
||
class shader final: public resource | ||
{ | ||
private: | ||
GLuint m_id; | ||
|
||
static GLenum convert_to_gl_type(shader_type type) noexcept; | ||
|
||
public: | ||
shader() noexcept; | ||
~shader() noexcept override; | ||
|
||
GLuint id() const noexcept { return m_id; } | ||
|
||
status create(string_view file_path, shader_type type) noexcept; | ||
status create(const shader_data& data, shader_type type) noexcept; | ||
void destroy() noexcept; | ||
}; | ||
|
||
} | ||
|
||
#endif // !__DK_GRAPH_SHADER_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,29 @@ | ||
#ifndef __DK_GRAPH_SHADER_DATA_H__ | ||
#define __DK_GRAPH_SHADER_DATA_H__ | ||
|
||
#include "resource.h" | ||
#include "containers/string.h" | ||
#include "containers/string_view.h" | ||
|
||
namespace dk::graph | ||
{ | ||
|
||
class shader_data final: public resource | ||
{ | ||
private: | ||
string m_data; | ||
string_view m_file_path; | ||
|
||
public: | ||
shader_data() noexcept = default; | ||
~shader_data() noexcept override = default; | ||
|
||
const string& data() const noexcept { return m_data; } | ||
string_view file_path() const noexcept { return m_file_path; } | ||
|
||
status create(string_view path) noexcept; | ||
}; | ||
|
||
} | ||
|
||
#endif // !__DK_GRAPH_SHADER_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifndef __DK_GRAPH_SHADER_PROGRAM_H__ | ||
#define __DK_GRAPH_SHADER_PROGRAM_H__ | ||
|
||
#include "graph/shader.h" | ||
|
||
namespace dk::graph | ||
{ | ||
|
||
class shader_program : public resource | ||
{ | ||
private: | ||
GLuint m_id; | ||
|
||
public: | ||
~shader_program() noexcept override; | ||
|
||
void enable() const noexcept; | ||
void disable() const noexcept; | ||
|
||
status add(string_view file_path, shader_type type) const noexcept; | ||
status add(const shader& inst) const noexcept; | ||
status remove_shaders() const noexcept; | ||
|
||
status create() noexcept; | ||
status link() const noexcept; | ||
void destroy() noexcept; | ||
}; | ||
|
||
} | ||
|
||
#endif // !__DK_GRAPH_SHADER_PROGRAM_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#ifndef __DK_RESOURCE_H__ | ||
#define __DK_RESOURCE_H__ | ||
|
||
#include "status.h" | ||
|
||
namespace dk | ||
{ | ||
|
||
class resource | ||
{ | ||
public: | ||
virtual ~resource() noexcept = default; | ||
}; | ||
|
||
} | ||
|
||
#endif // !__DK_RESOURCE_H__ |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#ifndef __DK_SYS_WINDOW_CLOSE_EVENT_H__ | ||
#define __DK_SYS_WINDOW_CLOSE_EVENT_H__ | ||
|
||
#include "sys/event.h" | ||
|
||
namespace dk::sys | ||
{ | ||
|
||
class window_close_event : public event {}; | ||
|
||
} | ||
|
||
#endif // !__DK_SYS_WINDOW_CLOSE_EVENT_H__ |
Oops, something went wrong.