(define-foreign draw-all
void "irr_scene_drawAll" (list '*))
+(define-foreign get-absolute-transformation
+ '* "irr_scene_getAbsoluteTransformation" (list '*))
+
(define-foreign get-mesh
'* "irr_scene_getMesh" (list '* '*))
(define-public EMT_ONETEXTURE_BLEND 23)
(define-public EMT_FORCE_32BIT #x7fffffff)
+;; irr_video_E_TRANSFORMATION_STATE enum
+(define-public ETS_VIEW 0)
+(define-public ETS_WORLD 1)
+(define-public ETS_PROJECTION 2)
+(define-public ETS_TEXTURE_0 3)
+(define-public ETS_TEXTURE_1 4)
+(define-public ETS_TEXTURE_2 5)
+(define-public ETS_TEXTURE_3 6)
+(define-public ETS_TEXTURE_4 7)
+(define-public ETS_TEXTURE_5 8)
+(define-public ETS_TEXTURE_6 9)
+(define-public ETS_TEXTURE_7 10)
+(define-public ETS_COUNT 11)
+
;; scolor struct
(define-public scolor
(define-foreign set-material
void "irr_video_setMaterial" (list '* '*))
+(define-foreign set-transform
+ void "irr_video_setTransform" (list '* int '*))
+
;; s3dvertex struct
(define-wrapped-pointer-type s3dvertex-type
s3dvertex?
add-custom-scene-node!
add-octree-scene-node
create-rotation-animator
+ get-absolute-transformation
get-mesh
get-root-scene-node
scene-draw-all
(ffi-core:vector3df->pointer rotation-speed))))
(if (null-pointer? animator) #f animator)))
+(define (get-absolute-transformation node)
+ (ffi-scene:get-absolute-transformation node))
+
(define (get-mesh scene-manager filename)
(let ((mesh (ffi-scene:get-mesh scene-manager (string->pointer filename))))
(if (null-pointer? mesh) #f mesh)))
(define-module (irrlicht video)
+ #:use-module (ice-9 match)
#:use-module (system foreign)
#:use-module ((irrlicht bindings core) #:prefix ffi-core:)
#:use-module ((irrlicht bindings video) #:prefix ffi-video:)
get-texture
get-video-driver-name
set-material!
+ set-transform!
make-s3dvertex
vertex-position
make-material))
driver
(ffi-video:smaterial->pointer material)))
+(define (set-transform! driver state mat)
+ (let ((transform-state
+ (match state
+ ('view ffi-video:ETS_VIEW)
+ ('world ffi-video:ETS_WORLD)
+ ('projection ffi-video:ETS_PROJECTION)
+ ('texture0 ffi-video:ETS_TEXTURE_0)
+ ('texture1 ffi-video:ETS_TEXTURE_1)
+ ('texture2 ffi-video:ETS_TEXTURE_2)
+ ('texture3 ffi-video:ETS_TEXTURE_3)
+ ('texture4 ffi-video:ETS_TEXTURE_4)
+ ('texture5 ffi-video:ETS_TEXTURE_5)
+ ('texture6 ffi-video:ETS_TEXTURE_6)
+ ('texture7 ffi-video:ETS_TEXTURE_7)
+ ('count ffi-video:ETS_COUNT))))
+ (ffi-video:set-transform
+ driver
+ transform-state
+ mat)))
+
;; s3d vertices
(define (make-s3dvertex position normal color t-coords)
(ffi-video:pointer->s3dvertex