+++ /dev/null
-/* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine
-
- Copyright (C) 2020 Javier Sancho <jsf@jsancho.org>
-
- This file is part of guile-irrlicht.
-
- guile-irrlicht is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 3 of the
- License, or (at your option) any later version.
-
- guile-irrlicht is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with guile-irrlicht. If not, see
- <http://www.gnu.org/licenses/>.
-*/
-
-#include <irrlicht/irrlicht.h>
-#include <libguile.h>
-#include "gsubr.h"
-#include "material-flags.h"
-#include "matrix4.h"
-#include "scene-node.h"
-#include "vector3d.h"
-#include "wrapped.h"
-
-using namespace irr;
-
-template <typename TSceneNode>
-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 <typename TSceneNode>
-SCM
-ISceneNode_getAbsoluteTransformation (SCM scene_node)
-{
- TSceneNode node = (TSceneNode) scm_to_irr_pointer (scene_node);
- return scm_from_matrix4 (node->getAbsoluteTransformation ());
-}
-
-template <typename TSceneNode>
-SCM
-ISceneNode_getPosition (SCM scene_node)
-{
- TSceneNode node = (TSceneNode) scm_to_irr_pointer (scene_node);
- return scm_from_vector3df (node->getPosition ());
-}
-
-template <typename TSceneNode>
-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 <typename TSceneNode>
-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 <typename TSceneNode>
-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 <typename TSceneNode>
-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 <typename TSceneNode>
-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<scene::IAnimatedMeshSceneNode*>);
- DEFINE_GSUBR ("IMeshSceneNode_addAnimator", 2, 0, 0,
- ISceneNode_addAnimator<scene::IMeshSceneNode*>);
- DEFINE_GSUBR ("ISceneNode_addAnimator", 2, 0, 0,
- ISceneNode_addAnimator<scene::ISceneNode*>);
-
- DEFINE_GSUBR ("ISceneNode_getAbsoluteTransformation", 1, 0, 0,
- ISceneNode_getAbsoluteTransformation<scene::ISceneNode*>);
-
- DEFINE_GSUBR ("IMeshSceneNode_getPosition", 1, 0, 0,
- ISceneNode_getPosition<scene::IMeshSceneNode*>);
- DEFINE_GSUBR ("ISceneNode_getPosition", 1, 0, 0,
- ISceneNode_getPosition<scene::ISceneNode*>);
-
- DEFINE_GSUBR ("IAnimatedMeshSceneNode_setMaterialFlag", 3, 0, 0,
- ISceneNode_setMaterialFlag<scene::IAnimatedMeshSceneNode*>);
- DEFINE_GSUBR ("IMeshSceneNode_setMaterialFlag", 3, 0, 0,
- ISceneNode_setMaterialFlag<scene::IMeshSceneNode*>);
- DEFINE_GSUBR ("ISceneNode_setMaterialFlag", 3, 0, 0,
- ISceneNode_setMaterialFlag<scene::ISceneNode*>);
-
- DEFINE_GSUBR ("IAnimatedMeshSceneNode_setMaterialTexture", 3, 0, 0,
- ISceneNode_setMaterialTexture<scene::IAnimatedMeshSceneNode*>);
- DEFINE_GSUBR ("IMeshSceneNode_setMaterialTexture", 3, 0, 0,
- ISceneNode_setMaterialTexture<scene::IMeshSceneNode*>);
- DEFINE_GSUBR ("ISceneNode_setMaterialTexture", 3, 0, 0,
- ISceneNode_setMaterialTexture<scene::ISceneNode*>);
-
- DEFINE_GSUBR ("IMeshSceneNode_setPosition", 2, 0, 0,
- ISceneNode_setPosition<scene::IMeshSceneNode*>);
- DEFINE_GSUBR ("ISceneNode_setPosition", 2, 0, 0,
- ISceneNode_setPosition<scene::ISceneNode*>);
-
- DEFINE_GSUBR ("IAnimatedMeshSceneNode_setRotation", 2, 0, 0,
- ISceneNode_setRotation<scene::IAnimatedMeshSceneNode*>);
- DEFINE_GSUBR ("ICameraSceneNode_setRotation", 2, 0, 0,
- ISceneNode_setRotation<scene::ICameraSceneNode*>);
- DEFINE_GSUBR ("ISceneNode_setRotation", 2, 0, 0,
- ISceneNode_setRotation<scene::ISceneNode*>);
-
- DEFINE_GSUBR ("IAnimatedMeshSceneNode_setScale", 2, 0, 0,
- ISceneNode_setScale<scene::IAnimatedMeshSceneNode*>);
- DEFINE_GSUBR ("ISceneNode_setScale", 2, 0, 0,
- ISceneNode_setScale<scene::ISceneNode*>);
-}