Manual_Graphics.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  1. // Copyright (c) 2008-2023 the Urho3D project
  2. // License: MIT
  3. #pragma once
  4. #include "../Graphics/AnimatedModel.h"
  5. #include "../Graphics/Animation.h"
  6. #include "../Graphics/AnimationController.h"
  7. #include "../Graphics/AnimationController.h"
  8. #include "../Graphics/AnimationState.h"
  9. #include "../Graphics/Graphics.h"
  10. #include "../Graphics/Material.h"
  11. #include "../Graphics/Model.h"
  12. #include "../Graphics/Octree.h"
  13. #include "../Graphics/ParticleEffect.h"
  14. #include "../Graphics/Renderer.h"
  15. #include "../Graphics/RenderPath.h"
  16. #include "../Graphics/Technique.h"
  17. #include "../GraphicsAPI/GraphicsDefs.h"
  18. #include "../GraphicsAPI/IndexBuffer.h"
  19. #include "../GraphicsAPI/Texture2D.h"
  20. #include "../GraphicsAPI/TextureCube.h"
  21. #include "../GraphicsAPI/VertexBuffer.h"
  22. namespace Urho3D
  23. {
  24. // Vector<RenderTargetInfo> RenderPath::renderTargets_ | File: ../Graphics/RenderPath.h
  25. template <class T> RenderTargetInfo* RenderPath_GetRenderTarget(unsigned index, T* ptr)
  26. {
  27. if (index >= ptr->renderTargets_.Size())
  28. {
  29. asIScriptContext* context = asGetActiveContext();
  30. if (context)
  31. context->SetException("Index out of bounds");
  32. return nullptr;
  33. }
  34. else
  35. return &ptr->renderTargets_[index];
  36. }
  37. // Vector<RenderPathCommand> RenderPath::commands_ | File: ../Graphics/RenderPath.h
  38. template <class T> RenderPathCommand* RenderPath_GetCommand(unsigned index, T* ptr)
  39. {
  40. if (index >= ptr->commands_.Size())
  41. {
  42. asIScriptContext* context = asGetActiveContext();
  43. if (context)
  44. context->SetException("Index out of bounds");
  45. return nullptr;
  46. }
  47. else
  48. return &ptr->commands_[index];
  49. }
  50. #define REGISTER_MEMBERS_MANUAL_PART_RenderPath() \
  51. /* Vector<RenderTargetInfo> RenderPath::renderTargets_ | File: ../Graphics/RenderPath.h */ \
  52. engine->RegisterObjectMethod(className, "const RenderTargetInfo& get_renderTargets(uint) const", AS_FUNCTION_OBJLAST(RenderPath_GetRenderTarget<T>), AS_CALL_CDECL_OBJLAST); \
  53. \
  54. /* Vector<RenderPathCommand> RenderPath::commands_ | File: ../Graphics/RenderPath.h */ \
  55. engine->RegisterObjectMethod(className, "const RenderPathCommand& get_commands(uint) const", AS_FUNCTION_OBJLAST(RenderPath_GetCommand<T>), AS_CALL_CDECL_OBJLAST);
  56. // ========================================================================================
  57. // SharedPtr<Technique> TechniqueEntry::technique_ | File: ../Graphics/Material.h
  58. template <class T> void TechniqueEntry_SetTechnique(Technique* technique, T* ptr)
  59. {
  60. ptr->technique_ = technique;
  61. }
  62. // SharedPtr<Technique> TechniqueEntry::technique_ | File: ../Graphics/Material.h
  63. template <class T> Technique* TechniqueEntry_GetTechnique(T* ptr)
  64. {
  65. return ptr->technique_;
  66. }
  67. #define REGISTER_MEMBERS_MANUAL_PART_TechniqueEntry() \
  68. /* SharedPtr<Technique> TechniqueEntry::technique_ | File: ../Graphics/Material.h */ \
  69. engine->RegisterObjectMethod(className, "void set_technique(Technique@+)", AS_FUNCTION_OBJLAST(TechniqueEntry_SetTechnique<T>), AS_CALL_CDECL_OBJLAST); \
  70. engine->RegisterObjectMethod(className, "Technique@+ get_technique() const", AS_FUNCTION_OBJLAST(TechniqueEntry_GetTechnique<T>), AS_CALL_CDECL_OBJLAST);
  71. // ========================================================================================
  72. extern TechniqueEntry noTechniqueEntry;
  73. template <class T> bool Material_Load_File(File* file, T* ptr)
  74. {
  75. return file && ptr->Resource::Load(*file);
  76. }
  77. // const HashMap<StringHash, MaterialShaderParameter>& Material::GetShaderParameters() const | File: ../Graphics/Material.h
  78. template <class T> CScriptArray* Material_GetShaderParameterNames(T* material)
  79. {
  80. Vector<String> result;
  81. const HashMap<StringHash, MaterialShaderParameter>& parameters = material->GetShaderParameters();
  82. for (HashMap<StringHash, MaterialShaderParameter>::ConstIterator i = parameters.Begin(); i != parameters.End(); ++i)
  83. result.Push(i->second_.name_);
  84. Sort(result.Begin(), result.End());
  85. return VectorToArray<String>(result, "Array<String>");
  86. }
  87. // const TechniqueEntry& Material::GetTechniqueEntry(unsigned index) const | File: ../Graphics/Material.h
  88. template <class T> const TechniqueEntry& Material_GetTechniqueEntry(unsigned index, T* ptr)
  89. {
  90. if (index >= ptr->GetNumTechniques())
  91. {
  92. asGetActiveContext()->SetException("Index out of bounds");
  93. return noTechniqueEntry;
  94. }
  95. return ptr->GetTechniqueEntry(index);
  96. }
  97. #define REGISTER_MEMBERS_MANUAL_PART_Material() \
  98. /* const HashMap<StringHash, MaterialShaderParameter>& Material::GetShaderParameters() const | File: ../Graphics/Material.h */ \
  99. engine->RegisterObjectMethod(className, "Array<String>@ get_shaderParameterNames() const", AS_FUNCTION_OBJLAST(Material_GetShaderParameterNames<T>), AS_CALL_CDECL_OBJLAST); \
  100. \
  101. /* const TechniqueEntry& Material::GetTechniqueEntry(unsigned index) const | File: ../Graphics/Material.h */ \
  102. engine->RegisterObjectMethod(className, "const TechniqueEntry& get_techniqueEntries(uint) const", AS_FUNCTION_OBJLAST(Material_GetTechniqueEntry<T>), AS_CALL_CDECL_OBJLAST);
  103. // ========================================================================================
  104. template <class T> VectorBuffer VertexBuffer_GetData(T* ptr)
  105. {
  106. VectorBuffer ret;
  107. void* data = ptr->Lock(0, ptr->GetVertexCount(), false);
  108. if (data)
  109. {
  110. ret.Write(data, ptr->GetVertexCount() * ptr->GetVertexSize());
  111. ret.Seek(0);
  112. ptr->Unlock();
  113. }
  114. return ret;
  115. }
  116. // bool VertexBuffer::SetData(const void* data) | File: ../GraphicsAPI/VertexBuffer.h
  117. template <class T> bool VertexBuffer_SetData(VectorBuffer& src, T* ptr)
  118. {
  119. // Make sure there is enough data
  120. if (ptr->GetVertexCount() && src.GetSize() >= ptr->GetVertexCount() * ptr->GetVertexSize())
  121. return ptr->SetData(&src.GetBuffer()[0]);
  122. else
  123. return false;
  124. }
  125. // bool VertexBuffer::SetDataRange(const void* data, unsigned start, unsigned count, bool discard = false) | File: ../GraphicsAPI/VertexBuffer.h
  126. template <class T> bool VertexBuffer_SetDataRange(VectorBuffer& src, unsigned start, unsigned count, bool discard, T* ptr)
  127. {
  128. // Make sure there is enough data
  129. if (ptr->GetVertexCount() && src.GetSize() >= count * ptr->GetVertexSize())
  130. return ptr->SetDataRange(&src.GetBuffer()[0], start, count, discard);
  131. else
  132. return false;
  133. }
  134. #define REGISTER_MEMBERS_MANUAL_PART_VertexBuffer() \
  135. engine->RegisterObjectMethod(className, "VectorBuffer GetData() const", AS_FUNCTION_OBJLAST(VertexBuffer_GetData<T>), AS_CALL_CDECL_OBJLAST); \
  136. \
  137. /* bool VertexBuffer::SetData(const void* data) | File: ../GraphicsAPI/VertexBuffer.h */ \
  138. engine->RegisterObjectMethod(className, "bool SetData(VectorBuffer&)", AS_FUNCTION_OBJLAST(VertexBuffer_SetData<T>), AS_CALL_CDECL_OBJLAST); \
  139. \
  140. /* bool VertexBuffer::SetDataRange(const void* data, unsigned start, unsigned count, bool discard = false) | File: ../GraphicsAPI/VertexBuffer.h */ \
  141. engine->RegisterObjectMethod(className, "bool SetDataRange(VectorBuffer&, uint, uint, bool = false)", AS_FUNCTION_OBJLAST(VertexBuffer_SetDataRange<T>), AS_CALL_CDECL_OBJLAST);
  142. // ========================================================================================
  143. template <class T> VectorBuffer IndexBuffer_GetData(T* ptr)
  144. {
  145. VectorBuffer ret;
  146. void* data = ptr->Lock(0, ptr->GetIndexCount(), false);
  147. if (data)
  148. {
  149. ret.Write(data, ptr->GetIndexCount() * ptr->GetIndexSize());
  150. ret.Seek(0);
  151. ptr->Unlock();
  152. }
  153. return ret;
  154. }
  155. // bool IndexBuffer::SetData(const void* data) | File: ../GraphicsAPI/IndexBuffer.h
  156. template <class T> bool IndexBuffer_SetData(VectorBuffer& src, T* ptr)
  157. {
  158. // Make sure there is enough data
  159. if (ptr->GetIndexCount() && src.GetSize() >= ptr->GetIndexCount() * ptr->GetIndexSize())
  160. return ptr->SetData(&src.GetBuffer()[0]);
  161. else
  162. return false;
  163. }
  164. // bool IndexBuffer::SetDataRange(const void* data, unsigned start, unsigned count, bool discard = false) | File: ../GraphicsAPI/IndexBuffer.h
  165. template <class T> bool IndexBuffer_SetDataRange(VectorBuffer& src, unsigned start, unsigned count, bool discard, T* ptr)
  166. {
  167. // Make sure there is enough data
  168. if (ptr->GetIndexCount() && src.GetSize() >= count * ptr->GetIndexSize())
  169. return ptr->SetDataRange(&src.GetBuffer()[0], start, count, discard);
  170. else
  171. return false;
  172. }
  173. #define REGISTER_MEMBERS_MANUAL_PART_IndexBuffer() \
  174. engine->RegisterObjectMethod(className, "VectorBuffer GetData()", AS_FUNCTION_OBJLAST(IndexBuffer_GetData<T>), AS_CALL_CDECL_OBJLAST); \
  175. \
  176. /* bool IndexBuffer::SetData(const void* data) | File: ../GraphicsAPI/IndexBuffer.h */ \
  177. engine->RegisterObjectMethod(className, "bool SetData(VectorBuffer&)", AS_FUNCTION_OBJLAST(IndexBuffer_SetData<T>), AS_CALL_CDECL_OBJLAST); \
  178. \
  179. /* bool IndexBuffer::SetDataRange(const void* data, unsigned start, unsigned count, bool discard = false) | File: ../GraphicsAPI/IndexBuffer.h */ \
  180. engine->RegisterObjectMethod(className, "bool SetDataRange(VectorBuffer&, uint, uint, bool discard = false)", AS_FUNCTION_OBJLAST(IndexBuffer_SetDataRange<T>), AS_CALL_CDECL_OBJLAST);
  181. // ========================================================================================
  182. #define REGISTER_MEMBERS_MANUAL_PART_AnimationTrack() \
  183. /* AnimationKeyFrame* AnimationTrack::GetKeyFrame(unsigned index) | File: ../Graphics/Animation.h */ \
  184. engine->RegisterObjectMethod(className, "const AnimationKeyFrame& get_keyFrames(uint) const", AS_METHOD(T, GetKeyFrame), AS_CALL_THISCALL);
  185. // ========================================================================================
  186. // AnimationTriggerPoint* Animation::GetTrigger(unsigned index) | File: ../Graphics/Animation.h
  187. template <class T> AnimationTriggerPoint* Animation_GetTrigger(unsigned index, T* ptr)
  188. {
  189. if (index >= ptr->GetNumTriggers())
  190. {
  191. asIScriptContext* context = asGetActiveContext();
  192. if (context)
  193. context->SetException("Index out of bounds");
  194. return nullptr;
  195. }
  196. else
  197. return ptr->GetTrigger(index);
  198. }
  199. #define REGISTER_MEMBERS_MANUAL_PART_Animation() \
  200. /* AnimationTriggerPoint* Animation::GetTrigger(unsigned index) | File: ../Graphics/Animation.h */ \
  201. engine->RegisterObjectMethod(className, "const AnimationTriggerPoint& get_triggers(uint) const", AS_FUNCTION_OBJLAST(Animation_GetTrigger<T>), AS_CALL_CDECL_OBJLAST);
  202. // ========================================================================================
  203. #define REGISTER_MEMBERS_MANUAL_PART_CascadeParameters() \
  204. /* Vector4 CascadeParameters::splits_ | File: ../Graphics/Light.h */ \
  205. engine->RegisterObjectProperty(className, "float split1", offsetof(T, splits_.x_)); \
  206. engine->RegisterObjectProperty(className, "float split2", offsetof(T, splits_.y_)); \
  207. engine->RegisterObjectProperty(className, "float split3", offsetof(T, splits_.z_)); \
  208. engine->RegisterObjectProperty(className, "float split4", offsetof(T, splits_.w_));
  209. // ========================================================================================
  210. // void AnimationState::SetBoneWeight(const String& name, float weight, bool recursive = false) | File: ../Graphics/AnimationState.h
  211. template <class T> void AnimationState_SetBoneWeight(const String& name, float weight, T* ptr)
  212. {
  213. ptr->SetBoneWeight(name, weight);
  214. }
  215. #define REGISTER_MEMBERS_MANUAL_PART_AnimationState() \
  216. /* void AnimationState::SetBoneWeight(const String& name, float weight, bool recursive = false) | File: ../Graphics/AnimationState.h */ \
  217. engine->RegisterObjectMethod(className, "void set_boneWeights(const String&in, float)", AS_FUNCTION_OBJLAST(AnimationState_SetBoneWeight<T>), AS_CALL_CDECL_OBJLAST);
  218. // ========================================================================================
  219. // virtual void StaticModel::SetModel(Model* model) | File: ../Graphics/StaticModel.h
  220. template <class T> void StaticModel_SetModel(Model* model, T* ptr)
  221. {
  222. // Check type here to allow operating on both AnimatedModel and StaticModel without calling the wrong function,
  223. // as AnimatedModel can be cast to StaticModel
  224. if (ptr->GetType() == AnimatedModel::GetTypeStatic())
  225. ((AnimatedModel*)ptr)->SetModel(model);
  226. else
  227. ptr->SetModel(model);
  228. }
  229. #define REGISTER_MEMBERS_MANUAL_PART_StaticModel() \
  230. /* virtual void StaticModel::SetModel(Model* model) | File: ../Graphics/StaticModel.h */ \
  231. engine->RegisterObjectMethod(className, "void SetModel(Model@+)", AS_FUNCTION_OBJLAST(StaticModel_SetModel<T>), AS_CALL_CDECL_OBJLAST); \
  232. engine->RegisterObjectMethod(className, "void set_model(Model@+)", AS_FUNCTION_OBJLAST(StaticModel_SetModel<T>), AS_CALL_CDECL_OBJLAST);
  233. // ========================================================================================
  234. // const Vector<ModelMorph>& AnimatedModel::GetMorphs() const | File: ../Graphics/AnimatedModel.h
  235. template <class T> const String& AnimatedModel_GetMorphName(unsigned index, T* ptr)
  236. {
  237. const Vector<ModelMorph>& morphs = ptr->GetMorphs();
  238. return index < morphs.Size() ? morphs[index].name_ : String::EMPTY;
  239. }
  240. // void AnimatedModel::SetModel(Model* model, bool createBones = true) | File: ../Graphics/AnimatedModel.h
  241. template <class T> void AnimatedModel_SetModel(Model* model, T* ptr)
  242. {
  243. ptr->SetModel(model);
  244. }
  245. #define REGISTER_MEMBERS_MANUAL_PART_AnimatedModel() \
  246. /* const Vector<ModelMorph>& AnimatedModel::GetMorphs() const | File: ../Graphics/AnimatedModel.h */ \
  247. engine->RegisterObjectMethod(className, "const String& get_morphNames(uint) const", AS_FUNCTION_OBJLAST(AnimatedModel_GetMorphName<T>), AS_CALL_CDECL_OBJLAST);
  248. // ========================================================================================
  249. // const Vector<AnimationControl>& AnimationController::GetAnimations() const | File: ../Graphics/AnimationController.h
  250. template <class T> unsigned AnimationController_GetNumAnimations(T* controller)
  251. {
  252. return controller->GetAnimations().Size();
  253. }
  254. // const Vector<AnimationControl>& AnimationController::GetAnimations() const | File: ../Graphics/AnimationController.h
  255. template <class T> const AnimationControl* AnimationController_GetAnimation(unsigned index, T* controller)
  256. {
  257. const Vector<AnimationControl>& animations = controller->GetAnimations();
  258. return (index < animations.Size()) ? &animations[index] : nullptr;
  259. }
  260. #define REGISTER_MEMBERS_MANUAL_PART_AnimationController() \
  261. /* const Vector<AnimationControl>& AnimationController::GetAnimations() const | File: ../Graphics/AnimationController.h */ \
  262. engine->RegisterObjectMethod(className, "uint get_numAnimations() const", AS_FUNCTION_OBJLAST(AnimationController_GetNumAnimations<T>), AS_CALL_CDECL_OBJLAST); \
  263. \
  264. /* const Vector<AnimationControl>& AnimationController::GetAnimations() const | File: ../Graphics/AnimationController.h */ \
  265. engine->RegisterObjectMethod(className, "const AnimationControl@ get_animations(uint) const", AS_FUNCTION_OBJLAST(AnimationController_GetAnimation<T>), AS_CALL_CDECL_OBJLAST);
  266. // ========================================================================================
  267. // void Graphics::PrecacheShaders(Deserializer& source) | File: ../Graphics/Graphics.h
  268. template <class T> void Graphics_PrecacheShaders_File(File* file, T* ptr)
  269. {
  270. if (file)
  271. ptr->PrecacheShaders(*file);
  272. }
  273. // void Graphics::PrecacheShaders(Deserializer& source) | File: ../Graphics/Graphics.h
  274. template <class T> void Graphics_PrecacheShaders_VectorBuffer(VectorBuffer& buffer, T* ptr)
  275. {
  276. ptr->PrecacheShaders(buffer);
  277. }
  278. #define REGISTER_MEMBERS_MANUAL_PART_Graphics() \
  279. /* void Graphics::PrecacheShaders(Deserializer& source) | File: ../Graphics/Graphics.h */ \
  280. engine->RegisterObjectMethod(className, "void PrecacheShaders(File@+)", AS_FUNCTION_OBJLAST(Graphics_PrecacheShaders_File<T>), AS_CALL_CDECL_OBJLAST); \
  281. \
  282. /* void Graphics::PrecacheShaders(Deserializer& source) | File: ../Graphics/Graphics.h */ \
  283. engine->RegisterObjectMethod(className, "void PrecacheShaders(VectorBuffer&)", AS_FUNCTION_OBJLAST(Graphics_PrecacheShaders_VectorBuffer<T>), AS_CALL_CDECL_OBJLAST);
  284. // ========================================================================================
  285. // Drawable* RayQueryResult::drawable_ | File: ../Graphics/OctreeQuery.h
  286. template <class T> Drawable* RayQueryResult_GetDrawable(T* ptr)
  287. {
  288. return ptr->drawable_;
  289. }
  290. // Node* RayQueryResult::node_ | File: ../Graphics/OctreeQuery.h
  291. template <class T> Node* RayQueryResult_GetNode(T* ptr)
  292. {
  293. return ptr->node_;
  294. }
  295. #define REGISTER_MEMBERS_MANUAL_PART_RayQueryResult() \
  296. /* Drawable* RayQueryResult::drawable_ | File: ../Graphics/OctreeQuery.h */ \
  297. engine->RegisterObjectMethod(className, "Drawable@+ get_drawable() const", AS_FUNCTION_OBJLAST(RayQueryResult_GetDrawable<T>), AS_CALL_CDECL_OBJLAST); \
  298. \
  299. /* Node* RayQueryResult::node_ | File: ../Graphics/OctreeQuery.h */ \
  300. engine->RegisterObjectMethod(className, "Node@+ get_node() const", AS_FUNCTION_OBJLAST(RayQueryResult_GetNode<T>), AS_CALL_CDECL_OBJLAST);
  301. // ========================================================================================
  302. // void Octree::Raycast(RayOctreeQuery& query) const | File: ../Graphics/Octree.h
  303. template <class T> CScriptArray* Octree_Raycast(const Ray& ray, RayQueryLevel level, float maxDistance, DrawableTypes drawableTypes, unsigned viewMask, Octree* ptr)
  304. {
  305. Vector<RayQueryResult> result;
  306. RayOctreeQuery query(result, ray, level, maxDistance, drawableTypes, viewMask);
  307. ptr->Raycast(query);
  308. return VectorToArray<RayQueryResult>(result, "Array<RayQueryResult>");
  309. }
  310. // void Octree::RaycastSingle(RayOctreeQuery& query) const | File: ../Graphics/Octree.h
  311. template <class T> RayQueryResult Octree_RaycastSingle(const Ray& ray, RayQueryLevel level, float maxDistance, DrawableTypes drawableTypes, unsigned viewMask, Octree* ptr)
  312. {
  313. Vector<RayQueryResult> result;
  314. RayOctreeQuery query(result, ray, level, maxDistance, drawableTypes, viewMask);
  315. ptr->RaycastSingle(query);
  316. if (!query.result_.Empty())
  317. {
  318. return query.result_[0];
  319. }
  320. else
  321. {
  322. RayQueryResult empty;
  323. empty.position_ = Vector3::ZERO;
  324. empty.normal_ = Vector3::ZERO;
  325. empty.distance_ = M_INFINITY;
  326. empty.subObject_ = 0;
  327. return empty;
  328. }
  329. }
  330. // void Octree::GetDrawables(OctreeQuery& query) const | File: ../Graphics/Octree.h
  331. template <class T> CScriptArray* Octree_GetDrawables_Point(const Vector3& point, DrawableTypes drawableTypes, unsigned viewMask, Octree* ptr)
  332. {
  333. Vector<Drawable*> result;
  334. PointOctreeQuery query(result, point, drawableTypes, viewMask);
  335. ptr->GetDrawables(query);
  336. return VectorToHandleArray<Drawable>(result, "Array<Drawable@>");
  337. }
  338. // void Octree::GetDrawables(OctreeQuery& query) const | File: ../Graphics/Octree.h
  339. template <class T> CScriptArray* Octree_GetDrawables_Box(const BoundingBox& box, DrawableTypes drawableTypes, unsigned viewMask, Octree* ptr)
  340. {
  341. Vector<Drawable*> result;
  342. BoxOctreeQuery query(result, box, drawableTypes, viewMask);
  343. ptr->GetDrawables(query);
  344. return VectorToHandleArray<Drawable>(result, "Array<Drawable@>");
  345. }
  346. // void Octree::GetDrawables(OctreeQuery& query) const | File: ../Graphics/Octree.h
  347. template <class T> CScriptArray* Octree_GetDrawables_Frustum(const Frustum& frustum, DrawableTypes drawableTypes, unsigned viewMask, Octree* ptr)
  348. {
  349. Vector<Drawable*> result;
  350. FrustumOctreeQuery query(result, frustum, drawableTypes, viewMask);
  351. ptr->GetDrawables(query);
  352. return VectorToHandleArray<Drawable>(result, "Array<Drawable@>");
  353. }
  354. // void Octree::GetDrawables(OctreeQuery& query) const | File: ../Graphics/Octree.h
  355. template <class T> CScriptArray* Octree_GetDrawables_Sphere(const Sphere& sphere, DrawableTypes drawableTypes, unsigned viewMask, Octree* ptr)
  356. {
  357. Vector<Drawable*> result;
  358. SphereOctreeQuery query(result, sphere, drawableTypes, viewMask);
  359. ptr->GetDrawables(query);
  360. return VectorToHandleArray<Drawable>(result, "Array<Drawable@>");
  361. }
  362. // void Octree::GetDrawables(OctreeQuery& query) const | File: ../Graphics/Octree.h
  363. template <class T> CScriptArray* Octree_GetDrawables_All(DrawableTypes drawableTypes, unsigned viewMask, Octree* ptr)
  364. {
  365. Vector<Drawable*> result;
  366. AllContentOctreeQuery query(result, drawableTypes, viewMask);
  367. ptr->GetDrawables(query);
  368. return VectorToHandleArray<Drawable>(result, "Array<Drawable@>");
  369. }
  370. #define REGISTER_MEMBERS_MANUAL_PART_Octree() \
  371. /* void Octree::Raycast(RayOctreeQuery& query) const | File: ../Graphics/Octree.h */ \
  372. engine->RegisterObjectMethod(className, "Array<RayQueryResult>@ Raycast(const Ray&in, RayQueryLevel = RAY_TRIANGLE, float = M_INFINITY, DrawableTypes = DrawableTypes::Any, uint = DEFAULT_VIEWMASK) const", AS_FUNCTION_OBJLAST(Octree_Raycast<T>), AS_CALL_CDECL_OBJLAST); \
  373. \
  374. /* void Octree::RaycastSingle(RayOctreeQuery& query) const | File: ../Graphics/Octree.h */ \
  375. engine->RegisterObjectMethod(className, "RayQueryResult RaycastSingle(const Ray&in, RayQueryLevel = RAY_TRIANGLE, float = M_INFINITY, DrawableTypes = DrawableTypes::Any, uint = DEFAULT_VIEWMASK) const", AS_FUNCTION_OBJLAST(Octree_RaycastSingle<T>), AS_CALL_CDECL_OBJLAST); \
  376. \
  377. /* void Octree::GetDrawables(OctreeQuery& query) const | File: ../Graphics/Octree.h */ \
  378. engine->RegisterObjectMethod(className, "Array<Drawable@>@ GetDrawables(const Vector3&in, DrawableTypes = DrawableTypes::Any, uint = DEFAULT_VIEWMASK)", AS_FUNCTION_OBJLAST(Octree_GetDrawables_Point<T>), AS_CALL_CDECL_OBJLAST); \
  379. engine->RegisterObjectMethod(className, "Array<Drawable@>@ GetDrawables(const BoundingBox&in, DrawableTypes = DrawableTypes::Any, uint = DEFAULT_VIEWMASK)", AS_FUNCTION_OBJLAST(Octree_GetDrawables_Box<T>), AS_CALL_CDECL_OBJLAST); \
  380. engine->RegisterObjectMethod(className, "Array<Drawable@>@ GetDrawables(const Frustum&in, DrawableTypes = DrawableTypes::Any, uint = DEFAULT_VIEWMASK)", AS_FUNCTION_OBJLAST(Octree_GetDrawables_Frustum<T>), AS_CALL_CDECL_OBJLAST); \
  381. engine->RegisterObjectMethod(className, "Array<Drawable@>@ GetDrawables(const Sphere&in, DrawableTypes = DrawableTypes::Any, uint = DEFAULT_VIEWMASK)", AS_FUNCTION_OBJLAST(Octree_GetDrawables_Sphere<T>), AS_CALL_CDECL_OBJLAST); \
  382. engine->RegisterObjectMethod(className, "Array<Drawable@>@ GetAllDrawables(DrawableTypes = DrawableTypes::Any, uint = DEFAULT_VIEWMASK)", AS_FUNCTION_OBJLAST(Octree_GetDrawables_All<T>), AS_CALL_CDECL_OBJLAST);
  383. // ========================================================================================
  384. // void Renderer::SetVSMShadowParameters(float minVariance, float lightBleedingReduction) | File: ../Graphics/Renderer.h
  385. template <class T> void Renderer_SetVSMShadowParameters(const Vector2& parameters, T* ptr)
  386. {
  387. ptr->SetVSMShadowParameters(parameters.x_, parameters.y_);
  388. }
  389. #define REGISTER_MEMBERS_MANUAL_PART_Renderer() \
  390. /* void Renderer::SetVSMShadowParameters(float minVariance, float lightBleedingReduction) | File: ../Graphics/Renderer.h */ \
  391. engine->RegisterObjectMethod("Renderer", "void set_vsmShadowParameters(const Vector2&in)", AS_FUNCTION_OBJLAST(Renderer_SetVSMShadowParameters<T>), AS_CALL_CDECL_OBJLAST);
  392. }