This will help us deal with shader name collision. Breaks the Windows build for the moment, unfortunately.undefined
| @@ -40,7 +40,8 @@ SUFFIXES += .lolfx | |||||
| .lolfx.o: | .lolfx.o: | ||||
| $(lolfx_gen) | $(lolfx_gen) | ||||
| $(AM_V_at)(echo "char const *"; \ | $(AM_V_at)(echo "char const *"; \ | ||||
| echo "lolfx_resource_$(notdir $(basename $(filter %.lolfx, $^))) ="; \ | |||||
| echo "lolfx_resource_$(basename $(filter %.lolfx, $^))" | $(SED) 's/[^a-zA-Z0-9_]/_/g'; \ | |||||
| echo "="; \ | |||||
| $(SED) 's/"/\\"/g' $(filter %.lolfx, $^) | $(SED) 's/\([^\r]*\).*/"\1\\n"/'; \ | $(SED) 's/"/\\"/g' $(filter %.lolfx, $^) | $(SED) 's/\([^\r]*\).*/"\1\\n"/'; \ | ||||
| echo ";") \ | echo ";") \ | ||||
| > $@.lolfx.cpp && \ | > $@.lolfx.cpp && \ | ||||
| @@ -14,6 +14,12 @@ | |||||
| <CommandLineTemplate>@echo off | <CommandLineTemplate>@echo off | ||||
| set D=$(IntDir)%(Filename)%(Extension).cpp | set D=$(IntDir)%(Filename)%(Extension).cpp | ||||
| echo /* This file was autogenerated. DO NOT MODIFY IT. */ > "%D%" | echo /* This file was autogenerated. DO NOT MODIFY IT. */ > "%D%" | ||||
| echo /* Filename = %(Filename) */ > "%D" | |||||
| echo /* FullPath = %(FullPath) */ > "%D" | |||||
| echo /* RootDir = %(RootDir) */ > "%D" | |||||
| echo /* Directory = %(Directory) */ > "%D" | |||||
| echo /* Input = %(Input) */ > "%D" | |||||
| echo /* Output = %(Output) */ > "%D" | |||||
| echo extern "C" { char const *lolfx_resource_%(Filename) = >> "%D%" | echo extern "C" { char const *lolfx_resource_%(Filename) = >> "%D%" | ||||
| setlocal disabledelayedexpansion | setlocal disabledelayedexpansion | ||||
| for /F "tokens=1,* delims=`" %%L in ('type "%(Fullpath)"') do ( | for /F "tokens=1,* delims=`" %%L in ('type "%(Fullpath)"') do ( | ||||
| @@ -21,7 +21,7 @@ using namespace lol; | |||||
| #define USE_CUSTOM_SHADER 1 | #define USE_CUSTOM_SHADER 1 | ||||
| #if USE_CUSTOM_SHADER | #if USE_CUSTOM_SHADER | ||||
| LOLFX_RESOURCE_DECLARE(shiny); | |||||
| LOLFX_RESOURCE_DECLARE(easymesh_shiny); | |||||
| #endif //USE_CUSTOM_SHADER | #endif //USE_CUSTOM_SHADER | ||||
| class EasyMeshTutorial : public WorldEntity | class EasyMeshTutorial : public WorldEntity | ||||
| @@ -136,7 +136,7 @@ public: | |||||
| #if USE_CUSTOM_SHADER | #if USE_CUSTOM_SHADER | ||||
| /* Custom Shader: Init the shader */ | /* Custom Shader: Init the shader */ | ||||
| Shader *custom_shader = Shader::Create(LOLFX_RESOURCE_NAME(shiny)); | |||||
| Shader *custom_shader = Shader::Create(LOLFX_RESOURCE_NAME(easymesh_shiny)); | |||||
| // any other shader stuf here (Get uniform, mostly, and set texture) | // any other shader stuf here (Get uniform, mostly, and set texture) | ||||
| for (int i = 0; i < m_gears.count(); i++) | for (int i = 0; i < m_gears.count(); i++) | ||||
| @@ -95,10 +95,10 @@ liblol_core_sources = \ | |||||
| input/input.cpp input/input.h input/input_internal.h input/keys.h \ | input/input.cpp input/input.h input/input_internal.h input/keys.h \ | ||||
| input/controller.cpp input/controller.h \ | input/controller.cpp input/controller.h \ | ||||
| \ | \ | ||||
| gpu/defaultmaterial.lolfx \ | |||||
| gpu/default-material.lolfx \ | |||||
| gpu/empty-material.lolfx \ | |||||
| gpu/test-material.lolfx \ | |||||
| gpu/tile.lolfx gpu/palette.lolfx gpu/line.lolfx \ | gpu/tile.lolfx gpu/palette.lolfx gpu/line.lolfx \ | ||||
| gpu/emptymaterial.lolfx \ | |||||
| gpu/testmaterial.lolfx \ | |||||
| gpu/blit.lolfx \ | gpu/blit.lolfx \ | ||||
| gpu/postprocess.lolfx \ | gpu/postprocess.lolfx \ | ||||
| \ | \ | ||||
| @@ -13,7 +13,7 @@ | |||||
| #include <lol/engine-internal.h> | #include <lol/engine-internal.h> | ||||
| LOLFX_RESOURCE_DECLARE(shiny); | |||||
| LOLFX_RESOURCE_DECLARE(easymesh_shiny); | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| @@ -15,19 +15,19 @@ | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| LOLFX_RESOURCE_DECLARE(shiny); | |||||
| LOLFX_RESOURCE_DECLARE(shinyflat); | |||||
| LOLFX_RESOURCE_DECLARE(shinydebugwireframe); | |||||
| LOLFX_RESOURCE_DECLARE(shinydebuglighting); | |||||
| LOLFX_RESOURCE_DECLARE(shinydebugnormal); | |||||
| LOLFX_RESOURCE_DECLARE(shinydebugUV); | |||||
| LOLFX_RESOURCE_DECLARE(shiny_SK); | |||||
| LOLFX_RESOURCE_DECLARE(easymesh_shiny); | |||||
| LOLFX_RESOURCE_DECLARE(easymesh_shinyflat); | |||||
| LOLFX_RESOURCE_DECLARE(easymesh_shinydebugwireframe); | |||||
| LOLFX_RESOURCE_DECLARE(easymesh_shinydebuglighting); | |||||
| LOLFX_RESOURCE_DECLARE(easymesh_shinydebugnormal); | |||||
| LOLFX_RESOURCE_DECLARE(easymesh_shinydebugUV); | |||||
| LOLFX_RESOURCE_DECLARE(easymesh_shiny_SK); | |||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||
| void EasyMesh::MeshConvert() | void EasyMesh::MeshConvert() | ||||
| { | { | ||||
| /* Default material */ | /* Default material */ | ||||
| Shader *shader = Shader::Create(LOLFX_RESOURCE_NAME(shiny)); | |||||
| Shader *shader = Shader::Create(LOLFX_RESOURCE_NAME(easymesh_shiny)); | |||||
| /* Push index buffer to GPU */ | /* Push index buffer to GPU */ | ||||
| IndexBuffer *ibo = new IndexBuffer(m_indices.count() * sizeof(uint16_t)); | IndexBuffer *ibo = new IndexBuffer(m_indices.count() * sizeof(uint16_t)); | ||||
| @@ -130,18 +130,18 @@ DefaultShaderData::DefaultShaderData(DebugRenderMode render_mode) | |||||
| (1 << VertexUsage::Color); | (1 << VertexUsage::Color); | ||||
| if (render_mode == DebugRenderMode::Default) | if (render_mode == DebugRenderMode::Default) | ||||
| m_shader = Shader::Create(LOLFX_RESOURCE_NAME(shiny)); | |||||
| m_shader = Shader::Create(LOLFX_RESOURCE_NAME(easymesh_shiny)); | |||||
| else if (render_mode == DebugRenderMode::Flat) | else if (render_mode == DebugRenderMode::Flat) | ||||
| m_shader = Shader::Create(LOLFX_RESOURCE_NAME(shinyflat)); | |||||
| m_shader = Shader::Create(LOLFX_RESOURCE_NAME(easymesh_shinyflat)); | |||||
| else if (render_mode == DebugRenderMode::Wireframe) | else if (render_mode == DebugRenderMode::Wireframe) | ||||
| m_shader = Shader::Create(LOLFX_RESOURCE_NAME(shinydebugwireframe)); | |||||
| m_shader = Shader::Create(LOLFX_RESOURCE_NAME(easymesh_shinydebugwireframe)); | |||||
| else if (render_mode == DebugRenderMode::Lighting) | else if (render_mode == DebugRenderMode::Lighting) | ||||
| m_shader = Shader::Create(LOLFX_RESOURCE_NAME(shinydebuglighting)); | |||||
| m_shader = Shader::Create(LOLFX_RESOURCE_NAME(easymesh_shinydebuglighting)); | |||||
| else if (render_mode == DebugRenderMode::Normal) | else if (render_mode == DebugRenderMode::Normal) | ||||
| m_shader = Shader::Create(LOLFX_RESOURCE_NAME(shinydebugnormal)); | |||||
| m_shader = Shader::Create(LOLFX_RESOURCE_NAME(easymesh_shinydebugnormal)); | |||||
| else if (render_mode == DebugRenderMode::UV) | else if (render_mode == DebugRenderMode::UV) | ||||
| { | { | ||||
| m_shader = Shader::Create(LOLFX_RESOURCE_NAME(shinydebugUV)); | |||||
| m_shader = Shader::Create(LOLFX_RESOURCE_NAME(easymesh_shinydebugUV)); | |||||
| m_vert_decl_flags |= (1 << VertexUsage::TexCoord); | m_vert_decl_flags |= (1 << VertexUsage::TexCoord); | ||||
| with_UV = true; | with_UV = true; | ||||
| } | } | ||||
| @@ -369,12 +369,12 @@ | |||||
| <LolFxCompile Include="easymesh\shinyflat.lolfx" /> | <LolFxCompile Include="easymesh\shinyflat.lolfx" /> | ||||
| <LolFxCompile Include="easymesh\shiny_SK.lolfx" /> | <LolFxCompile Include="easymesh\shiny_SK.lolfx" /> | ||||
| <LolFxCompile Include="gpu\blit.lolfx" /> | <LolFxCompile Include="gpu\blit.lolfx" /> | ||||
| <LolFxCompile Include="gpu\defaultmaterial.lolfx" /> | |||||
| <LolFxCompile Include="gpu\emptymaterial.lolfx" /> | |||||
| <LolFxCompile Include="gpu\default-material.lolfx" /> | |||||
| <LolFxCompile Include="gpu\empty-material.lolfx" /> | |||||
| <LolFxCompile Include="gpu\line.lolfx" /> | <LolFxCompile Include="gpu\line.lolfx" /> | ||||
| <LolFxCompile Include="gpu\palette.lolfx" /> | <LolFxCompile Include="gpu\palette.lolfx" /> | ||||
| <LolFxCompile Include="gpu\postprocess.lolfx" /> | <LolFxCompile Include="gpu\postprocess.lolfx" /> | ||||
| <LolFxCompile Include="gpu\testmaterial.lolfx" /> | |||||
| <LolFxCompile Include="gpu\test-material.lolfx" /> | |||||
| <LolFxCompile Include="gpu\tile.lolfx" /> | <LolFxCompile Include="gpu\tile.lolfx" /> | ||||
| <LolFxCompile Include="gradient.lolfx" /> | <LolFxCompile Include="gradient.lolfx" /> | ||||
| </ItemGroup> | </ItemGroup> | ||||
| @@ -803,13 +803,13 @@ | |||||
| </ClInclude> | </ClInclude> | ||||
| </ItemGroup> | </ItemGroup> | ||||
| <ItemGroup> | <ItemGroup> | ||||
| <LolFxCompile Include="gpu\emptymaterial.lolfx"> | |||||
| <LolFxCompile Include="gpu\empty-material.lolfx"> | |||||
| <Filter>gpu</Filter> | <Filter>gpu</Filter> | ||||
| </LolFxCompile> | </LolFxCompile> | ||||
| <LolFxCompile Include="gpu\defaultmaterial.lolfx"> | |||||
| <LolFxCompile Include="gpu\default-material.lolfx"> | |||||
| <Filter>gpu</Filter> | <Filter>gpu</Filter> | ||||
| </LolFxCompile> | </LolFxCompile> | ||||
| <LolFxCompile Include="gpu\testmaterial.lolfx"> | |||||
| <LolFxCompile Include="gpu\test-material.lolfx"> | |||||
| <Filter>gpu</Filter> | <Filter>gpu</Filter> | ||||
| </LolFxCompile> | </LolFxCompile> | ||||
| <LolFxCompile Include="easymesh\shiny.lolfx"> | <LolFxCompile Include="easymesh\shiny.lolfx"> | ||||
| @@ -23,12 +23,12 @@ | |||||
| #include "lolgl.h" | #include "lolgl.h" | ||||
| LOLFX_RESOURCE_DECLARE(tile); | |||||
| LOLFX_RESOURCE_DECLARE(palette); | |||||
| LOLFX_RESOURCE_DECLARE(line); | |||||
| LOLFX_RESOURCE_DECLARE(gpu_tile); | |||||
| LOLFX_RESOURCE_DECLARE(gpu_palette); | |||||
| LOLFX_RESOURCE_DECLARE(gpu_line); | |||||
| LOLFX_RESOURCE_DECLARE(blit); | |||||
| LOLFX_RESOURCE_DECLARE(postprocess); | |||||
| LOLFX_RESOURCE_DECLARE(gpu_blit); | |||||
| LOLFX_RESOURCE_DECLARE(gpu_postprocess); | |||||
| namespace lol | namespace lol | ||||
| { | { | ||||
| @@ -207,8 +207,8 @@ Scene::Scene(ivec2 size) | |||||
| data->m_renderbuffer[1] = new Framebuffer(size); | data->m_renderbuffer[1] = new Framebuffer(size); | ||||
| data->m_renderbuffer[2] = new Framebuffer(size); | data->m_renderbuffer[2] = new Framebuffer(size); | ||||
| data->m_renderbuffer[3] = new Framebuffer(size); | data->m_renderbuffer[3] = new Framebuffer(size); | ||||
| data->m_pp.m_shader[0] = Shader::Create(LOLFX_RESOURCE_NAME(blit)); | |||||
| data->m_pp.m_shader[1] = Shader::Create(LOLFX_RESOURCE_NAME(postprocess)); | |||||
| data->m_pp.m_shader[0] = Shader::Create(LOLFX_RESOURCE_NAME(gpu_blit)); | |||||
| data->m_pp.m_shader[1] = Shader::Create(LOLFX_RESOURCE_NAME(gpu_postprocess)); | |||||
| data->m_pp.m_coord[0] = data->m_pp.m_shader[0]->GetAttribLocation(VertexUsage::Position, 0); | data->m_pp.m_coord[0] = data->m_pp.m_shader[0]->GetAttribLocation(VertexUsage::Position, 0); | ||||
| data->m_pp.m_coord[1] = data->m_pp.m_shader[1]->GetAttribLocation(VertexUsage::Position, 0); | data->m_pp.m_coord[1] = data->m_pp.m_shader[1]->GetAttribLocation(VertexUsage::Position, 0); | ||||
| data->m_pp.m_vdecl = new VertexDeclaration(VertexStream<vec2>(VertexUsage::Position)); | data->m_pp.m_vdecl = new VertexDeclaration(VertexStream<vec2>(VertexUsage::Position)); | ||||
| @@ -764,9 +764,9 @@ void Scene::render_tiles() // XXX: rename to Blit() | |||||
| #endif | #endif | ||||
| if (!data->m_tile_api.m_shader) | if (!data->m_tile_api.m_shader) | ||||
| data->m_tile_api.m_shader = Shader::Create(LOLFX_RESOURCE_NAME(tile)); | |||||
| data->m_tile_api.m_shader = Shader::Create(LOLFX_RESOURCE_NAME(gpu_tile)); | |||||
| if (!data->m_tile_api.m_palette_shader) | if (!data->m_tile_api.m_palette_shader) | ||||
| data->m_tile_api.m_palette_shader = Shader::Create(LOLFX_RESOURCE_NAME(palette)); | |||||
| data->m_tile_api.m_palette_shader = Shader::Create(LOLFX_RESOURCE_NAME(gpu_palette)); | |||||
| for (int p = 0; p < 2; p++) | for (int p = 0; p < 2; p++) | ||||
| { | { | ||||
| @@ -878,7 +878,7 @@ void Scene::render_lines(float seconds) | |||||
| int linecount = (int)data->m_line_api.m_lines.count(); | int linecount = (int)data->m_line_api.m_lines.count(); | ||||
| if (!data->m_line_api.m_shader) | if (!data->m_line_api.m_shader) | ||||
| data->m_line_api.m_shader = Shader::Create(LOLFX_RESOURCE_NAME(line)); | |||||
| data->m_line_api.m_shader = Shader::Create(LOLFX_RESOURCE_NAME(gpu_line)); | |||||
| array<vec4, vec4, vec4, vec4> buff; | array<vec4, vec4, vec4, vec4> buff; | ||||
| buff.resize(linecount); | buff.resize(linecount); | ||||