Browse Source

build: add path to lolfx resource names

This will help us deal with shader name collision. Breaks the Windows
build for the moment, unfortunately.
undefined
Sam Hocevar 8 years ago
parent
commit
9e4b6a4155
12 changed files with 44 additions and 37 deletions
  1. +2
    -1
      build/autotools/common.am
  2. +6
    -0
      build/msbuild/lolfx.props
  3. +2
    -2
      doc/tutorial/05_easymesh.cpp
  4. +3
    -3
      src/Makefile.am
  5. +1
    -1
      src/easymesh/easymesh.cpp
  6. +14
    -14
      src/easymesh/easymeshrender.cpp
  7. +0
    -0
      src/gpu/default-material.lolfx
  8. +0
    -0
      src/gpu/empty-material.lolfx
  9. +0
    -0
      src/gpu/test-material.lolfx
  10. +3
    -3
      src/lol-core.vcxproj
  11. +3
    -3
      src/lol-core.vcxproj.filter
  12. +10
    -10
      src/scene.cpp

+ 2
- 1
build/autotools/common.am View File

@@ -40,7 +40,8 @@ SUFFIXES += .lolfx
.lolfx.o:
$(lolfx_gen)
$(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"/'; \
echo ";") \
> $@.lolfx.cpp && \


+ 6
- 0
build/msbuild/lolfx.props View File

@@ -14,6 +14,12 @@
<CommandLineTemplate>@echo off
set D=$(IntDir)%(Filename)%(Extension).cpp
echo /* This file was autogenerated. DO NOT MODIFY IT. */ &gt; "%D%"
echo /* Filename = %(Filename) */ &gt; "%D"
echo /* FullPath = %(FullPath) */ &gt; "%D"
echo /* RootDir = %(RootDir) */ &gt; "%D"
echo /* Directory = %(Directory) */ &gt; "%D"
echo /* Input = %(Input) */ &gt; "%D"
echo /* Output = %(Output) */ &gt; "%D"
echo extern "C" { char const *lolfx_resource_%(Filename) = &gt;&gt; "%D%"
setlocal disabledelayedexpansion
for /F "tokens=1,* delims=`" %%L in ('type "%(Fullpath)"') do (


+ 2
- 2
doc/tutorial/05_easymesh.cpp View File

@@ -21,7 +21,7 @@ using namespace lol;

#define USE_CUSTOM_SHADER 1
#if USE_CUSTOM_SHADER
LOLFX_RESOURCE_DECLARE(shiny);
LOLFX_RESOURCE_DECLARE(easymesh_shiny);
#endif //USE_CUSTOM_SHADER

class EasyMeshTutorial : public WorldEntity
@@ -136,7 +136,7 @@ public:

#if USE_CUSTOM_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)

for (int i = 0; i < m_gears.count(); i++)


+ 3
- 3
src/Makefile.am View File

@@ -95,10 +95,10 @@ liblol_core_sources = \
input/input.cpp input/input.h input/input_internal.h input/keys.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/emptymaterial.lolfx \
gpu/testmaterial.lolfx \
gpu/blit.lolfx \
gpu/postprocess.lolfx \
\


+ 1
- 1
src/easymesh/easymesh.cpp View File

@@ -13,7 +13,7 @@

#include <lol/engine-internal.h>

LOLFX_RESOURCE_DECLARE(shiny);
LOLFX_RESOURCE_DECLARE(easymesh_shiny);

namespace lol
{


+ 14
- 14
src/easymesh/easymeshrender.cpp View File

@@ -15,19 +15,19 @@
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()
{
/* Default material */
Shader *shader = Shader::Create(LOLFX_RESOURCE_NAME(shiny));
Shader *shader = Shader::Create(LOLFX_RESOURCE_NAME(easymesh_shiny));

/* Push index buffer to GPU */
IndexBuffer *ibo = new IndexBuffer(m_indices.count() * sizeof(uint16_t));
@@ -130,18 +130,18 @@ DefaultShaderData::DefaultShaderData(DebugRenderMode render_mode)
(1 << VertexUsage::Color);

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)
m_shader = Shader::Create(LOLFX_RESOURCE_NAME(shinyflat));
m_shader = Shader::Create(LOLFX_RESOURCE_NAME(easymesh_shinyflat));
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)
m_shader = Shader::Create(LOLFX_RESOURCE_NAME(shinydebuglighting));
m_shader = Shader::Create(LOLFX_RESOURCE_NAME(easymesh_shinydebuglighting));
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)
{
m_shader = Shader::Create(LOLFX_RESOURCE_NAME(shinydebugUV));
m_shader = Shader::Create(LOLFX_RESOURCE_NAME(easymesh_shinydebugUV));
m_vert_decl_flags |= (1 << VertexUsage::TexCoord);
with_UV = true;
}


src/gpu/defaultmaterial.lolfx → src/gpu/default-material.lolfx View File


src/gpu/emptymaterial.lolfx → src/gpu/empty-material.lolfx View File


src/gpu/testmaterial.lolfx → src/gpu/test-material.lolfx View File


+ 3
- 3
src/lol-core.vcxproj View File

@@ -369,12 +369,12 @@
<LolFxCompile Include="easymesh\shinyflat.lolfx" />
<LolFxCompile Include="easymesh\shiny_SK.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\palette.lolfx" />
<LolFxCompile Include="gpu\postprocess.lolfx" />
<LolFxCompile Include="gpu\testmaterial.lolfx" />
<LolFxCompile Include="gpu\test-material.lolfx" />
<LolFxCompile Include="gpu\tile.lolfx" />
<LolFxCompile Include="gradient.lolfx" />
</ItemGroup>


+ 3
- 3
src/lol-core.vcxproj.filter View File

@@ -803,13 +803,13 @@
</ClInclude>
</ItemGroup>
<ItemGroup>
<LolFxCompile Include="gpu\emptymaterial.lolfx">
<LolFxCompile Include="gpu\empty-material.lolfx">
<Filter>gpu</Filter>
</LolFxCompile>
<LolFxCompile Include="gpu\defaultmaterial.lolfx">
<LolFxCompile Include="gpu\default-material.lolfx">
<Filter>gpu</Filter>
</LolFxCompile>
<LolFxCompile Include="gpu\testmaterial.lolfx">
<LolFxCompile Include="gpu\test-material.lolfx">
<Filter>gpu</Filter>
</LolFxCompile>
<LolFxCompile Include="easymesh\shiny.lolfx">


+ 10
- 10
src/scene.cpp View File

@@ -23,12 +23,12 @@

#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
{
@@ -207,8 +207,8 @@ Scene::Scene(ivec2 size)
data->m_renderbuffer[1] = new Framebuffer(size);
data->m_renderbuffer[2] = 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[1] = data->m_pp.m_shader[1]->GetAttribLocation(VertexUsage::Position, 0);
data->m_pp.m_vdecl = new VertexDeclaration(VertexStream<vec2>(VertexUsage::Position));
@@ -764,9 +764,9 @@ void Scene::render_tiles() // XXX: rename to Blit()
#endif

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)
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++)
{
@@ -878,7 +878,7 @@ void Scene::render_lines(float seconds)
int linecount = (int)data->m_line_api.m_lines.count();

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;
buff.resize(linecount);


Loading…
Cancel
Save