56 MMechostr(MSKDEBUG,
"SO3LineEntityCreate\n");
58 int color = MMpull(m);
59 int points = MMpull(m);
68 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
80 lineEntity = scene->CreateLineEntity(MMstartstr(m, MTOP(name)));
89 points = MTOP(points);
93 pointTuple = MTOP(MMfetch(m, points, 0));
94 x = MTOF(MMfetch(m, pointTuple, 0));
95 y = MTOF(MMfetch(m, pointTuple, 1));
96 z = MTOF(MMfetch(m, pointTuple, 2));
97 points = MTOP(MMfetch(m, points, 1));
111 catch(Ogre::Exception &e)
113 MMechostr(MSKDEBUG,
"An exception has occurred : %s\n", e.what());
138 MMechostr(MSKDEBUG,
"SO3LineEntityCreateDashed\n");
140 int color = MMpull(m);
141 int points = MMpull(m);
142 int name = MMpull(m);
150 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
162 lineEntity = scene->CreateLineEntity(MMstartstr(m, MTOP(name)),
true);
171 points = MTOP(points);
175 pointTuple = MTOP(MMfetch(m, points, 0));
176 x = MTOF(MMfetch(m, pointTuple, 0));
177 y = MTOF(MMfetch(m, pointTuple, 1));
178 z = MTOF(MMfetch(m, pointTuple, 2));
179 points = MTOP(MMfetch(m, points, 1));
193 catch(Ogre::Exception &e)
195 MMechostr(MSKDEBUG,
"An exception has occurred : %s\n", e.what());
221 MMechostr(MSKDEBUG,
"SO3LineEntityCreateEx\n");
224 int idepth = MMpull(m);
225 int color = MMpull(m);
226 int points = MMpull(m);
227 int name = MMpull(m);
235 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
242 bool disableDepth =
false;
243 if (idepth != NIL && (MTOI(idepth) > 0))
251 lineEntity = scene->CreateLineEntity(MMstartstr(m, MTOP(name)),
false, disableDepth);
260 points = MTOP(points);
261 while (points != NIL)
264 pointTuple = MTOP(MMfetch(m, points, 0));
265 x = MTOF(MMfetch(m, pointTuple, 0));
266 y = MTOF(MMfetch(m, pointTuple, 1));
267 z = MTOF(MMfetch(m, pointTuple, 2));
268 points = MTOP(MMfetch(m, points, 1));
282 catch (Ogre::Exception &e)
284 MMechostr(MSKDEBUG,
"An exception has occurred : %s\n", e.what());
310 MMechostr(MSKDEBUG,
"SO3LineEntityCreateDashedEx\n");
313 int idepth = MMpull(m);
314 int color = MMpull(m);
315 int points = MMpull(m);
316 int name = MMpull(m);
324 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
331 bool disableDepth =
false;
332 if (idepth != NIL && (MTOI(idepth) > 0))
340 lineEntity = scene->CreateLineEntity(MMstartstr(m, MTOP(name)),
true, disableDepth);
349 points = MTOP(points);
350 while (points != NIL)
353 pointTuple = MTOP(MMfetch(m, points, 0));
354 x = MTOF(MMfetch(m, pointTuple, 0));
355 y = MTOF(MMfetch(m, pointTuple, 1));
356 z = MTOF(MMfetch(m, pointTuple, 2));
357 points = MTOP(MMfetch(m, points, 1));
371 catch (Ogre::Exception &e)
373 MMechostr(MSKDEBUG,
"An exception has occurred : %s\n", e.what());
394 MMechostr(MSKDEBUG,
"SO3LineEntityGetDiffuse\n");
396 int obj = MMget(m, 0);
403 SNode* node = MMgetPointer<SNode*>(m, MTOP(obj));
410 if(node->GetNodeType()!=SNode::LINE_ENTITY_TYPE_ID)
421 catch(
const SException&)
423 MMechostr(MSKDEBUG,
"SO3LineEntityGetDiffuse error\n");
442 MMechostr(MSKDEBUG,
"SO3LineEntitySetDiffuse\n");
444 int color = MMpull(m);
445 int obj = MMget(m, 0);
452 SNode* node = MMgetPointer<SNode*>(m, MTOP(obj));
459 if(node->GetNodeType()!=SNode::LINE_ENTITY_TYPE_ID)
471 MMset(m, 0, ITOM(1));
488 MMechostr(MSKDEBUG,
"SO3LineEntityGetPoint\n");
491 int obj = MMget(m, 0);
498 SNode* node = MMgetPointer<SNode*>(m, MTOP(obj));
505 if(node->GetNodeType()!=SNode::LINE_ENTITY_TYPE_ID)
513 SLines* lines = (
static_cast<SLineEntity*
>(node))->GetSLines();
517 idx = lines->GetNumberOfPoints() - 1;
521 int tuple = MMmalloc(m, 3, TYPETAB);
528 Ogre::Vector3 position = lines->GetPoint(idx);
529 MMstore(m, tuple, 0, FTOM((position.x)));
530 MMstore(m, tuple, 1, FTOM((position.y)));
531 MMstore(m, tuple, 2, FTOM((position.z)));
532 MMset(m, 0, PTOM(tuple));
537 catch(
const SException&)
539 MMechostr(MSKDEBUG,
"SO3LineEntityGetPoint error\n");
560 MMechostr(MSKDEBUG,
"SO3LineEntitySetPoint\n");
564 int obj = MMget(m, 0);
565 if((obj==NIL) || (pos==NIL))
571 SNode* node = MMgetPointer<SNode*>(m, MTOP(obj));
578 if(node->GetNodeType()!=SNode::LINE_ENTITY_TYPE_ID)
586 SLines* lines = (
static_cast<SLineEntity*
>(node))->GetSLines();
590 idx = lines->GetNumberOfPoints() - 1;
595 lines->SetPoint(idx, Ogre::Vector3(MTOF(MMfetch(m, pos, 0)), MTOF(MMfetch(m, pos, 1)), MTOF(MMfetch(m, pos, 2))));
598 MMset(m, 0, ITOM(1));
603 catch(
const SException&)
605 MMechostr(MSKDEBUG,
"SO3LineEntitySetPoint error\n");
626 MMechostr(MSKDEBUG,
"SO3LineEntityAddPoint\n");
630 int obj = MMget(m, 0);
631 if((obj==NIL) || (pos==NIL))
637 SNode* node = MMgetPointer<SNode*>(m, MTOP(obj));
644 if(node->GetNodeType()!=SNode::LINE_ENTITY_TYPE_ID)
652 SLines* lines = (
static_cast<SLineEntity*
>(node))->GetSLines();
656 idx = lines->GetNumberOfPoints() - 1;
660 lines->AddPoint(Ogre::Vector3(MTOF(MMfetch(m, pos, 0)), MTOF(MMfetch(m, pos, 1)), MTOF(MMfetch(m, pos, 2))));
662 lines->AddPoint(idx, Ogre::Vector3(MTOF(MMfetch(m, pos, 0)), MTOF(MMfetch(m, pos, 1)), MTOF(MMfetch(m, pos, 2))));
665 MMset(m, 0, ITOM(1));
668 catch(
const SException&)
670 MMechostr(MSKDEBUG,
"SO3LineEntityAddPoint error\n");
689 MMechostr(MSKDEBUG,
"SO3LineEntityRemovePoint\n");
692 int obj = MMget(m, 0);
699 SNode* node = MMgetPointer<SNode*>(m, MTOP(obj));
706 if(node->GetNodeType()!=SNode::LINE_ENTITY_TYPE_ID)
714 SLines* lines = (
static_cast<SLineEntity*
>(node))->GetSLines();
718 idx = lines->GetNumberOfPoints() - 1;
722 lines->RemovePoint(idx);
725 MMset(m, 0, ITOM(1));
730 catch(
const SException&)
732 MMechostr(MSKDEBUG,
"SO3LineEntityRemovePoint error\n");
750 MMechostr(MSKDEBUG,
"SO3LineEntityGetNumberOfPoints\n");
752 int obj = MMget(m, 0);
759 SNode* node = MMgetPointer<SNode*>(m, MTOP(obj));
766 if(node->GetNodeType()!=SNode::LINE_ENTITY_TYPE_ID)
774 SLines* lines = (
static_cast<SLineEntity*
>(node))->GetSLines();
775 MMset(m, 0, ITOM(lines->GetNumberOfPoints()));
778 catch(
const SException&)
780 MMechostr(MSKDEBUG,
"SO3LineEntityGetNumberOfPoints error\n");
798 MMechostr(MSKDEBUG,
"SO3LineEntityGetPoints\n");
800 int obj = MMget(m, 0);
807 SNode* node = MMgetPointer<SNode*>(m, MTOP(obj));
814 if(node->GetNodeType()!=SNode::LINE_ENTITY_TYPE_ID)
824 SLines* lines = (
static_cast<SLineEntity*
>(node))->GetSLines();
826 size_t numberOfPoints = lines->GetNumberOfPoints();
827 if(numberOfPoints > 0)
829 while(counter < numberOfPoints)
831 Ogre::Vector3 position = lines->GetPoint(counter);
832 MMpush(m, FTOM(position.x));
833 MMpush(m, FTOM(position.y));
834 MMpush(m, FTOM(position.z));
842 while(counter < numberOfPoints)
852 catch(
const SException&)
854 MMechostr(MSKDEBUG,
"SO3LineEntityGetPoints error\n");
874 MMechostr(MSKDEBUG,
"SO3LineEntitySetPoints\n");
876 int points = MMpull(m);
877 int obj = MMget(m, 0);
884 SNode* node = MMgetPointer<SNode*>(m, MTOP(obj));
891 if(node->GetNodeType()!=SNode::LINE_ENTITY_TYPE_ID)
900 SLines* lines = (
static_cast<SLineEntity*
>(node))->GetSLines();
909 points = MTOP(points);
913 pointTuple = MTOP(MMfetch(m, points, 0));
914 x = MTOF(MMfetch(m, pointTuple, 0));
915 y = MTOF(MMfetch(m, pointTuple, 1));
916 z = MTOF(MMfetch(m, pointTuple, 2));
917 points = MTOP(MMfetch(m, points, 1));
920 lines->AddPoint(x, y, z);
925 MMset(m, 0, ITOM(1));
929 catch(Ogre::Exception&)
931 MMechostr(MSKDEBUG,
"SO3LineEntitySetPoints error\n");
949 MMechostr(MSKDEBUG,
"SO3LineEntityClearPoints\n");
951 int obj = MMget(m, 0);
958 SNode* node = MMgetPointer<SNode*>(m, MTOP(obj));
965 if(node->GetNodeType()!=SNode::LINE_ENTITY_TYPE_ID)
973 SLines* lines = (
static_cast<SLineEntity*
>(node))->GetSLines();
975 MMset(m, 0, ITOM(1));
978 catch(
const SException&)
980 MMechostr(MSKDEBUG,
"SO3LineEntityClearPoints error\n");
999 MMechostr(MSKDEBUG,
"SO3LineEntitySetDashed\n");
1001 int dash = MMpull(m);
1002 int obj = MMget(m, 0);
1009 SNode* node = MMgetPointer<SNode*>(m, MTOP(obj));
1016 if(node->GetNodeType()!=SNode::LINE_ENTITY_TYPE_ID)
1022 bool dashed =
false;
1024 dashed = (MTOI(dashed) > 1) ?
true :
false;
1028 SLines* lines = (
static_cast<SLineEntity*
>(node))->GetSLines();
1029 lines->SetDashed(dashed);
1030 MMset(m, 0, ITOM(1));
1033 catch(
const SException&)
1035 MMechostr(MSKDEBUG,
"SO3LineEntitySetDashed error\n");
1053 MMechostr(MSKDEBUG,
"SO3LineEntityGetDashed\n");
1055 int obj = MMget(m, 0);
1062 SNode* node = MMgetPointer<SNode*>(m, MTOP(obj));
1069 if(node->GetNodeType()!=SNode::LINE_ENTITY_TYPE_ID)
1077 SLines* lines = (
static_cast<SLineEntity*
>(node))->GetSLines();
1078 MMset(m, 0, ITOM(lines->GetDashed() ? 1 : 0));
1081 catch(
const SException&)
1083 MMechostr(MSKDEBUG,
"SO3LineEntityGetDashed error\n");
1091 {
"SO3LineEntityCreate", 4,
"fun [SO3_SCENE S [[F F F] r1] I] SO3_OBJECT",
SO3LineEntityCreate },
1093 {
"SO3LineEntityCreateEx", 5,
"fun [SO3_SCENE S [[F F F] r1] I I] SO3_OBJECT",
SO3LineEntityCreateEx },
NativeDefinition natSO3Line[]
int SCOLfreeLineEntity()
free the SO3Engine LineEntity function
int SCOLloadLineEntity(mmachine m, cbmachine w)
Load the SO3Engine LineEntity function.
MMechostr(MSKDEBUG, " > Start loading Plugin SO3Engine dll\n")
SCOL_EXPORT int cbmachine w
int createObject(mmachine m, SNode *curNode, SScene *curScene)
void SetColour(const Ogre::ColourValue &newColour)
void AddPoint(const size_t &pointIndex, const Ogre::Vector3 &pt)
int SO3LineEntitySetPoints(mmachine m)
SO3LineEntitySetPoints : Set all the points of the line in a single call.
int SO3LineEntityGetPoints(mmachine m)
SO3LineEntityGetPoints : Retrieves the list of points positions.
int SO3LineEntityRemovePoint(mmachine m)
SO3LineEntityRemovePoint : Removes an existing point on the line, at the indicated position.
int SO3LineEntityCreateDashedEx(mmachine m)
SO3LineEntityCreateDashedEx : Create a new line entity.
int SO3LineEntitySetPoint(mmachine m)
SO3LineEntitySetPoint : Sets the position of an existing point of the line.
int SO3LineEntityGetNumberOfPoints(mmachine m)
SO3LineEntityGetNumberOfPoints : Retrieves the numbers of points composing the line.
int SO3LineEntityGetDashed(mmachine m)
SO3LineEntityGetDashed : Get the drawing mode of the line.
int SO3LineEntityClearPoints(mmachine m)
SO3LineEntityClearPoints : Clear all the points of the line.
int SO3LineEntityGetDiffuse(mmachine m)
SO3LineEntityGetDiffuse : Retrieves the color of the line (RGBA)
int SO3LineEntitySetDashed(mmachine m)
SO3LineEntitySetDashed : Change the drawing mode of the line.
int SO3LineEntityCreate(mmachine m)
main include
int SO3LineEntityAddPoint(mmachine m)
SO3LineEntityAddPoint : Add a new point on the line, after the indicated position.
int SO3LineEntitySetDiffuse(mmachine m)
SO3LineEntitySetDiffuse : Set the color of the line (RGBA)
int SO3LineEntityCreateDashed(mmachine m)
SO3LineEntityCreateDashed : Create a new line entity.
int SO3LineEntityCreateEx(mmachine m)
SO3LineEntityCreateEx : Create a new line entity.
int SO3LineEntityGetPoint(mmachine m)
SO3LineEntityGetPoint : Retrieves the position of an existing point of the line.