Manual_Graphics.h 24 KB

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