]> git.jsancho.org Git - guile-irrlicht.git/commitdiff
get-mesh is-empty?
authorJavier Sancho <jsf@jsancho.org>
Mon, 11 May 2020 06:36:03 +0000 (08:36 +0200)
committerJavier Sancho <jsf@jsancho.org>
Mon, 11 May 2020 06:36:03 +0000 (08:36 +0200)
examples/01-hello-world.scm
irrlicht.scm
irrlicht/base.scm
irrlicht/scene.scm

index b480c8934ccbac60ffc0361d3b2253e08649a58d..4029b7ec23a15c16c577ea99607460cd7d83b769 100644 (file)
@@ -47,7 +47,7 @@
 
 ;; load a Quake2 model
 (define mesh (get-mesh scene-manager "media/sydney.md2"))
-(when (not mesh)
+(when (is-empty? mesh)
   (drop! device)
   (exit #f))
 
index d6c4b90afe35c7e5fb7527ac32ed71c5e15694a8..293049368eebe2fd6e0be9ccced514a4774084a8 100644 (file)
 
 
 (define-module (irrlicht)
+  #:use-module (irrlicht base)
   #:use-module (irrlicht device)
   #:use-module (irrlicht gui)
+  #:use-module (irrlicht scene)
   #:re-export (add-static-text!
                create-device
                get-gui-environment
+               get-mesh
                get-scene-manager
                get-video-driver
+               is-empty?
                set-window-caption!))
index 4a5d9ae91a405265da9c1e46f2b9aaf9d4aa2c85..dba889b6168eddb90b15b5518740111614d149aa 100644 (file)
   #:use-module (system foreign)
   #:export (<irrlicht-base>
             irr-class
-            irr-pointer))
+            irr-pointer
+            is-empty?))
 
 (define-class <irrlicht-base> ()
   (irr-class #:init-value "" #:getter irr-class)
   (irr-pointer #:init-value %null-pointer #:getter irr-pointer #:init-keyword #:irr-pointer))
+
+(define-method (is-empty? (obj <irrlicht-base>))
+  (equal? (irr-pointer obj) %null-pointer))
index e5cd4225fe1b386c93fea5dd1a6010d84725c3ea..6f6d5e920b598eb076f08688405e93f6cb9d4a64 100644 (file)
 
 (define-module (irrlicht scene)
   #:use-module (oop goops)
+  #:use-module (irrlicht base)
   #:use-module (irrlicht foreign)
   #:use-module (irrlicht irr))
 
 
+;; IMesh
+(define-class <mesh> (<reference-counted>)
+  (irr-class #:init-value "IMesh" #:getter irr-class))
+
+(export <mesh>)
+
+
+;; IAnimatedMesh
+(define-class <animated-mesh> (<mesh>)
+  (irr-class #:init-value "IAnimatedMesh" #:getter irr-class))
+
+(export <animated-mesh>)
+
+
 ;; ISceneManager
 (define-class <scene-manager> (<reference-counted>)
   (irr-class #:init-value "ISceneManager" #:getter irr-class))
 
-(export <scene-manager>)
+(define-method (get-mesh (scene-manager <scene-manager>) filename)
+  (make <animated-mesh>
+    #:irr-pointer
+    ((get-irrlicht-proc "getMesh" scene-manager)
+     (irr-pointer scene-manager)
+     filename)))
+
+(export <scene-manager> get-mesh)