ソースを参照

build: hide LolFx external declarations behind macros.

legacy
Sam Hocevar sam 12年前
コミット
3adf42b00c
11個のファイルの変更24行の追加19行の削除
  1. +1
    -1
      build/autotools/common.am
  2. +5
    -0
      src/core.h
  3. +2
    -2
      src/easymesh/easymesh.cpp
  4. +2
    -2
      src/gradient.cpp
  5. +2
    -2
      src/scene.cpp
  6. +2
    -2
      tutorial/01_triangle.cpp
  7. +2
    -2
      tutorial/02_cube.cpp
  8. +2
    -2
      tutorial/03_noise.cpp
  9. +2
    -2
      tutorial/04_texture.cpp
  10. +2
    -2
      tutorial/08_fbo.cpp
  11. +2
    -2
      tutorial/11_fractal.cpp

+ 1
- 1
build/autotools/common.am ファイルの表示

@@ -61,7 +61,7 @@ SUFFIXES += .lolfx
.lolfx.o:
$(lolfx_gen)
$(AM_V_at)(echo "char const *"; \
echo "lolfx_$(notdir $(basename $(filter %.lolfx, $^))) ="; \
echo "lolfx_resource_$(notdir $(basename $(filter %.lolfx, $^))) ="; \
$(SED) 's/"/\\"/g' $(filter %.lolfx, $^) | $(SED) 's/\([^\r]*\).*/"\1\\n"/'; \
echo ";") \
| $(CXXCOMPILE) -xc++ -c - -o $@


+ 5
- 0
src/core.h ファイルの表示

@@ -61,6 +61,11 @@ static inline int isnan(float f)
}
#endif

/* External declaration for LolFx files. */
#define LOLFX_RESOURCE_DECLARE(name) \
extern "C" char const *LOLFX_RESOURCE_NAME(name)
#define LOLFX_RESOURCE_NAME(name) lolfx_resource_##name

/* If using NaCl or Android, override main() with our version */
#if defined __native_client__
# define main lol_nacl_main


+ 2
- 2
src/easymesh/easymesh.cpp ファイルの表示

@@ -35,7 +35,7 @@
#include "core.h"
#include "easymesh/easymesh-compiler.h"

extern char const *lolfx_shiny;
LOLFX_RESOURCE_DECLARE(shiny);

namespace lol
{
@@ -66,7 +66,7 @@ void EasyMesh::MeshConvert(Shader* provided_shader)
{
if(provided_shader == NULL)
{
m_gpu.shader = Shader::Create(lolfx_shiny);
m_gpu.shader = Shader::Create(LOLFX_RESOURCE_NAME(shiny));
}
else
{


+ 2
- 2
src/gradient.cpp ファイルの表示

@@ -17,7 +17,7 @@

using namespace std;

extern char const *lolfx_gradient;
LOLFX_RESOURCE_DECLARE(gradient);

namespace lol
{
@@ -76,7 +76,7 @@ void Gradient::TickDraw(float seconds)

if (!data->shader)
{
data->shader = Shader::Create(lolfx_gradient);
data->shader = Shader::Create(LOLFX_RESOURCE_NAME(gradient));

data->m_vbo = new VertexBuffer(sizeof(vertex));
data->m_cbo = new VertexBuffer(sizeof(color));


+ 2
- 2
src/scene.cpp ファイルの表示

@@ -22,7 +22,7 @@
#include "core.h"
#include "lolgl.h"

extern char const *lolfx_tile;
LOLFX_RESOURCE_DECLARE(tile);

namespace lol
{
@@ -156,7 +156,7 @@ void Scene::Render() // XXX: rename to Blit()
return;

if (!data->m_shader)
data->m_shader = Shader::Create(lolfx_tile);
data->m_shader = Shader::Create(LOLFX_RESOURCE_NAME(tile));

#if 0
// Randomise, then sort.


+ 2
- 2
tutorial/01_triangle.cpp ファイルの表示

@@ -18,7 +18,7 @@
using namespace std;
using namespace lol;

extern char const *lolfx_01_triangle;
LOLFX_RESOURCE_DECLARE(01_triangle);

class Triangle : public WorldEntity
{
@@ -37,7 +37,7 @@ public:

if (!m_ready)
{
m_shader = Shader::Create(lolfx_01_triangle);
m_shader = Shader::Create(LOLFX_RESOURCE_NAME(01_triangle));
m_coord = m_shader->GetAttribLocation("in_Position", VertexUsage::Position, 0);

m_vdecl = new VertexDeclaration(VertexStream<vec2>(VertexUsage::Position));


+ 2
- 2
tutorial/02_cube.cpp ファイルの表示

@@ -18,7 +18,7 @@
using namespace std;
using namespace lol;

extern char const *lolfx_02_cube;
LOLFX_RESOURCE_DECLARE(02_cube);

class Cube : public WorldEntity
{
@@ -74,7 +74,7 @@ public:

if (!m_ready)
{
m_shader = Shader::Create(lolfx_02_cube);
m_shader = Shader::Create(LOLFX_RESOURCE_NAME(02_cube));

m_mvp = m_shader->GetUniformLocation("in_Matrix");
m_coord = m_shader->GetAttribLocation("in_Vertex",


+ 2
- 2
tutorial/03_noise.cpp ファイルの表示

@@ -18,7 +18,7 @@
using namespace std;
using namespace lol;

extern char const *lolfx_03_noise;
LOLFX_RESOURCE_DECLARE(03_noise);

class NoiseDemo : public WorldEntity
{
@@ -44,7 +44,7 @@ public:

if (!m_ready)
{
m_shader = Shader::Create(lolfx_03_noise);
m_shader = Shader::Create(LOLFX_RESOURCE_NAME(03_noise));
m_coord = m_shader->GetAttribLocation("in_Position", VertexUsage::Position, 0);
m_time_uni = m_shader->GetUniformLocation("u_Time");



+ 2
- 2
tutorial/04_texture.cpp ファイルの表示

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

static int const TEXTURE_WIDTH = 256;

extern char const *lolfx_04_texture;
LOLFX_RESOURCE_DECLARE(04_texture);

class TextureDemo : public WorldEntity
{
@@ -74,7 +74,7 @@ public:
{
m_texture = new Texture(ivec2(TEXTURE_WIDTH, 1), PixelFormat::A8R8G8B8);

m_shader = Shader::Create(lolfx_04_texture);
m_shader = Shader::Create(LOLFX_RESOURCE_NAME(04_texture));
m_coord = m_shader->GetAttribLocation("in_Position", VertexUsage::Position, 0);

m_vdecl = new VertexDeclaration(VertexStream<vec2>(VertexUsage::Position));


+ 2
- 2
tutorial/08_fbo.cpp ファイルの表示

@@ -18,7 +18,7 @@
using namespace std;
using namespace lol;

extern char const *lolfx_08_fbo;
LOLFX_RESOURCE_DECLARE(08_fbo);

class FBO : public WorldEntity
{
@@ -56,7 +56,7 @@ public:

if (!m_ready)
{
m_shader = Shader::Create(lolfx_08_fbo);
m_shader = Shader::Create(LOLFX_RESOURCE_NAME(08_fbo));
m_coord = m_shader->GetAttribLocation("in_Position", VertexUsage::Position, 0);
m_uni_flag = m_shader->GetUniformLocation("in_Flag");
m_uni_point = m_shader->GetUniformLocation("in_Point");


+ 2
- 2
tutorial/11_fractal.cpp ファイルの表示

@@ -20,7 +20,7 @@

using namespace lol;

extern char const *lolfx_11_fractal;
LOLFX_RESOURCE_DECLARE(11_fractal);

class Fractal : public WorldEntity
{
@@ -448,7 +448,7 @@ public:
* uploading subimages will not work. */
m_texture->SetData(&m_pixels[0]);

m_shader = Shader::Create(lolfx_11_fractal);
m_shader = Shader::Create(LOLFX_RESOURCE_NAME(11_fractal));

m_vertexattrib = m_shader->GetAttribLocation("a_Vertex", VertexUsage::Position, 0);
m_texattrib = m_shader->GetAttribLocation("a_TexCoord", VertexUsage::TexCoord, 0);


読み込み中…
キャンセル
保存