From 34a59d25d40abd7f8aa9b15c98688a3390bd3666 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20=E2=80=98Touky=E2=80=99=20Huet?= Date: Wed, 25 Sep 2013 22:37:17 +0000 Subject: [PATCH] MeshViewer cleanup + MessageService tweak for emscripten --- src/messageservice.cpp | 4 ++-- test/Makefile.am | 2 +- test/meshviewer.cpp | 37 +------------------------------------ test/mviewer_em_test.lolfx | 32 -------------------------------- 4 files changed, 4 insertions(+), 71 deletions(-) delete mode 100644 test/mviewer_em_test.lolfx diff --git a/src/messageservice.cpp b/src/messageservice.cpp index 24e25de0..b6619045 100644 --- a/src/messageservice.cpp +++ b/src/messageservice.cpp @@ -26,9 +26,9 @@ namespace lol #if EMSCRIPTEN extern "C" { - bool C_Send(int id, const char* message) + int C_Send(int id, const char* message) { - return MessageService::Send(id, message); + return (int)MessageService::Send(id, message); } //NOT IMPLEMENTED //bool C_FetchFirst(int id, String& message); diff --git a/test/Makefile.am b/test/Makefile.am index a6ff2af5..264bdba1 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -58,7 +58,7 @@ nacl_phystest_DEPENDENCIES = @LOL_DEPS@ nacl_phystest_LDFLAGS = $(AM_LDFLAGS) meshviewer_SOURCES = meshviewer.cpp \ - shinymvtexture.lolfx shinyfur.lolfx mviewer_em_test.lolfx + shinymvtexture.lolfx shinyfur.lolfx meshviewer_CPPFLAGS = $(AM_CPPFLAGS) meshviewer_DEPENDENCIES = @LOL_DEPS@ meshviewer_LDFLAGS = $(AM_LDFLAGS) diff --git a/test/meshviewer.cpp b/test/meshviewer.cpp index 869ecf5f..b935f37f 100644 --- a/test/meshviewer.cpp +++ b/test/meshviewer.cpp @@ -45,7 +45,6 @@ static int const TEXTURE_WIDTH = 256; #define HST_CLAMP 1.f #define WITH_TEXTURE 0 -#define EM_TEST (1 && EMSCRIPTEN) #define NO_NACL_EM (!__native_client__ && !EMSCRIPTEN) #define NACL_EM (__native_client__ || EMSCRIPTEN) @@ -85,38 +84,6 @@ enum MessageType MSG_MAX }; -LOLFX_RESOURCE_DECLARE(mviewer_em_test); - -class MVTestShaderData : public GpuShaderData -{ -public: - //----------------------------------------------------------------------------- - MVTestShaderData() - { - m_render_mode = DebugRenderMode::Default; - m_vert_decl_flags = (1 << VertexUsage::Position) | (1 << VertexUsage::Color); - m_shader = Shader::Create(LOLFX_RESOURCE_NAME(mviewer_em_test)); - SetupDefaultData(false); - } - - //----------------------------------------------------------------------------- - void SetupDefaultData(bool with_UV) - { - AddUniform("in_ModelView"); - AddUniform("in_Proj"); - } - - //----------------------------------------------------------------------------- - void SetupShaderDatas(mat4 const &model) - { - mat4 proj = g_scene->GetCamera()->GetProjection(); - mat4 view = g_scene->GetCamera()->GetView(); - - m_shader->SetUniform(*GetUniform("in_ModelView"), view * model); - m_shader->SetUniform(*GetUniform("in_Proj"), proj); - } -}; - class MeshViewer : public WorldEntity { public: @@ -491,9 +458,7 @@ public: { if (m_meshes[i]->GetMeshState() == MeshRender::NeedConvert) { -#if EM_TEST - m_meshes[i]->MeshConvert(new MVTestShaderData()); -#elif WITH_TEXTURE +#if WITH_TEXTURE m_meshes[i]->MeshConvert(new DefaultShaderData(((1 << VertexUsage::Position) | (1 << VertexUsage::Normal) | (1 << VertexUsage::Color) | (1 << VertexUsage::TexCoord)), m_texture_shader, true)); diff --git a/test/mviewer_em_test.lolfx b/test/mviewer_em_test.lolfx deleted file mode 100644 index f5cc223c..00000000 --- a/test/mviewer_em_test.lolfx +++ /dev/null @@ -1,32 +0,0 @@ - -[vert.glsl] -#version 120 - -attribute vec3 in_Position; -attribute vec4 in_Color; - -uniform mat4 in_ModelView; -uniform mat4 in_Proj; - -varying vec4 pass_Color; - -void main(void) -{ - pass_Color = in_Color; - - gl_Position = in_Proj * in_ModelView * vec4(in_Position, 1.0); -} - -[frag.glsl] -#version 120 - -#if defined GL_ES -precision highp float; -#endif - -varying vec4 pass_Color; - -void main(void) -{ - gl_FragColor = pass_Color; -}