diff --git a/test/meshviewer.cpp b/test/meshviewer.cpp index 9f9fb52f..1bf125f4 100644 --- a/test/meshviewer.cpp +++ b/test/meshviewer.cpp @@ -481,10 +481,13 @@ public: SceneSetup* new_ssetup = new SceneSetup(); if (new_ssetup->Compile(mesh.C())) { - if (m_ssetup) - delete(m_ssetup); - m_ssetup = new_ssetup; - m_ssetup->Startup(); + if (new_ssetup->GetLightNb()) + { + if (m_ssetup) + delete(m_ssetup); + m_ssetup = new_ssetup; + m_ssetup->Startup(); + } m_mat_prev = mat4(quat::fromeuler_xyz(vec3::zero)); } else @@ -524,7 +527,7 @@ public: // MessageService::Send(MessageBucket::AppIn, "[sc#8ff afcb 1 1 1 0]"); // MessageService::Send(MessageBucket::AppIn, "[sc#ff8 afcb 1 1 1 0]"); //} -#elif WIN32 && 0 +#elif WIN32 //-- //File management //-- @@ -542,11 +545,6 @@ public: && (!m_cmdlist.Count() || cmd != m_cmdlist.Last())) { m_cmdlist << cmd; - /* - cmd = String(" addlight 0.0 position (4 -1 -4) color (.0 .2 .5 1) \ - addlight 0.0 position (8 2 6) color #ffff \ - custom setmesh \"") + cmd + "\""; - */ MessageService::Send(MessageBucket::AppIn, cmd); } } diff --git a/test/meshviewer.index.html b/test/meshviewer.index.html index 496c3529..91d2901d 100644 --- a/test/meshviewer.index.html +++ b/test/meshviewer.index.html @@ -104,12 +104,13 @@ progress::-webkit-progress-value //This is the module pointer : can be either the NaCl or Em one depending on the context. g_embed_module = null; - var g_mesh_code_base = []; + var g_code_addin = ['custom setmesh "#CODE#"', '']; + var g_code_base = []; var CodeDictionnary = []; g_code_id = 0; - g_mesh_code_base[0] = "//This is a comment\nsc#f8f afcb 1 1 1 0"; - g_mesh_code_base[1] = "//This is a comment\naddlight 0.0 position (4 -1 -4) color (.0 .2 .5 1)\naddlight 0.0 position (8 2 6) color #ffff"; + g_code_base[0] = "//This is a comment\nsc#f8f afcb 1 1 1 0"; + g_code_base[1] = "//This is a comment\naddlight 0.0 position (4 -1 -4) color (.0 .2 .5 1)\naddlight 0.0 position (8 2 6) color #ffff"; function machinchose() { return 'test machin '; } function GetTextAreaCodeSrc() { return g_txtarea_code_src; } @@ -179,7 +180,7 @@ function machinchose() { return 'test machin '; } //Put here any cookie update if (!g_txtarea_code_src.value) - g_txtarea_code_src.value = g_mesh_code_base[g_code_id]; + g_txtarea_code_src.value = g_code_base[g_code_id]; //Fill the TOC if (!g_div_alphabet.innerHTML) @@ -234,7 +235,7 @@ function machinchose() { return 'test machin '; } function StoreTextAreaValue() { - g_mesh_code_base[g_code_id] = GetTextAreaCodeSrc().value; + g_code_base[g_code_id] = GetTextAreaCodeSrc().value; } function ExchangeSetup() @@ -246,7 +247,7 @@ function machinchose() { return 'test machin '; } function InitEditValues() { - GetTextAreaCodeSrc().value = g_mesh_code_base[g_code_id]; + GetTextAreaCodeSrc().value = g_code_base[g_code_id]; g_div_alphabet.innerHTML = ' Table of content
 [' + CodeDictionnary[g_code_id].m_alphabet + '] 
 '; } @@ -260,8 +261,7 @@ function machinchose() { return 'test machin '; } function SendMessageToModule() { StoreTextAreaValue(); - var message = g_mesh_code_base[1] + ' \n'; - message += ' custom setmesh "' + g_mesh_code_base[0] + '"'; + var message = g_code_addin[g_code_id].Replace('#CODE#', g_code_base[g_code_id]); if (g_embed_module) g_embed_module.SendMessage(message); else @@ -292,10 +292,10 @@ function machinchose() { return 'test machin '; }
-
+
-
+
diff --git a/test/scenesetup.h b/test/scenesetup.h index 97f1149f..3d899617 100644 --- a/test/scenesetup.h +++ b/test/scenesetup.h @@ -38,6 +38,9 @@ public: bool Startup(); bool Shutdown(bool destroy=false); + //-- + int GetLightNb() { m_lights.Count(); } + //private: Array m_lights; Array m_custom_cmd;