X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=src%2Fscene-node.cpp;h=3700818f4c290eeeea6dff21c33f046347b87e7e;hb=3bb58c2b45af12c0f9c9eac648e67ac6fa90e104;hp=d392aba5200a332fe60ff4c25018723f8f4b16b6;hpb=2806f03eafc48ec9ef02a3dc2d74133eaf11ccc1;p=guile-irrlicht.git diff --git a/src/scene-node.cpp b/src/scene-node.cpp index d392aba..3700818 100644 --- a/src/scene-node.cpp +++ b/src/scene-node.cpp @@ -21,19 +21,140 @@ #include #include +#include "gsubr.h" +#include "material-flags.h" +#include "matrix4.h" #include "scene-node.h" +#include "vector3d.h" #include "wrapped.h" -extern "C" { +using namespace irr; - void - init_scene_node (void) - { - init_scene_node_type (); - } +template +SCM +ISceneNode_addAnimator (SCM scene_node, + SCM animator) +{ + TSceneNode node = (TSceneNode) scm_to_irr_pointer (scene_node); + node->addAnimator ((scene::ISceneNodeAnimator*) scm_to_irr_pointer (animator)); + return SCM_UNSPECIFIED; +} + +template +SCM +ISceneNode_getAbsoluteTransformation (SCM scene_node) +{ + TSceneNode node = (TSceneNode) scm_to_irr_pointer (scene_node); + return scm_from_matrix4 (node->getAbsoluteTransformation ()); +} + +template +SCM +ISceneNode_getPosition (SCM scene_node) +{ + TSceneNode node = (TSceneNode) scm_to_irr_pointer (scene_node); + return scm_from_vector3df (node->getPosition ()); +} + +template +SCM +ISceneNode_setMaterialFlag (SCM scene_node, + SCM flag, + SCM newvalue) +{ + TSceneNode node = (TSceneNode) scm_to_irr_pointer (scene_node); + node->setMaterialFlag (scm_to_material_flag (flag), scm_to_bool (newvalue)); + return SCM_UNSPECIFIED; +} + +template +SCM +ISceneNode_setMaterialTexture (SCM scene_node, + SCM texture_layer, + SCM texture) +{ + TSceneNode node = (TSceneNode) scm_to_irr_pointer (scene_node); + node->setMaterialTexture (scm_to_uint32 (texture_layer), + (video::ITexture*) scm_to_irr_pointer (texture)); + return SCM_UNSPECIFIED; +} + +template +SCM +ISceneNode_setPosition (SCM scene_node, + SCM position) +{ + TSceneNode node = (TSceneNode) scm_to_irr_pointer (scene_node); + node->setPosition (scm_to_vector3df (position)); + return SCM_UNSPECIFIED; +} + +template +SCM +ISceneNode_setRotation (SCM scene_node, + SCM rotation) +{ + TSceneNode node = (TSceneNode) scm_to_irr_pointer (scene_node); + node->setRotation (scm_to_vector3df (rotation)); + return SCM_UNSPECIFIED; +} + +template +SCM +ISceneNode_setScale (SCM scene_node, + SCM scale) +{ + TSceneNode node = (TSceneNode) scm_to_irr_pointer (scene_node); + node->setScale (scm_to_vector3df (scale)); + return SCM_UNSPECIFIED; +} + +void +init_scene_node (void) +{ + DEFINE_GSUBR ("IAnimatedMeshSceneNode_addAnimator", 2, 0, 0, + ISceneNode_addAnimator); + DEFINE_GSUBR ("IMeshSceneNode_addAnimator", 2, 0, 0, + ISceneNode_addAnimator); + DEFINE_GSUBR ("ISceneNode_addAnimator", 2, 0, 0, + ISceneNode_addAnimator); + + DEFINE_GSUBR ("ISceneNode_getAbsoluteTransformation", 1, 0, 0, + ISceneNode_getAbsoluteTransformation); + + DEFINE_GSUBR ("IMeshSceneNode_getPosition", 1, 0, 0, + ISceneNode_getPosition); + DEFINE_GSUBR ("ISceneNode_getPosition", 1, 0, 0, + ISceneNode_getPosition); + + DEFINE_GSUBR ("IAnimatedMeshSceneNode_setMaterialFlag", 3, 0, 0, + ISceneNode_setMaterialFlag); + DEFINE_GSUBR ("IMeshSceneNode_setMaterialFlag", 3, 0, 0, + ISceneNode_setMaterialFlag); + DEFINE_GSUBR ("ISceneNode_setMaterialFlag", 3, 0, 0, + ISceneNode_setMaterialFlag); + + DEFINE_GSUBR ("IAnimatedMeshSceneNode_setMaterialTexture", 3, 0, 0, + ISceneNode_setMaterialTexture); + DEFINE_GSUBR ("IMeshSceneNode_setMaterialTexture", 3, 0, 0, + ISceneNode_setMaterialTexture); + DEFINE_GSUBR ("ISceneNode_setMaterialTexture", 3, 0, 0, + ISceneNode_setMaterialTexture); + + DEFINE_GSUBR ("IMeshSceneNode_setPosition", 2, 0, 0, + ISceneNode_setPosition); + DEFINE_GSUBR ("ISceneNode_setPosition", 2, 0, 0, + ISceneNode_setPosition); - DEFINE_WRAPPED_TYPE (irr::scene::ISceneNode*, "scene-node", - init_scene_node_type, scene_node_p, - wrap_scene_node, unwrap_scene_node); + DEFINE_GSUBR ("IAnimatedMeshSceneNode_setRotation", 2, 0, 0, + ISceneNode_setRotation); + DEFINE_GSUBR ("ICameraSceneNode_setRotation", 2, 0, 0, + ISceneNode_setRotation); + DEFINE_GSUBR ("ISceneNode_setRotation", 2, 0, 0, + ISceneNode_setRotation); + DEFINE_GSUBR ("IAnimatedMeshSceneNode_setScale", 2, 0, 0, + ISceneNode_setScale); + DEFINE_GSUBR ("ISceneNode_setScale", 2, 0, 0, + ISceneNode_setScale); }