Menu

[r760]: / trunk / lispbuilder-cal3d / cal3d / util-cal3d.lisp  Maximize  Restore  History

Download this file

42 lines (34 with data), 1.4 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
;; Cal#D library using CFFI for foreign function interfacing...
;; (C)2006 Luke Crook <luke@balooga.com>
;; see COPYING for license
;; This file contains some useful functions for using Cal3D from Common lisp
(in-package #:lispbuilder-cal3d)
(defun get-ambient-color (renderer)
(let ((meshcolor (cffi:foreign-alloc :uint8 :count 4 :initial-element 0))
(color (vector 0 0 0 0)))
(cal3d::CalRenderer_GetAmbientColor renderer (cffi::make-pointer (cffi:pointer-address meshcolor)))
(dotimes (i 4)
(setf (elt color i)
(/ (cffi:mem-aref meshcolor :uint8 i) 255.0)))
(cffi:foreign-free meshcolor)
color))
(defun get-diffuse-color (renderer)
(let ((meshcolor (cffi:foreign-alloc :uint8 :count 4 :initial-element 0))
(color (vector 0 0 0 0)))
(cal3d::CalRenderer_getDiffuseColor renderer meshcolor)
(dotimes (i 4)
(setf (elt color i)
(/ (cffi:mem-aref meshcolor :uint8 i) 255.0)))
(cffi:foreign-free meshcolor)
color))
(defun get-specular-color (renderer)
(let ((meshcolor (cffi:foreign-alloc :uint8 :count 4 :initial-element 0))
(color (vector 0 0 0 0)))
(cal3d::CalRenderer_getSpecularColor renderer meshcolor)
(dotimes (i 4)
(setf (elt color i)
(/ (cffi:mem-aref meshcolor :uint8 i) 255.0)))
(cffi:foreign-free meshcolor)
color))
(defun get-specular-exponent (renderer)
(cal3d::CalRenderer_getShininess renderer))
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.