X-Git-Url: https://git.jsancho.org/?p=guile-irrlicht.git;a=blobdiff_plain;f=irrlicht%2Fscene.scm;h=6a6486fe8565f8bf5ecdce34723df012112211a3;hp=ee47d4c57fccee84f9beab104ff3ae63bb15c2a7;hb=e6792f323493078dceac0566f5d27786fc76225d;hpb=5cd7046669d8cb991f75e1e56b4155f29bb80935 diff --git a/irrlicht/scene.scm b/irrlicht/scene.scm index ee47d4c..6a6486f 100644 --- a/irrlicht/scene.scm +++ b/irrlicht/scene.scm @@ -24,28 +24,31 @@ #:use-module (irrlicht base) #:use-module (irrlicht foreign) #:use-module (irrlicht io) - #:use-module (irrlicht irr)) + #:use-module (irrlicht irr) + #:use-module (irrlicht video)) ;; IMesh (define-class () - (irr-class #:init-value "IMesh" #:getter irr-class)) + (irr-class #:init-value "IMesh")) (export ) ;; IAnimatedMesh (define-class () - (irr-class #:init-value "IAnimatedMesh" #:getter irr-class)) + (irr-class #:init-value "IAnimatedMesh")) (export ) ;; ISceneManager (define-class () - (irr-class #:init-value "ISceneManager" #:getter irr-class)) + (irr-class #:init-value "ISceneManager")) -(define-method (add-animated-mesh-scene-node! (scene-manager ) mesh . rest) +(define-method (add-animated-mesh-scene-node! (scene-manager ) + (mesh ) + . rest) (let-keywords rest #f ((parent (make )) (id -1) @@ -56,40 +59,115 @@ (make #:irr-pointer ((get-irrlicht-proc "addAnimatedMeshSceneNode" scene-manager parent) - (irr-pointer scene-manager) - (irr-pointer mesh) - (irr-pointer parent) + scene-manager + mesh + parent id position rotation scale also-add-if-mesh-pointer-zero)))) +(define-method (add-camera-scene-node! (scene-manager ) . rest) + (let-keywords rest #f + ((parent (make )) + (position '(0 0 0)) + (lookat '(0 0 100)) + (id -1) + (make-active #t)) + (make + #:irr-pointer + ((get-irrlicht-proc "addCameraSceneNode" scene-manager parent) + scene-manager + parent + position + lookat + id + make-active)))) + +(define-method (add-octree-scene-node! (scene-manager ) + (mesh ) + . rest) + (let-keywords rest #f + ((parent (make )) + (id -1) + (minimal-polys-per-node 512) + (also-add-if-mesh-pointer-zero #f)) + (let ((addOctreeSceneNode (get-irrlicht-proc "addOctreeSceneNode" scene-manager parent mesh))) + (make + #:irr-pointer + (addOctreeSceneNode scene-manager mesh parent id minimal-polys-per-node + also-add-if-mesh-pointer-zero))))) + +(define-method (add-octree-scene-node! (scene-manager ) + (mesh ) + . rest) + (let-keywords rest #f + ((parent (make )) + (id -1) + (minimal-polys-per-node 256) + (also-add-if-mesh-pointer-zero #f)) + (let ((addOctreeSceneNode (get-irrlicht-proc "addOctreeSceneNode" scene-manager parent mesh))) + (make + #:irr-pointer + (addOctreeSceneNode scene-manager mesh parent id minimal-polys-per-node + also-add-if-mesh-pointer-zero))))) + +(define-method (draw-all (scene-manager )) + ((get-irrlicht-proc "drawAll" scene-manager) + scene-manager)) + (define-method (get-mesh (scene-manager ) filename) (make #:irr-pointer ((get-irrlicht-proc "getMesh" scene-manager) - (irr-pointer scene-manager) + scene-manager filename))) -(export add-animated-mesh-scene-node! get-mesh) +(export add-animated-mesh-scene-node! add-camera-scene-node! add-octree-scene-node! + draw-all get-mesh) ;; ISceneNode (define-class () - (irr-class #:init-value "ISceneNode" #:getter irr-class)) + (irr-class #:init-value "ISceneNode")) (define-method (set-material-flag! (node ) flag new-value) ((get-irrlicht-proc "setMaterialFlag" node) - (irr-pointer node) + node flag new-value)) -(export set-material-flag!) +(define-method (set-material-texture! (node ) texture-layer (texture )) + ((get-irrlicht-proc "setMaterialTexture" node) + node + texture-layer + texture)) +(export set-material-flag! set-material-texture!) -;; ISceneNode + +;; IAnimatedMeshSceneNode (define-class () - (irr-class #:init-value "IAnimatedMeshSceneNode" #:getter irr-class)) + (irr-class #:init-value "IAnimatedMeshSceneNode")) + +(define-method (set-md2-animation! (node ) anim) + ((get-irrlicht-proc "setMD2Animation" node) + node + anim)) + +(export set-md2-animation!) + + +;; ICameraSceneNode +(define-class () + (irr-class #:init-value "ICameraSceneNode")) + +(export ) + + +;; IMeshSceneNode +(define-class () + (irr-class #:init-value "IMeshSceneNode")) -(export ) +(export )