tool_api.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /*
  2. * Copyright (c) 2012-2020 Daniele Bartolini and individual contributors.
  3. * License: https://github.com/dbartolini/crown/blob/master/LICENSE
  4. */
  5. #include "core/guid.h"
  6. #include "core/strings/string_stream.h"
  7. #include "core/types.h"
  8. #include "world/types.h"
  9. #if CROWN_PLATFORM_WINDOWS
  10. #undef RELATIVE
  11. #undef ABSOLUTE
  12. #endif // CROWN_PLATFORM_WINDOWS
  13. namespace crown
  14. {
  15. namespace tool
  16. {
  17. struct ToolType
  18. {
  19. enum Enum
  20. {
  21. PLACE,
  22. MOVE,
  23. ROTATE,
  24. SCALE
  25. };
  26. };
  27. struct SnapMode
  28. {
  29. enum Enum
  30. {
  31. RELATIVE,
  32. ABSOLUTE
  33. };
  34. };
  35. struct ReferenceSystem
  36. {
  37. enum Enum
  38. {
  39. LOCAL,
  40. WORLD
  41. };
  42. };
  43. const char* lua_bool(const bool b);
  44. void lua_vector2(StringStream& out, const Vector2& v);
  45. void lua_vector3(StringStream& out, const Vector3& v);
  46. void lua_quaternion(StringStream& out, const Quaternion& q);
  47. void device_quit(StringStream& out);
  48. void set_mouse_state(StringStream& out, f32 x, f32 y, bool left, bool middle, bool right);
  49. void mouse_down(StringStream& out, f32 x, f32 y);
  50. void mouse_up(StringStream& out, f32 x, f32 y);
  51. void mouse_wheel(StringStream& out, f32 delta);
  52. void key_down(StringStream& out, const char* key);
  53. void key_up(StringStream& out, const char* key);
  54. void set_grid_size(StringStream& out, f32 size);
  55. void set_rotation_snap(StringStream& out, f32 degrees);
  56. void enable_show_grid(StringStream& out, bool enable);
  57. void enable_snap_to_grid(StringStream& out, bool enable);
  58. void enable_debug_render_world(StringStream& out, bool enable);
  59. void enable_debug_physics_world(StringStream& out, bool enable);
  60. void set_tool_type(StringStream& out, const ToolType::Enum tt);
  61. void set_snap_mode(StringStream& out, const SnapMode::Enum sm);
  62. void set_reference_system(StringStream& out, const ReferenceSystem::Enum rs);
  63. void spawn_unit(StringStream& out
  64. , const Guid& id
  65. , const char* name
  66. , const Vector3& pos
  67. , const Quaternion& rot
  68. , const Vector3& scl
  69. );
  70. void spawn_empty_unit(StringStream& /*out*/, Guid& /*id*/);
  71. void spawn_sound(StringStream& /*out*/
  72. , const Guid& /*id*/
  73. , const char* /*name*/
  74. , const Vector3& /*pos*/
  75. , const Quaternion& /*rot*/
  76. , const f64 /*vol*/
  77. , const bool /*loop*/
  78. );
  79. void add_tranform_component(StringStream& /*out*/
  80. , const Guid& /*id*/
  81. , const Guid& /*component_id*/
  82. , const Vector3& /*pos*/
  83. , const Quaternion& /*rot*/
  84. , const Vector3& /*scl*/
  85. );
  86. void add_mesh_component(StringStream& /*out*/
  87. , const Guid& /*id*/
  88. , const Guid& /*component_id*/
  89. , const char* /*mesh_resource*/
  90. , const char* /*geometry_name*/
  91. , const char* /*material_resource*/
  92. , const bool /*visible*/
  93. );
  94. void add_material_component(StringStream& /*out*/
  95. , const Guid& /*id*/
  96. , const Guid& /*component_id*/
  97. , const char* /*sprite_resource*/
  98. , const char* /*material_resource*/
  99. , const bool /*visible*/
  100. );
  101. void add_camera_content(StringStream& /*out*/
  102. , const Guid& /*id*/
  103. , const Guid& /*component_id*/
  104. , const ProjectionType::Enum /*projection*/
  105. , const f64 /*fov*/
  106. , const f64 /*far_range*/
  107. , const f64 /*near_range*/
  108. );
  109. void add_light_component(StringStream& /*out*/
  110. , const Guid& /*id*/
  111. , const Guid& /*component_id*/
  112. , const LightType::Enum /*type*/
  113. , const f64 /*range*/
  114. , const f64 /*intensity*/
  115. , const f64 /*spot_angle*/
  116. , const Vector3& /*color*/
  117. );
  118. void move_object(StringStream& /*out*/
  119. , const Guid& /*id*/
  120. , const Vector3& /*pos*/
  121. , const Quaternion& /*rot*/
  122. , const Vector3& /*scl*/
  123. );
  124. void set_light(StringStream& /*out*/
  125. , const Guid& /*id*/
  126. , const LightType::Enum /*type*/
  127. , const f64 /*range*/
  128. , const f64 /*intensity*/
  129. , const f64 /*spot_angle*/
  130. , const Vector3& /*color*/
  131. );
  132. void set_sound_range(StringStream& /*out*/
  133. , const Guid& /*id*/
  134. , f64 /*range*/
  135. );
  136. void set_placeable(StringStream& out
  137. , const char* type
  138. , const char* name
  139. );
  140. void selection_set(StringStream& /*out*/, const Array<Guid>& /*ids*/);
  141. void camera_view_perspective(StringStream& out);
  142. void camera_view_front(StringStream& out);
  143. void camera_view_back(StringStream& out);
  144. void camera_view_right(StringStream& out);
  145. void camera_view_left(StringStream& out);
  146. void camera_view_top(StringStream& out);
  147. void camera_view_bottom(StringStream& out);
  148. } // namespace tool
  149. } // namespace crown