Module: ShatteredController::ClassMethods

Defined in:
lib/state.rb

Instance Method Summary collapse

Instance Method Details

#camera(options = {}) ⇒ Object

In order to set the initial position of the camera, and any other attributes you would like, use the following format.

class CameraTestState < ShatteredController::Base
  camera :position => v(10,0,0), :orientation => [0.5, 0.5, 0.5, 0.5]
end

If you pass a symbol as a value, the symbol will be evaluated.

This allows for things such as:

class CameraTestState < ShatteredController::Base
  camera :position => :camera_position
  def camera_position
    return [rand*10,0,0]
  end
end

The valid options are any public functions within camera that ends in = (such as position=, looking_at=) See ShatteredView::Camera for more.



28
29
30
# File 'lib/state.rb', line 28

def camera(options = {})
  before_init_call( 'camera', options )
end

#sky(type, options = {}) ⇒ Object

This blurs the lines between view and controller. Valid types are [:box]



34
35
36
# File 'lib/state.rb', line 34

def sky(type, options = {})
  before_init_set( "self", { :"sky" => [type, options[:material]] })
end