Manual_Math.h 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. //
  2. // Copyright (c) 2008-2020 the Urho3D project.
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. #pragma once
  23. #include "../Math/Polyhedron.h"
  24. namespace Urho3D
  25. {
  26. // explicit IntVector2::IntVector2(const int *data) noexcept | File: ../Math/Vector2.h
  27. void ConstructIntVector2ArrayInit(CScriptArray* data, IntVector2* ptr);
  28. // const int* IntVector2::Data() const | File: ../Math/Vector2.h
  29. CScriptArray* IntVector2Data(IntVector2* ptr);
  30. #define REGISTER_MANUAL_PART_IntVector2(T, className) \
  31. /* explicit IntVector2::IntVector2(const int *data) noexcept | File: ../Math/Vector2.h */ \
  32. engine->RegisterObjectBehaviour(className, asBEHAVE_CONSTRUCT, "void f(int[]&)", asFUNCTION(ConstructIntVector2ArrayInit), asCALL_CDECL_OBJLAST); \
  33. /* const int* IntVector2::Data() const | File: ../Math/Vector2.h */ \
  34. engine->RegisterObjectMethod(className, "int[]& get_data() const", asFUNCTION(IntVector2Data), asCALL_CDECL_OBJLAST);
  35. // ========================================================================================
  36. // explicit Vector2::Vector2(const float *data) noexcept | File: ../Math/Vector2.h
  37. void ConstructVector2ArrayInit(CScriptArray* data, Vector2* ptr);
  38. // const float* Vector2::Data() const | File: ../Math/Vector2.h
  39. CScriptArray* Vector2Data(Vector2* ptr);
  40. #define REGISTER_MANUAL_PART_Vector2(T, className) \
  41. /* explicit Vector2::Vector2(const float *data) noexcept | File: ../Math/Vector2.h */ \
  42. engine->RegisterObjectBehaviour(className, asBEHAVE_CONSTRUCT, "void f(float[]&)", asFUNCTION(ConstructVector2ArrayInit), asCALL_CDECL_OBJLAST); \
  43. /* const float* Vector2::Data() const | File: ../Math/Vector2.h */ \
  44. engine->RegisterObjectMethod(className, "float[]& get_data() const", asFUNCTION(Vector2Data), asCALL_CDECL_OBJLAST);
  45. // ========================================================================================
  46. // explicit IntVector3::IntVector3(const int *data) noexcept | File: ../Math/Vector3.h
  47. void ConstructIntVector3ArrayInit(CScriptArray* data, IntVector3* ptr);
  48. // const int* IntVector3::Data() const | File: ../Math/Vector3.h
  49. CScriptArray* IntVector3Data(IntVector3* ptr);
  50. #define REGISTER_MANUAL_PART_IntVector3(T, className) \
  51. /* explicit IntVector3::IntVector3(const int *data) noexcept | File: ../Math/Vector3.h */ \
  52. engine->RegisterObjectBehaviour(className, asBEHAVE_CONSTRUCT, "void f(int[]&)", asFUNCTION(ConstructIntVector3ArrayInit), asCALL_CDECL_OBJLAST); \
  53. /* const int* IntVector3::Data() const | File: ../Math/Vector3.h */ \
  54. engine->RegisterObjectMethod(className, "int[]& get_data() const", asFUNCTION(IntVector3Data), asCALL_CDECL_OBJLAST);
  55. // ========================================================================================
  56. // explicit Vector3::Vector3(const float *data) noexcept | File: ../Math/Vector3.h
  57. void ConstructVector3ArrayInit(CScriptArray* data, Vector3* ptr);
  58. // const float* Vector3::Data() const | File: ../Math/Vector3.h
  59. CScriptArray* Vector3Data(Vector3* ptr);
  60. #define REGISTER_MANUAL_PART_Vector3(T, className) \
  61. /* explicit Vector3::Vector3(const float *data) noexcept | File: ../Math/Vector3.h */ \
  62. engine->RegisterObjectBehaviour(className, asBEHAVE_CONSTRUCT, "void f(float[]&)", asFUNCTION(ConstructVector3ArrayInit), asCALL_CDECL_OBJLAST); \
  63. /* const float* Vector3::Data() const | File: ../Math/Vector3.h */ \
  64. engine->RegisterObjectMethod(className, "float[]& get_data() const", asFUNCTION(Vector3Data), asCALL_CDECL_OBJLAST);
  65. // ========================================================================================
  66. // explicit Vector4::Vector4(const float *data) noexcept | File: ../Math/Vector4.h
  67. void ConstructVector4ArrayInit(CScriptArray* data, Vector4* ptr);
  68. // const float* Vector4::Data() const | File: ../Math/Vector4.h
  69. CScriptArray* Vector4Data(Vector4* ptr);
  70. #define REGISTER_MANUAL_PART_Vector4(T, className) \
  71. /* explicit Vector4::Vector4(const float *data) noexcept | File: ../Math/Vector4.h */ \
  72. engine->RegisterObjectBehaviour(className, asBEHAVE_CONSTRUCT, "void f(float[]&)", asFUNCTION(ConstructVector4ArrayInit), asCALL_CDECL_OBJLAST); \
  73. /* const float* Vector4::Data() const | File: ../Math/Vector4.h */ \
  74. engine->RegisterObjectMethod(className, "float[]& get_data() const", asFUNCTION(Vector4Data), asCALL_CDECL_OBJLAST);
  75. // ========================================================================================
  76. // explicit IntRect::IntRect(const int *data) noexcept | File: ../Math/Rect.h
  77. void ConstructIntRectArrayInit(CScriptArray* data, IntRect* ptr);
  78. // const int* IntRect::Data() const | File: ../Math/Rect.h
  79. CScriptArray* IntRectData(IntRect* ptr);
  80. #define REGISTER_MANUAL_PART_IntRect(T, className) \
  81. /* explicit IntRect::IntRect(const int *data) noexcept | File: ../Math/Rect.h */ \
  82. engine->RegisterObjectBehaviour(className, asBEHAVE_CONSTRUCT, "void f(int[]&)", asFUNCTION(ConstructIntRectArrayInit), asCALL_CDECL_OBJLAST); \
  83. /* const int* IntRect::Data() const | File: ../Math/Rect.h */ \
  84. engine->RegisterObjectMethod(className, "int[]& get_data() const", asFUNCTION(IntRectData), asCALL_CDECL_OBJLAST);
  85. // ========================================================================================
  86. // explicit Color::Color(const float *data) noexcept | File: ../Math/Color.h
  87. void ConstructColorArrayInit(CScriptArray* data, Color* ptr);
  88. // const float* Color::Data() const | File: ../Math/Color.h
  89. CScriptArray* ColorData(Color* ptr);
  90. #define REGISTER_MANUAL_PART_Color(T, className) \
  91. /* explicit Color::Color(const float *data) noexcept | File: ../Math/Color.h */ \
  92. engine->RegisterObjectBehaviour(className, asBEHAVE_CONSTRUCT, "void f(float[]&)", asFUNCTION(ConstructColorArrayInit), asCALL_CDECL_OBJLAST); \
  93. /* const float* Color::Data() const | File: ../Math/Color.h */ \
  94. engine->RegisterObjectMethod(className, "float[]& get_data() const", asFUNCTION(ColorData), asCALL_CDECL_OBJLAST);
  95. // ========================================================================================
  96. #define REGISTER_MANUAL_PART_Ray(T, className) \
  97. /* float Ray::HitDistance(const Vector3 &v0, const Vector3 &v1, const Vector3 &v2, Vector3 *outNormal=nullptr, Vector3 *outBary=nullptr) const | File: ../Math/Ray.h */ \
  98. engine->RegisterObjectMethod(className, "float HitDistance(const Vector3&in, const Vector3&in, const Vector3&in) const", asMETHODPR(T, HitDistance, (const Vector3&, const Vector3&, const Vector3&, Vector3*, Vector3*) const, float), asCALL_THISCALL);
  99. // ========================================================================================
  100. // Vector3 Frustum::vertices_[NUM_FRUSTUM_VERTICES] | File: ../Math/Frustum.h
  101. Vector3 FrustumGetVertex(unsigned index, Frustum* ptr);
  102. #define REGISTER_MANUAL_PART_Frustum(T, className) \
  103. /* Vector3 Frustum::vertices_[NUM_FRUSTUM_VERTICES] | File: ../Math/Frustum.h */ \
  104. engine->RegisterObjectMethod(className, "Vector3 get_vertices(uint) const", asFUNCTION(FrustumGetVertex), asCALL_CDECL_OBJLAST);
  105. // ========================================================================================
  106. // Vector<PODVector<Vector3> > Polyhedron::faces_ | File: ../Math/Polyhedron.h
  107. unsigned PolyhedronGetNumFaces(Polyhedron* ptr);
  108. // Vector<PODVector<Vector3> > Polyhedron::faces_ | File: ../Math/Polyhedron.h
  109. CScriptArray* PolyhedronGetFace(unsigned index, Polyhedron* ptr);
  110. #define REGISTER_MANUAL_PART_Polyhedron(T, className) \
  111. /* Vector<PODVector<Vector3> > Polyhedron::faces_ | File: ../Math/Polyhedron.h */ \
  112. engine->RegisterObjectMethod(className, "uint get_numFaces() const", asFUNCTION(PolyhedronGetNumFaces), asCALL_CDECL_OBJLAST); \
  113. /* Vector<PODVector<Vector3> > Polyhedron::faces_ | File: ../Math/Polyhedron.h */ \
  114. engine->RegisterObjectMethod(className, "Array<Vector3>@ get_face(uint) const", asFUNCTION(PolyhedronGetFace), asCALL_CDECL_OBJLAST);
  115. }