-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapplication-mixin.lisp
More file actions
executable file
·1325 lines (1143 loc) · 86.6 KB
/
application-mixin.lisp
File metadata and controls
executable file
·1325 lines (1143 loc) · 86.6 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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(in-package :krma)
(eval-when (:compile-toplevel :load-toplevel)
(when krma::*debug*
(declaim (optimize (safety 3) (debug 3)))))
(defclass pipeline-store-mixin ()
((2d-point-list-pipeline :accessor pipeline-store-2d-point-list-pipeline)
(2d-line-list-pipeline :accessor pipeline-store-2d-line-list-pipeline)
(2d-line-strip-pipeline :accessor pipeline-store-2d-line-strip-pipeline)
(2d-triangle-list-pipeline :accessor pipeline-store-2d-triangle-list-pipeline)
(2d-triangle-strip-pipeline :accessor pipeline-store-2d-triangle-strip-pipeline)
(3d-point-list-pipeline :accessor pipeline-store-3d-point-list-pipeline)
(3d-line-list-pipeline :accessor pipeline-store-3d-line-list-pipeline)
(3d-line-strip-pipeline :accessor pipeline-store-3d-line-strip-pipeline)
(3d-triangle-list-pipeline :accessor pipeline-store-3d-triangle-list-pipeline)
(3d-triangle-list-with-normals-pipeline :accessor pipeline-store-3d-triangle-list-with-normals-pipeline)
(3d-triangle-strip-pipeline :accessor pipeline-store-3d-triangle-strip-pipeline)
(3d-triangle-strip-with-normals-pipeline :accessor pipeline-store-3d-triangle-strip-with-normals-pipeline))
(:documentation "Abstract superclass of a krma pipeline store. Define your own concrete type with new pipelines based on this mixin. Pipeline store is used with pipeline combination generic functions to pair pipelines with draw lists to render in generic function `render-scene."))
(defclass standard-pipeline-store (pipeline-store-mixin)
()
(:documentation "An concrete class based on pipeline-store-mixin used in krma-test-application."))
(defmethod initialize-instance :after ((instance pipeline-store-mixin) &rest initargs &key dpy)
"Define your own method for initialize-instance for pipeline store to instantiate your own custom pipelines."
(declare (ignore initargs))
(with-slots (3d-point-list-pipeline
3d-line-list-pipeline
3d-line-strip-pipeline
3d-triangle-list-pipeline
3d-triangle-list-with-normals-pipeline
3d-triangle-strip-with-normals-pipeline
3d-triangle-strip-pipeline
2d-point-list-pipeline
2d-line-list-pipeline
2d-line-strip-pipeline
2d-triangle-list-pipeline
#+NOMORE msdf-text-pipeline
2d-triangle-strip-pipeline)
instance
(setf 2d-point-list-pipeline
(make-instance '2d-point-list-pipeline
:dpy dpy
:name :2d-point-list-pipeline
:subpass 1)
2d-line-list-pipeline
(make-instance '2d-line-list-pipeline
:dpy dpy
:name :2d-line-list-pipeline
:subpass 1)
2d-line-strip-pipeline
(make-instance '2d-line-strip-pipeline
:dpy dpy
:name :2d-line-strip-pipeline
:subpass 1)
2d-triangle-list-pipeline
(make-instance '2d-triangle-list-pipeline
:dpy dpy
:name :2d-triangle-list-pipeline
:subpass 1)
#+NOMORE #+NOMORE
msdf-text-pipeline
(make-instance 'msdf-text-pipeline
:dpy dpy
:name :msdf-text-pipeline)
2d-triangle-strip-pipeline
(make-instance '2d-triangle-strip-pipeline
:dpy dpy
:name :2d-triangle-strip-pipeline
:subpass 1)
3d-point-list-pipeline
(make-instance '3d-point-list-pipeline
:dpy dpy
:name :3d-point-list-pipeline
:subpass 0)
3d-line-list-pipeline
(make-instance '3d-line-list-pipeline
:dpy dpy
:name :3d-line-list-pipeline
:subpass 0)
3d-line-strip-pipeline
(make-instance '3d-line-strip-pipeline
:dpy dpy
:name :3d-line-strip-pipeline
:subpass 0)
3d-triangle-list-pipeline
(make-instance '3d-triangle-list-pipeline
:dpy dpy
:name :3d-triangle-list-pipeline
:subpass 0)
3d-triangle-list-with-normals-pipeline
(make-instance '3d-triangle-list-with-normals-pipeline
:dpy dpy
:name :3d-triangle-list-with-normals-pipeline
:subpass 0)
3d-triangle-strip-pipeline
(make-instance '3d-triangle-strip-pipeline
:dpy dpy
:name :3d-triangle-strip-pipeline
:subpass 0)
3d-triangle-strip-with-normals-pipeline
(make-instance '3d-triangle-strip-with-normals-pipeline
:dpy dpy
:name :3d-triangle-strip-with-normals-pipeline
:subpass 0)))
(values))
(defclass window-frame-rate-mixin ()
((show-frame-rate? :initform t :accessor window-show-frame-rate?)
(frame-rate :initform 0 :accessor window-frame-rate)
(frames :initform 0 :accessor %window-frames)
(delta-time :initform 0 :accessor %window-delta-time)
(time :initform (/ (get-internal-real-time) internal-time-units-per-second) :accessor %window-time)
(base-time :initform 0 :accessor %window-base-time)))
(defstruct viewport
(x) ;; in framebuffer coordinates
(y) ;; in framebuffer coordinates
(width) ;; in framebuffer scale
(height) ;; in framebuffer scale
(2d-camera)
(3d-camera)
(scene)) ;; only one scene per viewport
(defstruct (camera
(:conc-name %CAMERA-))
(proj-matrix)
(view-matrix))
(defmethod camera-proj-matrix ((camera camera))
(%camera-proj-matrix camera))
(defmethod camera-view-matrix ((camera camera))
(%camera-view-matrix camera))
(defmethod (setf camera-proj-matrix) (value (camera camera))
(setf (%camera-proj-matrix camera) value))
(defmethod (setf camera-view-matrix) (value (camera camera))
(setf (%camera-view-matrix camera) value))
(defmethod set-camera-width-height ((camera camera) new-width new-height camera-type)
(ecase camera-type
(:2d
(setf (camera-proj-matrix camera) (mortho-vulkan 0 new-width new-height 0 0 1024))
(setf (camera-view-matrix camera) (mlookat (vec3 0 0 +select-box-2d-depth+) (vec3 0 0 0) (vec3 0 1 0))))
(:3d
(setf (camera-proj-matrix camera) (mperspective-vulkan 45 (/ new-width new-height)
0.1 3000
;;*default-znear* *default-zfar*
))
(setf (camera-view-matrix camera) (mlookat (vec3 0 0 1500) (vec3 0 0 0) (vec3 0 1 0)))))
(values))
(defclass krma-window-mixin (window-frame-rate-mixin vk:vulkan-window-mixin)
((queue :accessor window-queue)
(command-pool :accessor window-command-pool)
(viewports :accessor window-viewports)))
;; this is a callback which happens after the native platfrom window has been created but before events start to happen
(defmethod clui::initialize-window-devices ((window vulkan-window-mixin) &rest args &key width height &allow-other-keys)
(declare (ignore args))
(let* ((device (default-logical-device (clui::window-display window)))
(surface (create-window-surface device window)))
(let* ((surface-format (find-supported-format
surface
:requested-image-format (vk::window-desired-format window)
:requested-color-space (vk::window-desired-color-space window)))
(present-mode (vk::get-physical-device-surface-present-mode (vk::paired-gpu surface) surface))
(render-pass (krma::display-stock-render-pass (clui::window-display window))))
(setf (render-pass window) render-pass)
(let ((swapchain (create-swapchain device window width height surface-format present-mode)))
(setup-framebuffers device render-pass swapchain)
(create-frame-resources swapchain (queue-family-index surface))
(values)))))
(defclass krma-window (krma-window-mixin)
())
(defmethod initialize-instance :before ((window krma-window) &rest initargs)
(declare (ignore initargs))
(multiple-value-bind (width height) (if #+(or (and linux x11) win32)(slot-boundp window 'clui::handle) #+cocoa(slot-boundp window 'clui::id)
(window-framebuffer-size window)
(values 640 480))
(setf (krma::window-viewports window)
(list (krma::make-viewport
:x 0 :y 0
:width width
:height height
:2d-camera (make-camera
:proj-matrix (mortho-vulkan 0 width height 0 0 +select-box-2d-depth+)
:view-matrix (mlookat (vec3 0 0 +select-box-2d-depth+) (vec3 0 0 0) (vec3 0 1 0)))
:3d-camera (make-camera
:proj-matrix (mperspective-vulkan
45 (/ width height)
*default-znear* *default-zfar*)
:view-matrix (mlookat (vec3 0 0 1500) (vec3 0 0 0) (vec3 0 1 0)))))))
(values))
(defun update-frame-rate (window)
(let ((app (clui::window-display window)))
(with-slots (frame-rate frames delta-time time base-time) window
(maybe-defer-debug (app)
(incf frames)
(setq time (/ (get-internal-real-time) internal-time-units-per-second))
(setq delta-time (- time base-time))
(when (>= delta-time 1)
(setf frame-rate (float (/ frames delta-time)))
(setq base-time time)
(setq frames 0))))))
(defmethod clui:handle-event :after ((window krma-window-mixin) (event clui::window-resize-event-mixin))
(let ((main-viewport (first (window-viewports window)))
(new-width (clui::window-resize-event-new-width event))
(new-height (clui::window-resize-event-new-height event)))
(unless (or (zerop new-width)
(zerop new-height))
(setf (viewport-width main-viewport) new-width
(viewport-height main-viewport) new-height)
(set-camera-width-height (viewport-3d-camera main-viewport) new-width new-height :3d)
(set-camera-width-height (viewport-2d-camera main-viewport) new-width new-height :2d)
)
(values)))
(defclass krma-application-mixin (vulkan-application-mixin)
((vk::application-name :initform "krma-application")
(dpy :accessor application-display)
(active-scenes :initform nil :accessor active-scenes)
(main-window :initform nil :initarg :main-window :accessor main-window))
(:documentation "Abstract superclass for top-level application objects. Base your own top-level application class on this mixin. Objects based on this type will be bound to krma:*app* after instantiation."))
(defmethod initialize-instance :before ((app krma-application-mixin) &rest initargs &key &allow-other-keys)
(declare (ignorable initargs))
(setq *app* app)
(values))
(defmethod initialize-instance :after ((app krma-application-mixin) &rest initargs &key (display (default-display)) &allow-other-keys)
(declare (ignorable initargs))
(setf (application-display app) display)
(setf (main-window app) (make-instance 'window :display display :title (vk::application-name app)))
(let* ((main-window (main-window app))
(main-viewport (first (window-viewports main-window)))
(new-scene (make-instance (scene-class app) :app app :dpy display)))
(setf (viewport-scene main-viewport) new-scene)
(push new-scene (active-scenes app))
(push app (display-applications (clui::window-display main-window)))
(let ((device (default-logical-device (clui::window-display main-window))))
(with-slots (queue command-pool) main-window
(let ((index (queue-family-index (render-surface main-window))))
(setf queue (find-queue device index))
(setf command-pool (find-command-pool device index)))))
(values)))
(defmethod application-default-font ((application krma-application-mixin))
(default-system-font (clui::window-display (main-window application))))
(defmethod application-scene ((application krma-application-mixin))
(first (active-scenes application)))
(defclass krma-enabled-display-mixin (vk:vulkan-enabled-display-mixin)
((pipeline-store :accessor krma-pipeline-store)
(texture-sampler :accessor krma-texture-sampler)
(applications :accessor display-applications :initform nil)
(compactor-thread :initform nil :accessor compactor-thread)
(current-frame-cons :initform (list 0) :accessor current-frame-cons)
(current-draw-data-cons :initform (list 0) :accessor current-draw-data-cons)
(retained-mode-handle-count-cons :initform (list -1) :accessor retained-mode-handle-count-cons)
(immediate-mode-work-function-1 :initform nil :accessor immediate-mode-work-function-1)
(immediate-mode-work-function-2 :initform nil :accessor immediate-mode-work-function-2)
(immediate-mode-work-function-3 :initform nil :accessor immediate-mode-work-function-3)
(backtrace :initform nil :accessor system-backtrace)
(error-msg :initform nil :accessor system-error-msg)
(select-box-coords :initform (vec4 -1 -1 -1 -1) :accessor krma-select-box-coords)
(last-select-box-width :initform 0 :accessor last-select-box-width)
(last-select-box-height :initform 0 :accessor last-select-box-height)
(select-box-size :initform -1 :accessor krma-select-box-size)
(select-boxes-descriptor-set-layout :initform nil :accessor krma-select-boxes-descriptor-set-layout)
(select-boxes-descriptor-sets :initform nil :accessor krma-select-boxes-descriptor-sets)
(select-box-2d-memory-resources :initform nil :accessor krma-select-box-2d-memory-resources)
(select-box-3d-memory-resources :initform nil :accessor krma-select-box-3d-memory-resources)
(select-box-2d :initform nil :accessor krma-select-box-2d)
(select-box-3d :initform nil :accessor krma-select-box-3d)
(ubershader-per-instance-descriptor-set-layout :initform nil :accessor krma-ubershader-per-instance-descriptor-set-layout)
(ubershader-per-instance-descriptor-set :initform nil :accessor krma-ubershader-per-instance-descriptor-set)
(cc-semaphore :initform (bt:make-semaphore :name "compacting-complete" :count 1)
:accessor compacting-complete-semaphore)
(fic-semaphore :initform (bt:make-semaphore :name "frame-iteration-complete")
:accessor frame-iteration-complete-semaphore)
(font :initform nil :accessor default-system-font)
(stock-render-pass :initform nil :accessor display-stock-render-pass)
(hovered :initform () :accessor krma-hovered)
(hovered-3d :initform () :accessor krma-hovered-3d))
(:default-initargs :enable-fragment-stores-and-atomics t))
(defmethod shutdown-run-loop ((dpy krma-enabled-display-mixin))
(vk::shutdown-application dpy)
(values))
(defun most-specifically-hovered-2d (2d-select-box x y)
(when 2d-select-box
(loop for i from (1- +select-box-2d-depth+) downto 0
do (when (not (zerop (aref 2d-select-box x y i)))
(return (aref 2d-select-box x y i)))
finally (return nil))))
(defun most-specifically-hovered-2d-object (2d-select-box x y)
(when 2d-select-box
(let ((hovered (most-specifically-hovered-2d 2d-select-box x y)))
(when hovered
(let ((object (object-from-id hovered)))
object)))))
(defun all-hovered-2d (2d-select-box x y)
(loop for i from 0 below +select-box-2d-depth+
with result = ()
unless (zerop (aref 2d-select-box x y i))
do (push (aref 2d-select-box x y i) result)
finally (return result)))
(defun all-hovered-3d (3d-select-box x y)
(loop for i from 0 below +select-box-3d-depth+
with result = ()
unless (zerop (aref 3d-select-box x y i))
do (push (aref 3d-select-box x y i) result)
finally (return result)))
(defun focused-hovered-2d (2d-select-box x y)
(first (remove-if #'(lambda (list)
(every #'zerop list))
(loop for i from (1- +select-box-2d-depth+) downto (1- +view-depth+) by +view-depth+
collect (loop for j from i downto 0 repeat +view-depth+
unless (zerop (aref 2d-select-box x y j))
collect (aref 2d-select-box x y j))))))
#+NIL
(defun focused-hovered-2d (2d-select-box x y)
(let ((i (loop for i from (1- +select-box-2d-depth+) downto 0
when (and (zerop (mod (1+ i) +view-depth+))
(not (zerop (aref 2d-select-box x y i))))
do (return i)
finally (return 0))))
(loop for j from i
repeat +view-depth+
with result = ()
unless (zerop (aref 2d-select-box x y j))
do (push (aref 2d-select-box x y j) result)
finally (return (nreverse result)))))
(defun monitor-select-boxes (dpy)
;; note: could put this logic in pointer-motion-event on krma-window-mixin
(let* ((all-hovered (all-hovered-2d (krma-select-box-2d dpy) 0 0)))
(flet ((exit-event (hovered)
(let ((object (object-from-id hovered)))
(when object
(if (clui::window-p object)
(multiple-value-bind (x y) (window-cursor-position object)
(handle-event object (make-instance 'pointer-exit-event
:window object
:timestamp (get-internal-real-time)
:x x :y y)))
(handle-event object (make-instance 'pointer-exit-event
:window object
:timestamp (get-internal-real-time)))))))
(enter-event (hovered)
(let ((object (object-from-id hovered)))
(when object
(if (clui::window-p object)
(multiple-value-bind (x y) (window-cursor-position object)
(handle-event object (make-instance 'pointer-enter-event
:window object
:timestamp (get-internal-real-time)
:x x :y y)))
(handle-event object (make-instance 'pointer-enter-event
:window object
:timestamp (get-internal-real-time))))))))
;;(print (krma-select-box-2d dpy))
(let ((difference (set-difference (krma-hovered dpy) all-hovered)))
;;(format t "~%0: ~S" difference)
(mapcar #'exit-event difference))
(let ((difference (set-difference all-hovered (krma-hovered dpy))))
;;(format t "~%1: ~S" difference)
(mapcar #'enter-event difference))
;;(format t "~%2: ~S" all-hovered)
(setf (krma-hovered dpy) all-hovered)))
(unless (krma-hovered dpy)
(let* ((all-hovered (all-hovered-3d (krma-select-box-3d dpy) 0 0)))
(flet ((exit-event (hovered)
(let ((object (object-from-id hovered)))
(when object
(if (clui::window-p object)
(multiple-value-bind (x y) (window-cursor-position object)
(handle-event object (make-instance 'pointer-exit-event
:window object
:timestamp (get-internal-real-time)
:x x :y y)))
(handle-event object (make-instance 'pointer-exit-event
:window object
:timestamp (get-internal-real-time)))))))
(enter-event (hovered)
(let ((object (object-from-id hovered)))
(when object
(if (clui::window-p object)
(multiple-value-bind (x y) (window-cursor-position object)
(handle-event object (make-instance 'pointer-enter-event
:window object
:timestamp (get-internal-real-time)
:x x :y y)))
(handle-event object (make-instance 'pointer-enter-event
:window object
:timestamp (get-internal-real-time))))))))
;;(print (krma-select-box-2d dpy))
(let ((difference (set-difference (krma-hovered-3d dpy) all-hovered)))
;;(format t "~%0: ~S" difference)
(mapcar #'exit-event difference))
(let ((difference (set-difference all-hovered (krma-hovered-3d dpy))))
;;(format t "~%1: ~S" difference)
(mapcar #'enter-event difference))
;;(format t "~%2: ~S" all-hovered)
(setf (krma-hovered-3d dpy) all-hovered)))))
(defun make-select-boxes-descriptor-set-layout-bindings (dpy)
(declare (ignore dpy)) ;; set 1
(list (make-instance 'storage-buffer-for-fragment-shader-dsl-binding)
(make-instance 'storage-buffer-for-fragment-shader-dsl-binding
:binding 1)))
(defun create-select-boxes-descriptor-set-layout (device dpy)
(setf (krma-select-boxes-descriptor-set-layout dpy)
(create-descriptor-set-layout device :bindings (make-select-boxes-descriptor-set-layout-bindings dpy))))
(defun make-ubershader-per-instance-descriptor-set-layout-bindings (dpy)
;; set 2
(list (make-instance 'descriptor-set-layout-binding
:type VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
:count 1
:flags VK_SHADER_STAGE_FRAGMENT_BIT
:samplers (list (krma-texture-sampler dpy)))))
(defun create-ubershader-per-instance-descriptor-set-layout (device dpy)
(setf (krma-ubershader-per-instance-descriptor-set-layout dpy)
(create-descriptor-set-layout device :bindings (make-ubershader-per-instance-descriptor-set-layout-bindings dpy))))
(defun setup-krma (dpy &rest initargs)
(declare (ignorable initargs))
(setf (krma-texture-sampler dpy) (create-sampler (default-logical-device dpy) :allocator (allocator dpy)))
(create-select-boxes-descriptor-set-layout (default-logical-device dpy) dpy)
(create-ubershader-per-instance-descriptor-set-layout (default-logical-device dpy) dpy)
(setf (krma-pipeline-store dpy) (make-instance 'standard-pipeline-store :dpy dpy))
(let* ((helper-window (clui::helper-window dpy))
(device (default-logical-device dpy))
(index (queue-family-index (render-surface helper-window)))
(queue (find-queue device index))
(command-pool (find-command-pool device index))
(command-buffer (elt (command-buffers command-pool) 0))
(descriptor-pool (default-descriptor-pool dpy))
(sampler (krma-texture-sampler dpy))
(texture-dsl (create-descriptor-set-layout
device
:bindings (list (make-instance 'descriptor-set-layout-binding
:type VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER
:count 1
:flags VK_SHADER_STAGE_FRAGMENT_BIT
:samplers (list sampler))))))
(device-wait-idle device)
(reset-command-pool device command-pool)
;; one time commands here.
(unless (probe-file (asdf/system:system-relative-pathname :krma "submodules/krma-fonts/rm16cache.json"))
(sdf-bmfont:create-bmfont
(asdf/system:system-relative-pathname
:krma "submodules/krma-fonts/Roboto_Mono/static/RobotoMono-Medium.ttf")
(asdf/system:system-relative-pathname :krma "submodules/krma-fonts/rm16cache.json")
:size 16 :mode :msdf+a :type :json :spread 8))
(uiop/filesystem:with-current-directory
((asdf/system:system-relative-pathname :krma "submodules/krma-fonts/"))
(setf (default-system-font dpy)
(vulkan-make-font
device queue sampler texture-dsl descriptor-pool command-buffer
:cache-file "rm16cache.json")))
(let* ((bpp 4)
(bitmap (make-array bpp :element-type '(unsigned-byte 8) :initial-element #xff)))
(setq *white-texture*
(make-vulkan-texture device queue sampler texture-dsl descriptor-pool command-buffer bpp bitmap 1 1)))
(values)))
(defmethod initialize-instance :after ((instance krma-enabled-display-mixin) &rest initargs)
(apply #'setup-krma instance initargs)
(values))
(defclass krma-test-application (krma-application-mixin)
((vk::application-name :initform "krma-test-application"))
(:documentation "A demo application for krma."))
(defgeneric scene-class (application)
(:documentation "Define your own scene-class method for your custom application object to tell krma which type of scene to use in your application."))
(defmethod scene-class ((application krma-application-mixin))
'standard-scene)
(defun add-2d-point-primitive (x y &key
(color *default-color*)
(point-size *default-point-size*)
(matrix nil)
(group nil)
(object-id 0)
(scene (application-scene *app*)))
"Retained-mode function, creates a primitive, returns a handle. Calls scene-add-2d-point-primitive with color defaulting to *default-color*, point-size defaulting to *default-point-size*, matrix defaulting to nil (identity), group defaulting to nil (no group), and scene defaulting to (application-scene *app*). The required arguments x and y must be real numbers."
(scene-add-2d-point-primitive scene group matrix point-size color x y object-id))
(defun add-2d-point (x y &key
(color *default-color*)
(point-size *default-point-size*)
(group :default)
(object-id 0)
(scene (application-scene *app*)))
"Retained-mode function, returns no values. Calls scene-add-2d-point with color defaulting to *default-color*, point-size defaulting to *default-point-size*, group defaulting to :default, and scene defaulting to (application-scene *app*). The required arguments x and y must be real numbers."
(scene-add-2d-point scene group point-size color x y object-id))
(defun draw-2d-point (x y &key
(color *default-color*)
(point-size *default-point-size*)
(group :default)
(object-id 0)
(scene (application-scene *app*)))
"Immediate-mode function, returns no values. Calls scene-draw-2d-point with color defaulting to *default-color*, point-size defaulting to *default-point-size*, group defaulting to :default, and scene defaulting to (application-scene *app*). The required arguments x and y must be real numbers."
(scene-draw-2d-point scene group point-size color x y object-id))
(defun add-3d-point-primitive (x y z &key
(color *default-color*)
(point-size *default-point-size*)
(matrix nil)
(group nil)
(object-id 0)
(scene (application-scene *app*)))
"Retained-mode function, creates a primitive, returns a handle. Calls scene-add-3d-point-primitive with color defaulting to *default-color*, point-size defaulting to *default-point-size*, matrix defaulting to nil (identity), group defaulting to nil (no group), and scene defaulting to (application-scene *app*). The required arguments x, y and z must be real numbers."
(scene-add-3d-point-primitive scene group matrix point-size color x y z object-id))
(defun add-3d-point (x y z &key
(color *default-color*)
(point-size *default-point-size*)
(group :default)
(object-id 0)
(scene (application-scene *app*)))
"Retained-mode function, returns no values. Calls scene-add-3d-point with color defaulting to *default-color*, point-size defaulting to *default-point-size*, group defaulting to :default, and scene defaulting to (application-scene *app*). The required arguments x, y and z must be real numbers."
(scene-add-3d-point scene group point-size color x y z object-id))
(defun draw-3d-point (x y z &key
(color *default-color*)
(point-size *default-point-size*)
(group :default)
(object-id 0)
(scene (application-scene *app*)))
"Immediate-mode function, returns no values. Calls scene-draw-3d-point with color defaulting to *default-color*, point-size defaulting to *default-point-size*, group defaulting to :default, and scene defaulting to (application-scene *app*). The required arguments x, y and z must be real numbers."
(scene-draw-3d-point scene group point-size color x y z object-id))
(defun add-2d-line-primitive (x0 y0 x1 y1 &key
(color *default-color*)
(line-thickness *default-line-thickness*)
(matrix nil)
(group nil)
(object-id 0)
(scene (application-scene *app*)))
"Retained-mode function, creates a primitive, returns a handle. Calls scene-add-2d-line-primitive with color defaulting to *default-color*, line-thickness defaulting to *default-line-thickness*, matrix defaulting to nil (identity), group defaulting to nil (no group), and scene defaulting to (application-scene *app*). The required arguments x0, y0, x1, and y1 are the endpoints of the line and must be real numbers."
(scene-add-2d-line-primitive scene group matrix line-thickness color x0 y0 x1 y1 object-id))
(defun add-2d-line (x0 y0 x1 y1 &key
(color *default-color*)
(line-thickness *default-line-thickness*)
(group :default)
(object-id 0)
(scene (application-scene *app*)))
"Retained-mode function, returns no values. Calls scene-add-2d-line with color defaulting to *default-color*, line-thickness defaulting to *default-line-thickness*, group defaulting to nil (no group), and scene defaulting to (application-scene *app*). The required arguments x0, y0, x1 and y1 are the endpoints of the line and must be real numbers."
(scene-add-2d-line scene group line-thickness color x0 y0 x1 y1 object-id))
(defun draw-2d-line (x0 y0 x1 y1 &key
(color *default-color*)
(line-thickness *default-line-thickness*)
(group :default)
(object-id 0)
(scene (application-scene *app*)))
"Immediate-mode function, returns no values. Calls scene-draw-2d-line with color defaulting to *default-color*, line-thickness defaulting to *default-line-thickness*, group defaulting to nil (no group), and scene defaulting to (application-scene *app*). The required arguments x0, y0, x1 and y1 are the endpoints of the line and must be real numbers."
(scene-draw-2d-line scene group line-thickness color x0 y0 x1 y1 object-id))
(defun add-3d-line-primitive (x0 y0 z0 x1 y1 z1 &key
(color *default-color*)
(line-thickness *default-line-thickness*)
(matrix nil)
(group nil)
(object-id 0)
(scene (application-scene *app*)))
"Retained-mode function, creates a primitive, returns a handle. Calls scene-add-3d-line-primitive with color defaulting to *default-color*, line-thickness defaulting to *default-line-thickness*, matrix defaulting to nil (identity), group defaulting to nil (no group), and scene defaulting to (application-scene *app*). The required arguments x0, y0, z0, x1, y1 and z1 are the endpoints of the line and must be real numbers."
(scene-add-3d-line-primitive scene group matrix line-thickness color x0 y0 z0 x1 y1 z1 object-id))
(defun add-3d-line (x0 y0 z0 x1 y1 z1 &key
(color *default-color*)
(line-thickness *default-line-thickness*)
(group :default)
(object-id 0)
(scene (application-scene *app*)))
"Retained-mode function, returns no values. Calls scene-add-3d-line with color defaulting to *default-color*, line-thickness defaulting to *default-line-thickness*, group defaulting to nil (no group), and scene defaulting to (application-scene *app*). The required arguments x0, y0, z0, x1, y1 and z1 are the endpoints of the line and must be real numbers."
(scene-add-3d-line scene group line-thickness color x0 y0 z0 x1 y1 z1 object-id))
(defun draw-3d-line (x0 y0 z0 x1 y1 z1 &key
(color *default-color*)
(line-thickness *default-line-thickness*)
(group :default)
(object-id 0)
(scene (application-scene *app*)))
"Immediate-mode function, returns no values. Calls scene-draw-3d-line-primitive with color defaulting to *default-color*, line-thickness defaulting to *default-line-thickness*, matrix defaulting to nil (identity), group defaulting to nil (no group), and scene defaulting to (application-scene *app*). The required arguments x0, y0, z0, x1, y1 and z1 are the endpoints of the line and must be real numbers."
(scene-draw-3d-line scene group line-thickness color x0 y0 z0 x1 y1 z1 object-id))
(defun add-multicolor-2d-polyline-primitive (vertices &key
(closed? nil)
(line-thickness *default-line-thickness*)
(matrix nil)
(group nil)
(object-id 0)
(scene (application-scene *app*)))
"Retained-mode function, creates a primitive, returns a handle. Calls scene-add-multicolor-2d-polyline-primitive with closed? defaulting to nil, line-thickness defaulting to *default-line-thickness*, matrix defaulting to nil (identity), group defaulting to nil (no group), and scene defaulting to (application-scene *app*). The required argument vertices should be of the form (list x0 y0 color0 x1 y1 color1 ... xn yn colorn) where the x and y values must be real numbers and the color value must be a color."
(scene-add-multicolor-2d-polyline-primitive scene group matrix closed? line-thickness vertices object-id))
(defun add-multicolor-2d-polyline (vertices &key
(closed? nil)
(line-thickness *default-line-thickness*)
(group :default)
(object-id 0)
(scene (application-scene *app*)))
"Retained-mode function, returns no values. Calls scene-add-multicolor-2d-polyline with closed? defaulting to nil. line-thickness defaulting to *default-line-thickness*, group defaulting to :default, and scene defaulting to (application-scene *app*). The required argument vertices should be of the form (list x0 y0 color0 x1 y1 color1 ... xn yn colorn) where the x and y values must be real numbers and the color value must be a color."
(scene-add-multicolor-2d-polyline scene group closed? line-thickness vertices object-id))
(defun draw-multicolor-2d-polyline (vertices &key
(closed? nil)
(line-thickness *default-line-thickness*)
(group :default)
(object-id 0)
(scene (application-scene *app*)))
"Immediate-mode function, returns no values. Calls scene-draw-multicolor-2d-polyline with closed? defaulting to nil. line-thickness defaulting to *default-line-thickness*, group defaulting to :default, and scene defaulting to (application-scene *app*). The required argument vertices should be of the form (list x0 y0 color0 x1 y1 color1 ... xn yn colorn) where the x and y values must be real numbers and the color value must be a color."
(scene-draw-multicolor-2d-polyline scene group closed? line-thickness vertices object-id))
(defun add-2d-polyline-primitive (vertices &key
(closed? nil)
(color *default-color*)
(line-thickness *default-line-thickness*)
(matrix nil)
(group nil)
(object-id 0)
(scene (application-scene *app*)))
"Retained-mode function, creates a primitive, returns a handle. Calls scene-add-2d-polyline-primitive with closed? defaulting to nil, color defaulting to *default-color*, line-thickness defaulting to *default-line-thickness*, matrix defaulting to nil (identity), group defaulting to nil (no group), and scene defaulting to (application-scene *app*). The required argument vertices should be of the form (list x0 y0 x1 y1 ... xn yn) where the x and y values must be real numbers."
(scene-add-2d-polyline-primitive scene group matrix closed? line-thickness color vertices object-id))
(defun add-2d-polyline (vertices &key
(closed? nil)
(color *default-color*)
(line-thickness *default-line-thickness*)
(group :default)
(object-id 0)
(scene (application-scene *app*)))
"Retained-mode function, returns no values. Calls scene-add-2d-polyline with closed? defaulting to nil, color defaulting to *default-color*, line-thickness defaulting to *default-line-thickness*, group defaulting to :default, and scene defaulting to (application-scene *app*). The required argument vertices should be of the form (list x0 y0 x1 y1 ... xn yn) where the x and y values must be real numbers."
(scene-add-2d-polyline scene group closed? line-thickness color vertices object-id))
(defun draw-2d-polyline (vertices &key
(closed? nil)
(color *default-color*)
(line-thickness *default-line-thickness*)
(group :default)
(object-id 0)
(scene (application-scene *app*)))
"Immediate-mode function, returns no values. Calls scene-draw-2d-polyline with closed? defaulting to nil, color defaulting to *default-color*, line-thickness defaulting to *default-line-thickness*, group defaulting to :default, and scene defaulting to (application-scene *app*). The required argument vertices should be of the form (list x0 y0 x1 y1 ... xn yn) where the x and y values must be real numbers."
(scene-draw-2d-polyline scene group closed? line-thickness color vertices object-id))
(defun add-2d-triangle-primitive (x0 y0 x1 y1 x2 y2 &key
(color *default-color*)
(line-thickness *default-line-thickness*)
(matrix nil)
(group nil)
(object-id 0)
(scene (application-scene *app*)))
"Retained-mode function, creates a primitive outline of a triangle, returns a handle. Calls scene-add-2d-triangle-primitive with color defaulting to *default-color*, line-thickness defaulting to *default-line-thickness*, matrix defaulting to nil (identity), group defaulting to nil (no group) and scene defaulting to (application-scene *app*). The required arguments represent the vertices of the triangle and must be real numbers."
(scene-add-2d-triangle-primitive scene group matrix line-thickness color x0 y0 x1 y1 x2 y2 object-id))
(defun add-2d-triangle (x0 y0 x1 y1 x2 y2 &key
(color *default-color*)
(line-thickness *default-line-thickness*)
(group :default)
(object-id 0)
(scene (application-scene *app*)))
"Retained-mode function, creates an outline of a triangle, returns no values. Calls scene-add-2d-triangle with color defaulting to *default-color*, line-thickness defaulting to *default-line-thickness*, group defaulting to :default and scene defaulting to (application-scene *app*). The required arguments represent the vertices of the triangle and must be real numbers."
(scene-add-2d-triangle scene group line-thickness color x0 y0 x1 y1 x2 y2 object-id))
(defun draw-2d-triangle (x0 y0 x1 y1 x2 y2 &key
(color *default-color*)
(line-thickness *default-line-thickness*)
(group :default)
(object-id 0)
(scene (application-scene *app*)))
"Immediate-mode function, creates an outline of a triangle, returns no values. Calls scene-draw-2d-triangle with color defaulting to *default-color*, line-thickness defaulting to *default-line-thickness*, group defaulting to :default and scene defaulting to (application-scene *app*). The required arguments represent the vertices of the triangle and must be real numbers."
(scene-draw-2d-triangle scene group line-thickness color x0 y0 x1 y1 x2 y2 object-id))
(defun add-2d-rectangle-primitive (x0 y0 x1 y1
&key
(color *default-color*)
(line-thickness *default-line-thickness*)
(matrix nil)
(group nil)
(object-id 0)
(scene (application-scene *app*)))
"Retained-mode function, creates a primitive outline of a rectangle, returns a handle. Calls scene-add-2d-rectangle-primitive with color defaulting to *default-color*, line-thickness defaulting to *default-line-thickness*, matrix defaulting to nil (identity), group defaulting to nil (no group) and scene defaulting to (application-scene *app*). The required arguments represent the top-left and bottom-right corners of the rectangle, and must be real numbers."
(scene-add-2d-rectangle-primitive scene group matrix line-thickness color x0 y0 x1 y1 object-id))
(defun add-2d-rectangle (x0 y0 x1 y1 &key
(color *default-color*)
(line-thickness *default-line-thickness*)
(group :default)
(object-id 0)
(scene (application-scene *app*)))
"Retained-mode function, creates an outline of a rectangle, returns no values. Calls scene-add-2d-rectangle with color defaulting to *default-color*, line-thickness defaulting to *default-line-thickness*, group defaulting to :default and scene defaulting to (application-scene *app*). The required arguments represent the top-left and bottom-right corners of the rectangle, and must be real numbers."
(scene-add-2d-rectangle scene group line-thickness color x0 y0 x1 y1 object-id))
(defun draw-2d-rectangle (x0 y0 x1 y1 &key
(color *default-color*)
(line-thickness *default-line-thickness*)
(group :default)
(object-id 0)
(scene (application-scene *app*)))
"Immediate-mode function, creates an outline of a rectangle, returns no values. Calls scene-draw-2d-rectangle with color defaulting to *default-color*, line-thickness defaulting to *default-line-thickness*, group defaulting to :default and scene defaulting to (application-scene *app*). The required arguments represent the top-left and bottom-right corners of the rectangle, and must be real numbers."
(scene-draw-2d-rectangle scene group line-thickness color x0 y0 x1 y1 object-id))
(defun add-2d-circular-arc-primitive (center-x center-y radius start-angle end-angle
&key
(closed? nil)
(color *default-color*)
(line-thickness *default-line-thickness*)
(number-of-segments *default-number-of-segments*)
(matrix nil)
(group nil)
(object-id 0)
(scene (application-scene *app*)))
"Retained-mode function, creates a primitive, a polyline representing the arc of a circle, returns a handle. Calls scene-add-2d-circular-arc-primitive with closed? defaulting to nil, color defaulting to *default-color*, line-thickness defaulting to *default-line-thickness*, number-of-segments defaulting to 64, matrix defaulting to nil (identity), group defaulting to nil (no group) and scene defaulting to (application-scene *app*). The required arguments should be real numbers and start-angle and end-angle are in radians."
(scene-add-2d-circular-arc-primitive scene group matrix closed? line-thickness color
center-x center-y radius start-angle end-angle
number-of-segments object-id))
(defun add-2d-circular-arc (center-x center-y radius start-angle end-angle
&key
(closed? nil)
(color *default-color*)
(line-thickness *default-line-thickness*)
(number-of-segments *default-number-of-segments*)
(group :default)
(object-id 0)
(scene (application-scene *app*)))
"Retained-mode function, creates a polyline representing the arc of a circle, returns no values. Calls scene-add-2d-circular-arc with closed? defaulting to nil, color defaulting to *default-color*, line-thickness defaulting to *default-line-thickness*, number-of-segments defaulting to 64, group defaulting to :default and scene defaulting to (application-scene *app*). The required arguments should be real numbers and start-angle and end-angle are in radians."
(scene-add-2d-circular-arc scene group closed? line-thickness color
center-x center-y radius start-angle end-angle
number-of-segments object-id))
(defun draw-2d-circular-arc (center-x center-y radius start-angle end-angle
&key
(closed? nil)
(color *default-color*)
(line-thickness *default-line-thickness*)
(number-of-segments *default-number-of-segments*)
(group :default)
(object-id 0)
(scene (application-scene *app*)))
"Immediate-mode function, creates a polyline representing the arc of a circle, returns no values. Calls scene-add-2d-circular-arc with closed? defaulting to nil, color defaulting to *default-color*, line-thickness defaulting to *default-line-thickness*, number-of-segments defaulting to 64, group defaulting to :default and scene defaulting to (application-scene *app*). The required arguments should be real numbers and start-angle and end-angle are in radians."
(scene-draw-2d-circular-arc scene group closed? line-thickness color
center-x center-y radius start-angle end-angle
number-of-segments object-id))
(defun add-2d-circle-primitive (center-x center-y radius
&key
(color *default-color*)
(line-thickness *default-line-thickness*)
(number-of-segments *default-number-of-segments*)
(matrix nil)
(group nil)
(object-id 0)
(scene (application-scene *app*)))
"Retained-mode function, creates a primitive, a polyline representing the outline of a circle, returns a handle. Calls scene-add-2d-circle-primitive with color defaulting to *default-color*, line-thickness defaulting to *default-line-thickness*, number-of-segments defaulting to 64, matrix defaulting to nil (identity), group defaulting to nil (no group) and scene defaulting to (application-scene *app*). The required arguments should be real numbers."
(scene-add-2d-circle-primitive scene
group matrix line-thickness color
center-x center-y radius number-of-segments object-id))
(defun add-2d-circle (center-x center-y radius
&key
(color *default-color*)
(line-thickness *default-line-thickness*)
(number-of-segments *default-number-of-segments*)
(group :default)
(object-id 0)
(scene (application-scene *app*)))
"Retained-mode function, creates a polyline representing the outline of a circle, returns a no values. Calls scene-add-2d-circle with color defaulting to *default-color*, line-thickness defaulting to *default-line-thickness*, number-of-segments defaulting to 64, group defaulting to :default and scene defaulting to (application-scene *app*). The required arguments should be real numbers."
(scene-add-2d-circle scene
group line-thickness color
center-x center-y radius number-of-segments object-id))
(defun draw-2d-circle (center-x center-y radius
&key
(color *default-color*)
(line-thickness *default-line-thickness*)
(number-of-segments *default-number-of-segments*)
(group :default)
(object-id 0)
(scene (application-scene *app*)))
"Immediate-mode function, creates a polyline representing the outline of a circle, returns a no values. Calls scene-draw-2d-circle with color defaulting to *default-color*, line-thickness defaulting to *default-line-thickness*, number-of-segments defaulting to 64, group defaulting to :default and scene defaulting to (application-scene *app*). The required arguments should be real numbers."
(scene-draw-2d-circle scene
group line-thickness color
center-x center-y radius number-of-segments object-id))
(defun add-filled-2d-circle-primitive (center-x center-y radius
&key
(color *default-color*)
(number-of-sectors *default-number-of-segments*)
(matrix nil)
(group nil)
(object-id 0)
(elevation 0)
(scene (application-scene *app*)))
"Retained-mode function, creates a primitive, a filled 2d circle, returns a handle. Calls scene-add-filled-2d-circle-primitive with color defaulting to *default-color*, number-of-sectors defaulting to 64, matrix defaulting to nil (identity), group defaulting to nil (no group) and scene defaulting to (application-scene *app*). The required arguments should be real numbers."
(scene-add-filled-2d-circle-primitive scene
group matrix color
center-x center-y radius
number-of-sectors object-id elevation))
(defun add-filled-2d-circle (center-x center-y radius
&key
(color *default-color*)
(number-of-sectors *default-number-of-segments*)
(group :default)
(object-id 0)
(elevation 0)
(scene (application-scene *app*)))
"Retained-mode function, creates a filled 2d circle, returns no values. Calls scene-add-filled-2d-circle with color defaulting to *default-color*, number-of-sectors defaulting to 64, group defaulting to :default and scene defaulting to (application-scene *app*). The required arguments should be real numbers."
(scene-add-filled-2d-circle scene group color
center-x center-y radius
number-of-sectors object-id elevation))
(defun draw-filled-2d-circle (center-x center-y radius
&key
(color *default-color*)
(number-of-sectors *default-number-of-segments*)
(group :default)
(object-id 0)
(elevation 0)
(scene (application-scene *app*)))
"Immediate-mode function, creates a filled 2d circle, returns no values. Calls scene-draw-filled-2d-circle with color defaulting to *default-color*, number-of-sectors defaulting to 64, group defaulting to :default and scene defaulting to (application-scene *app*). The required arguments should be real numbers."
(scene-draw-filled-2d-circle scene group color center-x center-y radius number-of-sectors object-id elevation))
(defun add-multicolor-3d-polyline-primitive (vertices &key
(closed? nil)
(line-thickness *default-line-thickness*)
(matrix nil)
(group nil)
(object-id 0)
(scene (application-scene *app*)))
"Retained-mode function, creates a primitive, a multicolored 3d polyline, returns a handle. Calls scene-add-multicolored-3d-polyline-primitive with closed? defaulting to nil, line-thickness defaulting to *default-line-thickness*, matrix defaulting to nil (identity), group defaulting to nil (no group) and scene defaulting to (application-scene *app*). The required argument, vertices, should be of the form (list x0 y0 z0 color0 x1 y1 z1 color1 ... xn yn zn colorn) where the x y and z values should be real numbers and the color values should represent a color."
(scene-add-multicolor-3d-polyline-primitive scene group matrix closed? line-thickness vertices object-id))
(defun add-multicolor-3d-polyline (vertices &key
(closed? nil)
(line-thickness *default-line-thickness*)
(group :default)
(object-id 0)
(scene (application-scene *app*)))
"Retained-mode function, creates a multicolored 3d polyline, returns a no values. Calls scene-add-multicolored-3d-polyline with closed? defaulting to nil, line-thickness defaulting to *default-line-thickness*, group defaulting to :default and scene defaulting to (application-scene *app*). The required argument, vertices, should be of the form (list x0 y0 z0 color0 x1 y1 z1 color1 ... xn yn zn colorn) where the x y and z values should be real numbers and the color values should represent a color."
(scene-add-multicolor-3d-polyline scene group closed? line-thickness vertices object-id))
(defun draw-multicolor-3d-polyline (vertices &key
(closed? nil)
(line-thickness *default-line-thickness*)
(group :default)
(object-id 0)
(scene (application-scene *app*)))
"Immediate-mode function, creates a multicolored 3d polyline, returns a no values. Calls scene-draw-multicolored-3d-polyline with closed? defaulting to nil, line-thickness defaulting to *default-line-thickness*, group defaulting to :default and scene defaulting to (application-scene *app*). The required argument, vertices, should be of the form (list x0 y0 z0 color0 x1 y1 z1 color1 ... xn yn zn colorn) where the x y and z values should be real numbers and the color values should represent a color."
(scene-draw-multicolor-3d-polyline scene group closed? line-thickness vertices object-id))
(defun add-3d-polyline-primitive (vertices &key
(color *default-color*)
(closed? nil)
(line-thickness *default-line-thickness*)
(matrix nil)
(group nil)
(object-id 0)
(scene (application-scene *app*)))
"Retained-mode function, creates a primitive, a 3d polyline, returns a handle. Calls scene-add-3d-polyline-primitive with color defaulting to *default-color*, closed? defaulting to nil, line-thickness defaulting to *default-line-thickness*, matrix defaulting to nil (identity), group defaulting to nil (no group) and scene defaulting to (application-scene *app*). The required argument, vertices, should be of the form (list x0 y0 z0 x1 y1 z1 ... xn yn zn) where the x y and z values should be real numbers."
(scene-add-3d-polyline-primitive scene group matrix closed? line-thickness color vertices object-id))
(defun add-3d-polyline (vertices &key
(color *default-color*)
(closed? nil)
(line-thickness *default-line-thickness*)
(group :default)
(object-id 0)
(scene (application-scene *app*)))
"Retained-mode function, creates a 3d polyline, returns a no values. Calls scene-add-3d-polyline with color defaulting to *default-color*, closed? defaulting to nil, line-thickness defaulting to *default-line-thickness*, group defaulting to :default and scene defaulting to (application-scene *app*). The required argument, vertices, should be of the form (list x0 y0 z0 x1 y1 z1 ... xn yn zn) where the x y and z values should be real numbers."
(scene-add-3d-polyline scene group closed? line-thickness color vertices object-id))
(defun draw-3d-polyline (vertices &key
(color *default-color*)
(closed? nil)
(line-thickness *default-line-thickness*)
(group :default)
(object-id 0)
(scene (application-scene *app*)))
"Immediate-mode function, creates a 3d polyline, returns a no values. Calls scene-draw-3d-polyline with color defaulting to *default-color*, closed? defaulting to nil, line-thickness defaulting to *default-line-thickness*, group defaulting to :default and scene defaulting to (application-scene *app*). The required argument, vertices, should be of the form (list x0 y0 z0 x1 y1 z1 ... xn yn zn) where the x y and z values should be real numbers."
(scene-draw-3d-polyline scene group closed? line-thickness color vertices object-id))
(defun add-filled-2d-triangle-list-primitive (vertices &key
(color *default-color*)
(matrix nil)
(group nil)
(object-id 0)
(elevation 0)
(scene (application-scene *app*)))
"Retained-mode function, creates a primitive, a series of filled 2d triangles, returns a handle. Calls scene-add-filled-2d-triangle-list-primitive with color defaulting to *default-color*, matrix defaulting to nil (identity), group defaulting to nil (no group) and scene defaulting to (application-scene *app*). The required argument, vertices, should be of the form (list x00 y00 x10 y10 x20 y20 x01 y01 x11 y11 x21 y21 ... x0n y0n x1n y1n x2n y2n) where the x and y values represent vertices of a triangle in a series of triangles."
(scene-add-filled-2d-triangle-list-primitive scene group matrix color vertices object-id elevation))
(defun add-filled-2d-triangle-list (vertices &key
(color *default-color*)
(group :default)
(object-id 0)
(elevation 0)
(scene (application-scene *app*)))
"Retained-mode function, creates a series of filled 2d triangles, returns a no values. Calls scene-add-filled-2d-triangle-list with color defaulting to *default-color*, group defaulting to :default and scene defaulting to (application-scene *app*). The required argument, vertices, should be of the form (list x00 y00 x10 y10 x20 y20 x01 y01 x11 y11 x21 y21 ... x0n y0n x1n y1n x2n y2n) where the x and y values represent vertices of a triangle in a series of triangles."
(scene-add-filled-2d-triangle-list scene group color vertices object-id elevation))
(defun draw-filled-2d-triangle-list (vertices &key
(color *default-color*)
(group :default)
(object-id 0)
(elevation 0)
(scene (application-scene *app*)))
"Immediate-mode function, creates a series of filled 2d triangles, returns a no values. Calls scene-draw-2d-triangle-list with color defaulting to *default-color*, group defaulting to :default and scene defaulting to (application-scene *app*). The required argument, vertices, should be of the form (list x00 y00 x10 y10 x20 y20 x01 y01 x11 y11 x21 y21 ... x0n y0n x1n y1 x2n y2n) where the x and y values represent vertices of a triangle in a series of triangles."
(scene-draw-filled-2d-triangle-list scene group color vertices object-id elevation))