Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

btphystest.h 3.6 KiB

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