Merge branch 'master' of git://factorcode.org/git/factor
commit
2144fd9abc
|
@ -23,7 +23,9 @@ IN: springies.ui
|
||||||
GL_MODELVIEW glMatrixMode
|
GL_MODELVIEW glMatrixMode
|
||||||
glLoadIdentity ;
|
glLoadIdentity ;
|
||||||
|
|
||||||
: display ( -- ) set-projection black gl-color draw-nodes draw-springs ;
|
! : display ( -- ) set-projection black gl-color draw-nodes draw-springs ;
|
||||||
|
|
||||||
|
: display ( -- ) set-projection black set-color draw-nodes draw-springs ;
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
|
|
@ -22,9 +22,7 @@ TUPLE: cartesian < slate x-min x-max y-min y-max z-min z-max perspective ;
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
M: cartesian draw-gadget* ( cartesian -- )
|
M: cartesian establish-coordinate-system ( cartesian -- cartesian )
|
||||||
GL_PROJECTION glMatrixMode
|
|
||||||
glLoadIdentity
|
|
||||||
dup
|
dup
|
||||||
{
|
{
|
||||||
[ x-min>> ] [ x-max>> ]
|
[ x-min>> ] [ x-max>> ]
|
||||||
|
@ -32,10 +30,7 @@ M: cartesian draw-gadget* ( cartesian -- )
|
||||||
[ z-min>> ] [ z-max>> ]
|
[ z-min>> ] [ z-max>> ]
|
||||||
}
|
}
|
||||||
cleave
|
cleave
|
||||||
glOrtho
|
glOrtho ;
|
||||||
GL_MODELVIEW glMatrixMode
|
|
||||||
glLoadIdentity
|
|
||||||
call-next-method ;
|
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
|
|
@ -47,12 +47,14 @@ M: function plot-function ( plot function -- plot )
|
||||||
[ [ drop 0 ] [ y-min>> ] bi 2array ]
|
[ [ drop 0 ] [ y-min>> ] bi 2array ]
|
||||||
[ [ drop 0 ] [ y-max>> ] bi 2array ] bi line* ;
|
[ [ drop 0 ] [ y-max>> ] bi 2array ] bi line* ;
|
||||||
|
|
||||||
M: plot draw-gadget* ( plot -- )
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
dup call-next-method
|
|
||||||
|
USING: ui.gadgets.slate ;
|
||||||
|
|
||||||
|
M: plot draw-slate ( plot -- plot )
|
||||||
2 glLineWidth
|
2 glLineWidth
|
||||||
draw-axis
|
draw-axis
|
||||||
plot-functions
|
plot-functions
|
||||||
drop
|
|
||||||
fill-mode
|
fill-mode
|
||||||
1 glLineWidth ;
|
1 glLineWidth ;
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,93 @@ TUPLE: slate < gadget action pdim graft ungraft ;
|
||||||
|
|
||||||
M: slate pref-dim* ( slate -- dim ) pdim>> ;
|
M: slate pref-dim* ( slate -- dim ) pdim>> ;
|
||||||
|
|
||||||
M: slate draw-gadget* ( slate -- ) origin get swap action>> with-translation ;
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
USING: combinators arrays sequences math math.geometry
|
||||||
|
opengl.gl ui.gadgets.worlds ;
|
||||||
|
|
||||||
|
: screen-y* ( gadget -- loc )
|
||||||
|
{
|
||||||
|
[ find-world height ]
|
||||||
|
[ screen-loc second ]
|
||||||
|
[ height ]
|
||||||
|
}
|
||||||
|
cleave
|
||||||
|
+ - ;
|
||||||
|
|
||||||
|
: screen-loc* ( gadget -- loc )
|
||||||
|
{
|
||||||
|
[ screen-loc first ]
|
||||||
|
[ screen-y* ]
|
||||||
|
}
|
||||||
|
cleave
|
||||||
|
2array ;
|
||||||
|
|
||||||
|
: setup-viewport ( gadget -- gadget )
|
||||||
|
dup
|
||||||
|
{
|
||||||
|
[ screen-loc* ]
|
||||||
|
[ dim>> ]
|
||||||
|
}
|
||||||
|
cleave
|
||||||
|
gl-viewport ;
|
||||||
|
|
||||||
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
: default-coordinate-system ( gadget -- gadget )
|
||||||
|
dup
|
||||||
|
{
|
||||||
|
[ drop 0 ]
|
||||||
|
[ width 1 - ]
|
||||||
|
[ height 1 - ]
|
||||||
|
[ drop 0 ]
|
||||||
|
}
|
||||||
|
cleave
|
||||||
|
-1 1
|
||||||
|
glOrtho ;
|
||||||
|
|
||||||
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
M: slate graft* ( slate -- ) graft>> call ;
|
M: slate graft* ( slate -- ) graft>> call ;
|
||||||
M: slate ungraft* ( slate -- ) ungraft>> call ;
|
M: slate ungraft* ( slate -- ) ungraft>> call ;
|
||||||
|
|
||||||
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
GENERIC: establish-coordinate-system ( gadget -- gadget )
|
||||||
|
|
||||||
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
M: slate establish-coordinate-system ( slate -- slate )
|
||||||
|
default-coordinate-system ;
|
||||||
|
|
||||||
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
GENERIC: draw-slate ( slate -- slate )
|
||||||
|
|
||||||
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
M: slate draw-slate ( slate -- slate ) dup action>> call ;
|
||||||
|
|
||||||
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
|
M: slate draw-gadget* ( slate -- )
|
||||||
|
|
||||||
|
GL_PROJECTION glMatrixMode glPushMatrix glLoadIdentity
|
||||||
|
|
||||||
|
establish-coordinate-system
|
||||||
|
|
||||||
|
GL_MODELVIEW glMatrixMode glLoadIdentity glPushMatrix
|
||||||
|
|
||||||
|
setup-viewport
|
||||||
|
|
||||||
|
draw-slate
|
||||||
|
|
||||||
|
GL_PROJECTION glMatrixMode glPopMatrix
|
||||||
|
GL_MODELVIEW glMatrixMode glPopMatrix
|
||||||
|
|
||||||
|
dup
|
||||||
|
find-world
|
||||||
|
default-coordinate-system
|
||||||
|
setup-viewport
|
||||||
|
drop
|
||||||
|
drop ;
|
Loading…
Reference in New Issue