You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

108 lines
3.3 KiB

  1. //
  2. // BtPhysTest
  3. //
  4. // Copyright: (c) 2009-2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com>
  5. // (c) 2012 Sam Hocevar <sam@hocevar.net>
  6. //
  7. #pragma once
  8. class CatShaderData : public GpuShaderData
  9. {
  10. friend class CRenderer;
  11. public:
  12. //---
  13. CatShaderData(uint32_t vert_decl_flags, Shader* shader);
  14. //---
  15. void SetupDefaultData();
  16. virtual void SetupShaderDatas(mat4 const &model);
  17. //--
  18. virtual lol::String GetInVertexName() { return lol::String("in_vertex"); }
  19. virtual lol::String GetInNormalName() { return lol::String("in_normal"); }
  20. virtual lol::String GetInColorName() { return lol::String("in_color"); }
  21. virtual lol::String GetInTexCoordName() { return lol::String("in_texcoord"); }
  22. TextureUniform m_tex_uniform;
  23. float m_sprite_orientation;
  24. float m_sprite_flip;
  25. };
  26. class BtPhysTest : public WorldEntity
  27. {
  28. public:
  29. BtPhysTest(bool editor = false);
  30. virtual ~BtPhysTest();
  31. char const *GetName() { return "<BtPhysTest>"; }
  32. protected:
  33. virtual void TickGame(float seconds);
  34. virtual void TickDraw(float seconds, Scene &scene);
  35. void InitApp();
  36. private:
  37. //MeshViewerInput ---------------------------------------------------------
  38. struct BtPhysTestKeyInputBase : public StructSafeEnum
  39. {
  40. enum Type
  41. {
  42. KEY_START = 0,
  43. KEY_MOVE_FORWARD = KEY_START,
  44. KEY_MOVE_BACK,
  45. KEY_MOVE_LEFT,
  46. KEY_MOVE_RIGHT,
  47. KEY_MOVE_UP,
  48. KEY_MOVE_DOWN,
  49. KEY_MOVE_JUMP,
  50. KEY_QUIT,
  51. KEY_MAX
  52. };
  53. protected:
  54. virtual bool BuildEnumMap(map<int64_t, String>& enum_map)
  55. {
  56. enum_map[KEY_MOVE_FORWARD] = g_name_key_Up;
  57. enum_map[KEY_MOVE_BACK] = g_name_key_Down;
  58. enum_map[KEY_MOVE_LEFT] = g_name_key_Left;
  59. enum_map[KEY_MOVE_RIGHT] = g_name_key_Right;
  60. enum_map[KEY_MOVE_UP] = g_name_key_PageUp;
  61. enum_map[KEY_MOVE_DOWN] = g_name_key_PageDown;
  62. enum_map[KEY_MOVE_JUMP] = g_name_key_Space;
  63. enum_map[KEY_QUIT] = g_name_key_Escape;
  64. return true;
  65. }
  66. };
  67. typedef SafeEnum<BtPhysTestKeyInputBase> BtPhysTestKeyInput;
  68. TileSet* m_cat_texture;
  69. Shader* m_cat_shader;
  70. CatShaderData* m_cat_sdata;
  71. Camera* m_camera;
  72. Controller* m_controller;
  73. InputProfile m_profile;
  74. Light* m_light1;
  75. Light* m_light2;
  76. int m_init_status;
  77. bool m_ready;
  78. lol::phys::Simulation* m_simulation;
  79. array<EasyConstraint*> m_constraint_list;
  80. array<PhysicsObject*, float> m_physobj_list;
  81. array<PhysicsObject*> m_ground_list;
  82. array<PhysicsObject*> m_platform_list;
  83. array<PhysicsObject*> m_character_list;
  84. array<PhysicsObject*> m_stairs_list;
  85. float m_loop_value;
  86. float m_target_timer;
  87. int m_cam_target;
  88. float m_fov_dp;
  89. float m_loc_dp;
  90. };