Skip to content

Commit

Permalink
Fixed a few things after merging
Browse files Browse the repository at this point in the history
- 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
L4ZZA committed Jul 2, 2020
1 parent e0a8bac commit 339fb35
Show file tree
Hide file tree
Showing 14 changed files with 451 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ inter/
## Files
*.user
*.filters
**/imgui\.ini
**\.ini

## VisualStudio Specific
*.vcxproj
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@

# Ember Editor [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Build status](https://ci.appveyor.com/api/projects/status/r3k87jbaegd8v3fc/branch/procedural_generation?svg=true)](https://ci.appveyor.com/project/L4ZZA/pyro-procedural-gen/branch/procedural_generation)
==================

# Ember Editor [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Build status](https://ci.appveyor.com/api/projects/status/47kvcru66wge4vas/branch/develop?svg=true)](https://ci.appveyor.com/project/L4ZZA/pyro/branch/develop)

> A small piece of burning or glowing coal or wood in a dying fire.
Expand All @@ -21,7 +19,8 @@ Real-time 2D level editor using Pyro engine.

> **Requirements**
> - Install [NSIS: Nullsoft Scriptable Install System](https://sourceforge.net/projects/nsis/) to its default location `C:\Program Files (x86)\NSIS`
> - Add the install directory to your system path like so:![image](https://i.imgur.com/cTZquD7.png)
> - Add the install directory to your system path like so:
![image](https://i.imgur.com/cTZquD7.png)

- Run the `create_installer.bat`, thie will generate the installer in the bin directory.
- go to `bin\Release-windows-x86_64\installers` and run `LevelEditorSetup.exe`.
18 changes: 10 additions & 8 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
#
# Reference list
# - https://raw.githubusercontent.com/malaterre/GDCM/master/appveyor.yml
#
# - https://github.com/KhronosGroup/SPIRV-Tools/blob/master/.appveyor.yml
# - https://gitlab.com/eyeo/adblockplus/libadblockplus/blob/master/appveyor.yml
#
# http://www.appveyor.com/docs/build-cache#caching-chocolatey-packages
# https://github.com/kvirc/KVIrc/blob/master/.appveyor.yml
cache:
- C:\Tools\vcpkg\installed -> appveyor.yml
# caching binries and intermediates to allow incremental build
- C:\dev\source\bin -> appveyor.yml
- C:\dev\source\inter -> appveyor.yml
- C:\Tools\vcpkg\installed
# - 'C:\Program Files (x86)\NSIS'
# - C:\ProgramData\chocolatey\bin -> appveyor.yml
# - C:\ProgramData\chocolatey\lib -> appveyor.yml
Expand All @@ -35,11 +33,16 @@ environment:
image:
- Visual Studio 2019

# stop infinite cycle of tag creation and build on tag
skip_tags: true

clone_depth: 1

# branches to build
branches:
# whitelist
only:
- procedural_generation
- develop

#---------------------------------#
# scripts that are called at #
Expand Down Expand Up @@ -146,7 +149,6 @@ deploy:
artifact: installer
draft: false
prerelease: true
appveyor_repo_tag: false # deploy on tag push only
on:
branch: procedural_generation # release from master branch only
branch: develop # release from master branch only
configuration: Release
2 changes: 1 addition & 1 deletion installer/Ember.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
!system '${CMD_PATH} /C ${ScriptPath} ${LinkName} ${LinkDest} ${LinkTarget}'
!macroend

!insertmacro WebShortucts "${SCRIPTS_DIR}\create_shortcut.cmd" "Readme" "." "https://github.com/L4ZZA/pyro/blob/procedural_generation/README.md"
!insertmacro WebShortucts "${SCRIPTS_DIR}\create_shortcut.cmd" "Readme" "." "https://github.com/L4ZZA/pyro/blob/develop/README.md"

;General

Expand Down
2 changes: 1 addition & 1 deletion pyro/external/GLFW
Submodule GLFW updated 144 files
36 changes: 36 additions & 0 deletions sandbox/assets/shaders/color.glsl
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;
}

33 changes: 33 additions & 0 deletions sandbox/assets/shaders/dynamic_flat_color.glsl
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;
}
34 changes: 34 additions & 0 deletions sandbox/assets/shaders/texture.glsl
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);
}
Binary file added sandbox/assets/textures/checkerboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sandbox/assets/textures/face.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
124 changes: 124 additions & 0 deletions sandbox/src/layer_2d.cpp
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);
}
Loading

0 comments on commit 339fb35

Please sign in to comment.