]> git.jsancho.org Git - guile-irrlicht.git/commitdiff
WIP: SMaterial and vertices
authorJavier Sancho <jsf@jsancho.org>
Sun, 2 Feb 2020 17:36:47 +0000 (18:36 +0100)
committerJavier Sancho <jsf@jsancho.org>
Sun, 2 Feb 2020 17:36:47 +0000 (18:36 +0100)
irrlicht/bindings/core.scm
irrlicht/bindings/video.scm
irrlicht/core.scm
irrlicht/video.scm

index 59b05af4e9fcd56c63f3b0a6bec6e01c8bda1340..140506b47a0ab40414007ed2280f920f67e7875c 100644 (file)
@@ -51,7 +51,7 @@
   (make-c-struct vector3df data))
 
 ;; aabbox3df struct
-(define-wrapped-pointer-type aabbox3df
+(define-wrapped-pointer-type aabbox3df-type
   aabbox3df?
   pointer->aabbox3df aabbox3df->pointer
   (lambda (box port)
 
 (export aabbox3df->pointer)
 
-(define aabbox3df-type
+(define-public aabbox3df
   (list vector3df vector3df))
 
 (define-public (make-aabbox3df)
   (pointer->aabbox3df
-   (make-c-struct aabbox3df-type '((0 0 0) (0 0 0)))))
+   (make-c-struct aabbox3df '((0 0 0) (0 0 0)))))
 
 (define-foreign aabbox3d-add-internal-point
   void "irr_core_aabbox3d_addInternalPoint" (list '* '*))
index 7816686b02ca761598996e63f7d0e0fdabba9042..0bdf0f0c908b2fbff0bdc2fd71a01fc80ad51f06 100644 (file)
@@ -79,7 +79,7 @@
   '* "irr_video_getName" (list '*))
 
 ;; s3dvertex struct
-(define-wrapped-pointer-type s3dvertex
+(define-wrapped-pointer-type s3dvertex-type
   s3dvertex?
   pointer->s3dvertex s3dvertex->pointer
   (lambda (vertex port)
@@ -88,7 +88,7 @@
 
 (export s3dvertex->pointer)
 
-(define s3dvertex-type
+(define-public s3dvertex
   (list ffi-core:vector3df
         ffi-core:vector3df
         scolor
 
 (define-public (make-s3dvertex position normal color t-coords)
   (pointer->s3dvertex
-   (make-c-struct s3dvertex-type (list position normal color t-coords))))
+   (make-c-struct s3dvertex (list position normal color t-coords))))
+
+(define-public (vertex-position vertex)
+  (let ((data (parse-c-struct (s3dvertex->pointer vertex) s3dvertex)))
+    (car data)))
+
+;; smateriallayer struct
+(define-public smateriallayer
+  (list '* uint8 uint8 uint8 uint8 uint8 int8 '* '*))
+
+;; smaterial struct
+(define-wrapped-pointer-type smaterial-type
+  smaterial?
+  pointer->smaterial smaterial->pointer
+  (lambda (material port)
+    (format port "#<smaterial ~x>"
+            (pointer-address (smaterial->pointer material)))))
+
+(export smaterial->pointer)
+
+(define-public smaterial
+  (list smateriallayer smateriallayer smateriallayer smateriallayer  ; textureLayer[4]
+        uint32  ; materialType
+        scolor  ; ambientColor
+        scolor  ; diffuseColor
+        scolor  ; emissiveColor
+        scolor  ; specularColor
+        float   ; shininess
+        float   ; materialTypeParam
+        float   ; materialTypeParam2
+        float   ; thickness
+        uint8   ; zBuffer
+        uint8   ; antiAliasing
+        (bit-field-group
+         (uint8 4)  ; colorMask:4
+         (uint8 3)  ; colorMaterial:3
+         (uint32 4) ; blendOperation:4
+         (uint8 3)  ; polygonOffsetFactor:3
+         (uint32 1) ; polygonOffsetDirection:1
+         (uint8 1)  ; wireframe:1
+         (uint8 1)  ; pointCloud:1
+         (uint8 1)  ; gouraudShading:1
+         (uint8 1)  ; lighting:1
+         (uint8 1)  ; zWriteEnable:1
+         (uint8 1)  ; backfaceCulling:1
+         (uint8 1)  ; frontfaceCulling:1
+         (uint8 1)  ; fogEnable:1
+         (uint8 1)  ; normalizeNormals:1
+         (uint8 1)  ; useMipMaps:1
+        )))
+
+;; (define-public (make-material #:key
+;;                               (wireframe #f)
+;;                               (lighting #t))
+;;   material)
index 1fa54978d7b76c441ddef95761579fd8eef628d1..7bc62084e77dd0b630a72d395c74b139f86e5a77 100644 (file)
 
 (define-module (irrlicht core)
   #:use-module ((irrlicht bindings core) #:prefix ffi-core:)
+  #:export (aabbox3d-reset!)
   #:re-export ((ffi-core:make-aabbox3df . make-aabbox3df)))
+
+(define (aabbox3d-reset! box init-value)
+  (ffi-core:aabbox3d-reset
+   (ffi-core:aabbox3df->pointer box)
+   (ffi-core:vector3df->pointer init-value)))
index 36ea0ec8a4afa77ff73448ff984f81c3d0a0a4a7..b0f48d999957b95dd1a2cca85b00989b093718ee 100644 (file)
@@ -28,7 +28,8 @@
             get-fps
             get-texture
             get-video-driver-name)
-  #:re-export ((ffi-video:make-s3dvertex . make-s3dvertex)))
+  #:re-export ((ffi-video:make-s3dvertex . make-s3dvertex)
+               (ffi-video:vertex-position . vertex-position)))
 
 (define* (begin-scene driver
                       #:key