Merge branch 'master' of git://factorcode.org/git/factor
commit
e73d78be88
|
@ -0,0 +1,2 @@
|
||||||
|
Ryan Murphy
|
||||||
|
Doug Coleman
|
|
@ -0,0 +1,7 @@
|
||||||
|
USING: help.syntax help.markup ;
|
||||||
|
IN: editors.editpadpro
|
||||||
|
|
||||||
|
ARTICLE: "editors.editpadpro" "EditPad Pro support"
|
||||||
|
"EditPadPro text editor integration on Windows. Be sure to put EditPadPro in your system path so that it will be found. Windows only." ;
|
||||||
|
|
||||||
|
ABOUT: "editors.editpadpro"
|
|
@ -0,0 +1,16 @@
|
||||||
|
USING: definitions kernel parser words sequences math.parser
|
||||||
|
namespaces editors io.launcher windows.shell32 io.files
|
||||||
|
io.paths.windows strings unicode.case make ;
|
||||||
|
IN: editors.editpadlite
|
||||||
|
|
||||||
|
: editpadlite-path ( -- path )
|
||||||
|
\ editpadlite-path get-global [
|
||||||
|
"JGsoft" t [ >lower "editpadlite.exe" tail? ] find-in-program-files
|
||||||
|
] unless* ;
|
||||||
|
|
||||||
|
: editpadlite ( file line -- )
|
||||||
|
[
|
||||||
|
editpadlite-path , drop ,
|
||||||
|
] { } make run-detached drop ;
|
||||||
|
|
||||||
|
[ editpadlite ] edit-hook set-global
|
|
@ -0,0 +1 @@
|
||||||
|
EditPadLite editor integration
|
|
@ -0,0 +1 @@
|
||||||
|
unportable
|
|
@ -1,6 +1,7 @@
|
||||||
USING: help.syntax help.markup ;
|
USING: help.syntax help.markup ;
|
||||||
|
IN: editors.editpadpro
|
||||||
|
|
||||||
ARTICLE: "editpadpro" "EditPad Pro support"
|
ARTICLE: "editors.editpadpro" "EditPad Pro support"
|
||||||
"Just load this module and you will be able to edit documentation with EditPadPro. Be sure to put EditPadPro in your system path so that it will be found. Windows only." ;
|
"EditPadPro text editor integration on Windows. Be sure to put EditPadPro in your system path so that it will be found. Windows only." ;
|
||||||
|
|
||||||
ABOUT: "editpadpro"
|
ABOUT: "editors.editpadpro"
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
USING: definitions kernel parser words sequences math.parser
|
USING: definitions kernel parser words sequences math.parser
|
||||||
namespaces editors io.launcher windows.shell32 io.files
|
namespaces editors io.launcher windows.shell32 io.files
|
||||||
io.paths strings unicode.case make ;
|
io.paths.windows strings unicode.case make ;
|
||||||
IN: editors.editpadpro
|
IN: editors.editpadpro
|
||||||
|
|
||||||
: editpadpro-path
|
: editpadpro-path ( -- path )
|
||||||
\ editpadpro-path get-global [
|
\ editpadpro-path get-global [
|
||||||
program-files "JGsoft" append-path
|
"JGsoft" t [ >lower "editpadpro.exe" tail? ] find-in-program-files
|
||||||
t [ >lower "editpadpro.exe" tail? ] find-file
|
|
||||||
] unless* ;
|
] unless* ;
|
||||||
|
|
||||||
: editpadpro ( file line -- )
|
: editpadpro ( file line -- )
|
||||||
[
|
[
|
||||||
editpadpro-path , "/l" swap number>string append , ,
|
editpadpro-path , number>string "/l" prepend , ,
|
||||||
] { } make run-detached drop ;
|
] { } make run-detached drop ;
|
||||||
|
|
||||||
[ editpadpro ] edit-hook set-global
|
[ editpadpro ] edit-hook set-global
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
USING: editors io.files io.launcher kernel math.parser
|
USING: editors io.files io.launcher kernel math.parser
|
||||||
namespaces sequences windows.shell32 make ;
|
namespaces sequences windows.shell32 make io.paths.windows ;
|
||||||
IN: editors.editplus
|
IN: editors.editplus
|
||||||
|
|
||||||
: editplus-path ( -- path )
|
: editplus-path ( -- path )
|
||||||
\ editplus-path get-global [
|
\ editplus-path get-global [
|
||||||
program-files "\\EditPlus 2\\editplus.exe" append-path
|
"EditPlus 2" t [ "editplus.exe" tail? ] find-in-program-files
|
||||||
] unless* ;
|
] unless* ;
|
||||||
|
|
||||||
: editplus ( file line -- )
|
: editplus ( file line -- )
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
USING: editors hardware-info.windows io.files io.launcher
|
USING: editors io.files io.launcher kernel math.parser
|
||||||
kernel math.parser namespaces sequences windows.shell32
|
namespaces sequences windows.shell32 make io.paths.windows ;
|
||||||
make ;
|
|
||||||
IN: editors.emeditor
|
IN: editors.emeditor
|
||||||
|
|
||||||
: emeditor-path ( -- path )
|
: emeditor-path ( -- path )
|
||||||
\ emeditor-path get-global [
|
\ emeditor-path get-global [
|
||||||
program-files "\\EmEditor\\EmEditor.exe" append-path
|
"EmEditor" t [ "EmEditor.exe" tail? ] find-in-program-files
|
||||||
] unless* ;
|
] unless* ;
|
||||||
|
|
||||||
: emeditor ( file line -- )
|
: emeditor ( file line -- )
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
! Copyright (C) 2008 Kibleur Christophe.
|
! Copyright (C) 2008 Kibleur Christophe.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: editors io.files io.launcher kernel math.parser
|
USING: editors io.files io.launcher kernel math.parser
|
||||||
namespaces sequences windows.shell32 make ;
|
namespaces sequences windows.shell32 io.paths.windows make ;
|
||||||
IN: editors.etexteditor
|
IN: editors.etexteditor
|
||||||
|
|
||||||
: etexteditor-path ( -- str )
|
: etexteditor-path ( -- str )
|
||||||
\ etexteditor-path get-global [
|
\ etexteditor-path get-global [
|
||||||
program-files "e\\e.exe" append-path
|
"e" t [ "e.exe" tail? ] find-in-program-files
|
||||||
] unless* ;
|
] unless* ;
|
||||||
|
|
||||||
: etexteditor ( file line -- )
|
: etexteditor ( file line -- )
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
USING: editors.gvim io.files io.windows kernel namespaces
|
USING: editors.gvim io.files io.windows kernel namespaces
|
||||||
sequences windows.shell32 io.paths system ;
|
sequences windows.shell32 io.paths.windows system ;
|
||||||
IN: editors.gvim.windows
|
IN: editors.gvim.windows
|
||||||
|
|
||||||
M: windows gvim-path
|
M: windows gvim-path
|
||||||
\ gvim-path get-global [
|
\ gvim-path get-global [
|
||||||
program-files "vim" append-path
|
"vim" t [ "gvim.exe" tail? ] find-in-program-files
|
||||||
t [ "gvim.exe" tail? ] find-file
|
|
||||||
] unless* ;
|
] unless* ;
|
||||||
|
|
|
@ -2,10 +2,10 @@ USING: editors io.files io.launcher kernel math.parser
|
||||||
namespaces sequences windows.shell32 make ;
|
namespaces sequences windows.shell32 make ;
|
||||||
IN: editors.notepad2
|
IN: editors.notepad2
|
||||||
|
|
||||||
: notepad2-path ( -- str )
|
: notepad2-path ( -- path )
|
||||||
\ notepad2-path get-global [
|
\ notepad2-path get-global [
|
||||||
program-files "C:\\Windows\\system32\\notepad.exe" append-path
|
"C:\\Windows\\system32\\notepad.exe"
|
||||||
] unless* ;
|
] unless* ;
|
||||||
|
|
||||||
: notepad2 ( file line -- )
|
: notepad2 ( file line -- )
|
||||||
[
|
[
|
||||||
|
@ -13,4 +13,4 @@ IN: editors.notepad2
|
||||||
"/g" , number>string , ,
|
"/g" , number>string , ,
|
||||||
] { } make run-detached drop ;
|
] { } make run-detached drop ;
|
||||||
|
|
||||||
[ notepad2 ] edit-hook set-global
|
[ notepad2 ] edit-hook set-global
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
USING: editors io.files io.launcher kernel math.parser
|
USING: editors io.files io.launcher kernel math.parser
|
||||||
namespaces sequences windows.shell32 make ;
|
namespaces sequences io.paths.windows make ;
|
||||||
IN: editors.notepadpp
|
IN: editors.notepadpp
|
||||||
|
|
||||||
: notepadpp-path
|
: notepadpp-path ( -- path )
|
||||||
\ notepadpp-path get-global [
|
\ notepadpp-path get-global [
|
||||||
program-files "notepad++\\notepad++.exe" append-path
|
"notepad++" t [ "notepad++.exe" tail? ] find-in-program-files
|
||||||
] unless* ;
|
] unless* ;
|
||||||
|
|
||||||
: notepadpp ( file line -- )
|
: notepadpp ( file line -- )
|
||||||
|
|
|
@ -1,34 +1,25 @@
|
||||||
! Basic SciTE integration for Factor.
|
! Copyright (C) 2007 Clemens F. Hofreither.
|
||||||
!
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
! By Clemens F. Hofreither, 2007.
|
|
||||||
! clemens.hofreither@gmx.net
|
! clemens.hofreither@gmx.net
|
||||||
!
|
USING: io.files io.launcher kernel namespaces io.paths.windows
|
||||||
! In your .factor-rc or .factor-boot-rc,
|
math math.parser editors sequences make unicode.case ;
|
||||||
! require this module and set the scite-path
|
|
||||||
! variable to point to your executable,
|
|
||||||
! if not on the path.
|
|
||||||
!
|
|
||||||
USING: io.files io.launcher kernel namespaces math
|
|
||||||
math.parser editors sequences windows.shell32 make ;
|
|
||||||
IN: editors.scite
|
IN: editors.scite
|
||||||
|
|
||||||
: scite-path ( -- path )
|
: scite-path ( -- path )
|
||||||
\ scite-path get-global [
|
\ scite-path get-global [
|
||||||
program-files "ScITE Source Code Editor\\SciTE.exe" append-path
|
"Scintilla Text Editor" t
|
||||||
dup exists? [
|
[ >lower "scite.exe" tail? ] find-in-program-files
|
||||||
drop program-files "wscite\\SciTE.exe" append-path
|
|
||||||
] unless
|
|
||||||
] unless* ;
|
] unless* ;
|
||||||
|
|
||||||
: scite-command ( file line -- cmd )
|
: scite-command ( file line -- cmd )
|
||||||
swap
|
swap
|
||||||
[
|
[
|
||||||
scite-path ,
|
scite-path ,
|
||||||
,
|
,
|
||||||
"-goto:" swap number>string append ,
|
number>string "-goto:" prepend ,
|
||||||
] { } make ;
|
] { } make ;
|
||||||
|
|
||||||
: scite-location ( file line -- )
|
: scite-location ( file line -- )
|
||||||
scite-command run-detached drop ;
|
scite-command run-detached drop ;
|
||||||
|
|
||||||
[ scite-location ] edit-hook set-global
|
[ scite-location ] edit-hook set-global
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
SciTE editor integration
|
Scintilla text editor (SciTE) integration
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
USING: editors io.files io.launcher kernel math.parser
|
USING: editors io.files io.launcher kernel math.parser
|
||||||
namespaces sequences windows.shell32 make ;
|
namespaces sequences io.paths.windows make ;
|
||||||
IN: editors.ted-notepad
|
IN: editors.ted-notepad
|
||||||
|
|
||||||
: ted-notepad-path
|
: ted-notepad-path ( -- path )
|
||||||
\ ted-notepad-path get-global [
|
\ ted-notepad-path get-global [
|
||||||
program-files "\\TED Notepad\\TedNPad.exe" append-path
|
"TED Notepad" t [ "TedNPad.exe" tail? ] find-in-program-files
|
||||||
] unless* ;
|
] unless* ;
|
||||||
|
|
||||||
: ted-notepad ( file line -- )
|
: ted-notepad ( file line -- )
|
||||||
[
|
[
|
||||||
ted-notepad-path , "/l" swap number>string append , ,
|
ted-notepad-path ,
|
||||||
|
number>string "/l" prepend , ,
|
||||||
] { } make run-detached drop ;
|
] { } make run-detached drop ;
|
||||||
|
|
||||||
[ ted-notepad ] edit-hook set-global
|
[ ted-notepad ] edit-hook set-global
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
USING: definitions io.launcher kernel math math.parser parser
|
USING: definitions io.launcher kernel math math.parser parser
|
||||||
namespaces prettyprint editors make ;
|
namespaces prettyprint editors make ;
|
||||||
|
|
||||||
IN: editors.textedit
|
IN: editors.textedit
|
||||||
|
|
||||||
: textedit-location ( file line -- )
|
: textedit-location ( file line -- )
|
||||||
|
@ -9,5 +8,3 @@ IN: editors.textedit
|
||||||
try-process ;
|
try-process ;
|
||||||
|
|
||||||
[ textedit-location ] edit-hook set-global
|
[ textedit-location ] edit-hook set-global
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
USING: editors io.files io.launcher kernel math.parser
|
USING: editors io.files io.launcher kernel math.parser
|
||||||
namespaces sequences windows.shell32 wne ;
|
namespaces sequences io.paths.windows make ;
|
||||||
IN: editors.ultraedit
|
IN: editors.ultraedit
|
||||||
|
|
||||||
: ultraedit-path ( -- path )
|
: ultraedit-path ( -- path )
|
||||||
\ ultraedit-path get-global [
|
\ ultraedit-path get-global [
|
||||||
program-files
|
"IDM Computer Solutions" t [ "uedit32.exe" tail? ] find-in-program-files
|
||||||
"IDM Computer Solutions\\UltraEdit-32\\uedit32.exe" append-path
|
|
||||||
] unless* ;
|
] unless* ;
|
||||||
|
|
||||||
: ultraedit ( file line -- )
|
: ultraedit ( file line -- )
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
USING: editors hardware-info.windows io.launcher kernel
|
USING: editors io.launcher kernel io.paths.windows
|
||||||
math.parser namespaces sequences windows.shell32 io.files
|
math.parser namespaces sequences io.files arrays ;
|
||||||
arrays ;
|
|
||||||
IN: editors.wordpad
|
IN: editors.wordpad
|
||||||
|
|
||||||
: wordpad-path ( -- path )
|
: wordpad-path ( -- path )
|
||||||
\ wordpad-path get [
|
\ wordpad-path get [
|
||||||
program-files "Windows NT\\Accessories\\wordpad.exe" append-path
|
"Windows NT\\Accessories" t
|
||||||
|
[ "wordpad.exe" tail? ] find-in-program-files
|
||||||
] unless* ;
|
] unless* ;
|
||||||
|
|
||||||
: wordpad ( file line -- )
|
: wordpad ( file line -- )
|
||||||
drop wordpad-path swap 2array dup . run-detached drop ;
|
drop wordpad-path swap 2array run-detached drop ;
|
||||||
|
|
||||||
[ wordpad ] edit-hook set-global
|
[ wordpad ] edit-hook set-global
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
USING: arrays bunny.model bunny.cel-shaded continuations
|
USING: arrays bunny.model bunny.cel-shaded continuations
|
||||||
destructors kernel math multiline opengl opengl.shaders
|
destructors kernel math multiline opengl opengl.shaders
|
||||||
opengl.framebuffers opengl.gl opengl.demo-support
|
opengl.framebuffers opengl.gl opengl.demo-support fry
|
||||||
opengl.capabilities sequences ui.gadgets combinators accessors ;
|
opengl.capabilities sequences ui.gadgets combinators accessors
|
||||||
|
macros ;
|
||||||
IN: bunny.outlined
|
IN: bunny.outlined
|
||||||
|
|
||||||
STRING: outlined-pass1-fragment-shader-main-source
|
STRING: outlined-pass1-fragment-shader-main-source
|
||||||
|
@ -176,24 +177,30 @@ TUPLE: bunny-outlined
|
||||||
} cleave
|
} cleave
|
||||||
] [ drop ] if ;
|
] [ drop ] if ;
|
||||||
|
|
||||||
|
MACRO: (framebuffer-texture>>draw) ( iformat xformat setter -- )
|
||||||
|
'[ _ _ (framebuffer-texture) [ @ drop ] keep ] ;
|
||||||
|
|
||||||
|
: (make-framebuffer-textures) ( draw dim -- draw color normal depth )
|
||||||
|
{
|
||||||
|
[ drop ]
|
||||||
|
[ GL_RGBA16F_ARB GL_RGBA [ >>color-texture ] (framebuffer-texture>>draw) ]
|
||||||
|
[ GL_RGBA16F_ARB GL_RGBA [ >>normal-texture ] (framebuffer-texture>>draw) ]
|
||||||
|
[
|
||||||
|
GL_DEPTH_COMPONENT32 GL_DEPTH_COMPONENT
|
||||||
|
[ >>depth-texture ] (framebuffer-texture>>draw)
|
||||||
|
]
|
||||||
|
} 2cleave ;
|
||||||
|
|
||||||
|
: remake-framebuffer ( draw -- )
|
||||||
|
[ dispose-framebuffer ]
|
||||||
|
[ dup gadget>> dim>>
|
||||||
|
[ (make-framebuffer-textures) (make-framebuffer) >>framebuffer ]
|
||||||
|
[ >>framebuffer-dim drop ] bi
|
||||||
|
] bi ;
|
||||||
|
|
||||||
: remake-framebuffer-if-needed ( draw -- )
|
: remake-framebuffer-if-needed ( draw -- )
|
||||||
dup [ gadget>> dim>> ] [ framebuffer-dim>> ] bi =
|
dup [ gadget>> dim>> ] [ framebuffer-dim>> ] bi =
|
||||||
[ drop ] [
|
[ drop ] [ remake-framebuffer ] if ;
|
||||||
[ dispose-framebuffer ] [ dup ] [ gadget>> dim>> ] tri {
|
|
||||||
[
|
|
||||||
GL_RGBA16F_ARB GL_RGBA (framebuffer-texture)
|
|
||||||
[ >>color-texture drop ] keep
|
|
||||||
] [
|
|
||||||
GL_RGBA16F_ARB GL_RGBA (framebuffer-texture)
|
|
||||||
[ >>normal-texture drop ] keep
|
|
||||||
] [
|
|
||||||
GL_DEPTH_COMPONENT32 GL_DEPTH_COMPONENT (framebuffer-texture)
|
|
||||||
[ >>depth-texture drop ] keep
|
|
||||||
]
|
|
||||||
} 2cleave
|
|
||||||
[ (make-framebuffer) >>framebuffer ] [ >>framebuffer-dim ] bi
|
|
||||||
drop
|
|
||||||
] if ;
|
|
||||||
|
|
||||||
: clear-framebuffer ( -- )
|
: clear-framebuffer ( -- )
|
||||||
GL_COLOR_ATTACHMENT0_EXT glDrawBuffer
|
GL_COLOR_ATTACHMENT0_EXT glDrawBuffer
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
! Copyright (C) 2008 Doug Coleman.
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: io.files kernel sequences accessors
|
USING: accessors arrays deques dlists io.files io.paths.private
|
||||||
dlists deques arrays ;
|
kernel sequences system vocabs.loader fry continuations ;
|
||||||
IN: io.paths
|
IN: io.paths
|
||||||
|
|
||||||
TUPLE: directory-iterator path bfs queue ;
|
TUPLE: directory-iterator path bfs queue ;
|
||||||
|
|
||||||
|
<PRIVATE
|
||||||
|
|
||||||
: qualified-directory ( path -- seq )
|
: qualified-directory ( path -- seq )
|
||||||
dup directory-files [ append-path ] with map ;
|
dup directory-files [ append-path ] with map ;
|
||||||
|
|
||||||
|
@ -25,25 +27,32 @@ TUPLE: directory-iterator path bfs queue ;
|
||||||
[ over push-directory next-file ] [ nip ] if
|
[ over push-directory next-file ] [ nip ] if
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
: iterate-directory ( iter quot -- obj )
|
: iterate-directory ( iter quot: ( obj -- ? ) -- obj )
|
||||||
over next-file [
|
over next-file [
|
||||||
over call
|
over call
|
||||||
[ 2drop ] [ iterate-directory ] if
|
[ 2nip ] [ iterate-directory ] if*
|
||||||
] [
|
] [
|
||||||
2drop f
|
2drop f
|
||||||
] if* ; inline recursive
|
] if* ; inline recursive
|
||||||
|
|
||||||
: find-file ( path bfs? quot -- path/f )
|
PRIVATE>
|
||||||
|
|
||||||
|
: find-file ( path bfs? quot: ( obj -- ? ) -- path/f )
|
||||||
[ <directory-iterator> ] dip
|
[ <directory-iterator> ] dip
|
||||||
[ keep and ] curry iterate-directory ; inline
|
[ keep and ] curry iterate-directory ; inline
|
||||||
|
|
||||||
: each-file ( path bfs? quot -- )
|
: each-file ( path bfs? quot: ( obj -- ? ) -- )
|
||||||
[ <directory-iterator> ] dip
|
[ <directory-iterator> ] dip
|
||||||
[ f ] compose iterate-directory drop ; inline
|
[ f ] compose iterate-directory drop ; inline
|
||||||
|
|
||||||
: find-all-files ( path bfs? quot -- paths )
|
: find-all-files ( path bfs? quot: ( obj -- ? ) -- paths )
|
||||||
[ <directory-iterator> ] dip
|
[ <directory-iterator> ] dip
|
||||||
pusher [ [ f ] compose iterate-directory drop ] dip ; inline
|
pusher [ [ f ] compose iterate-directory drop ] dip ; inline
|
||||||
|
|
||||||
: recursive-directory ( path bfs? -- paths )
|
: recursive-directory ( path bfs? -- paths )
|
||||||
[ ] accumulator [ each-file ] dip ;
|
[ ] accumulator [ each-file ] dip ;
|
||||||
|
|
||||||
|
: find-in-directories ( directories bfs? quot -- path' )
|
||||||
|
'[ _ _ find-file ] attempt-all ; inline
|
||||||
|
|
||||||
|
os windows? [ "io.paths.windows" require ] when
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Doug Coleman
|
|
@ -0,0 +1 @@
|
||||||
|
unportable
|
|
@ -0,0 +1,13 @@
|
||||||
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
USING: arrays continuations fry io.files io.paths
|
||||||
|
kernel windows.shell32 sequences ;
|
||||||
|
IN: io.paths.windows
|
||||||
|
|
||||||
|
: program-files-directories ( -- array )
|
||||||
|
program-files program-files-x86 2array ; inline
|
||||||
|
|
||||||
|
: find-in-program-files ( base-directory bfs? quot -- path )
|
||||||
|
[
|
||||||
|
[ program-files-directories ] dip '[ _ append-path ] map
|
||||||
|
] 2dip find-in-directories ; inline
|
|
@ -5,7 +5,7 @@ IN: opengl.demo-support
|
||||||
|
|
||||||
: FOV 2.0 sqrt 1+ ; inline
|
: FOV 2.0 sqrt 1+ ; inline
|
||||||
: MOUSE-MOTION-SCALE 0.5 ; inline
|
: MOUSE-MOTION-SCALE 0.5 ; inline
|
||||||
: KEY-ROTATE-STEP 1.0 ; inline
|
: KEY-ROTATE-STEP 10.0 ; inline
|
||||||
|
|
||||||
SYMBOL: last-drag-loc
|
SYMBOL: last-drag-loc
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ main()
|
||||||
TUPLE: spheres-gadget < demo-gadget
|
TUPLE: spheres-gadget < demo-gadget
|
||||||
plane-program solid-sphere-program texture-sphere-program
|
plane-program solid-sphere-program texture-sphere-program
|
||||||
reflection-framebuffer reflection-depthbuffer
|
reflection-framebuffer reflection-depthbuffer
|
||||||
reflection-texture ;
|
reflection-texture initialized? ;
|
||||||
|
|
||||||
: <spheres-gadget> ( -- gadget )
|
: <spheres-gadget> ( -- gadget )
|
||||||
20.0 10.0 20.0 spheres-gadget new-demo-gadget ;
|
20.0 10.0 20.0 spheres-gadget new-demo-gadget ;
|
||||||
|
@ -182,9 +182,11 @@ M: spheres-gadget graft* ( gadget -- )
|
||||||
(make-reflection-texture) >>reflection-texture
|
(make-reflection-texture) >>reflection-texture
|
||||||
(make-reflection-depthbuffer) [ >>reflection-depthbuffer ] keep
|
(make-reflection-depthbuffer) [ >>reflection-depthbuffer ] keep
|
||||||
(make-reflection-framebuffer) >>reflection-framebuffer
|
(make-reflection-framebuffer) >>reflection-framebuffer
|
||||||
|
t >>initialized?
|
||||||
drop ;
|
drop ;
|
||||||
|
|
||||||
M: spheres-gadget ungraft* ( gadget -- )
|
M: spheres-gadget ungraft* ( gadget -- )
|
||||||
|
f >>initialized?
|
||||||
dup find-gl-context
|
dup find-gl-context
|
||||||
{
|
{
|
||||||
[ reflection-framebuffer>> [ delete-framebuffer ] when* ]
|
[ reflection-framebuffer>> [ delete-framebuffer ] when* ]
|
||||||
|
@ -238,9 +240,8 @@ M: spheres-gadget pref-dim* ( gadget -- dim )
|
||||||
] bi ;
|
] bi ;
|
||||||
|
|
||||||
: reflection-frustum ( gadget -- -x x -y y near far )
|
: reflection-frustum ( gadget -- -x x -y y near far )
|
||||||
[ near-plane ] [ far-plane ] bi [
|
[ near-plane ] [ far-plane ] bi
|
||||||
drop dup [ -+ ] bi@
|
[ drop dup [ -+ ] bi@ ] 2keep ;
|
||||||
] 2keep ;
|
|
||||||
|
|
||||||
: (reflection-face) ( gadget face -- )
|
: (reflection-face) ( gadget face -- )
|
||||||
swap reflection-texture>> >r >r
|
swap reflection-texture>> >r >r
|
||||||
|
@ -280,7 +281,7 @@ M: spheres-gadget pref-dim* ( gadget -- dim )
|
||||||
[ dim>> 0 0 rot first2 glViewport ]
|
[ dim>> 0 0 rot first2 glViewport ]
|
||||||
} cleave ] with-framebuffer ;
|
} cleave ] with-framebuffer ;
|
||||||
|
|
||||||
M: spheres-gadget draw-gadget* ( gadget -- )
|
: (draw-gadget) ( gadget -- )
|
||||||
GL_DEPTH_TEST glEnable
|
GL_DEPTH_TEST glEnable
|
||||||
GL_SCISSOR_TEST glDisable
|
GL_SCISSOR_TEST glDisable
|
||||||
0.15 0.15 1.0 1.0 glClearColor {
|
0.15 0.15 1.0 1.0 glClearColor {
|
||||||
|
@ -297,6 +298,9 @@ M: spheres-gadget draw-gadget* ( gadget -- )
|
||||||
]
|
]
|
||||||
} cleave ;
|
} cleave ;
|
||||||
|
|
||||||
|
M: spheres-gadget draw-gadget* ( gadget -- )
|
||||||
|
dup initialized?>> [ (draw-gadget) ] [ drop ] if ;
|
||||||
|
|
||||||
: spheres-window ( -- )
|
: spheres-window ( -- )
|
||||||
[ <spheres-gadget> "Spheres" open-window ] with-ui ;
|
[ <spheres-gadget> "Spheres" open-window ] with-ui ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue