No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 

283 líneas
8.7 KiB

  1. <DOCTYPE html>
  2. <html>
  3. <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
  4. <!--
  5. Copyright (c) 2012 The Native Client Authors. All rights reserved.
  6. Use of this source code is governed by a BSD-style license that can be
  7. found in the LICENSE file.
  8. -->
  9. <head>
  10. <style type="text/css">
  11. body
  12. {
  13. font:12px Consolas;
  14. }
  15. button
  16. {
  17. font:14px Consolas;
  18. }
  19. textarea
  20. {
  21. font:14px Consolas;
  22. }
  23. #id_div_progress_status
  24. {
  25. font:12px Consolas;
  26. }
  27. #id_div_progress
  28. {
  29. position: absolute;
  30. top: 20%;
  31. left: 30%;
  32. right: 30%;
  33. z-index: 3;
  34. background-color:white;
  35. border:1px solid #000000;
  36. visibility: hidden;
  37. }
  38. progress
  39. {
  40. background-color: #f3f3f3;
  41. border: 0;
  42. height: 18px;
  43. width: 200px;
  44. border-radius: 9px;
  45. }
  46. progress::-webkit-progress-bar
  47. {
  48. background-color: #f3f3f3;
  49. border: 1px solid #000000;
  50. padding: 2px 2px;
  51. height: 20px;
  52. border-radius: 0px;
  53. }
  54. progress::-webkit-progress-value
  55. {
  56. background-color: #22BB22;
  57. border: 0px;
  58. height: 14px;
  59. border-radius: 0px;
  60. }
  61. #id_div_listener
  62. {
  63. position: relative;
  64. }
  65. #id_div_frame_embed
  66. {
  67. position: absolute;
  68. top: 2px;
  69. left: 2px;
  70. z-index: -1;
  71. }
  72. #BGCanvas
  73. {
  74. border:1px solid #000000;
  75. }
  76. #id_div_helper_cmd_0
  77. {
  78. margin-left: 5px;
  79. }
  80. </style>
  81. <title>Mesh Viewer Web Edition</title>
  82. </head>
  83. <script type="text/javascript">
  84. //Base data Setup : GLOBAL STYLE
  85. g_div_frame_embed_save = '';
  86. g_div_frame_embed = null;
  87. g_txtarea_code_src = null;
  88. g_div_helper_cmd = [null, null];
  89. g_div_helper_args = null;
  90. g_div_helper_cmnt = null;
  91. g_div_helper_vars = null;
  92. g_div_alphabet = null;
  93. g_div_progress = null;
  94. g_div_progress_status = null;
  95. g_progress_bar = null;
  96. g_var_progress_bar = -1;
  97. g_frame_embed = null;
  98. //This is the module pointer : can be either the NaCl or Em one depending on the context.
  99. g_embed_module = null;
  100. g_mesh_code_base = "//This is a comment\nsc#f8f afcb 1 1 1 0";
  101. g_scene_code_base = "//This is a comment\naddlight 0.0 position (4 -1 -4) color (.0 .2 .5 1) addlight 0.0 position (8 2 6) color #ffff";
  102. function machinchose() { return 'test machin '; }
  103. function GetTextAreaCodeSrc() { return g_txtarea_code_src; }
  104. function GetDivProgress() { return g_div_progress; }
  105. function GetProgressBar() { return g_progress_bar; }
  106. function GetDivProgressStatus() { return g_div_progress_status; }
  107. function GetDivEmbedData() { return g_div_frame_embed; }
  108. function GetDivEmbedDataSave() { return g_div_frame_embed_save; }
  109. function GetFrameData() { return g_frame_embed; }
  110. //Communication with iframe content.
  111. function InitModuleVar() { g_embed_module = GetiFrameModuleVar(); }
  112. function GetiFrameDivEmbed() { return (!g_frame_embed) ? (null) : (g_frame_embed.contentWindow.GetDivEmbed()); }
  113. function GetiFrameModuleVar() { return (!g_frame_embed) ? (null) : (g_frame_embed.contentWindow.GetEmbedModule()); }
  114. function IsUsingNaCl() { return window.chrome; }
  115. </script>
  116. <script src="./utils.js"></script>
  117. <script src="./progress_status.js"></script>
  118. <script src="./type_dictionnary.js"></script>
  119. <script type="text/javascript">
  120. var EasyMeshDict = new TypeDictionnary("EasyMesh");
  121. function GetCmdDictionnary() { return EasyMeshDict; }
  122. </script>
  123. <script src="./easy_mesh_dictionnary.js"></script>
  124. <script type="text/javascript">
  125. //Base init for all datas
  126. function VarInit()
  127. {
  128. //Init frame variable first.
  129. g_frame_embed = document.getElementById('id_frame_embed');
  130. //This is in an iframe.
  131. g_div_frame_embed = g_frame_embed.contentDocument.getElementById('id_div_frame_embed');
  132. //The rest of these are in this page.
  133. g_txtarea_code_src = document.getElementById('id_txtarea_code_src');
  134. g_div_helper_cmd[0] = document.getElementById('id_div_helper_cmd_0');
  135. g_div_helper_cmd[1] = document.getElementById('id_div_helper_cmd_1');
  136. g_div_helper_args = document.getElementById('id_div_helper_args');
  137. g_div_helper_cmnt = document.getElementById('id_div_helper_cmnt');
  138. g_div_helper_vars = document.getElementById('id_div_helper_vars');
  139. g_div_alphabet = document.getElementById('id_div_alphabet');
  140. g_div_progress = document.getElementById('id_div_progress');
  141. g_div_progress_status = document.getElementById('id_div_progress_status');
  142. g_progress_bar = document.getElementById('id_progress_bar');
  143. }
  144. //Base init
  145. function Init()
  146. {
  147. VarInit();
  148. //Put here any cookie update
  149. if (!g_txtarea_code_src.value)
  150. g_txtarea_code_src.value = g_mesh_code_base;
  151. //Fill the TOC
  152. if (!g_div_alphabet.innerHTML)
  153. {
  154. g_div_alphabet.innerHTML = '&nbsp;Table of content<br>&nbsp;[';
  155. var new_toc = BuildTOC(true);
  156. var pattern = new RegExp("^[a-zA-Z\.]");
  157. while (pattern.test(new_toc))
  158. new_toc = new_toc.replace(pattern, "<b>$&");
  159. pattern = new RegExp("[a-zA-Z\.]$");
  160. while (pattern.test(new_toc))
  161. new_toc = new_toc.replace(pattern, "$&</b>");
  162. pattern = new RegExp("([a-zA-Z])([\.])");
  163. while (pattern.test(new_toc))
  164. new_toc = new_toc.replace(pattern, "$1</b>$2");
  165. pattern = new RegExp("([\.])([a-zA-Z])");
  166. while (pattern.test(new_toc))
  167. new_toc = new_toc.replace(pattern, "$1<b>$2");
  168. g_div_alphabet.innerHTML += new_toc + ']&nbsp;<br>&nbsp;';
  169. }
  170. //NaCl Specific
  171. if (IsUsingNaCl())
  172. {
  173. DynLoadFile("nacl_loading.js");
  174. g_frame_embed.src = 'meshviewer_nacl.html';
  175. }
  176. else
  177. g_frame_embed.src = 'meshviewer_em.html';
  178. g_frame_embed.onload = function() { VarInit(); }
  179. //Tick has been done, start Tick
  180. window.setTimeout("Tick()", 200);
  181. }
  182. function Tick()
  183. {
  184. window.setTimeout("Tick()", 100);
  185. var text_src = g_txtarea_code_src;
  186. var div_cmds = g_div_helper_cmd;
  187. var div_args = g_div_helper_args;
  188. var div_cmnt = g_div_helper_cmnt;
  189. var div_vars = g_div_helper_vars;
  190. CmdLookup(div_cmds, div_args, div_cmnt, div_vars, text_src);
  191. }
  192. //Handle message from the NaCl module
  193. function ModuleSentMessage(message)
  194. {
  195. alert('Module sent message: ' + message.data);
  196. }
  197. //Called by the "Send Mesh Command !" button
  198. function SendMessageToModule()
  199. {
  200. if (g_embed_module)
  201. g_embed_module.SendMessage(g_scene_code_base + ' ' + GetTextAreaCodeSrc().value);
  202. else
  203. alert("Module not loaded !");
  204. }
  205. </script>
  206. <body>
  207. <h1>Mesh Viewer : Web version.</h1>
  208. <p>
  209. <div id="final_div">
  210. <div id="id_div_listener" align="center" style="width:770px;height:200px">
  211. <canvas id="BGCanvas" width="772" height="202"></canvas>
  212. <div id="id_div_progress">
  213. <br>&nbsp;
  214. <progress id="id_progress_bar" align="left"></progress>
  215. <div id="id_div_progress_status">....</div>&nbsp;
  216. </div>
  217. <div id="id_div_frame_embed">
  218. <iframe onload="Init();" id="id_frame_embed" src="empty.html" width=770 height=200 frameborder=0 scrolling=no></iframe>
  219. </div>
  220. </div>
  221. </div>
  222. </p>
  223. <div><button onclick="SendMessageToModule()">Send Mesh Command !</button></div>
  224. <table border="0" cellpadding="0" cellspacing="0">
  225. <tr>
  226. <td height="1%">
  227. <div id="bouton">
  228. <textarea autofocus id="id_txtarea_code_src" rows="6" cols="94" style="font: 14px Consolas; resize: none;"></textarea>
  229. </div>
  230. </td>
  231. <td valign="top" rowspan="3">&nbsp;</td>
  232. <td valign="top" rowspan="3">
  233. <div><b><u>Variable Types usage :</u></b></div>
  234. <div id="id_div_helper_vars"></div>
  235. </td>
  236. </tr>
  237. <tr>
  238. <td height="1%">
  239. <div id="id_div_alphabet"></div>
  240. </td>
  241. </tr>
  242. <tr>
  243. <td valign="top">
  244. <table border="0" cellpadding="0" cellspacing="0">
  245. <tr>
  246. <td valign="top"><div id="id_div_helper_cmd_0"></div></td>
  247. <td valign="top"><div id="id_div_helper_cmd_1"></div></td>
  248. <td valign="top"><div id="id_div_helper_args" ></div></td>
  249. <td valign="top"><div id="id_div_helper_cmnt" ></div></td>
  250. </tr>
  251. </table>
  252. </td>
  253. </tr>
  254. </table>
  255. </body>
  256. </html>