Commit 0a8cb709 authored by Jonathan Kunstwald's avatar Jonathan Kunstwald

Use embedded shaders

parent e176a0f1
......@@ -3,6 +3,7 @@ imgui.ini
Thumbs.db
flock_save.dat
qu3e.lib
flock_embed_shaders.*
# C++ objects and libs
*.slo
......
......@@ -3,8 +3,16 @@ project(flock)
set(CMAKE_CXX_STANDARD 17)
file(GLOB_RECURSE SOURCES "*.cc" "*.hh" "*.*sh" "*.glsl")
add_executable(flock ${SOURCES})
file(GLOB_RECURSE SHADER_FILES "shader/*.*")
if (GLOW_EXTRAS_EMBED_SHADERS)
embed_files("flock_embed_shaders" "shader/" "flock_embed_shaders" "${SHADER_FILES}")
endif()
file(GLOB_RECURSE SOURCE_FILES "*.cc")
file(GLOB_RECURSE HEADER_FILES "*.hh")
add_executable(flock ${SOURCE_FILES} ${HEADER_FILES} ${SHADER_FILES})
# ignore warnings for non-standard unnamed structs in glm
target_compile_options(flock PUBLIC ${CMAKE_CXX_FLAGS} /wd4201)
......
......@@ -43,6 +43,10 @@
#include "swarm/SwarmlingC.hh"
#include "util/FileSaver.hh"
#if USE_EMBEDDED_SHADERS
#include "../flock_embed_shaders.hh"
#endif
using namespace glow;
using namespace glow::camera;
using namespace glow::pipeline;
......@@ -308,7 +312,13 @@ void FlockApp::init()
// -- Asset & Shader loading --
{
#if USE_EMBEDDED_SHADERS
for (auto &virtualPair : internal_embedded_files::flock_embed_shaders)
DefaultShaderParser::addVirtualFile(virtualPair.first, virtualPair.second);
#else
DefaultShaderParser::addIncludePath("shader");
#endif
mShaderDepthPre = Program::createFromFiles({"depthPre/geometry.vsh", "depthPre/depthPre.fsh"});
mShaderDepthPreInstanced = Program::createFromFiles({"instancedGeometry.vsh", "depthPre/depthPre.fsh"});
mShaderOpaqueForward = Program::createFromFiles({"geometry.vsh", "opaque/litOpaque.fsh"});
......
......@@ -24,6 +24,8 @@
#include "particles/PrimitiveParticleRenderer.hh"
#include "swarm/Swarm.hh"
#define USE_EMBEDDED_SHADERS true
namespace flock
{
class FlockApp : public glow::glfw::GlfwApp
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment