Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

557 lignes
19 KiB

  1. //
  2. // Lol Engine - EasyMesh tutorial
  3. //
  4. // Copyright: (c) 2011-2013 Sam Hocevar <sam@hocevar.net>
  5. // (c) 2012-2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com>
  6. // This program is free software; you can redistribute it and/or
  7. // modify it under the terms of the Do What The Fuck You Want To
  8. // Public License, Version 2, as published by Sam Hocevar. See
  9. // http://www.wtfpl.net/ for more details.
  10. //
  11. #if defined HAVE_CONFIG_H
  12. # include "config.h"
  13. #endif
  14. #include <cfloat> /* for FLT_MAX */
  15. #include "core.h"
  16. using namespace std;
  17. using namespace lol;
  18. static int const TEXTURE_WIDTH = 256;
  19. #define R_M 2.f
  20. #define DEFAULT_WIDTH (770.f * R_M)
  21. #define DEFAULT_HEIGHT (200.f * R_M)
  22. #define WIDTH ((float)Video::GetSize().x)
  23. #define HEIGHT ((float)Video::GetSize().y)
  24. #define SCREEN_W (10.f / WIDTH)
  25. #define SCREEN_LIMIT 1.1f
  26. #define RATIO_HW (HEIGHT / WIDTH)
  27. #define RATIO_WH (WIDTH / HEIGHT)
  28. #define ROT_SPEED vec2(50.f)
  29. #define ROT_CLAMP 89.f
  30. #define POS_SPEED vec2(1.2f)
  31. #define POS_CLAMP 1.f
  32. #define FOV_SPEED 20.f
  33. #define FOV_CLAMP 120.f
  34. #define ZOM_SPEED 3.f
  35. #define ZOM_CLAMP 20.f
  36. #define HST_SPEED .5f
  37. #define HST_CLAMP 1.f
  38. #define WITH_TEXTURE 0
  39. LOLFX_RESOURCE_DECLARE(shinyfur);
  40. LOLFX_RESOURCE_DECLARE(shinymvtexture);
  41. enum
  42. {
  43. KEY_CAM_RESET,
  44. KEY_CAM_POS,
  45. KEY_CAM_FOV,
  46. KEY_CAM_UP,
  47. KEY_CAM_DOWN,
  48. KEY_CAM_LEFT,
  49. KEY_CAM_RIGHT,
  50. KEY_MESH_NEXT,
  51. KEY_MESH_PREV,
  52. KEY_F1,
  53. KEY_F2,
  54. KEY_F3,
  55. KEY_F4,
  56. KEY_F5,
  57. KEY_ESC,
  58. KEY_MAX,
  59. };
  60. enum MessageType
  61. {
  62. MSG_IN,
  63. MSG_OUT,
  64. MSG_MAX
  65. };
  66. class MeshViewer : public WorldEntity
  67. {
  68. public:
  69. MeshViewer(char const *file_name = "data/mesh-buffer.txt")
  70. : m_file_name(file_name)
  71. {
  72. m_init = false;
  73. }
  74. void Init()
  75. {
  76. m_init = true;
  77. #if !__native_client__
  78. /* Register an input controller for the keyboard */
  79. m_controller = new Controller("Default", KEY_MAX, 0);
  80. //Camera keyboard rotation
  81. m_controller->GetKey(KEY_CAM_UP ).Bind("Keyboard", "Up");
  82. m_controller->GetKey(KEY_CAM_DOWN ).Bind("Keyboard", "Down");
  83. m_controller->GetKey(KEY_CAM_LEFT ).Bind("Keyboard", "Left");
  84. m_controller->GetKey(KEY_CAM_RIGHT).Bind("Keyboard", "Right");
  85. //Camera keyboard position switch
  86. m_controller->GetKey(KEY_CAM_POS ).Bind("Keyboard", "LeftShift");
  87. m_controller->GetKey(KEY_CAM_FOV ).Bind("Keyboard", "LeftCtrl");
  88. //Camera unzoom switch
  89. m_controller->GetKey(KEY_CAM_RESET).Bind("Keyboard", "Space");
  90. //Mesh change
  91. m_controller->GetKey(KEY_MESH_NEXT).Bind("Keyboard", "PageUp");
  92. m_controller->GetKey(KEY_MESH_PREV).Bind("Keyboard", "PageDown");
  93. //Base setup
  94. m_controller->GetKey(KEY_F1).Bind("Keyboard", "F1");
  95. m_controller->GetKey(KEY_F2).Bind("Keyboard", "F2");
  96. m_controller->GetKey(KEY_F3).Bind("Keyboard", "F3");
  97. m_controller->GetKey(KEY_F4).Bind("Keyboard", "F4");
  98. m_controller->GetKey(KEY_F5).Bind("Keyboard", "F5");
  99. m_controller->GetKey(KEY_ESC).Bind("Keyboard", "Escape");
  100. #endif //!__native_client__
  101. // Message Service
  102. MessageService::Setup(MSG_MAX);
  103. // Mesh Setup
  104. m_render_max = vec2(-.9f, 6.1f);
  105. m_mesh_id = 0;
  106. m_mesh_id1 = 0.f;
  107. m_default_texture = NULL;
  108. //Camera Setup
  109. m_fov = -100.f;
  110. m_fov_mesh = 0.f;
  111. m_fov_speed = 0.f;
  112. m_zoom = -100.f;
  113. m_zoom_mesh = 0.f;
  114. m_zoom_speed = 0.f;
  115. m_rot = vec2(45.f);
  116. m_rot_mesh = vec2::zero;
  117. m_rot_speed = vec2::zero;
  118. m_pos = vec2::zero;
  119. m_pos_mesh = vec2::zero;
  120. m_pos_speed = vec2::zero;
  121. m_screen_offset = vec2::zero;
  122. m_hist_scale = vec2(.13f, .03f);
  123. m_hist_scale_mesh = vec2(.0f);
  124. m_hist_scale_speed = vec2(.0f);
  125. m_camera = new Camera();
  126. m_camera->SetView(vec3(0.f, 0.f, 10.f), vec3(0.f, 0.f, 0.f), vec3(0.f, 1.f, 0.f));
  127. m_camera->SetProjection(0.f, .0001f, 2000.f, WIDTH * SCREEN_W, RATIO_HW);
  128. m_camera->UseShift(true);
  129. g_scene->PushCamera(m_camera);
  130. //Lights setup
  131. m_lights << new Light();
  132. m_lights.Last()->SetPosition(vec4(4.f, -1.f, -4.f, 0.f));
  133. m_lights.Last()->SetColor(vec4(.0f, .2f, .5f, 1.f));
  134. Ticker::Ref(m_lights.Last());
  135. m_lights << new Light();
  136. m_lights.Last()->SetPosition(vec4(8.f, 2.f, 6.f, 0.f));
  137. m_lights.Last()->SetColor(vec4(1.f, 1.f, 1.f, 1.f));
  138. Ticker::Ref(m_lights.Last());
  139. //stream update
  140. m_stream_update_time = 2.0f;
  141. m_stream_update_timer = 1.0f;
  142. }
  143. ~MeshViewer()
  144. {
  145. if (m_camera)
  146. g_scene->PopCamera(m_camera);
  147. for (int i = 0; i < m_lights.Count(); ++i)
  148. Ticker::Unref(m_lights[i]);
  149. MessageService::Destroy();
  150. }
  151. virtual void TickGame(float seconds)
  152. {
  153. WorldEntity::TickGame(seconds);
  154. if (!m_init && g_scene)
  155. {
  156. Init();
  157. return;
  158. }
  159. if (!m_init)
  160. return;
  161. //TODO : This should probably be "standard LoL behaviour"
  162. #if !__native_client__
  163. {
  164. //Shutdown logic
  165. if (m_controller->GetKey(KEY_ESC).IsReleased())
  166. Ticker::Shutdown();
  167. }
  168. #endif //!__native_client__
  169. //Mesh Change
  170. #if !__native_client__
  171. m_mesh_id = clamp(m_mesh_id + ((int)m_controller->GetKey(KEY_MESH_PREV).IsPressed() - (int)m_controller->GetKey(KEY_MESH_NEXT).IsPressed()), 0, m_meshes.Count() - 1);
  172. #endif //!__native_client__
  173. m_mesh_id1 = damp(m_mesh_id1, (float)m_mesh_id, .2f, seconds);
  174. //Camera update
  175. bool is_pos = false;
  176. bool is_fov = false;
  177. bool is_hsc = false;
  178. vec2 tmp = vec2::zero;
  179. #if !__native_client__
  180. is_pos = m_controller->GetKey(KEY_CAM_POS).IsDown();
  181. is_fov = m_controller->GetKey(KEY_CAM_FOV).IsDown();
  182. tmp = vec2((float)m_controller->GetKey(KEY_CAM_UP ).IsDown() - (float)m_controller->GetKey(KEY_CAM_DOWN).IsDown(),
  183. (float)m_controller->GetKey(KEY_CAM_RIGHT ).IsDown() - (float)m_controller->GetKey(KEY_CAM_LEFT).IsDown());
  184. #endif //!__native_client__
  185. //Base data
  186. vec2 rot = (!is_pos && !is_fov)?(tmp):(vec2(.0f)); rot = vec2(rot.x, rot.y);
  187. vec2 pos = (is_pos && !is_fov)?(tmp):(vec2(.0f)); pos = -vec2(pos.y, pos.x);
  188. vec2 fov = (!is_pos && is_fov)?(tmp):(vec2(.0f)); fov = vec2(-fov.x, fov.y);
  189. vec2 hsc = vec2(0.f);
  190. //speed
  191. m_rot_speed = damp(m_rot_speed, rot * ROT_SPEED, .2f, seconds);
  192. float pos_factor = 1.f / (1.f + m_zoom_mesh * .5f);
  193. m_pos_speed = damp(m_pos_speed, pos * POS_SPEED * pos_factor, .2f, seconds);
  194. float fov_factor = 1.f + lol::pow((m_fov_mesh / FOV_CLAMP) * 1.f, 2.f);
  195. m_fov_speed = damp(m_fov_speed, fov.x * FOV_SPEED * fov_factor, .2f, seconds);
  196. float zom_factor = 1.f + lol::pow((m_zoom_mesh / ZOM_CLAMP) * 1.f, 2.f);
  197. m_zoom_speed = damp(m_zoom_speed, fov.y * ZOM_SPEED * zom_factor, .2f, seconds);
  198. m_hist_scale_speed = damp(m_hist_scale_speed, hsc * HST_SPEED, .2f, seconds);
  199. m_rot += m_rot_speed * seconds;
  200. #if !__native_client__
  201. //Transform update
  202. if (!m_controller->GetKey(KEY_CAM_RESET).IsDown())
  203. {
  204. m_pos += m_pos_speed * seconds;
  205. m_fov += m_fov_speed * seconds;
  206. m_zoom += m_zoom_speed * seconds;
  207. m_hist_scale += m_hist_scale_speed * seconds;
  208. }
  209. #endif //!__native_client__
  210. //clamp
  211. vec2 rot_mesh = vec2(SmoothClamp(m_rot.x, -ROT_CLAMP, ROT_CLAMP, ROT_CLAMP * .1f), m_rot.y);
  212. vec2 pos_mesh = vec2(SmoothClamp(m_pos.x, -POS_CLAMP, POS_CLAMP, POS_CLAMP * .1f),
  213. SmoothClamp(m_pos.y, -POS_CLAMP, POS_CLAMP, POS_CLAMP * .1f));
  214. float fov_mesh = SmoothClamp(m_fov, 0.f, FOV_CLAMP, FOV_CLAMP * .1f);
  215. float zoom_mesh = SmoothClamp(m_zoom, 0.f, ZOM_CLAMP, ZOM_CLAMP * .1f);
  216. vec2 hist_scale_mesh = vec2(SmoothClamp(m_hist_scale.x, 0.f, HST_CLAMP, HST_CLAMP * .1f),
  217. SmoothClamp(m_hist_scale.y, 0.f, HST_CLAMP, HST_CLAMP * .1f));
  218. #if !__native_client__
  219. if (m_controller->GetKey(KEY_CAM_RESET).IsDown())
  220. {
  221. pos_mesh = vec2::zero;
  222. zoom_mesh = 0.f;
  223. }
  224. #endif //!__native_client__
  225. m_rot_mesh = vec2(damp(m_rot_mesh.x, rot_mesh.x, .2f, seconds), damp(m_rot_mesh.y, rot_mesh.y, .2f, seconds));
  226. m_pos_mesh = vec2(damp(m_pos_mesh.x, pos_mesh.x, .2f, seconds), damp(m_pos_mesh.y, pos_mesh.y, .2f, seconds));
  227. m_fov_mesh = damp(m_fov_mesh, fov_mesh, .2f, seconds);
  228. m_zoom_mesh = damp(m_zoom_mesh, zoom_mesh, .2f, seconds);
  229. m_hist_scale_mesh = damp(m_hist_scale_mesh, hist_scale_mesh, .2f, seconds);
  230. //Mesh mat calculation
  231. m_mat = mat4(quat::fromeuler_xyz(vec3(m_rot_mesh, .0f)));
  232. //Target List Setup
  233. Array<vec3> target_list;
  234. if (m_meshes.Count() && m_mesh_id >= 0)
  235. for (int i = 0; i < m_meshes[m_mesh_id]->GetVertexCount(); i++)
  236. target_list << (m_mat * mat4::translate(m_meshes[m_mesh_id]->GetVertexLocation(i))).v3.xyz;
  237. //--
  238. //Update mesh screen location - Get the Min/Max needed
  239. //--
  240. vec2 cam_center(0.f);
  241. float cam_factor = .0f;
  242. vec3 local_min_max[2] = { vec3(FLT_MAX), vec3(-FLT_MAX) };
  243. vec2 screen_min_max[2] = { vec2(FLT_MAX), vec2(-FLT_MAX) };
  244. mat4 world_cam = m_camera->GetView();
  245. mat4 cam_screen = m_camera->GetProjection();
  246. //target on-screen computation
  247. for (int i = 0; i < target_list.Count(); i++)
  248. {
  249. vec3 obj_loc = target_list[i];
  250. {
  251. //Debug::DrawBox(obj_loc - vec3(4.f), obj_loc + vec3(4.f), vec4(1.f, 0.f, 0.f, 1.f));
  252. mat4 target_mx = mat4::translate(obj_loc);
  253. vec3 vpos;
  254. //Get location in cam coordinates
  255. target_mx = world_cam * target_mx;
  256. vpos = target_mx.v3.xyz;
  257. local_min_max[0] = min(vpos.xyz, local_min_max[0]);
  258. local_min_max[1] = max(vpos.xyz, local_min_max[1]);
  259. //Get location in screen coordinates
  260. target_mx = cam_screen * target_mx;
  261. vpos = (target_mx.v3 / target_mx.v3.w).xyz;
  262. screen_min_max[0] = min(screen_min_max[0], vpos.xy * vec2(RATIO_WH, 1.f));
  263. screen_min_max[1] = max(screen_min_max[1], vpos.xy * vec2(RATIO_WH, 1.f));
  264. //Build Barycenter
  265. cam_center += vpos.xy;
  266. cam_factor += 1.f;
  267. }
  268. }
  269. float screen_ratio = max(max(lol::abs(local_min_max[0].x), lol::abs(local_min_max[0].y)),
  270. max(lol::abs(local_min_max[1].x), lol::abs(local_min_max[1].y)));
  271. float scale_ratio = max(max(lol::abs(screen_min_max[0].x), lol::abs(screen_min_max[0].y)),
  272. max(lol::abs(screen_min_max[1].x), lol::abs(screen_min_max[1].y)));
  273. vec2 screen_offset = vec2(0.f, -(screen_min_max[1].y + screen_min_max[0].y) * .5f);
  274. m_screen_offset = damp(m_screen_offset, screen_offset, .9f, seconds);
  275. float z_pos = (inverse(world_cam) * mat4::translate(vec3(0.f, 0.f, max(local_min_max[0].z, local_min_max[1].z)))).v3.z;
  276. if (cam_factor > 0.f)
  277. {
  278. vec2 new_screen_scale = m_camera->GetScreenScale();
  279. m_camera->SetScreenScale(max(vec2(0.001f), new_screen_scale * ((1.0f + m_zoom_mesh) / (scale_ratio * SCREEN_LIMIT))));
  280. m_camera->m_position.z = damp(m_camera->m_position.z, z_pos + screen_ratio * 2.f, .1f, seconds);
  281. m_camera->SetFov(m_fov_mesh);
  282. m_camera->SetScreenInfos(damp(m_camera->GetScreenSize(), max(1.f, screen_ratio), 1.2f, seconds));
  283. }
  284. //--
  285. //Message Service
  286. //--
  287. String mesh("");
  288. int u = 4;
  289. while (u-- > 0 && MessageService::FetchFirst(MSG_IN, mesh))
  290. {
  291. int o = 1;
  292. while (o-- > 0)
  293. {
  294. if (m_mesh_id == m_meshes.Count() - 1)
  295. m_mesh_id++;
  296. //Create a new mesh
  297. EasyMesh* em = new EasyMesh();
  298. if (em->Compile(mesh.C()))
  299. m_meshes.Push(em);
  300. else
  301. delete(em);
  302. }
  303. }
  304. #if __native_client__
  305. if (m_stream_update_time > .0f)
  306. {
  307. m_stream_update_time = -1.f;
  308. MessageService::Send(MSG_IN, "[sc#f8f afcb 1]");
  309. // MessageService::Send(MSG_IN, "[sc#f8f ab 1 splt 4 twy 90]");
  310. // MessageService::Send(MSG_IN, "[sc#8ff afcb 1 1 1 0]");
  311. // MessageService::Send(MSG_IN, "[sc#ff8 afcb 1 1 1 0]");
  312. }
  313. #elif WIN32
  314. //--
  315. //File management
  316. //--
  317. m_stream_update_time += seconds;
  318. if (m_stream_update_time > m_stream_update_timer)
  319. {
  320. m_stream_update_time = 0.f;
  321. File f;
  322. f.Open(m_file_name.C(), FileAccess::Read);
  323. String cmd = f.ReadString();
  324. f.Close();
  325. /*
  326. for (int i = 0; i < cmd.Count() - 1; i++)
  327. {
  328. if (cmd[i] == '/' && cmd[i + 1] == '/')
  329. {
  330. int j = i;
  331. for (; j < cmd.Count(); j++)
  332. {
  333. if (cmd[j] == '\r' || cmd[j] == '\n')
  334. break;
  335. }
  336. String new_cmd = cmd.Sub(0, i);
  337. if (j < cmd.Count())
  338. new_cmd += cmd.Sub(j, cmd.Count() - j);
  339. cmd = new_cmd;
  340. i--;
  341. }
  342. }
  343. */
  344. if (cmd.Count()
  345. && (!m_cmdlist.Count() || cmd != m_cmdlist.Last()))
  346. {
  347. m_cmdlist << cmd;
  348. MessageService::Send(MSG_IN, cmd);
  349. }
  350. }
  351. #endif //WINDOWS
  352. }
  353. virtual void TickDraw(float seconds)
  354. {
  355. WorldEntity::TickDraw(seconds);
  356. if (!m_init)
  357. return;
  358. //TODO : This should probably be "standard LoL behaviour"
  359. #if !__native_client__
  360. {
  361. if (m_controller->GetKey(KEY_F1).IsReleased())
  362. Video::SetDebugRenderMode(DebugRenderMode::Default);
  363. if (m_controller->GetKey(KEY_F2).IsReleased())
  364. Video::SetDebugRenderMode(DebugRenderMode::Wireframe);
  365. if (m_controller->GetKey(KEY_F3).IsReleased())
  366. Video::SetDebugRenderMode(DebugRenderMode::Lighting);
  367. if (m_controller->GetKey(KEY_F4).IsReleased())
  368. Video::SetDebugRenderMode(DebugRenderMode::Normal);
  369. if (m_controller->GetKey(KEY_F5).IsReleased())
  370. Video::SetDebugRenderMode(DebugRenderMode::UV);
  371. }
  372. #endif //!__native_client__
  373. #if !__native_client__
  374. if (!m_default_texture)
  375. {
  376. m_texture_shader = Shader::Create(LOLFX_RESOURCE_NAME(shinymvtexture));
  377. m_texture_uni = m_texture_shader->GetUniformLocation("u_Texture");
  378. m_default_texture = Tiler::Register("data/test-texture.png", ivec2::zero, ivec2(0,1));
  379. }
  380. else if (m_texture && m_default_texture)
  381. m_texture_shader->SetUniform(m_texture_uni, m_default_texture->GetTexture(), 0);
  382. #endif //!__native_client__
  383. g_renderer->SetClearColor(vec4(0.0f, 0.0f, 0.0f, 1.0f));
  384. vec3 x = vec3(1.f,0.f,0.f);
  385. vec3 y = vec3(0.f,1.f,0.f);
  386. for (int i = 0; i < m_meshes.Count(); i++)
  387. {
  388. {
  389. if (m_meshes[i]->GetMeshState() == MeshRender::NeedConvert)
  390. {
  391. #if WITH_TEXTURE
  392. m_meshes[i]->MeshConvert(new DefaultShaderData(((1 << VertexUsage::Position) | (1 << VertexUsage::Normal) |
  393. (1 << VertexUsage::Color) | (1 << VertexUsage::TexCoord)),
  394. m_texture_shader, true));
  395. #else
  396. m_meshes[i]->MeshConvert();
  397. #endif //WITH_TEXTURE
  398. }
  399. mat4 save_proj = m_camera->GetProjection();
  400. float j = -(float)(m_meshes.Count() - (i + 1)) + (-m_mesh_id1 + (float)(m_meshes.Count() - 1));
  401. if (m_mesh_id1 - m_render_max[0] > (float)i && m_mesh_id1 - m_render_max[1] < (float)i &&
  402. m_meshes[i]->GetMeshState() > MeshRender::NeedConvert)
  403. {
  404. float a_j = lol::abs(j);
  405. float i_trans = (a_j * a_j * m_hist_scale_mesh.x + a_j * m_hist_scale_mesh.x) * .5f;
  406. float i_scale = clamp(1.f - (m_hist_scale_mesh.y * (m_mesh_id1 - (float)i)), 0.f, 1.f);
  407. mat4 new_proj =
  408. //Y object Offset
  409. mat4::translate(x * m_screen_offset.x + y * m_screen_offset.y) *
  410. //Mesh Pos Offset
  411. mat4::translate((x * m_pos_mesh.x * RATIO_HW + y * m_pos_mesh.y) * 2.f * (1.f + .5f * m_zoom_mesh / SCREEN_LIMIT)) *
  412. //Mesh count offset
  413. mat4::translate(x * RATIO_HW * 2.f * (j + i_trans)) *
  414. //Align right meshes
  415. mat4::translate(x - x * RATIO_HW) *
  416. //Mesh count scale
  417. mat4::scale(vec3(vec2(i_scale), 1.f)) *
  418. //Camera projection
  419. save_proj;
  420. m_camera->SetProjection(new_proj);
  421. m_meshes[i]->Render(m_mat);
  422. g_renderer->Clear(ClearMask::Depth);
  423. }
  424. m_camera->SetProjection(save_proj);
  425. }
  426. }
  427. }
  428. private:
  429. Array<Light *> m_lights;
  430. Controller *m_controller;
  431. mat4 m_mat;
  432. bool m_init;
  433. //Camera Setup
  434. Camera *m_camera;
  435. float m_fov;
  436. float m_fov_mesh;
  437. float m_fov_speed;
  438. float m_zoom;
  439. float m_zoom_mesh;
  440. float m_zoom_speed;
  441. vec2 m_rot;
  442. vec2 m_rot_mesh;
  443. vec2 m_rot_speed;
  444. vec2 m_pos;
  445. vec2 m_pos_mesh;
  446. vec2 m_pos_speed;
  447. vec2 m_hist_scale;
  448. vec2 m_hist_scale_mesh;
  449. vec2 m_hist_scale_speed;
  450. vec2 m_screen_offset;
  451. //Mesh infos
  452. vec2 m_render_max;
  453. int m_mesh_id;
  454. float m_mesh_id1;
  455. Array<EasyMesh*> m_meshes;
  456. //File data
  457. String m_file_name;
  458. Array<String> m_cmdlist;
  459. float m_stream_update_time;
  460. float m_stream_update_timer;
  461. //misc datas
  462. Shader * m_texture_shader;
  463. TileSet * m_default_texture;
  464. Texture * m_texture;
  465. ShaderUniform m_texture_uni;
  466. Image * m_image;
  467. };
  468. //The basic main :
  469. int main(int argc, char **argv)
  470. {
  471. System::Init(argc, argv);
  472. Application app("MeshViewer", ivec2((int)DEFAULT_WIDTH, (int)DEFAULT_HEIGHT), 60.0f);
  473. if (argc > 1)
  474. new MeshViewer(argv[1]);
  475. else
  476. new MeshViewer();
  477. app.Run();
  478. return EXIT_SUCCESS;
  479. }