Merge git://pgdn.org/factor
						commit
						33b26fb0f5
					
				| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
USING: arrays bunny combinators.lib io io.files kernel
 | 
			
		||||
       math math.functions multiline
 | 
			
		||||
       math math.functions multiline continuations debugger
 | 
			
		||||
       opengl opengl.gl opengl-demo-support
 | 
			
		||||
       sequences ui ui.gadgets ui.render ;
 | 
			
		||||
IN: cel-shading
 | 
			
		||||
| 
						 | 
				
			
			@ -58,14 +58,14 @@ main()
 | 
			
		|||
    <simple-gl-program> ;
 | 
			
		||||
 | 
			
		||||
M: cel-shading-gadget graft* ( gadget -- )
 | 
			
		||||
    "2.0" { "GL_ARB_shader_objects" } require-gl-version-or-extensions
 | 
			
		||||
    [ "2.0" { "GL_ARB_shader_objects" } require-gl-version-or-extensions
 | 
			
		||||
    0.0 0.0 0.0 1.0 glClearColor
 | 
			
		||||
    GL_CULL_FACE glEnable
 | 
			
		||||
    GL_DEPTH_TEST glEnable
 | 
			
		||||
    cel-shading-program swap set-cel-shading-gadget-program ;
 | 
			
		||||
    cel-shading-program swap set-cel-shading-gadget-program ] [ ] [ :c ] cleanup ;
 | 
			
		||||
 | 
			
		||||
M: cel-shading-gadget ungraft* ( gadget -- )
 | 
			
		||||
    cel-shading-gadget-program delete-gl-program ;
 | 
			
		||||
    cel-shading-gadget-program [ delete-gl-program ] when* ;
 | 
			
		||||
 | 
			
		||||
: cel-shading-draw-setup ( gadget -- gadget )
 | 
			
		||||
    [ demo-gadget-set-matrices ] keep
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
USING: arrays bunny combinators.lib continuations io io.files kernel
 | 
			
		||||
       math math.functions math.vectors multiline
 | 
			
		||||
       namespaces
 | 
			
		||||
       namespaces debugger
 | 
			
		||||
       opengl opengl.gl opengl-demo-support
 | 
			
		||||
       prettyprint
 | 
			
		||||
       sequences ui ui.gadgets ui.gestures ui.render ;
 | 
			
		||||
| 
						 | 
				
			
			@ -187,7 +187,7 @@ main()
 | 
			
		|||
    ] if ;
 | 
			
		||||
    
 | 
			
		||||
M: line-art-gadget graft* ( gadget -- )
 | 
			
		||||
    "2.0" { "GL_ARB_draw_buffers"
 | 
			
		||||
    [ "2.0" { "GL_ARB_draw_buffers"
 | 
			
		||||
            "GL_ARB_shader_objects"
 | 
			
		||||
            "GL_ARB_multitexture"
 | 
			
		||||
            "GL_ARB_texture_float" }
 | 
			
		||||
| 
						 | 
				
			
			@ -196,16 +196,17 @@ M: line-art-gadget graft* ( gadget -- )
 | 
			
		|||
    GL_CULL_FACE glEnable
 | 
			
		||||
    GL_DEPTH_TEST glEnable
 | 
			
		||||
    (line-art-step1-program) over set-line-art-gadget-step1-program
 | 
			
		||||
    (line-art-step2-program) swap set-line-art-gadget-step2-program ;
 | 
			
		||||
    (line-art-step2-program) swap set-line-art-gadget-step2-program
 | 
			
		||||
    ] [ ] [ :c ] cleanup ;
 | 
			
		||||
 | 
			
		||||
M: line-art-gadget ungraft* ( gadget -- )
 | 
			
		||||
    dup line-art-gadget-framebuffer [
 | 
			
		||||
        { [ line-art-gadget-step1-program delete-gl-program ]
 | 
			
		||||
          [ line-art-gadget-step2-program delete-gl-program ]
 | 
			
		||||
          [ line-art-gadget-framebuffer delete-framebuffer ]
 | 
			
		||||
          [ line-art-gadget-color-texture delete-texture ]
 | 
			
		||||
          [ line-art-gadget-normal-texture delete-texture ]
 | 
			
		||||
          [ line-art-gadget-depth-texture delete-texture ]
 | 
			
		||||
        { [ line-art-gadget-step1-program [ delete-gl-program ] when* ]
 | 
			
		||||
          [ line-art-gadget-step2-program [ delete-gl-program ] when* ]
 | 
			
		||||
          [ line-art-gadget-framebuffer [ delete-framebuffer ] when* ]
 | 
			
		||||
          [ line-art-gadget-color-texture [ delete-texture ] when* ]
 | 
			
		||||
          [ line-art-gadget-normal-texture [ delete-texture ] when* ]
 | 
			
		||||
          [ line-art-gadget-depth-texture [ delete-texture ] when* ]
 | 
			
		||||
          [ f swap set-line-art-gadget-framebuffer-dim ]
 | 
			
		||||
          [ f swap set-line-art-gadget-framebuffer ] } call-with
 | 
			
		||||
    ] [ drop ] if ;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -120,7 +120,9 @@ SYMBOL: ui-hook
 | 
			
		|||
    [ dup update-hand draw-world ] each ;
 | 
			
		||||
 | 
			
		||||
: notify ( gadget -- )
 | 
			
		||||
    dup gadget-graft-state dup first { f f } { t t } ? pick set-gadget-graft-state {
 | 
			
		||||
    dup gadget-graft-state
 | 
			
		||||
    dup first { f f } { t t } ?
 | 
			
		||||
    pick set-gadget-graft-state {
 | 
			
		||||
        { { f t } [ dup activate-control graft* ] }
 | 
			
		||||
        { { t f } [ dup deactivate-control ungraft* ] }
 | 
			
		||||
    } case ;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue