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 "animated-mesh.h"
26 #include "animated-mesh-scene-node.h"
27 #include "scene-manager.h"
28 #include "scene-node.h"
35 init_scene_manager (void)
37 init_scene_manager_type ();
38 scm_c_define_gsubr ("add-animated-mesh-scene-node", 8, 0, 0,
39 (scm_t_subr)irr_scene_addAnimatedMeshSceneNode);
40 scm_c_define_gsubr ("get-mesh", 2, 0, 0, (scm_t_subr)irr_scene_getMesh);
43 DEFINE_WRAPPED_TYPE (irr::scene::ISceneManager*, "scene-manager",
44 init_scene_manager_type, scene_manager_p,
45 wrap_scene_manager, unwrap_scene_manager);
48 irr_scene_addAnimatedMeshSceneNode (SCM wrapped_scene_manager,
55 SCM alsoAddIfMeshPointerZero)
57 irr::scene::ISceneManager* smgr = unwrap_scene_manager (wrapped_scene_manager);
58 irr::scene::IAnimatedMeshSceneNode* node =
59 smgr->addAnimatedMeshSceneNode (unwrap_animated_mesh (mesh),
60 scm_is_false (parent) ? 0 : unwrap_scene_node (parent),
62 scm_to_vector3df (position),
63 scm_to_vector3df (rotation),
64 scm_to_vector3df (scale),
65 scm_to_bool (alsoAddIfMeshPointerZero));
66 return wrap_animated_mesh_scene_node (node);
70 irr_scene_getMesh (SCM wrapped_scene_manager,
73 irr::scene::ISceneManager* smgr = unwrap_scene_manager (wrapped_scene_manager);
74 irr::scene::IAnimatedMesh* mesh = smgr->getMesh(scm_to_utf8_stringn (filename, NULL));
75 return wrap_animated_mesh (mesh);