(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)
;;; <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)
(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))
(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))
#: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