src/animated-mesh.cpp \
src/animated-mesh-md2.cpp \
src/animated-mesh-scene-node.cpp \
+ src/camera-scene-node.cpp \
src/device.cpp \
src/dimension2d.cpp \
src/driver-types.cpp \
;; load a Quake2 model
(define mesh (get-mesh scene-manager "media/sydney.md2"))
(when (not mesh)
- (device-drop! device)
+ (drop! device)
(exit #f))
-(define node (add-animated-mesh-scene-node scene-manager mesh))
+(define node (add-animated-mesh-scene-node! scene-manager mesh))
(when node
(set-material-flag! node 'lighting #f)
(set-md2-animation! node 'stand)
(end-scene driver))
;; delete device
-(device-drop! device)
+(drop! device)
(exit #t)
(define-module (irrlicht scene)
- #:export (add-animated-mesh-scene-node
+ #:export (add-animated-mesh-scene-node!
+ add-camera-scene-node!
get-mesh
set-material-flag!
set-material-texture!
(load-extension "libguile-irrlicht" "init_guile_irrlicht")
-(define irr-add-animated-mesh-scene-node add-animated-mesh-scene-node)
-(define* (add-animated-mesh-scene-node scene-manager mesh
- #:key
- (parent #f)
- (id -1)
- (position '(0 0 0))
- (rotation '(0 0 0))
- (scale '(1 1 1))
- (also-add-if-mesh-pointer-zero #f))
- (irr-add-animated-mesh-scene-node scene-manager
- mesh
- parent
- id
- position
- rotation
- scale
- also-add-if-mesh-pointer-zero))
+(define irr-add-animated-mesh-scene-node! add-animated-mesh-scene-node!)
+(define* (add-animated-mesh-scene-node! scene-manager mesh
+ #:key
+ (parent #f)
+ (id -1)
+ (position '(0 0 0))
+ (rotation '(0 0 0))
+ (scale '(1 1 1))
+ (also-add-if-mesh-pointer-zero #f))
+ (irr-add-animated-mesh-scene-node! scene-manager
+ mesh
+ parent
+ id
+ position
+ rotation
+ scale
+ also-add-if-mesh-pointer-zero))
+
+(define irr-add-camera-scene-node! add-camera-scene-node!)
+(define* (add-camera-scene-node! scene-manager
+ #:key
+ (parent #f)
+ (position '(0 0 0))
+ (lookat '(0 0 100))
+ (id -1)
+ (make-active #t))
+ (irr-add-camera-scene-node! scene-manager
+ parent
+ position
+ lookat
+ id
+ make-active))
--- /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 "camera-scene-node.h"
+
+extern "C" {
+
+ void
+ init_camera_scene_node (void)
+ {
+ init_camera_scene_node_type ();
+ }
+
+ DEFINE_WRAPPED_TYPE (irr::scene::ICameraSceneNode*, "camera_scene_node",
+ init_camera_scene_node_type, camera_scene_node_p,
+ wrap_camera_scene_node, unwrap_camera_scene_node);
+
+}
--- /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/>.
+*/
+
+#ifndef __GUILE_IRRLICHT_CAMERA_SCENE_NODE_H_INCLUDED__
+#define __GUILE_IRRLICHT_CAMERA_SCENE_NODE_H_INCLUDED__
+
+#include <irrlicht/irrlicht.h>
+#include <libguile.h>
+#include "wrapped.h"
+
+extern "C" {
+
+ void
+ init_camera_scene_node (void);
+
+ DECLARE_WRAPPED_TYPE (irr::scene::ICameraSceneNode*, init_camera_scene_node_type,
+ camera_scene_node_p, wrap_camera_scene_node, unwrap_camera_scene_node);
+
+}
+
+#endif
#include "animated-mesh.h"
#include "animated-mesh-scene-node.h"
+#include "camera-scene-node.h"
#include "device.h"
#include "gui-element.h"
#include "gui-environment.h"
{
init_animated_mesh ();
init_animated_mesh_scene_node ();
+ init_camera_scene_node ();
init_device ();
init_gui_element ();
init_gui_environment ();
#include "animated-mesh.h"
#include "animated-mesh-scene-node.h"
+#include "camera-scene-node.h"
#include "device.h"
#include "scene-manager.h"
#include "scene-node.h"
init_scene_manager (void)
{
init_scene_manager_type ();
- scm_c_define_gsubr ("add-animated-mesh-scene-node", 8, 0, 0,
+ scm_c_define_gsubr ("add-animated-mesh-scene-node!", 8, 0, 0,
(scm_t_subr)irr_scene_addAnimatedMeshSceneNode);
+ scm_c_define_gsubr ("add-camera-scene-node!", 6, 0, 0,
+ (scm_t_subr)irr_scene_addCameraSceneNode);
scm_c_define_gsubr ("get-mesh", 2, 0, 0, (scm_t_subr)irr_scene_getMesh);
scm_c_define_gsubr ("get-scene-manager", 1, 0, 0, (scm_t_subr)irr_getSceneManager);
}
init_scene_manager_type, scene_manager_p,
wrap_scene_manager, unwrap_scene_manager);
- SCM
- irr_getSceneManager (SCM wrapped_obj)
- {
- irr::scene::ISceneManager* scene_manager;
- if (device_p (wrapped_obj))
- {
- scene_manager = unwrap_device (wrapped_obj)->getSceneManager ();
- }
- else
- {
- scm_error (scm_arg_type_key, NULL, "Cannot get scene manager from object: ~S",
- scm_list_1 (wrapped_obj), scm_list_1 (wrapped_obj));
- }
- return wrap_scene_manager (scene_manager);
- }
-
SCM
irr_scene_addAnimatedMeshSceneNode (SCM wrapped_scene_manager,
SCM mesh,
return wrap_animated_mesh_scene_node (node);
}
+ SCM
+ irr_scene_addCameraSceneNode (SCM wrapped_scene_manager,
+ SCM parent,
+ SCM position,
+ SCM lookat,
+ SCM id,
+ SCM make_active)
+ {
+ irr::scene::ISceneManager* scene_manager = unwrap_scene_manager (wrapped_scene_manager);
+ irr::scene::ICameraSceneNode* camera =
+ scene_manager->addCameraSceneNode (scm_is_false (parent) ? 0 : unwrap_scene_node (parent),
+ scm_to_vector3df (position),
+ scm_to_vector3df (lookat),
+ scm_to_int32 (id),
+ scm_to_bool (make_active));
+ return wrap_camera_scene_node (camera);
+ }
+
SCM
irr_scene_getMesh (SCM wrapped_scene_manager,
SCM filename)
return wrap_animated_mesh (mesh);
}
+ SCM
+ irr_getSceneManager (SCM wrapped_obj)
+ {
+ irr::scene::ISceneManager* scene_manager;
+ if (device_p (wrapped_obj))
+ {
+ scene_manager = unwrap_device (wrapped_obj)->getSceneManager ();
+ }
+ else
+ {
+ scm_error (scm_arg_type_key, NULL, "Cannot get scene manager from object: ~S",
+ scm_list_1 (wrapped_obj), scm_list_1 (wrapped_obj));
+ }
+ return wrap_scene_manager (scene_manager);
+ }
+
}
DECLARE_WRAPPED_TYPE (irr::scene::ISceneManager*, init_scene_manager_type,
scene_manager_p, wrap_scene_manager, unwrap_scene_manager);
- SCM
- irr_getSceneManager (SCM wrapped_obj);
-
SCM
irr_scene_addAnimatedMeshSceneNode (SCM wrapped_scene_manager,
SCM mesh,
SCM rotation,
SCM scale,
SCM alsoAddIfMeshPointerZero);
+
+ SCM
+ irr_scene_addCameraSceneNode (SCM wrapped_scene_manager,
+ SCM parent,
+ SCM position,
+ SCM lookat,
+ SCM id,
+ SCM make_active);
+
SCM
irr_scene_getMesh (SCM wrapped_scene_manager,
SCM filename);
+ SCM
+ irr_getSceneManager (SCM wrapped_obj);
+
}
#endif