1 /* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine
3 Copyright (C) 2020 Javier Sancho <jsf@jsancho.org>
5 This file is part of guile-irrlicht.
7 guile-irrlicht is free software; you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 3 of the
10 License, or (at your option) any later version.
12 guile-irrlicht is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with guile-irrlicht. If not, see
19 <http://www.gnu.org/licenses/>.
22 #include <irrlicht/irrlicht.h>
25 #include "material-flags.h"
27 #include "scene-node.h"
33 template <typename TSceneNode>
35 ISceneNode_addAnimator (SCM scene_node,
38 TSceneNode node = (TSceneNode) scm_to_irr_pointer (scene_node);
39 node->addAnimator ((scene::ISceneNodeAnimator*) scm_to_irr_pointer (animator));
40 return SCM_UNSPECIFIED;
43 template <typename TSceneNode>
45 ISceneNode_getAbsoluteTransformation (SCM scene_node)
47 TSceneNode node = (TSceneNode) scm_to_irr_pointer (scene_node);
48 return scm_from_matrix4 (node->getAbsoluteTransformation ());
51 template <typename TSceneNode>
53 ISceneNode_getPosition (SCM scene_node)
55 TSceneNode node = (TSceneNode) scm_to_irr_pointer (scene_node);
56 return scm_from_vector3df (node->getPosition ());
59 template <typename TSceneNode>
61 ISceneNode_setMaterialFlag (SCM scene_node,
65 TSceneNode node = (TSceneNode) scm_to_irr_pointer (scene_node);
66 node->setMaterialFlag (scm_to_material_flag (flag), scm_to_bool (newvalue));
67 return SCM_UNSPECIFIED;
70 template <typename TSceneNode>
72 ISceneNode_setMaterialTexture (SCM scene_node,
76 TSceneNode node = (TSceneNode) scm_to_irr_pointer (scene_node);
77 node->setMaterialTexture (scm_to_uint32 (texture_layer),
78 (video::ITexture*) scm_to_irr_pointer (texture));
79 return SCM_UNSPECIFIED;
82 template <typename TSceneNode>
84 ISceneNode_setPosition (SCM scene_node,
87 TSceneNode node = (TSceneNode) scm_to_irr_pointer (scene_node);
88 node->setPosition (scm_to_vector3df (position));
89 return SCM_UNSPECIFIED;
92 template <typename TSceneNode>
94 ISceneNode_setRotation (SCM scene_node,
97 TSceneNode node = (TSceneNode) scm_to_irr_pointer (scene_node);
98 node->setRotation (scm_to_vector3df (rotation));
99 return SCM_UNSPECIFIED;
102 template <typename TSceneNode>
104 ISceneNode_setScale (SCM scene_node,
107 TSceneNode node = (TSceneNode) scm_to_irr_pointer (scene_node);
108 node->setScale (scm_to_vector3df (scale));
109 return SCM_UNSPECIFIED;
113 init_scene_node (void)
115 DEFINE_GSUBR ("IAnimatedMeshSceneNode_addAnimator", 2, 0, 0,
116 ISceneNode_addAnimator<scene::IAnimatedMeshSceneNode*>);
117 DEFINE_GSUBR ("IMeshSceneNode_addAnimator", 2, 0, 0,
118 ISceneNode_addAnimator<scene::IMeshSceneNode*>);
119 DEFINE_GSUBR ("ISceneNode_addAnimator", 2, 0, 0,
120 ISceneNode_addAnimator<scene::ISceneNode*>);
122 DEFINE_GSUBR ("ISceneNode_getAbsoluteTransformation", 1, 0, 0,
123 ISceneNode_getAbsoluteTransformation<scene::ISceneNode*>);
125 DEFINE_GSUBR ("IMeshSceneNode_getPosition", 1, 0, 0,
126 ISceneNode_getPosition<scene::IMeshSceneNode*>);
127 DEFINE_GSUBR ("ISceneNode_getPosition", 1, 0, 0,
128 ISceneNode_getPosition<scene::ISceneNode*>);
130 DEFINE_GSUBR ("IAnimatedMeshSceneNode_setMaterialFlag", 3, 0, 0,
131 ISceneNode_setMaterialFlag<scene::IAnimatedMeshSceneNode*>);
132 DEFINE_GSUBR ("IMeshSceneNode_setMaterialFlag", 3, 0, 0,
133 ISceneNode_setMaterialFlag<scene::IMeshSceneNode*>);
134 DEFINE_GSUBR ("ISceneNode_setMaterialFlag", 3, 0, 0,
135 ISceneNode_setMaterialFlag<scene::ISceneNode*>);
137 DEFINE_GSUBR ("IAnimatedMeshSceneNode_setMaterialTexture", 3, 0, 0,
138 ISceneNode_setMaterialTexture<scene::IAnimatedMeshSceneNode*>);
139 DEFINE_GSUBR ("IMeshSceneNode_setMaterialTexture", 3, 0, 0,
140 ISceneNode_setMaterialTexture<scene::IMeshSceneNode*>);
141 DEFINE_GSUBR ("ISceneNode_setMaterialTexture", 3, 0, 0,
142 ISceneNode_setMaterialTexture<scene::ISceneNode*>);
144 DEFINE_GSUBR ("IMeshSceneNode_setPosition", 2, 0, 0,
145 ISceneNode_setPosition<scene::IMeshSceneNode*>);
146 DEFINE_GSUBR ("ISceneNode_setPosition", 2, 0, 0,
147 ISceneNode_setPosition<scene::ISceneNode*>);
149 DEFINE_GSUBR ("IAnimatedMeshSceneNode_setRotation", 2, 0, 0,
150 ISceneNode_setRotation<scene::IAnimatedMeshSceneNode*>);
151 DEFINE_GSUBR ("ICameraSceneNode_setRotation", 2, 0, 0,
152 ISceneNode_setRotation<scene::ICameraSceneNode*>);
153 DEFINE_GSUBR ("ISceneNode_setRotation", 2, 0, 0,
154 ISceneNode_setRotation<scene::ISceneNode*>);
156 DEFINE_GSUBR ("IAnimatedMeshSceneNode_setScale", 2, 0, 0,
157 ISceneNode_setScale<scene::IAnimatedMeshSceneNode*>);
158 DEFINE_GSUBR ("ISceneNode_setScale", 2, 0, 0,
159 ISceneNode_setScale<scene::ISceneNode*>);