]> gitweb.factorcode.org Git - factor.git/commitdiff
Make bunny load
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Thu, 18 Dec 2008 02:28:26 +0000 (20:28 -0600)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Thu, 18 Dec 2008 02:28:26 +0000 (20:28 -0600)
extra/bunny/model/model.factor
extra/bunny/outlined/outlined.factor
extra/opengl/demo-support/demo-support.factor

index 3e0019110884491d1dbd441963a17a7053e0a83b..255e6eb343ffa845b42aba924e28522c7a76fb5c 100755 (executable)
@@ -23,7 +23,7 @@ IN: bunny.model
 
 : n ( vs triple -- n )
     swap [ nth ] curry map
-    dup third over first v- >r dup second swap first v- r> cross
+    [ [ second ] [ first ] bi v- ] [ [ third ] [ first ] bi v- ] bi cross
     vneg normalize ;
 
 : normal ( ns vs triple -- )
@@ -31,7 +31,7 @@ IN: bunny.model
 
 : normals ( vs is -- ns )
     over length { 0.0 0.0 0.0 } <array> -rot
-    [ >r 2dup r> normal ] each drop
+    [ [ 2dup ] dip normal ] each drop
     [ normalize ] map ;
 
 : read-model ( stream -- model )
index 3cf3f94d7385c3213974dcb38b3d66440a6fdfab..c91a895ce112973dc0e92a95ec758e0927451184 100755 (executable)
@@ -2,7 +2,7 @@ USING: arrays bunny.model bunny.cel-shaded continuations
 destructors kernel math multiline opengl opengl.shaders
 opengl.framebuffers opengl.gl opengl.demo-support fry
 opengl.capabilities sequences ui.gadgets combinators accessors
-macros ;
+macros locals ;
 IN: bunny.outlined
 
 STRING: outlined-pass1-fragment-shader-main-source
@@ -143,19 +143,17 @@ TUPLE: bunny-outlined
         pass1-program pass2-program f f f f f bunny-outlined boa
     ] [ drop f ] if ;
 
-: (framebuffer-texture) ( dim iformat xformat -- texture )
-    swapd >r >r >r
+:: (framebuffer-texture) ( dim iformat xformat -- texture )
     GL_TEXTURE0 glActiveTexture
     gen-texture GL_TEXTURE_2D over glBindTexture
     GL_TEXTURE_2D GL_TEXTURE_WRAP_S GL_CLAMP glTexParameteri
     GL_TEXTURE_2D GL_TEXTURE_WRAP_T GL_CLAMP glTexParameteri
     GL_TEXTURE_2D GL_TEXTURE_MAG_FILTER GL_NEAREST glTexParameteri
     GL_TEXTURE_2D GL_TEXTURE_MIN_FILTER GL_NEAREST glTexParameteri
-    GL_TEXTURE_2D 0 r> r> first2 0 r> GL_UNSIGNED_BYTE f glTexImage2D ;
+    GL_TEXTURE_2D 0 iformat dim first2 0 xformat GL_UNSIGNED_BYTE f glTexImage2D ;
 
-: (attach-framebuffer-texture) ( texture attachment -- )
-    swap >r >r
-    GL_FRAMEBUFFER_EXT r> GL_TEXTURE_2D r> 0 glFramebufferTexture2DEXT
+:: (attach-framebuffer-texture) ( texture attachment -- )
+    GL_FRAMEBUFFER_EXT attachment GL_TEXTURE_2D texture 0 glFramebufferTexture2DEXT
     gl-error ;
 
 : (make-framebuffer) ( color-texture normal-texture depth-texture -- framebuffer )
index c1b656b6c8e486d07385e183dc08ccede6e985f7..c8fe2b4882a1d9a59ad562664f8987dada4e2086 100755 (executable)
@@ -60,7 +60,7 @@ M: demo-gadget pref-dim* ( gadget -- dim )
     ] [
         GL_MODELVIEW glMatrixMode
         glLoadIdentity
-        [ >r 0.0 0.0 r> distance>> neg glTranslatef ]
+        [ [ 0.0 0.0 ] dip distance>> neg glTranslatef ]
         [ pitch>> 1.0 0.0 0.0 glRotatef ]
         [ yaw>>   0.0 1.0 0.0 glRotatef ]
         tri