Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

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