63 SScene* scene = MMgetPointer<SScene*>(m, MTOP(s));
71 std::string tmpLightName(MMstartstr(m,MTOP(name)));
76 light = scene->CreateLight(tmpLightName);
78 catch(Ogre::Exception &e)
80 MMechostr(MSKDEBUG,
"An exception has occurred : %s\n",e.what());
108 MMechostr(MSKDEBUG,
"SO3LightSetType\n");
111 int type = MMpull(m);
113 if ((type==NIL)||(l==NIL))
120 SNode* node = MMgetPointer<SNode*>(m, MTOP(l));
127 if (node->GetNodeType() != SNode::LIGHT_TYPE_ID)
133 SLight* light =
static_cast<SLight*
>(node);
135 light->SetType(
static_cast <SLight::LightType
> (MTOI(type)));
137 MMset(m, 0, ITOM(1));
160 MMechostr(MSKDEBUG,
"SO3LightGetType\n");
171 SNode* node = MMgetPointer<SNode*>(m, MTOP(l));
178 if (node->GetNodeType() != SNode::LIGHT_TYPE_ID)
184 SLight* light =
static_cast<SLight*
>(node);
186 int type =
static_cast <int> (light->GetType());
187 MMset(m, 0, ITOM(type));
204 MMechostr(MSKDEBUG,
"SO3LightSetDiffuseColor\n");
207 int diffuse = MMpull(m);
209 if ((l==NIL)||(diffuse==NIL))
215 SNode* node = MMgetPointer<SNode*>(m, MTOP(l));
222 if (node->GetNodeType() != SNode::LIGHT_TYPE_ID)
228 SLight* light =
static_cast<SLight*
>(node);
230 light->SetDiffuseColour(MTOI(diffuse));
231 MMset(m, 0, ITOM(1));
247 MMechostr(MSKDEBUG,
"SO3LightGetDiffuseColor\n");
257 SNode* node = MMgetPointer<SNode*>(m, MTOP(l));
264 if (node->GetNodeType() != SNode::LIGHT_TYPE_ID)
270 SLight* light =
static_cast<SLight*
>(node);
271 int val = light->GetDiffuseColour();
272 MMset(m, 0, ITOM(val));
289 MMechostr(MSKDEBUG,
"SO3LightSetPowerScale\n");
294 if ((l==NIL)||(pow==NIL))
300 SNode* node = MMgetPointer<SNode*>(m, MTOP(l));
307 if (node->GetNodeType() != SNode::LIGHT_TYPE_ID)
313 SLight* light =
static_cast<SLight*
>(node);
315 light->SetPowerScale(MTOF(pow));
316 MMset(m, 0, ITOM(1));
334 MMechostr(MSKDEBUG,
"SO3LightSetShadowFarDistance\n");
339 if ((l==NIL)||(d==NIL))
345 SNode* node = MMgetPointer<SNode*>(m, MTOP(l));
352 if (node->GetNodeType() != SNode::LIGHT_TYPE_ID)
358 SLight* light =
static_cast<SLight*
>(node);
360 light->SetShadowFarDistance(MTOF(d));
361 MMset(m, 0, ITOM(1));
378 MMechostr(MSKDEBUG,
"SO3LightGetPowerScale\n");
388 SNode* node = MMgetPointer<SNode*>(m, MTOP(l));
395 if (node->GetNodeType() != SNode::LIGHT_TYPE_ID)
401 SLight* light =
static_cast<SLight*
>(node);
403 float pow = light->GetPowerScale();
404 MMset(m, 0, FTOM(pow));
421 MMechostr(MSKDEBUG,
"SO3LightGetShadowFarDistance\n");
431 SNode* node = MMgetPointer<SNode*>(m, MTOP(l));
438 if (node->GetNodeType() != SNode::LIGHT_TYPE_ID)
444 SLight* light =
static_cast<SLight*
>(node);
446 float d = light->GetShadowFarDistance();
447 MMset(m, 0, FTOM(d));
465 MMechostr(MSKDEBUG,
"SO3LightSetVisible\n");
468 int v = MTOI(MMpull(m));
476 SNode* node = MMgetPointer<SNode*>(m, MTOP(l));
483 if (node->GetNodeType() != SNode::LIGHT_TYPE_ID)
489 SLight* light =
static_cast<SLight*
>(node);
492 light->SetVisible(
false);
494 light->SetVisible(
true);
496 MMset(m, 0, ITOM(1));
512 MMechostr(MSKDEBUG,
"SO3LightGetVisible\n");
522 SNode* node = MMgetPointer<SNode*>(m, MTOP(l));
529 if (node->GetNodeType() != SNode::LIGHT_TYPE_ID)
535 SLight* light =
static_cast<SLight*
>(node);
539 if (light->GetVisible())
542 MMset(m, 0, ITOM(val));
560 MMechostr(MSKDEBUG,
"SO3LightSetVolumetric\n");
563 int v = MTOI(MMpull(m));
571 SNode* node = MMgetPointer<SNode*>(m, MTOP(l));
578 if (node->GetNodeType() != SNode::LIGHT_TYPE_ID)
584 SLight* light =
static_cast<SLight*
>(node);
587 light->SetVolumetric(
false);
589 light->SetVolumetric(
true);
591 MMset(m, 0, ITOM(1));
607 MMechostr(MSKDEBUG,
"SO3LightGetVolumetric\n");
617 SNode* node = MMgetPointer<SNode*>(m, MTOP(l));
624 if (node->GetNodeType() != SNode::LIGHT_TYPE_ID)
630 SLight* light =
static_cast<SLight*
>(node);
634 if (light->GetVolumetric())
637 MMset(m, 0, ITOM(val));
655 MMechostr(MSKDEBUG,
"SO3LightSetAttenuation\n");
658 int param = MMpull(m);
660 if ((l==NIL)||(
param==NIL))
666 SNode* node = MMgetPointer<SNode*>(m, MTOP(l));
673 if (node->GetNodeType() != SNode::LIGHT_TYPE_ID)
679 SLight* light =
static_cast<SLight*
>(node);
681 light->SetAttenuation(MTOF(MMfetch(m, MTOI(
param), 0)),
682 MTOF(MMfetch(m, MTOI(
param), 1)),
683 MTOF(MMfetch(m, MTOI(
param), 2)),
684 MTOF(MMfetch(m, MTOI(
param), 3)));
686 MMset(m, 0, ITOM(1));
703 MMechostr(MSKDEBUG,
"SO3LightSetAttenuationAuto\n");
706 int irange = MMpull(m);
708 if ((irange == NIL) || (l == NIL))
714 SNode* node = MMgetPointer<SNode*>(m, MTOP(l));
721 if (node->GetNodeType() != SNode::LIGHT_TYPE_ID)
727 SLight* light =
static_cast<SLight*
>(node);
728 light->SetAttenuation(MTOF(irange));
729 MMset(m, 0, ITOM(1));
746 MMechostr(MSKDEBUG,
"SO3LightGetAttenuation\n");
756 SNode* node = MMgetPointer<SNode*>(m, MTOP(l));
763 if (node->GetNodeType() != SNode::LIGHT_TYPE_ID)
769 SLight* light =
static_cast<SLight*
>(node);
771 Ogre::Vector4 attenuation = light->GetAttenuation();
773 int tuple = MMmalloc(m, 4, TYPETAB);
780 MMstore(m, tuple, 0, FTOM(attenuation.x));
781 MMstore(m, tuple, 1, FTOM(attenuation.y));
782 MMstore(m, tuple, 2, FTOM(attenuation.z));
783 MMstore(m, tuple, 3, FTOM(attenuation.w));
784 MMset(m, 0, PTOM(tuple));
802 MMechostr(MSKDEBUG,
"SO3LightSetSpecularColor\n");
805 int specular = MMpull(m);
807 if ((l==NIL)||(specular==NIL))
813 SNode* node = MMgetPointer<SNode*>(m, MTOP(l));
820 if (node->GetNodeType() != SNode::LIGHT_TYPE_ID)
826 SLight* light =
static_cast<SLight*
>(node);
828 light->SetSpecularColour(MTOI(specular));
830 MMset(m, 0, ITOM(1));
847 MMechostr(MSKDEBUG,
"SO3LightGetSpecularColor\n");
857 SNode* node = MMgetPointer<SNode*>(m, MTOP(l));
864 if (node->GetNodeType() != SNode::LIGHT_TYPE_ID)
870 SLight* light =
static_cast<SLight*
>(node);
872 int val = light->GetSpecularColour();
873 MMset(m, 0, ITOM(val));
891 MMechostr(MSKDEBUG,
"SO3LightSetSpotFallOff\n");
896 if ((l==NIL)||(fal==NIL))
902 SNode* node = MMgetPointer<SNode*>(m, MTOP(l));
909 if (node->GetNodeType() != SNode::LIGHT_TYPE_ID)
915 SLight* light =
static_cast<SLight*
>(node);
917 light->SetSpotlightFalloff(MTOF(fal));
918 MMset(m, 0, ITOM(1));
935 MMechostr(MSKDEBUG,
"SO3LightGetSpotFallOff\n");
945 SNode* node = MMgetPointer<SNode*>(m, MTOP(l));
952 if (node->GetNodeType() != SNode::LIGHT_TYPE_ID)
958 SLight* light =
static_cast<SLight*
>(node);
960 float f = light->GetSpotlightFalloff();
961 MMset(m, 0, FTOM(f));
979 MMechostr(MSKDEBUG,
"SO3LightSetSpotInnerAngle\n");
984 if ((l==NIL)||(ang==NIL))
990 SNode* node = MMgetPointer<SNode*>(m, MTOP(l));
997 if (node->GetNodeType() != SNode::LIGHT_TYPE_ID)
1003 SLight* light =
static_cast<SLight*
>(node);
1005 light->SetSpotlightInnerAngle(MTOF(ang));
1007 MMset(m, 0, ITOM(1));
1025 MMechostr(MSKDEBUG,
"SO3LightSetSpotOuterAngle\n");
1028 int ang = MMpull(m);
1029 int l = MMget(m, 0);
1030 if ((l==NIL)||(ang==NIL))
1036 SNode* node = MMgetPointer<SNode*>(m, MTOP(l));
1043 if (node->GetNodeType() != SNode::LIGHT_TYPE_ID)
1049 SLight* light =
static_cast<SLight*
>(node);
1051 light->SetSpotlightOuterAngle(MTOF(ang));
1053 MMset(m, 0, ITOM(1));
1071 MMechostr(MSKDEBUG,
"SO3LightSetSpotRange\n");
1074 int param = MMpull(m);
1075 int l = MMget(m, 0);
1076 if ((l==NIL)||(
param==NIL))
1082 SNode* node = MMgetPointer<SNode*>(m, MTOP(l));
1089 if (node->GetNodeType() != SNode::LIGHT_TYPE_ID)
1095 SLight* light =
static_cast<SLight*
>(node);
1097 if((MMfetch(m,MTOP(
param),0)==NIL) || (MMfetch(m,MTOP(
param),1)==NIL) || (MMfetch(m,MTOP(
param),2)==NIL))
1103 light->SetSpotlightInnerAngle(MTOF(MMfetch(m, MTOP(
param), 0)));
1104 light->SetSpotlightOuterAngle(MTOF(MMfetch(m, MTOP(
param), 1)));
1105 light->SetSpotlightFalloff(MTOF(MMfetch(m, MTOP(
param), 2)));
1107 MMset(m, 0, ITOM(1));
1124 MMechostr(MSKDEBUG,
"SO3LightGetSpotInnerAngle\n");
1127 int l = MMget(m, 0);
1134 SNode* node = MMgetPointer<SNode*>(m, MTOP(l));
1141 if (node->GetNodeType() != SNode::LIGHT_TYPE_ID)
1147 SLight* light =
static_cast<SLight*
>(node);
1149 float inner = light->GetSpotlightInnerAngle();
1150 MMset(m, 0, FTOM(inner));
1167 MMechostr(MSKDEBUG,
"SO3LightGetSpotOuterAngle\n");
1170 int l = MMget(m, 0);
1177 SNode* node = MMgetPointer<SNode*>(m, MTOP(l));
1184 if (node->GetNodeType() != SNode::LIGHT_TYPE_ID)
1190 SLight* light =
static_cast<SLight*
>(node);
1192 float f = light->GetSpotlightOuterAngle();
1193 MMset(m, 0, FTOM(f));
1211 MMechostr(MSKDEBUG,
"SO3LightSetSourceSize\n");
1214 int param = MMpull(m);
1215 int l = MMget(m, 0);
1216 if ((l == NIL) || (
param == NIL))
1222 SNode* node = MMgetPointer<SNode*>(m, MTOP(l));
1229 if (node->GetNodeType() != SNode::LIGHT_TYPE_ID)
1235 SLight* light =
static_cast<SLight*
>(node);
1236 if ((MMfetch(m, MTOP(
param), 0) == NIL) || (MMfetch(m, MTOP(
param), 1) == NIL))
1242 light->SetSourceSize(MTOF(MMfetch(m, MTOP(
param), 0)), MTOF(MMfetch(m, MTOP(
param), 1)));
1243 MMset(m, 0, ITOM(1));
1260 MMechostr(MSKDEBUG,
"SO3LightGetSourceSize\n");
1263 int l = MMget(m, 0);
1270 SNode* node = MMgetPointer<SNode*>(m, MTOP(l));
1277 if (node->GetNodeType() != SNode::LIGHT_TYPE_ID)
1283 SLight* light =
static_cast<SLight*
>(node);
1284 Ogre::Vector2f src = light->GetSourceSize();
1286 int tuple = MMmalloc(m, 2, TYPETAB);
1293 MMstore(m, tuple, 0, FTOM(src.x));
1294 MMstore(m, tuple, 1, FTOM(src.y));
1295 MMset(m, 0, PTOM(tuple));
1302 {
"SO3LightCreate", 2,
"fun [SO3_SCENE S] SO3_OBJECT",
SO3LightCreate },
int SCOLloadLight(mmachine m, cbmachine w)
Load the SO3Engine Lights function.
int SCOLfreeLight()
free the SO3Engine Lights function
NativeDefinition natSO3Light[]
MMechostr(MSKDEBUG, " > Start loading Plugin SO3Engine dll\n")
SCOL_EXPORT int cbmachine w
SCOL_EXPORT void SCOL_PTR_TYPE param
int createObject(mmachine m, SNode *curNode, SScene *curScene)
int SO3LightSetAttenuationAuto(mmachine m)
SO3LightSetAttenuationAuto : defines attenuation coefficients for a light automatically,...
int SO3LightSetSpotRange(mmachine m)
SO3LightSetSpotRange : defines spot range of a spot light.
int SO3LightGetSourceSize(mmachine m)
SO3LightGetSourceSize : get the source size of a rect light.
int SO3LightSetType(mmachine m)
SO3LightSetType : Defines the type of light.
int SO3LightGetVolumetric(mmachine m)
SO3LightGetVolumetric : Get the volumetric state of a light.
int SO3LightGetAttenuation(mmachine m)
SO3LightGetAttenuation : Get the attenuation coefficients for a light.
int SO3LightGetVisible(mmachine m)
SO3LightGetVisible : Get the visibility state of a light.
int SO3LightSetPowerScale(mmachine m)
SO3LightSetPowerScale : defines power scale of a light.
int SO3LightSetSpotOuterAngle(mmachine m)
SO3LightSetSpotOuterAngle : defines spot outer angle of a spot light.
int SO3LightSetVolumetric(mmachine m)
SO3LightSetVolumetric : defines if a light is displayed as a volumetric light.
int SO3LightGetType(mmachine m)
SO3LightGetType : Returns the type of light.
int SO3LightGetShadowFarDistance(mmachine m)
SO3LightGetShadowFarDistance : Get the shadow far distance of a light.
int SO3LightGetSpotOuterAngle(mmachine m)
SO3LightGetSpotOuterAngle : Get the spot outer angle of a spot light.
int SO3LightGetSpecularColor(mmachine m)
SO3LightGetSpecularColor : Get the specular color of a light.
int SO3LightSetAttenuation(mmachine m)
SO3LightSetAttenuation : defines attenuation coefficients for a light.
int SO3LightSetDiffuseColor(mmachine m)
SO3LightSetDiffuseColor : defines diffuse color of a light.
int SO3LightSetVisible(mmachine m)
SO3LightSetVisible : defines visibility state of a light.
int SO3LightSetSpotInnerAngle(mmachine m)
SO3LightSetSpotInnerAngle : defines spot inner angle of a spot light.
int SO3LightGetPowerScale(mmachine m)
SO3LightGetPowerScale : Get the power scale of a light.
int SO3LightCreate(mmachine m)
main include
int SO3LightGetDiffuseColor(mmachine m)
SO3LightGetDiffuseColor : Get the diffuse color of a light.
int SO3LightSetSpecularColor(mmachine m)
SO3LightSetSpecularColor : defines specular color of a light.
int SO3LightSetSpotFallOff(mmachine m)
SO3LightSetSpotFallOff : defines spot fall off of a spot light.
int SO3LightGetSpotFallOff(mmachine m)
SO3LightGetSpotFallOff : Get the spot fall off of a spot light.
int SO3LightSetSourceSize(mmachine m)
SO3LightSetSourceSize : defines the source size of a rect light.
int SO3LightGetSpotInnerAngle(mmachine m)
SO3LightGetSpotInnerAngle : Get the spot inner angle of a spot light.
int SO3LightSetShadowFarDistance(mmachine m)
SO3LightSetShadowFarDistance : defines shadows far distance of a light.