-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- updated build target branch - Rebased branch to updated master in submodule - Updated readme link in installer and readme header - Added batch script that deletes all local and remote tags - Stop caching outputs and removed cache dependencies - Stop infinite builds - Deploying again - Fixed appveyor badge - Fixed image in readme file
- Loading branch information
Showing
14 changed files
with
451 additions
and
15 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 |
---|---|---|
|
@@ -6,7 +6,7 @@ inter/ | |
## Files | ||
*.user | ||
*.filters | ||
**/imgui\.ini | ||
**\.ini | ||
|
||
## VisualStudio Specific | ||
*.vcxproj | ||
|
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,36 @@ | ||
/* | ||
* Simple color shader, taking position and vec4 color as input. | ||
*/ | ||
|
||
#type vertex | ||
#version 430 | ||
|
||
layout(location = 0) in vec3 a_position; | ||
layout(location = 1) in vec4 a_color; | ||
|
||
uniform mat4 u_view_projection; | ||
uniform mat4 u_transform; | ||
|
||
out vec3 v_position; | ||
out vec4 v_color; | ||
|
||
void main() | ||
{ | ||
v_position = a_position; | ||
v_color = a_color; | ||
gl_Position = u_view_projection * u_transform * vec4(a_position, 1.0); | ||
} | ||
|
||
#type fragment | ||
#version 430 | ||
|
||
layout(location = 0) out vec4 o_color; | ||
|
||
in vec3 v_position; | ||
in vec4 v_color; | ||
|
||
void main() | ||
{ | ||
o_color = v_color; | ||
} | ||
|
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,33 @@ | ||
/* | ||
* Simple flat color shader, with dynamic update of the color. | ||
*/ | ||
|
||
#type vertex | ||
#version 430 | ||
|
||
layout(location = 0) in vec3 a_position; | ||
|
||
uniform mat4 u_view_projection; | ||
uniform mat4 u_transform; | ||
|
||
out vec3 v_position; | ||
|
||
void main() | ||
{ | ||
v_position = a_position; | ||
gl_Position = u_view_projection * u_transform * vec4(a_position, 1.0); | ||
} | ||
|
||
#type fragment | ||
#version 430 | ||
|
||
layout(location = 0) out vec4 o_color; | ||
|
||
in vec3 v_position; | ||
|
||
uniform vec4 u_color; | ||
|
||
void main() | ||
{ | ||
o_color = u_color; | ||
} |
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,34 @@ | ||
/* | ||
* Simple texture shader. | ||
*/ | ||
|
||
#type vertex | ||
#version 430 | ||
|
||
layout(location = 0) in vec3 a_position; | ||
layout(location = 1) in vec2 a_tex_coord; | ||
|
||
uniform mat4 u_view_projection; | ||
uniform mat4 u_transform; | ||
|
||
out vec2 v_tex_coord; | ||
|
||
void main() | ||
{ | ||
v_tex_coord = a_tex_coord; | ||
gl_Position = u_view_projection * u_transform * vec4(a_position, 1.0); | ||
} | ||
|
||
#type fragment | ||
#version 430 | ||
|
||
layout(location = 0) out vec4 o_color; | ||
|
||
in vec2 v_tex_coord; | ||
|
||
uniform sampler2D u_sampler; | ||
|
||
void main() | ||
{ | ||
o_color = texture(u_sampler, v_tex_coord); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,124 @@ | ||
#include "layer_2d.h" | ||
#include "imgui/imgui.h" | ||
|
||
|
||
layer_2d::layer_2d() : imgui_layer("Sandbox2D"), | ||
m_2d_camera_controller(1280.0f / 720.0f, true) | ||
{ | ||
} | ||
|
||
layer_2d::~layer_2d() | ||
{ | ||
} | ||
|
||
void layer_2d::on_attach() | ||
{ | ||
PYRO_PROFILE_FUNCTION(); | ||
imgui_layer::on_attach(); | ||
|
||
pyro::texture::wrap(pyro::e_texture_wrap::repeat); | ||
m_checkerboard_texture = pyro::texture_2d::create_from_file("assets/textures/checkerboard.png"); | ||
} | ||
|
||
void layer_2d::on_detach() | ||
{ | ||
PYRO_PROFILE_FUNCTION(); | ||
} | ||
|
||
static float rotation = 0.0f; | ||
void layer_2d::on_update(const pyro::timestep &ts) | ||
{ | ||
// Update | ||
PYRO_PROFILE_FUNCTION(); | ||
m_2d_camera_controller.on_update(ts); | ||
rotation += ts * 0.5f; | ||
} | ||
|
||
void layer_2d::on_imgui_render() | ||
{ | ||
pyro::renderer_2d::reset_stats(); | ||
{ | ||
// Pre Render | ||
PYRO_PROFILE_SCOPE("layer_2d::pre_render"); | ||
pyro::render_command::clear_color({0.1f, 0.1f, 0.1f, 1}); | ||
pyro::render_command::clear(); | ||
} | ||
{ | ||
// Render | ||
PYRO_PROFILE_SCOPE("layer_2d::render"); | ||
pyro::renderer_2d::begin_scene(m_2d_camera_controller.camera()); | ||
pyro::quad_properties props; | ||
|
||
props.position = {1.f, 0.0f, 0.f}; | ||
props.size = {0.8f, 0.85f}; | ||
props.rotation = -45.f; | ||
props.color = { 0.8f, 0.2f, 0.3f, 1.0f }; | ||
pyro::renderer_2d::draw_quad(props); | ||
|
||
props.position = {-1.0f, 0.0f, 0.f}; | ||
props.size = {0.8f, 0.8f}; | ||
props.rotation = 0.f; | ||
props.color = {0.8f, 0.3f, 0.2f, 1.0f}; | ||
pyro::renderer_2d::draw_quad(props); | ||
|
||
props.position = {0.5f, -0.5f, 0.f}; | ||
props.size = {0.5f, 0.75f}; | ||
props.color = {m_rect_color, 1.f}; | ||
pyro::renderer_2d::draw_quad(props); | ||
|
||
props.position = { 0.f, 0.f, -0.1f }; | ||
props.size = {20.f, 20.f}; | ||
props.color = glm::vec4(1.f); | ||
props.tiling_factor = 10.f; | ||
props.texture = m_checkerboard_texture; | ||
pyro::renderer_2d::draw_quad(props); | ||
|
||
props.color = glm::vec4(1); | ||
props.position = { -2.f, 0.f, 0.0f }; | ||
props.size = {1.f, 1.f}; | ||
props.rotation = rotation; | ||
props.tiling_factor = 20.f; | ||
props.color = { .8f, 1.f, .8f, 1.f }; | ||
pyro::renderer_2d::draw_quad(props); | ||
|
||
for (float y = -5.0f; y < 5.0f; y += 0.5f) | ||
{ | ||
for (float x = -5.0f; x < 5.0f; x += 0.5f) | ||
{ | ||
pyro::quad_properties props; | ||
props.color = { (x + 5.0f) / 10.0f, 0.4f, (y + 5.0f) / 10.0f, 0.7f }; | ||
props.size = { 0.45f, 0.45f }; | ||
props.position = { x, y, 0.f }; | ||
pyro::renderer_2d::draw_quad(props); | ||
} | ||
} | ||
pyro::renderer_2d::end_scene(); | ||
} | ||
|
||
ImGui::Begin("Settings"); | ||
|
||
ImGui::ColorEdit3("Squares color", glm::value_ptr(m_rect_color)); | ||
for (auto& result : m_profile_results) | ||
{ | ||
char label[50]; | ||
strcpy_s(label, "%.3fms "); | ||
strcat_s(label, result.name); | ||
ImGui::Text(label, result.time); | ||
} | ||
m_profile_results.clear(); | ||
|
||
auto stats = pyro::renderer_2d::stats(); | ||
ImGui::Text("-- 2D Renderer stats:"); | ||
ImGui::Text("- Draw calls: %d", stats.draw_calls); | ||
ImGui::Text("- Quads: %d", stats.quad_count); | ||
ImGui::Text("- Vertices: %d", stats.total_vertex_count()); | ||
ImGui::Text("- Indices: %d", stats.total_index_count()); | ||
ImGui::Text("---------------------"); | ||
|
||
ImGui::End(); | ||
} | ||
|
||
void layer_2d::on_event(pyro::event &e) | ||
{ | ||
m_2d_camera_controller.on_event(e); | ||
} |
Oops, something went wrong.