Sha256: fa270213dc3c0eed3fe0e9e15ddfb03fc65bd97197357de1836997bba41776f9

Contents?: true

Size: 756 Bytes

Versions: 2

Compression:

Stored size: 756 Bytes

Contents

# Directional. 
# 
# Move the mouse the change the direction of the light.
# Directional light comes from one direction and is stronger 
# when hitting a surface squarely and weaker if it hits at a 
# a gentle angle. After hitting a surface, a directional lights 
# scatters in all directions. 

class Directional < Processing::App

  def setup
    
    size 640, 360, P3D
    
    no_stroke
    fill 204
    
  end
  
  def draw
  
  	background 0
  	
  	dir_x = (mouse_x / width.to_f - 0.5) * 2
  	dir_y = (mouse_y / height.to_f - 0.5) * 2
  	
  	directional_light 204, 204, 204, -dir_x, -dir_y, -1
  	
  	translate width/2 - 100, height/2
  	
  	sphere 80
  	
  	translate 200, 0
  	
  	sphere 80
  
  end
  
end

Directional.new :title => "Directional"

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-processing-1.0.11 samples/processing_app/3D/lights/directional.rb
ruby-processing-1.0.10.1 samples/processing_app/3D/lights/directional.rb