load_libraries :planetarium, :control_panel include_package 'codeanticode.planetarium' attr_reader :cube_x, :cube_y, :panel, :hide, :camera, :grid def setup # For the time being, only use square windows size(600, 600, Dome::RENDERER) @camera = DomeCamera.new(self) @hide = false @grid = true control_panel do |c| c.title = "Control" c.look_feel "Metal" c.slider :cube_x, -width / 2.0 .. width / 2.0, -60.0 c.slider :cube_y, -height / 2.0 .. height / 2.0, 60.0 @panel = c end end def mouse_pressed @hide = false if hide # use mouse click to restore control panel end # Called five times per frame. def draw unless hide @hide = true panel.set_visible hide end face = camera.getFace case(face) when DomeCamera::POSITIVE_X background(240, 59, 31) when DomeCamera::NEGATIVE_X background(240, 146, 31) when DomeCamera::POSITIVE_Y background(30, 245, 0) when DomeCamera::NEGATIVE_Y background(30, 232, 156) when DomeCamera::POSITIVE_Z background(52, 148, 206) when DomeCamera::NEGATIVE_Z background(183, 115, 13) end push_matrix translate(width/2, height/2, 300) stroke(255) noFill push_matrix translate(cube_x, cube_y, 0) sphere_detail(8) sphere(30) pop_matrix lines_amount = 10 (0 ... lines_amount).each do |i| ratio = i/(lines_amount - 1.0) line(0, 0, cos(ratio * TWO_PI) * 50, sin(ratio * TWO_PI) * 50) end pop_matrix end def key_pressed @grid = !grid (grid)? camera.set_mode(Dome::GRID) : camera.set_mode(Dome::NORMAL) end
Experiments with ruby-processing (processing-2.2.1) and JRubyArt for processing-3.0
Monday, 9 September 2013
Planetarium calibrate sketch in ruby-processing
Subscribe to:
Post Comments (Atom)
Followers
Blog Archive
-
▼
2013
(94)
-
▼
September
(11)
- Refactored Load Save Json Sketch (To isolate respo...
- Reading and writing RubyStructs to yaml ruby proce...
- Reading and writing to a yaml file ruby-processing
- Reading and writing to a csv file ruby-processing
- Using json in ruby-processing
- Why ruby-processing?
- Gravitational Attraction (3D) Planetarium Sketch (...
- Planetarium calibrate sketch in ruby-processing
- New Improved Planetarium Basic Sketch
- Getting ready for jruby-1.7.5
- Dome Projection Shader
-
▼
September
(11)
About Me
- monkstone
- I have developed JRubyArt and propane new versions of ruby-processing for JRuby-9.1.5.0 and processing-3.2.2
No comments:
Post a Comment