]> git.jsancho.org Git - guile-irrlicht.git/blobdiff - src/scene-manager.cpp
create-fly-straight-animator
[guile-irrlicht.git] / src / scene-manager.cpp
index f5d1bf7c8315d403ddc13045f0d002b23d4f0178..9ef592fcbfaa10972e78b68010cda494265d9632 100644 (file)
@@ -49,20 +49,28 @@ 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,
                         (scm_t_subr)irr_scene_addOctreeSceneNode);
+    scm_c_define_gsubr ("add-sphere-scene-node!", 1, 0, 1,
+                        (scm_t_subr)irr_scene_addSphereSceneNode);
+    scm_c_define_gsubr ("create-fly-circle-animator", 1, 0, 1,
+                        (scm_t_subr)irr_scene_createFlyCircleAnimator);
+    scm_c_define_gsubr ("create-fly-straight-animator", 4, 0, 1,
+                        (scm_t_subr)irr_scene_createFlyStraightAnimator);
     scm_c_define_gsubr ("create-rotation-animator", 2, 0, 0,
                         (scm_t_subr)irr_scene_createRotationAnimator);
     scm_c_define_gsubr ("get-mesh", 2, 0, 0, (scm_t_subr)irr_scene_getMesh);
     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!", "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-fly-circle-animator",
+                  "create-fly-straight-animator", "create-rotation-animator", "get-mesh",
+                  "get-root-scene-node", "get-scene-manager", NULL);
   }
 
   DEFINE_WRAPPED_TYPE (irr::scene::ISceneManager*, "scene-manager",
@@ -183,6 +191,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,
@@ -323,13 +368,113 @@ extern "C" {
     return wrap_mesh_scene_node (node);
   }
 
+  SCM
+  irr_scene_addSphereSceneNode (SCM wrapped_scene_manager,
+                                SCM rest)
+  {
+    SCM radius = scm_from_double (5.0);
+    SCM poly_count = scm_from_int32 (16);
+    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-sphere-scene-node!", rest, (scm_t_keyword_arguments_flags)0,
+                                  scm_from_utf8_keyword ("radius"), &radius,
+                                  scm_from_utf8_keyword ("poly-count"), &poly_count,
+                                  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->addSphereSceneNode (scm_to_double (radius),
+                                scm_to_int32 (poly_count),
+                                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_createFlyCircleAnimator (SCM wrapped_scene_manager,
+                                     SCM rest)
+  {
+    SCM center = scm_list_3 (scm_from_double (0),
+                             scm_from_double (0),
+                             scm_from_double (0));
+    SCM radius = scm_from_double (100);
+    SCM speed = scm_from_double (0.001);
+    SCM direction = scm_list_3 (scm_from_double (0),
+                                scm_from_double (1),
+                                scm_from_double (0));
+    SCM start_position = scm_from_double (0);
+    SCM radius_ellipsoid = scm_from_double (0);
+
+    scm_c_bind_keyword_arguments ("create-fly-circle-animator", rest, (scm_t_keyword_arguments_flags)0,
+                                  scm_from_utf8_keyword ("center"), &center,
+                                  scm_from_utf8_keyword ("radius"), &radius,
+                                  scm_from_utf8_keyword ("speed"), &speed,
+                                  scm_from_utf8_keyword ("direction"), &direction,
+                                  scm_from_utf8_keyword ("start-position"), &start_position,
+                                  scm_from_utf8_keyword ("radius-ellipsoid"), &radius_ellipsoid,
+                                  SCM_UNDEFINED);
+
+    irr::scene::ISceneManager* smgr = unwrap_scene_manager (wrapped_scene_manager);
+    irr::scene::ISceneNodeAnimator* anim =
+      smgr->createFlyCircleAnimator (scm_to_vector3df (center),
+                                     scm_to_double (radius),
+                                     scm_to_double (speed),
+                                     scm_to_vector3df (direction),
+                                     scm_to_double (start_position),
+                                     scm_to_double (radius_ellipsoid));
+    return wrap_scene_node_animator (anim);
+  }
+
+  SCM
+  irr_scene_createFlyStraightAnimator (SCM wrapped_scene_manager,
+                                       SCM start_point,
+                                       SCM end_point,
+                                       SCM time_for_way,
+                                       SCM rest)
+  {
+    SCM loop = scm_from_bool (0);
+    SCM pingpong = scm_from_bool (0);
+
+    scm_c_bind_keyword_arguments ("create-fly-straight-animator", rest, (scm_t_keyword_arguments_flags)0,
+                                  scm_from_utf8_keyword ("loop"), &loop,
+                                  scm_from_utf8_keyword ("pingpong"), &pingpong,
+                                  SCM_UNDEFINED);
+
+    irr::scene::ISceneManager* smgr = unwrap_scene_manager (wrapped_scene_manager);
+    irr::scene::ISceneNodeAnimator* anim =
+      smgr->createFlyStraightAnimator (scm_to_vector3df (start_point),
+                                       scm_to_vector3df (end_point),
+                                       scm_to_uint32 (time_for_way),
+                                       scm_to_bool (loop),
+                                       scm_to_bool (pingpong));
+    return wrap_scene_node_animator (anim);
+  }
+
   SCM
   irr_scene_createRotationAnimator (SCM wrapped_scene_manager,
                                     SCM rotation_speed)
   {
     irr::scene::ISceneManager* smgr = unwrap_scene_manager (wrapped_scene_manager);
     irr::scene::ISceneNodeAnimator* anim =
-      smgr->createRotationAnimator(scm_to_vector3df (rotation_speed));
+      smgr->createRotationAnimator (scm_to_vector3df (rotation_speed));
     return wrap_scene_node_animator (anim);
   }