#:use-module ((irrlicht bindings core) #:prefix ffi-core:)
#:use-module (irrlicht util foreign))
-;; E_DRIVER_TYPE enum
+;; irr_video_E_BLEND_OPERATION enum
+(define-public EBO_NONE 0)
+(define-public EBO_ADD 1)
+(define-public EBO_SUBTRACT 2)
+(define-public EBO_REVSUBTRACT 3)
+(define-public EBO_MIN 4)
+(define-public EBO_MAX 5)
+(define-public EBO_MIN_FACTOR 6)
+(define-public EBO_MAX_FACTOR 7)
+(define-public EBO_MIN_ALPHA 8)
+(define-public EBO_MAX_ALPHA 9)
+
+;; irr_video_E_COMPARISON_FUNC enum
+(define-public ECFN_NEVER 0)
+(define-public ECFN_LESSEQUAL 1)
+(define-public ECFN_EQUAL 2)
+(define-public ECFN_LESS 3)
+(define-public ECFN_NOTEQUAL 4)
+(define-public ECFN_GREATEREQUAL 5)
+(define-public ECFN_GREATER 6)
+(define-public ECFN_ALWAYS 7)
+
+;; irr_video_E_COLOR_PLANE enum
+(define-public ECP_NONE 0)
+(define-public ECP_ALPHA 1)
+(define-public ECP_RED 2)
+(define-public ECP_GREEN 4)
+(define-public ECP_BLUE 8)
+(define-public ECP_RGB 14)
+(define-public ECP_ALL 15)
+
+;; irr_video_E_ANTI_ALIASING_MODE enum
+(define-public EAAM_OFF 0)
+(define-public EAAM_SIMPLE 1)
+(define-public EAAM_QUALITY 3)
+(define-public EAAM_LINE_SMOOTH 4)
+(define-public EAAM_POINT_SMOOTH 8)
+(define-public EAAM_FULL_BASIC 15)
+(define-public EAAM_ALPHA_TO_COVERAGE 16)
+
+;; irr_video_E_COLOR_MATERIAL enum
+(define-public ECM_NONE 0)
+(define-public ECM_DIFFUSE 1)
+(define-public ECM_AMBIENT 2)
+(define-public ECM_EMISSIVE 3)
+(define-public ECM_SPECULAR 4)
+(define-public ECM_DIFFUSE_AND_AMBIENT 5)
+
+;; irr_video_E_DRIVER_TYPE enum
(define-public EDT_NULL 0)
(define-public EDT_SOFTWARE 1)
(define-public EDT_BURNINGSVIDEO 2)
(define-public EMF_BLEND_OPERATION #x40000)
(define-public EMF_POLYGON_OFFSET #x80000)
+;; irr_video_E_POLYGON_OFFSET enum
+(define-public EPO_BACK 0)
+(define-public EPO_FRONT 1)
+
+;;irr_video_E_MATERIAL_TYPE enum
+(define-public EMT_SOLID 0)
+(define-public EMT_SOLID_2_LAYER 1)
+(define-public EMT_LIGHTMAP 2)
+(define-public EMT_LIGHTMAP_ADD 3)
+(define-public EMT_LIGHTMAP_M2 4)
+(define-public EMT_LIGHTMAP_M4 5)
+(define-public EMT_LIGHTMAP_LIGHTING 6)
+(define-public EMT_LIGHTMAP_LIGHTING_M2 7)
+(define-public EMT_LIGHTMAP_LIGHTING_M4 8)
+(define-public EMT_DETAIL_MAP 9)
+(define-public EMT_SPHERE_MAP 10)
+(define-public EMT_REFLECTION_2_LAYER 11)
+(define-public EMT_TRANSPARENT_ADD_COLOR 12)
+(define-public EMT_TRANSPARENT_ALPHA_CHANNEL 13)
+(define-public EMT_TRANSPARENT_ALPHA_CHANNEL_REF 14)
+(define-public EMT_TRANSPARENT_VERTEX_ALPHA 15)
+(define-public EMT_TRANSPARENT_REFLECTION_2_LAYER 16)
+(define-public EMT_NORMAL_MAP_SOLID 17)
+(define-public EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR 18)
+(define-public EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA 19)
+(define-public EMT_PARALLAX_MAP_SOLID 20)
+(define-public EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR 21)
+(define-public EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA 22)
+(define-public EMT_ONETEXTURE_BLEND 23)
+(define-public EMT_FORCE_32BIT #x7fffffff)
+
;; scolor struct
(define-public scolor
(format port "#<s3dvertex ~x>"
(pointer-address (s3dvertex->pointer vertex)))))
-(export s3dvertex->pointer)
+(export pointer->s3dvertex
+ s3dvertex->pointer)
(define-public s3dvertex
(list ffi-core:vector3df
scolor
ffi-core:vector2df))
-(define-public (make-s3dvertex position normal color t-coords)
- (pointer->s3dvertex
- (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 '* '*))
(format port "#<smaterial ~x>"
(pointer-address (smaterial->pointer material)))))
-(export smaterial->pointer)
+(export pointer->smaterial
+ smaterial->pointer)
(define-public smaterial
(list smateriallayer smateriallayer smateriallayer smateriallayer ; textureLayer[4]
(uint8 1) ; normalizeNormals:1
(uint8 1) ; useMipMaps:1
)))
-
-;; (define-public (make-material #:key
-;; (wireframe #f)
-;; (lighting #t))
-;; material)
#:use-module ((irrlicht bindings core) #:prefix ffi-core:)
#:use-module ((irrlicht bindings video) #:prefix ffi-video:)
#:use-module (irrlicht util)
+ #:use-module (irrlicht util foreign)
#:export (begin-scene
end-scene
get-fps
get-texture
- get-video-driver-name)
- #:re-export ((ffi-video:make-s3dvertex . make-s3dvertex)
- (ffi-video:vertex-position . vertex-position)))
+ get-video-driver-name
+ make-s3dvertex
+ vertex-position
+ make-material))
(define* (begin-scene driver
#:key
(define (get-video-driver-name driver)
(pointer->string
(ffi-video:get-video-driver-name driver)))
+
+;; s3d vertices
+(define (make-s3dvertex position normal color t-coords)
+ (ffi-video:pointer->s3dvertex
+ (make-c-struct ffi-video:s3dvertex
+ (list position normal color t-coords))))
+
+(define (vertex-position vertex)
+ (let ((data (parse-c-struct (ffi-video:s3dvertex->pointer vertex)
+ ffi-video:s3dvertex)))
+ (car data)))
+
+;; smaterial
+(define* (make-material #:key (wireframe #f) (lighting #t))
+ (let ((material
+ (list
+ ;; textureLayer[4]
+ (list %null-pointer 0 0 0 0 0 0 %null-pointer %null-pointer)
+ (list %null-pointer 0 0 0 0 0 0 %null-pointer %null-pointer)
+ (list %null-pointer 0 0 0 0 0 0 %null-pointer %null-pointer)
+ (list %null-pointer 0 0 0 0 0 0 %null-pointer %null-pointer)
+ ffi-video:EMT_SOLID ; materialType
+ (list 255 255 255 255) ; ambientColor
+ (list 255 255 255 255) ; diffuseColor
+ (list 0 0 0 0) ; emissiveColor
+ (list 255 255 255 255) ; specularColor
+ 0 ; shininess
+ 0 ; materialTypeParam
+ 0 ; materialTypeParam2
+ 1 ; thickness
+ ffi-video:ECFN_LESSEQUAL ; zBuffer
+ ffi-video:EAAM_SIMPLE ; antiAliasing
+ (list
+ ffi-video:ECP_ALL ; colorMask
+ ffi-video:ECM_DIFFUSE ; colorMaterial
+ ffi-video:EBO_NONE ; blendOperation
+ 0 ; polygonOffsetFactor
+ ffi-video:EPO_FRONT ; polygonOffsetDirection
+ (bool->integer wireframe) ; wireframe
+ (bool->integer #f) ; pointCloud
+ (bool->integer #t) ; gouraudShading
+ (bool->integer lighting) ; lighting
+ (bool->integer #t) ; zWriteEnable
+ (bool->integer #t) ; backfaceCulling
+ (bool->integer #f) ; frontfaceCulling
+ (bool->integer #f) ; fogEnable
+ (bool->integer #f) ; normalizeNormals
+ (bool->integer #t) ; useMipMaps
+ ))))
+ (ffi-video:pointer->smaterial
+ (make-c-struct+ ffi-video:smaterial material))))