Skip to content

Instantly share code, notes, and snippets.

(in-package :fl.core)
(defstruct-gpu texture-struct ()
(sampler1 :sampler-2d :accessor sampler1)
(sampler2 :sampler-2d :accessor sampler2))
(define-gpu default-vertex ((pos :vec3)
(normal :vec3)
(tangent :vec3)
(color :vec4)
FIRST-LIGHT-EXAMPLE> (let ((x (loop for i below (* 1024 1024 20) collect i)) (sum 0)) (time (dolist (val x) (incf sum val))) sum)
Evaluation took:
0.056 seconds of real time
0.056000 seconds of total run time (0.056000 user, 0.000000 system)
100.00% CPU
191,979,137 processor cycles
0 bytes consed
219902315069440 (48 bits, #xC7FFFF600000)
(defun doit ()
;; This goes in INITIALIZE-COMPONENT
(let ((vao (gl:gen-vertex-array))
(vbo (gl:gen-buffer))
(buffer (static-vectors:make-static-vector
1 :element-type '(integer 0 255)
:initial-element 0)))
(shadow:defstruct-gpu texture2 ()
(image :sampler-2d :accessor image)
(sprite :int :accessor sprite))
(shadow:defstruct-gpu sprite-sheet-data ()
(x (:float 4) :accessor x)
(y (:float 4) :accessor y)
(w (:float 4) :accessor w)
(h (:float 4) :accessor h))
MFIANOS-TESTS> (shadow:make-shader-program sprite-shader (:version 430 :primitive :points)
(:vertex () (sprite/vert))
(:geometry () (sprite/geom))
(:fragment () (sprite/frag :vec2)))
; Debugger entered on #<SIMPLE-ERROR "~@<The assertion ~S failed~:[.~:; ~
; with ~:*~{~{~S = ~S~}~^, ~}.~]~:@>" {1003CE0D13}>
[1] MFIANOS-TESTS>
;; In a clean image:
(ql:quickload :shadow)
(shadow:defstruct-gpu sprite-index ()
(image :sampler-2d :accessor image)
(sprite :int :accessor sprite))
(shadow:defstruct-gpu sprite-sheet-data ()
(x (:float 4) :accessor x)
diff --git a/src/frame-manager.lisp b/src/frame-manager.lisp
index b0b3e7c..c954c46 100644
--- a/src/frame-manager.lisp
+++ b/src/frame-manager.lisp
@@ -1,7 +1,8 @@
(in-package :box.frame)
(defclass frame-manager ()
- ((%start :initform (local-time:now))
+ ((%vsyncp :initarg :vsyncp)
diff --git a/src/display.lisp b/src/display.lisp
index 2f460a0..301a6b8 100644
--- a/src/display.lisp
+++ b/src/display.lisp
@@ -13,10 +13,11 @@
(defgeneric make-display (core-state)
(:method ((core-state core-state))
(let ((hz (calculate-refresh-rate)))
- (with-cfg (title width height delta periodic-interval debug-frames-interval)
+ (with-cfg (vsync title width height delta periodic-interval debug-frames-interval)
;; Most of the full API to deal with uniform/buffer blocks.
;; Some of this code is in or should be in shadow, and other parts are
;; in or should be in FL.
;; ;;;;;;;;;;;;;;;;;;;;;;;
;; Naming an interface block in a specific shader
;; ;;;;;;;;;;;;;;;;;;;;;;;
;; New function.
(XXX:create-shader-storage-block-alias snazzy-alias-eql-name
(define-component mesh ()
;; Component slot descriptions all in one form, like defclass
((location :default nil :shared t)
(id :default 0 :shared t)
(primitives :default nil))
;; Shared storage namespace definitions. First form is a namespace symbol
;; which could be in a different package if desired, the &rest is a
;; sequence of hash table test functions that will be consulted when
;; making nested hash tables.