class Disp3D::Compass
Public Class Methods
new(camera)
click to toggle source
# File lib/compass.rb, line 5 def initialize(camera) @camera = camera @coord_node = NodeCoord.new(nil, Vector3.new(), coord_size) end
Public Instance Methods
gl_display(current_view)
click to toggle source
# File lib/compass.rb, line 10 def gl_display current_view GL.PushMatrix() GL.LoadIdentity() GL.Translate(coord_pos.x, coord_pos.y, coord_pos.z) @camera.apply_rotate @coord_node.draw current_view GL.PopMatrix() end
update()
click to toggle source
# File lib/compass.rb, line 19 def update @coord_node.length = coord_size end
Private Instance Methods
coord_pos()
click to toggle source
# File lib/compass.rb, line 24 def coord_pos dmy, dmy, screen_width, screen_height = @camera.viewport Vector3.new(-screen_width*0.5 + coord_size*1.5, -screen_height*0.5 + coord_size*1.5, 0.0) end
coord_size()
click to toggle source
# File lib/compass.rb, line 29 def coord_size dmy, dmy, screen_width, screen_height = @camera.viewport coord_size = [screen_width, screen_height].min scalling_factor = 0.1 coord_size *= scalling_factor end