Skip to content

Instantly share code, notes, and snippets.

View sgithens's full-sized avatar

Steven Githens sgithens

View GitHub Profile
@sgithens
sgithens / gist:f3f840538e7490fac42c1d06e70c9d14
Created August 21, 2023 16:25
Transformation matrix with determinant zed
CL-USER 1 > (3D-MATRICES:MAT4 #(0.1299038 -0.074999996 0.0 408.0877 0.074999996 0.1299038 0.0 122.7445 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0))
(3D-MATRICES:MAT4 #(0.1299038 -0.074999996 0.0 408.0877 0.074999996 0.1299038 0.0 122.7445 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0))
CL-USER 2 > (setf wowm (3D-MATRICES:MAT4 #(0.1299038 -0.074999996 0.0 408.0877 0.074999996 0.1299038 0.0 122.7445 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0)))
(3D-MATRICES:MAT4 #(0.1299038 -0.074999996 0.0 408.0877 0.074999996 0.1299038 0.0 122.7445 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0))
CL-USER 3 > wowm
(3D-MATRICES:MAT4 #(0.1299038 -0.074999996 0.0 408.0877 0.074999996 0.1299038 0.0 122.7445 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0))
CL-USER 4 > (3d-matrices:mdet wowm)
@sgithens
sgithens / transformations.lisp
Created June 9, 2023 23:34
transformations.lisp
(in-package :boxgl)
(defvar *vs-transforms-example*
"#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aColor;
layout (location = 2) in vec2 aTexCoord;
out vec3 ourColor;
out vec2 TexCoord;
@sgithens
sgithens / textures.lisp
Created June 9, 2023 03:00
textures.lisp
(in-package :boxgl)
(defvar *vs-vanilla*
"#version 330 core
layout (location = 0) in vec3 aPos;
void main()
{
gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);
}")
@sgithens
sgithens / tests.lisp
Created September 17, 2022 17:37
initial tests for .boxer file format
;; Basic test of creating a box structure, saving it, re-opening it, and verifying a few bits
(let* ((boxer::*supress-graphics-recording?* t)
(boxer::*draw-status-line* nil)
(current-time (simple-name-timestamp))
(new-tests-dir (cl-fad:merge-pathnames-as-directory cl-user::*boxer-project-dir*
(format nil "tests/data/testing/~A/" current-time)))
(zip-results-dir (cl-fad:merge-pathnames-as-directory new-tests-dir "unzip-results/"))
(newbox (make-instance 'boxer::data-box))
(reopened-box nil)
(zipped-reopened-box nil))
@sgithens
sgithens / dumper.lisp
Created May 24, 2022 22:54
Boxer Embedded png pixmap encoding hacking.
(defun dump-pixmap (pixmap stream)
(log:debug "Inside dump-pixmap")
(enter-table pixmap)
(write-file-word bin-op-pixmap stream)
(cond
((>= *version-number* 13)
(dump-png-encoded-pixmap pixmap stream)
)
(t (let ((depth (offscreen-bitmap-depth pixmap)))
(case depth
CL-USER 7 > (pprint (macroexpand-1 '(boxer-eval::evaluator-body (2) nil)))
(BOXER-EVAL::WITH-EVALUATOR-STATE-VARIABLES-AND-UNWIND-PROTECT
(BOXER-EVAL::INIT-TIMING)
(BOXER-EVAL::TRACE-ENTERING EVAL)
(SETQ BOXER-EVAL::*POLL-COUNT* BOXER-EVAL::*INITIAL-POLL-COUNT*)
(TAGBODY
BOXER-EVAL::STANDARD-ENTRY (BOXER-EVAL::TRACE-ENTERING BOXER-EVAL::STANDARD-ENTRY)
(WHEN (NULL NIL)
(SETQ BOXER-EVAL::*RETURNED-VALUE* BOXER-EVAL::*NOVALUE*)
@sgithens
sgithens / stuff.lisp
Created March 29, 2022 13:03
macroexpanded defboxer preference
(pprint (macroexpand-1 '(defboxer-preference bu::print-fractions (true-or-false)
((*print-rationals* :boolean (boxer-eval::boxer-boolean *print-rationals*))
#+capi results #-capi result-appearance
("Should fractional numbers (e.g., 1/2) appear as ")
("fractions (1/2), rather than decimals (0.5) ?"))
(setq *print-rationals* true-or-false)
boxer-eval::*novalue*)))
(PROGN
(UNLESS (FAST-MEMQ 'BOXER-USER::PRINT-FRACTIONS *BOXER-PREFERENCES-LIST*)
https://us02web.zoom.us/j/9147221372?fbclid=IwAR0K4Xtl6XDjuHBhTd_2dicIpiAM8IIalBElpRG3ytSshfNKBaFvL6sFfwM
;;;;
;;;; Boxer
;;;; Copyright 1985-2020 Andrea A. diSessa and the Estate of Edward H. Lay
;;;;
;;;; Portions of this code may be copyright 1982-1985 Massachusetts Institute of Technology. Those portions may be
;;;; used for any purpose, including commercial ones, providing that notice of MIT copyright is retained.
;;;;
;;;; Licensed under the 3-Clause BSD license. You may not use this file except in compliance with this license.
;;;;
;;;; https://opensource.org/licenses/BSD-3-Clause
@sgithens
sgithens / example-with-no-usage-before-unloading.lisp
Last active December 5, 2020 03:53
cl-freetype2 loading and unloading in lispworks
CL-USER 1 > (ql:quickload :cffi)
To load "cffi":
Load 1 ASDF system:
cffi
; Loading "cffi"
(:CFFI)
CL-USER 2 > (pushnew #P"/Users/sgithens/code/boxer-sunrise2/data/boxersunrise.app/Contents/Resources/libs/" cffi:*foreign-library-directories* :test #'equal)
(#P"/Users/sgithens/code/boxer-sunrise2/data/boxersunrise.app/Contents/Resources/libs/" (CFFI::EXPLODE-PATH-ENVIRONMENT-VARIABLE "LD_LIBRARY_PATH") (CFFI::EXPLODE-PATH-ENVIRONMENT-VARIABLE "DYLD_LIBRARY_PATH") (UIOP/OS:GETCWD) (CFFI::DARWIN-FALLBACK-LIBRARY-PATH))