]> gitweb.factorcode.org Git - factor-unmaintained.git/blobdiff - 4DNav/camera/camera.factor
unmaintained: New home for misfit Factor vocabularies.
[factor-unmaintained.git] / 4DNav / camera / camera.factor
diff --git a/4DNav/camera/camera.factor b/4DNav/camera/camera.factor
new file mode 100644 (file)
index 0000000..0d46d73
--- /dev/null
@@ -0,0 +1,18 @@
+USING: kernel namespaces math.vectors opengl opengl.glu 4DNav.turtle  ;
+
+IN: 4DNav.camera
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+: camera-eye ( -- point ) turtle-pos> ;
+
+: camera-focus ( -- point ) 
+    [ 1 step-turtle turtle-pos> ] save-self ;
+
+: camera-up ( -- dirvec )
+[ 90 pitch-up turtle-pos> 1 step-turtle turtle-pos> swap v- ] 
+    save-self ;
+
+: do-look-at ( camera -- )
+[ >self camera-eye camera-focus camera-up gl-look-at ] 
+    with-scope ;