From 671b139a1cc72854edc73325a7feac30fd8705a8 Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Sun, 17 May 2020 08:35:27 +0200 Subject: [PATCH] set-material! --- irrlicht.scm | 1 + irrlicht/video.scm | 112 +++++++++++++++++++++++---------------------- 2 files changed, 59 insertions(+), 54 deletions(-) diff --git a/irrlicht.scm b/irrlicht.scm index 11fcb96..88da30e 100644 --- a/irrlicht.scm +++ b/irrlicht.scm @@ -61,6 +61,7 @@ make-vertex3d reset-box3d! run + set-material! set-material-flag! set-material-texture! set-md2-animation! diff --git a/irrlicht/video.scm b/irrlicht/video.scm index c6531f0..23f9db4 100644 --- a/irrlicht/video.scm +++ b/irrlicht/video.scm @@ -32,6 +32,59 @@ (export ) +;; SMaterial +(define-class () + (irr-class #:init-value "SMaterial")) + +(define* (make-material #:key + (material-type 'solid) + (ambient-color '(255 255 255 255)) + (diffuse-color '(255 255 255 255)) + (emissive-color '(0 0 0 0)) + (specular-color '(255 255 255 255)) + (shininess 0) + (material-type-param 0) + (material-type-param-2 0) + (thickness 1) + (z-buffer 'less-equal) + (anti-aliasing 'simple) + (color-mask 'all) + (color-material 'diffuse) + (blend-operation 'none) + (polygon-offset-factor 0) + (polygon-offset-direction 'front) + (wireframe #f) + (point-cloud #f) + (gouraud-shading #t) + (lighting #t) + (z-write-enable #t) + (backface-culling #t) + (frontface-culling #f) + (fog-enable #f) + (normalize-normals #f) + (use-mip-maps #t)) + (let ((SMaterial_make (get-irrlicht-proc "SMaterial_make"))) + (make + #:irr-pointer + (SMaterial_make #:material-type material-type #:ambient-color ambient-color + #:diffuse-color diffuse-color #:emissive-color emissive-color + #:specular-color specular-color #:shininess shininess + #:material-type-param material-type-param + #:material-type-param-2 material-type-param-2 + #:thickness thickness #:z-buffer z-buffer #:anti-aliasing anti-aliasing + #:color-mask color-mask #:color-material color-material + #:blend-operation blend-operation + #:polygon-offset-factor polygon-offset-factor + #:polygon-offset-direction polygon-offset-direction + #:wireframe wireframe #:point-cloud point-cloud + #:gouraud-shading gouraud-shading #:lighting lighting + #:z-write-enable z-write-enable #:backface-culling backface-culling + #:frontface-culling frontface-culling #:fog-enable fog-enable + #:normalize-normals normalize-normals #:use-mip-maps use-mip-maps)))) + +(export make-material) + + ;; IVideoDriver (define-class () (irr-class #:init-value "IVideoDriver")) @@ -70,7 +123,11 @@ video-driver filename))) -(export begin-scene end-scene get-fps get-name get-texture) +(define-method (set-material! (video-driver ) (material )) + (let ((setMaterial (get-irrlicht-proc "setMaterial" video-driver))) + (setMaterial video-driver material))) + +(export begin-scene end-scene get-fps get-name get-texture set-material!) ;; S3DVertex @@ -88,56 +145,3 @@ (S3DVertex_make position normal color tcoords)))) (export get-position make-vertex3d) - - -;; SMaterial -(define-class () - (irr-class #:init-value "SMaterial")) - -(define* (make-material #:key - (material-type 'solid) - (ambient-color '(255 255 255 255)) - (diffuse-color '(255 255 255 255)) - (emissive-color '(0 0 0 0)) - (specular-color '(255 255 255 255)) - (shininess 0) - (material-type-param 0) - (material-type-param-2 0) - (thickness 1) - (z-buffer 'less-equal) - (anti-aliasing 'simple) - (color-mask 'all) - (color-material 'diffuse) - (blend-operation 'none) - (polygon-offset-factor 0) - (polygon-offset-direction 'front) - (wireframe #f) - (point-cloud #f) - (gouraud-shading #t) - (lighting #t) - (z-write-enable #t) - (backface-culling #t) - (frontface-culling #f) - (fog-enable #f) - (normalize-normals #f) - (use-mip-maps #t)) - (let ((SMaterial_make (get-irrlicht-proc "SMaterial_make"))) - (make - #:irr-pointer - (SMaterial_make #:material-type material-type #:ambient-color ambient-color - #:diffuse-color diffuse-color #:emissive-color emissive-color - #:specular-color specular-color #:shininess shininess - #:material-type-param material-type-param - #:material-type-param-2 material-type-param-2 - #:thickness thickness #:z-buffer z-buffer #:anti-aliasing anti-aliasing - #:color-mask color-mask #:color-material color-material - #:blend-operation blend-operation - #:polygon-offset-factor polygon-offset-factor - #:polygon-offset-direction polygon-offset-direction - #:wireframe wireframe #:point-cloud point-cloud - #:gouraud-shading gouraud-shading #:lighting lighting - #:z-write-enable z-write-enable #:backface-culling backface-culling - #:frontface-culling frontface-culling #:fog-enable fog-enable - #:normalize-normals normalize-normals #:use-mip-maps use-mip-maps)))) - -(export make-material) -- 2.39.2