This repository was archived by the owner on Oct 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathllgs-engine-cl.lisp
More file actions
203 lines (149 loc) · 6.81 KB
/
Copy pathllgs-engine-cl.lisp
File metadata and controls
203 lines (149 loc) · 6.81 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
;;;; llgs-engine-cl.lisp
(in-package #:llgs-engine-cl)
(defun load-llgsengine (debug)
"LLGS Engine DLL load"
(if (not debug)
(cffi:define-foreign-library llgs-engine
(:unix "llgs-engine.so")
(t (:default "llgs-engine")))
(cffi:define-foreign-library llgs-engine
(:unix "llgs-engine-debug.so")
(t (:default "llgs-engine-debug"))))
(cffi:use-foreign-library llgs-engine))
(defun close-llgsengine ()
(cffi:close-foreign-library 'llgs-engine))
;; void r_init(char *pluginsfile, char *configfile, char *logfile, char *rendersystem, char *resourcesfile)
(cffi:defcfun "r_init" :void
(pluginsfile :string) (configfile :string) (logfile :string)
(rendersystem :string) (resfile :string))
(defun render-init (pluginscfg conffile logfile rendersystem resfile)
"Init Ogre 3D renderer with some basic parameters. Example call: (render-init \"plugins_d.cfg\" \"mygame.cfg\" \"mygame.log\" 'directx, \"resources.cfg\")"
(let ((rsys (cond ((eq rendersystem 'directx) "Direct3D9 Rendering Subsystem")
(t "OpenGL Rendering Subsystem"))))
(r-init pluginscfg conffile logfile rsys resfile)))
(cffi:defcfun "r_shutdown" :void)
(defun render-shutdown ()
"Shutdown engine after done using it."
(r-shutdown))
;; void r_createrenderwindow(char *title, int w, int h, int fullscreen);
(cffi:defcfun "r_createrenderwindow" :void
(title :string) (w :int) (h :int) (fullscreen :int))
(defun render-createrenderwindow (title &key (w 800) (h 600) (fullscreen 0))
"Create Ogre 3D renderwindow with width, height resolution and fullscreen flag."
(r-createrenderwindow title w h fullscreen))
;; void r_createscenemanager(char *type, char *name);
(cffi:defcfun "r_createscenemanager" :void
(type :string) (name :string))
(defun render-createscenemanager (type name)
"Create Ogre 3D scenemanager, type can be EXTERIOR_CLOSE EXTERIOR_FAR
EXTERIOR_REAL_FAR and INTERIOR."
(r-createscenemanager type name))
;void *r_createcamera(char *name);
(cffi:defcfun "r_createcamera" :pointer
(name :string))
(defun render-createcamera (name)
(r-createcamera name))
;void r_setcamerapos(void *camptr, float x, float y, float z);
(cffi:defcfun "r_setcamerapos" :void
(camptr :pointer) (x :float) (y :float) (z :float))
(defun render-setcamerapos (camptr x y z)
(r-setcamerapos camptr x y z))
;LLGSENGINE_API void r_movecamerarel(void *camptr, float x, float y, float z);
(cffi:defcfun ("r_movecamerarel" render-movecamerarel) :void
(camptr :pointer) (x :float) (y :float) (z :float))
;LLGSENGINE_API void r_movecameraforward(void *camptr, float dist);
(cffi:defcfun ("r_movecameraforward" render-movecameraforward) :void
(camptr :pointer) (dist :float))
; void r_cameralookat(void *camptr, float x, float y, float z);
(cffi:defcfun "r_cameralookat" :void
(camptr :pointer) (x :float) (y :float) (z :float))
(defun render-cameralookat (camptr x y z)
(r-cameralookat camptr x y z))
;LLGSENGINE_API void r_rotatecamerax(void *camptr, float radian);
(cffi:defcfun ("r_rotatecamerax" render-rotatecamerax) :void (camptr :pointer) (radian :float))
;LLGSENGINE_API void r_rotatecameray(void *camptr, float radian);
(cffi:defcfun ("r_rotatecameray" render-rotatecameray) :void (camptr :pointer) (radian :float))
;LLGSENGINE_API void r_rotatecameraz(void *camptr, float radian);
(cffi:defcfun ("r_rotatecameraz" render-rotatecameraz) :void (camptr :pointer) (radian :float))
; void r_setcameranearclipdist(void *camptr, float dist);
(cffi:defcfun "r_setcameranearclipdist" :void
(camptr :pointer) (dist :float))
(defun render-setcameranearclipdist (camptr dist)
(r-setcameranearclipdist camptr dist))
(cffi:defcfun ("r_setcamerafarclipdist" render-setcamerafarclipdist) :void
(camptr :pointer) (dist :float))
; void r_setcameraasviewport(void *camptr);
(cffi:defcfun "r_setcameraasviewport" :void
(camptr :pointer))
(defun render-setcameraasviewport (camptr)
(r-setcameraasviewport camptr))
; void r_setviewportbackground(float r, float g, float b);
(cffi:defcfun "r_setviewportbackground" :void
(r :float) (g :float) (b :float))
(defun render-setviewportbackground (r g b)
(r-setviewportbackground r g b))
; void r_setambientlight(float r, float g, float b);
(cffi:defcfun "r_setambientlight" :void
(r :float) (g :float) (b :float))
(defun render-setambientlight (r g b)
(r-setambientlight r g b))
; void r_renderoneframe();
(cffi:defcfun "r_renderoneframe" :void)
(defun render-oneframe ()
(r-renderoneframe))
; void r_setskybox(char *materialname);
(cffi:defcfun "r_setskybox" :void
(materialname :string))
(defun render-setskybox (matname)
(r-setskybox matname))
; void r_screenshottofile(char *namebase);
(cffi:defcfun "r_screenshottofile" :void
(namebase :string))
(defun render-screenshottofile (namebase)
(r-screenshottofile namebase))
; void *t_createtimer();
(cffi:defcfun "t_createtimer" :pointer)
(defun timer-create ()
(t-createtimer))
; void t_resettimer(void *timerptr);
(cffi:defcfun "t_resettimer" :void
(timerptr :pointer))
(defun timer-reset (timerptr)
(t-resettimer timerptr))
; unsigned long t_gettimermicroseconds(void *timerptr);
(cffi:defcfun "t_gettimermicroseconds" :unsigned-long
(timerptr :pointer))
(defun timer-getmicroseconds (timerptr)
(t-gettimermicroseconds timerptr))
; void *r_simpletextpanel(char *id, char *txt, char *fontname, int fontsize, float x, float y, float w, float h, int pixelmetrics);
(cffi:defcfun ("r_simpletextpanel" render-createsimpletext) :pointer
(id :string) (txt :string) (fontname :string) (fontsize :float)
(x :float) (y :float)
(w :float) (h :float)
(pixelmetrics :int))
; void r_simpletextsetcolor(char *id, float r, float g, float b);
(cffi:defcfun ("r_simpletextsetcolor" render-simpletextcolor) :void
(id :string) (r :float) (g :float) (b :float))
; void r_simpletextshow(char *id);
(cffi:defcfun ("r_simpletextshow" render-simpletextshow) :void
(id :string))
; void r_simpletexthide(char *id);
(cffi:defcfun ("r_simpletexthide" render-simpletexthide) :void
(id :string))
; void r_simpletextsettext(char *id, char *txt);
(cffi:defcfun ("r_simpletextsettext" render-simpletextsettext) :pointer
(id :string) (txt :string))
;LLGSENGINE_API float r_actfps();
(cffi:defcfun ("r_actfps" render-actfps) :float)
;LLGSENGINE_API float r_minfps();
(cffi:defcfun ("r_minfps" render-minfps) :float)
;LLGSENGINE_API float r_maxfps();
(cffi:defcfun ("r_maxfps" render-maxfps) :float)
;LLGSENGINE_API long r_trianglecount();
(cffi:defcfun ("r_trianglecount" render-trianglecount) :long)
;LLGSENGINE_API long r_batchcount();
(cffi:defcfun ("r_batchcount" render-batchcount) :long)
;LLGSENGINE_API void *r_simpleimagepanel(char *id, char *matname, float x, float y, float w, float h, int pixelmetrics);
(cffi:defcfun ("r_simpleimagepanel" render-createsimpleimage) :pointer
(id :string) (matname :string) (x :float) (y :float)
(w :float) (h :float) (pixelmetrics :int))