]> git.jsancho.org Git - guile-irrlicht.git/commitdiff
add-cube-scene-node!
authorJavier Sancho <jsf@jsancho.org>
Wed, 8 Apr 2020 18:15:29 +0000 (20:15 +0200)
committerJavier Sancho <jsf@jsancho.org>
Wed, 8 Apr 2020 18:15:29 +0000 (20:15 +0200)
src/scene-manager.cpp
src/scene-manager.h

index 141498939ab340c26cb687e01ed647dec11fdd6e..f7a2b12f094104c9b106c96622e5fe7bdeca5454 100644 (file)
@@ -49,6 +49,8 @@ extern "C" {
                         (scm_t_subr)irr_scene_addCameraSceneNode);
     scm_c_define_gsubr ("add-camera-scene-node-fps!", 1, 0, 1,
                         (scm_t_subr)irr_scene_addCameraSceneNodeFPS);
+    scm_c_define_gsubr ("add-cube-scene-node!", 1, 0, 1,
+                        (scm_t_subr)irr_scene_addCubeSceneNode);
     scm_c_define_gsubr ("add-custom-scene-node!", 5, 0, 1,
                         (scm_t_subr)irr_scene_addCustomSceneNode);
     scm_c_define_gsubr ("add-octree-scene-node!", 2, 0, 1,
@@ -61,10 +63,9 @@ extern "C" {
     scm_c_define_gsubr ("get-root-scene-node", 1, 0, 0, (scm_t_subr)irr_scene_getRootSceneNode);
     scm_c_define_gsubr ("get-scene-manager", 1, 0, 0, (scm_t_subr)irr_getSceneManager);
     scm_c_export ("add-animated-mesh-scene-node!", "add-camera-scene-node!",
-                  "add-camera-scene-node-fps!", "add-custom-scene-node!",
-                  "add-octree-scene-node!", "add-sphere-scene-node!",
-                  "create-rotation-animator", "get-mesh", "get-root-scene-node",
-                  "get-scene-manager", NULL);
+                  "add-camera-scene-node-fps!", "add-custom-scene-node!", "add-cube-scene-node!",
+                  "add-octree-scene-node!", "add-sphere-scene-node!", "create-rotation-animator",
+                  "get-mesh", "get-root-scene-node", "get-scene-manager", NULL);
   }
 
   DEFINE_WRAPPED_TYPE (irr::scene::ISceneManager*, "scene-manager",
@@ -185,6 +186,43 @@ extern "C" {
     return wrap_camera_scene_node (camera);
   }
 
+  SCM
+  irr_scene_addCubeSceneNode (SCM wrapped_scene_manager,
+                              SCM rest)
+  {
+    SCM size = scm_from_double (10);
+    SCM parent = scm_from_bool (0);
+    SCM id = scm_from_int32 (-1);
+    SCM position = scm_list_3 (scm_from_double (0),
+                               scm_from_double (0),
+                               scm_from_double (0));
+    SCM rotation = scm_list_3 (scm_from_double (0),
+                               scm_from_double (0),
+                               scm_from_double (0));
+    SCM scale = scm_list_3 (scm_from_double (1),
+                            scm_from_double (1),
+                            scm_from_double (1));
+
+    scm_c_bind_keyword_arguments ("add-cube-scene-node!", rest, (scm_t_keyword_arguments_flags)0,
+                                  scm_from_utf8_keyword ("size"), &size,
+                                  scm_from_utf8_keyword ("parent"), &parent,
+                                  scm_from_utf8_keyword ("id"), &id,
+                                  scm_from_utf8_keyword ("position"), &position,
+                                  scm_from_utf8_keyword ("rotation"), &rotation,
+                                  scm_from_utf8_keyword ("scale"), &scale,
+                                  SCM_UNDEFINED);
+
+    irr::scene::ISceneManager* smgr = unwrap_scene_manager (wrapped_scene_manager);
+    irr::scene::IMeshSceneNode* node =
+      smgr->addCubeSceneNode (scm_to_double (size),
+                              scm_is_false (parent) ? 0 : unwrap_scene_node (parent),
+                              scm_to_int32 (id),
+                              scm_to_vector3df (position),
+                              scm_to_vector3df (rotation),
+                              scm_to_vector3df (scale));
+    return wrap_mesh_scene_node (node);
+  }
+
   SCM
   irr_scene_addCustomSceneNode (SCM wrapped_scene_manager,
                                 SCM proc_render,
index 7b6e7c536898c0de758f02bb2c3c966189d39fb6..e5ab953c7cecbcb76842d0dc91231e4572331f33 100644 (file)
@@ -47,6 +47,10 @@ extern "C" {
   irr_scene_addCameraSceneNodeFPS (SCM wrapped_scene_manager,
                                    SCM rest);
 
+  SCM
+  irr_scene_addCubeSceneNode (SCM wrapped_scene_manager,
+                              SCM rest);
+
   SCM
   irr_scene_addCustomSceneNode (SCM wrapped_scene_manager,
                                 SCM proc_render,