]> git.jsancho.org Git - guile-irrlicht.git/blobdiff - src/scene-manager.cpp
clean code
[guile-irrlicht.git] / src / scene-manager.cpp
index d5b9e6cf18f529b0b58dd3c1cefcabd58aa9871c..427faf57c5e7fb0b9031086d2d2412e2fe5b8b65 100644 (file)
 #include "scene-manager.h"
 #include "vector3d.h"
 
-
 using namespace irr;
 
-
 template <typename TParent>
 SCM
-scene_ISceneManager_addAnimatedMeshSceneNode (SCM scene_manager,
-                                              SCM mesh,
-                                              SCM parent,
-                                              SCM id,
-                                              SCM position,
-                                              SCM rotation,
-                                              SCM scale,
-                                              SCM also_add_if_mesh_pointer_zero)
+ISceneManager_addAnimatedMeshSceneNode (SCM scene_manager,
+                                        SCM mesh,
+                                        SCM parent,
+                                        SCM id,
+                                        SCM position,
+                                        SCM rotation,
+                                        SCM scale,
+                                        SCM also_add_if_mesh_pointer_zero)
 {
   scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_pointer (scene_manager);
   scene::IAnimatedMeshSceneNode* node =
@@ -52,15 +50,14 @@ scene_ISceneManager_addAnimatedMeshSceneNode (SCM scene_manager,
   return scm_from_pointer ((void*) node, NULL);
 }
 
-
 template <typename TParent>
 SCM
-scene_ISceneManager_addCameraSceneNode (SCM scene_manager,
-                                        SCM parent,
-                                        SCM position,
-                                        SCM lookat,
-                                        SCM id,
-                                        SCM make_active)
+ISceneManager_addCameraSceneNode (SCM scene_manager,
+                                  SCM parent,
+                                  SCM position,
+                                  SCM lookat,
+                                  SCM id,
+                                  SCM make_active)
 {
   scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_pointer (scene_manager);
   scene::ICameraSceneNode* camera =
@@ -72,21 +69,36 @@ scene_ISceneManager_addCameraSceneNode (SCM scene_manager,
   return scm_from_pointer ((void*) camera, NULL);
 }
 
-
 template <typename TParent>
 SCM
-scene_ISceneManager_addCameraSceneNodeFPS (SCM scene_manager,
-                                           SCM parent,
-                                           SCM rotate_speed,
-                                           SCM move_speed,
-                                           SCM id,
-                                           SCM key_map_array,
-                                           SCM key_map_size,
-                                           SCM no_vertical_movement,
-                                           SCM jump_speed,
-                                           SCM invert_mouse,
-                                           SCM make_active)
+ISceneManager_addCameraSceneNodeFPS (SCM scene_manager,
+                                     SCM rest)
 {
+  SCM parent;
+  SCM rotate_speed;
+  SCM move_speed;
+  SCM id;
+  SCM key_map_array;
+  SCM key_map_size;
+  SCM no_vertical_movement;
+  SCM jump_speed;
+  SCM invert_mouse;
+  SCM make_active;
+
+  scm_c_bind_keyword_arguments ("scene_ISceneManager_addCameraSceneNodeFPS",
+                                rest, (scm_t_keyword_arguments_flags)0,
+                                scm_from_utf8_keyword ("parent"), &parent,
+                                scm_from_utf8_keyword ("rotate-speed"), &rotate_speed,
+                                scm_from_utf8_keyword ("move-speed"), &move_speed,
+                                scm_from_utf8_keyword ("id"), &id,
+                                scm_from_utf8_keyword ("key-map-array"), &key_map_array,
+                                scm_from_utf8_keyword ("key-map-size"), &key_map_size,
+                                scm_from_utf8_keyword ("no-vertical-movement"), &no_vertical_movement,
+                                scm_from_utf8_keyword ("jump-speed"), &jump_speed,
+                                scm_from_utf8_keyword ("invert-mouse"), &invert_mouse,
+                                scm_from_utf8_keyword ("make-active"), &make_active,
+                                SCM_UNDEFINED);
+
   scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_pointer (scene_manager);
   scene::ICameraSceneNode* camera =
     smgr->addCameraSceneNodeFPS ((TParent) scm_to_pointer (parent),
@@ -102,16 +114,15 @@ scene_ISceneManager_addCameraSceneNodeFPS (SCM scene_manager,
   return scm_from_pointer ((void*) camera, NULL);
 }
 
-
 template <typename TParent>
 SCM
-scene_ISceneManager_addCubeSceneNode (SCM scene_manager,
-                                      SCM size,
-                                      SCM parent,
-                                      SCM id,
-                                      SCM position,
-                                      SCM rotation,
-                                      SCM scale)
+ISceneManager_addCubeSceneNode (SCM scene_manager,
+                                SCM size,
+                                SCM parent,
+                                SCM id,
+                                SCM position,
+                                SCM rotation,
+                                SCM scale)
 {
   scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_pointer (scene_manager);
   scene::IMeshSceneNode* node =
@@ -121,22 +132,21 @@ scene_ISceneManager_addCubeSceneNode (SCM scene_manager,
                             scm_to_vector3df (position),
                             scm_to_vector3df (rotation),
                             scm_to_vector3df (scale));
-  return scm_from_pointer ((void*) camera, NULL);
+  return scm_from_pointer ((void*) node, NULL);
 }
 
-
 template <typename TParent>
 SCM
-scene_ISceneManager_addCustomSceneNode (SCM scene_manager,
-                                        SCM proc_render,
-                                        SCM proc_get_bounding_box,
-                                        SCM proc_get_material_count,
-                                        SCM proc_get_material,
-                                        SCM parent,
-                                        SCM id,
-                                        SCM position,
-                                        SCM rotation,
-                                        SCM scale)
+ISceneManager_addCustomSceneNode (SCM scene_manager,
+                                  SCM proc_render,
+                                  SCM proc_get_bounding_box,
+                                  SCM proc_get_material_count,
+                                  SCM proc_get_material,
+                                  SCM parent,
+                                  SCM id,
+                                  SCM position,
+                                  SCM rotation,
+                                  SCM scale)
 {
   class CustomSceneNode : public scene::ISceneNode
   {
@@ -210,15 +220,14 @@ scene_ISceneManager_addCustomSceneNode (SCM scene_manager,
   return scm_from_pointer ((void*) node, NULL);
 }
 
-
 template <typename TParent, typename TMesh>
 SCM
-scene_ISceneManager_addOctreeSceneNode (SCM scene_manager,
-                                        SCM mesh,
-                                        SCM parent,
-                                        SCM id,
-                                        SCM minimal_polys_per_node,
-                                        SCM also_add_if_mesh_pointer_zero)
+ISceneManager_addOctreeSceneNode (SCM scene_manager,
+                                  SCM mesh,
+                                  SCM parent,
+                                  SCM id,
+                                  SCM minimal_polys_per_node,
+                                  SCM also_add_if_mesh_pointer_zero)
 {
   scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_pointer (scene_manager);
   scene::IMeshSceneNode* node =
@@ -230,17 +239,16 @@ scene_ISceneManager_addOctreeSceneNode (SCM scene_manager,
   return scm_from_pointer ((void*) node, NULL);
 }
 
-
 template <typename TParent>
 SCM
-scene_ISceneManager_addSphereSceneNode (SCM scene_manager,
-                                        SCM radius,
-                                        SCM poly_count,
-                                        SCM parent,
-                                        SCM id,
-                                        SCM position,
-                                        SCM rotation,
-                                        SCM scale)
+ISceneManager_addSphereSceneNode (SCM scene_manager,
+                                  SCM radius,
+                                  SCM poly_count,
+                                  SCM parent,
+                                  SCM id,
+                                  SCM position,
+                                  SCM rotation,
+                                  SCM scale)
 {
   scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_pointer (scene_manager);
   scene::IMeshSceneNode* node =
@@ -254,15 +262,14 @@ scene_ISceneManager_addSphereSceneNode (SCM scene_manager,
   return scm_from_pointer ((void*) node, NULL);
 }
 
-
 SCM
-scene_ISceneManager_createFlyCircleAnimator (SCM scene_manager,
-                                             SCM center,
-                                             SCM radius,
-                                             SCM speed,
-                                             SCM direction,
-                                             SCM start_position,
-                                             SCM radius_ellipsoid)
+ISceneManager_createFlyCircleAnimator (SCM scene_manager,
+                                       SCM center,
+                                       SCM radius,
+                                       SCM speed,
+                                       SCM direction,
+                                       SCM start_position,
+                                       SCM radius_ellipsoid)
 {
   scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_pointer (scene_manager);
   scene::ISceneNodeAnimator* anim =
@@ -275,14 +282,13 @@ scene_ISceneManager_createFlyCircleAnimator (SCM scene_manager,
   return scm_from_pointer ((void*) anim, NULL);
 }
 
-
 SCM
-scene_ISceneManager_createFlyStraightAnimator (SCM scene_manager,
-                                               SCM start_point,
-                                               SCM end_point,
-                                               SCM time_for_way,
-                                               SCM loop,
-                                               SCM pingpong)
+ISceneManager_createFlyStraightAnimator (SCM scene_manager,
+                                         SCM start_point,
+                                         SCM end_point,
+                                         SCM time_for_way,
+                                         SCM loop,
+                                         SCM pingpong)
 {
   scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_pointer (scene_manager);
   scene::ISceneNodeAnimator* anim =
@@ -294,10 +300,9 @@ scene_ISceneManager_createFlyStraightAnimator (SCM scene_manager,
   return scm_from_pointer ((void*) anim, NULL);
 }
 
-
 SCM
-scene_ISceneManager_createRotationAnimator (SCM scene_manager,
-                                            SCM rotation_speed)
+ISceneManager_createRotationAnimator (SCM scene_manager,
+                                      SCM rotation_speed)
 {
   scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_pointer (scene_manager);
   scene::ISceneNodeAnimator* anim =
@@ -305,64 +310,55 @@ scene_ISceneManager_createRotationAnimator (SCM scene_manager,
   return scm_from_pointer ((void*) anim, NULL);
 }
 
-
 SCM
-scene_ISceneManager_drawAll (SCM scene_manager)
+ISceneManager_drawAll (SCM scene_manager)
 {
   ((scene::ISceneManager*) scm_to_pointer (scene_manager))->drawAll ();
   return SCM_UNSPECIFIED;
 }
 
-
 SCM
-scene_ISceneManager_getMesh (SCM scene_manager,
-                             SCM filename)
+ISceneManager_getMesh (SCM scene_manager,
+                       SCM filename)
 {
   scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_pointer (scene_manager);
   scene::IAnimatedMesh* mesh = smgr->getMesh(scm_to_utf8_stringn (filename, NULL));
   return scm_from_pointer ((void*) mesh, NULL);
 }
 
-
 SCM
-scene_ISceneManager_getRootSceneNode (SCM scene_manager)
+ISceneManager_getRootSceneNode (SCM scene_manager)
 {
   scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_pointer (scene_manager);
   return scm_from_pointer ((void*) smgr->getRootSceneNode (), NULL);
 }
 
-
-extern "C" {
-
-  void
-  init_scene_manager (void)
-  {
-    DEFINE_GSUBR ("scene_ISceneManager_addAnimatedMeshSceneNode_ISceneNode", 8, 0, 0,
-                  scene_ISceneManager_addAnimatedMeshSceneNode<scene::ISceneNode*>);
-    DEFINE_GSUBR ("scene_ISceneManager_addCameraSceneNode_ISceneNode", 6, 0, 0,
-                  scene_ISceneManager_addCameraSceneNode<scene::ISceneNode*>);
-    DEFINE_GSUBR ("scene_ISceneManager_addCameraSceneNodeFPS_ISceneNode", 11, 0, 0,
-                  scene_ISceneManager_addCameraSceneNodeFPS<scene::ISceneNode*>);
-    DEFINE_GSUBR ("scene_ISceneManager_addCubeSceneNode_ISceneNode", 7, 0, 0,
-                  scene_ISceneManager_addCubeSceneNode<scene::ISceneNode*>);
-    DEFINE_GSUBR ("scene_ISceneManager_addCustomSceneNode_ISceneNode", 10, 0, 0,
-                  scene_ISceneManager_addCustomSceneNode<scene::ISceneNode*>);
-    DEFINE_GSUBR ("scene_ISceneManager_addOctreeSceneNode_ISceneNode_IAnimatedMesh", 6, 0, 0,
-                  scene_ISceneManager_addOctreeSceneNode<scene::ISceneNode*, scene::IAnimatedMesh*>);
-    DEFINE_GSUBR ("scene_ISceneManager_addOctreeSceneNode_ISceneNode_IMesh", 6, 0, 0,
-                  scene_ISceneManager_addOctreeSceneNode<scene::ISceneNode*, scene::IMesh*>);
-    DEFINE_GSUBR ("scene_ISceneManager_addSphereSceneNode_ISceneNode", 8, 0, 0,
-                  scene_ISceneManager_addSphereSceneNode<scene::ISceneNode*>);
-    DEFINE_GSUBR ("scene_ISceneManager_createFlyCircleAnimator", 7, 0, 0,
-                  scene_ISceneManager_createFlyCircleAnimator);
-    DEFINE_GSUBR ("scene_ISceneManager_createFlyStraightAnimator", 6, 0, 0,
-                  scene_ISceneManager_createFlyStraightAnimator);
-    DEFINE_GSUBR ("scene_ISceneManager_createRotationAnimator", 2, 0, 0,
-                  scene_ISceneManager_createRotationAnimator);
-    DEFINE_GSUBR ("scene_ISceneManager_drawAll", 1, 0, 0, scene_ISceneManager_drawAll);
-    DEFINE_GSUBR ("scene_ISceneManager_getMesh", 2, 0, 0, scene_ISceneManager_getMesh);
-    DEFINE_GSUBR ("scene_ISceneManager_getRootSceneNode", 1, 0, 0,
-                  scene_ISceneManager_getRootSceneNode);
-  }
-
+void
+init_scene_manager (void)
+{
+  DEFINE_GSUBR ("ISceneManager_addAnimatedMeshSceneNode_ISceneNode", 8, 0, 0,
+                ISceneManager_addAnimatedMeshSceneNode<scene::ISceneNode*>);
+  DEFINE_GSUBR ("ISceneManager_addCameraSceneNode_ISceneNode", 6, 0, 0,
+                ISceneManager_addCameraSceneNode<scene::ISceneNode*>);
+  DEFINE_GSUBR ("ISceneManager_addCameraSceneNodeFPS_ISceneNode", 1, 0, 1,
+                ISceneManager_addCameraSceneNodeFPS<scene::ISceneNode*>);
+  DEFINE_GSUBR ("ISceneManager_addCubeSceneNode_ISceneNode", 7, 0, 0,
+                ISceneManager_addCubeSceneNode<scene::ISceneNode*>);
+  DEFINE_GSUBR ("ISceneManager_addCustomSceneNode_ISceneNode", 10, 0, 0,
+                ISceneManager_addCustomSceneNode<scene::ISceneNode*>);
+  DEFINE_GSUBR ("ISceneManager_addOctreeSceneNode_ISceneNode_IAnimatedMesh", 6, 0, 0,
+                (ISceneManager_addOctreeSceneNode<scene::ISceneNode*, scene::IAnimatedMesh*>));
+  DEFINE_GSUBR ("ISceneManager_addOctreeSceneNode_ISceneNode_IMesh", 6, 0, 0,
+                (ISceneManager_addOctreeSceneNode<scene::ISceneNode*, scene::IMesh*>));
+  DEFINE_GSUBR ("ISceneManager_addSphereSceneNode_ISceneNode", 8, 0, 0,
+                ISceneManager_addSphereSceneNode<scene::ISceneNode*>);
+  DEFINE_GSUBR ("ISceneManager_createFlyCircleAnimator", 7, 0, 0,
+                ISceneManager_createFlyCircleAnimator);
+  DEFINE_GSUBR ("ISceneManager_createFlyStraightAnimator", 6, 0, 0,
+                ISceneManager_createFlyStraightAnimator);
+  DEFINE_GSUBR ("ISceneManager_createRotationAnimator", 2, 0, 0,
+                ISceneManager_createRotationAnimator);
+  DEFINE_GSUBR ("ISceneManager_drawAll", 1, 0, 0, ISceneManager_drawAll);
+  DEFINE_GSUBR ("ISceneManager_getMesh", 2, 0, 0, ISceneManager_getMesh);
+  DEFINE_GSUBR ("ISceneManager_getRootSceneNode", 1, 0, 0, ISceneManager_getRootSceneNode);
 }