76 int axe = MTOP(MMpull(m));
80 if ((n == NIL) || (rot == NIL) || (rep == NIL) || (axe == NIL))
86 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
93 int x = MMfetch(m, axe, 0);
94 int y = MMfetch(m, axe, 1);
95 int z = MMfetch(m, axe, 2);
97 if ((x == NIL) || (y == NIL) || (z == NIL))
103 node->Rotate(Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z)), MTOF(rot),
static_cast<SNode::NodeTransformSpace
> (MTOI(rep)));
105 MMset(m, 0, ITOM(1));
122 MMechostr(MSKDEBUG,
"SO3ObjectShowBoundingBox\n");
128 if ((i == NIL) || (n == NIL))
134 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
141 if (node->GetNodeType() == SNode::BONE_TYPE_ID)
148 node->SetShowBoundingBox(
false);
150 node->SetShowBoundingBox(
true);
152 MMset(m, 0, ITOM(1));
176 MMechostr(MSKDEBUG,
"SO3ObjectSetDirection\n");
180 int vec = MTOP(MMpull(m));
183 if ((n == NIL) || (vec == NIL) || (rep == NIL))
189 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
197 if (node->GetNodeType() == SNode::BONE_TYPE_ID)
203 int x = MMfetch(m, vec, 0);
204 int y = MMfetch(m, vec, 1);
205 int z = MMfetch(m, vec, 2);
207 if ((x == NIL) || (y == NIL) || (z == NIL))
213 node->SetDirection(Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z)),
static_cast <SNode::NodeTransformSpace
> (MTOI(rep)), Ogre::Vector3::NEGATIVE_UNIT_Z);
215 MMset(m, 0, ITOM(1));
232 MMechostr(MSKDEBUG,
"SO3ObjectGetDirection\n");
235 int obj = MMget(m, 0);
242 SNode* node = MMgetPointer<SNode*>(m, MTOP(obj));
249 Ogre::Vector3 dirvec(node->GetDirection());
250 int tuple = MMmalloc(m, 3, TYPETAB);
257 MMstore(m, tuple, 0, FTOM((dirvec.x)));
258 MMstore(m, tuple, 1, FTOM((dirvec.y)));
259 MMstore(m, tuple, 2, FTOM((dirvec.z)));
260 MMset(m, 0, PTOM(tuple));
277 MMechostr(MSKDEBUG,
"SO3ObjectGetDerivedDirection\n");
280 int obj = MMget(m, 0);
287 SNode* node = MMgetPointer<SNode*>(m, MTOP(obj));
294 Ogre::Vector3 dirvec(node->GetDirection(
true));
295 int tuple = MMmalloc(m, 3, TYPETAB);
302 MMstore(m, tuple, 0, FTOM((dirvec.x)));
303 MMstore(m, tuple, 1, FTOM((dirvec.y)));
304 MMstore(m, tuple, 2, FTOM((dirvec.z)));
305 MMset(m, 0, PTOM(tuple));
322 MMechostr(MSKDEBUG,
"SO3ObjectGetDirectionAxis\n");
325 int vec = MTOP(MMpull(m));
326 int obj = MMget(m, 0);
327 if ((obj == NIL) || (vec == NIL))
333 SNode* node = MMgetPointer<SNode*>(m, MTOP(obj));
340 int x = MMfetch(m, vec, 0);
341 int y = MMfetch(m, vec, 1);
342 int z = MMfetch(m, vec, 2);
344 if ((x == NIL) || (y == NIL) || (z == NIL))
349 Ogre::Vector3 axis(MTOF(x), MTOF(y), MTOF(z));
351 Ogre::Vector3 dirvec(node->GetDirection(
false, axis));
352 int tuple = MMmalloc(m, 3, TYPETAB);
359 MMstore(m, tuple, 0, FTOM((dirvec.x)));
360 MMstore(m, tuple, 1, FTOM((dirvec.y)));
361 MMstore(m, tuple, 2, FTOM((dirvec.z)));
362 MMset(m, 0, PTOM(tuple));
379 MMechostr(MSKDEBUG,
"SO3ObjectGetDerivedDirectionAxis\n");
382 int vec = MTOP(MMpull(m));
383 int obj = MMget(m, 0);
384 if ((obj == NIL) || (vec == NIL))
390 SNode* node = MMgetPointer<SNode*>(m, MTOP(obj));
397 int x = MMfetch(m, vec, 0);
398 int y = MMfetch(m, vec, 1);
399 int z = MMfetch(m, vec, 2);
401 if ((x == NIL) || (y == NIL) || (z == NIL))
406 Ogre::Vector3 axis(MTOF(x), MTOF(y), MTOF(z));
408 Ogre::Vector3 dirvec(node->GetDirection(
true, axis));
409 int tuple = MMmalloc(m, 3, TYPETAB);
416 MMstore(m, tuple, 0, FTOM((dirvec.x)));
417 MMstore(m, tuple, 1, FTOM((dirvec.y)));
418 MMstore(m, tuple, 2, FTOM((dirvec.z)));
419 MMset(m, 0, PTOM(tuple));
443 MMechostr(MSKDEBUG,
"SO3ObjectLookAt\n");
447 int vec = MTOP(MMpull(m));
450 if ((n == NIL) || (vec == NIL) || (rep == NIL))
456 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
463 if (node->GetNodeType() == SNode::BONE_TYPE_ID)
469 int x = MMfetch(m, vec, 0);
470 int y = MMfetch(m, vec, 1);
471 int z = MMfetch(m, vec, 2);
473 if ((x == NIL) || (y == NIL) || (z == NIL))
479 node->LookAt(Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z)),
static_cast <SNode::NodeTransformSpace
> (MTOI(rep)), Ogre::Vector3::NEGATIVE_UNIT_Z);
480 MMset(m, 0, ITOM(1));
499 MMechostr(MSKDEBUG,
"SO3ObjectSetVisible\n");
506 if ((n == NIL) || (c == NIL) || (v == NIL))
512 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
525 bool bvisible =
false;
526 bool brecursive =
false;
534 node->SetVisible(bvisible, brecursive);
536 MMset(m, 0, ITOM(1));
553 MMechostr(MSKDEBUG,
"SO3ObjectGetVisible\n");
564 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
577 bool result = node->GetVisible();
580 MMset(m, 0, ITOM(1));
582 MMset(m, 0, ITOM(0));
599 MMechostr(MSKDEBUG,
"SO3ObjectGetName\n");
609 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
616 return Mpushstrbloc(m, (
char*)(node->GetName().c_str()));
632 MMechostr(MSKDEBUG,
"SO3ObjectSetOrientation\n");
635 int q = MTOP(MMpull(m));
638 if ((n == NIL) || (q == NIL))
644 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
651 int x = MMfetch(m, q, 0);
652 int y = MMfetch(m, q, 1);
653 int z = MMfetch(m, q, 2);
654 int w = MMfetch(m, q, 3);
656 if ((x == NIL) || (y == NIL) || (z == NIL) || (
w == NIL))
662 Ogre::Quaternion quat = Ogre::Quaternion(MTOF(
w), MTOF(x), MTOF(y), MTOF(z));
665 node->SetOrientation(quat);
667 MMset(m, 0, ITOM(1));
684 MMechostr(MSKDEBUG,
"SO3ObjectAddOrientation\n");
687 int q = MTOP(MMpull(m));
690 if ((n == NIL) || (q == NIL))
696 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
703 int x = MMfetch(m, q, 0);
704 int y = MMfetch(m, q, 1);
705 int z = MMfetch(m, q, 2);
706 int w = MMfetch(m, q, 3);
708 if ((x == NIL) || (y == NIL) || (z == NIL) || (
w == NIL))
714 Ogre::Quaternion quat = Ogre::Quaternion(MTOF(
w), MTOF(x), MTOF(y), MTOF(z));
716 node->AddOrientation(quat);
718 MMset(m, 0, ITOM(1));
734 MMechostr(MSKDEBUG,
"SO3ObjectResetToInitialOrientation\n");
745 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
752 node->ResetToInitialOrientation();
754 MMset(m, 0, ITOM(1));
772 MMechostr(MSKDEBUG,
"SO3ObjectSetPosition\n");
775 int vec = MTOP(MMpull(m));
778 if ((n == NIL) || (vec == NIL))
784 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
791 int x = MMfetch(m, vec, 0);
792 int y = MMfetch(m, vec, 1);
793 int z = MMfetch(m, vec, 2);
795 if ((x == NIL) || (y == NIL) || (z == NIL))
801 node->SetPosition(Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z)));
802 MMset(m, 0, ITOM(1));
826 MMechostr(MSKDEBUG,
"SO3ObjectTranslate\n");
830 int vec = MTOP(MMpull(m));
833 if ((n == NIL) || (vec == NIL) || (rep == NIL))
839 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
842 MMechostr(MSKDEBUG,
"SO3ObjectTranslate Node is NULL\n");
847 int x = MMfetch(m, vec, 0);
848 int y = MMfetch(m, vec, 1);
849 int z = MMfetch(m, vec, 2);
851 if ((x == NIL) || (y == NIL) || (z == NIL))
858 if ((MTOF(x) == 0.0) && (MTOF(y) == 0.0) && (MTOF(z) == 0.0))
864 SNode::NodeTransformSpace ts = SNode::SO3_LOCAL_TS;
866 ts =
static_cast <SNode::NodeTransformSpace
>(MTOI(rep));
868 node->Translate(Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z)), ts);
870 MMset(m, 0, ITOM(1));
887 MMechostr(MSKDEBUG,
"SO3ObjectSetScale\n");
890 int vec = MTOP(MMpull(m));
893 if ((n == NIL) || (vec == NIL))
899 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
906 int x = MMfetch(m, vec, 0);
907 int y = MMfetch(m, vec, 1);
908 int z = MMfetch(m, vec, 2);
910 if ((x == NIL) || (y == NIL) || (z == NIL))
916 node->SetScale(Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z)));
918 MMset(m, 0, ITOM(1));
934 MMechostr(MSKDEBUG,
"SO3ObjectGetOrientation\n");
945 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
952 Ogre::Quaternion q = node->GetOrientation();
954 int tuple = MMmalloc(m, 4, TYPETAB);
961 MMstore(m, tuple, 0, FTOM((q.x)));
962 MMstore(m, tuple, 1, FTOM((q.y)));
963 MMstore(m, tuple, 2, FTOM((q.z)));
964 MMstore(m, tuple, 3, FTOM((q.w)));
965 MMset(m, 0, PTOM(tuple));
982 MMechostr(MSKDEBUG,
"SO3ObjectGetInitialOrientation\n");
993 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1000 Ogre::Quaternion q = node->GetInitialOrientation();
1002 int tuple = MMmalloc(m, 4, TYPETAB);
1009 MMstore(m, tuple, 0, FTOM((q.x)));
1010 MMstore(m, tuple, 1, FTOM((q.y)));
1011 MMstore(m, tuple, 2, FTOM((q.z)));
1012 MMstore(m, tuple, 3, FTOM((q.w)));
1013 MMset(m, 0, PTOM(tuple));
1030 MMechostr(MSKDEBUG,
"SO3ObjectGetGlobalOrientation\n");
1033 int n = MMget(m, 0);
1041 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1048 Ogre::Quaternion q = node->GetGlobalOrientation();
1050 int tuple = MMmalloc(m, 4, TYPETAB);
1057 MMstore(m, tuple, 0, FTOM(q.x));
1058 MMstore(m, tuple, 1, FTOM(q.y));
1059 MMstore(m, tuple, 2, FTOM(q.z));
1060 MMstore(m, tuple, 3, FTOM(q.w));
1061 MMset(m, 0, PTOM(tuple));
1079 MMechostr(MSKDEBUG,
"SO3ObjectSetGlobalPosition\n");
1082 int vec = MMpull(m);
1083 int n = MMget(m, 0);
1085 if ((n == NIL) || (vec == NIL))
1091 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1098 int x = MMfetch(m, MTOP(vec), 0);
1099 int y = MMfetch(m, MTOP(vec), 1);
1100 int z = MMfetch(m, MTOP(vec), 2);
1102 if ((x == NIL) || (y == NIL) || (z == NIL))
1108 Ogre::Vector3 position = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
1109 node->SetGlobalPosition(position);
1111 MMset(m, 0, ITOM(1));
1128 MMechostr(MSKDEBUG,
"SO3ObjectSetGlobalOrientation\n");
1132 int n = MMget(m, 0);
1134 if ((n == NIL) || (q == NIL))
1140 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1147 int x = MMfetch(m, MTOP(q), 0);
1148 int y = MMfetch(m, MTOP(q), 1);
1149 int z = MMfetch(m, MTOP(q), 2);
1150 int w = MMfetch(m, MTOP(q), 3);
1152 if ((x == NIL) || (y == NIL) || (z == NIL) || (
w == NIL))
1158 Ogre::Quaternion quat = Ogre::Quaternion(MTOF(
w), MTOF(x), MTOF(y), MTOF(z));
1161 node->SetGlobalOrientation(quat);
1163 MMset(m, 0, ITOM(1));
1180 MMechostr(MSKDEBUG,
"SO3ObjectSetGlobalScale\n");
1183 int vec = MTOP(MMpull(m));
1184 int n = MMget(m, 0);
1186 if ((n == NIL) || (vec == NIL))
1192 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1199 int x = MMfetch(m, vec, 0);
1200 int y = MMfetch(m, vec, 1);
1201 int z = MMfetch(m, vec, 2);
1203 if ((x == NIL) || (y == NIL) || (z == NIL))
1209 Ogre::Vector3 scale = Ogre::Vector3(MTOF(x), MTOF(y), MTOF(z));
1210 node->SetGlobalScale(scale);
1212 MMset(m, 0, ITOM(1));
1228 MMechostr(MSKDEBUG,
"SO3ObjectGetPosition\n");
1231 int n = MMget(m, 0);
1239 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1246 Ogre::Vector3 pos = node->GetPosition();
1248 int tuple = MMmalloc(m, 3, TYPETAB);
1255 MMstore(m, tuple, 0, FTOM((pos.x)));
1256 MMstore(m, tuple, 1, FTOM((pos.y)));
1257 MMstore(m, tuple, 2, FTOM((pos.z)));
1258 MMset(m, 0, PTOM(tuple));
1275 MMechostr(MSKDEBUG,
"SO3ObjectGetInitialPosition\n");
1278 int n = MMget(m, 0);
1286 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1293 Ogre::Vector3 pos = node->GetInitialPosition();
1295 int tuple = MMmalloc(m, 3, TYPETAB);
1302 MMstore(m, tuple, 0, FTOM((pos.x)));
1303 MMstore(m, tuple, 1, FTOM((pos.y)));
1304 MMstore(m, tuple, 2, FTOM((pos.z)));
1305 MMset(m, 0, PTOM(tuple));
1322 MMechostr(MSKDEBUG,
"SO3ObjectGetGlobalPosition\n");
1325 int n = MMget(m, 0);
1333 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1340 Ogre::Vector3 vec = node->GetGlobalPosition();
1342 int tuple = MMmalloc(m, 3, TYPETAB);
1349 MMstore(m, tuple, 0, FTOM((vec.x)));
1350 MMstore(m, tuple, 1, FTOM((vec.y)));
1351 MMstore(m, tuple, 2, FTOM((vec.z)));
1352 MMset(m, 0, PTOM(tuple));
1369 MMechostr(MSKDEBUG,
"SO3ObjectGetScale\n");
1372 int n = MMget(m, 0);
1380 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1387 Ogre::Vector3 pos = node->GetScale();
1389 int tuple = MMmalloc(m, 3, TYPETAB);
1396 MMstore(m, tuple, 0, FTOM((pos.x)));
1397 MMstore(m, tuple, 1, FTOM((pos.y)));
1398 MMstore(m, tuple, 2, FTOM((pos.z)));
1399 MMset(m, 0, PTOM(tuple));
1416 MMechostr(MSKDEBUG,
"SO3ObjectGetInitialScale\n");
1419 int n = MMget(m, 0);
1427 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1434 Ogre::Vector3 pos = node->GetInitialScale();
1436 int tuple = MMmalloc(m, 3, TYPETAB);
1443 MMstore(m, tuple, 0, FTOM((pos.x)));
1444 MMstore(m, tuple, 1, FTOM((pos.y)));
1445 MMstore(m, tuple, 2, FTOM((pos.z)));
1446 MMset(m, 0, PTOM(tuple));
1463 MMechostr(MSKDEBUG,
"SO3ObjectGetMatrix\n");
1466 int n = MMget(m, 0);
1474 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1482 node->GetOrientation().ToRotationMatrix(rot);
1483 Ogre::Matrix4 matTr = (Ogre::Matrix4)rot;
1484 matTr.setTrans(node->GetPosition());
1485 matTr.setScale(node->GetScale());
1487 int tuple = MMmalloc(m, 16, TYPETAB);
1494 MMstore(m, tuple, 0, FTOM(matTr[0][0]));
1495 MMstore(m, tuple, 1, FTOM(matTr[0][1]));
1496 MMstore(m, tuple, 2, FTOM(matTr[0][2]));
1497 MMstore(m, tuple, 3, FTOM(matTr[0][3]));
1498 MMstore(m, tuple, 4, FTOM(matTr[1][0]));
1499 MMstore(m, tuple, 5, FTOM(matTr[1][1]));
1500 MMstore(m, tuple, 6, FTOM(matTr[1][2]));
1501 MMstore(m, tuple, 7, FTOM(matTr[1][3]));
1502 MMstore(m, tuple, 8, FTOM(matTr[2][0]));
1503 MMstore(m, tuple, 9, FTOM(matTr[2][1]));
1504 MMstore(m, tuple, 10, FTOM(matTr[2][2]));
1505 MMstore(m, tuple, 11, FTOM(matTr[2][3]));
1506 MMstore(m, tuple, 12, FTOM(matTr[3][0]));
1507 MMstore(m, tuple, 13, FTOM(matTr[3][1]));
1508 MMstore(m, tuple, 14, FTOM(matTr[3][2]));
1509 MMstore(m, tuple, 15, FTOM(matTr[3][3]));
1510 MMset(m, 0, PTOM(tuple));
1527 MMechostr(MSKDEBUG,
"SO3ObjectGetWorldMatrix\n");
1530 int n = MMget(m, 0);
1538 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1545 Ogre::Matrix4 matTr(node->GetTransformationMatrix());
1547 int tuple = MMmalloc(m, 16, TYPETAB);
1554 MMstore(m, tuple, 0, FTOM(matTr[0][0]));
1555 MMstore(m, tuple, 1, FTOM(matTr[0][1]));
1556 MMstore(m, tuple, 2, FTOM(matTr[0][2]));
1557 MMstore(m, tuple, 3, FTOM(matTr[0][3]));
1558 MMstore(m, tuple, 4, FTOM(matTr[1][0]));
1559 MMstore(m, tuple, 5, FTOM(matTr[1][1]));
1560 MMstore(m, tuple, 6, FTOM(matTr[1][2]));
1561 MMstore(m, tuple, 7, FTOM(matTr[1][3]));
1562 MMstore(m, tuple, 8, FTOM(matTr[2][0]));
1563 MMstore(m, tuple, 9, FTOM(matTr[2][1]));
1564 MMstore(m, tuple, 10, FTOM(matTr[2][2]));
1565 MMstore(m, tuple, 11, FTOM(matTr[2][3]));
1566 MMstore(m, tuple, 12, FTOM(matTr[3][0]));
1567 MMstore(m, tuple, 13, FTOM(matTr[3][1]));
1568 MMstore(m, tuple, 14, FTOM(matTr[3][2]));
1569 MMstore(m, tuple, 15, FTOM(matTr[3][3]));
1570 MMset(m, 0, PTOM(tuple));
1587 MMechostr(MSKDEBUG,
"SO3ObjectGetGlobalScale\n");
1590 int n = MMget(m, 0);
1598 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1605 Ogre::Vector3 pos = node->GetGlobalScale();
1607 int tuple = MMmalloc(m, 3, TYPETAB);
1614 MMstore(m, tuple, 0, FTOM((pos.x)));
1615 MMstore(m, tuple, 1, FTOM((pos.y)));
1616 MMstore(m, tuple, 2, FTOM((pos.z)));
1617 MMset(m, 0, PTOM(tuple));
1641 MMechostr(MSKDEBUG,
"SO3ObjectRotateRoll\n");
1644 int rep = MMpull(m);
1645 int ang = MMpull(m);
1646 int n = MMget(m, 0);
1648 if ((n == NIL) || (rep == NIL) || (ang == NIL))
1654 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1661 node->Roll(MTOF(ang),
static_cast <SNode::NodeTransformSpace
>(MTOI(rep)));
1663 MMset(m, 0, ITOM(1));
1686 MMechostr(MSKDEBUG,
"SO3ObjectRotateYaw\n");
1689 int rep = MMpull(m);
1690 int ang = MMpull(m);
1691 int n = MMget(m, 0);
1693 if ((n == NIL) || (rep == NIL) || (ang == NIL))
1699 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1706 node->Yaw(MTOF(ang),
static_cast <SNode::NodeTransformSpace
>(MTOI(rep)));
1708 MMset(m, 0, ITOM(1));
1732 MMechostr(MSKDEBUG,
"SO3ObjectRotatePitch\n");
1735 int rep = MMpull(m);
1736 int ang = MMpull(m);
1737 int n = MMget(m, 0);
1739 if ((n == NIL) || (rep == NIL) || (ang == NIL))
1745 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1752 node->Pitch(MTOF(ang),
static_cast <SNode::NodeTransformSpace
>(MTOI(rep)));
1754 MMset(m, 0, ITOM(1));
1771 MMechostr(MSKDEBUG,
"SO3ObjectNbOfChild\n");
1774 int n = MMget(m, 0);
1782 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1789 int nb = node->GetNumChildren();
1808 MMechostr(MSKDEBUG,
"SO3ObjectRemoveAllChildren\n");
1811 int n = MMget(m, 0);
1819 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1826 node->DetachAllChildren();
1828 MMset(m, 0, ITOM(1));
1844 MMechostr(MSKDEBUG,
"SO3ObjectGetChildren\n");
1847 int n = MMget(m, 0);
1855 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1865 const SNodeMap childrenNodesListCopy = node->GetChildrenNodes();
1866 SNodeMap::const_iterator iChildrenList = childrenNodesListCopy.begin();
1868 while (iChildrenList != childrenNodesListCopy.end())
1870 int c = OBJfindTH(m,
SO3OBJTYPE, SCOL_PTR(iChildrenList->second));
1872 c = MMfetch(m, c, OFFOBJMAG);
1886 for (
int j = 0; j < p; j++)
1888 if (MMpush(m, 2 * 2))
1891 if (
int k = MBdeftab(m))
1909 MMechostr(MSKDEBUG,
"SO3ObjectDestroy\n");
1912 int n = MMget(m, 0);
1922 MMset(m, 0, ITOM(1));
1938 MMechostr(MSKDEBUG,
"SO3ObjectSetInitialState\n");
1941 int n = MMget(m, 0);
1945 MMechostr(MSKDEBUG,
"SO3ObjectSetInitialState : Node is NIL\n");
1950 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1953 MMechostr(MSKDEBUG,
"SO3ObjectSetInitialState : Node is NULL \n");
1958 node->StoreInitialPRS();
1960 MMset(m, 0, ITOM(1));
1977 MMechostr(MSKDEBUG,
"SO3ObjectResetToInitialState\n");
1980 int n = MMget(m, 0);
1989 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
1996 node->ResetToInitialPRS();
1998 MMset(m, 0, ITOM(1));
2015 MMechostr(MSKDEBUG,
"SO3ObjectGetSceneRoot\n");
2018 int s = MMget(m, 0);
2026 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
2033 SNode* curNode = scene->GetRootNode();
2034 int so3obj = OBJfindTH(m,
SO3OBJTYPE, SCOL_PTR(curNode));
2036 so3obj = MMfetch(m, so3obj, OFFOBJMAG);
2037 MMset(m, 0, so3obj);
2054 MMechostr(MSKDEBUG,
"SO3ObjectGetParent\n");
2057 int n = MMget(m, 0);
2065 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
2072 SNode* parent = node->GetParentSceneNode();
2079 int p = OBJfindTH(m,
SO3OBJTYPE, SCOL_PTR(parent));
2082 p = MMfetch(m, p, OFFOBJMAG);
2101 MMechostr(MSKDEBUG,
"SO3ObjectGetScene\n");
2104 int n = MMget(m, 0);
2112 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
2119 SScene* scene = node->GetParentScene();
2129 p = MMfetch(m, p, OFFOBJMAG);
2153 int n = MMget(m, 0);
2161 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
2171 parent = MMgetPointer<SNode*>(m, MTOP(p));
2181 MMechostr(MSKRUNTIME,
"SO3ObjectLink can't link an object to himslef!\n");
2187 if (node->GetNodeType() == SNode::BONE_TYPE_ID)
2194 node->AttachToParent(node->GetParentScene()->GetRootNode());
2196 node->AttachToParent(parent);
2198 MMset(m, 0, ITOM(1));
2215 MMechostr(MSKDEBUG,
"SO3ObjectGetPositionInObjectRef\n");
2219 int n = MMget(m, 0);
2221 if ((n == NIL) || (p == NIL))
2227 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
2228 SNode* parent = MMgetPointer<SNode*>(m, MTOP(p));
2230 if ((node == 0) || (parent == 0))
2236 Ogre::Vector3 v = node->GetPositionFromNode(parent);
2238 int tuple = MMmalloc(m, 3, TYPETAB);
2245 MMstore(m, tuple, 0, FTOM(v.x));
2246 MMstore(m, tuple, 1, FTOM(v.y));
2247 MMstore(m, tuple, 2, FTOM(v.z));
2248 MMset(m, 0, PTOM(tuple));
2266 MMechostr(MSKDEBUG,
"SO3ObjectGetOrientationInObjectRef\n");
2270 int n = MMget(m, 0);
2272 if ((n == NIL) || (p == NIL))
2278 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
2279 SNode* parent = MMgetPointer<SNode*>(m, MTOP(p));
2281 if ((node == 0) || (parent == 0))
2287 Ogre::Quaternion orient = node->GetOrientationFromNode(parent);
2289 int tuple = MMmalloc(m, 4, TYPETAB);
2296 MMstore(m, tuple, 0, FTOM((orient.x)));
2297 MMstore(m, tuple, 1, FTOM((orient.y)));
2298 MMstore(m, tuple, 2, FTOM((orient.z)));
2299 MMstore(m, tuple, 3, FTOM((orient.w)));
2300 MMset(m, 0, PTOM(tuple));
2318 MMechostr(MSKDEBUG,
"SO3ObjectGetScaleInObjectRef\n");
2322 int n = MMget(m, 0);
2324 if ((n == NIL) || (p == NIL))
2330 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
2331 SNode* parent = MMgetPointer<SNode*>(m, MTOP(p));
2333 if ((node == 0) || (parent == 0))
2339 Ogre::Vector3 scaleResult = node->GetScaleFromNode(parent);
2341 int tuple = MMmalloc(m, 3, TYPETAB);
2348 MMstore(m, tuple, 0, FTOM((scaleResult.x)));
2349 MMstore(m, tuple, 1, FTOM((scaleResult.y)));
2350 MMstore(m, tuple, 2, FTOM((scaleResult.z)));
2351 MMset(m, 0, PTOM(tuple));
2368 MMechostr(MSKDEBUG,
"SO3ObjectUnlink\n");
2371 int n = MMget(m, 0);
2379 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
2387 node->DetachFromParent();
2389 MMset(m, 0, ITOM(1));
2409 MMechostr(MSKDEBUG,
"SO3ObjectSetAutoTracking\n");
2412 int offset = MMpull(m);
2413 int direction = MMpull(m);
2414 int booleen = MTOI(MMpull(m));
2416 int n = MMget(m, 0);
2418 if ((n == NIL) || (p == NIL))
2424 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
2425 SNode* parent = MMgetPointer<SNode*>(m, MTOP(p));
2427 if ((node == 0) || (parent == 0))
2433 if (parent->GetNodeType() == SNode::BONE_TYPE_ID || node->GetNodeType() == SNode::BONE_TYPE_ID)
2439 if (direction == NIL && offset == NIL)
2442 node->SetAutoTracking(
false, parent);
2444 node->SetAutoTracking(
true, parent);
2446 else if (direction != NIL && offset == NIL)
2448 Ogre::Vector3 dir(Ogre::Vector3::NEGATIVE_UNIT_Z);
2450 if ((MMfetch(m, MTOP(direction), 0) != NIL))
2451 dir.x = MTOF(MMfetch(m, MTOP(direction), 0));
2452 if ((MMfetch(m, MTOP(direction), 1) != NIL))
2453 dir.y = MTOF(MMfetch(m, MTOP(direction), 1));
2454 if ((MMfetch(m, MTOP(direction), 2) != NIL))
2455 dir.z = MTOF(MMfetch(m, MTOP(direction), 2));
2458 node->SetAutoTracking(
false, parent, dir);
2460 node->SetAutoTracking(
true, parent, dir);
2462 else if (direction == NIL && offset != NIL)
2464 Ogre::Vector3 dir(Ogre::Vector3::NEGATIVE_UNIT_Z);
2465 Ogre::Vector3 off(Ogre::Vector3::ZERO);
2467 if ((MMfetch(m, MTOP(offset), 0) != NIL))
2468 off.x = MTOF(MMfetch(m, MTOP(offset), 0));
2469 if ((MMfetch(m, MTOP(offset), 1) != NIL))
2470 off.y = MTOF(MMfetch(m, MTOP(offset), 1));
2471 if ((MMfetch(m, MTOP(offset), 2) != NIL))
2472 off.z = MTOF(MMfetch(m, MTOP(offset), 2));
2475 node->SetAutoTracking(
false, parent, dir, off);
2477 node->SetAutoTracking(
true, parent, dir, off);
2481 Ogre::Vector3 dir(Ogre::Vector3::NEGATIVE_UNIT_Z);
2483 if ((MMfetch(m, MTOP(direction), 0) != NIL))
2484 dir.x = MTOF(MMfetch(m, MTOP(direction), 0));
2485 if ((MMfetch(m, MTOP(direction), 1) != NIL))
2486 dir.y = MTOF(MMfetch(m, MTOP(direction), 1));
2487 if ((MMfetch(m, MTOP(direction), 2) != NIL))
2488 dir.z = MTOF(MMfetch(m, MTOP(direction), 2));
2490 Ogre::Vector3 off(Ogre::Vector3::ZERO);
2492 if ((MMfetch(m, MTOP(offset), 0) != NIL))
2493 off.x = MTOF(MMfetch(m, MTOP(offset), 0));
2494 if ((MMfetch(m, MTOP(offset), 1) != NIL))
2495 off.y = MTOF(MMfetch(m, MTOP(offset), 1));
2496 if ((MMfetch(m, MTOP(offset), 2) != NIL))
2497 off.z = MTOF(MMfetch(m, MTOP(offset), 2));
2500 node->SetAutoTracking(
false, parent, dir, off);
2502 node->SetAutoTracking(
true, parent, dir, off);
2505 MMset(m, 0, ITOM(1));
2522 MMechostr(MSKDEBUG,
"SO3ObjectSetRenderingDistance\n");
2525 int value = MMpull(m);
2526 int n = MMget(m, 0);
2534 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
2541 float fvalue = (value == NIL) ? 0.0f : MTOF(value);
2545 node->SetRenderingDistance(fvalue);
2547 catch (Ogre::Exception &e)
2549 MMechostr(MSKDEBUG,
"An exception has occurred: %s\n", e.what());
2555 MMset(m, 0, ITOM(1));
2571 MMechostr(MSKDEBUG,
"SO3ObjectGetRenderingDistance\n");
2574 int n = MMget(m, 0);
2582 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
2592 value = node->GetRenderingDistance();
2594 catch (Ogre::Exception &e)
2596 MMechostr(MSKDEBUG,
"An exception has occurred: %s\n", e.what());
2602 MMset(m, 0, FTOM(value));
2619 MMechostr(MSKDEBUG,
"SO3ObjectSetCastShadows\n");
2622 int booleen = MTOI(MMpull(m));
2623 int n = MMget(m, 0);
2631 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
2640 if (booleen == SO3_FALSE)
2641 node->SetCastShadows(
false);
2643 node->SetCastShadows(
true);
2645 catch (Ogre::Exception &e)
2647 MMechostr(MSKDEBUG,
"An exception has occurred: %s\n", e.what());
2653 MMset(m, 0, ITOM(1));
2673 MMechostr(MSKDEBUG,
"SO3ObjectGetBoundingBoxInfo\n");
2676 int ichilds = MMpull(m);
2677 int n = MMget(m, 0);
2684 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
2691 Ogre::Vector3 sizeBB(0.0f, 0.0f, 0.0f);
2692 Ogre::Vector3 position(0.0f, 0.0f, 0.0f);
2693 Ogre::Quaternion quat;
2695 bool childs =
false;
2696 if ((ichilds != NIL) && (MTOI(ichilds) == 1))
2701 sizeBB = node->GetBoundingBoxSize(childs);
2703 catch (std::exception &e)
2705 MMechostr(MSKDEBUG,
"An exception has occurred: %s\n", e.what());
2713 position = node->GetBoundingBoxCenter(childs);
2715 catch (std::exception &)
2719 quat = node->GetOrientation();
2722 int size = MMmalloc(m, 3, TYPETAB);
2729 MMstore(m, size, 0, FTOM(sizeBB.x));
2730 MMstore(m, size, 1, FTOM(sizeBB.y));
2731 MMstore(m, size, 2, FTOM(sizeBB.z));
2732 MMpush(m, PTOM(size));
2735 int pos = MMmalloc(m, 3, TYPETAB);
2743 MMstore(m, pos, 0, FTOM(position.x));
2744 MMstore(m, pos, 1, FTOM(position.y));
2745 MMstore(m, pos, 2, FTOM(position.z));
2746 MMpush(m, PTOM(pos));
2749 int orient = MMmalloc(m, 4, TYPETAB);
2758 MMstore(m, orient, 0, FTOM(quat.x));
2759 MMstore(m, orient, 1, FTOM(quat.y));
2760 MMstore(m, orient, 2, FTOM(quat.z));
2761 MMstore(m, orient, 3, FTOM(quat.w));
2762 MMpush(m, PTOM(orient));
2765 int result = MMmalloc(m, 3, TYPETAB);
2775 MMstore(m, result, 2, MMpull(m));
2776 MMstore(m, result, 1, MMpull(m));
2777 MMstore(m, result, 0, MMpull(m));
2778 MMset(m, 0, PTOM(result));
2799 MMechostr(MSKDEBUG,
"SO3ObjectGetWorldBoundingBoxInfo\n");
2802 int ichilds = MMpull(m);
2803 int n = MMget(m, 0);
2810 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
2817 Ogre::Vector3 sizeBB(0.0f, 0.0f, 0.0f);
2818 Ogre::Vector3 position(0.0f, 0.0f, 0.0f);
2819 Ogre::Quaternion quat;
2821 bool childs =
false;
2822 if ((ichilds != NIL) && (MTOI(ichilds) == 1))
2827 sizeBB = node->GetWorldBoundingBoxSize(childs);
2829 catch (std::exception &e)
2831 MMechostr(MSKDEBUG,
"An exception has occurred: %s\n", e.what());
2839 position = node->GetWorldBoundingBoxCenter(childs);
2841 catch (std::exception &)
2845 quat = node->GetOrientation();
2848 int size = MMmalloc(m, 3, TYPETAB);
2855 MMstore(m, size, 0, FTOM(sizeBB.x));
2856 MMstore(m, size, 1, FTOM(sizeBB.y));
2857 MMstore(m, size, 2, FTOM(sizeBB.z));
2858 MMpush(m, PTOM(size));
2861 int pos = MMmalloc(m, 3, TYPETAB);
2869 MMstore(m, pos, 0, FTOM(position.x));
2870 MMstore(m, pos, 1, FTOM(position.y));
2871 MMstore(m, pos, 2, FTOM(position.z));
2872 MMpush(m, PTOM(pos));
2875 int orient = MMmalloc(m, 4, TYPETAB);
2884 MMstore(m, orient, 0, FTOM(quat.x));
2885 MMstore(m, orient, 1, FTOM(quat.y));
2886 MMstore(m, orient, 2, FTOM(quat.z));
2887 MMstore(m, orient, 3, FTOM(quat.w));
2888 MMpush(m, PTOM(orient));
2891 int result = MMmalloc(m, 3, TYPETAB);
2901 MMstore(m, result, 2, MMpull(m));
2902 MMstore(m, result, 1, MMpull(m));
2903 MMstore(m, result, 0, MMpull(m));
2904 MMset(m, 0, PTOM(result));
2920 MMechostr(MSKDEBUG,
"SO3ObjectGetCastShadows\n");
2923 int n = MMget(m, 0);
2931 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
2941 if (node->GetCastShadows())
2944 catch (Ogre::Exception &e)
2946 MMechostr(MSKDEBUG,
"An exception has occurred: %s\n", e.what());
2952 MMset(m, 0, ITOM(booleen));
2969 MMechostr(MSKDEBUG,
"SO3ObjectGetPolygonCount\n");
2972 int n = MMget(m, 0);
2980 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
2987 if (node->GetNodeType() != SNode::ENTITY_TYPE_ID)
2993 SEntity* entity =
static_cast<SEntity*
>(node);
2994 MMset(m, 0, ITOM(entity->GetPolygonCount()));
3011 MMechostr(MSKDEBUG,
"SO3ObjectGetVerticesCount\n");
3014 int n = MMget(m, 0);
3022 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
3029 if (node->GetNodeType() != SNode::ENTITY_TYPE_ID)
3035 SEntity* entity =
static_cast<SEntity*
>(node);
3036 MMset(m, 0, ITOM(entity->GetVerticesCount()));
3054 MMechostr(MSKDEBUG,
"SO3ObjectSetMouseForeGround\n");
3057 int i = MTOI(MMpull(m));
3058 int n = MMget(m, 0);
3060 if ((i == NIL) || (n == NIL))
3066 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
3073 if (node->GetNodeType() != SNode::ENTITY_TYPE_ID)
3080 node->SetSceneNodeIsMouseForeground(
false);
3082 node->SetSceneNodeIsMouseForeground(
true);
3084 MMset(m, 0, ITOM(i));
3102 MMechostr(MSKDEBUG,
"SO3ObjectSetMouseClick\n");
3105 int i = MTOI(MMpull(m));
3106 int n = MMget(m, 0);
3108 if ((i == NIL) || (n == NIL))
3114 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
3121 if (node->GetNodeType() != SNode::ENTITY_TYPE_ID)
3128 node->SetSceneNodeIsMouseClick(
false);
3130 node->SetSceneNodeIsMouseClick(
true);
3132 MMset(m, 0, ITOM(i));
3149 MMechostr(MSKDEBUG,
"SO3ObjectGetMouseForeGround\n");
3152 int n = MMget(m, 0);
3160 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
3167 if (node->GetNodeType() != SNode::ENTITY_TYPE_ID)
3175 if (node->GetSceneNodeIsMouseForeground())
3178 MMset(m, 0, ITOM(result));
3195 MMechostr(MSKDEBUG,
"SO3ObjectGetMouseClick\n");
3198 int n = MMget(m, 0);
3206 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
3213 if (node->GetNodeType() != SNode::ENTITY_TYPE_ID)
3221 if (node->GetSceneNodeIsMouseClick())
3224 MMset(m, 0, ITOM(result));
3242 MMechostr(MSKDEBUG,
"SO3ObjectSetFlags\n");
3246 int n = MMget(m, 0);
3247 if ((i == NIL) || (n == NIL))
3253 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
3260 node->SetFlags(MTOI(i));
3278 MMechostr(MSKDEBUG,
"SO3ObjectGetFlags\n");
3281 int n = MMget(m, 0);
3288 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
3295 MMset(m, 0, ITOM(node->GetFlags()));
3312 MMechostr(MSKDEBUG,
"SO3ObjectSetRenderOverlay\n");
3315 int booleen = MTOI(MMpull(m));
3316 int n = MMget(m, 0);
3324 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
3331 if (node->GetNodeType() != SNode::ENTITY_TYPE_ID)
3337 SEntity* entity =
static_cast<SEntity*
>(node);
3340 entity->SetRenderQueue(Ogre::RENDER_QUEUE_MAIN);
3342 entity->SetRenderQueue(Ogre::RENDER_QUEUE_OVERLAY);
3344 MMset(m, 0, ITOM(1));
3361 MMechostr(MSKDEBUG,
"SO3ObjectSetRenderQueue\n");
3364 int val = MMpull(m);
3365 int n = MMget(m, 0);
3374 val = Ogre::RENDER_QUEUE_MAIN;
3378 if (val >= Ogre::RENDER_QUEUE_MAX)
3379 val = Ogre::RENDER_QUEUE_MAX-1;
3380 else if (val < Ogre::RENDER_QUEUE_1)
3381 val = Ogre::RENDER_QUEUE_1;
3383 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
3390 if (node->GetNodeType() != SNode::ENTITY_TYPE_ID)
3396 SEntity* entity =
static_cast<SEntity*
>(node);
3397 entity->SetRenderQueue((Ogre::RenderQueueGroupID)val);
3399 MMset(m, 0, ITOM(1));
3420 MMechostr(MSKDEBUG,
"SO3ObjectGetInfo\n");
3425 int v = MMget(m, 0);
3427 if ((v == NIL) || (x == NIL) || (y == NIL))
3433 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(v));
3440 SRaycastResult rayCastResults = viewport->RayCast(MTOI(y), MTOI(x));
3442 int ent = OBJfindTH(m,
SO3OBJTYPE, SCOL_PTR(rayCastResults.entity));
3444 ent = MMfetch(m, ent, OFFOBJMAG);
3447 int mat = MMpull(m);
3449 int tuple = MMmalloc(m, 3, TYPETAB);
3456 MMstore(m, tuple, 0, ent == 0 ? NIL : ent);
3457 MMstore(m, tuple, 1, mat);
3458 MMstore(m, tuple, 2, ITOM(rayCastResults.indexSubEntity));
3459 MMset(m, 0, PTOM(tuple));
3490 MMechostr(MSKDEBUG,
"SO3ObjectGetInfoEx\n");
3495 int v = MMget(m, 0);
3497 if ((v == NIL) || (x == NIL) || (y == NIL))
3503 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(v));
3510 SRaycastResult rayCastResults = viewport->RayCast(MTOI(y), MTOI(x));
3512 int ent = OBJfindTH(m,
SO3OBJTYPE, SCOL_PTR(rayCastResults.entity));
3523 ent = MMfetch(m, ent, OFFOBJMAG);
3529 MMpush(m, ITOM(rayCastResults.indexSubEntity));
3530 MMpush(m, FTOM(rayCastResults.closestDistance));
3531 MMpush(m, ITOM(rayCastResults.indexFace));
3536 int vertex1 = MMmalloc(m, 3, TYPETAB);
3542 MMstore(m, vertex1, 0, FTOM(rayCastResults.v1.x));
3543 MMstore(m, vertex1, 1, FTOM(rayCastResults.v1.y));
3544 MMstore(m, vertex1, 2, FTOM(rayCastResults.v1.z));
3545 MMpush(m, PTOM(vertex1));
3548 int vertex2 = MMmalloc(m, 3, TYPETAB);
3554 MMstore(m, vertex2, 0, FTOM(rayCastResults.v2.x));
3555 MMstore(m, vertex2, 1, FTOM(rayCastResults.v2.y));
3556 MMstore(m, vertex2, 2, FTOM(rayCastResults.v2.z));
3557 MMpush(m, PTOM(vertex2));
3560 int vertex3 = MMmalloc(m, 3, TYPETAB);
3566 MMstore(m, vertex3, 0, FTOM(rayCastResults.v3.x));
3567 MMstore(m, vertex3, 1, FTOM(rayCastResults.v3.y));
3568 MMstore(m, vertex3, 2, FTOM(rayCastResults.v3.z));
3569 MMpush(m, PTOM(vertex3));
3573 int uv1 = MMmalloc(m, 2, TYPETAB);
3579 MMstore(m, uv1, 0, FTOM(rayCastResults.pReal1[0]));
3580 MMstore(m, uv1, 1, FTOM(rayCastResults.pReal1[1]));
3581 MMpush(m, PTOM(uv1));
3584 int uv2 = MMmalloc(m, 2, TYPETAB);
3589 MMstore(m, uv2, 0, FTOM(rayCastResults.pReal2[0]));
3590 MMstore(m, uv2, 1, FTOM(rayCastResults.pReal2[1]));
3591 MMpush(m, PTOM(uv2));
3594 int uv3 = MMmalloc(m, 2, TYPETAB);
3599 MMstore(m, uv3, 0, FTOM(rayCastResults.pReal3[0]));
3600 MMstore(m, uv3, 1, FTOM(rayCastResults.pReal3[1]));
3601 MMpush(m, PTOM(uv3));
3604 int inter = MMmalloc(m, 3, TYPETAB);
3610 MMstore(m, inter, 0, FTOM(rayCastResults.point.x));
3611 MMstore(m, inter, 1, FTOM(rayCastResults.point.y));
3612 MMstore(m, inter, 2, FTOM(rayCastResults.point.z));
3613 MMpush(m, PTOM(inter));
3616 int uvf = MMmalloc(m, 2, TYPETAB);
3622 MMstore(m, uvf, 0, FTOM(rayCastResults.uvResult.x));
3623 MMstore(m, uvf, 1, FTOM(rayCastResults.uvResult.y));
3624 MMpush(m, PTOM(uvf));
3644 MMechostr(MSKDEBUG,
"SO3ObjectGetScreenCoord\n");
3648 int n = MMget(m, 0);
3650 if ((n == NIL) || (v == NIL))
3656 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
3663 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(v));
3670 SCamera* camera = viewport->GetCamera();
3677 Ogre::Vector2 result;
3678 Ogre::Vector3 point = node->GetGlobalPosition();
3681 if (camera->IsFacingPoint(point))
3688 point = camera->ToScreenSpace(point);
3691 result.x = (point.x / 2) + 0.5f;
3692 result.y = 1 - ((point.y / 2) + 0.5f);
3694 int tuple = MMmalloc(m, 2, TYPETAB);
3701 MMstore(m, tuple, 0, FTOM((result.x)));
3702 MMstore(m, tuple, 1, FTOM((result.y)));
3703 MMset(m, 0, PTOM(tuple));
3721 MMechostr(MSKDEBUG,
"SO3ObjectGetScreenPixelCoord\n");
3725 int n = MMget(m, 0);
3727 if ((n == NIL) || (vp == NIL))
3733 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
3740 SViewPort* viewport = MMgetPointer<SViewPort*>(m, MTOP(vp));
3748 SCamera* camera = viewport->GetCamera();
3755 Ogre::Vector2 result;
3756 Ogre::Vector3 point = node->GetGlobalPosition();
3759 if (camera->IsFacingPoint(point))
3766 point = camera->ToScreenSpace(point);
3769 result.x = (point.x / 2) + 0.5f;
3770 result.y = 1 - ((point.y / 2) + 0.5f);
3772 result.x *= viewport->GetWidthPixels();
3773 result.y *= viewport->GetHeightPixels();
3775 int tuple = MMmalloc(m, 2, TYPETAB);
3782 MMstore(m, tuple, 0, ITOM(((
int)result.x)));
3783 MMstore(m, tuple, 1, ITOM(((
int)result.y)));
3784 MMset(m, 0, PTOM(tuple));
3805 MMechostr(MSKDEBUG,
"SO3ObjectGetNodeFacingOrientation\n");
3808 int axis = MMpull(m);
3809 int dir = MMpull(m);
3810 int des = MMpull(m);
3811 int src = MMget(m, 0);
3813 if ((des == NIL) || (src == NIL))
3819 SNode* srcnode = MMgetPointer<SNode*>(m, MTOP(src));
3826 SNode* destnode = MMgetPointer<SNode*>(m, MTOP(des));
3833 Ogre::Vector3 uDir = Ogre::Vector3::NEGATIVE_UNIT_Z;
3837 if (MMfetch(m, MTOP(dir), 0) != NIL)
3838 uDir.x = MTOF(MMfetch(m, MTOP(dir), 0));
3839 if (MMfetch(m, MTOP(dir), 1) != NIL)
3840 uDir.y = MTOF(MMfetch(m, MTOP(dir), 1));
3841 if (MMfetch(m, MTOP(dir), 2) != NIL)
3842 uDir.z = MTOF(MMfetch(m, MTOP(dir), 2));
3846 Ogre::Vector3 uAxis;
3853 if (MMfetch(m, MTOP(axis), 0) != NIL)
3854 uAxis.x = (float)MTOI(MMfetch(m, MTOP(axis), 0));
3855 if (MMfetch(m, MTOP(axis), 1) != NIL)
3856 uAxis.y = (
float)MTOI(MMfetch(m, MTOP(axis), 1));
3857 if (MMfetch(m, MTOP(axis), 2) != NIL)
3858 uAxis.z = (float)MTOI(MMfetch(m, MTOP(axis), 2));
3863 Ogre::Vector3 direction = srcnode->GetGlobalPosition() - destnode->GetGlobalPosition();
3864 Ogre::Vector3 srcvec = destnode->GetGlobalOrientation() * uDir;
3866 direction.normalise();
3868 Ogre::Quaternion dirQuat = srcvec.getRotationTo(direction) * destnode->GetGlobalOrientation();
3870 Ogre::Vector3 xaxis = srcnode->GetGlobalOrientation().xAxis();
3871 Ogre::Vector3 yaxis = srcnode->GetGlobalOrientation().yAxis();
3872 Ogre::Vector3 zaxis = srcnode->GetGlobalOrientation().zAxis();
3874 Ogre::Vector3 dxaxis = dirQuat.xAxis();
3875 Ogre::Vector3 dyaxis = dirQuat.yAxis();
3876 Ogre::Vector3 dzaxis = dirQuat.zAxis();
3878 Ogre::Vector3 fxaxis;
3879 Ogre::Vector3 fyaxis;
3880 Ogre::Vector3 fzaxis;
3897 Ogre::Quaternion returnQuat = Ogre::Quaternion(fxaxis, fyaxis, fzaxis);
3898 int tuple = MMmalloc(m, 4, TYPETAB);
3905 MMstore(m, tuple, 0, FTOM((returnQuat.x)));
3906 MMstore(m, tuple, 1, FTOM((returnQuat.y)));
3907 MMstore(m, tuple, 2, FTOM((returnQuat.z)));
3908 MMstore(m, tuple, 3, FTOM((returnQuat.w)));
3909 MMset(m, 0, PTOM(tuple));
3927 MMechostr(MSKDEBUG,
"SO3ObjectGetAnimation\n");
3930 int name = MMpull(m);
3931 int n = MMget(m, 0);
3932 if ((name == NIL) || (n == NIL))
3938 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
3945 std::string animationName(MMstartstr(m, MTOP(name)));
3946 SAnim* curAnim = node->GetAnimation(animationName);
3949 if (node->GetNodeType() == SNode::ENTITY_TYPE_ID)
3951 SEntity* entity =
static_cast<SEntity*
> (node);
3952 SSkeleton* skeleton = entity->GetSkeleton();
3955 curAnim = skeleton->GetAnimation(animationName);
3961 MMechostr(MSKDEBUG,
"Animation not found!\n");
3967 int a = OBJfindTH(m,
SO3ANIM, SCOL_PTR(curAnim));
3969 a = MMfetch(m, a, OFFOBJMAG);
3989 MMechostr(MSKDEBUG,
"SO3ObjectCreateNodesAnimation\n");
3992 int length = MMpull(m);
3995 if ((p == NIL) || (n == NIL) || (length == NIL))
4001 SNode* node = MMgetPointer<SNode*>(m, MTOP(n));
4010 std::string animationName(MMstartstr(m, MTOP(p)));
4011 SAnim* animation = node->CreateNodeAnimation(animationName, MTOF(length));
4014 catch (Ogre::Exception &e)
4016 MMechostr(MSKDEBUG,
"An exception has occurred: %s\n", e.what());
4035 MMechostr(MSKDEBUG,
"SO3ObjectSetInheritOrientation\n");
4038 int state = MMpull(m);
4039 int obj = MMget(m, 0);
4046 SNode* node = MMgetPointer<SNode*>(m, MTOP(obj));
4053 bool bState =
false;
4054 if (MTOI(state) == 1)
4057 node->SetInheritOrientation(bState);
4059 MMset(m, 0, ITOM(1));
4076 MMechostr(MSKDEBUG,
"SO3ObjectGetInheritOrientation\n");
4079 int obj = MMget(m, 0);
4086 SNode* node = MMgetPointer<SNode*>(m, MTOP(obj));
4093 MMset(m, 0, ITOM(node->GetInheritOrientation() ? 1 : 0));
4109 MMechostr(MSKDEBUG,
"SO3ObjectResetOrientation\n");
4112 int obj = MMget(m, 0);
4119 SNode* node = MMgetPointer<SNode*>(m, MTOP(obj));
4126 node->ResetOrientation();
4128 MMset(m, 0, ITOM(1));
4146 MMechostr(MSKDEBUG,
"SO3ObjectSetAsStaticGeometry\n");
4149 int state = MMpull(m);
4150 int obj = MMget(m, 0);
4157 SNode* node = MMgetPointer<SNode*>(m, MTOP(obj));
4164 bool bState =
false;
4165 if (MTOI(state) == 1)
4170 node->SetAsStaticGeometry(bState);
4172 catch (Ogre::Exception &)
4178 MMset(m, 0, ITOM(1));
4195 MMechostr(MSKDEBUG,
"SO3ObjectGetAsStaticGeometry\n");
4198 int obj = MMget(m, 0);
4205 SNode* node = MMgetPointer<SNode*>(m, MTOP(obj));
4212 MMset(m, 0, ITOM(node->GetAsStaticGeometry() ? 1 : 0));
4242 MMechostr(MSKDEBUG,
"SO3ObjectGetType\n");
4245 int obj = MMget(m, 0);
4252 SNode* node = MMgetPointer<SNode*>(m, MTOP(obj));
4259 MMset(m, 0, ITOM(node->GetNodeType()));
4265 {
"SO3_TYPE_NODE", TYPVAR,
"I", SCOL_TYPTYPE(SNode::NODE_TYPE_ID) },
4266 {
"SO3_TYPE_ENTITY", TYPVAR,
"I", SCOL_TYPTYPE(SNode::ENTITY_TYPE_ID) },
4267 {
"SO3_TYPE_CAMERA", TYPVAR,
"I", SCOL_TYPTYPE(SNode::CAMERA_TYPE_ID) },
4268 {
"SO3_TYPE_LIGHT", TYPVAR,
"I", SCOL_TYPTYPE(SNode::LIGHT_TYPE_ID) },
4269 {
"SO3_TYPE_SKELETON", TYPVAR,
"I", SCOL_TYPTYPE(SNode::SKELETON_TYPE_ID) },
4270 {
"SO3_TYPE_BONE", TYPVAR,
"I", SCOL_TYPTYPE(SNode::BONE_TYPE_ID) },
4271 {
"SO3_TYPE_PARTICLE", TYPVAR,
"I", SCOL_TYPTYPE(SNode::PARTICLE_SYSTEM_TYPE_ID) },
4272 {
"SO3_TYPE_CUBE_MAP", TYPVAR,
"I", SCOL_TYPTYPE(SNode::DYNAMIC_CUBE_MAP_ID) },
4273 {
"SO3_TYPE_REFLECTION_MAP", TYPVAR,
"I", SCOL_TYPTYPE(SNode::DYNAMIC_REFLECTION_MAP_ID) },
4274 {
"SO3_TYPE_RENDER_TO_TEXTURE", TYPVAR,
"I", SCOL_TYPTYPE(SNode::RENDER_TO_TEXTURE_ID) },
4275 {
"SO3_TYPE_LINE_ENTITY", TYPVAR,
"I", SCOL_TYPTYPE(SNode::LINE_ENTITY_TYPE_ID) },
4276 {
"SO3_TYPE_VIRTUAL_POINTER", TYPVAR,
"I", SCOL_TYPTYPE(SNode::VIRTUAL_POINTER_TYPE_ID) },
4278 {
"SO3ObjectRotate", 4,
"fun [SO3_OBJECT F [F F F] I] I",
SO3ObjectRotate },
4286 {
"SO3ObjectLookAt", 3,
"fun [SO3_OBJECT [F F F] I] I",
SO3ObjectLookAt },
4306 {
"SO3ObjectGetMatrix", 1,
"fun [SO3_OBJECT] [F F F F F F F F F F F F F F F F]",
SO3ObjectGetMatrix },
4307 {
"SO3ObjectGetWorldMatrix", 1,
"fun [SO3_OBJECT] [F F F F F F F F F F F F F F F F]",
SO3ObjectGetWorldMatrix },
4321 {
"SO3ObjectLink", 2,
"fun [SO3_OBJECT SO3_OBJECT] I",
SO3ObjectLink },
4341 {
"SO3ObjectGetInfo", 3,
"fun [SO3_VIEWPORT I I] [SO3_OBJECT SO3_MATERIAL I]",
SO3ObjectGetInfo },
4342 {
"SO3ObjectGetInfoEx", 3,
"fun [SO3_VIEWPORT I I] [SO3_OBJECT SO3_MATERIAL I F I [F F F] [F F F] [F F F] [F F] [F F] [F F] [F F F] [F F]]",
SO3ObjectGetInfoEx },
int SCOLfreeObject()
free the SO3Engine Viewport function
NativeDefinition natSO3Obj[]
int SCOLloadObject(mmachine m, cbmachine w)
Load the SO3Engine Viewport function.
MMechostr(MSKDEBUG, " > Start loading Plugin SO3Engine dll\n")
SCOL_EXPORT int cbmachine w
int createAnim(mmachine m, SAnim *curAnim, SNode *curNode)
int createOrRetrieveScolMaterialAndSendToVM(mmachine m, SScene *scene, SMaterial *mat)
int SO3ObjectCreateNodesAnimation(mmachine m)
SO3ObjectCreateNodesAnimation : Create a Scene Node Animation.
int SO3ObjectSetRenderingDistance(mmachine m)
SO3ObjectSetRenderingDistance : defines a maximum distance for rendering the object.
int SO3ObjectSetGlobalOrientation(mmachine m)
SO3ObjectSetGlobalOrientation : Set Global Object Orientation.
int SO3ObjectGetParent(mmachine m)
SO3ObjectGetParent : Get the parent node of a node.
int SO3ObjectRotateRoll(mmachine m)
SO3ObjectRotateRoll : Roll a node.
int SO3ObjectGetInitialScale(mmachine m)
SO3ObjectGetScale : Get Object Initial Scale.
int SO3ObjectSetRenderQueue(mmachine m)
SO3ObjectSetRenderQueue : defines render queue position of a mesh.
int SO3ObjectSetInheritOrientation(mmachine m)
SO3ObjectSetInheritOrientation : Set the inherit orientation of a node.
int SO3ObjectLink(mmachine m)
SO3ObjectLink : Link two nodes.
int SO3ObjectGetVisible(mmachine m)
SO3ObjectGetVisible : Get the visible state of a node.
int SO3ObjectSetOrientation(mmachine m)
SO3ObjectSetOrientation : Set an orientation for a given node.
int SO3ObjectGetWorldBoundingBoxInfo(mmachine m)
SO3ObjectGetWorldBoundingBoxInfo : Return the world bounding box information of a node.
int SO3ObjectGetGlobalPosition(mmachine m)
SO3ObjectGetGlobalPosition : Get Object Global Position.
int SO3ObjectGetInfoEx(mmachine m)
SO3ObjectGetInfoEx : Get extended mouse informations (raycast) from a viewport.
int SO3ObjectSetDirection(mmachine m)
SO3ObjectSetDirection : defines direction of a node.
int SO3ObjectGetBoundingBoxInfo(mmachine m)
SO3ObjectGetBoundingBoxInfo : Return the bounding box information of a node.
int SO3ObjectSetInitialState(mmachine m)
SO3ObjectSetInitialState : defines initial state of a node.
int SO3ObjectGetInitialOrientation(mmachine m)
SO3ObjectGetInitialOrientation : Get Initial Object Orientation.
int SO3ObjectGetGlobalScale(mmachine m)
SO3ObjectGetScale : Get Object Global Scale.
int SO3ObjectSetGlobalScale(mmachine m)
SO3ObjectSetGlobalScale : Set Global Object scale.
int SO3ObjectSetMouseForeGround(mmachine m)
SO3ObjectSetMouseForeGround : defines mouse foreground priority of a node.
int SO3ObjectResetToInitialOrientation(mmachine m)
SO3ObjectResetToInitialOrientation : Reset node orientation.
int SO3ObjectGetAsStaticGeometry(mmachine m)
SO3ObjectGetAsStaticGeometry : Get the static gemoetry state of a node.
int SO3ObjectGetInfo(mmachine m)
SO3ObjectGetInfo : Get mouse informations (raycast) from a viewport.
int SO3ObjectResetOrientation(mmachine m)
SO3ObjectResetOrientation : Resets the node orientation (local axes as world axes,...
int SO3ObjectLookAt(mmachine m)
SO3ObjectLookAt : defines "look at" direction of a node.
int SO3ObjectRotateYaw(mmachine m)
SO3ObjectRotateYaw : Yaw a node.
int SO3ObjectGetScene(mmachine m)
SO3ObjectGetScene : Get the parent scene of a node.
int SO3ObjectTranslate(mmachine m)
SO3ObjectTranslate : Translate a given node.
int SO3ObjectUnlink(mmachine m)
SO3ObjectUnlink : Unlink a node from the scene.
int SO3ObjectGetVerticesCount(mmachine m)
SO3ObjectGetVerticesCount : Return the numer of Vertex for a node.
int SO3ObjectGetChildren(mmachine m)
SO3ObjectGetChildren : Return the list of child node.
int SO3ObjectAddOrientation(mmachine m)
SO3ObjectAddOrientation : Add orientation to a given node.
int SO3ObjectGetAnimation(mmachine m)
SO3ObjectGetAnimation : return an animation by its name.
int SO3ObjectRotatePitch(mmachine m)
SO3ObjectRotatePitch : Pitch a node.
int SO3ObjectGetMouseForeGround(mmachine m)
SO3ObjectGetMouseForeGround :Get the mouse foreground priority of a node.
int SO3ObjectGetMouseClick(mmachine m)
SO3ObjectGetMouseClick :Get the mouse click state of a node.
int SO3ObjectSetFlags(mmachine m)
SO3ObjectSetFlags : defines any flags value on a node.
int SO3ObjectGetInitialPosition(mmachine m)
SO3ObjectGetInitialPosition : Get Object Initial Position.
int SO3ObjectNbOfChild(mmachine m)
SO3ObjectNbOfChild : return the numer of child of a node.
int SO3ObjectGetOrientation(mmachine m)
SO3ObjectGetOrientation : Get Object Orientation.
int SO3ObjectGetScaleInObjectRef(mmachine m)
SO3ObjectGetScaleInObjectRef : Return the scale of node in the transform space of another node.
int SO3ObjectGetSceneRoot(mmachine m)
SO3ObjectGetSceneRoot : Get the scene root node.
int SO3ObjectGetPosition(mmachine m)
SO3ObjectGetPosition : Get Object Position.
int SO3ObjectSetCastShadows(mmachine m)
SO3ObjectSetCastShadows : defines cast shadow state for a node.
int SO3ObjectGetPositionInObjectRef(mmachine m)
SO3ObjectGetPositionInObjectRef : Return the position of node in the transform space of another node.
int SO3ObjectGetDerivedDirection(mmachine m)
SO3ObjectGetDerivedDirection : Get the node derived direction.
int SO3ObjectGetGlobalOrientation(mmachine m)
SO3ObjectGetGlobalOrientation : Get Global Object Orientation.
int SO3ObjectSetScale(mmachine m)
SO3ObjectSetScale : Scale a given node.
int SO3ObjectGetRenderingDistance(mmachine m)
SO3ObjectGetRenderingDistance : return the maximum distance for rendering the object.
int SO3ObjectGetFlags(mmachine m)
SO3ObjectGetFlags : Get a node flags value.
int SO3ObjectResetToInitialState(mmachine m)
SO3ObjectResetToInitialState : Reset a node to its initial state.
int SO3ObjectGetMatrix(mmachine m)
SO3ObjectGetMatrix : Return the matrix of a given node.
int SO3ObjectShowBoundingBox(mmachine m)
SO3ObjectShowBoundingBox : Allow the display of BoundingBox.
int SO3ObjectGetInheritOrientation(mmachine m)
SO3ObjectGetInheritOrientation : Get the inherit orientation of a node.
int SO3ObjectGetName(mmachine m)
SO3ObjectGetName : Return a node's name.
int SO3ObjectRemoveAllChildren(mmachine m)
SO3ObjectRemoveAllChildren : Remove all children.
int SO3ObjectGetOrientationInObjectRef(mmachine m)
SO3ObjectGetOrientationInObjectRef : Return the orientation of node in the transform space of another...
int SO3ObjectSetVisible(mmachine m)
SO3ObjectSetVisible : defines visible state of a node.
int SO3ObjectGetScreenPixelCoord(mmachine m)
SO3ObjectGetScreenPixelCoord : Get screen coordinates in pixels of a node.
int SO3ObjectDestroy(mmachine m)
SO3ObjectDestroy : Destroy a node and its hierarchy.
int SO3ObjectGetNodeFacingOrientation(mmachine m)
SO3ObjectGetNodeFacingOrientation : Get the necessary rotation for making the target node facing the ...
int SO3ObjectGetDirection(mmachine m)
SO3ObjectGetDirection : Get the node direction.
int SO3ObjectGetCastShadows(mmachine m)
SO3ObjectGetCastShadows : Get the cast shadows state of a node.
int SO3ObjectGetDerivedDirectionAxis(mmachine m)
SO3ObjectGetDerivedDirectionAxis : Get the node derived direction from axis.
int SO3ObjectRotate(mmachine m)
main include
int SO3ObjectSetRenderOverlay(mmachine m)
SO3ObjectSetRenderOverlay : defines render overlay priority of a mesh.
int SO3ObjectGetPolygonCount(mmachine m)
SO3ObjectGetPolygonCount : Return the numer of Polygone for a node.
int SO3ObjectGetDirectionAxis(mmachine m)
SO3ObjectGetDirectionAxis : Get the node direction from axis.
int SO3ObjectSetAsStaticGeometry(mmachine m)
SO3ObjectSetAsStaticGeometry : Set the object as a static geometry.
int SO3ObjectGetWorldMatrix(mmachine m)
SO3ObjectGetWorldMatrix : Return the world matrix of a given node.
int SO3ObjectGetType(mmachine m)
SO3ObjectGetType : Get the type of an object.
int SO3ObjectSetPosition(mmachine m)
SO3ObjectSetPosition : defines position for a given node.
int SO3ObjectGetScale(mmachine m)
SO3ObjectGetScale : Get Object Scale.
int SO3ObjectSetAutoTracking(mmachine m)
SO3ObjectSetAutoTracking : defines auto tracking for a node.
int SO3ObjectSetGlobalPosition(mmachine m)
SO3ObjectSetGlobalPosition : Set Global Object Postion.
int SO3ObjectGetScreenCoord(mmachine m)
SO3ObjectGetScreenCoord : Get screen coordinates of a node.
int SO3ObjectSetMouseClick(mmachine m)
SO3ObjectSetMouseClick : defines mouse click state of a node.