Changeset 2277 for trunk


Ignore:
Timestamp:
Jan 25, 2013, 4:48:37 PM (7 years ago)
Author:
sam
Message:

build: hide LolFx external declarations behind macros.

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/build/autotools/common.am

    r1981 r2277  
    6262        $(lolfx_gen)
    6363        $(AM_V_at)(echo "char const *"; \
    64          echo "lolfx_$(notdir $(basename $(filter %.lolfx, $^))) ="; \
     64         echo "lolfx_resource_$(notdir $(basename $(filter %.lolfx, $^))) ="; \
    6565         $(SED) 's/"/\\"/g' $(filter %.lolfx, $^) | $(SED) 's/\([^\r]*\).*/"\1\\n"/'; \
    6666         echo ";") \
  • trunk/src/core.h

    r2276 r2277  
    6161}
    6262#endif
     63
     64/* External declaration for LolFx files. */
     65#define LOLFX_RESOURCE_DECLARE(name) \
     66    extern "C" char const *LOLFX_RESOURCE_NAME(name)
     67#define LOLFX_RESOURCE_NAME(name) lolfx_resource_##name
    6368
    6469/* If using NaCl or Android, override main() with our version */
  • trunk/src/easymesh/easymesh.cpp

    r2232 r2277  
    3636#include "easymesh/easymesh-compiler.h"
    3737
    38 extern char const *lolfx_shiny;
     38LOLFX_RESOURCE_DECLARE(shiny);
    3939
    4040namespace lol
     
    6767    if(provided_shader == NULL)
    6868    {
    69         m_gpu.shader = Shader::Create(lolfx_shiny);
     69        m_gpu.shader = Shader::Create(LOLFX_RESOURCE_NAME(shiny));
    7070    }
    7171    else
  • trunk/src/gradient.cpp

    r2216 r2277  
    1818using namespace std;
    1919
    20 extern char const *lolfx_gradient;
     20LOLFX_RESOURCE_DECLARE(gradient);
    2121
    2222namespace lol
     
    7777    if (!data->shader)
    7878    {
    79         data->shader = Shader::Create(lolfx_gradient);
     79        data->shader = Shader::Create(LOLFX_RESOURCE_NAME(gradient));
    8080
    8181        data->m_vbo = new VertexBuffer(sizeof(vertex));
  • trunk/src/scene.cpp

    r2216 r2277  
    2323#include "lolgl.h"
    2424
    25 extern char const *lolfx_tile;
     25LOLFX_RESOURCE_DECLARE(tile);
    2626
    2727namespace lol
     
    157157
    158158    if (!data->m_shader)
    159         data->m_shader = Shader::Create(lolfx_tile);
     159        data->m_shader = Shader::Create(LOLFX_RESOURCE_NAME(tile));
    160160
    161161#if 0
  • trunk/tools/neercs/video/render.cpp

    r2182 r2277  
    3333#include "text-render.h"
    3434
    35 extern char const *lolfx_simple;
    36 extern char const *lolfx_blurh;
    37 extern char const *lolfx_blurv;
    38 extern char const *lolfx_glow;
    39 extern char const *lolfx_remanence;
    40 extern char const *lolfx_copper;
    41 extern char const *lolfx_color;
    42 extern char const *lolfx_noise;
    43 extern char const *lolfx_postfx;
    44 extern char const *lolfx_mirror;
    45 extern char const *lolfx_radial;
     35LOLFX_RESOURCE_DECLARE(simple);
     36LOLFX_RESOURCE_DECLARE(blurh);
     37LOLFX_RESOURCE_DECLARE(blurv);
     38LOLFX_RESOURCE_DECLARE(glow);
     39LOLFX_RESOURCE_DECLARE(remanence);
     40LOLFX_RESOURCE_DECLARE(copper);
     41LOLFX_RESOURCE_DECLARE(color);
     42LOLFX_RESOURCE_DECLARE(noise);
     43LOLFX_RESOURCE_DECLARE(postfx);
     44LOLFX_RESOURCE_DECLARE(mirror);
     45LOLFX_RESOURCE_DECLARE(radial);
    4646
    4747#define PID M_PI/180.0f    // pi ratio
     
    883883    fbo_tmp = new FrameBuffer(screen_size);
    884884    // shader simple
    885     shader_simple = Shader::Create(lolfx_simple);
     885    shader_simple = Shader::Create(LOLFX_RESOURCE_NAME(simple));
    886886    shader_simple_texture = shader_simple->GetUniformLocation("texture");
    887887    // shader glow
    888     shader_glow = Shader::Create(lolfx_glow);
     888    shader_glow = Shader::Create(LOLFX_RESOURCE_NAME(glow));
    889889    shader_glow_glow = shader_glow->GetUniformLocation("glow");
    890890    shader_glow_source = shader_glow->GetUniformLocation("source");
    891891    shader_glow_mix = shader_glow->GetUniformLocation("mix");
    892892    // shader blur horizontal
    893     shader_blur_h = Shader::Create(lolfx_blurh);
     893    shader_blur_h = Shader::Create(LOLFX_RESOURCE_NAME(blurh));
    894894    shader_blur_h_texture = shader_blur_h->GetUniformLocation("texture");
    895895    shader_blur_h_radius = shader_blur_h->GetUniformLocation("radius");
    896896    // shader blur vertical
    897     shader_blur_v = Shader::Create(lolfx_blurv);
     897    shader_blur_v = Shader::Create(LOLFX_RESOURCE_NAME(blurv));
    898898    shader_blur_v_texture = shader_blur_v->GetUniformLocation("texture");
    899899    shader_blur_v_radius = shader_blur_v->GetUniformLocation("radius");
    900900    // shader remanence
    901     shader_remanence = Shader::Create(lolfx_remanence);
     901    shader_remanence = Shader::Create(LOLFX_RESOURCE_NAME(remanence));
    902902    shader_remanence_source = shader_remanence->GetUniformLocation("source");
    903903    shader_remanence_buffer = shader_remanence->GetUniformLocation("buffer");
    904904    shader_remanence_mix = shader_remanence->GetUniformLocation("mix");
    905905    // shader copper
    906     shader_copper = Shader::Create(lolfx_copper);
     906    shader_copper = Shader::Create(LOLFX_RESOURCE_NAME(copper));
    907907    shader_copper_texture = shader_copper->GetUniformLocation("texture");
    908908    shader_copper_screen_size = shader_copper->GetUniformLocation("screen_size");
     
    911911    shader_copper_mask_color = shader_copper->GetUniformLocation("mask_color");
    912912    // shader color
    913     shader_color = Shader::Create(lolfx_color);
     913    shader_color = Shader::Create(LOLFX_RESOURCE_NAME(color));
    914914    shader_color_texture = shader_color->GetUniformLocation("texture");
    915915    shader_color_screen_size = shader_color->GetUniformLocation("screen_size");
     
    918918    shader_color_flash = shader_color->GetUniformLocation("flash");
    919919    // shader noise
    920     shader_noise = Shader::Create(lolfx_noise);
     920    shader_noise = Shader::Create(LOLFX_RESOURCE_NAME(noise));
    921921    shader_noise_texture = shader_noise->GetUniformLocation("texture");
    922922    shader_noise_screen_size = shader_noise->GetUniformLocation("screen_size");
     
    926926    shader_noise_retrace = shader_noise->GetUniformLocation("retrace");
    927927    // shader postfx
    928     shader_postfx = Shader::Create(lolfx_postfx);
     928    shader_postfx = Shader::Create(LOLFX_RESOURCE_NAME(postfx));
    929929    shader_postfx_texture = shader_postfx->GetUniformLocation("texture");
    930930    shader_postfx_texture_2d = shader_postfx->GetUniformLocation("texture_2d");
     
    948948    shader_postfx_beat = shader_postfx->GetUniformLocation("beat");
    949949    // shader mirror
    950     shader_mirror = Shader::Create(lolfx_mirror);
     950    shader_mirror = Shader::Create(LOLFX_RESOURCE_NAME(mirror));
    951951    shader_mirror_texture = shader_mirror->GetUniformLocation("texture");
    952952    shader_mirror_screen_size = shader_mirror->GetUniformLocation("screen_size");
    953953    shader_mirror_mirror = shader_mirror->GetUniformLocation("mirror");
    954954    // shader radial blur
    955     shader_radial = Shader::Create(lolfx_radial);
     955    shader_radial = Shader::Create(LOLFX_RESOURCE_NAME(radial));
    956956    shader_radial_texture = shader_radial->GetUniformLocation("texture");
    957957    shader_radial_screen_size = shader_radial->GetUniformLocation("screen_size");
  • trunk/tools/neercs/video/text-render.cpp

    r2242 r2277  
    2323#include "text-render.h"
    2424
    25 extern char const *lolfx_text;
     25LOLFX_RESOURCE_DECLARE(text);
    2626
    2727#define HAVE_SHADER_4 1
     
    4747                         ivec2(256, 256), ivec2(1));
    4848
    49     m_shader = Shader::Create(lolfx_text);
     49    m_shader = Shader::Create(LOLFX_RESOURCE_NAME(text));
    5050    m_color = m_shader->GetAttribLocation("in_Attr",
    5151                                          VertexUsage::Color, 0);
  • trunk/tutorial/01_triangle.cpp

    r2241 r2277  
    1919using namespace lol;
    2020
    21 extern char const *lolfx_01_triangle;
     21LOLFX_RESOURCE_DECLARE(01_triangle);
    2222
    2323class Triangle : public WorldEntity
     
    3838        if (!m_ready)
    3939        {
    40             m_shader = Shader::Create(lolfx_01_triangle);
     40            m_shader = Shader::Create(LOLFX_RESOURCE_NAME(01_triangle));
    4141            m_coord = m_shader->GetAttribLocation("in_Position", VertexUsage::Position, 0);
    4242
  • trunk/tutorial/02_cube.cpp

    r2241 r2277  
    1919using namespace lol;
    2020
    21 extern char const *lolfx_02_cube;
     21LOLFX_RESOURCE_DECLARE(02_cube);
    2222
    2323class Cube : public WorldEntity
     
    7575        if (!m_ready)
    7676        {
    77             m_shader = Shader::Create(lolfx_02_cube);
     77            m_shader = Shader::Create(LOLFX_RESOURCE_NAME(02_cube));
    7878
    7979            m_mvp = m_shader->GetUniformLocation("in_Matrix");
  • trunk/tutorial/03_noise.cpp

    r2241 r2277  
    1919using namespace lol;
    2020
    21 extern char const *lolfx_03_noise;
     21LOLFX_RESOURCE_DECLARE(03_noise);
    2222
    2323class NoiseDemo : public WorldEntity
     
    4545        if (!m_ready)
    4646        {
    47             m_shader = Shader::Create(lolfx_03_noise);
     47            m_shader = Shader::Create(LOLFX_RESOURCE_NAME(03_noise));
    4848            m_coord = m_shader->GetAttribLocation("in_Position", VertexUsage::Position, 0);
    4949            m_time_uni = m_shader->GetUniformLocation("u_Time");
  • trunk/tutorial/04_texture.cpp

    r2237 r2277  
    2121static int const TEXTURE_WIDTH = 256;
    2222
    23 extern char const *lolfx_04_texture;
     23LOLFX_RESOURCE_DECLARE(04_texture);
    2424
    2525class TextureDemo : public WorldEntity
     
    7575            m_texture = new Texture(ivec2(TEXTURE_WIDTH, 1), PixelFormat::A8R8G8B8);
    7676
    77             m_shader = Shader::Create(lolfx_04_texture);
     77            m_shader = Shader::Create(LOLFX_RESOURCE_NAME(04_texture));
    7878            m_coord = m_shader->GetAttribLocation("in_Position", VertexUsage::Position, 0);
    7979
  • trunk/tutorial/08_fbo.cpp

    r2241 r2277  
    1919using namespace lol;
    2020
    21 extern char const *lolfx_08_fbo;
     21LOLFX_RESOURCE_DECLARE(08_fbo);
    2222
    2323class FBO : public WorldEntity
     
    5757        if (!m_ready)
    5858        {
    59             m_shader = Shader::Create(lolfx_08_fbo);
     59            m_shader = Shader::Create(LOLFX_RESOURCE_NAME(08_fbo));
    6060            m_coord = m_shader->GetAttribLocation("in_Position", VertexUsage::Position, 0);
    6161            m_uni_flag = m_shader->GetUniformLocation("in_Flag");
  • trunk/tutorial/11_fractal.cpp

    r2241 r2277  
    2121using namespace lol;
    2222
    23 extern char const *lolfx_11_fractal;
     23LOLFX_RESOURCE_DECLARE(11_fractal);
    2424
    2525class Fractal : public WorldEntity
     
    449449            m_texture->SetData(&m_pixels[0]);
    450450
    451             m_shader = Shader::Create(lolfx_11_fractal);
     451            m_shader = Shader::Create(LOLFX_RESOURCE_NAME(11_fractal));
    452452
    453453            m_vertexattrib = m_shader->GetAttribLocation("a_Vertex", VertexUsage::Position, 0);
Note: See TracChangeset for help on using the changeset viewer.