Permalink
Browse files

update to cantor 0.2.0

  • Loading branch information...
1 parent 5ebda33 commit cc3baeb2915248f4b710897d94d87ce401181ba5 @ztellman committed May 30, 2010
Submodule autodoc added at 3e635a
View
@@ -1,7 +1,7 @@
(defproject penumbra "0.6.0-SNAPSHOT"
:description "An idiomatic wrapper for OpenGL"
:dependencies [[slick-util "1.0.0"]
- [cantor "0.1.0"]
+ [cantor "0.2.0-SNAPSHOT"]
[org.clojure/clojure "1.2.0-master-SNAPSHOT"]
[org.clojure/clojure-contrib "1.2.0-SNAPSHOT"]]
:native-dependencies [[penumbra/lwjgl "2.4.2"]]
View
@@ -15,9 +15,9 @@
[clojure.walk :only (postwalk-replace)])
(:require [penumbra.opengl
[texture :as texture]
- [context :as context]]
+ [context :as context]
+ [slate :as slate]]
[penumbra
- [slate :as slate]
[time :as time]]
[penumbra.app
[core :as app]
@@ -9,13 +9,12 @@
(ns penumbra.app.window
(:use [penumbra.opengl]
[clojure.contrib.core :only (-?>)])
- (:require [penumbra.slate :as slate]
- [penumbra.opengl
+ (:require [penumbra.opengl
[texture :as texture]
[context :as context]]
- [penumbra.text :as text]
- [penumbra.app.event :as event]
- [penumbra.app.core :as app])
+ [penumbra.text :as text]
+ [penumbra.app.event :as event]
+ [penumbra.app.core :as app])
(:import [org.lwjgl.opengl Display PixelFormat]
[org.newdawn.slick.opengl InternalTextureLoader TextureImpl]
[java.awt Frame Canvas GridLayout Color]
View
@@ -6,7 +6,8 @@
;; the terms of this license.
;; You must not remove this notice, or any other, from this software.
-(ns penumbra.opengl
+(ns ^{:author "Zachary Tellman"}
+ penumbra.opengl
(:use [penumbra.opengl core]
[clojure.contrib.def :only (defn-memo defmacro- defvar)])
(:require [penumbra.opengl.texture :as tex]
@@ -7,7 +7,7 @@
;; You must not remove this notice, or any other, from this software.
(ns penumbra.opengl.capabilities
- (:require [penumbra.slate :as slate]
+ (:require [penumbra.opengl.slate :as slate]
[penumbra.opengl :as gl]
[penumbra.opengl.texture :as tex]
[penumbra.opengl.frame-buffer :as fb]
@@ -31,57 +31,61 @@
(defn vertex
"Defines the coordinates for a new vertex."
- ([v]
- (cond
- (vec2? v) (vertex (v 0) (v 1))
- (vec3? v) (vertex (v 0) (v 1) (v 2))
- :else (apply vertex v)))
+ ([v] (if (cartesian? v)
+ (condp = (dimension v)
+ 2 (vertex (v 0) (v 1))
+ 3 (vertex (v 0) (v 1) (v 2)))
+ (apply vertex v)))
([x y] (vertex x y 0))
([x y z] (vertex- *renderer* x y z))
([x y z w] (vertex x y z)))
(defn texture
"Defines the texture coordinate for subsequent vertices."
- ([v] (cond
- (vec2? v) (texture (v 0) (v 1))
- (vec3? v) (texture (v 0) (v 1) (v 2))
- (number? v) (texture- *renderer* v)
- :else (apply texture v)))
+ ([v] (if (cartesian? v)
+ (condp = (dimension v)
+ 2 (texture (v 0) (v 1))
+ 3 (texture (v 0) (v 1) (v 2)))
+ (if (number? v)
+ (texture- *renderer* v)
+ (apply vertex v))))
([u v] (texture- *renderer* u v))
([u v w] (texture- *renderer* u v w)))
(defn normal
"Defines the normal vector for subsequent vertices."
- ([v] (cond
- (vec2? v) (normal (v 0) (v 1) 0)
- (vec3? v) (normal (v 0) (v 1) (v 2))
- :else (apply normal v)))
+ ([v] (if (cartesian? v)
+ (condp = (dimension v)
+ 2 (normal (v 0) (v 1) 0)
+ 3 (normal (v 0) (v 1) (v 2)))
+ (apply normal v)))
([x y z] (normal- *renderer* x y z)))
(defn translate
"Translates the position of subsequent vertices."
- ([v] (cond
- (vec2? v) (translate (v 0) (v 1))
- (vec3? v) (translate (v 0) (v 1) (v 2))
- :else (apply translate v)))
+ ([v] (if (cartesian? v)
+ (condp = (dimension v)
+ 2 (translate (v 0) (v 1))
+ 3 (translate (v 0) (v 1) (v 2)))
+ (apply translate v)))
([x y] (translate x y 0))
([x y z] (translate- *renderer* x y z)))
(defn scale
"Scales the position of subsequent vertices."
- ([v] (cond
- (vec2? v) (scale (v 0) (v 1))
- (vec3? v) (scale (v 0) (v 1) (v 2))
- :else (apply scale v)))
+ ([v] (if (cartesian? v)
+ (condp = (dimension v)
+ 2 (scale (v 0) (v 1))
+ 3 (scale (v 0) (v 1) (v 2)))
+ (apply scale v)))
([x y] (scale x y 1))
([x y z] (scale- *renderer* x y z)))
(defn color
"Defines the color of subsequent vertices."
- ([c] (cond
- (vec2? c) (color (c 0) (c 1))
- (vec3? c) (color (c 0) (c 1) (c 2))
- :else (apply color c)))
+ ([c] (if (cartesian? c)
+ (color (c 0) (c 1) (c 2))
+ (apply color c)))
([r g b] (color r g b 1))
([r g b a] (color- *renderer* r g b a)))
@@ -6,7 +6,7 @@
; the terms of this license.
; You must not remove this notice, or any other, from this software.
-(ns penumbra.slate
+(ns penumbra.opengl.slate
(:use [clojure.contrib.def :only [defmacro- defn-memo defvar-]]
[clojure.contrib.pprint]
[clojure.contrib.seq :only [separate]]
@@ -63,9 +63,6 @@
(with-slate- slate#
~@body)))
-
-
-
;;;
@@ -41,7 +41,7 @@
((:radius x))))
(defn position [x]
- (if (vec? (:position x))
+ (if (cartesian? (:position x))
(:position x)
((:position x))))
@@ -9,7 +9,6 @@
(ns example.gpgpu.mandelbrot
(:use [penumbra opengl compute])
(:require [penumbra.app :as app]
- [penumbra.slate :as slate]
[penumbra.data :as data]))
(defn init [state]

0 comments on commit cc3baeb

Please sign in to comment.