Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

116 linhas
3.6 KiB

  1. //
  2. // Lol Engine — Bullet physics test
  3. //
  4. // Copyright © 2009—2013 Benjamin “Touky” Huet <huet.benjamin@gmail.com>
  5. // © 2012—2018 Sam Hocevar <sam@hocevar.net>
  6. //
  7. // Lol Engine is free software. It comes without any warranty, to
  8. // the extent permitted by applicable law. You can redistribute it
  9. // and/or modify it under the terms of the Do What the Fuck You Want
  10. // to Public License, Version 2, as published by the WTFPL Task Force.
  11. // See http://www.wtfpl.net/ for more details.
  12. //
  13. #pragma once
  14. #include <string>
  15. class CatShaderData : public GpuShaderData
  16. {
  17. friend class CRenderer;
  18. public:
  19. //---
  20. CatShaderData(uint32_t vert_decl_flags, Shader* shader);
  21. //---
  22. void SetupDefaultData();
  23. virtual void SetupShaderDatas(mat4 const &model);
  24. //--
  25. virtual std::string GetInVertexName() { return "in_vertex"; }
  26. virtual std::string GetInNormalName() { return "in_normal"; }
  27. virtual std::string GetInColorName() { return "in_color"; }
  28. virtual std::string GetInTexCoordName() { return "in_texcoord"; }
  29. TextureUniform m_tex_uniform;
  30. float m_sprite_orientation;
  31. float m_sprite_flip;
  32. };
  33. class BtPhysTest : public WorldEntity
  34. {
  35. public:
  36. BtPhysTest(bool editor = false);
  37. virtual ~BtPhysTest();
  38. char const *GetName() { return "<BtPhysTest>"; }
  39. protected:
  40. virtual void TickGame(float seconds);
  41. virtual void TickDraw(float seconds, Scene &scene);
  42. void InitApp();
  43. private:
  44. //MeshViewerInput ---------------------------------------------------------
  45. struct BtPhysTestKeyInputBase : public StructSafeEnum
  46. {
  47. enum Type
  48. {
  49. KEY_START = 0,
  50. KEY_MOVE_FORWARD = KEY_START,
  51. KEY_MOVE_BACK,
  52. KEY_MOVE_LEFT,
  53. KEY_MOVE_RIGHT,
  54. KEY_MOVE_UP,
  55. KEY_MOVE_DOWN,
  56. KEY_MOVE_JUMP,
  57. KEY_QUIT,
  58. KEY_MAX
  59. };
  60. protected:
  61. virtual bool BuildEnumMap(map<int64_t, std::string>& enum_map)
  62. {
  63. enum_map[KEY_MOVE_FORWARD] = g_name_key_Up;
  64. enum_map[KEY_MOVE_BACK] = g_name_key_Down;
  65. enum_map[KEY_MOVE_LEFT] = g_name_key_Left;
  66. enum_map[KEY_MOVE_RIGHT] = g_name_key_Right;
  67. enum_map[KEY_MOVE_UP] = g_name_key_PageUp;
  68. enum_map[KEY_MOVE_DOWN] = g_name_key_PageDown;
  69. enum_map[KEY_MOVE_JUMP] = g_name_key_Space;
  70. enum_map[KEY_QUIT] = g_name_key_Escape;
  71. return true;
  72. }
  73. };
  74. typedef SafeEnum<BtPhysTestKeyInputBase> BtPhysTestKeyInput;
  75. TileSet* m_cat_texture;
  76. Shader* m_cat_shader;
  77. CatShaderData* m_cat_sdata;
  78. Camera* m_camera;
  79. Controller* m_controller;
  80. InputProfile m_profile;
  81. Light* m_light1;
  82. Light* m_light2;
  83. int m_init_status;
  84. bool m_ready;
  85. lol::phys::Simulation* m_simulation;
  86. array<EasyConstraint*> m_constraint_list;
  87. array<PhysicsObject*, float> m_physobj_list;
  88. array<PhysicsObject*> m_ground_list;
  89. array<PhysicsObject*> m_platform_list;
  90. array<PhysicsObject*> m_character_list;
  91. array<PhysicsObject*> m_stairs_list;
  92. float m_loop_value;
  93. float m_target_timer;
  94. int m_cam_target;
  95. float m_fov_dp;
  96. float m_loc_dp;
  97. };