Rigs of Rods 2026.01
Soft-body Physics Simulation
Loading...
Searching...
No Matches
OgreAngelscriptWrappers.h
Go to the documentation of this file.
1/*
2 This source file is part of Rigs of Rods
3 Copyright 2005-2012 Pierre-Michel Ricordel
4 Copyright 2007-2012 Thomas Fischer
5 Copyright 2013-2024 Petr Ohlidal
6
7 For more information, see http://www.rigsofrods.org/
8
9 Rigs of Rods is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License version 3, as
11 published by the Free Software Foundation.
12
13 Rigs of Rods is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
20*/
21
27
28#pragma once
29
30#include "Application.h"
31#include "ScriptEngine.h"
32#include "ScriptUtils.h"
33
34#include "scriptarray/scriptarray.h"
35
36#include <OgreRenderOperation.h>
37
38#include <Overlay/OgreOverlaySystem.h>
39#include <Overlay/OgreOverlayManager.h>
40#include <Overlay/OgreOverlay.h>
41#include <Overlay/OgreOverlayContainer.h>
42
44
45using namespace Ogre;
46using namespace AngelScript;
47using namespace RoR;
48
49/***VECTOR3***/
50static void Vector3DefaultConstructor(Vector3* self)
51{
52 new(self) Vector3();
53}
54
55static void Vector3CopyConstructor(const Vector3& other, Vector3* self)
56{
57 new(self) Vector3(other);
58}
59
60static void Vector3InitConstructor(float x, float y, float z, Vector3* self)
61{
62 new(self) Vector3(x, y, z);
63}
64
65static void Vector3InitConstructorScaler(float s, Vector3* self)
66{
67 new(self) Vector3(s, s, s);
68}
69
70/***VECTOR2***/
71static void Vector2DefaultConstructor(Vector2* self)
72{
73 new(self) Vector2();
74}
75
76static void Vector2CopyConstructor(const Vector2& other, Vector2* self)
77{
78 new(self) Vector2(other);
79}
80
81static void Vector2InitConstructor(float x, float y, Vector2* self)
82{
83 new(self) Vector2(x, y);
84}
85
86static void Vector2InitConstructorScaler(float s, Vector2* self)
87{
88 new(self) Vector2(s, s);
89}
90
91
92/***RADIAN***/
93static void RadianDefaultConstructor(Radian* self)
94{
95 new(self) Radian();
96}
97
98static void RadianCopyConstructor(const Radian& other, Radian* self)
99{
100 new(self) Radian(other);
101}
102
103static void RadianInitConstructor(float r, Radian* self)
104{
105 new(self) Radian(r);
106}
107
108static int RadianCmp(const Radian& a, const Radian& b)
109{
110 if (a > b)
111 return 1;
112 else if (a < b)
113 return -1;
114 else
115 return 0;
116}
117
118/***DEGREE***/
119static void DegreeDefaultConstructor(Degree* self)
120{
121 new(self) Degree();
122}
123
124static void DegreeCopyConstructor(const Degree& other, Degree* self)
125{
126 new(self) Degree(other);
127}
128
129static void DegreeInitConstructor(float r, Degree* self)
130{
131 new(self) Degree(r);
132}
133
134static int DegreeCmp(const Degree& a, const Degree& b)
135{
136 if (a > b)
137 return 1;
138 else if (a < b)
139 return -1;
140 else
141 return 0;
142}
143
144/***QUATERNION***/
145static void QuaternionDefaultConstructor(Quaternion* self)
146{
147 new(self) Quaternion();
148}
149
150static void QuaternionCopyConstructor(const Quaternion& other, Quaternion* self)
151{
152 new(self) Quaternion(other.w, other.x, other.y, other.z);
153}
154
155static void QuaternionInitConstructor1(const Radian& rfAngle, const Vector3& rkAxis, Quaternion* self)
156{
157 new(self) Quaternion(rfAngle, rkAxis);
158}
159
160static void QuaternionInitConstructor2(float w, float x, float y, float z, Quaternion* self)
161{
162 new(self) Quaternion(w, x, y, z);
163}
164
165static void QuaternionInitConstructor3(const Vector3& xaxis, const Vector3& yaxis, const Vector3& zaxis, Quaternion* self)
166{
167 new(self) Quaternion(xaxis, yaxis, zaxis);
168}
169
170static void QuaternionInitConstructorScaler(float s, Quaternion* self)
171{
172 new(self) Quaternion(s, s, s, s);
173}
174
175/***COLOURVALUE***/
176static void ColourValueDefaultConstructor(ColourValue* self)
177{
178 new(self) ColourValue();
179}
180
181static void ColourValueInitConstructor(float r, float g, float b, float a, ColourValue* self)
182{
183 new(self) ColourValue(r,g,b,a);
184}
185
186static void ColourValueCopyConstructor(const ColourValue& other, ColourValue* self)
187{
188 new(self) ColourValue(other.r, other.g, other.b, other.a);
189}
190
191/***BOX***/
192static void BoxDefaultConstructor(Box* self)
193{
194 new(self) Box();
195}
196
197static void BoxInitConstructor(asUINT l, asUINT t, asUINT r, asUINT b, Box* self)
198{
199 new(self) Box(l, t, r, b);
200}
201
202static void BoxCopyConstructor(const Box& other, Box* self)
203{
204 new(self) Box(other);
205}
206
207static void BoxDestructor(Box* self)
208{
209 (self)->~Box();
210}
211
212static void BoxAssignOperator(const Box& other, Box* self)
213{
214 (self)->operator=(other);
215}
216
217/***TEXTURE***/
218static void TexturePtrDefaultConstructor(TexturePtr* self)
219{
220 new (self) TexturePtr();
221}
222
223static void TexturePtrCopyConstructor(const TexturePtr& other, TexturePtr* self)
224{
225 new (self) TexturePtr(other);
226}
227
228static void TexturePtrDestructor(TexturePtr* self)
229{
230 (self)->~TexturePtr();
231}
232
233static void TexturePtrAssignOperator(const TexturePtr& other, TexturePtr* self)
234{
235 (self)->operator=(other);
236}
237
238static bool TexturePtrIsNull(TexturePtr* self)
239{
240 return !(self)->operator bool();
241}
242
243// Wrappers are inevitable, see https://www.gamedev.net/forums/topic/540419-custom-smartpointers-and-angelscript-/
244static Ogre::String TexturePtrGetName(TexturePtr const& self)
245{
246 return self->getName();
247}
248
249static Ogre::uint32 TexturePtrGetWidth(TexturePtr const& self)
250{
251 return (asUINT)self->getWidth();
252}
253
254static Ogre::uint32 TexturePtrGetHeight(TexturePtr const& self)
255{
256 return (asUINT)self->getHeight();
257}
258
259static Ogre::uint32 TexturePtrGetNumMipmaps(TexturePtr const& self)
260{
261 return (asUINT)self->getNumMipmaps();
262}
263
264static HardwarePixelBufferSharedPtr TexturePtrGetBuffer(TexturePtr const& self, asUINT face, asUINT mipmap)
265{
266 return self->getBuffer(face, mipmap);
267}
268
269/***TEXTUREMANAGER***/
270// Convenience wrapper to omit optional parameters
271static TexturePtr TextureManagerLoad(TextureManager& mgr, std::string const& file, std::string const& rg)
272{
273 try { return mgr.load(file, rg); }
274 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::TextureManager::load()"); return Ogre::TexturePtr();}
275}
276
277/***HARDWAREPIXELBUFFER***/
278// NOTE: The `*SharedPtr` is a deprecated alias of `*Ptr` in OGRE 14, but it's not yet present in the version we use.
279static void HardwarePixelBufferPtrDefaultConstructor(HardwarePixelBufferSharedPtr* self)
280{
281 new (self) HardwarePixelBufferSharedPtr();
282}
283
284static void HardwarePixelBufferPtrCopyConstructor(const HardwarePixelBufferSharedPtr& other, HardwarePixelBufferSharedPtr* self)
285{
286 new (self) HardwarePixelBufferSharedPtr(other);
287}
288
289static void HardwarePixelBufferPtrDestructor(HardwarePixelBufferSharedPtr* self)
290{
291 (self)->~HardwarePixelBufferSharedPtr();
292}
293
294static void HardwarePixelBufferPtrAssignOperator(const HardwarePixelBufferSharedPtr& other, HardwarePixelBufferSharedPtr* self)
295{
296 (self)->operator=(other);
297}
298
299static PixelBox PIXELBOX_DUMMY = PixelBox(); // for returning as `const&`
300
301static const PixelBox& HardwarePixelBufferPtrGetCurrentLock(HardwarePixelBufferSharedPtr const& self)
302{
303 try { return self->getCurrentLock(); }
304 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::HardwarePixelBuffer::getCurrentLock()"); return PIXELBOX_DUMMY;}
305}
306
307static const PixelBox& HardwarePixelBufferPtrLock(HardwarePixelBufferSharedPtr const& self, const Box& lockbox, HardwareBuffer::LockOptions opt)
308{
309 try { return self->lock(lockbox, opt); }
310 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::HardwarePixelBuffer::lock()"); return PIXELBOX_DUMMY;}
311}
312
313static asUINT HardwarePixelBufferPtrGetWidth(HardwarePixelBufferSharedPtr const& self)
314{
315 try { return self->getWidth(); }
316 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::HardwarePixelBuffer::getWidth()"); return 0;}
317}
318
319static asUINT HardwarePixelBufferPtrGetHeight(HardwarePixelBufferSharedPtr const& self)
320{
321 try { return self->getHeight(); }
322 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::HardwarePixelBuffer::getHeight()"); return 0;}
323}
324
325static void HardwarePixelBufferPtrBlitFromMemory(HardwarePixelBufferSharedPtr const& self, const PixelBox& src, const Box& dstBox)
326{
327 try { self->blitFromMemory(src, dstBox); }
328 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::HardwarePixelBuffer::blitFromMemory()"); }
329}
330
331static void HardwarePixelBufferPtrBlitToMemory(HardwarePixelBufferSharedPtr const& self, const Box& srcBox, const PixelBox& dst)
332{
333 try { self->blitToMemory(srcBox, dst); }
334 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::HardwarePixelBuffer::blitToMemory()"); }
335}
336
337static void HardwarePixelBufferPtrUnlock(HardwarePixelBufferSharedPtr const& self)
338{
339 try { self->unlock(); }
340 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::HardwarePixelBuffer::unlock()"); }
341}
342
343/***PIXELBOX***/
344static void PixelBoxDefaultConstructor(PixelBox* self)
345{
346 new (self) PixelBox();
347}
348
349static void PixelBoxCopyConstructor(const PixelBox& other, PixelBox* self)
350{
351 new (self) PixelBox(other);
352}
353
354static void PixelBoxDestructor(PixelBox* self)
355{
356 (self)->~PixelBox();
357}
358
359static void PixelBoxAssignOperator(const PixelBox& other, PixelBox* self)
360{
361 (self)->operator=(other);
362}
363
364// Inherited methods must have wrappers - see AngelScript doc
365static asUINT PixelBoxGetWidth(const Ogre::PixelBox& self)
366{
367 return self.getWidth();
368}
369
370static asUINT PixelBoxGetHeight(const Ogre::PixelBox& self)
371{
372 return self.getHeight();
373}
374
375static asUINT PixelBoxGetDepth(const Ogre::PixelBox& self)
376{
377 return self.getDepth();
378}
379
380/***IMAGE***/
381static void ImageDefaultConstructor(Image* self)
382{
383 new (self) Image();
384}
385
386static void ImageCopyConstructor(const Image& other, Image* self)
387{
388 new (self) Image(other);
389}
390
391static void ImageDestructor(PixelBox* self)
392{
393 (self)->~PixelBox();
394}
395
396static void ImageAssignOperator(const PixelBox& other, PixelBox* self)
397{
398 (self)->operator=(other);
399}
400
401/***MESH***/
403
404static SubMeshArray* MeshPtrGetSubmeshes(const MeshPtr& self)
405{
406 return new SubMeshArray(self->getSubMeshes());
407}
408
409static void MeshPtrDefaultConstructor(MeshPtr* self)
410{
411 new (self) MeshPtr();
412}
413
414static void MeshPtrCopyConstructor(const MeshPtr& other, MeshPtr* self)
415{
416 new (self) MeshPtr(other);
417}
418
419static void MeshPtrDestructor(MeshPtr* self)
420{
421 (self)->~MeshPtr();
422}
423
424static void MeshPtrAssignOperator(const MeshPtr& other, MeshPtr* self)
425{
426 (self)->operator=(other);
427}
428
429static bool MeshPtrIsNull(MeshPtr* self)
430{
431 return !(self)->operator bool();
432}
433
434// Wrappers are inevitable, see https://www.gamedev.net/forums/topic/540419-custom-smartpointers-and-angelscript-/
435static Ogre::String MeshPtrGetName(MeshPtr const& self)
436{
437 return self->getName();
438}
439
440static Ogre::SubMesh* MeshPtrCreateSubMesh(MeshPtr const& self, const Ogre::String& name)
441{
442 return self->createSubMesh(name);
443}
444
445static void MeshPtrDestroySubMesh(MeshPtr const& self, const Ogre::String& name)
446{
447 self->createSubMesh(name);
448}
449
450/***MESHMANAGER***/
451static MeshPtr MeshManagerLoad(MeshManager& mgr, std::string const& file, std::string const& rg)
452{
453 try { return mgr.load(file, rg); }
454 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::MeshManager::load()"); return Ogre::MeshPtr();}
455}
456
457static void MeshManagerRemove(MeshManager& mgr, std::string const& file, std::string const& rg)
458{
459 try { mgr.remove(file, rg); }
460 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::MeshManager::remove()"); }
461}
462
463/***SUBMESH***/
464static AngelScript::CScriptArray* SubMesh__getVertexPositions(SubMesh* self)
465{
466 VertexData* vertData = (self->useSharedVertices) ? self->parent->sharedVertexData : self->vertexData;
467 if (!vertData)
468 {
469 App::GetScriptEngine()->SLOG("SubMesh::__getVertexPositions(): No vertex data found");
470 return nullptr;
471 }
472 const Ogre::VertexElement* posElem = vertData->vertexDeclaration->findElementBySemantic(Ogre::VES_POSITION);
473 if (!posElem)
474 {
475 App::GetScriptEngine()->SLOG("SubMesh::__getVertexPositions(): No POSITION element found");
476 return nullptr;
477 }
478 Ogre::HardwareVertexBufferSharedPtr vbuf = vertData->vertexBufferBinding->getBuffer(posElem->getSource());
479 if (!vbuf)
480 {
481 App::GetScriptEngine()->SLOG("SubMesh::__getVertexPositions(): No vertex buffer found");
482 return nullptr;
483 }
484 AngelScript::asITypeInfo* typeinfo = App::GetScriptEngine()->getEngine()->GetTypeInfoByDecl("array<vector3>");
485 AngelScript::CScriptArray* arr = AngelScript::CScriptArray::Create(typeinfo, vertData->vertexCount);
486 uint8_t* pStart = static_cast<uint8_t*>(vbuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
487 for (size_t i = 0; i < vertData->vertexCount; i++)
488 {
489 uint8_t* pVert = pStart + (i * vertData->vertexDeclaration->getVertexSize(posElem->getSource()));
490 float* pPos = nullptr;
491 posElem->baseVertexPointerToElement(pVert, &pPos);
492 Vector3 pos(*pPos, *(pPos+1), *(pPos+2));
493 arr->SetValue(i, &pos);
494 }
495 vbuf->unlock();
496 return arr;
497}
498
499static AngelScript::CScriptArray* SubMesh__getVertexTexcoords(SubMesh* self, asUINT index)
500{
501 VertexData* vertData = (self->useSharedVertices) ? self->parent->sharedVertexData : self->vertexData;
502 if (!vertData)
503 {
504 App::GetScriptEngine()->SLOG("SubMesh::__getVertexTexcoords(): No vertex data found");
505 return nullptr;
506 }
507 const Ogre::VertexElement* texcoordElem = vertData->vertexDeclaration->findElementBySemantic(Ogre::VES_TEXTURE_COORDINATES, (unsigned short)index);
508 if (!texcoordElem)
509 {
510 App::GetScriptEngine()->SLOG(fmt::format("SubMesh::__getVertexTexcoords(): TEXCOORD element with index {} not found", index));
511 return nullptr;
512 }
513 Ogre::HardwareVertexBufferSharedPtr vbuf = vertData->vertexBufferBinding->getBuffer(texcoordElem->getSource());
514 if (!vbuf)
515 {
516 App::GetScriptEngine()->SLOG("SubMesh::__getVertexTexcoords(): No vertex buffer found");
517 return nullptr;
518 }
519 AngelScript::asITypeInfo* typeinfo = App::GetScriptEngine()->getEngine()->GetTypeInfoByDecl("array<vector2>");
520 AngelScript::CScriptArray* arr = AngelScript::CScriptArray::Create(typeinfo, vertData->vertexCount);
521 uint8_t* pStart = static_cast<uint8_t*>(vbuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
522 const size_t vertSize = vertData->vertexDeclaration->getVertexSize(texcoordElem->getSource());
523 ROR_ASSERT(texcoordElem->getType() == Ogre::VET_FLOAT2);
524 for (size_t i = 0; i < vertData->vertexCount; i++)
525 {
526 uint8_t* pVert = pStart + ((i + vertData->vertexStart) * vertSize);
527 float* pTexcoord = nullptr;
528 texcoordElem->baseVertexPointerToElement(pVert, &pTexcoord);
529 Vector2 texcoord(*pTexcoord, *(pTexcoord+1));
530 arr->SetValue(i, &texcoord);
531 }
532 vbuf->unlock();
533 return arr;
534}
535
536static Ogre::HardwareIndexBuffer::IndexType SubMesh__getIndexType(SubMesh* self)
537{
538 if (!self->indexData)
539 {
540 App::GetScriptEngine()->SLOG("SubMesh::__getIndexType(): No index data found");
541 return Ogre::HardwareIndexBuffer::IT_16BIT;
542 }
543 Ogre::HardwareIndexBufferSharedPtr ibuf = self->indexData->indexBuffer;
544 if (!ibuf)
545 {
546 App::GetScriptEngine()->SLOG("SubMesh::__getIndexType(): No index buffer found");
547 return Ogre::HardwareIndexBuffer::IT_16BIT;
548 }
549 return ibuf->getType();
550}
551
552static AngelScript::CScriptArray* SubMesh__getIndexBufferHelper(Ogre::SubMesh* self, Ogre::HardwareIndexBuffer::IndexType desiredType)
553{
554 if (!self->indexData)
555 {
556 App::GetScriptEngine()->SLOG("SubMesh::__getIndexBufferHelper(): No index data found");
557 return nullptr;
558 }
559 Ogre::HardwareIndexBufferSharedPtr ibuf = self->indexData->indexBuffer;
560 if (!ibuf)
561 {
562 App::GetScriptEngine()->SLOG("SubMesh::__getIndexBufferHelper(): No index buffer found");
563 return nullptr;
564 }
565 if (ibuf->getType() != desiredType)
566 {
567 App::GetScriptEngine()->SLOG("SubMesh::__getIndexBufferHelper(): Index buffer type mismatch");
568 return nullptr;
569 }
570 AngelScript::asITypeInfo* typeinfo = App::GetScriptEngine()->getEngine()->GetTypeInfoByDecl("array<uint16>");
571 AngelScript::CScriptArray* arr = AngelScript::CScriptArray::Create(typeinfo, self->indexData->indexCount);
572 uint8_t* pStart = static_cast<uint8_t*>(ibuf->lock(Ogre::HardwareBuffer::HBL_READ_ONLY));
573 for (size_t i = self->indexData->indexStart; i < self->indexData->indexCount; i++)
574 {
575 uint8_t* pIndex = pStart + (i * ibuf->getIndexSize());
576 if (ibuf->getType() == Ogre::HardwareIndexBuffer::IT_16BIT)
577 {
578 uint16_t index = *reinterpret_cast<uint16_t*>(pIndex);
579 arr->SetValue(i, &index);
580 }
581 else if (ibuf->getType() == Ogre::HardwareIndexBuffer::IT_32BIT)
582 {
583 uint32_t index = *reinterpret_cast<uint32_t*>(pIndex);
584 arr->SetValue(i, &index);
585 }
586 else
587 {
588 App::GetScriptEngine()->SLOG("SubMesh::__getIndexBufferHelper(): Unknown index buffer type");
589 return nullptr;
590 }
591 }
592 ibuf->unlock();
593 return arr;
594}
595
596static CScriptArray* SubMesh__getIndexBuffer16bit(Ogre::SubMesh* self)
597{
598 const Ogre::HardwareIndexBuffer::IndexType desiredType = Ogre::HardwareIndexBuffer::IndexType::IT_16BIT;
599 if (SubMesh__getIndexType(self) == desiredType) { return SubMesh__getIndexBufferHelper(self, desiredType); }
600 else { App::GetScriptEngine()->SLOG("SubMesh::__getIndexBuffer16bit(): The buffer format isn't 16bit."); return (CScriptArray*)nullptr; }
601}
602
603static CScriptArray* SubMesh__getIndexBuffer32bit(Ogre::SubMesh* self)
604{
605 const Ogre::HardwareIndexBuffer::IndexType desiredType = Ogre::HardwareIndexBuffer::IndexType::IT_32BIT;
606 if (SubMesh__getIndexType(self) == desiredType) { return SubMesh__getIndexBufferHelper(self, desiredType); }
607 else { App::GetScriptEngine()->SLOG("SubMesh::__getIndexBuffer32bit(): The buffer format isn't 32bit."); return (CScriptArray*)nullptr; }
608}
609
610/***NODE***/
612
613static ChildNodeArray* NodeGetChildren(Ogre::Node* self)
614{
615 return new ChildNodeArray(self->getChildren());
616}
617
618static std::string NodeGetUniqueNameMixin(Ogre::Node* self)
619{
620 // Node names are optional and largely unused by RoR, so always append the memory address (libfmt adds the '0x' prefix)
621 return fmt::format("\"{}\" ({})", self->getName(), static_cast<void*>(self));
622}
623
624template <typename T>
625static void NodeSetOrientation(T* self, const Ogre::Quaternion& q)
626{
627 self->setOrientation(q);
628}
629
630/***SCENENODE***/
632
634{
635 return new MovableObjectArray(self->getAttachedObjects());
636}
637
638/***MOVABLEOBJECT***/
639static std::string MovableObjectGetUniqueNameMixin(Ogre::MovableObject* self)
640{
641 // names are optional and largely unused by RoR, so always append the type and memory address (libfmt adds the '0x' prefix)
642 return fmt::format("\"{}\" ({} {})", self->getName(), self->getMovableType(), static_cast<void*>(self));
643}
644
645/***ROOT***/
647
649{
650 return new SceneManagerInstanceDict(self->getSceneManagers());
651}
652
653/***ANIMATIONSTATESET***/
655
657{
658 return new AnimationStateDict(self->getAnimationStates());
659}
660
661/***MATERIAL***/
663
664static TechniqueArray* MaterialPtrGetTechniques(const MaterialPtr& self)
665{
666 return new TechniqueArray(self->getTechniques());
667}
668
669static void MaterialPtrDefaultConstructor(MaterialPtr* self)
670{
671 new (self) MaterialPtr();
672}
673
674static void MaterialPtrCopyConstructor(const MaterialPtr& other, MaterialPtr* self)
675{
676 new (self) MaterialPtr(other);
677}
678
679static void MaterialPtrDestructor(MaterialPtr* self)
680{
681 (self)->~MaterialPtr();
682}
683
684static void MaterialPtrAssignOperator(const MaterialPtr& other, MaterialPtr* self)
685{
686 (self)->operator=(other);
687}
688
689static bool MaterialPtrIsNull(MaterialPtr* self)
690{
691 return !(self)->operator bool();
692}
693
694// Wrappers are inevitable, see https://www.gamedev.net/forums/topic/540419-custom-smartpointers-and-angelscript-/
695static Ogre::String MaterialPtrGetName(MaterialPtr const& self)
696{
697 return self->getName();
698}
699
700static Ogre::Technique* MaterialPtrCreateTechnique(MaterialPtr const& self)
701{
702 try { return self->createTechnique(); }
703 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::Material::createTechnique()"); return (Ogre::Technique*)nullptr;}
704}
705
706static void MaterialPtrRemoveTechnique(MaterialPtr const& self, uint16_t index)
707{
708 try { self->removeTechnique(index); }
709 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::Material::removeTechnique()"); }
710}
711
712/***MATERIALMANAGER***/
713static MaterialPtr MaterialManagerGetByName(MaterialManager& mgr, std::string const& file, std::string const& rg)
714{
715 try { return mgr.getByName(file, rg); }
716 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::MaterialManager::getByName()"); return Ogre::MaterialPtr();}
717}
718
719static MaterialPtr MaterialManagerCreate(MaterialManager& mgr, std::string const& file, std::string const& rg)
720{
721 try { return mgr.create(file, rg); }
722 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::MaterialManager::create()"); return Ogre::MaterialPtr(); }
723}
724
725/***TECHNIQUE***/
727
728static PassArray* TechniqueGetPasses(Technique* self)
729{
730 return new PassArray(self->getPasses());
731}
732
733/***PASS***/
735
737{
738 return new TextureUnitStateArray(self->getTextureUnitStates());
739}
740
741static Ogre::GpuProgramParametersPtr PassGetVertexProgramParameters(Ogre::Pass* self)
742{
743 try { return self->getVertexProgramParameters(); }
744 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::Pass::getVertexProgramParameters()"); return Ogre::GpuProgramParametersPtr(); }
745}
746
747static Ogre::GpuProgramParametersPtr PassGetFragmentProgramParameters(Ogre::Pass* self)
748{
749 try { return self->getFragmentProgramParameters(); }
750 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::Pass::getFragmentProgramParameters()"); return Ogre::GpuProgramParametersPtr(); }
751}
752
753static Ogre::GpuProgramParametersPtr PassGetGeometryProgramParameters(Ogre::Pass* self)
754{
755 try { return self->getGeometryProgramParameters(); }
756 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::Pass::getGeometryProgramParameters()"); return Ogre::GpuProgramParametersPtr(); }
757}
758
759static Ogre::GpuProgramParametersPtr PassGetTessellationHullProgramParameters(Ogre::Pass* self)
760{
761 try { return self->getTessellationHullProgramParameters(); }
762 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::Pass::getTessellationHullProgramParameters()"); return Ogre::GpuProgramParametersPtr(); }
763}
764
765static Ogre::GpuProgramParametersPtr PassGetTessellationDomainProgramParameters(Ogre::Pass* self)
766{
767 try { return self->getTessellationDomainProgramParameters(); }
768 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::Pass::getTessellationDomainProgramParameters()"); return Ogre::GpuProgramParametersPtr(); }
769}
770
771static Ogre::GpuProgramParametersPtr PassGetComputeProgramParameters(Ogre::Pass* self)
772{
773 try { return self->getComputeProgramParameters(); }
774 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::Pass::getComputeProgramParameters()"); return Ogre::GpuProgramParametersPtr(); }
775}
776
777/***SUBENTITY***/
779
781{
782 return new SubEntityArray(self->getSubEntities());
783}
784
785/***TIMER***/
786static void TimerDefaultConstructor(Timer* self)
787{
788 new(self) Timer();
789}
790
791static void TimerDefaultDestructor(Timer* self)
792{
793 self->~Timer();
794}
795
796static void TimerCopyConstructor(const Timer& other, Timer* self)
797{
798 new(self) Timer(other);
799}
800
801static void TimerAssignOperator(const Timer& other, Timer* self)
802{
803 (self)->operator=(other);
804}
805
806/***GPUPROGRAMPARAMETERSPTR***/
807static void GpuProgramParametersPtrDefaultConstructor(GpuProgramParametersPtr* self)
808{
809 new (self) GpuProgramParametersPtr();
810}
811
812static void GpuProgramParametersPtrCopyConstructor(const GpuProgramParametersPtr& other, GpuProgramParametersPtr* self)
813{
814 new (self) GpuProgramParametersPtr(other);
815}
816
817static void GpuProgramParametersPtrDestructor(GpuProgramParametersPtr* self)
818{
819 (self)->~GpuProgramParametersPtr();
820}
821
822static void GpuProgramParametersPtrAssignOperator(const GpuProgramParametersPtr& other, GpuProgramParametersPtr* self)
823{
824 (self)->operator=(other);
825}
826
827static bool GpuProgramParametersPtrIsNull(GpuProgramParametersPtr* self)
828{
829 return !(self)->operator bool();
830}
831
832// Wrappers are inevitable, see https://www.gamedev.net/forums/topic/540419-custom-smartpointers-and-angelscript-/
833
834// > setConstant (scalar)
835static void GpuProgramParametersPtrSetConstantFloat(GpuProgramParametersPtr const& self, asUINT index, float val)
836{
837 try { self->setConstant(index, val); }
838 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::GpuProgramParameters::setConstant(uint, float)"); }
839}
840
841static void GpuProgramParametersPtrSetConstantVector3(GpuProgramParametersPtr const& self, asUINT index, const Ogre::Vector3& val)
842{
843 try { self->setConstant(index, val); }
844 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::GpuProgramParameters::setConstant(uint, vector3)"); }
845}
846
847static void GpuProgramParametersPtrSetConstantVector2(GpuProgramParametersPtr const& self, asUINT index, const Ogre::Vector2& val)
848{
849 try { self->setConstant(index, val); }
850 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::GpuProgramParameters::setConstant(uint, vector2)"); }
851}
852
853static void GpuProgramParametersPtrSetConstantColourValue(GpuProgramParametersPtr const& self, asUINT index, const Ogre::ColourValue& val)
854{
855 try { self->setConstant(index, val); }
856 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::GpuProgramParameters::setConstant(uint, color)"); }
857}
858
859// > setConstant (vector)
860static void GpuProgramParametersPtrSetConstantFloatArray(GpuProgramParametersPtr const& self, asUINT index, CScriptArray* vals)
861{
862 ROR_ASSERT(vals->GetElementTypeId() == App::GetScriptEngine()->getEngine()->GetTypeIdByDecl("float"));
863 try { self->setConstant(index, (float*)vals->GetBuffer(), vals->GetSize()); }
864 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::GpuProgramParameters::setConstant(uint, array<float>)"); }
865}
866
867static void GpuProgramParametersPtrSetConstantVector3Array(GpuProgramParametersPtr const& self, asUINT index, CScriptArray* vals)
868{
869 ROR_ASSERT(vals->GetElementTypeId() == App::GetScriptEngine()->getEngine()->GetTypeIdByDecl("vector3"));
870 try { self->setConstant(index, (float*)vals->GetBuffer(), vals->GetSize()*3); }
871 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::GpuProgramParameters::setConstant(uint, array<vector3>)"); }
872}
873
874static void GpuProgramParametersPtrSetConstantVector2Array(GpuProgramParametersPtr const& self, asUINT index, CScriptArray* vals)
875{
876 ROR_ASSERT(vals->GetElementTypeId() == App::GetScriptEngine()->getEngine()->GetTypeIdByDecl("vector2"));
877 try { self->setConstant(index, (float*)vals->GetBuffer(), vals->GetSize()*2); }
878 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::GpuProgramParameters::setConstant(uint, array<vector2>)"); }
879}
880
881static void GpuProgramParametersPtrSetConstantColourValueArray(GpuProgramParametersPtr const& self, asUINT index, CScriptArray* vals)
882{
883 ROR_ASSERT(vals->GetElementTypeId() == App::GetScriptEngine()->getEngine()->GetTypeIdByDecl("color"));
884 try { self->setConstant(index, (float*)vals->GetBuffer(), vals->GetSize()*4); }
885 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::GpuProgramParameters::setConstant(uint, array<color>)"); }
886}
887
888// > setNamedConstant (scalar)
889static void GpuProgramParametersPtrSetNamedConstantFloat(GpuProgramParametersPtr const& self, const std::string& name, float val)
890{
891 try { self->setNamedConstant(name, val); }
892 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::GpuProgramParameters::setNamedConstant(string, float)"); }
893}
894
895static void GpuProgramParametersPtrSetNamedConstantVector3(GpuProgramParametersPtr const& self, const std::string& name, const Ogre::Vector3& val)
896{
897 try { self->setNamedConstant(name, val); }
898 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::GpuProgramParameters::setNamedConstant(string, vector3)"); }
899}
900
901static void GpuProgramParametersPtrSetNamedConstantVector2(GpuProgramParametersPtr const& self, const std::string& name, const Ogre::Vector2& val)
902{
903 try { self->setNamedConstant(name, val); }
904 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::GpuProgramParameters::setNamedConstant(string, vector2)"); }
905}
906
907static void GpuProgramParametersPtrSetNamedConstantColourValue(GpuProgramParametersPtr const& self, const std::string& name, const Ogre::ColourValue& val)
908{
909 try { self->setNamedConstant(name, val); }
910 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::GpuProgramParameters::setNamedConstant(string, color)"); }
911}
912
913// > setNamedConstant (vector)
914static void GpuProgramParametersPtrSetNamedConstantFloatArray(GpuProgramParametersPtr const& self, const std::string& name, CScriptArray* vals)
915{
916 ROR_ASSERT(vals->GetElementTypeId() == App::GetScriptEngine()->getEngine()->GetTypeIdByDecl("float"));
917 try { self->setNamedConstant(name, (float*)vals->GetBuffer(), vals->GetSize()); }
918 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::GpuProgramParameters::setNamedConstant(string, array<float>)"); }
919}
920
921static void GpuProgramParametersPtrSetNamedConstantVector3Array(GpuProgramParametersPtr const& self, const std::string& name, CScriptArray* vals)
922{
923 ROR_ASSERT(vals->GetElementTypeId() == App::GetScriptEngine()->getEngine()->GetTypeIdByDecl("vector3"));
924 try { self->setNamedConstant(name, (float*)vals->GetBuffer(), vals->GetSize()*3); }
925 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::GpuProgramParameters::setNamedConstant(string, array<vector3>)"); }
926}
927
928static void GpuProgramParametersPtrSetNamedConstantVector2Array(GpuProgramParametersPtr const& self, const std::string& name, CScriptArray* vals)
929{
930 ROR_ASSERT(vals->GetElementTypeId() == App::GetScriptEngine()->getEngine()->GetTypeIdByDecl("vector2"));
931 try { self->setNamedConstant(name, (float*)vals->GetBuffer(), vals->GetSize()*2); }
932 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::GpuProgramParameters::setNamedConstant(string, array<vector2>)"); }
933}
934
935static void GpuProgramParametersPtrSetNamedConstantColourValueArray(GpuProgramParametersPtr const& self, const std::string& name, CScriptArray* vals)
936{
937 ROR_ASSERT(vals->GetElementTypeId() == App::GetScriptEngine()->getEngine()->GetTypeIdByDecl("color"));
938 try { self->setNamedConstant(name, (float*)vals->GetBuffer(), vals->GetSize()*4); }
939 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::GpuProgramParameters::setNamedConstant(string, array<color>)"); }
940}
941
942static CScriptArray* GpuProgramParametersPtr__getNamedConstants(GpuProgramParametersPtr const& self)
943{
944 try {
945 std::vector<std::string> keys;
946 const Ogre::GpuNamedConstants& namedConstants = self->getConstantDefinitions();
947 for (auto& pair : namedConstants.map)
948 keys.push_back(pair.first);
949 return RoR::VectorToScriptArray(keys, "string");
950 }
951 catch (...) {
952 App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::GpuProgramParameters::__getNamedConstants()");
953 return nullptr; }
954}
955
956/***SCENEMANAGER***/
957
958static AngelScript::CScriptArray* SceneManager__getMovableObjectsByType(SceneManager* self, const std::string& typeName)
959{
960 if (!self)
961 {
962 App::GetScriptEngine()->SLOG("SceneManager::__getMovableObjectsByType(): SceneManager is null");
963 return nullptr;
964 }
965
966 try
967 {
968 // Get the iterator
969 SceneManager::MovableObjectIterator it = self->getMovableObjectIterator(typeName);
970
971 // Create script array for MovableObjects
972 AngelScript::asITypeInfo* typeinfo = App::GetScriptEngine()->getEngine()->GetTypeInfoByDecl("array<Ogre::MovableObject@>");
973 if (!typeinfo)
974 {
975 App::GetScriptEngine()->SLOG("SceneManager::__getMovableObjectsByType(): Failed to get array type info");
976 return nullptr;
977 }
978
979 AngelScript::CScriptArray* arr = AngelScript::CScriptArray::Create(typeinfo);
980
981 // Iterate through all movable objects of this type
982 while (it.hasMoreElements())
983 {
984 Ogre::MovableObject* obj = it.getNext();
985 if (obj)
986 {
987 arr->InsertLast(&obj);
988 }
989 }
990
991 return arr;
992 }
993 catch (...)
994 {
995 App::GetScriptEngine()->forwardExceptionAsScriptEvent("SceneManager::__getMovableObjectsByType()");
996 return nullptr;
997 }
998}
999
1000static Ogre::Entity* SceneManagerCreateEntity(Ogre::SceneManager* self, const std::string& entityName, const std::string& meshName, const std::string& meshRG)
1001{
1002 try { return self->createEntity(entityName, meshName, meshRG); }
1003 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::SceneManager::createEntity()"); return nullptr; }
1004}
1005
1006/***OVERLAY***/
1007static void OverlayAdd2D(Ogre::Overlay* self, Ogre::OverlayElement* elem)
1008{
1009 try { self->add2D(dynamic_cast<Ogre::OverlayContainer*>(elem)); }
1010 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::Overlay::add2D()"); }
1011}
1012
1013static void OverlayRemove2D(Ogre::Overlay* self, Ogre::OverlayElement* elem)
1014{
1015 try { self->remove2D(dynamic_cast<Ogre::OverlayContainer*>(elem)); }
1016 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::Overlay::remove2D()"); }
1017}
1018
1019static AngelScript::CScriptArray* get2DElementsHelper(Ogre::Overlay* self)
1020{
1021 try {
1022 const Ogre::Overlay::OverlayContainerList& ocList = self->get2DElements();
1023 AngelScript::asITypeInfo* typeinfo = App::GetScriptEngine()->getEngine()->GetTypeInfoByDecl("array<Ogre::OverlayElement@>");
1024 AngelScript::CScriptArray* arr = AngelScript::CScriptArray::Create(typeinfo);
1025 for (OverlayContainer* oc: ocList)
1026 {
1027 OverlayElement* elem = static_cast<Ogre::OverlayElement*>(oc);
1028 arr->InsertLast(&elem); // TORN HAIR HERE!! Don't forget to pass ref-types as pointer-to-pointer!!
1029 }
1030 return arr;
1031 }
1032 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::Overlay::get2DElements()"); return (CScriptArray*)nullptr; }
1033}
1034
1035/***OVERLAYMANAGER***/
1036static AngelScript::CScriptArray* getElementTemplatesHelper(Ogre::OverlayManager* self)
1037{
1038 try {
1039 auto iterable = self->getTemplateIterator();
1040 // we must cast on the go (unlike get2DElements() this actually returns list of Ogre::OverlayElement*), see ATTENTION! below.
1041 AngelScript::asITypeInfo* typeinfo = App::GetScriptEngine()->getEngine()->GetTypeInfoByDecl("array<Ogre::OverlayElement@>");
1042 AngelScript::CScriptArray* arr = AngelScript::CScriptArray::Create(typeinfo);
1043 for (auto& elem_pair: iterable) {
1044 OverlayElement* elem = static_cast<Ogre::OverlayElement*>(elem_pair.second);
1045 arr->InsertLast(&elem); // TORN HAIR HERE!! Don't forget to pass ref-types as pointer-to-pointer!!
1046 }
1047 return arr; }
1048 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::OverlayManager::getTemplates()"); return (CScriptArray*)nullptr; }
1049}
1050
1051static Ogre::Overlay* OverlayManagerCreate(Ogre::OverlayManager* self, const std::string& name)
1052{
1053 try {return self->create(name);}
1054 catch(...) {App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::OverlayManager::create()"); return (Ogre::Overlay*)nullptr;}
1055}
1056
1057static Ogre::Overlay* OverlayManagerGetByName(Ogre::OverlayManager* self, const std::string& name)
1058{
1059 try {return self->getByName(name);} // Doesn't seem to throw, but just to be sure...
1060 catch(...) {App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::OverlayManager::getByName()"); return (Ogre::Overlay*)nullptr;}
1061}
1062
1063static void OverlayManagerDestroyByName(Ogre::OverlayManager* self, const std::string& name)
1064{
1065 try {return self->destroy(name);}
1066 catch(...) {App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::OverlayManager::destroy(string)"); }
1067}
1068
1069static void OverlayManagerDestroy(Ogre::OverlayManager* self, Ogre::Overlay* ov)
1070{
1071 try {return self->destroy(ov);}
1072 catch(...) {App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::OverlayManager::destroy(Overlay@)"); }
1073}
1074
1075static void OverlayManagerDestroyAll(Ogre::OverlayManager* self)
1076{
1077 try {return self->destroyAll();}
1078 catch(...) {App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::OverlayManager::destroyAll()"); }
1079}
1080
1081// NOTE: we have `getOverlays()` instead of `getOverlayIterator()`
1082static CScriptArray* OverlayManagerGetOverlays(Ogre::OverlayManager* self)
1083{
1084 try {auto iterable = self->getOverlayIterator();
1085 return IterableMapToScriptArray(iterable.begin(), iterable.end(), "Ogre::Overlay@"); }
1086 catch (...) { App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::OverlayManager::getOverlays()"); return (CScriptArray*)nullptr; }
1087}
1088
1089static Ogre::OverlayElement* OverlayManagerCreateOverlayElement(Ogre::OverlayManager* self, const std::string& type, const std::string& name, bool isTemplate)
1090{
1091 try {return dynamic_cast<Ogre::OverlayElement*>(self->createOverlayElement(type,name,isTemplate));}
1092 catch(...) {App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::OverlayManager::createOverlayElement()"); return (Ogre::OverlayElement*)nullptr;}
1093}
1094
1095static Ogre::OverlayElement* OverlayManagerGetOverlayElement(Ogre::OverlayManager* self, const std::string& name)
1096{
1097 try {return dynamic_cast<Ogre::OverlayElement*>(self->getOverlayElement(name));}
1098 catch(...) {App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::OverlayManager::getOverlayElement()"); return (Ogre::OverlayElement*)nullptr;}
1099}
1100
1101static void OverlayManagerDestroyOverlayElementByName(Ogre::OverlayManager* self, const std::string& name, bool isTemplate)
1102{
1103 try { self->destroyOverlayElement(name, isTemplate);}
1104 catch(...) {App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::OverlayManager::destroyOverlayElement(string)"); }
1105}
1106
1107static void OverlayManagerDestroyOverlayElement(Ogre::OverlayManager* self, Ogre::OverlayElement* oe, bool isTemplate)
1108{
1109 try { self->destroyOverlayElement(oe, isTemplate);}
1110 catch(...) {App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::OverlayManager::destroyOverlayElement(OverlayElement@)"); }
1111}
1112
1113static void OverlayManagerDestroyAllOverlayElements(Ogre::OverlayManager* self, bool isTemplate)
1114{
1115 try { self->destroyAllOverlayElements(isTemplate);}
1116 catch(...) {App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::OverlayManager::destroyAllOverlayElements()"); }
1117}
1118
1119static Ogre::OverlayElement* OverlayManagerCreateOverlayElementFromTemplate(Ogre::OverlayManager* self, const std::string& templateName, const std::string& typeName, const std::string& instanceName, bool isTemplate)
1120{
1121 try {return dynamic_cast<Ogre::OverlayElement*>(self->createOverlayElementFromTemplate(templateName, typeName, instanceName, isTemplate));}
1122 catch(...) {App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::OverlayManager::createOverlayElementFromTemplate()"); return (Ogre::OverlayElement*)nullptr;}
1123}
1124
1125static Ogre::OverlayElement* OverlayManagerCloneOverlayElementFromTemplate(Ogre::OverlayManager* self, const std::string& templateName, const std::string& instanceName)
1126{
1127 try {return dynamic_cast<Ogre::OverlayElement*>(self->cloneOverlayElementFromTemplate(templateName, instanceName));}
1128 catch(...) {App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::OverlayManager::cloneOverlayElementFromTemplate()"); return (Ogre::OverlayElement*)nullptr;}
1129}
1130
1131static bool OverlayManagerIsTemplate(Ogre::OverlayManager* self, const std::string& name)
1132{
1133 try {return self->isTemplate(name);}
1134 catch(...) {App::GetScriptEngine()->forwardExceptionAsScriptEvent("Ogre::OverlayManager::isTemplate()"); return false;}
1135}
1136
1137} // namespace OgreAngelscriptWrappers
Central state/object manager and communications hub.
#define ROR_ASSERT(_EXPR)
Definition Application.h:40
void forwardExceptionAsScriptEvent(const std::string &from)
Forwards useful info from C++ try{}catch{} exceptions to script in the form of game event.
void SLOG(const char *msg)
Replacement of macro.
AngelScript::asIScriptEngine * getEngine()
AngelScript::CScriptArray * VectorToScriptArray(const std::vector< T > &vec, const std::string &decl)
Definition ScriptUtils.h:44
AngelScript::CScriptArray * IterableMapToScriptArray(ItorT begin, ItorT end, const std::string &decl)
Definition ScriptUtils.h:80
static void GpuProgramParametersPtrCopyConstructor(const GpuProgramParametersPtr &other, GpuProgramParametersPtr *self)
static TechniqueArray * MaterialPtrGetTechniques(const MaterialPtr &self)
static Ogre::uint32 TexturePtrGetWidth(TexturePtr const &self)
static Ogre::OverlayElement * OverlayManagerCloneOverlayElementFromTemplate(Ogre::OverlayManager *self, const std::string &templateName, const std::string &instanceName)
static void GpuProgramParametersPtrSetConstantFloat(GpuProgramParametersPtr const &self, asUINT index, float val)
static AnimationStateDict * AnimationStateSetGetAnimationStates(AnimationStateSet *self)
static void MeshPtrDefaultConstructor(MeshPtr *self)
static void GpuProgramParametersPtrSetConstantColourValueArray(GpuProgramParametersPtr const &self, asUINT index, CScriptArray *vals)
static Ogre::Technique * MaterialPtrCreateTechnique(MaterialPtr const &self)
static void MaterialPtrAssignOperator(const MaterialPtr &other, MaterialPtr *self)
static void GpuProgramParametersPtrSetConstantVector2Array(GpuProgramParametersPtr const &self, asUINT index, CScriptArray *vals)
static asUINT PixelBoxGetWidth(const Ogre::PixelBox &self)
static void MaterialPtrDestructor(MaterialPtr *self)
static void GpuProgramParametersPtrSetNamedConstantVector3(GpuProgramParametersPtr const &self, const std::string &name, const Ogre::Vector3 &val)
static Ogre::GpuProgramParametersPtr PassGetComputeProgramParameters(Ogre::Pass *self)
static void ImageCopyConstructor(const Image &other, Image *self)
static HardwarePixelBufferSharedPtr TexturePtrGetBuffer(TexturePtr const &self, asUINT face, asUINT mipmap)
static AngelScript::CScriptArray * SubMesh__getVertexTexcoords(SubMesh *self, asUINT index)
static bool OverlayManagerIsTemplate(Ogre::OverlayManager *self, const std::string &name)
static void MeshPtrAssignOperator(const MeshPtr &other, MeshPtr *self)
static void ImageDefaultConstructor(Image *self)
static void MeshPtrCopyConstructor(const MeshPtr &other, MeshPtr *self)
static bool MeshPtrIsNull(MeshPtr *self)
static ChildNodeArray * NodeGetChildren(Ogre::Node *self)
CReadonlyScriptDictView< SceneManager * > SceneManagerInstanceDict
static void BoxDestructor(Box *self)
CReadonlyScriptArrayView< Ogre::TextureUnitState * > TextureUnitStateArray
static void Vector2DefaultConstructor(Vector2 *self)
static Ogre::GpuProgramParametersPtr PassGetGeometryProgramParameters(Ogre::Pass *self)
static asUINT HardwarePixelBufferPtrGetWidth(HardwarePixelBufferSharedPtr const &self)
static SubEntityArray * EntityGetSubEntities(Entity *self)
static void HardwarePixelBufferPtrBlitFromMemory(HardwarePixelBufferSharedPtr const &self, const PixelBox &src, const Box &dstBox)
static void PixelBoxCopyConstructor(const PixelBox &other, PixelBox *self)
static void OverlayAdd2D(Ogre::Overlay *self, Ogre::OverlayElement *elem)
static CScriptArray * SubMesh__getIndexBuffer16bit(Ogre::SubMesh *self)
static Ogre::GpuProgramParametersPtr PassGetTessellationDomainProgramParameters(Ogre::Pass *self)
static void BoxCopyConstructor(const Box &other, Box *self)
CReadonlyScriptArrayView< Ogre::Technique * > TechniqueArray
static void RadianInitConstructor(float r, Radian *self)
static void ImageDestructor(PixelBox *self)
static Ogre::uint32 TexturePtrGetHeight(TexturePtr const &self)
static std::string MovableObjectGetUniqueNameMixin(Ogre::MovableObject *self)
static Ogre::OverlayElement * OverlayManagerCreateOverlayElementFromTemplate(Ogre::OverlayManager *self, const std::string &templateName, const std::string &typeName, const std::string &instanceName, bool isTemplate)
static const PixelBox & HardwarePixelBufferPtrLock(HardwarePixelBufferSharedPtr const &self, const Box &lockbox, HardwareBuffer::LockOptions opt)
static void TimerDefaultConstructor(Timer *self)
static void PixelBoxDestructor(PixelBox *self)
static MovableObjectArray * SceneNodeGetAttachedObjects(SceneNode *self)
static PassArray * TechniqueGetPasses(Technique *self)
static void TexturePtrAssignOperator(const TexturePtr &other, TexturePtr *self)
static void MaterialPtrDefaultConstructor(MaterialPtr *self)
static void MeshPtrDestructor(MeshPtr *self)
static MaterialPtr MaterialManagerCreate(MaterialManager &mgr, std::string const &file, std::string const &rg)
static void GpuProgramParametersPtrSetNamedConstantColourValueArray(GpuProgramParametersPtr const &self, const std::string &name, CScriptArray *vals)
static void GpuProgramParametersPtrSetNamedConstantVector2Array(GpuProgramParametersPtr const &self, const std::string &name, CScriptArray *vals)
CReadonlyScriptArrayView< Ogre::MovableObject * > MovableObjectArray
static int RadianCmp(const Radian &a, const Radian &b)
static void DegreeDefaultConstructor(Degree *self)
CReadonlyScriptArrayView< Ogre::Node * > ChildNodeArray
static void GpuProgramParametersPtrSetConstantVector3(GpuProgramParametersPtr const &self, asUINT index, const Ogre::Vector3 &val)
static void GpuProgramParametersPtrDestructor(GpuProgramParametersPtr *self)
static Ogre::String TexturePtrGetName(TexturePtr const &self)
static AngelScript::CScriptArray * SceneManager__getMovableObjectsByType(SceneManager *self, const std::string &typeName)
static Ogre::String MaterialPtrGetName(MaterialPtr const &self)
static void GpuProgramParametersPtrSetConstantVector2(GpuProgramParametersPtr const &self, asUINT index, const Ogre::Vector2 &val)
static void Vector3InitConstructorScaler(float s, Vector3 *self)
static void Vector2CopyConstructor(const Vector2 &other, Vector2 *self)
static void MeshManagerRemove(MeshManager &mgr, std::string const &file, std::string const &rg)
static void Vector3CopyConstructor(const Vector3 &other, Vector3 *self)
static void OverlayManagerDestroy(Ogre::OverlayManager *self, Ogre::Overlay *ov)
static void GpuProgramParametersPtrSetNamedConstantColourValue(GpuProgramParametersPtr const &self, const std::string &name, const Ogre::ColourValue &val)
static void PixelBoxDefaultConstructor(PixelBox *self)
static void ColourValueDefaultConstructor(ColourValue *self)
static void RadianCopyConstructor(const Radian &other, Radian *self)
static void GpuProgramParametersPtrSetConstantVector3Array(GpuProgramParametersPtr const &self, asUINT index, CScriptArray *vals)
static void ColourValueCopyConstructor(const ColourValue &other, ColourValue *self)
static void TexturePtrDefaultConstructor(TexturePtr *self)
static SceneManagerInstanceDict * RootGetSceneManagers(Root *self)
static void Vector2InitConstructorScaler(float s, Vector2 *self)
static Ogre::GpuProgramParametersPtr PassGetFragmentProgramParameters(Ogre::Pass *self)
CReadonlyScriptArrayView< Ogre::SubEntity * > SubEntityArray
static CScriptArray * OverlayManagerGetOverlays(Ogre::OverlayManager *self)
static void QuaternionInitConstructor1(const Radian &rfAngle, const Vector3 &rkAxis, Quaternion *self)
CReadonlyScriptDictView< AnimationState * > AnimationStateDict
static CScriptArray * SubMesh__getIndexBuffer32bit(Ogre::SubMesh *self)
static void GpuProgramParametersPtrSetNamedConstantFloat(GpuProgramParametersPtr const &self, const std::string &name, float val)
static TextureUnitStateArray * PassGetTextureUnitStates(Pass *self)
static asUINT HardwarePixelBufferPtrGetHeight(HardwarePixelBufferSharedPtr const &self)
CReadonlyScriptArrayView< Ogre::SubMesh * > SubMeshArray
static void ImageAssignOperator(const PixelBox &other, PixelBox *self)
static Ogre::Entity * SceneManagerCreateEntity(Ogre::SceneManager *self, const std::string &entityName, const std::string &meshName, const std::string &meshRG)
static void QuaternionDefaultConstructor(Quaternion *self)
static std::string NodeGetUniqueNameMixin(Ogre::Node *self)
static bool GpuProgramParametersPtrIsNull(GpuProgramParametersPtr *self)
static void GpuProgramParametersPtrSetConstantColourValue(GpuProgramParametersPtr const &self, asUINT index, const Ogre::ColourValue &val)
static void HardwarePixelBufferPtrCopyConstructor(const HardwarePixelBufferSharedPtr &other, HardwarePixelBufferSharedPtr *self)
static void OverlayManagerDestroyAllOverlayElements(Ogre::OverlayManager *self, bool isTemplate)
static void BoxAssignOperator(const Box &other, Box *self)
static void TimerAssignOperator(const Timer &other, Timer *self)
static bool MaterialPtrIsNull(MaterialPtr *self)
static bool TexturePtrIsNull(TexturePtr *self)
static Ogre::uint32 TexturePtrGetNumMipmaps(TexturePtr const &self)
static TexturePtr TextureManagerLoad(TextureManager &mgr, std::string const &file, std::string const &rg)
static void HardwarePixelBufferPtrUnlock(HardwarePixelBufferSharedPtr const &self)
static void TimerDefaultDestructor(Timer *self)
static void OverlayManagerDestroyAll(Ogre::OverlayManager *self)
static void QuaternionInitConstructor3(const Vector3 &xaxis, const Vector3 &yaxis, const Vector3 &zaxis, Quaternion *self)
static void BoxInitConstructor(asUINT l, asUINT t, asUINT r, asUINT b, Box *self)
static void PixelBoxAssignOperator(const PixelBox &other, PixelBox *self)
static void OverlayManagerDestroyOverlayElementByName(Ogre::OverlayManager *self, const std::string &name, bool isTemplate)
static void GpuProgramParametersPtrSetNamedConstantFloatArray(GpuProgramParametersPtr const &self, const std::string &name, CScriptArray *vals)
static AngelScript::CScriptArray * getElementTemplatesHelper(Ogre::OverlayManager *self)
static Ogre::GpuProgramParametersPtr PassGetTessellationHullProgramParameters(Ogre::Pass *self)
static void DegreeInitConstructor(float r, Degree *self)
static Ogre::SubMesh * MeshPtrCreateSubMesh(MeshPtr const &self, const Ogre::String &name)
static void TimerCopyConstructor(const Timer &other, Timer *self)
static void Vector3InitConstructor(float x, float y, float z, Vector3 *self)
static void RadianDefaultConstructor(Radian *self)
static SubMeshArray * MeshPtrGetSubmeshes(const MeshPtr &self)
static Ogre::HardwareIndexBuffer::IndexType SubMesh__getIndexType(SubMesh *self)
static asUINT PixelBoxGetDepth(const Ogre::PixelBox &self)
static void MaterialPtrRemoveTechnique(MaterialPtr const &self, uint16_t index)
static void Vector2InitConstructor(float x, float y, Vector2 *self)
static void HardwarePixelBufferPtrDestructor(HardwarePixelBufferSharedPtr *self)
CReadonlyScriptArrayView< Ogre::Pass * > PassArray
static void HardwarePixelBufferPtrBlitToMemory(HardwarePixelBufferSharedPtr const &self, const Box &srcBox, const PixelBox &dst)
static void Vector3DefaultConstructor(Vector3 *self)
static void ColourValueInitConstructor(float r, float g, float b, float a, ColourValue *self)
static void GpuProgramParametersPtrSetConstantFloatArray(GpuProgramParametersPtr const &self, asUINT index, CScriptArray *vals)
static void HardwarePixelBufferPtrAssignOperator(const HardwarePixelBufferSharedPtr &other, HardwarePixelBufferSharedPtr *self)
static void QuaternionInitConstructor2(float w, float x, float y, float z, Quaternion *self)
static void GpuProgramParametersPtrSetNamedConstantVector3Array(GpuProgramParametersPtr const &self, const std::string &name, CScriptArray *vals)
static MaterialPtr MaterialManagerGetByName(MaterialManager &mgr, std::string const &file, std::string const &rg)
static void BoxDefaultConstructor(Box *self)
static Ogre::OverlayElement * OverlayManagerGetOverlayElement(Ogre::OverlayManager *self, const std::string &name)
static asUINT PixelBoxGetHeight(const Ogre::PixelBox &self)
static AngelScript::CScriptArray * SubMesh__getVertexPositions(SubMesh *self)
static Ogre::String MeshPtrGetName(MeshPtr const &self)
static void HardwarePixelBufferPtrDefaultConstructor(HardwarePixelBufferSharedPtr *self)
static void MaterialPtrCopyConstructor(const MaterialPtr &other, MaterialPtr *self)
static Ogre::GpuProgramParametersPtr PassGetVertexProgramParameters(Ogre::Pass *self)
static Ogre::OverlayElement * OverlayManagerCreateOverlayElement(Ogre::OverlayManager *self, const std::string &type, const std::string &name, bool isTemplate)
static MeshPtr MeshManagerLoad(MeshManager &mgr, std::string const &file, std::string const &rg)
static void OverlayManagerDestroyOverlayElement(Ogre::OverlayManager *self, Ogre::OverlayElement *oe, bool isTemplate)
static AngelScript::CScriptArray * SubMesh__getIndexBufferHelper(Ogre::SubMesh *self, Ogre::HardwareIndexBuffer::IndexType desiredType)
static void GpuProgramParametersPtrDefaultConstructor(GpuProgramParametersPtr *self)
static Ogre::Overlay * OverlayManagerCreate(Ogre::OverlayManager *self, const std::string &name)
static void TexturePtrDestructor(TexturePtr *self)
static void QuaternionCopyConstructor(const Quaternion &other, Quaternion *self)
static void MeshPtrDestroySubMesh(MeshPtr const &self, const Ogre::String &name)
static void OverlayManagerDestroyByName(Ogre::OverlayManager *self, const std::string &name)
static Ogre::Overlay * OverlayManagerGetByName(Ogre::OverlayManager *self, const std::string &name)
static const PixelBox & HardwarePixelBufferPtrGetCurrentLock(HardwarePixelBufferSharedPtr const &self)
static void NodeSetOrientation(T *self, const Ogre::Quaternion &q)
static int DegreeCmp(const Degree &a, const Degree &b)
static CScriptArray * GpuProgramParametersPtr__getNamedConstants(GpuProgramParametersPtr const &self)
static void DegreeCopyConstructor(const Degree &other, Degree *self)
static void TexturePtrCopyConstructor(const TexturePtr &other, TexturePtr *self)
static AngelScript::CScriptArray * get2DElementsHelper(Ogre::Overlay *self)
static void QuaternionInitConstructorScaler(float s, Quaternion *self)
static void GpuProgramParametersPtrSetNamedConstantVector2(GpuProgramParametersPtr const &self, const std::string &name, const Ogre::Vector2 &val)
static void GpuProgramParametersPtrAssignOperator(const GpuProgramParametersPtr &other, GpuProgramParametersPtr *self)
static void OverlayRemove2D(Ogre::Overlay *self, Ogre::OverlayElement *elem)
ScriptEngine * GetScriptEngine()