Experiments with ruby-processing (processing-2.2.1) and JRubyArt for processing-3.0

Wednesday, 6 August 2014

Experimenting with a more explicit camera in ruby-processing

def setup
  size 400,400, P3D
  kamera(self,
    {
      x_eye: 200.0,
      y_eye: 200.0,
      z_eye: 800.0,
    }
   # kamera(self, 
    # {
      # x_eye: 200.0, 
      # y_eye: 200.0,
      # z_eye: 800.0, 
      # x_up: 0, 
      # y_up: 1, 
      # z_up: 0, 
      # x_look_at: 0, 
      # y_look_at: 0, 
      # z_look_at: 0
    # }
    )
  end

  def draw
    lights
    rotate_x PI / 4
    rotate_z PI / 6
    box(width / 2, height / 2, width)
  end

  def kamera(app, option = {})
    x_eye = option[:x_eye]
    y_eye = option[:y_eye]
    z_eye = option[:z_eye]
    x_up = option[:x_up] || 0
    y_up = option[:y_up] || 1
    z_up = option[:z_up] || 0
    x_at = option[:x_look_at] || 0
    y_at = option[:y_look_at] || 0
    z_at = option[:z_look_at] || 0
    app.camera(x_eye, y_eye, z_eye, x_at, y_at, z_at, x_up, y_up, z_up)
  end

No comments:

Post a Comment

Followers

Blog Archive

About Me

My photo
I have developed JRubyArt and propane new versions of ruby-processing for JRuby-9.1.5.0 and processing-3.2.2