]> git.jsancho.org Git - guile-irrlicht.git/commitdiff
Appropiate method bindings
authorJavier Sancho <jsf@jsancho.org>
Tue, 3 Dec 2019 09:24:38 +0000 (10:24 +0100)
committerJavier Sancho <jsf@jsancho.org>
Tue, 3 Dec 2019 09:24:38 +0000 (10:24 +0100)
examples/01.HelloWorld.scm
examples/02.Quake3Map.scm
irrlicht/bindings/scene.scm
irrlicht/scene.scm

index ea5c5be37768a63b2fee5d7e0ba91f9e5df7303b..3f128cb7770d3839213a0f825148165942f81adf 100644 (file)
 
 (define node (add-animated-mesh-scene-node scene-manager mesh))
 (when node
-  (set-material-flag-am! node 'lighting #f)
+  (set-material-flag! node 'lighting #f)
   (set-md2-animation! node 'stand)
-  (set-material-texture-am! node 0 (get-texture driver "media/sydney.bmp")))
+  (set-material-texture! node 0 (get-texture driver "media/sydney.bmp")))
 
 ;; place camera
-(add-camera-scene-node scene-manager #:position '(0 30 -40) #:lookat '(0 5 0))
+(add-camera-scene-node! scene-manager #:position '(0 30 -40) #:lookat '(0 5 0))
 
 ;; draw everything
 (while (device-run? device)
index a3b897bf87506c874722d73dd2642c4dd6f4c090..45249aceb562599864cd6c06e2325aad25c6765e 100644 (file)
@@ -18,8 +18,8 @@
 ;;; <http://www.gnu.org/licenses/>.
 
 
-;;; Irrlicht 01.HelloWorld example
-;;; http://irrlicht.sourceforge.net/docu/example001.html
+;;; Irrlicht 02.Quake3Map example
+;;; http://irrlicht.sourceforge.net/docu/example002.html
 
 
 (use-modules (irrlicht)
@@ -65,7 +65,7 @@
 (add-file-archive! (get-file-system device) "media/map-20kdm2.pk3")
 
 (define mesh (get-mesh scene-manager "20kdm2.bsp"))
-(define node (add-octree-scene-node-am
+(define node (add-octree-scene-node
               scene-manager mesh
               #:minimal-polys-per-node 1024))
 (set-position! node '(-1300 -144 -1249))
index 63dc24c77931951269eb184e8cfd0154a9d4240d..6a54f18cc7d7817aa44b25f61a2e17d8e515e834 100644 (file)
 (define-foreign add-camera-scene-node-fps
   '* "irr_scene_addCameraSceneNodeFPS" (list '* '* float float int '* int int float int int))
 
-(define-foreign add-octree-scene-node-am
-  '* "irr_scene_addOctreeSceneNodeAM" (list '* '* '* int int int))
+(define-foreign add-custom-scene-node
+  '* "irr_scene_addCustomSceneNode" (list '* '* int '*))
+
+(define-foreign add-octree-scene-node
+  '* "irr_scene_addOctreeSceneNode" (list '* '* '* int int int))
 
 (define-foreign draw-all
   void "irr_scene_drawAll" (list '*))
 (define-foreign get-mesh
   '* "irr_scene_getMesh" (list '* '*))
 
-(define-foreign set-material-flag-am
-  void "irr_scene_setMaterialFlagAM" (list '* int int))
+(define-foreign get-root-scene-node
+  '* "irr_scene_getRootSceneNode" (list '*))
+
+(define-foreign set-material-flag
+  void "irr_scene_setMaterialFlag" (list '* int int))
 
-(define-foreign set-material-texture-am
-  void "irr_scene_setMaterialTextureAM" (list '* int '*))
+(define-foreign set-material-texture
+  void "irr_scene_setMaterialTexture" (list '* int '*))
 
 (define-foreign set-md2-animation
   void "irr_scene_setMD2Animation" (list '* int))
index 264a4bd9883fce2d46d5a70257216ede6820736b..2f2aa50c2a070b7e1a5831e70cd5220dbe7daa38 100644 (file)
   #:use-module ((irrlicht bindings video) #:prefix ffi-video:)
   #:use-module (irrlicht util)
   #:export (add-animated-mesh-scene-node
-            add-camera-scene-node
+            add-camera-scene-node!
             add-camera-scene-node-fps!
-            add-octree-scene-node-am
+            add-custom-scene-node!
+            add-octree-scene-node
             get-mesh
+            get-root-scene-node
             scene-draw-all
-            set-material-flag-am!
-            set-material-texture-am!
+            set-material-flag!
+            set-material-texture!
             set-md2-animation!
             set-position!))
 
                (bool->integer also-add-if-mesh-pointer-zero))))
     (if (null-pointer? node) #f node)))
 
-(define* (add-camera-scene-node scene-manager
-                                #:key
-                                (parent %null-pointer)
-                                (position '(0 0 0))
-                                (lookat '(0 0 100))
-                                (id -1)
-                                (make-active #t))
+(define* (add-camera-scene-node! scene-manager
+                                 #:key
+                                 (parent %null-pointer)
+                                 (position '(0 0 0))
+                                 (lookat '(0 0 100))
+                                 (id -1)
+                                 (make-active #t))
   (let ((camera (ffi-scene:add-camera-scene-node
                  scene-manager
                  parent
    (bool->integer invert-mouse)
    (bool->integer make-active)))
 
-(define* (add-octree-scene-node-am scene-manager mesh
-                                   #:key
-                                   (parent %null-pointer)
-                                   (id -1)
-                                   (minimal-polys-per-node 512)
-                                   (also-add-if-mesh-pointer-zero #f))
-  (ffi-scene:add-octree-scene-node-am
+(define (add-custom-scene-node! parent
+                                scene-manager
+                                id
+                                custom-render)
+  (ffi-scene:add-custom-scene-node
+   parent
+   scene-manager
+   id
+   (procedure->pointer void custom-render '())))
+
+(define* (add-octree-scene-node scene-manager mesh
+                                #:key
+                                (parent %null-pointer)
+                                (id -1)
+                                (minimal-polys-per-node 512)
+                                (also-add-if-mesh-pointer-zero #f))
+  (ffi-scene:add-octree-scene-node
    scene-manager
    mesh
    parent
   (let ((mesh (ffi-scene:get-mesh scene-manager (string->pointer filename))))
     (if (null-pointer? mesh) #f mesh)))
 
+(define (get-root-scene-node scene-manager)
+  (ffi-scene:get-root-scene-node scene-manager))
+
 (define (scene-draw-all scene-manager)
   (ffi-scene:draw-all scene-manager))
 
-(define (set-material-flag-am! node flag newvalue)
+(define (set-material-flag! node flag newvalue)
   (let ((material-flag
          (match flag
                 ('wireframe ffi-video:EMF_WIREFRAME)
                 ('use-mip-maps ffi-video:EMF_USE_MIP_MAPS)
                 ('blend-operation ffi-video:EMF_BLEND_OPERATION)
                 ('polygon-offset ffi-video:EMF_POLYGON_OFFSET))))
-    (ffi-scene:set-material-flag-am
+    (ffi-scene:set-material-flag
      node
      material-flag
      (bool->integer newvalue))))
 
-(define (set-material-texture-am! node texture-layer texture)
-  (ffi-scene:set-material-texture-am node texture-layer texture))
+(define (set-material-texture! node texture-layer texture)
+  (ffi-scene:set-material-texture node texture-layer texture))
 
 (define (set-md2-animation! node anim)
   (let ((animation-type